Annotation of Gnu-Mach/linux/pcmcia-cs/modules/cs_internal.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * cs_internal.h 1.58 2004/04/25 17:58:22
        !             3:  *
        !             4:  * The contents of this file are subject to the Mozilla Public License
        !             5:  * Version 1.1 (the "License"); you may not use this file except in
        !             6:  * compliance with the License. You may obtain a copy of the License
        !             7:  * at http://www.mozilla.org/MPL/
        !             8:  *
        !             9:  * Software distributed under the License is distributed on an "AS IS"
        !            10:  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
        !            11:  * the License for the specific language governing rights and
        !            12:  * limitations under the License. 
        !            13:  *
        !            14:  * The initial developer of the original code is David A. Hinds
        !            15:  * <[email protected]>.  Portions created by David A. Hinds
        !            16:  *  are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
        !            17:  *
        !            18:  * Alternatively, the contents of this file may be used under the
        !            19:  * terms of the GNU General Public License version 2 (the "GPL"), in
        !            20:  * which case the provisions of the GPL are applicable instead of the
        !            21:  * above.  If you wish to allow the use of your version of this file
        !            22:  * only under the terms of the GPL and not to allow others to use
        !            23:  * your version of this file under the MPL, indicate your decision by
        !            24:  * deleting the provisions above and replace them with the notice and
        !            25:  * other provisions required by the GPL.  If you do not delete the
        !            26:  * provisions above, a recipient may use your version of this file
        !            27:  * under either the MPL or the GPL.
        !            28:  */
        !            29: 
        !            30: #ifndef _LINUX_CS_INTERNAL_H
        !            31: #define _LINUX_CS_INTERNAL_H
        !            32: 
        !            33: #include <linux/config.h>
        !            34: #include <linux/spinlock.h>
        !            35: 
        !            36: typedef struct erase_busy_t {
        !            37:     eraseq_entry_t     *erase;
        !            38:     client_handle_t    client;
        !            39:     struct timer_list  timeout;
        !            40:     struct erase_busy_t        *prev, *next;
        !            41: } erase_busy_t;
        !            42: 
        !            43: #define ERASEQ_MAGIC   0xFA67
        !            44: typedef struct eraseq_t {
        !            45:     u_short            eraseq_magic;
        !            46:     client_handle_t    handle;
        !            47:     int                        count;
        !            48:     eraseq_entry_t     *entry;
        !            49: } eraseq_t;
        !            50: 
        !            51: #define CLIENT_MAGIC   0x51E6
        !            52: typedef struct client_t {
        !            53:     u_short            client_magic;
        !            54:     socket_t           Socket;
        !            55:     u_char             Function;
        !            56:     dev_info_t         dev_info;
        !            57:     u_int              Attributes;
        !            58:     u_int              state;
        !            59:     event_t            EventMask, PendingEvents;
        !            60:     int (*event_handler)(event_t event, int priority,
        !            61:                         event_callback_args_t *);
        !            62:     event_callback_args_t event_callback_args;
        !            63:     struct client_t    *next;
        !            64:     u_int              mtd_count;
        !            65:     wait_queue_head_t  mtd_req;
        !            66:     erase_busy_t       erase_busy;
        !            67: } client_t;
        !            68: 
        !            69: /* Flags in client state */
        !            70: #define CLIENT_CONFIG_LOCKED   0x0001
        !            71: #define CLIENT_IRQ_REQ         0x0002
        !            72: #define CLIENT_IO_REQ          0x0004
        !            73: #define CLIENT_UNBOUND         0x0008
        !            74: #define CLIENT_STALE           0x0010
        !            75: #define CLIENT_WIN_REQ(i)      (0x20<<(i))
        !            76: #define CLIENT_CARDBUS         0x8000
        !            77: 
        !            78: typedef struct io_window_t {
        !            79:     u_int              Attributes;
        !            80:     ioaddr_t           BasePort, NumPorts;
        !            81:     ioaddr_t           InUse, Config;
        !            82: } io_window_t;
        !            83: 
        !            84: #define WINDOW_MAGIC   0xB35C
        !            85: typedef struct window_t {
        !            86:     u_short            magic;
        !            87:     u_short            index;
        !            88:     client_handle_t    handle;
        !            89:     struct socket_info_t *sock;
        !            90:     u_long             base;
        !            91:     u_long             size;
        !            92:     pccard_mem_map     ctl;
        !            93: } window_t;
        !            94: 
        !            95: #define REGION_MAGIC   0xE3C9
        !            96: typedef struct region_t {
        !            97:     u_short            region_magic;
        !            98:     u_short            state;
        !            99:     dev_info_t         dev_info;
        !           100:     client_handle_t    mtd;
        !           101:     u_int              MediaID;
        !           102:     region_info_t      info;
        !           103: } region_t;
        !           104: 
        !           105: #define REGION_STALE   0x01
        !           106: 
        !           107: /* Each card function gets one of these guys */
        !           108: typedef struct config_t {
        !           109:     u_int              state;
        !           110:     u_int              Attributes;
        !           111:     u_int              Vcc, Vpp1, Vpp2;
        !           112:     u_int              IntType;
        !           113:     u_int              ConfigBase;
        !           114:     u_char             Status, Pin, Copy, Option, ExtStatus;
        !           115:     u_int              Present;
        !           116:     u_int              CardValues;
        !           117:     io_req_t           io;
        !           118:     struct {
        !           119:        u_int           Attributes;
        !           120:     } irq;
        !           121: } config_t;
        !           122: 
        !           123: /* Maximum number of IO windows per socket */
        !           124: #define MAX_IO_WIN 2
        !           125: 
        !           126: /* Maximum number of memory windows per socket */
        !           127: #define MAX_WIN 4
        !           128: 
        !           129: /* The size of the CIS cache */
        !           130: #define MAX_CIS_TABLE  64
        !           131: #define MAX_CIS_DATA   512
        !           132: 
        !           133: typedef struct socket_info_t {
        !           134: #ifdef __SMP__
        !           135:     spinlock_t                 lock;
        !           136: #endif
        !           137:     ss_entry_t                 ss_entry;
        !           138:     u_int                      sock;
        !           139:     socket_state_t             socket;
        !           140:     socket_cap_t               cap;
        !           141:     u_int                      state;
        !           142:     u_short                    functions;
        !           143:     u_short                    lock_count;
        !           144:     client_handle_t            clients;
        !           145:     u_int                      real_clients;
        !           146:     client_handle_t            reset_handle;
        !           147:     struct timer_list          setup, shutdown;
        !           148:     u_long                     setup_timeout;
        !           149:     pccard_mem_map             cis_mem;
        !           150:     u_char                     *cis_virt;
        !           151:     config_t                   *config;
        !           152: #ifdef CONFIG_CARDBUS
        !           153:     u_int                      cb_cis_space;
        !           154:     cb_bridge_map              cb_cis_map;
        !           155:     u_char                     *cb_cis_virt;
        !           156:     struct cb_config_t         *cb_config;
        !           157: #endif
        !           158:     struct {
        !           159:        u_int                   AssignedIRQ;
        !           160:        u_int                   Config;
        !           161:     } irq;
        !           162:     io_window_t                        io[MAX_IO_WIN];
        !           163:     window_t                   win[MAX_WIN];
        !           164:     region_t                   *c_region, *a_region;
        !           165:     erase_busy_t               erase_busy;
        !           166:     int                                cis_used;
        !           167:     struct {
        !           168:        u_int                   addr;
        !           169:        u_short                 len;
        !           170:        u_short                 attr;
        !           171:     }                          cis_table[MAX_CIS_TABLE];
        !           172:     char                       cis_cache[MAX_CIS_DATA];
        !           173:     u_int                      fake_cis_len;
        !           174:     char                       *fake_cis;
        !           175: #ifdef HAS_PROC_BUS
        !           176:     struct proc_dir_entry      *proc;
        !           177: #endif
        !           178: } socket_info_t;
        !           179: 
        !           180: /* Flags in config state */
        !           181: #define CONFIG_LOCKED          0x01
        !           182: #define CONFIG_IRQ_REQ         0x02
        !           183: #define CONFIG_IO_REQ          0x04
        !           184: 
        !           185: /* Flags in socket state */
        !           186: #define SOCKET_PRESENT         0x0008
        !           187: #define SOCKET_SETUP_PENDING   0x0010
        !           188: #define SOCKET_SHUTDOWN_PENDING        0x0020
        !           189: #define SOCKET_RESET_PENDING   0x0040
        !           190: #define SOCKET_SUSPEND         0x0080
        !           191: #define SOCKET_WIN_REQ(i)      (0x0100<<(i))
        !           192: #define SOCKET_IO_REQ(i)       (0x1000<<(i))
        !           193: #define SOCKET_REGION_INFO     0x4000
        !           194: #define SOCKET_CARDBUS         0x8000
        !           195: 
        !           196: #define CHECK_HANDLE(h) \
        !           197:     (((h) == NULL) || ((h)->client_magic != CLIENT_MAGIC))
        !           198: 
        !           199: #define CHECK_SOCKET(s) \
        !           200:     (((s) >= sockets) || (socket_table[s]->ss_entry == NULL))
        !           201: 
        !           202: #define SOCKET(h) (socket_table[(h)->Socket])
        !           203: #define CONFIG(h) (&SOCKET(h)->config[(h)->Function])
        !           204: 
        !           205: #define CHECK_REGION(r) \
        !           206:     (((r) == NULL) || ((r)->region_magic != REGION_MAGIC))
        !           207: 
        !           208: #define CHECK_ERASEQ(q) \
        !           209:     (((q) == NULL) || ((q)->eraseq_magic != ERASEQ_MAGIC))
        !           210: 
        !           211: #define EVENT(h, e, p) \
        !           212:     ((h)->event_handler((e), (p), &(h)->event_callback_args))
        !           213: 
        !           214: /* In cardbus.c */
        !           215: int cb_alloc(socket_info_t *s);
        !           216: void cb_free(socket_info_t *s);
        !           217: int cb_config(socket_info_t *s);
        !           218: void cb_release(socket_info_t *s);
        !           219: void cb_enable(socket_info_t *s);
        !           220: void cb_disable(socket_info_t *s);
        !           221: int read_cb_mem(socket_info_t *s, u_char fn, int space,
        !           222:                u_int addr, u_int len, void *ptr);
        !           223: void cb_release_cis_mem(socket_info_t *s);
        !           224: 
        !           225: /* In cistpl.c */
        !           226: int read_cis_mem(socket_info_t *s, int attr,
        !           227:                 u_int addr, u_int len, void *ptr);
        !           228: void write_cis_mem(socket_info_t *s, int attr,
        !           229:                   u_int addr, u_int len, void *ptr);
        !           230: void release_cis_mem(socket_info_t *s);
        !           231: int verify_cis_cache(socket_info_t *s);
        !           232: void preload_cis_cache(socket_info_t *s);
        !           233: int get_first_tuple(client_handle_t handle, tuple_t *tuple);
        !           234: int get_next_tuple(client_handle_t handle, tuple_t *tuple);
        !           235: int get_tuple_data(client_handle_t handle, tuple_t *tuple);
        !           236: int parse_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse);
        !           237: int validate_cis(client_handle_t handle, cisinfo_t *info);
        !           238: int replace_cis(client_handle_t handle, cisdump_t *cis);
        !           239: int read_tuple(client_handle_t handle, cisdata_t code, void *parse);
        !           240: 
        !           241: /* In bulkmem.c */
        !           242: void retry_erase_list(struct erase_busy_t *list, u_int cause);
        !           243: int get_first_region(client_handle_t handle, region_info_t *rgn);
        !           244: int get_next_region(client_handle_t handle, region_info_t *rgn);
        !           245: int register_mtd(client_handle_t handle, mtd_reg_t *reg);
        !           246: int register_erase_queue(client_handle_t *handle, eraseq_hdr_t *header);
        !           247: int deregister_erase_queue(eraseq_handle_t eraseq);
        !           248: int check_erase_queue(eraseq_handle_t eraseq);
        !           249: int open_memory(client_handle_t *handle, open_mem_t *open);
        !           250: int close_memory(memory_handle_t handle);
        !           251: int read_memory(memory_handle_t handle, mem_op_t *req, caddr_t buf);
        !           252: int write_memory(memory_handle_t handle, mem_op_t *req, caddr_t buf);
        !           253: int copy_memory(memory_handle_t handle, copy_op_t *req);
        !           254: 
        !           255: /* In rsrc_mgr */
        !           256: void validate_mem(int (*is_valid)(u_long), int (*do_cksum)(u_long),
        !           257:                  int force_low);
        !           258: int find_io_region(ioaddr_t *base, ioaddr_t num, ioaddr_t align,
        !           259:                   char *name);
        !           260: int find_mem_region(u_long *base, u_long num, u_long align,
        !           261:                    int force_low, char *name);
        !           262: int try_irq(u_int Attributes, int irq, int specific);
        !           263: void undo_irq(u_int Attributes, int irq);
        !           264: int adjust_resource_info(client_handle_t handle, adjust_t *adj);
        !           265: void release_resource_db(void);
        !           266: int proc_read_io(char *buf, char **start, off_t pos,
        !           267:                 int count, int *eof, void *data);
        !           268: int proc_read_mem(char *buf, char **start, off_t pos,
        !           269:                  int count, int *eof, void *data);
        !           270: 
        !           271: /* in pnp components */
        !           272: int proc_read_irq(char *buf, char **start, off_t pos,
        !           273:                  int count, int *eof, void *data);
        !           274: int check_pnp_irq(int n);
        !           275: void pnp_bios_init(void);
        !           276: void pnp_proc_init(void);
        !           277: void pnp_proc_done(void);
        !           278: void pnp_rsrc_init(void);
        !           279: void pnp_rsrc_done(void);
        !           280: 
        !           281: /* in pci_fixup */
        !           282: void pci_fixup_init(void);
        !           283: void pci_fixup_done(void);
        !           284: 
        !           285: #define MAX_SOCK 8
        !           286: extern socket_t sockets;
        !           287: extern socket_info_t *socket_table[MAX_SOCK];
        !           288: 
        !           289: #ifdef HAS_PROC_BUS
        !           290: extern struct proc_dir_entry *proc_pccard;
        !           291: #endif
        !           292: 
        !           293: #ifdef PCMCIA_DEBUG
        !           294: extern int pc_debug;
        !           295: #define DEBUG(n, args...) do { if (pc_debug>(n)) printk(KERN_DEBUG args); } while (0)
        !           296: #else
        !           297: #define DEBUG(n, args...) do { } while (0)
        !           298: #endif
        !           299: 
        !           300: #endif /* _LINUX_CS_INTERNAL_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.