diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/isapnp.h | 10 | ||||
| -rw-r--r-- | include/linux/pnp.h | 208 | ||||
| -rw-r--r-- | include/linux/pnpbios.h | 151 | ||||
| -rw-r--r-- | include/linux/thermal.h | 39 |
4 files changed, 135 insertions, 273 deletions
diff --git a/include/linux/isapnp.h b/include/linux/isapnp.h index 1e8728a9ee8a..cd5a269fdb5e 100644 --- a/include/linux/isapnp.h +++ b/include/linux/isapnp.h | |||
| @@ -26,16 +26,6 @@ | |||
| 26 | #include <linux/pnp.h> | 26 | #include <linux/pnp.h> |
| 27 | 27 | ||
| 28 | /* | 28 | /* |
| 29 | * Configuration registers (TODO: change by specification) | ||
| 30 | */ | ||
| 31 | |||
| 32 | #define ISAPNP_CFG_ACTIVATE 0x30 /* byte */ | ||
| 33 | #define ISAPNP_CFG_MEM 0x40 /* 4 * dword */ | ||
| 34 | #define ISAPNP_CFG_PORT 0x60 /* 8 * word */ | ||
| 35 | #define ISAPNP_CFG_IRQ 0x70 /* 2 * word */ | ||
| 36 | #define ISAPNP_CFG_DMA 0x74 /* 2 * byte */ | ||
| 37 | |||
| 38 | /* | ||
| 39 | * | 29 | * |
| 40 | */ | 30 | */ |
| 41 | 31 | ||
diff --git a/include/linux/pnp.h b/include/linux/pnp.h index 2f3bcf73052c..63b128d512fb 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h | |||
| @@ -11,59 +11,122 @@ | |||
| 11 | #include <linux/errno.h> | 11 | #include <linux/errno.h> |
| 12 | #include <linux/mod_devicetable.h> | 12 | #include <linux/mod_devicetable.h> |
| 13 | 13 | ||
| 14 | #define PNP_MAX_PORT 40 | ||
| 15 | #define PNP_MAX_MEM 24 | ||
| 16 | #define PNP_MAX_IRQ 2 | ||
| 17 | #define PNP_MAX_DMA 2 | ||
| 18 | #define PNP_NAME_LEN 50 | 14 | #define PNP_NAME_LEN 50 |
| 19 | 15 | ||
| 20 | struct pnp_protocol; | 16 | struct pnp_protocol; |
| 21 | struct pnp_dev; | 17 | struct pnp_dev; |
| 18 | struct pnp_resource_table; | ||
| 22 | 19 | ||
| 23 | /* | 20 | /* |
| 24 | * Resource Management | 21 | * Resource Management |
| 25 | */ | 22 | */ |
| 23 | struct resource *pnp_get_resource(struct pnp_dev *, unsigned int, unsigned int); | ||
| 24 | |||
| 25 | static inline int pnp_resource_valid(struct resource *res) | ||
| 26 | { | ||
| 27 | if (res && !(res->flags & IORESOURCE_UNSET)) | ||
| 28 | return 1; | ||
| 29 | return 0; | ||
| 30 | } | ||
| 31 | |||
| 32 | static inline resource_size_t pnp_resource_len(struct resource *res) | ||
| 33 | { | ||
| 34 | if (res->start == 0 && res->end == 0) | ||
| 35 | return 0; | ||
| 36 | return res->end - res->start + 1; | ||
| 37 | } | ||
| 38 | |||
| 39 | |||
| 40 | static inline resource_size_t pnp_port_start(struct pnp_dev *dev, | ||
| 41 | unsigned int bar) | ||
| 42 | { | ||
| 43 | return pnp_get_resource(dev, IORESOURCE_IO, bar)->start; | ||
| 44 | } | ||
| 45 | |||
| 46 | static inline resource_size_t pnp_port_end(struct pnp_dev *dev, | ||
| 47 | unsigned int bar) | ||
| 48 | { | ||
| 49 | return pnp_get_resource(dev, IORESOURCE_IO, bar)->end; | ||
| 50 | } | ||
| 51 | |||
| 52 | static inline unsigned long pnp_port_flags(struct pnp_dev *dev, | ||
| 53 | unsigned int bar) | ||
| 54 | { | ||
| 55 | return pnp_get_resource(dev, IORESOURCE_IO, bar)->flags; | ||
| 56 | } | ||
| 57 | |||
| 58 | static inline int pnp_port_valid(struct pnp_dev *dev, unsigned int bar) | ||
| 59 | { | ||
| 60 | return pnp_resource_valid(pnp_get_resource(dev, IORESOURCE_IO, bar)); | ||
| 61 | } | ||
| 62 | |||
| 63 | static inline resource_size_t pnp_port_len(struct pnp_dev *dev, | ||
| 64 | unsigned int bar) | ||
| 65 | { | ||
| 66 | return pnp_resource_len(pnp_get_resource(dev, IORESOURCE_IO, bar)); | ||
| 67 | } | ||
| 68 | |||
| 69 | |||
| 70 | static inline resource_size_t pnp_mem_start(struct pnp_dev *dev, | ||
| 71 | unsigned int bar) | ||
| 72 | { | ||
| 73 | return pnp_get_resource(dev, IORESOURCE_MEM, bar)->start; | ||
| 74 | } | ||
| 75 | |||
| 76 | static inline resource_size_t pnp_mem_end(struct pnp_dev *dev, | ||
| 77 | unsigned int bar) | ||
| 78 | { | ||
| 79 | return pnp_get_resource(dev, IORESOURCE_MEM, bar)->end; | ||
| 80 | } | ||
| 81 | |||
| 82 | static inline unsigned long pnp_mem_flags(struct pnp_dev *dev, unsigned int bar) | ||
| 83 | { | ||
| 84 | return pnp_get_resource(dev, IORESOURCE_MEM, bar)->flags; | ||
| 85 | } | ||
| 86 | |||
| 87 | static inline int pnp_mem_valid(struct pnp_dev *dev, unsigned int bar) | ||
| 88 | { | ||
| 89 | return pnp_resource_valid(pnp_get_resource(dev, IORESOURCE_MEM, bar)); | ||
| 90 | } | ||
| 91 | |||
| 92 | static inline resource_size_t pnp_mem_len(struct pnp_dev *dev, | ||
| 93 | unsigned int bar) | ||
| 94 | { | ||
| 95 | return pnp_resource_len(pnp_get_resource(dev, IORESOURCE_MEM, bar)); | ||
| 96 | } | ||
| 97 | |||
| 98 | |||
| 99 | static inline resource_size_t pnp_irq(struct pnp_dev *dev, unsigned int bar) | ||
| 100 | { | ||
| 101 | return pnp_get_resource(dev, IORESOURCE_IRQ, bar)->start; | ||
| 102 | } | ||
| 103 | |||
| 104 | static inline unsigned long pnp_irq_flags(struct pnp_dev *dev, unsigned int bar) | ||
| 105 | { | ||
| 106 | return pnp_get_resource(dev, IORESOURCE_IRQ, bar)->flags; | ||
| 107 | } | ||
| 108 | |||
| 109 | static inline int pnp_irq_valid(struct pnp_dev *dev, unsigned int bar) | ||
| 110 | { | ||
| 111 | return pnp_resource_valid(pnp_get_resource(dev, IORESOURCE_IRQ, bar)); | ||
| 112 | } | ||
| 113 | |||
| 114 | |||
| 115 | static inline resource_size_t pnp_dma(struct pnp_dev *dev, unsigned int bar) | ||
| 116 | { | ||
| 117 | return pnp_get_resource(dev, IORESOURCE_DMA, bar)->start; | ||
| 118 | } | ||
| 119 | |||
| 120 | static inline unsigned long pnp_dma_flags(struct pnp_dev *dev, unsigned int bar) | ||
| 121 | { | ||
| 122 | return pnp_get_resource(dev, IORESOURCE_DMA, bar)->flags; | ||
| 123 | } | ||
| 124 | |||
| 125 | static inline int pnp_dma_valid(struct pnp_dev *dev, unsigned int bar) | ||
| 126 | { | ||
| 127 | return pnp_resource_valid(pnp_get_resource(dev, IORESOURCE_DMA, bar)); | ||
| 128 | } | ||
| 26 | 129 | ||
| 27 | /* Use these instead of directly reading pnp_dev to get resource information */ | ||
| 28 | #define pnp_port_start(dev,bar) ((dev)->res.port_resource[(bar)].start) | ||
| 29 | #define pnp_port_end(dev,bar) ((dev)->res.port_resource[(bar)].end) | ||
| 30 | #define pnp_port_flags(dev,bar) ((dev)->res.port_resource[(bar)].flags) | ||
| 31 | #define pnp_port_valid(dev,bar) \ | ||
| 32 | ((pnp_port_flags((dev),(bar)) & (IORESOURCE_IO | IORESOURCE_UNSET)) \ | ||
| 33 | == IORESOURCE_IO) | ||
| 34 | #define pnp_port_len(dev,bar) \ | ||
| 35 | ((pnp_port_start((dev),(bar)) == 0 && \ | ||
| 36 | pnp_port_end((dev),(bar)) == \ | ||
| 37 | pnp_port_start((dev),(bar))) ? 0 : \ | ||
| 38 | \ | ||
| 39 | (pnp_port_end((dev),(bar)) - \ | ||
| 40 | pnp_port_start((dev),(bar)) + 1)) | ||
| 41 | |||
| 42 | #define pnp_mem_start(dev,bar) ((dev)->res.mem_resource[(bar)].start) | ||
| 43 | #define pnp_mem_end(dev,bar) ((dev)->res.mem_resource[(bar)].end) | ||
| 44 | #define pnp_mem_flags(dev,bar) ((dev)->res.mem_resource[(bar)].flags) | ||
| 45 | #define pnp_mem_valid(dev,bar) \ | ||
| 46 | ((pnp_mem_flags((dev),(bar)) & (IORESOURCE_MEM | IORESOURCE_UNSET)) \ | ||
| 47 | == IORESOURCE_MEM) | ||
| 48 | #define pnp_mem_len(dev,bar) \ | ||
| 49 | ((pnp_mem_start((dev),(bar)) == 0 && \ | ||
| 50 | pnp_mem_end((dev),(bar)) == \ | ||
| 51 | pnp_mem_start((dev),(bar))) ? 0 : \ | ||
| 52 | \ | ||
| 53 | (pnp_mem_end((dev),(bar)) - \ | ||
| 54 | pnp_mem_start((dev),(bar)) + 1)) | ||
| 55 | |||
| 56 | #define pnp_irq(dev,bar) ((dev)->res.irq_resource[(bar)].start) | ||
| 57 | #define pnp_irq_flags(dev,bar) ((dev)->res.irq_resource[(bar)].flags) | ||
| 58 | #define pnp_irq_valid(dev,bar) \ | ||
| 59 | ((pnp_irq_flags((dev),(bar)) & (IORESOURCE_IRQ | IORESOURCE_UNSET)) \ | ||
| 60 | == IORESOURCE_IRQ) | ||
| 61 | |||
| 62 | #define pnp_dma(dev,bar) ((dev)->res.dma_resource[(bar)].start) | ||
| 63 | #define pnp_dma_flags(dev,bar) ((dev)->res.dma_resource[(bar)].flags) | ||
| 64 | #define pnp_dma_valid(dev,bar) \ | ||
| 65 | ((pnp_dma_flags((dev),(bar)) & (IORESOURCE_DMA | IORESOURCE_UNSET)) \ | ||
| 66 | == IORESOURCE_DMA) | ||
| 67 | 130 | ||
| 68 | #define PNP_PORT_FLAG_16BITADDR (1<<0) | 131 | #define PNP_PORT_FLAG_16BITADDR (1<<0) |
| 69 | #define PNP_PORT_FLAG_FIXED (1<<1) | 132 | #define PNP_PORT_FLAG_FIXED (1<<1) |
| @@ -116,13 +179,6 @@ struct pnp_option { | |||
| 116 | struct pnp_option *next; /* used to chain dependent resources */ | 179 | struct pnp_option *next; /* used to chain dependent resources */ |
| 117 | }; | 180 | }; |
| 118 | 181 | ||
| 119 | struct pnp_resource_table { | ||
| 120 | struct resource port_resource[PNP_MAX_PORT]; | ||
| 121 | struct resource mem_resource[PNP_MAX_MEM]; | ||
| 122 | struct resource dma_resource[PNP_MAX_DMA]; | ||
| 123 | struct resource irq_resource[PNP_MAX_IRQ]; | ||
| 124 | }; | ||
| 125 | |||
| 126 | /* | 182 | /* |
| 127 | * Device Management | 183 | * Device Management |
| 128 | */ | 184 | */ |
| @@ -192,10 +248,9 @@ struct pnp_dev { | |||
| 192 | int capabilities; | 248 | int capabilities; |
| 193 | struct pnp_option *independent; | 249 | struct pnp_option *independent; |
| 194 | struct pnp_option *dependent; | 250 | struct pnp_option *dependent; |
| 195 | struct pnp_resource_table res; | 251 | struct pnp_resource_table *res; |
| 196 | 252 | ||
| 197 | char name[PNP_NAME_LEN]; /* contains a human-readable name */ | 253 | char name[PNP_NAME_LEN]; /* contains a human-readable name */ |
| 198 | unsigned short regs; /* ISAPnP: supported registers */ | ||
| 199 | int flags; /* used by protocols */ | 254 | int flags; /* used by protocols */ |
| 200 | struct proc_dir_entry *procent; /* device entry in /proc/bus/isapnp */ | 255 | struct proc_dir_entry *procent; /* device entry in /proc/bus/isapnp */ |
| 201 | void *data; | 256 | void *data; |
| @@ -326,8 +381,8 @@ struct pnp_protocol { | |||
| 326 | char *name; | 381 | char *name; |
| 327 | 382 | ||
| 328 | /* resource control functions */ | 383 | /* resource control functions */ |
| 329 | int (*get) (struct pnp_dev *dev, struct pnp_resource_table *res); | 384 | int (*get) (struct pnp_dev *dev); |
| 330 | int (*set) (struct pnp_dev *dev, struct pnp_resource_table *res); | 385 | int (*set) (struct pnp_dev *dev); |
| 331 | int (*disable) (struct pnp_dev *dev); | 386 | int (*disable) (struct pnp_dev *dev); |
| 332 | 387 | ||
| 333 | /* protocol specific suspend/resume */ | 388 | /* protocol specific suspend/resume */ |
| @@ -356,20 +411,12 @@ extern struct bus_type pnp_bus_type; | |||
| 356 | #if defined(CONFIG_PNP) | 411 | #if defined(CONFIG_PNP) |
| 357 | 412 | ||
| 358 | /* device management */ | 413 | /* device management */ |
| 359 | int pnp_register_protocol(struct pnp_protocol *protocol); | ||
| 360 | void pnp_unregister_protocol(struct pnp_protocol *protocol); | ||
| 361 | int pnp_add_device(struct pnp_dev *dev); | ||
| 362 | int pnp_device_attach(struct pnp_dev *pnp_dev); | 414 | int pnp_device_attach(struct pnp_dev *pnp_dev); |
| 363 | void pnp_device_detach(struct pnp_dev *pnp_dev); | 415 | void pnp_device_detach(struct pnp_dev *pnp_dev); |
| 364 | extern struct list_head pnp_global; | 416 | extern struct list_head pnp_global; |
| 365 | extern int pnp_platform_devices; | 417 | extern int pnp_platform_devices; |
| 366 | 418 | ||
| 367 | /* multidevice card support */ | 419 | /* multidevice card support */ |
| 368 | int pnp_add_card(struct pnp_card *card); | ||
| 369 | void pnp_remove_card(struct pnp_card *card); | ||
| 370 | int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev); | ||
| 371 | void pnp_remove_card_device(struct pnp_dev *dev); | ||
| 372 | int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card); | ||
| 373 | struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, | 420 | struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, |
| 374 | const char *id, struct pnp_dev *from); | 421 | const char *id, struct pnp_dev *from); |
| 375 | void pnp_release_card_device(struct pnp_dev *dev); | 422 | void pnp_release_card_device(struct pnp_dev *dev); |
| @@ -378,77 +425,42 @@ void pnp_unregister_card_driver(struct pnp_card_driver *drv); | |||
| 378 | extern struct list_head pnp_cards; | 425 | extern struct list_head pnp_cards; |
| 379 | 426 | ||
| 380 | /* resource management */ | 427 | /* resource management */ |
| 381 | struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev); | ||
| 382 | struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev, | ||
| 383 | int priority); | ||
| 384 | int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data); | ||
| 385 | int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data); | ||
| 386 | int pnp_register_port_resource(struct pnp_option *option, | ||
| 387 | struct pnp_port *data); | ||
| 388 | int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data); | ||
| 389 | void pnp_init_resource_table(struct pnp_resource_table *table); | ||
| 390 | int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, | ||
| 391 | int mode); | ||
| 392 | int pnp_auto_config_dev(struct pnp_dev *dev); | 428 | int pnp_auto_config_dev(struct pnp_dev *dev); |
| 393 | int pnp_validate_config(struct pnp_dev *dev); | ||
| 394 | int pnp_start_dev(struct pnp_dev *dev); | 429 | int pnp_start_dev(struct pnp_dev *dev); |
| 395 | int pnp_stop_dev(struct pnp_dev *dev); | 430 | int pnp_stop_dev(struct pnp_dev *dev); |
| 396 | int pnp_activate_dev(struct pnp_dev *dev); | 431 | int pnp_activate_dev(struct pnp_dev *dev); |
| 397 | int pnp_disable_dev(struct pnp_dev *dev); | 432 | int pnp_disable_dev(struct pnp_dev *dev); |
| 398 | void pnp_resource_change(struct resource *resource, resource_size_t start, | ||
| 399 | resource_size_t size); | ||
| 400 | 433 | ||
| 401 | /* protocol helpers */ | 434 | /* protocol helpers */ |
| 402 | int pnp_is_active(struct pnp_dev *dev); | 435 | int pnp_is_active(struct pnp_dev *dev); |
| 403 | int compare_pnp_id(struct pnp_id *pos, const char *id); | 436 | int compare_pnp_id(struct pnp_id *pos, const char *id); |
| 404 | int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev); | ||
| 405 | int pnp_register_driver(struct pnp_driver *drv); | 437 | int pnp_register_driver(struct pnp_driver *drv); |
| 406 | void pnp_unregister_driver(struct pnp_driver *drv); | 438 | void pnp_unregister_driver(struct pnp_driver *drv); |
| 407 | 439 | ||
| 408 | #else | 440 | #else |
| 409 | 441 | ||
| 410 | /* device management */ | 442 | /* device management */ |
| 411 | static inline int pnp_register_protocol(struct pnp_protocol *protocol) { return -ENODEV; } | ||
| 412 | static inline void pnp_unregister_protocol(struct pnp_protocol *protocol) { } | ||
| 413 | static inline int pnp_init_device(struct pnp_dev *dev) { return -ENODEV; } | ||
| 414 | static inline int pnp_add_device(struct pnp_dev *dev) { return -ENODEV; } | ||
| 415 | static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; } | 443 | static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; } |
| 416 | static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { } | 444 | static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { } |
| 417 | 445 | ||
| 418 | #define pnp_platform_devices 0 | 446 | #define pnp_platform_devices 0 |
| 419 | 447 | ||
| 420 | /* multidevice card support */ | 448 | /* multidevice card support */ |
| 421 | static inline int pnp_add_card(struct pnp_card *card) { return -ENODEV; } | ||
| 422 | static inline void pnp_remove_card(struct pnp_card *card) { } | ||
| 423 | static inline int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev) { return -ENODEV; } | ||
| 424 | static inline void pnp_remove_card_device(struct pnp_dev *dev) { } | ||
| 425 | static inline int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card) { return -ENODEV; } | ||
| 426 | static inline struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, const char *id, struct pnp_dev *from) { return NULL; } | 449 | static inline struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, const char *id, struct pnp_dev *from) { return NULL; } |
| 427 | static inline void pnp_release_card_device(struct pnp_dev *dev) { } | 450 | static inline void pnp_release_card_device(struct pnp_dev *dev) { } |
| 428 | static inline int pnp_register_card_driver(struct pnp_card_driver *drv) { return -ENODEV; } | 451 | static inline int pnp_register_card_driver(struct pnp_card_driver *drv) { return -ENODEV; } |
| 429 | static inline void pnp_unregister_card_driver(struct pnp_card_driver *drv) { } | 452 | static inline void pnp_unregister_card_driver(struct pnp_card_driver *drv) { } |
| 430 | 453 | ||
| 431 | /* resource management */ | 454 | /* resource management */ |
| 432 | static inline struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev) { return NULL; } | ||
| 433 | static inline struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev, int priority) { return NULL; } | ||
| 434 | static inline int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data) { return -ENODEV; } | ||
| 435 | static inline int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data) { return -ENODEV; } | ||
| 436 | static inline int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data) { return -ENODEV; } | ||
| 437 | static inline int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data) { return -ENODEV; } | ||
| 438 | static inline void pnp_init_resource_table(struct pnp_resource_table *table) { } | ||
| 439 | static inline int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode) { return -ENODEV; } | ||
| 440 | static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; } | 455 | static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; } |
| 441 | static inline int pnp_validate_config(struct pnp_dev *dev) { return -ENODEV; } | ||
| 442 | static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; } | 456 | static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; } |
| 443 | static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; } | 457 | static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; } |
| 444 | static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; } | 458 | static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; } |
| 445 | static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; } | 459 | static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; } |
| 446 | static inline void pnp_resource_change(struct resource *resource, resource_size_t start, resource_size_t size) { } | ||
| 447 | 460 | ||
| 448 | /* protocol helpers */ | 461 | /* protocol helpers */ |
| 449 | static inline int pnp_is_active(struct pnp_dev *dev) { return 0; } | 462 | static inline int pnp_is_active(struct pnp_dev *dev) { return 0; } |
| 450 | static inline int compare_pnp_id(struct pnp_id *pos, const char *id) { return -ENODEV; } | 463 | static inline int compare_pnp_id(struct pnp_id *pos, const char *id) { return -ENODEV; } |
| 451 | static inline int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev) { return -ENODEV; } | ||
| 452 | static inline int pnp_register_driver(struct pnp_driver *drv) { return -ENODEV; } | 464 | static inline int pnp_register_driver(struct pnp_driver *drv) { return -ENODEV; } |
| 453 | static inline void pnp_unregister_driver(struct pnp_driver *drv) { } | 465 | static inline void pnp_unregister_driver(struct pnp_driver *drv) { } |
| 454 | 466 | ||
diff --git a/include/linux/pnpbios.h b/include/linux/pnpbios.h deleted file mode 100644 index 329192adc9dd..000000000000 --- a/include/linux/pnpbios.h +++ /dev/null | |||
| @@ -1,151 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Include file for the interface to a PnP BIOS | ||
| 3 | * | ||
| 4 | * Original BIOS code (C) 1998 Christian Schmidt (chr.schmidt@tu-bs.de) | ||
| 5 | * PnP handler parts (c) 1998 Tom Lees <tom@lpsg.demon.co.uk> | ||
| 6 | * Minor reorganizations by David Hinds <dahinds@users.sourceforge.net> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify it | ||
| 9 | * under the terms of the GNU General Public License as published by the | ||
| 10 | * Free Software Foundation; either version 2, or (at your option) any | ||
| 11 | * later version. | ||
| 12 | * | ||
| 13 | * This program is distributed in the hope that it will be useful, but | ||
| 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | * General Public License for more details. | ||
| 17 | * | ||
| 18 | * You should have received a copy of the GNU General Public License | ||
| 19 | * along with this program; if not, write to the Free Software | ||
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 21 | */ | ||
| 22 | |||
| 23 | #ifndef _LINUX_PNPBIOS_H | ||
| 24 | #define _LINUX_PNPBIOS_H | ||
| 25 | |||
| 26 | #ifdef __KERNEL__ | ||
| 27 | |||
| 28 | #include <linux/types.h> | ||
| 29 | #include <linux/pnp.h> | ||
| 30 | |||
| 31 | /* | ||
| 32 | * Return codes | ||
| 33 | */ | ||
| 34 | #define PNP_SUCCESS 0x00 | ||
| 35 | #define PNP_NOT_SET_STATICALLY 0x7f | ||
| 36 | #define PNP_UNKNOWN_FUNCTION 0x81 | ||
| 37 | #define PNP_FUNCTION_NOT_SUPPORTED 0x82 | ||
| 38 | #define PNP_INVALID_HANDLE 0x83 | ||
| 39 | #define PNP_BAD_PARAMETER 0x84 | ||
| 40 | #define PNP_SET_FAILED 0x85 | ||
| 41 | #define PNP_EVENTS_NOT_PENDING 0x86 | ||
| 42 | #define PNP_SYSTEM_NOT_DOCKED 0x87 | ||
| 43 | #define PNP_NO_ISA_PNP_CARDS 0x88 | ||
| 44 | #define PNP_UNABLE_TO_DETERMINE_DOCK_CAPABILITIES 0x89 | ||
| 45 | #define PNP_CONFIG_CHANGE_FAILED_NO_BATTERY 0x8a | ||
| 46 | #define PNP_CONFIG_CHANGE_FAILED_RESOURCE_CONFLICT 0x8b | ||
| 47 | #define PNP_BUFFER_TOO_SMALL 0x8c | ||
| 48 | #define PNP_USE_ESCD_SUPPORT 0x8d | ||
| 49 | #define PNP_MESSAGE_NOT_SUPPORTED 0x8e | ||
| 50 | #define PNP_HARDWARE_ERROR 0x8f | ||
| 51 | |||
| 52 | #define ESCD_SUCCESS 0x00 | ||
| 53 | #define ESCD_IO_ERROR_READING 0x55 | ||
| 54 | #define ESCD_INVALID 0x56 | ||
| 55 | #define ESCD_BUFFER_TOO_SMALL 0x59 | ||
| 56 | #define ESCD_NVRAM_TOO_SMALL 0x5a | ||
| 57 | #define ESCD_FUNCTION_NOT_SUPPORTED 0x81 | ||
| 58 | |||
| 59 | /* | ||
| 60 | * Events that can be received by "get event" | ||
| 61 | */ | ||
| 62 | #define PNPEV_ABOUT_TO_CHANGE_CONFIG 0x0001 | ||
| 63 | #define PNPEV_DOCK_CHANGED 0x0002 | ||
| 64 | #define PNPEV_SYSTEM_DEVICE_CHANGED 0x0003 | ||
| 65 | #define PNPEV_CONFIG_CHANGED_FAILED 0x0004 | ||
| 66 | #define PNPEV_UNKNOWN_SYSTEM_EVENT 0xffff | ||
| 67 | /* 0x8000 through 0xfffe are OEM defined */ | ||
| 68 | |||
| 69 | /* | ||
| 70 | * Messages that should be sent through "send message" | ||
| 71 | */ | ||
| 72 | #define PNPMSG_OK 0x00 | ||
| 73 | #define PNPMSG_ABORT 0x01 | ||
| 74 | #define PNPMSG_UNDOCK_DEFAULT_ACTION 0x40 | ||
| 75 | #define PNPMSG_POWER_OFF 0x41 | ||
| 76 | #define PNPMSG_PNP_OS_ACTIVE 0x42 | ||
| 77 | #define PNPMSG_PNP_OS_INACTIVE 0x43 | ||
| 78 | |||
| 79 | /* | ||
| 80 | * Plug and Play BIOS flags | ||
| 81 | */ | ||
| 82 | #define PNPBIOS_NO_DISABLE 0x0001 | ||
| 83 | #define PNPBIOS_NO_CONFIG 0x0002 | ||
| 84 | #define PNPBIOS_OUTPUT 0x0004 | ||
| 85 | #define PNPBIOS_INPUT 0x0008 | ||
| 86 | #define PNPBIOS_BOOTABLE 0x0010 | ||
| 87 | #define PNPBIOS_DOCK 0x0020 | ||
| 88 | #define PNPBIOS_REMOVABLE 0x0040 | ||
| 89 | #define pnpbios_is_static(x) (((x)->flags & 0x0100) == 0x0000) | ||
| 90 | #define pnpbios_is_dynamic(x) ((x)->flags & 0x0080) | ||
| 91 | |||
| 92 | /* | ||
| 93 | * Function Parameters | ||
| 94 | */ | ||
| 95 | #define PNPMODE_STATIC 1 | ||
| 96 | #define PNPMODE_DYNAMIC 0 | ||
| 97 | |||
| 98 | /* 0x8000 through 0xffff are OEM defined */ | ||
| 99 | |||
| 100 | #pragma pack(1) | ||
| 101 | struct pnp_dev_node_info { | ||
| 102 | __u16 no_nodes; | ||
| 103 | __u16 max_node_size; | ||
| 104 | }; | ||
| 105 | struct pnp_docking_station_info { | ||
| 106 | __u32 location_id; | ||
| 107 | __u32 serial; | ||
| 108 | __u16 capabilities; | ||
| 109 | }; | ||
| 110 | struct pnp_isa_config_struc { | ||
| 111 | __u8 revision; | ||
| 112 | __u8 no_csns; | ||
| 113 | __u16 isa_rd_data_port; | ||
| 114 | __u16 reserved; | ||
| 115 | }; | ||
| 116 | struct escd_info_struc { | ||
| 117 | __u16 min_escd_write_size; | ||
| 118 | __u16 escd_size; | ||
| 119 | __u32 nv_storage_base; | ||
| 120 | }; | ||
| 121 | struct pnp_bios_node { | ||
| 122 | __u16 size; | ||
| 123 | __u8 handle; | ||
| 124 | __u32 eisa_id; | ||
| 125 | __u8 type_code[3]; | ||
| 126 | __u16 flags; | ||
| 127 | __u8 data[0]; | ||
| 128 | }; | ||
| 129 | #pragma pack() | ||
| 130 | |||
| 131 | #ifdef CONFIG_PNPBIOS | ||
| 132 | |||
| 133 | /* non-exported */ | ||
| 134 | extern struct pnp_dev_node_info node_info; | ||
| 135 | |||
| 136 | extern int pnp_bios_dev_node_info(struct pnp_dev_node_info *data); | ||
| 137 | extern int pnp_bios_get_dev_node(u8 *nodenum, char config, | ||
| 138 | struct pnp_bios_node *data); | ||
| 139 | extern int pnp_bios_set_dev_node(u8 nodenum, char config, | ||
| 140 | struct pnp_bios_node *data); | ||
| 141 | extern int pnp_bios_get_stat_res(char *info); | ||
| 142 | extern int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data); | ||
| 143 | extern int pnp_bios_escd_info(struct escd_info_struc *data); | ||
| 144 | extern int pnp_bios_read_escd(char *data, u32 nvram_base); | ||
| 145 | extern int pnp_bios_dock_station_info(struct pnp_docking_station_info *data); | ||
| 146 | |||
| 147 | #endif /* CONFIG_PNPBIOS */ | ||
| 148 | |||
| 149 | #endif /* __KERNEL__ */ | ||
| 150 | |||
| 151 | #endif /* _LINUX_PNPBIOS_H */ | ||
diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 90c1c191ea69..06d3e6eb9ca8 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h | |||
| @@ -41,6 +41,7 @@ struct thermal_zone_device_ops { | |||
| 41 | int (*set_mode) (struct thermal_zone_device *, const char *); | 41 | int (*set_mode) (struct thermal_zone_device *, const char *); |
| 42 | int (*get_trip_type) (struct thermal_zone_device *, int, char *); | 42 | int (*get_trip_type) (struct thermal_zone_device *, int, char *); |
| 43 | int (*get_trip_temp) (struct thermal_zone_device *, int, char *); | 43 | int (*get_trip_temp) (struct thermal_zone_device *, int, char *); |
| 44 | int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *); | ||
| 44 | }; | 45 | }; |
| 45 | 46 | ||
| 46 | struct thermal_cooling_device_ops { | 47 | struct thermal_cooling_device_ops { |
| @@ -65,6 +66,23 @@ struct thermal_cooling_device { | |||
| 65 | ((long)t-2732+5)/10 : ((long)t-2732-5)/10) | 66 | ((long)t-2732+5)/10 : ((long)t-2732-5)/10) |
| 66 | #define CELSIUS_TO_KELVIN(t) ((t)*10+2732) | 67 | #define CELSIUS_TO_KELVIN(t) ((t)*10+2732) |
| 67 | 68 | ||
| 69 | #if defined(CONFIG_HWMON) || \ | ||
| 70 | (defined(CONFIG_HWMON_MODULE) && defined(CONFIG_THERMAL_MODULE)) | ||
| 71 | /* thermal zone devices with the same type share one hwmon device */ | ||
| 72 | struct thermal_hwmon_device { | ||
| 73 | char type[THERMAL_NAME_LENGTH]; | ||
| 74 | struct device *device; | ||
| 75 | int count; | ||
| 76 | struct list_head tz_list; | ||
| 77 | struct list_head node; | ||
| 78 | }; | ||
| 79 | |||
| 80 | struct thermal_hwmon_attr { | ||
| 81 | struct device_attribute attr; | ||
| 82 | char name[16]; | ||
| 83 | }; | ||
| 84 | #endif | ||
| 85 | |||
| 68 | struct thermal_zone_device { | 86 | struct thermal_zone_device { |
| 69 | int id; | 87 | int id; |
| 70 | char type[THERMAL_NAME_LENGTH]; | 88 | char type[THERMAL_NAME_LENGTH]; |
| @@ -76,6 +94,13 @@ struct thermal_zone_device { | |||
| 76 | struct idr idr; | 94 | struct idr idr; |
| 77 | struct mutex lock; /* protect cooling devices list */ | 95 | struct mutex lock; /* protect cooling devices list */ |
| 78 | struct list_head node; | 96 | struct list_head node; |
| 97 | #if defined(CONFIG_HWMON) || \ | ||
| 98 | (defined(CONFIG_HWMON_MODULE) && defined(CONFIG_THERMAL_MODULE)) | ||
| 99 | struct list_head hwmon_node; | ||
| 100 | struct thermal_hwmon_device *hwmon; | ||
| 101 | struct thermal_hwmon_attr temp_input; /* hwmon sys attr */ | ||
| 102 | struct thermal_hwmon_attr temp_crit; /* hwmon sys attr */ | ||
| 103 | #endif | ||
| 79 | }; | 104 | }; |
| 80 | 105 | ||
| 81 | struct thermal_zone_device *thermal_zone_device_register(char *, int, void *, | 106 | struct thermal_zone_device *thermal_zone_device_register(char *, int, void *, |
| @@ -88,24 +113,10 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, | |||
| 88 | struct thermal_cooling_device *); | 113 | struct thermal_cooling_device *); |
| 89 | int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, | 114 | int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, |
| 90 | struct thermal_cooling_device *); | 115 | struct thermal_cooling_device *); |
| 91 | |||
| 92 | #ifdef CONFIG_THERMAL | ||
| 93 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, | 116 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, |
| 94 | struct | 117 | struct |
| 95 | thermal_cooling_device_ops | 118 | thermal_cooling_device_ops |
| 96 | *); | 119 | *); |
| 97 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); | 120 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); |
| 98 | #else | ||
| 99 | static inline struct thermal_cooling_device | ||
| 100 | *thermal_cooling_device_register(char *c, void *v, | ||
| 101 | struct thermal_cooling_device_ops *t) | ||
| 102 | { | ||
| 103 | return NULL; | ||
| 104 | } | ||
| 105 | static inline | ||
| 106 | void thermal_cooling_device_unregister(struct thermal_cooling_device *t) | ||
| 107 | { | ||
| 108 | }; | ||
| 109 | #endif | ||
| 110 | 121 | ||
| 111 | #endif /* __THERMAL_H__ */ | 122 | #endif /* __THERMAL_H__ */ |
