diff options
| author | Greg Kroah-Hartman <greg@kroah.com> | 2002-12-29 22:17:54 -0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <greg@kroah.com> | 2002-12-29 22:17:54 -0800 |
| commit | 4513bc2fb92aa9407cea9c9b56053f38c211b6aa (patch) | |
| tree | 981016921579683c215defead9be6a85a3372d75 /include/linux | |
| parent | 288bde07965cad1bb83cb8aefa844e801472a5d4 (diff) | |
| parent | 708d7b682c14fb0c45ec3e917d2e49aca011c5a0 (diff) | |
Merge kroah.com:/home/linux/linux/BK/bleeding-2.5
into kroah.com:/home/linux/linux/BK/pnp-2.5
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/isapnp.h | 138 | ||||
| -rw-r--r-- | include/linux/pci.h | 19 | ||||
| -rw-r--r-- | include/linux/pnp.h | 47 |
3 files changed, 42 insertions, 162 deletions
diff --git a/include/linux/isapnp.h b/include/linux/isapnp.h index 7008adef1677..3e03c39fbc40 100644 --- a/include/linux/isapnp.h +++ b/include/linux/isapnp.h @@ -24,6 +24,7 @@ #include <linux/config.h> #include <linux/errno.h> +#include <linux/pnp.h> /* * Configuration registers (TODO: change by specification) @@ -54,79 +55,7 @@ #ifdef __KERNEL__ -#include <linux/pci.h> - -#define ISAPNP_PORT_FLAG_16BITADDR (1<<0) -#define ISAPNP_PORT_FLAG_FIXED (1<<1) - -struct isapnp_port { - unsigned short min; /* min base number */ - unsigned short max; /* max base number */ - unsigned char align; /* align boundary */ - unsigned char size; /* size of range */ - unsigned char flags; /* port flags */ - unsigned char pad; /* pad */ - struct isapnp_resources *res; /* parent */ - struct isapnp_port *next; /* next port */ -}; - -struct isapnp_irq { - unsigned short map; /* bitmaks for IRQ lines */ - unsigned char flags; /* IRQ flags */ - unsigned char pad; /* pad */ - struct isapnp_resources *res; /* parent */ - struct isapnp_irq *next; /* next IRQ */ -}; - -struct isapnp_dma { - unsigned char map; /* bitmask for DMA channels */ - unsigned char flags; /* DMA flags */ - struct isapnp_resources *res; /* parent */ - struct isapnp_dma *next; /* next port */ -}; - -struct isapnp_mem { - unsigned int min; /* min base number */ - unsigned int max; /* max base number */ - unsigned int align; /* align boundary */ - unsigned int size; /* size of range */ - unsigned char flags; /* memory flags */ - unsigned char pad; /* pad */ - struct isapnp_resources *res; /* parent */ - struct isapnp_mem *next; /* next memory resource */ -}; - -struct isapnp_mem32 { - /* TODO */ - unsigned char data[17]; - struct isapnp_resources *res; /* parent */ - struct isapnp_mem32 *next; /* next 32-bit memory resource */ -}; - -struct isapnp_fixup { - unsigned short vendor; /* matching vendor */ - unsigned short device; /* matching device */ - void (*quirk_function)(struct pci_dev *dev); /* fixup function */ -}; - - -#define ISAPNP_RES_PRIORITY_PREFERRED 0 -#define ISAPNP_RES_PRIORITY_ACCEPTABLE 1 -#define ISAPNP_RES_PRIORITY_FUNCTIONAL 2 -#define ISAPNP_RES_PRIORITY_INVALID 65535 - -struct isapnp_resources { - unsigned short priority; /* priority */ - unsigned short dependent; /* dependent resources */ - struct isapnp_port *port; /* first port */ - struct isapnp_irq *irq; /* first IRQ */ - struct isapnp_dma *dma; /* first DMA */ - struct isapnp_mem *mem; /* first memory resource */ - struct isapnp_mem32 *mem32; /* first 32-bit memory */ - struct pci_dev *dev; /* parent */ - struct isapnp_resources *alt; /* alternative resource (aka dependent resources) */ - struct isapnp_resources *next; /* next resource */ -}; +#define DEVICE_COUNT_COMPATIBLE 4 #define ISAPNP_ANY_ID 0xffff #define ISAPNP_CARD_DEVS 8 @@ -162,14 +91,6 @@ struct isapnp_device_id { unsigned long driver_data; /* data private to the driver */ }; -struct isapnp_driver { - struct list_head node; - char *name; - const struct isapnp_device_id *id_table; /* NULL if wants all devices */ - int (*probe) (struct pci_dev *dev, const struct isapnp_device_id *id); /* New device inserted */ - void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ -}; - #if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE)) #define __ISAPNP__ @@ -188,7 +109,6 @@ void isapnp_wake(unsigned char csn); void isapnp_device(unsigned char device); void isapnp_activate(unsigned char device); void isapnp_deactivate(unsigned char device); -void isapnp_fixup_device(struct pci_dev *dev); void *isapnp_alloc(long size); #ifdef CONFIG_PROC_FS @@ -199,40 +119,8 @@ static inline isapnp_proc_init(void) { return 0; } static inline isapnp_proc_done(void) { return 0; } #endif -/* misc */ -void isapnp_resource_change(struct resource *resource, - unsigned long start, - unsigned long size); /* init/main.c */ int isapnp_init(void); -/* manager */ -static inline struct pci_bus *isapnp_find_card(unsigned short vendor, - unsigned short device, - struct pci_bus *from) { return NULL; } -static inline struct pci_dev *isapnp_find_dev(struct pci_bus *card, - unsigned short vendor, - unsigned short function, - struct pci_dev *from) { return NULL; } -static inline int isapnp_probe_cards(const struct isapnp_card_id *ids, - int (*probe)(struct pci_bus *card, - const struct isapnp_card_id *id)) { return -ENODEV; } -static inline int isapnp_probe_devs(const struct isapnp_device_id *ids, - int (*probe)(struct pci_dev *dev, - const struct isapnp_device_id *id)) { return -ENODEV; } -static inline int isapnp_activate_dev(struct pci_dev *dev, const char *name) { return -ENODEV; } - -static inline int isapnp_register_driver(struct isapnp_driver *drv) { return 0; } - -static inline void isapnp_unregister_driver(struct isapnp_driver *drv) { } - -extern struct list_head isapnp_cards; -extern struct list_head isapnp_devices; -extern struct pnp_protocol isapnp_protocol; - -#define isapnp_for_each_card(card) \ - for(card = to_pnp_card(isapnp_cards.next); card != to_pnp_card(&isapnp_cards); card = to_pnp_card(card->node.next)) -#define isapnp_for_each_dev(dev) \ - for(dev = protocol_to_pnp_dev(isapnp_protocol.devices.next); dev != protocol_to_pnp_dev(&isapnp_protocol.devices); dev = protocol_to_pnp_dev(dev->dev_list.next)) #else /* !CONFIG_ISAPNP */ @@ -250,28 +138,6 @@ static inline void isapnp_wake(unsigned char csn) { ; } static inline void isapnp_device(unsigned char device) { ; } static inline void isapnp_activate(unsigned char device) { ; } static inline void isapnp_deactivate(unsigned char device) { ; } -/* manager */ -static inline struct pci_bus *isapnp_find_card(unsigned short vendor, - unsigned short device, - struct pci_bus *from) { return NULL; } -static inline struct pci_dev *isapnp_find_dev(struct pci_bus *card, - unsigned short vendor, - unsigned short function, - struct pci_dev *from) { return NULL; } -static inline int isapnp_probe_cards(const struct isapnp_card_id *ids, - int (*probe)(struct pci_bus *card, - const struct isapnp_card_id *id)) { return -ENODEV; } -static inline int isapnp_probe_devs(const struct isapnp_device_id *ids, - int (*probe)(struct pci_dev *dev, - const struct isapnp_device_id *id)) { return -ENODEV; } -static inline void isapnp_resource_change(struct resource *resource, - unsigned long start, - unsigned long size) { ; } -static inline int isapnp_activate_dev(struct pci_dev *dev, const char *name) { return -ENODEV; } - -static inline int isapnp_register_driver(struct isapnp_driver *drv) { return 0; } - -static inline void isapnp_unregister_driver(struct isapnp_driver *drv) { } #endif /* CONFIG_ISAPNP */ diff --git a/include/linux/pci.h b/include/linux/pci.h index 9d4e269ac1db..553864c6a5fb 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -362,7 +362,7 @@ enum pci_mmap_state { #define PCI_ANY_ID (~0) /* - * The pci_dev structure is used to describe both PCI and ISAPnP devices. + * The pci_dev structure is used to describe PCI devices. */ struct pci_dev { struct list_head global_list; /* node in list of all PCI devices */ @@ -410,16 +410,9 @@ struct pci_dev { struct resource irq_resource[DEVICE_COUNT_IRQ]; char slot_name[8]; /* slot name */ - int active; /* ISAPnP: device is active */ - int ro; /* ISAPnP: read only */ - unsigned short regs; /* ISAPnP: supported registers */ /* These fields are used by common fixups */ - unsigned short transparent:1; /* Transparent PCI bridge */ - - int (*prepare)(struct pci_dev *dev); /* ISAPnP hooks */ - int (*activate)(struct pci_dev *dev); - int (*deactivate)(struct pci_dev *dev); + unsigned int transparent:1; /* Transparent PCI bridge */ }; #define pci_dev_g(n) list_entry(n, struct pci_dev, global_list) @@ -463,13 +456,7 @@ struct pci_bus { unsigned char subordinate; /* max number of subordinate buses */ char name[48]; - unsigned short vendor; - unsigned short device; - unsigned int serial; /* serial number */ - unsigned char pnpver; /* Plug & Play version */ - unsigned char productver; /* product version */ - unsigned char checksum; /* if zero - checksum passed */ - unsigned char pad1; + struct device * dev; }; diff --git a/include/linux/pnp.h b/include/linux/pnp.h index d666c6a92b9f..7d4e9fd6ae0e 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h @@ -26,6 +26,7 @@ struct pnp_resource; struct pnp_protocol; struct pnp_id; +struct pnp_cfg; struct pnp_card { char name[80]; @@ -50,11 +51,15 @@ struct pnp_card { #define global_to_pnp_card(n) list_entry(n, struct pnp_card, global_list) #define protocol_to_pnp_card(n) list_entry(n, struct pnp_card, protocol_list) -#define to_pnp_card(n) list_entry(n, struct pnp_card, dev) +#define to_pnp_card(n) container_of(n, struct pnp_card, dev) #define pnp_for_each_card(card) \ - for(dev = global_to_pnp_card(pnp_cards.next); \ - dev != global_to_pnp_card(&cards); \ - dev = global_to_pnp_card(card>global_list.next)) + for((card) = global_to_pnp_card(pnp_cards.next); \ + (card) != global_to_pnp_card(&pnp_cards); \ + (card) = global_to_pnp_card((card)->global_list.next)) +#define pnp_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 *pnpc_get_drvdata (struct pnp_card *pcard) { @@ -79,7 +84,6 @@ 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 ro; /* read only */ 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 */ @@ -93,6 +97,7 @@ struct pnp_dev { unsigned short regs; /* ISAPnP: supported registers */ 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 dma_resource[DEVICE_COUNT_DMA]; struct resource irq_resource[DEVICE_COUNT_IRQ]; @@ -112,6 +117,13 @@ struct pnp_dev { 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; +} + static inline void *pnp_get_drvdata (struct pnp_dev *pdev) { return dev_get_drvdata(&pdev->dev); @@ -160,10 +172,13 @@ struct pnp_card_id { } devs[MAX_DEVICES]; /* logical devices */ }; +#define PNP_DRIVER_DO_NOT_ACTIVATE (1<<0) + struct pnp_driver { struct list_head node; char *name; const struct pnp_device_id *id_table; + unsigned int flags; int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id); void (*remove) (struct pnp_dev *dev); struct device_driver driver; @@ -171,10 +186,13 @@ struct pnp_driver { #define to_pnp_driver(drv) container_of(drv,struct pnp_driver, driver) +#define PNPC_DRIVER_DO_NOT_ACTIVATE (1<<0) + struct pnpc_driver { struct list_head node; char *name; const struct pnp_card_id *id_table; + unsigned int flags; int (*probe) (struct pnp_card *card, const struct pnp_card_id *card_id); void (*remove) (struct pnp_card *card); struct device_driver driver; @@ -279,6 +297,12 @@ struct pnp_resources { struct pnp_resources *dep; /* dependent resources */ }; +struct pnp_res_cfg { + struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and 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 */ @@ -287,7 +311,7 @@ struct pnp_cfg { struct pnp_irq *irq[2]; struct pnp_dma *dma[2]; struct pnp_mem *mem[4]; - struct pnp_dev request; + struct pnp_res_cfg request; }; @@ -340,9 +364,11 @@ int pnp_add_dma_resource(struct pnp_dev *dev, int depnum, struct pnp_dma *data); int pnp_add_port_resource(struct pnp_dev *dev, int depnum, struct pnp_port *data); int pnp_add_mem_resource(struct pnp_dev *dev, int depnum, struct pnp_mem *data); int pnp_add_mem32_resource(struct pnp_dev *dev, int depnum, struct pnp_mem32 *data); -int pnp_activate_dev(struct pnp_dev *dev); +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, int mode); +int pnp_raw_set_dev(struct pnp_dev *dev, int depnum, struct pnp_res_cfg *template, int mode); +void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size); /* driver */ int compare_pnp_id(struct pnp_id * pos, const char * id); @@ -366,9 +392,10 @@ static inline int pnp_add_dma_resource(struct pnp_dev *dev, int depnum, struct p static inline int pnp_add_port_resource(struct pnp_dev *dev, int depnum, struct pnp_irq *data) { return -ENODEV; } static inline int pnp_add_mem_resource(struct pnp_dev *dev, int depnum, struct pnp_irq *data) { return -ENODEV; } static inline int pnp_add_mem32_resource(struct pnp_dev *dev, int depnum, struct pnp_irq *data) { return -ENODEV; } -static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; } +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, int mode) { 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 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; } |
