2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* ds.h -- 16-bit PCMCIA core support
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
|
|
|
|
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* (C) 1999 David A. Hinds
|
|
|
|
* (C) 2003 - 2004 Dominik Brodowski
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _LINUX_DS_H
|
|
|
|
#define _LINUX_DS_H
|
|
|
|
|
2005-07-13 00:58:14 +04:00
|
|
|
#ifdef __KERNEL__
|
|
|
|
#include <linux/mod_devicetable.h>
|
|
|
|
#endif
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <pcmcia/bulkmem.h>
|
|
|
|
#include <pcmcia/cs_types.h>
|
2005-06-28 03:28:06 +04:00
|
|
|
#include <pcmcia/device_id.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
typedef struct tuple_parse_t {
|
|
|
|
tuple_t tuple;
|
|
|
|
cisdata_t data[255];
|
|
|
|
cisparse_t parse;
|
|
|
|
} tuple_parse_t;
|
|
|
|
|
|
|
|
typedef struct win_info_t {
|
|
|
|
window_handle_t handle;
|
|
|
|
win_req_t window;
|
|
|
|
memreq_t map;
|
|
|
|
} win_info_t;
|
|
|
|
|
|
|
|
typedef struct bind_info_t {
|
|
|
|
dev_info_t dev_info;
|
|
|
|
u_char function;
|
2006-03-05 12:45:09 +03:00
|
|
|
struct pcmcia_device *instance;
|
2005-04-17 02:20:36 +04:00
|
|
|
char name[DEV_NAME_LEN];
|
|
|
|
u_short major, minor;
|
|
|
|
void *next;
|
|
|
|
} bind_info_t;
|
|
|
|
|
|
|
|
typedef struct mtd_info_t {
|
|
|
|
dev_info_t dev_info;
|
|
|
|
u_int Attributes;
|
|
|
|
u_int CardOffset;
|
|
|
|
} mtd_info_t;
|
|
|
|
|
|
|
|
typedef union ds_ioctl_arg_t {
|
|
|
|
adjust_t adjust;
|
|
|
|
config_info_t config;
|
|
|
|
tuple_t tuple;
|
|
|
|
tuple_parse_t tuple_parse;
|
|
|
|
client_req_t client_req;
|
|
|
|
cs_status_t status;
|
|
|
|
conf_reg_t conf_reg;
|
|
|
|
cisinfo_t cisinfo;
|
|
|
|
region_info_t region;
|
|
|
|
bind_info_t bind_info;
|
|
|
|
mtd_info_t mtd_info;
|
|
|
|
win_info_t win_info;
|
|
|
|
cisdump_t cisdump;
|
|
|
|
} ds_ioctl_arg_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)
|
|
|
|
#define DS_GET_NEXT_TUPLE _IOWR('d', 5, tuple_t)
|
|
|
|
#define DS_GET_TUPLE_DATA _IOWR('d', 6, tuple_parse_t)
|
|
|
|
#define DS_PARSE_TUPLE _IOWR('d', 7, tuple_parse_t)
|
|
|
|
#define DS_RESET_CARD _IO ('d', 8)
|
|
|
|
#define DS_GET_STATUS _IOWR('d', 9, cs_status_t)
|
|
|
|
#define DS_ACCESS_CONFIGURATION_REGISTER _IOWR('d', 10, conf_reg_t)
|
|
|
|
#define DS_VALIDATE_CIS _IOR ('d', 11, cisinfo_t)
|
|
|
|
#define DS_SUSPEND_CARD _IO ('d', 12)
|
|
|
|
#define DS_RESUME_CARD _IO ('d', 13)
|
|
|
|
#define DS_EJECT_CARD _IO ('d', 14)
|
|
|
|
#define DS_INSERT_CARD _IO ('d', 15)
|
|
|
|
#define DS_GET_FIRST_REGION _IOWR('d', 16, region_info_t)
|
|
|
|
#define DS_GET_NEXT_REGION _IOWR('d', 17, region_info_t)
|
|
|
|
#define DS_REPLACE_CIS _IOWR('d', 18, cisdump_t)
|
|
|
|
#define DS_GET_FIRST_WINDOW _IOR ('d', 19, win_info_t)
|
|
|
|
#define DS_GET_NEXT_WINDOW _IOWR('d', 20, win_info_t)
|
|
|
|
#define DS_GET_MEM_PAGE _IOWR('d', 21, win_info_t)
|
|
|
|
|
|
|
|
#define DS_BIND_REQUEST _IOWR('d', 60, bind_info_t)
|
|
|
|
#define DS_GET_DEVICE_INFO _IOWR('d', 61, bind_info_t)
|
|
|
|
#define DS_GET_NEXT_DEVICE _IOWR('d', 62, bind_info_t)
|
|
|
|
#define DS_UNBIND_REQUEST _IOW ('d', 63, bind_info_t)
|
|
|
|
#define DS_BIND_MTD _IOWR('d', 64, mtd_info_t)
|
|
|
|
|
|
|
|
#ifdef __KERNEL__
|
|
|
|
#include <linux/device.h>
|
2006-03-02 02:09:29 +03:00
|
|
|
#include <pcmcia/ss.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
typedef struct dev_node_t {
|
|
|
|
char dev_name[DEV_NAME_LEN];
|
|
|
|
u_short major, minor;
|
|
|
|
struct dev_node_t *next;
|
|
|
|
} dev_node_t;
|
|
|
|
|
|
|
|
|
|
|
|
struct pcmcia_socket;
|
2006-01-10 22:41:27 +03:00
|
|
|
struct config_t;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2007-05-07 01:48:44 +04:00
|
|
|
struct pcmcia_dynids {
|
|
|
|
spinlock_t lock;
|
|
|
|
struct list_head list;
|
|
|
|
};
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
struct pcmcia_driver {
|
2005-11-14 23:25:51 +03:00
|
|
|
int (*probe) (struct pcmcia_device *dev);
|
2005-11-14 23:23:14 +03:00
|
|
|
void (*remove) (struct pcmcia_device *dev);
|
|
|
|
|
2005-11-14 23:21:18 +03:00
|
|
|
int (*suspend) (struct pcmcia_device *dev);
|
|
|
|
int (*resume) (struct pcmcia_device *dev);
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
struct module *owner;
|
2005-06-28 03:28:06 +04:00
|
|
|
struct pcmcia_device_id *id_table;
|
2005-04-17 02:20:36 +04:00
|
|
|
struct device_driver drv;
|
2007-05-07 01:48:44 +04:00
|
|
|
struct pcmcia_dynids dynids;
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/* driver registration */
|
|
|
|
int pcmcia_register_driver(struct pcmcia_driver *driver);
|
|
|
|
void pcmcia_unregister_driver(struct pcmcia_driver *driver);
|
|
|
|
|
2006-03-02 02:09:29 +03:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
struct pcmcia_device {
|
|
|
|
/* the socket and the device_no [for multifunction devices]
|
|
|
|
uniquely define a pcmcia_device */
|
|
|
|
struct pcmcia_socket *socket;
|
|
|
|
|
2005-09-10 00:03:29 +04:00
|
|
|
char *devname;
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
u8 device_no;
|
|
|
|
|
|
|
|
/* the hardware "function" device; certain subdevices can
|
|
|
|
* share one hardware "function" device. */
|
|
|
|
u8 func;
|
2006-01-10 22:41:27 +03:00
|
|
|
struct config_t* function_config;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
struct list_head socket_device_list;
|
|
|
|
|
2006-03-05 12:45:09 +03:00
|
|
|
/* 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;
|
|
|
|
|
2006-03-05 13:04:33 +03:00
|
|
|
/* Is the device suspended, or in the process of
|
|
|
|
* being removed? */
|
2006-03-02 02:09:29 +03:00
|
|
|
u16 suspended:1;
|
2006-03-05 13:04:33 +03:00
|
|
|
u16 _removed:1;
|
2006-03-02 02:09:29 +03:00
|
|
|
|
|
|
|
/* 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;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2006-03-02 02:09:29 +03:00
|
|
|
/* Flag whether a "fuzzy" func_id based match is
|
|
|
|
* allowed. */
|
|
|
|
u16 allow_func_id_match:1;
|
2006-01-20 17:10:23 +03:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/* information about this device */
|
2006-03-02 02:09:29 +03:00
|
|
|
u16 has_manf_id:1;
|
|
|
|
u16 has_card_id:1;
|
|
|
|
u16 has_func_id:1;
|
2005-06-28 03:28:06 +04:00
|
|
|
|
2006-03-05 13:04:33 +03:00
|
|
|
u16 reserved:3;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
u8 func_id;
|
|
|
|
u16 manf_id;
|
|
|
|
u16 card_id;
|
|
|
|
|
|
|
|
char * prod_id[4];
|
|
|
|
|
2007-10-16 12:23:58 +04:00
|
|
|
u64 dma_mask;
|
2006-01-15 03:14:31 +03:00
|
|
|
struct device dev;
|
|
|
|
|
|
|
|
#ifdef CONFIG_PCMCIA_IOCTL
|
2005-04-17 02:20:36 +04:00
|
|
|
/* device driver wanted by cardmgr */
|
|
|
|
struct pcmcia_driver * cardmgr;
|
2006-01-15 03:14:31 +03:00
|
|
|
#endif
|
2006-03-02 02:09:29 +03:00
|
|
|
|
|
|
|
/* data private to drivers */
|
|
|
|
void *priv;
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#define to_pcmcia_dev(n) container_of(n, struct pcmcia_device, dev)
|
|
|
|
#define to_pcmcia_drv(n) container_of(n, struct pcmcia_driver, drv)
|
|
|
|
|
2005-07-08 04:59:01 +04:00
|
|
|
#define handle_to_dev(handle) (handle->dev)
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* error reporting */
|
2006-03-31 19:21:06 +04:00
|
|
|
void cs_error(struct pcmcia_device *handle, int func, int ret);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
#endif /* __KERNEL__ */
|
|
|
|
#endif /* _LINUX_DS_H */
|