diff options
Diffstat (limited to 'drivers/pnp/pnpbios')
-rw-r--r-- | drivers/pnp/pnpbios/bioscalls.c | 161 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/core.c | 28 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/proc.c | 5 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/rsparser.c | 99 |
4 files changed, 103 insertions, 190 deletions
diff --git a/drivers/pnp/pnpbios/bioscalls.c b/drivers/pnp/pnpbios/bioscalls.c index d546f79d4d3b..5dba68fe33f5 100644 --- a/drivers/pnp/pnpbios/bioscalls.c +++ b/drivers/pnp/pnpbios/bioscalls.c @@ -1,6 +1,5 @@ /* * bioscalls.c - the lowlevel layer of the PnPBIOS driver - * */ #include <linux/types.h> @@ -52,7 +51,8 @@ __asm__(".text \n" " pushl %eax \n" " lcallw *pnp_bios_callpoint\n" " addl $16, %esp \n" - " lret \n" ".previous \n"); + " lret \n" + ".previous \n"); #define Q2_SET_SEL(cpu, selname, address, size) \ do { \ @@ -125,7 +125,8 @@ static inline u16 call_pnp_bios(u16 func, u16 arg1, u16 arg2, u16 arg3, "popl %%es\n\t" "popl %%ds\n\t" "popl %%esi\n\t" - "popl %%edi\n\t" "popl %%ebp\n\t":"=a"(status) + "popl %%edi\n\t" + "popl %%ebp\n\t":"=a"(status) :"0"((func) | (((u32) arg1) << 16)), "b"((arg2) | (((u32) arg3) << 16)), "c"((arg4) | (((u32) arg5) << 16)), @@ -253,12 +254,12 @@ void pnpbios_print_status(const char *module, u16 status) static int __pnp_bios_dev_node_info(struct pnp_dev_node_info *data) { u16 status; + if (!pnp_bios_present()) return PNP_FUNCTION_NOT_SUPPORTED; - status = - call_pnp_bios(PNP_GET_NUM_SYS_DEV_NODES, 0, PNP_TS1, 2, PNP_TS1, - PNP_DS, 0, 0, data, sizeof(struct pnp_dev_node_info), - NULL, 0); + status = call_pnp_bios(PNP_GET_NUM_SYS_DEV_NODES, 0, PNP_TS1, 2, + PNP_TS1, PNP_DS, 0, 0, data, + sizeof(struct pnp_dev_node_info), NULL, 0); data->no_nodes &= 0xff; return status; } @@ -266,6 +267,7 @@ static int __pnp_bios_dev_node_info(struct pnp_dev_node_info *data) int pnp_bios_dev_node_info(struct pnp_dev_node_info *data) { int status = __pnp_bios_dev_node_info(data); + if (status) pnpbios_print_status("dev_node_info", status); return status; @@ -285,27 +287,28 @@ int pnp_bios_dev_node_info(struct pnp_dev_node_info *data) * or volatile current (0) config * Output: *nodenum=next node or 0xff if no more nodes */ -static int __pnp_bios_get_dev_node(u8 * nodenum, char boot, +static int __pnp_bios_get_dev_node(u8 *nodenum, char boot, struct pnp_bios_node *data) { u16 status; u16 tmp_nodenum; + if (!pnp_bios_present()) return PNP_FUNCTION_NOT_SUPPORTED; if (!boot && pnpbios_dont_use_current_config) return PNP_FUNCTION_NOT_SUPPORTED; tmp_nodenum = *nodenum; - status = - call_pnp_bios(PNP_GET_SYS_DEV_NODE, 0, PNP_TS1, 0, PNP_TS2, - boot ? 2 : 1, PNP_DS, 0, &tmp_nodenum, - sizeof(tmp_nodenum), data, 65536); + status = call_pnp_bios(PNP_GET_SYS_DEV_NODE, 0, PNP_TS1, 0, PNP_TS2, + boot ? 2 : 1, PNP_DS, 0, &tmp_nodenum, + sizeof(tmp_nodenum), data, 65536); *nodenum = tmp_nodenum; return status; } -int pnp_bios_get_dev_node(u8 * nodenum, char boot, struct pnp_bios_node *data) +int pnp_bios_get_dev_node(u8 *nodenum, char boot, struct pnp_bios_node *data) { int status; + status = __pnp_bios_get_dev_node(nodenum, boot, data); if (status) pnpbios_print_status("get_dev_node", status); @@ -322,19 +325,21 @@ static int __pnp_bios_set_dev_node(u8 nodenum, char boot, struct pnp_bios_node *data) { u16 status; + if (!pnp_bios_present()) return PNP_FUNCTION_NOT_SUPPORTED; if (!boot && pnpbios_dont_use_current_config) return PNP_FUNCTION_NOT_SUPPORTED; - status = - call_pnp_bios(PNP_SET_SYS_DEV_NODE, nodenum, 0, PNP_TS1, - boot ? 2 : 1, PNP_DS, 0, 0, data, 65536, NULL, 0); + status = call_pnp_bios(PNP_SET_SYS_DEV_NODE, nodenum, 0, PNP_TS1, + boot ? 2 : 1, PNP_DS, 0, 0, data, 65536, NULL, + 0); return status; } int pnp_bios_set_dev_node(u8 nodenum, char boot, struct pnp_bios_node *data) { int status; + status = __pnp_bios_set_dev_node(nodenum, boot, data); if (status) { pnpbios_print_status("set_dev_node", status); @@ -348,68 +353,21 @@ int pnp_bios_set_dev_node(u8 nodenum, char boot, struct pnp_bios_node *data) return status; } -#if needed -/* - * Call PnP BIOS with function 0x03, "get event" - */ -static int pnp_bios_get_event(u16 * event) -{ - u16 status; - if (!pnp_bios_present()) - return PNP_FUNCTION_NOT_SUPPORTED; - status = call_pnp_bios(PNP_GET_EVENT, 0, PNP_TS1, PNP_DS, 0, 0, 0, 0, - event, sizeof(u16), NULL, 0); - return status; -} -#endif - -#if needed -/* - * Call PnP BIOS with function 0x04, "send message" - */ -static int pnp_bios_send_message(u16 message) -{ - u16 status; - if (!pnp_bios_present()) - return PNP_FUNCTION_NOT_SUPPORTED; - status = - call_pnp_bios(PNP_SEND_MESSAGE, message, PNP_DS, 0, 0, 0, 0, 0, 0, - 0, 0, 0); - return status; -} -#endif - /* * Call PnP BIOS with function 0x05, "get docking station information" */ int pnp_bios_dock_station_info(struct pnp_docking_station_info *data) { u16 status; - if (!pnp_bios_present()) - return PNP_FUNCTION_NOT_SUPPORTED; - status = - call_pnp_bios(PNP_GET_DOCKING_STATION_INFORMATION, 0, PNP_TS1, - PNP_DS, 0, 0, 0, 0, data, - sizeof(struct pnp_docking_station_info), NULL, 0); - return status; -} -#if needed -/* - * Call PnP BIOS with function 0x09, "set statically allocated resource - * information" - */ -static int pnp_bios_set_stat_res(char *info) -{ - u16 status; if (!pnp_bios_present()) return PNP_FUNCTION_NOT_SUPPORTED; - status = - call_pnp_bios(PNP_SET_STATIC_ALLOCED_RES_INFO, 0, PNP_TS1, PNP_DS, - 0, 0, 0, 0, info, *((u16 *) info), 0, 0); + status = call_pnp_bios(PNP_GET_DOCKING_STATION_INFORMATION, 0, PNP_TS1, + PNP_DS, 0, 0, 0, 0, data, + sizeof(struct pnp_docking_station_info), NULL, + 0); return status; } -#endif /* * Call PnP BIOS with function 0x0a, "get statically allocated resource @@ -418,57 +376,43 @@ static int pnp_bios_set_stat_res(char *info) static int __pnp_bios_get_stat_res(char *info) { u16 status; + if (!pnp_bios_present()) return PNP_FUNCTION_NOT_SUPPORTED; - status = - call_pnp_bios(PNP_GET_STATIC_ALLOCED_RES_INFO, 0, PNP_TS1, PNP_DS, - 0, 0, 0, 0, info, 65536, NULL, 0); + status = call_pnp_bios(PNP_GET_STATIC_ALLOCED_RES_INFO, 0, PNP_TS1, + PNP_DS, 0, 0, 0, 0, info, 65536, NULL, 0); return status; } int pnp_bios_get_stat_res(char *info) { int status; + status = __pnp_bios_get_stat_res(info); if (status) pnpbios_print_status("get_stat_res", status); return status; } -#if needed -/* - * Call PnP BIOS with function 0x0b, "get APM id table" - */ -static int pnp_bios_apm_id_table(char *table, u16 * size) -{ - u16 status; - if (!pnp_bios_present()) - return PNP_FUNCTION_NOT_SUPPORTED; - status = - call_pnp_bios(PNP_GET_APM_ID_TABLE, 0, PNP_TS2, 0, PNP_TS1, PNP_DS, - 0, 0, table, *size, size, sizeof(u16)); - return status; -} -#endif - /* * Call PnP BIOS with function 0x40, "get isa pnp configuration structure" */ static int __pnp_bios_isapnp_config(struct pnp_isa_config_struc *data) { u16 status; + if (!pnp_bios_present()) return PNP_FUNCTION_NOT_SUPPORTED; - status = - call_pnp_bios(PNP_GET_PNP_ISA_CONFIG_STRUC, 0, PNP_TS1, PNP_DS, 0, - 0, 0, 0, data, sizeof(struct pnp_isa_config_struc), - NULL, 0); + status = call_pnp_bios(PNP_GET_PNP_ISA_CONFIG_STRUC, 0, PNP_TS1, PNP_DS, + 0, 0, 0, 0, data, + sizeof(struct pnp_isa_config_struc), NULL, 0); return status; } int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data) { int status; + status = __pnp_bios_isapnp_config(data); if (status) pnpbios_print_status("isapnp_config", status); @@ -481,18 +425,19 @@ int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data) static int __pnp_bios_escd_info(struct escd_info_struc *data) { u16 status; + if (!pnp_bios_present()) return ESCD_FUNCTION_NOT_SUPPORTED; - status = - call_pnp_bios(PNP_GET_ESCD_INFO, 0, PNP_TS1, 2, PNP_TS1, 4, PNP_TS1, - PNP_DS, data, sizeof(struct escd_info_struc), NULL, - 0); + status = call_pnp_bios(PNP_GET_ESCD_INFO, 0, PNP_TS1, 2, PNP_TS1, 4, + PNP_TS1, PNP_DS, data, + sizeof(struct escd_info_struc), NULL, 0); return status; } int pnp_bios_escd_info(struct escd_info_struc *data) { int status; + status = __pnp_bios_escd_info(data); if (status) pnpbios_print_status("escd_info", status); @@ -506,46 +451,28 @@ int pnp_bios_escd_info(struct escd_info_struc *data) static int __pnp_bios_read_escd(char *data, u32 nvram_base) { u16 status; + if (!pnp_bios_present()) return ESCD_FUNCTION_NOT_SUPPORTED; - status = - call_pnp_bios(PNP_READ_ESCD, 0, PNP_TS1, PNP_TS2, PNP_DS, 0, 0, 0, - data, 65536, __va(nvram_base), 65536); + status = call_pnp_bios(PNP_READ_ESCD, 0, PNP_TS1, PNP_TS2, PNP_DS, 0, 0, + 0, data, 65536, __va(nvram_base), 65536); return status; } int pnp_bios_read_escd(char *data, u32 nvram_base) { int status; + status = __pnp_bios_read_escd(data, nvram_base); if (status) pnpbios_print_status("read_escd", status); return status; } -#if needed -/* - * Call PnP BIOS function 0x43, "write ESCD" - */ -static int pnp_bios_write_escd(char *data, u32 nvram_base) -{ - u16 status; - if (!pnp_bios_present()) - return ESCD_FUNCTION_NOT_SUPPORTED; - status = - call_pnp_bios(PNP_WRITE_ESCD, 0, PNP_TS1, PNP_TS2, PNP_DS, 0, 0, 0, - data, 65536, __va(nvram_base), 65536); - return status; -} -#endif - -/* - * Initialization - */ - void pnpbios_calls_init(union pnp_bios_install_struct *header) { int i; + spin_lock_init(&pnp_bios_lock); pnp_bios_callpoint.offset = header->fields.pm16offset; pnp_bios_callpoint.segment = PNP_CS16; diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c index 21289cb13a33..3692a099b45f 100644 --- a/drivers/pnp/pnpbios/core.c +++ b/drivers/pnp/pnpbios/core.c @@ -100,25 +100,24 @@ static struct completion unload_sem; /* * (Much of this belongs in a shared routine somewhere) */ - static int pnp_dock_event(int dock, struct pnp_docking_station_info *info) { char *argv[3], **envp, *buf, *scratch; int i = 0, value; - if (!current->fs->root) { + if (!current->fs->root) return -EAGAIN; - } - if (!(envp = kcalloc(20, sizeof(char *), GFP_KERNEL))) { + if (!(envp = kcalloc(20, sizeof(char *), GFP_KERNEL))) return -ENOMEM; - } if (!(buf = kzalloc(256, GFP_KERNEL))) { kfree(envp); return -ENOMEM; } - /* FIXME: if there are actual users of this, it should be integrated into - * the driver core and use the usual infrastructure like sysfs and uevents */ + /* FIXME: if there are actual users of this, it should be + * integrated into the driver core and use the usual infrastructure + * like sysfs and uevents + */ argv[0] = "/sbin/pnpbios"; argv[1] = "dock"; argv[2] = NULL; @@ -146,7 +145,7 @@ static int pnp_dock_event(int dock, struct pnp_docking_station_info *info) info->location_id, info->serial, info->capabilities); envp[i] = NULL; - value = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC); + value = call_usermodehelper(argv [0], argv, envp, UMH_WAIT_EXEC); kfree(buf); kfree(envp); return 0; @@ -159,6 +158,7 @@ static int pnp_dock_thread(void *unused) { static struct pnp_docking_station_info now; int docked = -1, d = 0; + set_freezable(); while (!unloading) { int status; @@ -203,7 +203,7 @@ static int pnp_dock_thread(void *unused) complete_and_exit(&unload_sem, 0); } -#endif /* CONFIG_HOTPLUG */ +#endif /* CONFIG_HOTPLUG */ static int pnpbios_get_resources(struct pnp_dev *dev, struct pnp_resource_table *res) @@ -211,7 +211,6 @@ static int pnpbios_get_resources(struct pnp_dev *dev, u8 nodenum = dev->number; struct pnp_bios_node *node; - /* just in case */ if (!pnpbios_is_dynamic(dev)) return -EPERM; @@ -235,7 +234,6 @@ static int pnpbios_set_resources(struct pnp_dev *dev, struct pnp_bios_node *node; int ret; - /* just in case */ if (!pnpbios_is_dynamic(dev)) return -EPERM; @@ -263,6 +261,7 @@ static void pnpbios_zero_data_stream(struct pnp_bios_node *node) unsigned char *end = (char *)(node->data + node->size); unsigned int len; int i; + while ((char *)p < (char *)end) { if (p[0] & 0x80) { /* large tag */ len = (p[2] << 8) | p[1]; @@ -287,7 +286,6 @@ static int pnpbios_disable_resources(struct pnp_dev *dev) u8 nodenum = dev->number; int ret; - /* just in case */ if (dev->flags & PNPBIOS_NO_DISABLE || !pnpbios_is_dynamic(dev)) return -EPERM; @@ -418,8 +416,8 @@ static void __init build_devlist(void) * */ -static int pnpbios_disabled; /* = 0 */ -int pnpbios_dont_use_current_config; /* = 0 */ +static int pnpbios_disabled; +int pnpbios_dont_use_current_config; #ifndef MODULE static int __init pnpbios_setup(char *str) @@ -551,7 +549,7 @@ static int __init pnpbios_init(void) printk(KERN_INFO "PnPBIOS: Disabled by ACPI PNP\n"); return -ENODEV; } -#endif /* CONFIG_ACPI */ +#endif /* CONFIG_ACPI */ /* scan the system for pnpbios support */ if (!pnpbios_probe_system()) diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c index b7e1d23e8a4e..9c8c07701b65 100644 --- a/drivers/pnp/pnpbios/proc.c +++ b/drivers/pnp/pnpbios/proc.c @@ -18,9 +18,6 @@ * The other files are human-readable. */ -//#include <pcmcia/config.h> -//#include <pcmcia/k_compat.h> - #include <linux/module.h> #include <linux/kernel.h> #include <linux/slab.h> @@ -297,6 +294,4 @@ void __exit pnpbios_proc_exit(void) remove_proc_entry("devices", proc_pnp); remove_proc_entry("boot", proc_pnp); remove_proc_entry("pnp", proc_bus); - - return; } diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c index 54c34d4d4f44..04ecd7b67230 100644 --- a/drivers/pnp/pnpbios/rsparser.c +++ b/drivers/pnp/pnpbios/rsparser.c @@ -1,6 +1,5 @@ /* * rsparser.c - parses and encodes pnpbios resource data streams - * */ #include <linux/ctype.h> @@ -15,7 +14,7 @@ inline void pcibios_penalize_isa_irq(int irq, int active) { } -#endif /* CONFIG_PCI */ +#endif /* CONFIG_PCI */ #include "pnpbios.h" @@ -54,10 +53,11 @@ inline void pcibios_penalize_isa_irq(int irq, int active) * Allocated Resources */ -static void -pnpbios_parse_allocated_irqresource(struct pnp_resource_table *res, int irq) +static void pnpbios_parse_allocated_irqresource(struct pnp_resource_table *res, + int irq) { int i = 0; + while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) && i < PNP_MAX_IRQ) i++; @@ -73,10 +73,11 @@ pnpbios_parse_allocated_irqresource(struct pnp_resource_table *res, int irq) } } -static void -pnpbios_parse_allocated_dmaresource(struct pnp_resource_table *res, int dma) +static void pnpbios_parse_allocated_dmaresource(struct pnp_resource_table *res, + int dma) { int i = 0; + while (i < PNP_MAX_DMA && !(res->dma_resource[i].flags & IORESOURCE_UNSET)) i++; @@ -91,11 +92,11 @@ pnpbios_parse_allocated_dmaresource(struct pnp_resource_table *res, int dma) } } -static void -pnpbios_parse_allocated_ioresource(struct pnp_resource_table *res, int io, - int len) +static void pnpbios_parse_allocated_ioresource(struct pnp_resource_table *res, + int io, int len) { int i = 0; + while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && i < PNP_MAX_PORT) i++; @@ -110,11 +111,11 @@ pnpbios_parse_allocated_ioresource(struct pnp_resource_table *res, int io, } } -static void -pnpbios_parse_allocated_memresource(struct pnp_resource_table *res, int mem, - int len) +static void pnpbios_parse_allocated_memresource(struct pnp_resource_table *res, + int mem, int len) { int i = 0; + while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) && i < PNP_MAX_MEM) i++; @@ -261,10 +262,11 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, * Resource Configuration Options */ -static void -pnpbios_parse_mem_option(unsigned char *p, int size, struct pnp_option *option) +static void pnpbios_parse_mem_option(unsigned char *p, int size, + struct pnp_option *option) { struct pnp_mem *mem; + mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); if (!mem) return; @@ -274,14 +276,13 @@ pnpbios_parse_mem_option(unsigned char *p, int size, struct pnp_option *option) mem->size = ((p[11] << 8) | p[10]) << 8; mem->flags = p[3]; pnp_register_mem_resource(option, mem); - return; } -static void -pnpbios_parse_mem32_option(unsigned char *p, int size, - struct pnp_option *option) +static void pnpbios_parse_mem32_option(unsigned char *p, int size, + struct pnp_option *option) { struct pnp_mem *mem; + mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); if (!mem) return; @@ -291,12 +292,10 @@ pnpbios_parse_mem32_option(unsigned char *p, int size, mem->size = (p[19] << 24) | (p[18] << 16) | (p[17] << 8) | p[16]; mem->flags = p[3]; pnp_register_mem_resource(option, mem); - return; } -static void -pnpbios_parse_fixed_mem32_option(unsigned char *p, int size, - struct pnp_option *option) +static void pnpbios_parse_fixed_mem32_option(unsigned char *p, int size, + struct pnp_option *option) { struct pnp_mem *mem; mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); @@ -307,11 +306,10 @@ pnpbios_parse_fixed_mem32_option(unsigned char *p, int size, mem->align = 0; mem->flags = p[3]; pnp_register_mem_resource(option, mem); - return; } -static void -pnpbios_parse_irq_option(unsigned char *p, int size, struct pnp_option *option) +static void pnpbios_parse_irq_option(unsigned char *p, int size, + struct pnp_option *option) { struct pnp_irq *irq; unsigned long bits; @@ -326,26 +324,26 @@ pnpbios_parse_irq_option(unsigned char *p, int size, struct pnp_option *option) else irq->flags = IORESOURCE_IRQ_HIGHEDGE; pnp_register_irq_resource(option, irq); - return; } -static void -pnpbios_parse_dma_option(unsigned char *p, int size, struct pnp_option *option) +static void pnpbios_parse_dma_option(unsigned char *p, int size, + struct pnp_option *option) { struct pnp_dma *dma; + dma = kzalloc(sizeof(struct pnp_dma), GFP_KERNEL); if (!dma) return; dma->map = p[1]; dma->flags = p[2]; pnp_register_dma_resource(option, dma); - return; } -static void -pnpbios_parse_port_option(unsigned char *p, int size, struct pnp_option *option) +static void pnpbios_parse_port_option(unsigned char *p, int size, + struct pnp_option *option) { struct pnp_port *port; + port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL); if (!port) return; @@ -355,14 +353,13 @@ pnpbios_parse_port_option(unsigned char *p, int size, struct pnp_option *option) port->size = p[7]; port->flags = p[1] ? PNP_PORT_FLAG_16BITADDR : 0; pnp_register_port_resource(option, port); - return; } -static void -pnpbios_parse_fixed_port_option(unsigned char *p, int size, - struct pnp_option *option) +static void pnpbios_parse_fixed_port_option(unsigned char *p, int size, + struct pnp_option *option) { struct pnp_port *port; + port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL); if (!port) return; @@ -371,7 +368,6 @@ pnpbios_parse_fixed_port_option(unsigned char *p, int size, port->align = 0; port->flags = PNP_PORT_FLAG_FIXED; pnp_register_port_resource(option, port); - return; } static unsigned char *pnpbios_parse_resource_option_data(unsigned char *p, @@ -498,7 +494,6 @@ static unsigned char *pnpbios_parse_resource_option_data(unsigned char *p, #define HEX(id,a) hex[((id)>>a) & 15] #define CHAR(id,a) (0x40 + (((id)>>a) & 31)) -// void pnpid32_to_pnpid(u32 id, char *str) { @@ -513,11 +508,8 @@ void pnpid32_to_pnpid(u32 id, char *str) str[5] = HEX(id, 4); str[6] = HEX(id, 0); str[7] = '\0'; - - return; } -// #undef CHAR #undef HEX @@ -598,19 +590,20 @@ static void pnpbios_encode_mem(unsigned char *p, struct resource *res) { unsigned long base = res->start; unsigned long len = res->end - res->start + 1; + p[4] = (base >> 8) & 0xff; p[5] = ((base >> 8) >> 8) & 0xff; p[6] = (base >> 8) & 0xff; p[7] = ((base >> 8) >> 8) & 0xff; p[10] = (len >> 8) & 0xff; p[11] = ((len >> 8) >> 8) & 0xff; - return; } static void pnpbios_encode_mem32(unsigned char *p, struct resource *res) { unsigned long base = res->start; unsigned long len = res->end - res->start + 1; + p[4] = base & 0xff; p[5] = (base >> 8) & 0xff; p[6] = (base >> 16) & 0xff; @@ -623,13 +616,13 @@ static void pnpbios_encode_mem32(unsigned char *p, struct resource *res) p[17] = (len >> 8) & 0xff; p[18] = (len >> 16) & 0xff; p[19] = (len >> 24) & 0xff; - return; } static void pnpbios_encode_fixed_mem32(unsigned char *p, struct resource *res) { unsigned long base = res->start; unsigned long len = res->end - res->start + 1; + p[4] = base & 0xff; p[5] = (base >> 8) & 0xff; p[6] = (base >> 16) & 0xff; @@ -638,46 +631,45 @@ static void pnpbios_encode_fixed_mem32(unsigned char *p, struct resource *res) p[9] = (len >> 8) & 0xff; p[10] = (len >> 16) & 0xff; p[11] = (len >> 24) & 0xff; - return; } static void pnpbios_encode_irq(unsigned char *p, struct resource *res) { unsigned long map = 0; + map = 1 << res->start; p[1] = map & 0xff; p[2] = (map >> 8) & 0xff; - return; } static void pnpbios_encode_dma(unsigned char *p, struct resource *res) { unsigned long map = 0; + map = 1 << res->start; p[1] = map & 0xff; - return; } static void pnpbios_encode_port(unsigned char *p, struct resource *res) { unsigned long base = res->start; unsigned long len = res->end - res->start + 1; + p[2] = base & 0xff; p[3] = (base >> 8) & 0xff; p[4] = base & 0xff; p[5] = (base >> 8) & 0xff; p[7] = len & 0xff; - return; } static void pnpbios_encode_fixed_port(unsigned char *p, struct resource *res) { unsigned long base = res->start; unsigned long len = res->end - res->start + 1; + p[1] = base & 0xff; p[2] = (base >> 8) & 0xff; p[3] = len & 0xff; - return; } static unsigned char *pnpbios_encode_allocated_resource_data(unsigned char *p, @@ -792,6 +784,7 @@ int pnpbios_parse_data_stream(struct pnp_dev *dev, struct pnp_bios_node *node) { unsigned char *p = (char *)node->data; unsigned char *end = (char *)(node->data + node->size); + p = pnpbios_parse_allocated_resource_data(p, end, &dev->res); if (!p) return -EIO; @@ -804,24 +797,24 @@ int pnpbios_parse_data_stream(struct pnp_dev *dev, struct pnp_bios_node *node) return 0; } -int -pnpbios_read_resources_from_node(struct pnp_resource_table *res, - struct pnp_bios_node *node) +int pnpbios_read_resources_from_node(struct pnp_resource_table *res, + struct pnp_bios_node *node) { unsigned char *p = (char *)node->data; unsigned char *end = (char *)(node->data + node->size); + p = pnpbios_parse_allocated_resource_data(p, end, res); if (!p) return -EIO; return 0; } -int -pnpbios_write_resources_to_node(struct pnp_resource_table *res, - struct pnp_bios_node *node) +int pnpbios_write_resources_to_node(struct pnp_resource_table *res, + struct pnp_bios_node *node) { unsigned char *p = (char *)node->data; unsigned char *end = (char *)(node->data + node->size); + p = pnpbios_encode_allocated_resource_data(p, end, res); if (!p) return -EIO; |