diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/pnp.h | 230 | ||||
| -rw-r--r-- | include/linux/pnpbios.h | 13 | ||||
| -rw-r--r-- | include/linux/sunrpc/stats.h | 18 |
3 files changed, 213 insertions, 48 deletions
diff --git a/include/linux/pnp.h b/include/linux/pnp.h index a3ff68f36634..d666c6a92b9f 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h @@ -1,3 +1,9 @@ +/* + * Linux Plug and Play Support + * Copyright by Adam Belay <ambx1@neo.rr.com> + * + */ + #ifndef _LINUX_PNP_H #define _LINUX_PNP_H @@ -5,110 +11,213 @@ #include <linux/device.h> #include <linux/list.h> +#include <linux/errno.h> -/* Device Managemnt */ +/* + * Device Managemnt + */ #define DEVICE_COUNT_IRQ 2 #define DEVICE_COUNT_DMA 2 #define DEVICE_COUNT_RESOURCE 12 +#define MAX_DEVICES 8 struct pnp_resource; struct pnp_protocol; +struct pnp_id; -struct pnp_card { /* this is for ISAPNP */ - struct list_head node; /* node in list of cards */ +struct pnp_card { char name[80]; unsigned char number; /* card number */ - struct list_head ids; /* stores all supported dev ids */ + struct list_head global_list; /* node in global list of cards */ + struct list_head protocol_list; /* node in protocol's list of cards */ struct list_head devices; /* devices attached to the card */ + struct pnp_protocol * protocol; + struct pnp_id * id; /* contains supported EISA IDs*/ + unsigned char pnpver; /* Plug & Play version */ unsigned char productver; /* product version */ unsigned int serial; /* serial number */ unsigned char checksum; /* if zero - checksum passed */ + void * protocol_data; /* Used to store protocol specific data */ + + struct pnpc_driver * driver; /* pointer to the driver bound to this device */ + struct list_head rdevs; /* a list of devices requested by the card driver */ struct proc_dir_entry *procdir; /* directory entry in /proc/bus/isapnp */ + struct device dev; /* Driver Model device interface */ }; -#define to_pnp_card(n) list_entry(n, struct pnp_card, node) +#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 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)) + +static inline void *pnpc_get_drvdata (struct pnp_card *pcard) +{ + return dev_get_drvdata(&pcard->dev); +} + +static inline void pnpc_set_drvdata (struct pnp_card *pcard, void *data) +{ + dev_set_drvdata(&pcard->dev, data); +} + +static inline void *pnpc_get_protodata (struct pnp_card *pcard) +{ + return pcard->protocol_data; +} + +static inline void pnpc_set_protodata (struct pnp_card *pcard, void *data) +{ + pcard->protocol_data = data; +} struct pnp_dev { char name[80]; /* device name */ int active; /* status of the device */ int ro; /* read only */ - struct list_head dev_list; /* node in list of device's protocol */ - struct list_head global_list; - struct list_head card_list; + 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 */ + struct list_head rdev_list; /* node in cards list of requested devices */ struct pnp_protocol * protocol; - struct pnp_card *card; + struct pnp_card * card; + struct pnp_id * id; /* contains supported EISA IDs*/ + void * protocol_data; /* Used to store protocol specific data */ unsigned char number; /* must be unique */ unsigned short regs; /* ISAPnP: supported registers */ - struct list_head ids; /* stores all supported dev ids */ + struct pnp_resources *res; /* possible resource information */ 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]; - struct pnp_driver * driver; /* which driver has allocated this device */ + struct pnp_driver * driver; /* pointer to the driver bound to this device */ struct device dev; /* Driver Model device interface */ - void * driver_data;/* data private to the driver */ - void * protocol_data; + int flags; /* used by protocols */ struct proc_dir_entry *procent; /* device entry in /proc/bus/isapnp */ }; #define global_to_pnp_dev(n) list_entry(n, struct pnp_dev, global_list) #define card_to_pnp_dev(n) list_entry(n, struct pnp_dev, card_list) -#define protocol_to_pnp_dev(n) list_entry(n, struct pnp_dev, dev_list) +#define protocol_to_pnp_dev(n) list_entry(n, struct pnp_dev, protocol_list) #define to_pnp_dev(n) container_of(n, struct pnp_dev, dev) #define pnp_for_each_dev(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 void *pnp_get_drvdata (struct pnp_dev *pdev) +{ + return dev_get_drvdata(&pdev->dev); +} + +static inline void pnp_set_drvdata (struct pnp_dev *pdev, void *data) +{ + dev_set_drvdata(&pdev->dev, data); +} + +static inline void *pnp_get_protodata (struct pnp_dev *pdev) +{ + return pdev->protocol_data; +} + +static inline void pnp_set_protodata (struct pnp_dev *pdev, void *data) +{ + pdev->protocol_data = data; +} + struct pnp_fixup { char id[7]; void (*quirk_function)(struct pnp_dev *dev); /* fixup function */ }; + /* - * Linux Plug and Play Support - * Copyright by Adam Belay <ambx1@neo.rr.com> - * + * Driver Management */ -/* Driver Management */ - struct pnp_id { char id[7]; + struct pnp_id * next; +}; + +struct pnp_device_id { + char id[7]; unsigned long driver_data; /* data private to the driver */ - struct list_head id_list; /* node in card's or device's list */ }; -#define to_pnp_id(n) list_entry(n, struct pnp_id, id_list) +struct pnp_card_id { + char id[7]; + unsigned long driver_data; /* data private to the driver */ + struct { + char id[7]; + } devs[MAX_DEVICES]; /* logical devices */ +}; struct pnp_driver { struct list_head node; char *name; - const struct pnp_id *card_id_table; - const struct pnp_id *id_table; - int (*probe) (struct pnp_dev *dev, const struct pnp_id *card_id, - const struct pnp_id *dev_id); + const struct pnp_device_id *id_table; + int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id); void (*remove) (struct pnp_dev *dev); - struct device_driver driver; + struct device_driver driver; }; #define to_pnp_driver(drv) container_of(drv,struct pnp_driver, driver) +struct pnpc_driver { + struct list_head node; + char *name; + const struct pnp_card_id *id_table; + int (*probe) (struct pnp_card *card, const struct pnp_card_id *card_id); + void (*remove) (struct pnp_card *card); + struct device_driver driver; +}; + +#define to_pnpc_driver(drv) container_of(drv,struct pnpc_driver, driver) + + +/* + * Resource Management + */ -/* Resource Management */ +/* 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_len(dev,bar) \ + ((pnp_port_start((dev),(bar)) == 0 && \ + pnp_port_end((dev),(bar)) == \ + pnp_port_start((dev),(bar))) ? 0 : \ + \ + (pnp_port_end((dev),(bar)) - \ + pnp_port_start((dev),(bar)) + 1)) -#define DEV_IO(dev, index) (dev->resource[index].start) -#define DEV_MEM(dev, index) (dev->resource[index+8].start) -#define DEV_IRQ(dev, index) (dev->irq_resource[index].start) -#define DEV_DMA(dev, index) (dev->dma_resource[index].start) +#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_len(dev,bar) \ + ((pnp_mem_start((dev),(bar)) == 0 && \ + pnp_mem_end((dev),(bar)) == \ + pnp_mem_start((dev),(bar))) ? 0 : \ + \ + (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_dma(dev,bar) ((dev)->dma_resource[(bar)].start) +#define pnp_dma_flags(dev,bar) ((dev)->dma_resource[(bar)].flags) #define PNP_PORT_FLAG_16BITADDR (1<<0) -#define PNP_PORT_FLAG_FIXED (1<<1) +#define PNP_PORT_FLAG_FIXED (1<<1) struct pnp_port { unsigned short min; /* min base number */ @@ -182,7 +291,9 @@ struct pnp_cfg { }; -/* Protocol Management */ +/* + * Protocol Management + */ struct pnp_protocol { struct list_head protocol_list; @@ -196,18 +307,26 @@ struct pnp_protocol { /* used by pnp layer only (look but don't touch) */ unsigned char number; /* protocol number*/ struct device dev; /* link to driver model */ + struct list_head cards; struct list_head devices; }; #define to_pnp_protocol(n) list_entry(n, struct pnp_protocol, protocol_list) +#define protocol_for_each_card(protocol,card) \ + for((card) = protocol_to_pnp_card((protocol)->cards.next); \ + (card) != protocol_to_pnp_card(&(protocol)->cards); \ + (card) = protocol_to_pnp_card((card)->protocol_list.next)) +#define protocol_for_each_dev(protocol,dev) \ + for((dev) = protocol_to_pnp_dev((protocol)->devices.next); \ + (dev) != protocol_to_pnp_dev(&(protocol)->devices); \ + (dev) = protocol_to_pnp_dev((dev)->protocol_list.next)) #if defined(CONFIG_PNP) /* core */ -int pnp_protocol_register(struct pnp_protocol *protocol); -void pnp_protocol_unregister(struct pnp_protocol *protocol); -int pnp_init_device(struct pnp_dev *dev); +int pnp_register_protocol(struct pnp_protocol *protocol); +void pnp_unregister_protocol(struct pnp_protocol *protocol); int pnp_add_device(struct pnp_dev *dev); void pnp_remove_device(struct pnp_dev *dev); extern struct list_head pnp_global; @@ -226,7 +345,7 @@ int pnp_disable_dev(struct pnp_dev *dev); int pnp_raw_set_dev(struct pnp_dev *dev, int depnum, int mode); /* driver */ -int compare_pnp_id(struct list_head * id_list, const char * id); +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); @@ -234,8 +353,8 @@ void pnp_unregister_driver(struct pnp_driver *drv); #else /* just in case anyone decides to call these without PnP Support Enabled */ -static inline int pnp_protocol_register(struct pnp_protocol *protocol) { return -ENODEV; } -static inline void pnp_protocol_unregister(struct pnp_protocol *protocol) { } +static inline int pnp_register_protocol(struct pnp_protocol *protocol) { return -ENODEV; } +static inline void pnp_unregister_protocol(struct pnp_protocol *protocol) { } static inline int pnp_init_device(struct pnp_dev *dev) { return -ENODEV; } static inline int pnp_add_device(struct pnp_dev *dev) { return -ENODEV; } static inline void pnp_remove_device(struct pnp_dev *dev) { } @@ -250,14 +369,45 @@ static inline int pnp_add_mem32_resource(struct pnp_dev *dev, int depnum, struct static inline int pnp_activate_dev(struct pnp_dev *dev) { 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 compare_pnp_id(struct list_head * id_list, char * id) { 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; } static inline void pnp_unregister_driver(struct pnp_driver *drv) { ; } #endif /* CONFIG_PNP */ + +#if defined(CONFIG_PNP_CARD) + +/* card */ +int pnpc_add_card(struct pnp_card *card); +void pnpc_remove_card(struct pnp_card *card); +int pnpc_add_device(struct pnp_card *card, struct pnp_dev *dev); +void pnpc_remove_device(struct pnp_dev *dev); +struct pnp_dev * pnp_request_card_device(struct pnp_card *card, const char *id, struct pnp_dev *from); +void pnp_release_card_device(struct pnp_dev *dev); +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; + +#else + +static inline int pnpc_add_card(struct pnp_card *card) { return -ENODEV; } +static inline void pnpc_remove_card(struct pnp_card *card) { ; } +static inline int pnpc_add_device(struct pnp_card *card, struct pnp_dev *dev) { return -ENODEV; } +static inline void pnpc_remove_device(struct pnp_dev *dev) { ; } +static inline struct pnp_dev * pnp_request_card_device(struct pnp_card *card, const char *id, struct pnp_dev *from) { return NULL; } +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; } + +#endif /* CONFIG_PNP_CARD */ + + #if defined(CONFIG_ISAPNP) + /* compat */ struct pnp_card *pnp_find_card(unsigned short vendor, unsigned short device, diff --git a/include/linux/pnpbios.h b/include/linux/pnpbios.h index de5064f6f420..2363817caa7f 100644 --- a/include/linux/pnpbios.h +++ b/include/linux/pnpbios.h @@ -75,6 +75,19 @@ #define PNPMSG_POWER_OFF 0x41 #define PNPMSG_PNP_OS_ACTIVE 0x42 #define PNPMSG_PNP_OS_INACTIVE 0x43 +/* + * 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 + /* 0x8000 through 0xffff are OEM defined */ #pragma pack(1) diff --git a/include/linux/sunrpc/stats.h b/include/linux/sunrpc/stats.h index 8553d06059bd..6feb82ded752 100644 --- a/include/linux/sunrpc/stats.h +++ b/include/linux/sunrpc/stats.h @@ -61,16 +61,18 @@ extern struct proc_dir_entry *proc_net_rpc; #else +static inline struct proc_dir_entry *rpc_proc_register(struct rpc_stat *s) { return NULL; } +static inline void rpc_proc_unregister(const char *p) {} +static inline int rpc_proc_read(char *a, char **b, off_t c, int d, int *e, void *f) { return 0; } +static inline void rpc_proc_zero(struct rpc_program *p) {} + +static inline struct proc_dir_entry *svc_proc_register(struct svc_stat *s) { return NULL; } static inline void svc_proc_unregister(const char *p) {} -static inline struct proc_dir_entry*svc_proc_register(struct svc_stat *s) -{ - return NULL; -} +static inline int svc_proc_read(char *a, char **b, off_t c, int d, int *e, void *f) { return 0; } +static inline void svc_proc_zero(struct svc_program *p) {} + +#define proc_net_rpc NULL -static inline int svc_proc_read(char *a, char **b, off_t c, int d, int *e, void *f) -{ - return 0; -} #endif #endif /* _LINUX_SUNRPC_STATS_H */ |
