x86: local.h fix checkpatch warnings
[linux-2.6/openmoko-kernel/knife-kernel.git] / include / linux / isapnp.h
blob1e8728a9ee8a0bce0e05e1fa41cb47a09876d053
1 /*
2 * ISA Plug & Play support
3 * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
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.
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.
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.
22 #ifndef LINUX_ISAPNP_H
23 #define LINUX_ISAPNP_H
25 #include <linux/errno.h>
26 #include <linux/pnp.h>
29 * Configuration registers (TODO: change by specification)
30 */
32 #define ISAPNP_CFG_ACTIVATE 0x30 /* byte */
33 #define ISAPNP_CFG_MEM 0x40 /* 4 * dword */
34 #define ISAPNP_CFG_PORT 0x60 /* 8 * word */
35 #define ISAPNP_CFG_IRQ 0x70 /* 2 * word */
36 #define ISAPNP_CFG_DMA 0x74 /* 2 * byte */
42 #define ISAPNP_VENDOR(a,b,c) (((((a)-'A'+1)&0x3f)<<2)|\
43 ((((b)-'A'+1)&0x18)>>3)|((((b)-'A'+1)&7)<<13)|\
44 ((((c)-'A'+1)&0x1f)<<8))
45 #define ISAPNP_DEVICE(x) ((((x)&0xf000)>>8)|\
46 (((x)&0x0f00)>>8)|\
47 (((x)&0x00f0)<<8)|\
48 (((x)&0x000f)<<8))
49 #define ISAPNP_FUNCTION(x) ISAPNP_DEVICE(x)
55 #ifdef __KERNEL__
57 #define DEVICE_COUNT_COMPATIBLE 4
59 #define ISAPNP_ANY_ID 0xffff
60 #define ISAPNP_CARD_DEVS 8
62 #define ISAPNP_CARD_ID(_va, _vb, _vc, _device) \
63 .card_vendor = ISAPNP_VENDOR(_va, _vb, _vc), .card_device = ISAPNP_DEVICE(_device)
64 #define ISAPNP_CARD_END \
65 .card_vendor = 0, .card_device = 0
66 #define ISAPNP_DEVICE_ID(_va, _vb, _vc, _function) \
67 { .vendor = ISAPNP_VENDOR(_va, _vb, _vc), .function = ISAPNP_FUNCTION(_function) }
69 /* export used IDs outside module */
70 #define ISAPNP_CARD_TABLE(name) \
71 MODULE_GENERIC_TABLE(isapnp_card, name)
73 struct isapnp_card_id {
74 unsigned long driver_data; /* data private to the driver */
75 unsigned short card_vendor, card_device;
76 struct {
77 unsigned short vendor, function;
78 } devs[ISAPNP_CARD_DEVS]; /* logical devices */
81 #define ISAPNP_DEVICE_SINGLE(_cva, _cvb, _cvc, _cdevice, _dva, _dvb, _dvc, _dfunction) \
82 .card_vendor = ISAPNP_VENDOR(_cva, _cvb, _cvc), .card_device = ISAPNP_DEVICE(_cdevice), \
83 .vendor = ISAPNP_VENDOR(_dva, _dvb, _dvc), .function = ISAPNP_FUNCTION(_dfunction)
84 #define ISAPNP_DEVICE_SINGLE_END \
85 .card_vendor = 0, .card_device = 0
87 struct isapnp_device_id {
88 unsigned short card_vendor, card_device;
89 unsigned short vendor, function;
90 unsigned long driver_data; /* data private to the driver */
93 #if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE))
95 #define __ISAPNP__
97 /* lowlevel configuration */
98 int isapnp_present(void);
99 int isapnp_cfg_begin(int csn, int device);
100 int isapnp_cfg_end(void);
101 unsigned char isapnp_read_byte(unsigned char idx);
102 void isapnp_write_byte(unsigned char idx, unsigned char val);
104 #ifdef CONFIG_PROC_FS
105 int isapnp_proc_init(void);
106 int isapnp_proc_done(void);
107 #else
108 static inline int isapnp_proc_init(void) { return 0; }
109 static inline int isapnp_proc_done(void) { return 0; }
110 #endif
112 /* compat */
113 struct pnp_card *pnp_find_card(unsigned short vendor,
114 unsigned short device,
115 struct pnp_card *from);
116 struct pnp_dev *pnp_find_dev(struct pnp_card *card,
117 unsigned short vendor,
118 unsigned short function,
119 struct pnp_dev *from);
121 #else /* !CONFIG_ISAPNP */
123 /* lowlevel configuration */
124 static inline int isapnp_present(void) { return 0; }
125 static inline int isapnp_cfg_begin(int csn, int device) { return -ENODEV; }
126 static inline int isapnp_cfg_end(void) { return -ENODEV; }
127 static inline unsigned char isapnp_read_byte(unsigned char idx) { return 0xff; }
128 static inline void isapnp_write_byte(unsigned char idx, unsigned char val) { ; }
130 static inline struct pnp_card *pnp_find_card(unsigned short vendor,
131 unsigned short device,
132 struct pnp_card *from) { return NULL; }
133 static inline struct pnp_dev *pnp_find_dev(struct pnp_card *card,
134 unsigned short vendor,
135 unsigned short function,
136 struct pnp_dev *from) { return NULL; }
138 #endif /* CONFIG_ISAPNP */
140 #endif /* __KERNEL__ */
141 #endif /* LINUX_ISAPNP_H */