diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/isapnp.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/linux/isapnp.h')
-rw-r--r-- | include/linux/isapnp.h | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/include/linux/isapnp.h b/include/linux/isapnp.h new file mode 100644 index 000000000000..26c64c286f42 --- /dev/null +++ b/include/linux/isapnp.h | |||
@@ -0,0 +1,142 @@ | |||
1 | /* | ||
2 | * ISA Plug & Play support | ||
3 | * Copyright (c) by Jaroslav Kysela <perex@suse.cz> | ||
4 | * | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
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 | * Configuration registers (TODO: change by specification) | ||
31 | */ | ||
32 | |||
33 | #define ISAPNP_CFG_ACTIVATE 0x30 /* byte */ | ||
34 | #define ISAPNP_CFG_MEM 0x40 /* 4 * dword */ | ||
35 | #define ISAPNP_CFG_PORT 0x60 /* 8 * word */ | ||
36 | #define ISAPNP_CFG_IRQ 0x70 /* 2 * word */ | ||
37 | #define ISAPNP_CFG_DMA 0x74 /* 2 * byte */ | ||
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 | /* export used IDs outside module */ | ||
71 | #define ISAPNP_CARD_TABLE(name) \ | ||
72 | MODULE_GENERIC_TABLE(isapnp_card, name) | ||
73 | |||
74 | struct isapnp_card_id { | ||
75 | unsigned long driver_data; /* data private to the driver */ | ||
76 | unsigned short card_vendor, card_device; | ||
77 | struct { | ||
78 | unsigned short vendor, function; | ||
79 | } devs[ISAPNP_CARD_DEVS]; /* logical devices */ | ||
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 | |||
88 | struct isapnp_device_id { | ||
89 | unsigned short card_vendor, card_device; | ||
90 | unsigned short vendor, function; | ||
91 | unsigned long driver_data; /* data private to the driver */ | ||
92 | }; | ||
93 | |||
94 | #if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE)) | ||
95 | |||
96 | #define __ISAPNP__ | ||
97 | |||
98 | /* lowlevel configuration */ | ||
99 | int isapnp_present(void); | ||
100 | int isapnp_cfg_begin(int csn, int device); | ||
101 | int isapnp_cfg_end(void); | ||
102 | unsigned char isapnp_read_byte(unsigned char idx); | ||
103 | void isapnp_write_byte(unsigned char idx, unsigned char val); | ||
104 | |||
105 | #ifdef CONFIG_PROC_FS | ||
106 | int isapnp_proc_init(void); | ||
107 | int isapnp_proc_done(void); | ||
108 | #else | ||
109 | static inline int isapnp_proc_init(void) { return 0; } | ||
110 | static inline int isapnp_proc_done(void) { return 0; } | ||
111 | #endif | ||
112 | |||
113 | /* compat */ | ||
114 | struct pnp_card *pnp_find_card(unsigned short vendor, | ||
115 | unsigned short device, | ||
116 | struct pnp_card *from); | ||
117 | struct pnp_dev *pnp_find_dev(struct pnp_card *card, | ||
118 | unsigned short vendor, | ||
119 | unsigned short function, | ||
120 | struct pnp_dev *from); | ||
121 | |||
122 | #else /* !CONFIG_ISAPNP */ | ||
123 | |||
124 | /* lowlevel configuration */ | ||
125 | static inline int isapnp_present(void) { return 0; } | ||
126 | static inline int isapnp_cfg_begin(int csn, int device) { return -ENODEV; } | ||
127 | static inline int isapnp_cfg_end(void) { return -ENODEV; } | ||
128 | static inline unsigned char isapnp_read_byte(unsigned char idx) { return 0xff; } | ||
129 | static inline void isapnp_write_byte(unsigned char idx, unsigned char val) { ; } | ||
130 | |||
131 | static inline struct pnp_card *pnp_find_card(unsigned short vendor, | ||
132 | unsigned short device, | ||
133 | struct pnp_card *from) { return NULL; } | ||
134 | static inline struct pnp_dev *pnp_find_dev(struct pnp_card *card, | ||
135 | unsigned short vendor, | ||
136 | unsigned short function, | ||
137 | struct pnp_dev *from) { return NULL; } | ||
138 | |||
139 | #endif /* CONFIG_ISAPNP */ | ||
140 | |||
141 | #endif /* __KERNEL__ */ | ||
142 | #endif /* LINUX_ISAPNP_H */ | ||