X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fpcmcia%2Fds.h;h=8c339f5678cf94c2288b331347a23ed9ddecc494;hb=refs%2Fheads%2Fvserver;hp=8a22fecf1cbd7be16a20963b32b8bd62211cfe82;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 8a22fecf1..8c339f567 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h @@ -1,37 +1,28 @@ /* - * ds.h 1.56 2000/06/12 21:55:40 + * ds.h -- 16-bit PCMCIA core support * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License - * at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and - * limitations under the License. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * * The initial developer of the original code is David A. Hinds * . Portions created by David A. Hinds * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. * - * Alternatively, the contents of this file may be used under the - * terms of the GNU General Public License version 2 (the "GPL"), in which - * case the provisions of the GPL are applicable instead of the - * above. If you wish to allow the use of your version of this file - * only under the terms of the GPL and not to allow others to use - * your version of this file under the MPL, indicate your decision by - * deleting the provisions above and replace them with the notice and - * other provisions required by the GPL. If you do not delete the - * provisions above, a recipient may use your version of this file - * under either the MPL or the GPL. + * (C) 1999 David A. Hinds + * (C) 2003 - 2004 Dominik Brodowski */ #ifndef _LINUX_DS_H #define _LINUX_DS_H +#ifdef __KERNEL__ +#include +#endif + #include #include +#include typedef struct tuple_parse_t { tuple_t tuple; @@ -48,7 +39,7 @@ typedef struct win_info_t { typedef struct bind_info_t { dev_info_t dev_info; u_char function; - struct dev_link_t *instance; + struct pcmcia_device *instance; char name[DEV_NAME_LEN]; u_short major, minor; void *next; @@ -61,7 +52,6 @@ typedef struct mtd_info_t { } mtd_info_t; typedef union ds_ioctl_arg_t { - servinfo_t servinfo; adjust_t adjust; config_info_t config; tuple_t tuple; @@ -77,7 +67,6 @@ typedef union ds_ioctl_arg_t { cisdump_t cisdump; } ds_ioctl_arg_t; -#define DS_GET_CARD_SERVICES_INFO _IOR ('d', 1, servinfo_t) #define DS_ADJUST_RESOURCE_INFO _IOWR('d', 2, adjust_t) #define DS_GET_CONFIGURATION_INFO _IOWR('d', 3, config_info_t) #define DS_GET_FIRST_TUPLE _IOWR('d', 4, tuple_t) @@ -107,6 +96,7 @@ typedef union ds_ioctl_arg_t { #ifdef __KERNEL__ #include +#include typedef struct dev_node_t { char dev_name[DEV_NAME_LEN]; @@ -114,40 +104,19 @@ typedef struct dev_node_t { struct dev_node_t *next; } dev_node_t; -typedef struct dev_link_t { - dev_node_t *dev; - u_int state, open; - wait_queue_head_t pending; - client_handle_t handle; - io_req_t io; - irq_req_t irq; - config_req_t conf; - window_handle_t win; - void *priv; - struct dev_link_t *next; -} dev_link_t; - -/* Flags for device state */ -#define DEV_PRESENT 0x01 -#define DEV_CONFIG 0x02 -#define DEV_STALE_CONFIG 0x04 /* release on close */ -#define DEV_STALE_LINK 0x08 /* detach on release */ -#define DEV_CONFIG_PENDING 0x10 -#define DEV_RELEASE_PENDING 0x20 -#define DEV_SUSPEND 0x40 -#define DEV_BUSY 0x80 - -#define DEV_OK(l) \ - ((l) && ((l->state & ~DEV_BUSY) == (DEV_CONFIG|DEV_PRESENT))) - - -extern struct bus_type pcmcia_bus_type; + +struct pcmcia_socket; +struct config_t; struct pcmcia_driver { - int use_count; - dev_link_t *(*attach)(void); - void (*detach)(dev_link_t *); + int (*probe) (struct pcmcia_device *dev); + void (*remove) (struct pcmcia_device *dev); + + int (*suspend) (struct pcmcia_device *dev); + int (*resume) (struct pcmcia_device *dev); + struct module *owner; + struct pcmcia_device_id *id_table; struct device_driver drv; }; @@ -155,8 +124,78 @@ struct pcmcia_driver { int pcmcia_register_driver(struct pcmcia_driver *driver); void pcmcia_unregister_driver(struct pcmcia_driver *driver); + +struct pcmcia_device { + /* the socket and the device_no [for multifunction devices] + uniquely define a pcmcia_device */ + struct pcmcia_socket *socket; + + char *devname; + + u8 device_no; + + /* the hardware "function" device; certain subdevices can + * share one hardware "function" device. */ + u8 func; + struct config_t* function_config; + + struct list_head socket_device_list; + + /* deprecated, will be cleaned up soon */ + dev_node_t *dev_node; + u_int open; + io_req_t io; + irq_req_t irq; + config_req_t conf; + window_handle_t win; + + /* Is the device suspended, or in the process of + * being removed? */ + u16 suspended:1; + u16 _removed:1; + + /* Flags whether io, irq, win configurations were + * requested, and whether the configuration is "locked" */ + u16 _irq:1; + u16 _io:1; + u16 _win:4; + u16 _locked:1; + + /* Flag whether a "fuzzy" func_id based match is + * allowed. */ + u16 allow_func_id_match:1; + + /* information about this device */ + u16 has_manf_id:1; + u16 has_card_id:1; + u16 has_func_id:1; + + u16 reserved:3; + + u8 func_id; + u16 manf_id; + u16 card_id; + + char * prod_id[4]; + + struct device dev; + +#ifdef CONFIG_PCMCIA_IOCTL + /* device driver wanted by cardmgr */ + struct pcmcia_driver * cardmgr; +#endif + + /* data private to drivers */ + void *priv; +}; + +#define to_pcmcia_dev(n) container_of(n, struct pcmcia_device, dev) +#define to_pcmcia_drv(n) container_of(n, struct pcmcia_driver, drv) + +#define handle_to_dev(handle) (handle->dev) + /* error reporting */ -void cs_error(client_handle_t handle, int func, int ret); +void cs_error(struct pcmcia_device *handle, int func, int ret); #endif /* __KERNEL__ */ #endif /* _LINUX_DS_H */