x86: fix header export, asm-x86/processor-flags.h, CONFIG_* leaks
[safe/jmp/linux-2.6] / include / pcmcia / ss.h
index f879776..ed919dd 100644 (file)
 #ifndef _LINUX_SS_H
 #define _LINUX_SS_H
 
+#include <linux/device.h>
+#include <linux/sched.h>       /* task_struct, completion */
+#include <linux/mutex.h>
+
 #include <pcmcia/cs_types.h>
 #include <pcmcia/cs.h>
-#include <pcmcia/bulkmem.h>
-#include <linux/device.h>
+#ifdef CONFIG_CARDBUS
+#include <linux/pci.h>
+#endif
 
 /* Definitions for card status flags for GetStatus */
 #define SS_WRPROT      0x0001
@@ -86,7 +91,7 @@ typedef struct pccard_io_map {
     u_char     map;
     u_char     flags;
     u_short    speed;
-    kio_addr_t start, stop;
+    u_int      start, stop;
 } pccard_io_map;
 
 typedef struct pccard_mem_map {
@@ -112,16 +117,14 @@ struct pcmcia_socket;
 struct pccard_operations {
        int (*init)(struct pcmcia_socket *sock);
        int (*suspend)(struct pcmcia_socket *sock);
-       int (*register_callback)(struct pcmcia_socket *sock, void (*handler)(void *, unsigned int), void * info);
        int (*get_status)(struct pcmcia_socket *sock, u_int *value);
-       int (*get_socket)(struct pcmcia_socket *sock, socket_state_t *state);
        int (*set_socket)(struct pcmcia_socket *sock, socket_state_t *state);
        int (*set_io_map)(struct pcmcia_socket *sock, struct pccard_io_map *io);
        int (*set_mem_map)(struct pcmcia_socket *sock, struct pccard_mem_map *mem);
 };
 
 struct pccard_resource_ops {
-       void    (*validate_mem)         (struct pcmcia_socket *s);
+       int     (*validate_mem)         (struct pcmcia_socket *s);
        int     (*adjust_io_region)     (struct resource *res,
                                         unsigned long r_start,
                                         unsigned long r_end,
@@ -132,8 +135,14 @@ struct pccard_resource_ops {
        struct resource* (*find_mem)    (unsigned long base, unsigned long num,
                                         unsigned long align, int low,
                                         struct pcmcia_socket *s);
-       int     (*adjust_resource)      (struct pcmcia_socket *s,
-                                        adjust_t *adj);
+       int     (*add_io)               (struct pcmcia_socket *s,
+                                        unsigned int action,
+                                        unsigned long r_start,
+                                        unsigned long r_end);
+       int     (*add_mem)              (struct pcmcia_socket *s,
+                                        unsigned int action,
+                                        unsigned long r_start,
+                                        unsigned long r_end);
        int     (*init)                 (struct pcmcia_socket *s);
        void    (*exit)                 (struct pcmcia_socket *s);
 };
@@ -142,15 +151,16 @@ extern struct pccard_resource_ops pccard_static_ops;
 /* !SS_CAP_STATIC_MAP */
 extern struct pccard_resource_ops pccard_nonstatic_ops;
 
+/* static mem, dynamic IO sockets */
+extern struct pccard_resource_ops pccard_iodyn_ops;
+
 /*
  *  Calls to set up low-level "Socket Services" drivers
  */
 struct pcmcia_socket;
 
 typedef struct io_window_t {
-       u_int                   Attributes;
-       kio_addr_t              BasePort, NumPorts;
-       kio_addr_t              InUse, Config;
+       u_int                   InUse, Config;
        struct resource         *res;
 } io_window_t;
 
@@ -158,7 +168,7 @@ typedef struct io_window_t {
 typedef struct window_t {
        u_short                 magic;
        u_short                 index;
-       client_handle_t         handle;
+       struct pcmcia_device    *handle;
        struct pcmcia_socket    *sock;
        pccard_mem_map          ctl;
 } window_t;
@@ -171,7 +181,7 @@ typedef struct window_t {
 
 struct config_t;
 struct pcmcia_callback;
-
+struct user_info_t;
 
 struct pcmcia_socket {
        struct module                   *owner;
@@ -182,7 +192,6 @@ struct pcmcia_socket {
        u_short                         lock_count;
        pccard_mem_map                  cis_mem;
        void __iomem                    *cis_virt;
-       struct config_t                 *config;
        struct {
                u_int                   AssignedIRQ;
                u_int                   Config;
@@ -204,7 +213,7 @@ struct pcmcia_socket {
        u_int                           features;
        u_int                           irq_mask;
        u_int                           map_size;
-       kio_addr_t                      io_offset;
+       u_int                           io_offset;
        u_char                          pci_irq;
        struct pci_dev *                cb_dev;
 
@@ -231,20 +240,47 @@ struct pcmcia_socket {
 
        /* so is power hook */
        int (*power_hook)(struct pcmcia_socket *sock, int operation);
-                           
+#ifdef CONFIG_CARDBUS
+       /* allows tuning the CB bridge before loading driver for the CB card */
+       void (*tune_bridge)(struct pcmcia_socket *sock, struct pci_bus *bus);
+#endif
+
        /* state thread */
-       struct semaphore                skt_sem;        /* protects socket h/w state */
+       struct mutex                    skt_mutex;      /* protects socket h/w state */
 
        struct task_struct              *thread;
        struct completion               thread_done;
-       wait_queue_head_t               thread_wait;
        spinlock_t                      thread_lock;    /* protects thread_events */
        unsigned int                    thread_events;
 
        /* pcmcia (16-bit) */
-       struct pcmcia_bus_socket        *pcmcia;
        struct pcmcia_callback          *callback;
 
+#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
+       struct list_head                devices_list;   /*  PCMCIA devices */
+       u8                              device_count;   /* the number of devices, used
+                                                        * only internally and subject
+                                                        * to incorrectness and change */
+
+       struct {
+               u8                      present:1,      /* PCMCIA card is present in socket */
+                                       busy:1,         /* "master" ioctl is used */
+                                       dead:1,         /* pcmcia module is being unloaded */
+                                       device_add_pending:1, /* a multifunction-device
+                                                              * add event is pending */
+                                       mfc_pfc:1,      /* the pending event adds a mfc (1) or pfc (0) */
+                                       reserved:3;
+       }                               pcmcia_state;
+
+       struct work_struct              device_add;     /* for adding further pseudo-multifunction
+                                                        * devices */
+
+#ifdef CONFIG_PCMCIA_IOCTL
+       struct user_info_t              *user;
+       wait_queue_head_t               queue;
+#endif
+#endif
+
        /* cardbus (32-bit) */
 #ifdef CONFIG_CARDBUS
        struct resource *               cb_cis_res;
@@ -252,7 +288,7 @@ struct pcmcia_socket {
 #endif
 
        /* socket device */
-       struct class_device             dev;
+       struct device                   dev;
        void                            *driver_data;   /* data internal to the socket driver */
 
 };