2005-05-30 08:28:49 +04:00
|
|
|
/* $NetBSD: pcmciachip.h,v 1.12 2005/05/30 04:28:49 christos Exp $ */
|
1997-10-17 03:27:16 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1997 Marc Horowitz. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by Marc Horowitz.
|
|
|
|
* 4. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _PCMCIA_PCMCIACHIP_H_
|
|
|
|
#define _PCMCIA_PCMCIACHIP_H_
|
|
|
|
|
|
|
|
#include <machine/bus.h>
|
|
|
|
|
|
|
|
struct pcmcia_function;
|
|
|
|
struct pcmcia_mem_handle;
|
|
|
|
struct pcmcia_io_handle;
|
|
|
|
|
|
|
|
/* interfaces for pcmcia to call the chipset */
|
|
|
|
|
|
|
|
typedef struct pcmcia_chip_functions *pcmcia_chipset_tag_t;
|
|
|
|
typedef void *pcmcia_chipset_handle_t;
|
|
|
|
typedef int pcmcia_mem_handle_t;
|
|
|
|
|
|
|
|
#define PCMCIA_MEM_ATTR 1
|
|
|
|
#define PCMCIA_MEM_COMMON 2
|
|
|
|
|
2000-01-13 11:58:51 +03:00
|
|
|
#define PCMCIA_WIDTH_MEM8 8
|
|
|
|
#define PCMCIA_WIDTH_MEM16 16
|
|
|
|
|
|
|
|
#define PCMCIA_WIDTH_MEM_MASK 24
|
|
|
|
|
1997-10-17 03:27:16 +04:00
|
|
|
#define PCMCIA_WIDTH_AUTO 0
|
|
|
|
#define PCMCIA_WIDTH_IO8 1
|
|
|
|
#define PCMCIA_WIDTH_IO16 2
|
|
|
|
|
|
|
|
struct pcmcia_chip_functions {
|
|
|
|
/* memory space allocation */
|
2005-02-04 05:10:35 +03:00
|
|
|
int (*mem_alloc)(pcmcia_chipset_handle_t, bus_size_t,
|
|
|
|
struct pcmcia_mem_handle *);
|
|
|
|
void (*mem_free)(pcmcia_chipset_handle_t,
|
|
|
|
struct pcmcia_mem_handle *);
|
1997-10-17 03:27:16 +04:00
|
|
|
|
|
|
|
/* memory space window mapping */
|
2005-02-04 05:10:35 +03:00
|
|
|
int (*mem_map)(pcmcia_chipset_handle_t, int, bus_addr_t,
|
1997-10-17 03:27:16 +04:00
|
|
|
bus_size_t, struct pcmcia_mem_handle *,
|
2005-02-04 05:10:35 +03:00
|
|
|
bus_size_t *, int *);
|
|
|
|
void (*mem_unmap)(pcmcia_chipset_handle_t, int);
|
1997-10-17 03:27:16 +04:00
|
|
|
|
|
|
|
/* I/O space allocation */
|
2005-02-04 05:10:35 +03:00
|
|
|
int (*io_alloc)(pcmcia_chipset_handle_t, bus_addr_t,
|
|
|
|
bus_size_t, bus_size_t, struct pcmcia_io_handle *);
|
|
|
|
void (*io_free)(pcmcia_chipset_handle_t,
|
|
|
|
struct pcmcia_io_handle *);
|
1997-10-17 03:27:16 +04:00
|
|
|
|
|
|
|
/* I/O space window mapping */
|
2005-02-04 05:10:35 +03:00
|
|
|
int (*io_map)(pcmcia_chipset_handle_t, int, bus_addr_t,
|
|
|
|
bus_size_t, struct pcmcia_io_handle *, int *);
|
|
|
|
void (*io_unmap)(pcmcia_chipset_handle_t, int);
|
1997-10-17 03:27:16 +04:00
|
|
|
|
|
|
|
/* interrupt glue */
|
2005-02-04 05:10:35 +03:00
|
|
|
void *(*intr_establish)(pcmcia_chipset_handle_t,
|
|
|
|
struct pcmcia_function *, int, int (*)(void *), void *);
|
|
|
|
void (*intr_disestablish)(pcmcia_chipset_handle_t, void *);
|
1997-10-17 03:27:16 +04:00
|
|
|
|
|
|
|
/* card enable/disable */
|
2005-02-04 05:10:35 +03:00
|
|
|
void (*socket_enable)(pcmcia_chipset_handle_t);
|
|
|
|
void (*socket_disable)(pcmcia_chipset_handle_t);
|
|
|
|
void (*socket_settype)(pcmcia_chipset_handle_t, int);
|
1999-10-15 10:07:17 +04:00
|
|
|
|
|
|
|
/* card detection */
|
2005-02-27 03:26:58 +03:00
|
|
|
int (*card_detect)(pcmcia_chipset_handle_t);
|
1997-10-17 03:27:16 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Memory space functions. */
|
|
|
|
#define pcmcia_chip_mem_alloc(tag, handle, size, pcmhp) \
|
|
|
|
((*(tag)->mem_alloc)((handle), (size), (pcmhp)))
|
|
|
|
|
|
|
|
#define pcmcia_chip_mem_free(tag, handle, pcmhp) \
|
|
|
|
((*(tag)->mem_free)((handle), (pcmhp)))
|
|
|
|
|
|
|
|
#define pcmcia_chip_mem_map(tag, handle, kind, card_addr, size, pcmhp, \
|
|
|
|
offsetp, windowp) \
|
|
|
|
((*(tag)->mem_map)((handle), (kind), (card_addr), (size), (pcmhp), \
|
|
|
|
(offsetp), (windowp)))
|
|
|
|
|
|
|
|
#define pcmcia_chip_mem_unmap(tag, handle, window) \
|
|
|
|
((*(tag)->mem_unmap)((handle), (window)))
|
|
|
|
|
|
|
|
/* I/O space functions. */
|
|
|
|
#define pcmcia_chip_io_alloc(tag, handle, start, size, align, pcihp) \
|
|
|
|
((*(tag)->io_alloc)((handle), (start), (size), (align), (pcihp)))
|
|
|
|
|
|
|
|
#define pcmcia_chip_io_free(tag, handle, pcihp) \
|
|
|
|
((*(tag)->io_free)((handle), (pcihp)))
|
|
|
|
|
|
|
|
#define pcmcia_chip_io_map(tag, handle, width, card_addr, size, pcihp, \
|
|
|
|
windowp) \
|
|
|
|
((*(tag)->io_map)((handle), (width), (card_addr), (size), (pcihp), \
|
|
|
|
(windowp)))
|
|
|
|
|
|
|
|
#define pcmcia_chip_io_unmap(tag, handle, window) \
|
|
|
|
((*(tag)->io_unmap)((handle), (window)))
|
|
|
|
|
|
|
|
/* Interrupt functions. */
|
|
|
|
#define pcmcia_chip_intr_establish(tag, handle, pf, ipl, fct, arg) \
|
|
|
|
((*(tag)->intr_establish)((handle), (pf), (ipl), (fct), (arg)))
|
|
|
|
|
|
|
|
#define pcmcia_chip_intr_disestablish(tag, handle, ih) \
|
|
|
|
((*(tag)->intr_disestablish)((handle), (ih)))
|
|
|
|
|
|
|
|
/* Socket functions. */
|
|
|
|
#define pcmcia_chip_socket_enable(tag, handle) \
|
|
|
|
((*(tag)->socket_enable)((handle)))
|
|
|
|
#define pcmcia_chip_socket_disable(tag, handle) \
|
|
|
|
((*(tag)->socket_disable)((handle)))
|
2004-08-11 04:18:18 +04:00
|
|
|
#define pcmcia_chip_socket_settype(tag, handle, type) \
|
|
|
|
((*(tag)->socket_settype)((handle), (type)))
|
1997-10-17 03:27:16 +04:00
|
|
|
|
|
|
|
struct pcmciabus_attach_args {
|
2005-05-30 08:28:49 +04:00
|
|
|
const char *paa_busname; /* Bus name */
|
1997-10-17 03:27:16 +04:00
|
|
|
pcmcia_chipset_tag_t pct;
|
|
|
|
pcmcia_chipset_handle_t pch;
|
|
|
|
bus_addr_t iobase; /* start i/o space allocation here */
|
|
|
|
bus_size_t iosize; /* size of the i/o space range */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* interfaces for the chipset to call pcmcia */
|
|
|
|
|
2005-02-04 05:10:35 +03:00
|
|
|
int pcmcia_card_attach(struct device *);
|
|
|
|
void pcmcia_card_detach(struct device *, int);
|
|
|
|
void pcmcia_card_deactivate(struct device *);
|
1997-10-17 03:27:16 +04:00
|
|
|
|
|
|
|
#endif /* _PCMCIA_PCMCIACHIP_H_ */
|