0001
0002
0003
0004
0005
0006
0007 #ifndef LINUX_ISAPNP_H
0008 #define LINUX_ISAPNP_H
0009
0010 #include <linux/errno.h>
0011 #include <linux/pnp.h>
0012
0013
0014
0015
0016
0017 #define ISAPNP_VENDOR(a,b,c) (((((a)-'A'+1)&0x3f)<<2)|\
0018 ((((b)-'A'+1)&0x18)>>3)|((((b)-'A'+1)&7)<<13)|\
0019 ((((c)-'A'+1)&0x1f)<<8))
0020 #define ISAPNP_DEVICE(x) ((((x)&0xf000)>>8)|\
0021 (((x)&0x0f00)>>8)|\
0022 (((x)&0x00f0)<<8)|\
0023 (((x)&0x000f)<<8))
0024 #define ISAPNP_FUNCTION(x) ISAPNP_DEVICE(x)
0025
0026
0027
0028
0029
0030 #ifdef __KERNEL__
0031 #include <linux/mod_devicetable.h>
0032
0033 #define DEVICE_COUNT_COMPATIBLE 4
0034
0035 #define ISAPNP_CARD_DEVS 8
0036
0037 #define ISAPNP_CARD_ID(_va, _vb, _vc, _device) \
0038 .card_vendor = ISAPNP_VENDOR(_va, _vb, _vc), .card_device = ISAPNP_DEVICE(_device)
0039 #define ISAPNP_CARD_END \
0040 .card_vendor = 0, .card_device = 0
0041 #define ISAPNP_DEVICE_ID(_va, _vb, _vc, _function) \
0042 { .vendor = ISAPNP_VENDOR(_va, _vb, _vc), .function = ISAPNP_FUNCTION(_function) }
0043
0044 struct isapnp_card_id {
0045 unsigned long driver_data;
0046 unsigned short card_vendor, card_device;
0047 struct {
0048 unsigned short vendor, function;
0049 } devs[ISAPNP_CARD_DEVS];
0050 };
0051
0052 #define ISAPNP_DEVICE_SINGLE(_cva, _cvb, _cvc, _cdevice, _dva, _dvb, _dvc, _dfunction) \
0053 .card_vendor = ISAPNP_VENDOR(_cva, _cvb, _cvc), .card_device = ISAPNP_DEVICE(_cdevice), \
0054 .vendor = ISAPNP_VENDOR(_dva, _dvb, _dvc), .function = ISAPNP_FUNCTION(_dfunction)
0055 #define ISAPNP_DEVICE_SINGLE_END \
0056 .card_vendor = 0, .card_device = 0
0057
0058 #if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE))
0059
0060 #define __ISAPNP__
0061
0062
0063 int isapnp_present(void);
0064 int isapnp_cfg_begin(int csn, int device);
0065 int isapnp_cfg_end(void);
0066 unsigned char isapnp_read_byte(unsigned char idx);
0067 void isapnp_write_byte(unsigned char idx, unsigned char val);
0068
0069 #ifdef CONFIG_PROC_FS
0070 int isapnp_proc_init(void);
0071 int isapnp_proc_done(void);
0072 #else
0073 static inline int isapnp_proc_init(void) { return 0; }
0074 static inline int isapnp_proc_done(void) { return 0; }
0075 #endif
0076
0077
0078 struct pnp_dev *pnp_find_dev(struct pnp_card *card,
0079 unsigned short vendor,
0080 unsigned short function,
0081 struct pnp_dev *from);
0082
0083 #else
0084
0085
0086 static inline int isapnp_present(void) { return 0; }
0087 static inline int isapnp_cfg_begin(int csn, int device) { return -ENODEV; }
0088 static inline int isapnp_cfg_end(void) { return -ENODEV; }
0089 static inline unsigned char isapnp_read_byte(unsigned char idx) { return 0xff; }
0090 static inline void isapnp_write_byte(unsigned char idx, unsigned char val) { ; }
0091
0092 static inline struct pnp_dev *pnp_find_dev(struct pnp_card *card,
0093 unsigned short vendor,
0094 unsigned short function,
0095 struct pnp_dev *from) { return NULL; }
0096
0097 #endif
0098
0099 #endif
0100 #endif