diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/ide.h | 2 | ||||
| -rw-r--r-- | include/linux/isapnp.h | 17 | ||||
| -rw-r--r-- | include/linux/module.h | 8 | ||||
| -rw-r--r-- | include/linux/pci_ids.h | 2 | ||||
| -rw-r--r-- | include/linux/pnp.h | 116 | ||||
| -rw-r--r-- | include/linux/pnpbios.h | 18 |
6 files changed, 100 insertions, 63 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h index 2e2718ebfd98..9aec59722441 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -916,6 +916,8 @@ typedef struct hwif_s { struct pci_dev *pci_dev; /* for pci chipsets */ struct ide_pci_device_s *cds; /* chipset device struct */ + + struct pnp_dev *pnp_dev; /* for PnP devices */ #if 0 ide_hwif_ops_t *hwifops; diff --git a/include/linux/isapnp.h b/include/linux/isapnp.h index 3e03c39fbc40..9582944ab25c 100644 --- a/include/linux/isapnp.h +++ b/include/linux/isapnp.h @@ -122,6 +122,15 @@ static inline isapnp_proc_done(void) { return 0; } /* init/main.c */ int isapnp_init(void); +/* compat */ +struct pnp_card *pnp_find_card(unsigned short vendor, + unsigned short device, + struct pnp_card *from); +struct pnp_dev *pnp_find_dev(struct pnp_card *card, + unsigned short vendor, + unsigned short function, + struct pnp_dev *from); + #else /* !CONFIG_ISAPNP */ /* lowlevel configuration */ @@ -139,6 +148,14 @@ static inline void isapnp_device(unsigned char device) { ; } static inline void isapnp_activate(unsigned char device) { ; } static inline void isapnp_deactivate(unsigned char device) { ; } +static inline struct pnp_card *pnp_find_card(unsigned short vendor, + unsigned short device, + struct pnp_card *from) { return NULL; } +static inline struct pnp_dev *pnp_find_dev(struct pnp_card *card, + unsigned short vendor, + unsigned short function, + struct pnp_dev *from) { return NULL; } + #endif /* CONFIG_ISAPNP */ #endif /* __KERNEL__ */ diff --git a/include/linux/module.h b/include/linux/module.h index 8b0084419604..f38e535eacd9 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -61,6 +61,8 @@ extern const struct gtype##_id __mod_##gtype##_table \ __attribute__ ((unused, alias(__stringify(name)))) #define THIS_MODULE (&__this_module) +#define MOD_INC_USE_COUNT _MOD_INC_USE_COUNT(THIS_MODULE) +#define MOD_DEC_USE_COUNT __MOD_DEC_USE_COUNT(THIS_MODULE) /* * The following license idents are currently accepted as indicating free @@ -96,6 +98,8 @@ extern const struct gtype##_id __mod_##gtype##_table \ #define MODULE_GENERIC_TABLE(gtype,name) #define THIS_MODULE ((struct module *)0) +#define MOD_INC_USE_COUNT do { } while (0) +#define MOD_DEC_USE_COUNT do { } while (0) #define MODULE_LICENSE(license) #endif @@ -426,10 +430,6 @@ static inline void __deprecated _MOD_INC_USE_COUNT(struct module *module) try_module_get(module); #endif } -#define MOD_INC_USE_COUNT \ - _MOD_INC_USE_COUNT(THIS_MODULE) -#define MOD_DEC_USE_COUNT \ - __MOD_DEC_USE_COUNT(THIS_MODULE) #define EXPORT_NO_SYMBOLS extern int module_dummy_usage; #define GET_USE_COUNT(module) (module_dummy_usage) diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 8221b1f372ab..013ccd61fb30 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -137,6 +137,7 @@ #define PCI_DEVICE_ID_COMPAQ_SMART2P 0xae10 #define PCI_DEVICE_ID_COMPAQ_NETEL100 0xae32 #define PCI_DEVICE_ID_COMPAQ_NETEL10 0xae34 +#define PCI_DEVICE_ID_COMPAQ_TRIFLEX_IDE 0xae33 #define PCI_DEVICE_ID_COMPAQ_NETFLEX3I 0xae35 #define PCI_DEVICE_ID_COMPAQ_NETEL100D 0xae40 #define PCI_DEVICE_ID_COMPAQ_NETEL100PI 0xae43 @@ -1880,6 +1881,7 @@ #define PCI_DEVICE_ID_INTEL_82454GX 0x84c4 #define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 #define PCI_DEVICE_ID_INTEL_82451NX 0x84ca +#define PCI_DEVICE_ID_INTEL_82454NX 0x84cb #define PCI_DEVICE_ID_INTEL_84460GX 0x84ea #define PCI_VENDOR_ID_COMPUTONE 0x8e0e diff --git a/include/linux/pnp.h b/include/linux/pnp.h index 7d4e9fd6ae0e..b97e8f64122f 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h @@ -20,7 +20,8 @@ #define DEVICE_COUNT_IRQ 2 #define DEVICE_COUNT_DMA 2 -#define DEVICE_COUNT_RESOURCE 12 +#define DEVICE_COUNT_IO 8 +#define DEVICE_COUNT_MEM 4 #define MAX_DEVICES 8 struct pnp_resource; @@ -30,6 +31,7 @@ struct pnp_cfg; struct pnp_card { char name[80]; + int status; /* status of the card */ unsigned char number; /* card number */ struct list_head global_list; /* node in global list of cards */ struct list_head protocol_list; /* node in protocol's list of cards */ @@ -84,6 +86,9 @@ static inline void pnpc_set_protodata (struct pnp_card *pcard, void *data) struct pnp_dev { char name[80]; /* device name */ int active; /* status of the device */ + int capabilities; + int status; + struct list_head global_list; /* node in global list of devices */ struct list_head protocol_list; /* node in list of device's protocol */ struct list_head card_list; /* node in card's list of devices */ @@ -98,7 +103,8 @@ struct pnp_dev { struct pnp_resources *res; /* possible resource information */ int lock_resources; /* resources are locked */ - struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ + struct resource io_resource[DEVICE_COUNT_IO]; /* port regions */ + struct resource mem_resource[DEVICE_COUNT_MEM]; /* memory regions + expansion ROMs */ struct resource dma_resource[DEVICE_COUNT_DMA]; struct resource irq_resource[DEVICE_COUNT_IRQ]; @@ -116,13 +122,10 @@ struct pnp_dev { for(dev = global_to_pnp_dev(pnp_global.next); \ dev != global_to_pnp_dev(&pnp_global); \ dev = global_to_pnp_dev(dev->global_list.next)) - -static inline int pnp_dev_has_driver(struct pnp_dev *pdev) -{ - if (pdev->driver || (pdev->card && pdev->card->driver)) - return 1; - return 0; -} +#define card_for_each_dev(card,dev) \ + for((dev) = card_to_pnp_dev((card)->devices.next); \ + (dev) != card_to_pnp_dev(&(card)->devices); \ + (dev) = card_to_pnp_dev((dev)->card_list.next)) static inline void *pnp_get_drvdata (struct pnp_dev *pdev) { @@ -149,6 +152,28 @@ struct pnp_fixup { void (*quirk_function)(struct pnp_dev *dev); /* fixup function */ }; +/* capabilities */ +#define PNP_READ 0x0001 +#define PNP_WRITE 0x0002 +#define PNP_DISABLE 0x0004 +#define PNP_CONFIGURABLE 0x0008 +#define PNP_REMOVABLE 0x0010 + +#define pnp_can_read(dev) (((dev)->protocol) && ((dev)->protocol->get) && \ + ((dev)->capabilities & PNP_READ)) +#define pnp_can_write(dev) (((dev)->protocol) && ((dev)->protocol->set) && \ + ((dev)->capabilities & PNP_WRITE)) +#define pnp_can_disable(dev) (((dev)->protocol) && ((dev)->protocol->disable) && \ + ((dev)->capabilities & PNP_DISABLE)) +#define pnp_can_configure(dev) ((!(dev)->active) && ((dev)->capabilities & PNP_CONFIGURABLE)) + +/* status */ +#define PNP_INIT 0x0000 +#define PNP_READY 0x0001 +#define PNP_ATTACHED 0x0002 +#define PNP_BUSY 0x0004 +#define PNP_FAULTY 0x0008 + /* * Driver Management @@ -205,10 +230,14 @@ struct pnpc_driver { * Resource Management */ +#define pnp_flags_valid(resrc) (((resrc)->flags & IORESOURCE_UNSET) == 0 && \ + ((resrc)->flags & (IORESOURCE_IO|IORESOURCE_MEM|IORESOURCE_IRQ|IORESOURCE_DMA)) != 0) + /* Use these instead of directly reading pnp_dev to get resource information */ -#define pnp_port_start(dev,bar) ((dev)->resource[(bar)].start) -#define pnp_port_end(dev,bar) ((dev)->resource[(bar)].end) -#define pnp_port_flags(dev,bar) ((dev)->resource[(bar)].flags) +#define pnp_port_start(dev,bar) ((dev)->io_resource[(bar)].start) +#define pnp_port_end(dev,bar) ((dev)->io_resource[(bar)].end) +#define pnp_port_flags(dev,bar) ((dev)->io_resource[(bar)].flags) +#define pnp_port_valid(dev,bar) pnp_flags_valid(&(dev)->io_resource[(bar)]) #define pnp_port_len(dev,bar) \ ((pnp_port_start((dev),(bar)) == 0 && \ pnp_port_end((dev),(bar)) == \ @@ -217,9 +246,10 @@ struct pnpc_driver { (pnp_port_end((dev),(bar)) - \ pnp_port_start((dev),(bar)) + 1)) -#define pnp_mem_start(dev,bar) ((dev)->resource[(bar+8)].start) -#define pnp_mem_end(dev,bar) ((dev)->resource[(bar+8)].end) -#define pnp_mem_flags(dev,bar) ((dev)->resource[(bar+8)].flags) +#define pnp_mem_start(dev,bar) ((dev)->mem_resource[(bar)].start) +#define pnp_mem_end(dev,bar) ((dev)->mem_resource[(bar)].end) +#define pnp_mem_flags(dev,bar) ((dev)->mem_resource[(bar)].flags) +#define pnp_mem_valid(dev,bar) pnp_flags_valid(&(dev)->mem_resource[(bar)]) #define pnp_mem_len(dev,bar) \ ((pnp_mem_start((dev),(bar)) == 0 && \ pnp_mem_end((dev),(bar)) == \ @@ -228,11 +258,13 @@ struct pnpc_driver { (pnp_mem_end((dev),(bar)) - \ pnp_mem_start((dev),(bar)) + 1)) -#define pnp_irq(dev,bar) ((dev)->irq_resource[(bar)].start) -#define pnp_irq_flags(dev,bar) ((dev)->irq_resource[(bar)].flags) +#define pnp_irq(dev,bar) ((dev)->irq_resource[(bar)].start) +#define pnp_irq_flags(dev,bar) ((dev)->irq_resource[(bar)].flags) +#define pnp_irq_valid(dev,bar) pnp_flags_valid(&(dev)->irq_resource[(bar)]) -#define pnp_dma(dev,bar) ((dev)->dma_resource[(bar)].start) -#define pnp_dma_flags(dev,bar) ((dev)->dma_resource[(bar)].flags) +#define pnp_dma(dev,bar) ((dev)->dma_resource[(bar)].start) +#define pnp_dma_flags(dev,bar) ((dev)->dma_resource[(bar)].flags) +#define pnp_dma_valid(dev,bar) pnp_flags_valid(&(dev)->dma_resource[(bar)]) #define PNP_PORT_FLAG_16BITADDR (1<<0) #define PNP_PORT_FLAG_FIXED (1<<1) @@ -298,14 +330,12 @@ struct pnp_resources { }; struct pnp_res_cfg { - struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ + struct resource io_resource[DEVICE_COUNT_IO]; /* I/O ports */ + struct resource mem_resource[DEVICE_COUNT_MEM]; /* memory regions + expansion ROMs */ struct resource dma_resource[DEVICE_COUNT_DMA]; struct resource irq_resource[DEVICE_COUNT_IRQ]; }; -#define PNP_DYNAMIC 0 /* get or set current resource */ -#define PNP_STATIC 1 /* get or set resource for next boot */ - struct pnp_cfg { struct pnp_port *port[8]; struct pnp_irq *irq[2]; @@ -325,7 +355,7 @@ struct pnp_protocol { /* functions */ int (*get)(struct pnp_dev *dev); - int (*set)(struct pnp_dev *dev, struct pnp_cfg *config, char flags); + int (*set)(struct pnp_dev *dev, struct pnp_cfg *config); int (*disable)(struct pnp_dev *dev); /* used by pnp layer only (look but don't touch) */ @@ -367,7 +397,7 @@ int pnp_add_mem32_resource(struct pnp_dev *dev, int depnum, struct pnp_mem32 *da int pnp_init_res_cfg(struct pnp_res_cfg *template); int pnp_activate_dev(struct pnp_dev *dev, struct pnp_res_cfg *template); int pnp_disable_dev(struct pnp_dev *dev); -int pnp_raw_set_dev(struct pnp_dev *dev, int depnum, struct pnp_res_cfg *template, int mode); +int pnp_raw_set_dev(struct pnp_dev *dev, int depnum, struct pnp_res_cfg *template); void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size); /* driver */ @@ -375,6 +405,8 @@ int compare_pnp_id(struct pnp_id * pos, const char * id); int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev); int pnp_register_driver(struct pnp_driver *drv); void pnp_unregister_driver(struct pnp_driver *drv); +int pnp_device_attach(struct pnp_dev *pnp_dev); +void pnp_device_detach(struct pnp_dev *pnp_dev); #else @@ -395,12 +427,16 @@ static inline int pnp_add_mem32_resource(struct pnp_dev *dev, int depnum, struct static inline int pnp_init_res_cfg(struct pnp_res_cfg *template) { return -ENODEV; } static inline int pnp_activate_dev(struct pnp_dev *dev, struct pnp_res_cfg *template) { return -ENODEV; } static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; } -static inline int pnp_raw_set_dev(struct pnp_dev *dev, int depnum, struct pnp_res_cfg *template, int mode) { return -ENODEV; } +static inline int pnp_raw_set_dev(struct pnp_dev *dev, int depnum, struct pnp_res_cfg *template) { return -ENODEV; } +static inline void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size) { ; } static inline int compare_pnp_id(struct list_head * id_list, const char * id) { return -ENODEV; } static inline int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev) { return -ENODEV; } static inline int pnp_register_driver(struct pnp_driver *drv) { return -ENODEV; } static inline void pnp_unregister_driver(struct pnp_driver *drv) { ; } +static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; } +static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { ; } + #endif /* CONFIG_PNP */ @@ -417,6 +453,8 @@ int pnpc_register_driver(struct pnpc_driver * drv); void pnpc_unregister_driver(struct pnpc_driver *drv); int pnpc_add_id(struct pnp_id *id, struct pnp_card *card); extern struct list_head pnp_cards; +int pnpc_attach(struct pnp_card *card); +void pnpc_detach(struct pnp_card *card); #else @@ -429,34 +467,12 @@ static inline void pnp_release_card_device(struct pnp_dev *dev) { ; } static inline int pnpc_register_driver(struct pnpc_driver *drv) { return -ENODEV; } static inline void pnpc_unregister_driver(struct pnpc_driver *drv) { ; } static inline int pnpc_add_id(struct pnp_id *id, struct pnp_card *card) { return -ENODEV; } +static inline int pnpc_attach(struct pnp_card *card) { return -ENODEV; } +static inline void pnpc_detach(struct pnp_card *card) { ; } #endif /* CONFIG_PNP_CARD */ -#if defined(CONFIG_ISAPNP) - -/* compat */ -struct pnp_card *pnp_find_card(unsigned short vendor, - unsigned short device, - struct pnp_card *from); -struct pnp_dev *pnp_find_dev(struct pnp_card *card, - unsigned short vendor, - unsigned short function, - struct pnp_dev *from); - -#else - -static inline struct pnp_card *pnp_find_card(unsigned short vendor, - unsigned short device, - struct pnp_card *from) { return NULL; } -static inline struct pnp_dev *pnp_find_dev(struct pnp_card *card, - unsigned short vendor, - unsigned short function, - struct pnp_dev *from) { return NULL; } - -#endif /* CONFIG_ISAPNP */ - - #ifdef DEBUG #define pnp_dbg(format, arg...) printk(KERN_DEBUG "pnp: " format "\n" , ## arg) #else diff --git a/include/linux/pnpbios.h b/include/linux/pnpbios.h index 2363817caa7f..81ea18989075 100644 --- a/include/linux/pnpbios.h +++ b/include/linux/pnpbios.h @@ -78,15 +78,15 @@ /* * Plug and Play BIOS flags */ -#define PNP_NO_DISABLE 0x0001 -#define PNP_NO_CONFIG 0x0002 -#define PNP_OUTPUT 0x0004 -#define PNP_INPUT 0x0008 -#define PNP_BOOTABLE 0x0010 -#define PNP_DOCK 0x0020 -#define PNP_REMOVABLE 0x0040 -#define pnp_is_static(x) (x->flags & 0x0100) == 0x0000 -#define pnp_is_dynamic(x) x->flags & 0x0080 +#define PNPBIOS_NO_DISABLE 0x0001 +#define PNPBIOS_NO_CONFIG 0x0002 +#define PNPBIOS_OUTPUT 0x0004 +#define PNPBIOS_INPUT 0x0008 +#define PNPBIOS_BOOTABLE 0x0010 +#define PNPBIOS_DOCK 0x0020 +#define PNPBIOS_REMOVABLE 0x0040 +#define pnpbios_is_static(x) ((x)->flags & 0x0100) == 0x0000 +#define pnpbios_is_dynamic(x) (x)->flags & 0x0080 /* 0x8000 through 0xffff are OEM defined */ |
