Merge branch 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/linville...
[safe/jmp/linux-2.6] / include / pcmcia / ds.h
index 279df0f..ee14857 100644 (file)
@@ -34,6 +34,7 @@
 struct pcmcia_socket;
 struct pcmcia_device;
 struct config_t;
+struct net_device;
 
 /* dynamic device IDs for PCMCIA device drivers. See
  * Documentation/pcmcia/driver.txt for details.
@@ -81,7 +82,7 @@ struct pcmcia_device {
        /* the hardware "function" device; certain subdevices can
         * share one hardware "function" device. */
        u8                      func;
-       struct config_t*        function_config;
+       struct config_t         *function_config;
 
        struct list_head        socket_device_list;
 
@@ -120,14 +121,14 @@ struct pcmcia_device {
        u16                     manf_id;
        u16                     card_id;
 
-       char *                  prod_id[4];
+       char                    *prod_id[4];
 
        u64                     dma_mask;
        struct device           dev;
 
 #ifdef CONFIG_PCMCIA_IOCTL
        /* device driver wanted by cardmgr */
-       struct pcmcia_driver *  cardmgr;
+       struct pcmcia_driver    *cardmgr;
 #endif
 
        /* data private to drivers */
@@ -137,26 +138,72 @@ struct pcmcia_device {
 #define to_pcmcia_dev(n) container_of(n, struct pcmcia_device, dev)
 #define to_pcmcia_drv(n) container_of(n, struct pcmcia_driver, drv)
 
-/* deprecated -- don't use! */
-#define handle_to_dev(handle) (handle->dev)
 
-
-/* (deprecated) error reporting by PCMCIA devices. Use dev_printk()
- * or dev_dbg() directly in the driver, without referring to pcmcia_error_func()
- * and/or pcmcia_error_ret() for those functions will go away soon.
+/*
+ * CIS access.
+ *
+ * Please use the following functions to access CIS tuples:
+ * - pcmcia_get_tuple()
+ * - pcmcia_loop_tuple()
+ * - pcmcia_get_mac_from_cis()
+ *
+ * To parse a tuple_t, pcmcia_parse_tuple() exists. Its interface
+ * might change in future.
  */
 
-const char *pcmcia_error_func(int func);
-const char *pcmcia_error_ret(int ret);
+/* get the very first CIS entry of type @code. Note that buf is pointer
+ * to u8 *buf; and that you need to kfree(buf) afterwards. */
+size_t pcmcia_get_tuple(struct pcmcia_device *p_dev, cisdata_t code,
+                       u8 **buf);
+
+/* loop over CIS entries */
+int pcmcia_loop_tuple(struct pcmcia_device *p_dev, cisdata_t code,
+                     int (*loop_tuple) (struct pcmcia_device *p_dev,
+                                        tuple_t *tuple,
+                                        void *priv_data),
+                     void *priv_data);
+
+/* get the MAC address from CISTPL_FUNCE */
+int pcmcia_get_mac_from_cis(struct pcmcia_device *p_dev,
+                           struct net_device *dev);
+
+
+/* parse a tuple_t */
+int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse);
+
+/* loop CIS entries for valid configuration */
+int pcmcia_loop_config(struct pcmcia_device *p_dev,
+                      int      (*conf_check)   (struct pcmcia_device *p_dev,
+                                                cistpl_cftable_entry_t *cf,
+                                                cistpl_cftable_entry_t *dflt,
+                                                unsigned int vcc,
+                                                void *priv_data),
+                      void *priv_data);
 
-#define cs_error(p_dev, func, ret)                     \
-       {                                               \
-               dev_printk(KERN_NOTICE, &p_dev->dev,    \
-                          "%s : %s\n",                 \
-                          pcmcia_error_func(func),     \
-                          pcmcia_error_ret(ret));      \
-       }
+/* is the device still there? */
+struct pcmcia_device *pcmcia_dev_present(struct pcmcia_device *p_dev);
 
+/* low-level interface reset */
+int pcmcia_reset_card(struct pcmcia_socket *skt);
+
+/* CIS config */
+int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
+                                        conf_reg_t *reg);
+
+/* device configuration */
+int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req);
+int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req);
+int pcmcia_request_configuration(struct pcmcia_device *p_dev,
+                                config_req_t *req);
+
+int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req,
+                         window_handle_t *wh);
+int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t win);
+int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t win,
+                       memreq_t *req);
+
+int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod);
+void pcmcia_disable_device(struct pcmcia_device *p_dev);
 
 #endif /* __KERNEL__ */
 
@@ -294,6 +341,17 @@ typedef struct config_info_t {
        u_int                   IOAddrLines;
 } config_info_t;
 
+/* For ValidateCIS */
+typedef struct cisinfo_t {
+       u_int                   Chains;
+} cisinfo_t;
+
+typedef struct cs_status_t {
+       u_char                  Function;
+       event_t                 CardState;
+       event_t                 SocketState;
+} cs_status_t;
+
 typedef union ds_ioctl_arg_t {
        adjust_t                adjust;
        config_info_t           config;
@@ -341,6 +399,15 @@ typedef union ds_ioctl_arg_t {
 /* used in userspace only */
 #define CS_IN_USE                      0x1e
 
+#define INFO_MASTER_CLIENT     0x01
+#define INFO_IO_CLIENT         0x02
+#define INFO_MTD_CLIENT                0x04
+#define INFO_MEM_CLIENT                0x08
+#define MAX_NUM_CLIENTS                3
+
+#define INFO_CARD_SHARE                0x10
+#define INFO_CARD_EXCL         0x20
+
 
 #endif /* !defined(__KERNEL__) || defined(CONFIG_PCMCIA_IOCTL) */