1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#ifndef LINUX_ISAPNP_H
23#define LINUX_ISAPNP_H
24
25#include <linux/config.h>
26#include <linux/errno.h>
27#include <linux/pnp.h>
28
29
30
31
32
33#define ISAPNP_CFG_ACTIVATE 0x30
34#define ISAPNP_CFG_MEM 0x40
35#define ISAPNP_CFG_PORT 0x60
36#define ISAPNP_CFG_IRQ 0x70
37#define ISAPNP_CFG_DMA 0x74
38
39
40
41
42
43#define ISAPNP_VENDOR(a,b,c) (((((a)-'A'+1)&0x3f)<<2)|\
44 ((((b)-'A'+1)&0x18)>>3)|((((b)-'A'+1)&7)<<13)|\
45 ((((c)-'A'+1)&0x1f)<<8))
46#define ISAPNP_DEVICE(x) ((((x)&0xf000)>>8)|\
47 (((x)&0x0f00)>>8)|\
48 (((x)&0x00f0)<<8)|\
49 (((x)&0x000f)<<8))
50#define ISAPNP_FUNCTION(x) ISAPNP_DEVICE(x)
51
52
53
54
55
56#ifdef __KERNEL__
57
58#define DEVICE_COUNT_COMPATIBLE 4
59
60#define ISAPNP_ANY_ID 0xffff
61#define ISAPNP_CARD_DEVS 8
62
63#define ISAPNP_CARD_ID(_va, _vb, _vc, _device) \
64 .card_vendor = ISAPNP_VENDOR(_va, _vb, _vc), .card_device = ISAPNP_DEVICE(_device)
65#define ISAPNP_CARD_END \
66 .card_vendor = 0, .card_device = 0
67#define ISAPNP_DEVICE_ID(_va, _vb, _vc, _function) \
68 { .vendor = ISAPNP_VENDOR(_va, _vb, _vc), .function = ISAPNP_FUNCTION(_function) }
69
70
71#define ISAPNP_CARD_TABLE(name) \
72 MODULE_GENERIC_TABLE(isapnp_card, name)
73
74struct isapnp_card_id {
75 unsigned long driver_data;
76 unsigned short card_vendor, card_device;
77 struct {
78 unsigned short vendor, function;
79 } devs[ISAPNP_CARD_DEVS];
80};
81
82#define ISAPNP_DEVICE_SINGLE(_cva, _cvb, _cvc, _cdevice, _dva, _dvb, _dvc, _dfunction) \
83 .card_vendor = ISAPNP_VENDOR(_cva, _cvb, _cvc), .card_device = ISAPNP_DEVICE(_cdevice), \
84 .vendor = ISAPNP_VENDOR(_dva, _dvb, _dvc), .function = ISAPNP_FUNCTION(_dfunction)
85#define ISAPNP_DEVICE_SINGLE_END \
86 .card_vendor = 0, .card_device = 0
87
88struct isapnp_device_id {
89 unsigned short card_vendor, card_device;
90 unsigned short vendor, function;
91 unsigned long driver_data;
92};
93
94#if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE))
95
96#define __ISAPNP__
97
98
99int isapnp_present(void);
100int isapnp_cfg_begin(int csn, int device);
101int isapnp_cfg_end(void);
102unsigned char isapnp_read_byte(unsigned char idx);
103unsigned short isapnp_read_word(unsigned char idx);
104unsigned int isapnp_read_dword(unsigned char idx);
105void isapnp_write_byte(unsigned char idx, unsigned char val);
106void isapnp_write_word(unsigned char idx, unsigned short val);
107void isapnp_write_dword(unsigned char idx, unsigned int val);
108void isapnp_wake(unsigned char csn);
109void isapnp_device(unsigned char device);
110void isapnp_activate(unsigned char device);
111void isapnp_deactivate(unsigned char device);
112void *isapnp_alloc(long size);
113
114#ifdef CONFIG_PROC_FS
115int isapnp_proc_init(void);
116int isapnp_proc_done(void);
117#else
118static inline int isapnp_proc_init(void) { return 0; }
119static inline int isapnp_proc_done(void) { return 0; }
120#endif
121
122
123int isapnp_init(void);
124
125
126struct pnp_card *pnp_find_card(unsigned short vendor,
127 unsigned short device,
128 struct pnp_card *from);
129struct pnp_dev *pnp_find_dev(struct pnp_card *card,
130 unsigned short vendor,
131 unsigned short function,
132 struct pnp_dev *from);
133
134#else
135
136
137static inline int isapnp_present(void) { return 0; }
138static inline int isapnp_cfg_begin(int csn, int device) { return -ENODEV; }
139static inline int isapnp_cfg_end(void) { return -ENODEV; }
140static inline unsigned char isapnp_read_byte(unsigned char idx) { return 0xff; }
141static inline unsigned short isapnp_read_word(unsigned char idx) { return 0xffff; }
142static inline unsigned int isapnp_read_dword(unsigned char idx) { return 0xffffffff; }
143static inline void isapnp_write_byte(unsigned char idx, unsigned char val) { ; }
144static inline void isapnp_write_word(unsigned char idx, unsigned short val) { ; }
145static inline void isapnp_write_dword(unsigned char idx, unsigned int val) { ; }
146static inline void isapnp_wake(unsigned char csn) { ; }
147static inline void isapnp_device(unsigned char device) { ; }
148static inline void isapnp_activate(unsigned char device) { ; }
149static inline void isapnp_deactivate(unsigned char device) { ; }
150
151static inline struct pnp_card *pnp_find_card(unsigned short vendor,
152 unsigned short device,
153 struct pnp_card *from) { return NULL; }
154static inline struct pnp_dev *pnp_find_dev(struct pnp_card *card,
155 unsigned short vendor,
156 unsigned short function,
157 struct pnp_dev *from) { return NULL; }
158
159#endif
160
161#endif
162#endif
163