diff options
| author | Jaroslav Kysela <perex@suse.cz> | 2003-01-11 12:57:09 +0100 |
|---|---|---|
| committer | Jaroslav Kysela <perex@suse.cz> | 2003-01-11 12:57:09 +0100 |
| commit | 7cf4ec8de358856f69bc971c6a6bcab22020c3e1 (patch) | |
| tree | 2da4cdc37c25e17673f7fb8c34508ddd88d34032 /include | |
| parent | b0de9c76475f7d8f6917d8ed8bb55259e1512c37 (diff) | |
Linux PnP Support 0.94
(Adam Belay) -use list_del instead of list_del_init in some areas
-introduce pnp capability and status flags
-remove static resource setting, I did some research and found that only
PnPBIOS supports it, therefore it is better to implememt this in the
PnPBIOS protocol itself. (it appears ACPI doesn't use this)
-Remove pnp_dev_has_driver and use PNP_ATTACHED instead, this is necessary
because a card driver only has rights over a device that it requests.
-added card_for_each_dev macro
-undo isapnp protocol changes, the pnp layer was designed to handle cards
and devices on the same protocol and I feel they should not be seperated.
(Pual Laufer) -Fix remove driver bug in pnp card services
(Adam Richter) -Fix a potential oops in id registration functions
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/pnp.h | 45 | ||||
| -rw-r--r-- | include/linux/pnpbios.h | 18 |
2 files changed, 41 insertions, 22 deletions
diff --git a/include/linux/pnp.h b/include/linux/pnp.h index 7d4e9fd6ae0e..c4b120c8727b 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h @@ -84,6 +84,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 */ @@ -116,13 +119,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 +149,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 @@ -303,9 +325,6 @@ struct pnp_res_cfg { 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 +344,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 +386,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 */ @@ -395,7 +414,7 @@ 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 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; } 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 */ |
