aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp')
-rw-r--r--drivers/pnp/card.c25
-rw-r--r--drivers/pnp/driver.c51
-rw-r--r--drivers/pnp/manager.c78
-rw-r--r--drivers/pnp/pnpacpi/core.c14
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c547
-rw-r--r--drivers/pnp/pnpbios/bioscalls.c45
-rw-r--r--drivers/pnp/pnpbios/core.c8
7 files changed, 486 insertions, 282 deletions
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
index bd7c966ea2d7..0ecbe4edbec1 100644
--- a/drivers/pnp/card.c
+++ b/drivers/pnp/card.c
@@ -69,6 +69,7 @@ static int card_probe(struct pnp_card * card, struct pnp_card_driver * drv)
69 return 0; 69 return 0;
70 clink->card = card; 70 clink->card = card;
71 clink->driver = drv; 71 clink->driver = drv;
72 clink->pm_state = PMSG_ON;
72 if (drv->probe) { 73 if (drv->probe) {
73 if (drv->probe(clink, id)>=0) 74 if (drv->probe(clink, id)>=0)
74 return 1; 75 return 1;
@@ -333,6 +334,28 @@ void pnp_release_card_device(struct pnp_dev * dev)
333 up_write(&dev->dev.bus->subsys.rwsem); 334 up_write(&dev->dev.bus->subsys.rwsem);
334} 335}
335 336
337/*
338 * suspend/resume callbacks
339 */
340static int card_suspend(struct pnp_dev *dev, pm_message_t state)
341{
342 struct pnp_card_link *link = dev->card_link;
343 if (link->pm_state.event == state.event)
344 return 0;
345 link->pm_state = state;
346 return link->driver->suspend(link, state);
347}
348
349static int card_resume(struct pnp_dev *dev)
350{
351 struct pnp_card_link *link = dev->card_link;
352 if (link->pm_state.event == PM_EVENT_ON)
353 return 0;
354 link->pm_state = PMSG_ON;
355 link->driver->resume(link);
356 return 0;
357}
358
336/** 359/**
337 * pnp_register_card_driver - registers a PnP card driver with the PnP Layer 360 * pnp_register_card_driver - registers a PnP card driver with the PnP Layer
338 * @drv: pointer to the driver to register 361 * @drv: pointer to the driver to register
@@ -348,6 +371,8 @@ int pnp_register_card_driver(struct pnp_card_driver * drv)
348 drv->link.flags = drv->flags; 371 drv->link.flags = drv->flags;
349 drv->link.probe = NULL; 372 drv->link.probe = NULL;
350 drv->link.remove = &card_remove_first; 373 drv->link.remove = &card_remove_first;
374 drv->link.suspend = drv->suspend ? card_suspend : NULL;
375 drv->link.resume = drv->resume ? card_resume : NULL;
351 376
352 spin_lock(&pnp_lock); 377 spin_lock(&pnp_lock);
353 list_add_tail(&drv->global_list, &pnp_card_drivers); 378 list_add_tail(&drv->global_list, &pnp_card_drivers);
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index d3ccce706ab4..7cafacdd12b0 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -146,10 +146,59 @@ static int pnp_bus_match(struct device *dev, struct device_driver *drv)
146 return 1; 146 return 1;
147} 147}
148 148
149static int pnp_bus_suspend(struct device *dev, pm_message_t state)
150{
151 struct pnp_dev * pnp_dev = to_pnp_dev(dev);
152 struct pnp_driver * pnp_drv = pnp_dev->driver;
153 int error;
154
155 if (!pnp_drv)
156 return 0;
157
158 if (pnp_drv->suspend) {
159 error = pnp_drv->suspend(pnp_dev, state);
160 if (error)
161 return error;
162 }
163
164 if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE) &&
165 pnp_can_disable(pnp_dev)) {
166 error = pnp_stop_dev(pnp_dev);
167 if (error)
168 return error;
169 }
170
171 return 0;
172}
173
174static int pnp_bus_resume(struct device *dev)
175{
176 struct pnp_dev * pnp_dev = to_pnp_dev(dev);
177 struct pnp_driver * pnp_drv = pnp_dev->driver;
178 int error;
179
180 if (!pnp_drv)
181 return 0;
182
183 if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE)) {
184 error = pnp_start_dev(pnp_dev);
185 if (error)
186 return error;
187 }
188
189 if (pnp_drv->resume)
190 return pnp_drv->resume(pnp_dev);
191
192 return 0;
193}
149 194
150struct bus_type pnp_bus_type = { 195struct bus_type pnp_bus_type = {
151 .name = "pnp", 196 .name = "pnp",
152 .match = pnp_bus_match, 197 .match = pnp_bus_match,
198 .probe = pnp_device_probe,
199 .remove = pnp_device_remove,
200 .suspend = pnp_bus_suspend,
201 .resume = pnp_bus_resume,
153}; 202};
154 203
155 204
@@ -168,8 +217,6 @@ int pnp_register_driver(struct pnp_driver *drv)
168 217
169 drv->driver.name = drv->name; 218 drv->driver.name = drv->name;
170 drv->driver.bus = &pnp_bus_type; 219 drv->driver.bus = &pnp_bus_type;
171 drv->driver.probe = pnp_device_probe;
172 drv->driver.remove = pnp_device_remove;
173 220
174 count = driver_register(&drv->driver); 221 count = driver_register(&drv->driver);
175 222
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c
index 261668618b2d..c4256aa32bcb 100644
--- a/drivers/pnp/manager.c
+++ b/drivers/pnp/manager.c
@@ -470,6 +470,53 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
470} 470}
471 471
472/** 472/**
473 * pnp_start_dev - low-level start of the PnP device
474 * @dev: pointer to the desired device
475 *
476 * assumes that resources have alread been allocated
477 */
478
479int pnp_start_dev(struct pnp_dev *dev)
480{
481 if (!pnp_can_write(dev)) {
482 pnp_info("Device %s does not supported activation.", dev->dev.bus_id);
483 return -EINVAL;
484 }
485
486 if (dev->protocol->set(dev, &dev->res)<0) {
487 pnp_err("Failed to activate device %s.", dev->dev.bus_id);
488 return -EIO;
489 }
490
491 pnp_info("Device %s activated.", dev->dev.bus_id);
492
493 return 0;
494}
495
496/**
497 * pnp_stop_dev - low-level disable of the PnP device
498 * @dev: pointer to the desired device
499 *
500 * does not free resources
501 */
502
503int pnp_stop_dev(struct pnp_dev *dev)
504{
505 if (!pnp_can_disable(dev)) {
506 pnp_info("Device %s does not supported disabling.", dev->dev.bus_id);
507 return -EINVAL;
508 }
509 if (dev->protocol->disable(dev)<0) {
510 pnp_err("Failed to disable device %s.", dev->dev.bus_id);
511 return -EIO;
512 }
513
514 pnp_info("Device %s disabled.", dev->dev.bus_id);
515
516 return 0;
517}
518
519/**
473 * pnp_activate_dev - activates a PnP device for use 520 * pnp_activate_dev - activates a PnP device for use
474 * @dev: pointer to the desired device 521 * @dev: pointer to the desired device
475 * 522 *
@@ -477,6 +524,8 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
477 */ 524 */
478int pnp_activate_dev(struct pnp_dev *dev) 525int pnp_activate_dev(struct pnp_dev *dev)
479{ 526{
527 int error;
528
480 if (!dev) 529 if (!dev)
481 return -EINVAL; 530 return -EINVAL;
482 if (dev->active) { 531 if (dev->active) {
@@ -487,18 +536,11 @@ int pnp_activate_dev(struct pnp_dev *dev)
487 if (pnp_auto_config_dev(dev)) 536 if (pnp_auto_config_dev(dev))
488 return -EBUSY; 537 return -EBUSY;
489 538
490 if (!pnp_can_write(dev)) { 539 error = pnp_start_dev(dev);
491 pnp_info("Device %s does not supported activation.", dev->dev.bus_id); 540 if (error)
492 return -EINVAL; 541 return error;
493 }
494
495 if (dev->protocol->set(dev, &dev->res)<0) {
496 pnp_err("Failed to activate device %s.", dev->dev.bus_id);
497 return -EIO;
498 }
499 542
500 dev->active = 1; 543 dev->active = 1;
501 pnp_info("Device %s activated.", dev->dev.bus_id);
502 544
503 return 1; 545 return 1;
504} 546}
@@ -511,23 +553,19 @@ int pnp_activate_dev(struct pnp_dev *dev)
511 */ 553 */
512int pnp_disable_dev(struct pnp_dev *dev) 554int pnp_disable_dev(struct pnp_dev *dev)
513{ 555{
556 int error;
557
514 if (!dev) 558 if (!dev)
515 return -EINVAL; 559 return -EINVAL;
516 if (!dev->active) { 560 if (!dev->active) {
517 return 0; /* the device is already disabled */ 561 return 0; /* the device is already disabled */
518 } 562 }
519 563
520 if (!pnp_can_disable(dev)) { 564 error = pnp_stop_dev(dev);
521 pnp_info("Device %s does not supported disabling.", dev->dev.bus_id); 565 if (error)
522 return -EINVAL; 566 return error;
523 }
524 if (dev->protocol->disable(dev)<0) {
525 pnp_err("Failed to disable device %s.", dev->dev.bus_id);
526 return -EIO;
527 }
528 567
529 dev->active = 0; 568 dev->active = 0;
530 pnp_info("Device %s disabled.", dev->dev.bus_id);
531 569
532 /* release the resources so that other devices can use them */ 570 /* release the resources so that other devices can use them */
533 down(&pnp_res_mutex); 571 down(&pnp_res_mutex);
@@ -558,6 +596,8 @@ EXPORT_SYMBOL(pnp_manual_config_dev);
558#if 0 596#if 0
559EXPORT_SYMBOL(pnp_auto_config_dev); 597EXPORT_SYMBOL(pnp_auto_config_dev);
560#endif 598#endif
599EXPORT_SYMBOL(pnp_start_dev);
600EXPORT_SYMBOL(pnp_stop_dev);
561EXPORT_SYMBOL(pnp_activate_dev); 601EXPORT_SYMBOL(pnp_activate_dev);
562EXPORT_SYMBOL(pnp_disable_dev); 602EXPORT_SYMBOL(pnp_disable_dev);
563EXPORT_SYMBOL(pnp_resource_change); 603EXPORT_SYMBOL(pnp_resource_change);
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 816479ad217b..f104577f73e0 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -27,12 +27,15 @@
27 27
28static int num = 0; 28static int num = 0;
29 29
30/* We need only to blacklist devices that have already an acpi driver that
31 * can't use pnp layer. We don't need to blacklist device that are directly
32 * used by the kernel (PCI root, ...), as it is harmless and there were
33 * already present in pnpbios. But there is an exception for devices that
34 * have irqs (PIC, Timer) because we call acpi_register_gsi.
35 * Finaly only devices that have a CRS method need to be in this list.
36 */
30static char __initdata excluded_id_list[] = 37static char __initdata excluded_id_list[] =
31 "PNP0C0A," /* Battery */
32 "PNP0C0C,PNP0C0E,PNP0C0D," /* Button */
33 "PNP0C09," /* EC */ 38 "PNP0C09," /* EC */
34 "PNP0C0B," /* Fan */
35 "PNP0A03," /* PCI root */
36 "PNP0C0F," /* Link device */ 39 "PNP0C0F," /* Link device */
37 "PNP0000," /* PIC */ 40 "PNP0000," /* PIC */
38 "PNP0100," /* Timer */ 41 "PNP0100," /* Timer */
@@ -131,7 +134,8 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
131 struct pnp_id *dev_id; 134 struct pnp_id *dev_id;
132 struct pnp_dev *dev; 135 struct pnp_dev *dev;
133 136
134 if (!ispnpidacpi(acpi_device_hid(device)) || 137 status = acpi_get_handle(device->handle, "_CRS", &temp);
138 if (ACPI_FAILURE(status) || !ispnpidacpi(acpi_device_hid(device)) ||
135 is_exclusive_device(device)) 139 is_exclusive_device(device))
136 return 0; 140 return 0;
137 141
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 416d30debe6c..407b4eaddcbf 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (c) 2004 Matthieu Castet <castet.matthieu@free.fr> 4 * Copyright (c) 2004 Matthieu Castet <castet.matthieu@free.fr>
5 * Copyright (c) 2004 Li Shaohua <shaohua.li@intel.com> 5 * Copyright (c) 2004 Li Shaohua <shaohua.li@intel.com>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the 8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any 9 * Free Software Foundation; either version 2, or (at your option) any
@@ -32,17 +32,17 @@
32/* 32/*
33 * Allocated Resources 33 * Allocated Resources
34 */ 34 */
35static int irq_flags(int edge_level, int active_high_low) 35static int irq_flags(int triggering, int polarity)
36{ 36{
37 int flag; 37 int flag;
38 if (edge_level == ACPI_LEVEL_SENSITIVE) { 38 if (triggering == ACPI_LEVEL_SENSITIVE) {
39 if(active_high_low == ACPI_ACTIVE_LOW) 39 if(polarity == ACPI_ACTIVE_LOW)
40 flag = IORESOURCE_IRQ_LOWLEVEL; 40 flag = IORESOURCE_IRQ_LOWLEVEL;
41 else 41 else
42 flag = IORESOURCE_IRQ_HIGHLEVEL; 42 flag = IORESOURCE_IRQ_HIGHLEVEL;
43 } 43 }
44 else { 44 else {
45 if(active_high_low == ACPI_ACTIVE_LOW) 45 if(polarity == ACPI_ACTIVE_LOW)
46 flag = IORESOURCE_IRQ_LOWEDGE; 46 flag = IORESOURCE_IRQ_LOWEDGE;
47 else 47 else
48 flag = IORESOURCE_IRQ_HIGHEDGE; 48 flag = IORESOURCE_IRQ_HIGHEDGE;
@@ -50,31 +50,31 @@ static int irq_flags(int edge_level, int active_high_low)
50 return flag; 50 return flag;
51} 51}
52 52
53static void decode_irq_flags(int flag, int *edge_level, int *active_high_low) 53static void decode_irq_flags(int flag, int *triggering, int *polarity)
54{ 54{
55 switch (flag) { 55 switch (flag) {
56 case IORESOURCE_IRQ_LOWLEVEL: 56 case IORESOURCE_IRQ_LOWLEVEL:
57 *edge_level = ACPI_LEVEL_SENSITIVE; 57 *triggering = ACPI_LEVEL_SENSITIVE;
58 *active_high_low = ACPI_ACTIVE_LOW; 58 *polarity = ACPI_ACTIVE_LOW;
59 break; 59 break;
60 case IORESOURCE_IRQ_HIGHLEVEL: 60 case IORESOURCE_IRQ_HIGHLEVEL:
61 *edge_level = ACPI_LEVEL_SENSITIVE; 61 *triggering = ACPI_LEVEL_SENSITIVE;
62 *active_high_low = ACPI_ACTIVE_HIGH; 62 *polarity = ACPI_ACTIVE_HIGH;
63 break; 63 break;
64 case IORESOURCE_IRQ_LOWEDGE: 64 case IORESOURCE_IRQ_LOWEDGE:
65 *edge_level = ACPI_EDGE_SENSITIVE; 65 *triggering = ACPI_EDGE_SENSITIVE;
66 *active_high_low = ACPI_ACTIVE_LOW; 66 *polarity = ACPI_ACTIVE_LOW;
67 break; 67 break;
68 case IORESOURCE_IRQ_HIGHEDGE: 68 case IORESOURCE_IRQ_HIGHEDGE:
69 *edge_level = ACPI_EDGE_SENSITIVE; 69 *triggering = ACPI_EDGE_SENSITIVE;
70 *active_high_low = ACPI_ACTIVE_HIGH; 70 *polarity = ACPI_ACTIVE_HIGH;
71 break; 71 break;
72 } 72 }
73} 73}
74 74
75static void 75static void
76pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, 76pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi,
77 int edge_level, int active_high_low) 77 int triggering, int polarity)
78{ 78{
79 int i = 0; 79 int i = 0;
80 int irq; 80 int irq;
@@ -89,7 +89,7 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi,
89 return; 89 return;
90 90
91 res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag 91 res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag
92 irq = acpi_register_gsi(gsi, edge_level, active_high_low); 92 irq = acpi_register_gsi(gsi, triggering, polarity);
93 if (irq < 0) { 93 if (irq < 0) {
94 res->irq_resource[i].flags |= IORESOURCE_DISABLED; 94 res->irq_resource[i].flags |= IORESOURCE_DISABLED;
95 return; 95 return;
@@ -163,77 +163,96 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
163 struct pnp_resource_table * res_table = (struct pnp_resource_table *)data; 163 struct pnp_resource_table * res_table = (struct pnp_resource_table *)data;
164 int i; 164 int i;
165 165
166 switch (res->id) { 166 switch (res->type) {
167 case ACPI_RSTYPE_IRQ: 167 case ACPI_RESOURCE_TYPE_IRQ:
168 /* 168 /*
169 * Per spec, only one interrupt per descriptor is allowed in 169 * Per spec, only one interrupt per descriptor is allowed in
170 * _CRS, but some firmware violates this, so parse them all. 170 * _CRS, but some firmware violates this, so parse them all.
171 */ 171 */
172 for (i = 0; i < res->data.irq.number_of_interrupts; i++) { 172 for (i = 0; i < res->data.irq.interrupt_count; i++) {
173 pnpacpi_parse_allocated_irqresource(res_table, 173 pnpacpi_parse_allocated_irqresource(res_table,
174 res->data.irq.interrupts[i], 174 res->data.irq.interrupts[i],
175 res->data.irq.edge_level, 175 res->data.irq.triggering,
176 res->data.irq.active_high_low); 176 res->data.irq.polarity);
177 } 177 }
178 break; 178 break;
179 179
180 case ACPI_RSTYPE_EXT_IRQ: 180 case ACPI_RESOURCE_TYPE_DMA:
181 for (i = 0; i < res->data.extended_irq.number_of_interrupts; i++) { 181 if (res->data.dma.channel_count > 0)
182 pnpacpi_parse_allocated_irqresource(res_table, 182 pnpacpi_parse_allocated_dmaresource(res_table,
183 res->data.extended_irq.interrupts[i],
184 res->data.extended_irq.edge_level,
185 res->data.extended_irq.active_high_low);
186 }
187 break;
188 case ACPI_RSTYPE_DMA:
189 if (res->data.dma.number_of_channels > 0)
190 pnpacpi_parse_allocated_dmaresource(res_table,
191 res->data.dma.channels[0]); 183 res->data.dma.channels[0]);
192 break; 184 break;
193 case ACPI_RSTYPE_IO: 185
194 pnpacpi_parse_allocated_ioresource(res_table, 186 case ACPI_RESOURCE_TYPE_IO:
195 res->data.io.min_base_address, 187 pnpacpi_parse_allocated_ioresource(res_table,
196 res->data.io.range_length); 188 res->data.io.minimum,
189 res->data.io.address_length);
197 break; 190 break;
198 case ACPI_RSTYPE_FIXED_IO: 191
199 pnpacpi_parse_allocated_ioresource(res_table, 192 case ACPI_RESOURCE_TYPE_START_DEPENDENT:
200 res->data.fixed_io.base_address, 193 case ACPI_RESOURCE_TYPE_END_DEPENDENT:
201 res->data.fixed_io.range_length);
202 break; 194 break;
203 case ACPI_RSTYPE_MEM24: 195
204 pnpacpi_parse_allocated_memresource(res_table, 196 case ACPI_RESOURCE_TYPE_FIXED_IO:
205 res->data.memory24.min_base_address, 197 pnpacpi_parse_allocated_ioresource(res_table,
206 res->data.memory24.range_length); 198 res->data.fixed_io.address,
199 res->data.fixed_io.address_length);
200 break;
201
202 case ACPI_RESOURCE_TYPE_VENDOR:
207 break; 203 break;
208 case ACPI_RSTYPE_MEM32: 204
209 pnpacpi_parse_allocated_memresource(res_table, 205 case ACPI_RESOURCE_TYPE_END_TAG:
210 res->data.memory32.min_base_address, 206 break;
211 res->data.memory32.range_length); 207
208 case ACPI_RESOURCE_TYPE_MEMORY24:
209 pnpacpi_parse_allocated_memresource(res_table,
210 res->data.memory24.minimum,
211 res->data.memory24.address_length);
212 break; 212 break;
213 case ACPI_RSTYPE_FIXED_MEM32: 213 case ACPI_RESOURCE_TYPE_MEMORY32:
214 pnpacpi_parse_allocated_memresource(res_table, 214 pnpacpi_parse_allocated_memresource(res_table,
215 res->data.fixed_memory32.range_base_address, 215 res->data.memory32.minimum,
216 res->data.fixed_memory32.range_length); 216 res->data.memory32.address_length);
217 break; 217 break;
218 case ACPI_RSTYPE_ADDRESS16: 218 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
219 pnpacpi_parse_allocated_memresource(res_table, 219 pnpacpi_parse_allocated_memresource(res_table,
220 res->data.address16.min_address_range, 220 res->data.fixed_memory32.address,
221 res->data.fixed_memory32.address_length);
222 break;
223 case ACPI_RESOURCE_TYPE_ADDRESS16:
224 pnpacpi_parse_allocated_memresource(res_table,
225 res->data.address16.minimum,
221 res->data.address16.address_length); 226 res->data.address16.address_length);
222 break; 227 break;
223 case ACPI_RSTYPE_ADDRESS32: 228 case ACPI_RESOURCE_TYPE_ADDRESS32:
224 pnpacpi_parse_allocated_memresource(res_table, 229 pnpacpi_parse_allocated_memresource(res_table,
225 res->data.address32.min_address_range, 230 res->data.address32.minimum,
226 res->data.address32.address_length); 231 res->data.address32.address_length);
227 break; 232 break;
228 case ACPI_RSTYPE_ADDRESS64: 233 case ACPI_RESOURCE_TYPE_ADDRESS64:
229 pnpacpi_parse_allocated_memresource(res_table, 234 pnpacpi_parse_allocated_memresource(res_table,
230 res->data.address64.min_address_range, 235 res->data.address64.minimum,
231 res->data.address64.address_length); 236 res->data.address64.address_length);
232 break; 237 break;
233 case ACPI_RSTYPE_VENDOR: 238
239 case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
240 break;
241
242 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
243 for (i = 0; i < res->data.extended_irq.interrupt_count; i++) {
244 pnpacpi_parse_allocated_irqresource(res_table,
245 res->data.extended_irq.interrupts[i],
246 res->data.extended_irq.triggering,
247 res->data.extended_irq.polarity);
248 }
249 break;
250
251 case ACPI_RESOURCE_TYPE_GENERIC_REGISTER:
234 break; 252 break;
253
235 default: 254 default:
236 pnp_warn("PnPACPI: unknown resource type %d", res->id); 255 pnp_warn("PnPACPI: unknown resource type %d", res->type);
237 return AE_ERROR; 256 return AE_ERROR;
238 } 257 }
239 258
@@ -253,13 +272,13 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso
253 int i; 272 int i;
254 struct pnp_dma * dma; 273 struct pnp_dma * dma;
255 274
256 if (p->number_of_channels == 0) 275 if (p->channel_count == 0)
257 return; 276 return;
258 dma = kcalloc(1, sizeof(struct pnp_dma), GFP_KERNEL); 277 dma = kcalloc(1, sizeof(struct pnp_dma), GFP_KERNEL);
259 if (!dma) 278 if (!dma)
260 return; 279 return;
261 280
262 for(i = 0; i < p->number_of_channels; i++) 281 for(i = 0; i < p->channel_count; i++)
263 dma->map |= 1 << p->channels[i]; 282 dma->map |= 1 << p->channels[i];
264 dma->flags = 0; 283 dma->flags = 0;
265 if (p->bus_master) 284 if (p->bus_master)
@@ -309,37 +328,37 @@ static void pnpacpi_parse_irq_option(struct pnp_option *option,
309 int i; 328 int i;
310 struct pnp_irq * irq; 329 struct pnp_irq * irq;
311 330
312 if (p->number_of_interrupts == 0) 331 if (p->interrupt_count == 0)
313 return; 332 return;
314 irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); 333 irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL);
315 if (!irq) 334 if (!irq)
316 return; 335 return;
317 336
318 for(i = 0; i < p->number_of_interrupts; i++) 337 for(i = 0; i < p->interrupt_count; i++)
319 if (p->interrupts[i]) 338 if (p->interrupts[i])
320 __set_bit(p->interrupts[i], irq->map); 339 __set_bit(p->interrupts[i], irq->map);
321 irq->flags = irq_flags(p->edge_level, p->active_high_low); 340 irq->flags = irq_flags(p->triggering, p->polarity);
322 341
323 pnp_register_irq_resource(option, irq); 342 pnp_register_irq_resource(option, irq);
324 return; 343 return;
325} 344}
326 345
327static void pnpacpi_parse_ext_irq_option(struct pnp_option *option, 346static void pnpacpi_parse_ext_irq_option(struct pnp_option *option,
328 struct acpi_resource_ext_irq *p) 347 struct acpi_resource_extended_irq *p)
329{ 348{
330 int i; 349 int i;
331 struct pnp_irq * irq; 350 struct pnp_irq * irq;
332 351
333 if (p->number_of_interrupts == 0) 352 if (p->interrupt_count == 0)
334 return; 353 return;
335 irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); 354 irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL);
336 if (!irq) 355 if (!irq)
337 return; 356 return;
338 357
339 for(i = 0; i < p->number_of_interrupts; i++) 358 for(i = 0; i < p->interrupt_count; i++)
340 if (p->interrupts[i]) 359 if (p->interrupts[i])
341 __set_bit(p->interrupts[i], irq->map); 360 __set_bit(p->interrupts[i], irq->map);
342 irq->flags = irq_flags(p->edge_level, p->active_high_low); 361 irq->flags = irq_flags(p->triggering, p->polarity);
343 362
344 pnp_register_irq_resource(option, irq); 363 pnp_register_irq_resource(option, irq);
345 return; 364 return;
@@ -351,16 +370,16 @@ pnpacpi_parse_port_option(struct pnp_option *option,
351{ 370{
352 struct pnp_port * port; 371 struct pnp_port * port;
353 372
354 if (io->range_length == 0) 373 if (io->address_length == 0)
355 return; 374 return;
356 port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); 375 port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL);
357 if (!port) 376 if (!port)
358 return; 377 return;
359 port->min = io->min_base_address; 378 port->min = io->minimum;
360 port->max = io->max_base_address; 379 port->max = io->maximum;
361 port->align = io->alignment; 380 port->align = io->alignment;
362 port->size = io->range_length; 381 port->size = io->address_length;
363 port->flags = ACPI_DECODE_16 == io->io_decode ? 382 port->flags = ACPI_DECODE_16 == io->io_decode ?
364 PNP_PORT_FLAG_16BITADDR : 0; 383 PNP_PORT_FLAG_16BITADDR : 0;
365 pnp_register_port_resource(option,port); 384 pnp_register_port_resource(option,port);
366 return; 385 return;
@@ -372,13 +391,13 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option,
372{ 391{
373 struct pnp_port * port; 392 struct pnp_port * port;
374 393
375 if (io->range_length == 0) 394 if (io->address_length == 0)
376 return; 395 return;
377 port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); 396 port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL);
378 if (!port) 397 if (!port)
379 return; 398 return;
380 port->min = port->max = io->base_address; 399 port->min = port->max = io->address;
381 port->size = io->range_length; 400 port->size = io->address_length;
382 port->align = 0; 401 port->align = 0;
383 port->flags = PNP_PORT_FLAG_FIXED; 402 port->flags = PNP_PORT_FLAG_FIXED;
384 pnp_register_port_resource(option,port); 403 pnp_register_port_resource(option,port);
@@ -387,21 +406,21 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option,
387 406
388static void 407static void
389pnpacpi_parse_mem24_option(struct pnp_option *option, 408pnpacpi_parse_mem24_option(struct pnp_option *option,
390 struct acpi_resource_mem24 *p) 409 struct acpi_resource_memory24 *p)
391{ 410{
392 struct pnp_mem * mem; 411 struct pnp_mem * mem;
393 412
394 if (p->range_length == 0) 413 if (p->address_length == 0)
395 return; 414 return;
396 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); 415 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
397 if (!mem) 416 if (!mem)
398 return; 417 return;
399 mem->min = p->min_base_address; 418 mem->min = p->minimum;
400 mem->max = p->max_base_address; 419 mem->max = p->maximum;
401 mem->align = p->alignment; 420 mem->align = p->alignment;
402 mem->size = p->range_length; 421 mem->size = p->address_length;
403 422
404 mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? 423 mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ?
405 IORESOURCE_MEM_WRITEABLE : 0; 424 IORESOURCE_MEM_WRITEABLE : 0;
406 425
407 pnp_register_mem_resource(option,mem); 426 pnp_register_mem_resource(option,mem);
@@ -410,21 +429,21 @@ pnpacpi_parse_mem24_option(struct pnp_option *option,
410 429
411static void 430static void
412pnpacpi_parse_mem32_option(struct pnp_option *option, 431pnpacpi_parse_mem32_option(struct pnp_option *option,
413 struct acpi_resource_mem32 *p) 432 struct acpi_resource_memory32 *p)
414{ 433{
415 struct pnp_mem * mem; 434 struct pnp_mem * mem;
416 435
417 if (p->range_length == 0) 436 if (p->address_length == 0)
418 return; 437 return;
419 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); 438 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
420 if (!mem) 439 if (!mem)
421 return; 440 return;
422 mem->min = p->min_base_address; 441 mem->min = p->minimum;
423 mem->max = p->max_base_address; 442 mem->max = p->maximum;
424 mem->align = p->alignment; 443 mem->align = p->alignment;
425 mem->size = p->range_length; 444 mem->size = p->address_length;
426 445
427 mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? 446 mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ?
428 IORESOURCE_MEM_WRITEABLE : 0; 447 IORESOURCE_MEM_WRITEABLE : 0;
429 448
430 pnp_register_mem_resource(option,mem); 449 pnp_register_mem_resource(option,mem);
@@ -433,33 +452,72 @@ pnpacpi_parse_mem32_option(struct pnp_option *option,
433 452
434static void 453static void
435pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, 454pnpacpi_parse_fixed_mem32_option(struct pnp_option *option,
436 struct acpi_resource_fixed_mem32 *p) 455 struct acpi_resource_fixed_memory32 *p)
437{ 456{
438 struct pnp_mem * mem; 457 struct pnp_mem * mem;
439 458
440 if (p->range_length == 0) 459 if (p->address_length == 0)
441 return; 460 return;
442 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); 461 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
443 if (!mem) 462 if (!mem)
444 return; 463 return;
445 mem->min = mem->max = p->range_base_address; 464 mem->min = mem->max = p->address;
446 mem->size = p->range_length; 465 mem->size = p->address_length;
447 mem->align = 0; 466 mem->align = 0;
448 467
449 mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? 468 mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ?
450 IORESOURCE_MEM_WRITEABLE : 0; 469 IORESOURCE_MEM_WRITEABLE : 0;
451 470
452 pnp_register_mem_resource(option,mem); 471 pnp_register_mem_resource(option,mem);
453 return; 472 return;
454} 473}
455 474
475static void
476pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r)
477{
478 struct acpi_resource_address64 addr, *p = &addr;
479 acpi_status status;
480 struct pnp_mem * mem;
481 struct pnp_port * port;
482
483 status = acpi_resource_to_address64(r, p);
484 if (!ACPI_SUCCESS(status)) {
485 pnp_warn("PnPACPI: failed to convert resource type %d", r->type);
486 return;
487 }
488
489 if (p->address_length == 0)
490 return;
491
492 if (p->resource_type == ACPI_MEMORY_RANGE) {
493 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
494 if (!mem)
495 return;
496 mem->min = mem->max = p->minimum;
497 mem->size = p->address_length;
498 mem->align = 0;
499 mem->flags = (p->info.mem.write_protect ==
500 ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0;
501 pnp_register_mem_resource(option,mem);
502 } else if (p->resource_type == ACPI_IO_RANGE) {
503 port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL);
504 if (!port)
505 return;
506 port->min = port->max = p->minimum;
507 port->size = p->address_length;
508 port->align = 0;
509 port->flags = PNP_PORT_FLAG_FIXED;
510 pnp_register_port_resource(option,port);
511 }
512}
513
456struct acpipnp_parse_option_s { 514struct acpipnp_parse_option_s {
457 struct pnp_option *option; 515 struct pnp_option *option;
458 struct pnp_option *option_independent; 516 struct pnp_option *option_independent;
459 struct pnp_dev *dev; 517 struct pnp_dev *dev;
460}; 518};
461 519
462static acpi_status pnpacpi_option_resource(struct acpi_resource *res, 520static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
463 void *data) 521 void *data)
464{ 522{
465 int priority = 0; 523 int priority = 0;
@@ -467,35 +525,16 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
467 struct pnp_dev *dev = parse_data->dev; 525 struct pnp_dev *dev = parse_data->dev;
468 struct pnp_option *option = parse_data->option; 526 struct pnp_option *option = parse_data->option;
469 527
470 switch (res->id) { 528 switch (res->type) {
471 case ACPI_RSTYPE_IRQ: 529 case ACPI_RESOURCE_TYPE_IRQ:
472 pnpacpi_parse_irq_option(option, &res->data.irq); 530 pnpacpi_parse_irq_option(option, &res->data.irq);
473 break; 531 break;
474 case ACPI_RSTYPE_EXT_IRQ: 532
475 pnpacpi_parse_ext_irq_option(option, 533 case ACPI_RESOURCE_TYPE_DMA:
476 &res->data.extended_irq);
477 break;
478 case ACPI_RSTYPE_DMA:
479 pnpacpi_parse_dma_option(option, &res->data.dma); 534 pnpacpi_parse_dma_option(option, &res->data.dma);
480 break; 535 break;
481 case ACPI_RSTYPE_IO: 536
482 pnpacpi_parse_port_option(option, &res->data.io); 537 case ACPI_RESOURCE_TYPE_START_DEPENDENT:
483 break;
484 case ACPI_RSTYPE_FIXED_IO:
485 pnpacpi_parse_fixed_port_option(option,
486 &res->data.fixed_io);
487 break;
488 case ACPI_RSTYPE_MEM24:
489 pnpacpi_parse_mem24_option(option, &res->data.memory24);
490 break;
491 case ACPI_RSTYPE_MEM32:
492 pnpacpi_parse_mem32_option(option, &res->data.memory32);
493 break;
494 case ACPI_RSTYPE_FIXED_MEM32:
495 pnpacpi_parse_fixed_mem32_option(option,
496 &res->data.fixed_memory32);
497 break;
498 case ACPI_RSTYPE_START_DPF:
499 switch (res->data.start_dpf.compatibility_priority) { 538 switch (res->data.start_dpf.compatibility_priority) {
500 case ACPI_GOOD_CONFIGURATION: 539 case ACPI_GOOD_CONFIGURATION:
501 priority = PNP_RES_PRIORITY_PREFERRED; 540 priority = PNP_RES_PRIORITY_PREFERRED;
@@ -518,7 +557,8 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
518 return AE_ERROR; 557 return AE_ERROR;
519 parse_data->option = option; 558 parse_data->option = option;
520 break; 559 break;
521 case ACPI_RSTYPE_END_DPF: 560
561 case ACPI_RESOURCE_TYPE_END_DEPENDENT:
522 /*only one EndDependentFn is allowed*/ 562 /*only one EndDependentFn is allowed*/
523 if (!parse_data->option_independent) { 563 if (!parse_data->option_independent) {
524 pnp_warn("PnPACPI: more than one EndDependentFn"); 564 pnp_warn("PnPACPI: more than one EndDependentFn");
@@ -527,15 +567,59 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
527 parse_data->option = parse_data->option_independent; 567 parse_data->option = parse_data->option_independent;
528 parse_data->option_independent = NULL; 568 parse_data->option_independent = NULL;
529 break; 569 break;
570
571 case ACPI_RESOURCE_TYPE_IO:
572 pnpacpi_parse_port_option(option, &res->data.io);
573 break;
574
575 case ACPI_RESOURCE_TYPE_FIXED_IO:
576 pnpacpi_parse_fixed_port_option(option,
577 &res->data.fixed_io);
578 break;
579
580 case ACPI_RESOURCE_TYPE_VENDOR:
581 case ACPI_RESOURCE_TYPE_END_TAG:
582 break;
583
584 case ACPI_RESOURCE_TYPE_MEMORY24:
585 pnpacpi_parse_mem24_option(option, &res->data.memory24);
586 break;
587
588 case ACPI_RESOURCE_TYPE_MEMORY32:
589 pnpacpi_parse_mem32_option(option, &res->data.memory32);
590 break;
591
592 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
593 pnpacpi_parse_fixed_mem32_option(option,
594 &res->data.fixed_memory32);
595 break;
596
597 case ACPI_RESOURCE_TYPE_ADDRESS16:
598 case ACPI_RESOURCE_TYPE_ADDRESS32:
599 case ACPI_RESOURCE_TYPE_ADDRESS64:
600 pnpacpi_parse_address_option(option, res);
601 break;
602
603 case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
604 break;
605
606 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
607 pnpacpi_parse_ext_irq_option(option,
608 &res->data.extended_irq);
609 break;
610
611 case ACPI_RESOURCE_TYPE_GENERIC_REGISTER:
612 break;
613
530 default: 614 default:
531 pnp_warn("PnPACPI: unknown resource type %d", res->id); 615 pnp_warn("PnPACPI: unknown resource type %d", res->type);
532 return AE_ERROR; 616 return AE_ERROR;
533 } 617 }
534 618
535 return AE_OK; 619 return AE_OK;
536} 620}
537 621
538acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, 622acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle,
539 struct pnp_dev *dev) 623 struct pnp_dev *dev)
540{ 624{
541 acpi_status status; 625 acpi_status status;
@@ -546,7 +630,7 @@ acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle,
546 return AE_ERROR; 630 return AE_ERROR;
547 parse_data.option_independent = parse_data.option; 631 parse_data.option_independent = parse_data.option;
548 parse_data.dev = dev; 632 parse_data.dev = dev;
549 status = acpi_walk_resources(handle, METHOD_NAME__PRS, 633 status = acpi_walk_resources(handle, METHOD_NAME__PRS,
550 pnpacpi_option_resource, &parse_data); 634 pnpacpi_option_resource, &parse_data);
551 635
552 return status; 636 return status;
@@ -559,21 +643,24 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res,
559 void *data) 643 void *data)
560{ 644{
561 int *res_cnt = (int *)data; 645 int *res_cnt = (int *)data;
562 switch (res->id) { 646 switch (res->type) {
563 case ACPI_RSTYPE_IRQ: 647 case ACPI_RESOURCE_TYPE_IRQ:
564 case ACPI_RSTYPE_EXT_IRQ: 648 case ACPI_RESOURCE_TYPE_DMA:
565 case ACPI_RSTYPE_DMA: 649 case ACPI_RESOURCE_TYPE_IO:
566 case ACPI_RSTYPE_IO: 650 case ACPI_RESOURCE_TYPE_FIXED_IO:
567 case ACPI_RSTYPE_FIXED_IO: 651 case ACPI_RESOURCE_TYPE_MEMORY24:
568 case ACPI_RSTYPE_MEM24: 652 case ACPI_RESOURCE_TYPE_MEMORY32:
569 case ACPI_RSTYPE_MEM32: 653 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
570 case ACPI_RSTYPE_FIXED_MEM32: 654 case ACPI_RESOURCE_TYPE_ADDRESS16:
571#if 0 655 case ACPI_RESOURCE_TYPE_ADDRESS32:
572 case ACPI_RSTYPE_ADDRESS16: 656 case ACPI_RESOURCE_TYPE_ADDRESS64:
573 case ACPI_RSTYPE_ADDRESS32: 657 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
574 case ACPI_RSTYPE_ADDRESS64:
575#endif
576 (*res_cnt) ++; 658 (*res_cnt) ++;
659 case ACPI_RESOURCE_TYPE_START_DEPENDENT:
660 case ACPI_RESOURCE_TYPE_END_DEPENDENT:
661 case ACPI_RESOURCE_TYPE_VENDOR:
662 case ACPI_RESOURCE_TYPE_END_TAG:
663 case ACPI_RESOURCE_TYPE_GENERIC_REGISTER:
577 default: 664 default:
578 return AE_OK; 665 return AE_OK;
579 } 666 }
@@ -584,22 +671,25 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res,
584 void *data) 671 void *data)
585{ 672{
586 struct acpi_resource **resource = (struct acpi_resource **)data; 673 struct acpi_resource **resource = (struct acpi_resource **)data;
587 switch (res->id) { 674 switch (res->type) {
588 case ACPI_RSTYPE_IRQ: 675 case ACPI_RESOURCE_TYPE_IRQ:
589 case ACPI_RSTYPE_EXT_IRQ: 676 case ACPI_RESOURCE_TYPE_DMA:
590 case ACPI_RSTYPE_DMA: 677 case ACPI_RESOURCE_TYPE_IO:
591 case ACPI_RSTYPE_IO: 678 case ACPI_RESOURCE_TYPE_FIXED_IO:
592 case ACPI_RSTYPE_FIXED_IO: 679 case ACPI_RESOURCE_TYPE_MEMORY24:
593 case ACPI_RSTYPE_MEM24: 680 case ACPI_RESOURCE_TYPE_MEMORY32:
594 case ACPI_RSTYPE_MEM32: 681 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
595 case ACPI_RSTYPE_FIXED_MEM32: 682 case ACPI_RESOURCE_TYPE_ADDRESS16:
596#if 0 683 case ACPI_RESOURCE_TYPE_ADDRESS32:
597 case ACPI_RSTYPE_ADDRESS16: 684 case ACPI_RESOURCE_TYPE_ADDRESS64:
598 case ACPI_RSTYPE_ADDRESS32: 685 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
599 case ACPI_RSTYPE_ADDRESS64: 686 (*resource)->type = res->type;
600#endif
601 (*resource)->id = res->id;
602 (*resource)++; 687 (*resource)++;
688 case ACPI_RESOURCE_TYPE_START_DEPENDENT:
689 case ACPI_RESOURCE_TYPE_END_DEPENDENT:
690 case ACPI_RESOURCE_TYPE_VENDOR:
691 case ACPI_RESOURCE_TYPE_END_TAG:
692 case ACPI_RESOURCE_TYPE_GENERIC_REGISTER:
603 default: 693 default:
604 return AE_OK; 694 return AE_OK;
605 } 695 }
@@ -607,14 +697,14 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res,
607 return AE_OK; 697 return AE_OK;
608} 698}
609 699
610int pnpacpi_build_resource_template(acpi_handle handle, 700int pnpacpi_build_resource_template(acpi_handle handle,
611 struct acpi_buffer *buffer) 701 struct acpi_buffer *buffer)
612{ 702{
613 struct acpi_resource *resource; 703 struct acpi_resource *resource;
614 int res_cnt = 0; 704 int res_cnt = 0;
615 acpi_status status; 705 acpi_status status;
616 706
617 status = acpi_walk_resources(handle, METHOD_NAME__CRS, 707 status = acpi_walk_resources(handle, METHOD_NAME__CRS,
618 pnpacpi_count_resources, &res_cnt); 708 pnpacpi_count_resources, &res_cnt);
619 if (ACPI_FAILURE(status)) { 709 if (ACPI_FAILURE(status)) {
620 pnp_err("Evaluate _CRS failed"); 710 pnp_err("Evaluate _CRS failed");
@@ -628,7 +718,7 @@ int pnpacpi_build_resource_template(acpi_handle handle,
628 return -ENOMEM; 718 return -ENOMEM;
629 pnp_dbg("Res cnt %d", res_cnt); 719 pnp_dbg("Res cnt %d", res_cnt);
630 resource = (struct acpi_resource *)buffer->pointer; 720 resource = (struct acpi_resource *)buffer->pointer;
631 status = acpi_walk_resources(handle, METHOD_NAME__CRS, 721 status = acpi_walk_resources(handle, METHOD_NAME__CRS,
632 pnpacpi_type_resources, &resource); 722 pnpacpi_type_resources, &resource);
633 if (ACPI_FAILURE(status)) { 723 if (ACPI_FAILURE(status)) {
634 kfree(buffer->pointer); 724 kfree(buffer->pointer);
@@ -636,54 +726,54 @@ int pnpacpi_build_resource_template(acpi_handle handle,
636 return -EINVAL; 726 return -EINVAL;
637 } 727 }
638 /* resource will pointer the end resource now */ 728 /* resource will pointer the end resource now */
639 resource->id = ACPI_RSTYPE_END_TAG; 729 resource->type = ACPI_RESOURCE_TYPE_END_TAG;
640 730
641 return 0; 731 return 0;
642} 732}
643 733
644static void pnpacpi_encode_irq(struct acpi_resource *resource, 734static void pnpacpi_encode_irq(struct acpi_resource *resource,
645 struct resource *p) 735 struct resource *p)
646{ 736{
647 int edge_level, active_high_low; 737 int triggering, polarity;
648 738
649 decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, 739 decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering,
650 &active_high_low); 740 &polarity);
651 resource->id = ACPI_RSTYPE_IRQ; 741 resource->type = ACPI_RESOURCE_TYPE_IRQ;
652 resource->length = sizeof(struct acpi_resource); 742 resource->length = sizeof(struct acpi_resource);
653 resource->data.irq.edge_level = edge_level; 743 resource->data.irq.triggering = triggering;
654 resource->data.irq.active_high_low = active_high_low; 744 resource->data.irq.polarity = polarity;
655 if (edge_level == ACPI_EDGE_SENSITIVE) 745 if (triggering == ACPI_EDGE_SENSITIVE)
656 resource->data.irq.shared_exclusive = ACPI_EXCLUSIVE; 746 resource->data.irq.sharable = ACPI_EXCLUSIVE;
657 else 747 else
658 resource->data.irq.shared_exclusive = ACPI_SHARED; 748 resource->data.irq.sharable = ACPI_SHARED;
659 resource->data.irq.number_of_interrupts = 1; 749 resource->data.irq.interrupt_count = 1;
660 resource->data.irq.interrupts[0] = p->start; 750 resource->data.irq.interrupts[0] = p->start;
661} 751}
662 752
663static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, 753static void pnpacpi_encode_ext_irq(struct acpi_resource *resource,
664 struct resource *p) 754 struct resource *p)
665{ 755{
666 int edge_level, active_high_low; 756 int triggering, polarity;
667 757
668 decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, 758 decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering,
669 &active_high_low); 759 &polarity);
670 resource->id = ACPI_RSTYPE_EXT_IRQ; 760 resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ;
671 resource->length = sizeof(struct acpi_resource); 761 resource->length = sizeof(struct acpi_resource);
672 resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; 762 resource->data.extended_irq.producer_consumer = ACPI_CONSUMER;
673 resource->data.extended_irq.edge_level = edge_level; 763 resource->data.extended_irq.triggering = triggering;
674 resource->data.extended_irq.active_high_low = active_high_low; 764 resource->data.extended_irq.polarity = polarity;
675 if (edge_level == ACPI_EDGE_SENSITIVE) 765 if (triggering == ACPI_EDGE_SENSITIVE)
676 resource->data.irq.shared_exclusive = ACPI_EXCLUSIVE; 766 resource->data.irq.sharable = ACPI_EXCLUSIVE;
677 else 767 else
678 resource->data.irq.shared_exclusive = ACPI_SHARED; 768 resource->data.irq.sharable = ACPI_SHARED;
679 resource->data.extended_irq.number_of_interrupts = 1; 769 resource->data.extended_irq.interrupt_count = 1;
680 resource->data.extended_irq.interrupts[0] = p->start; 770 resource->data.extended_irq.interrupts[0] = p->start;
681} 771}
682 772
683static void pnpacpi_encode_dma(struct acpi_resource *resource, 773static void pnpacpi_encode_dma(struct acpi_resource *resource,
684 struct resource *p) 774 struct resource *p)
685{ 775{
686 resource->id = ACPI_RSTYPE_DMA; 776 resource->type = ACPI_RESOURCE_TYPE_DMA;
687 resource->length = sizeof(struct acpi_resource); 777 resource->length = sizeof(struct acpi_resource);
688 /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ 778 /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */
689 if (p->flags & IORESOURCE_DMA_COMPATIBLE) 779 if (p->flags & IORESOURCE_DMA_COMPATIBLE)
@@ -701,75 +791,75 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource,
701 else if (p->flags & IORESOURCE_DMA_16BIT) 791 else if (p->flags & IORESOURCE_DMA_16BIT)
702 resource->data.dma.transfer = ACPI_TRANSFER_16; 792 resource->data.dma.transfer = ACPI_TRANSFER_16;
703 resource->data.dma.bus_master = p->flags & IORESOURCE_DMA_MASTER; 793 resource->data.dma.bus_master = p->flags & IORESOURCE_DMA_MASTER;
704 resource->data.dma.number_of_channels = 1; 794 resource->data.dma.channel_count = 1;
705 resource->data.dma.channels[0] = p->start; 795 resource->data.dma.channels[0] = p->start;
706} 796}
707 797
708static void pnpacpi_encode_io(struct acpi_resource *resource, 798static void pnpacpi_encode_io(struct acpi_resource *resource,
709 struct resource *p) 799 struct resource *p)
710{ 800{
711 resource->id = ACPI_RSTYPE_IO; 801 resource->type = ACPI_RESOURCE_TYPE_IO;
712 resource->length = sizeof(struct acpi_resource); 802 resource->length = sizeof(struct acpi_resource);
713 /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */ 803 /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */
714 resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? 804 resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)?
715 ACPI_DECODE_16 : ACPI_DECODE_10; 805 ACPI_DECODE_16 : ACPI_DECODE_10;
716 resource->data.io.min_base_address = p->start; 806 resource->data.io.minimum = p->start;
717 resource->data.io.max_base_address = p->end; 807 resource->data.io.maximum = p->end;
718 resource->data.io.alignment = 0; /* Correct? */ 808 resource->data.io.alignment = 0; /* Correct? */
719 resource->data.io.range_length = p->end - p->start + 1; 809 resource->data.io.address_length = p->end - p->start + 1;
720} 810}
721 811
722static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, 812static void pnpacpi_encode_fixed_io(struct acpi_resource *resource,
723 struct resource *p) 813 struct resource *p)
724{ 814{
725 resource->id = ACPI_RSTYPE_FIXED_IO; 815 resource->type = ACPI_RESOURCE_TYPE_FIXED_IO;
726 resource->length = sizeof(struct acpi_resource); 816 resource->length = sizeof(struct acpi_resource);
727 resource->data.fixed_io.base_address = p->start; 817 resource->data.fixed_io.address = p->start;
728 resource->data.fixed_io.range_length = p->end - p->start + 1; 818 resource->data.fixed_io.address_length = p->end - p->start + 1;
729} 819}
730 820
731static void pnpacpi_encode_mem24(struct acpi_resource *resource, 821static void pnpacpi_encode_mem24(struct acpi_resource *resource,
732 struct resource *p) 822 struct resource *p)
733{ 823{
734 resource->id = ACPI_RSTYPE_MEM24; 824 resource->type = ACPI_RESOURCE_TYPE_MEMORY24;
735 resource->length = sizeof(struct acpi_resource); 825 resource->length = sizeof(struct acpi_resource);
736 /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ 826 /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */
737 resource->data.memory24.read_write_attribute = 827 resource->data.memory24.write_protect =
738 (p->flags & IORESOURCE_MEM_WRITEABLE) ? 828 (p->flags & IORESOURCE_MEM_WRITEABLE) ?
739 ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; 829 ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
740 resource->data.memory24.min_base_address = p->start; 830 resource->data.memory24.minimum = p->start;
741 resource->data.memory24.max_base_address = p->end; 831 resource->data.memory24.maximum = p->end;
742 resource->data.memory24.alignment = 0; 832 resource->data.memory24.alignment = 0;
743 resource->data.memory24.range_length = p->end - p->start + 1; 833 resource->data.memory24.address_length = p->end - p->start + 1;
744} 834}
745 835
746static void pnpacpi_encode_mem32(struct acpi_resource *resource, 836static void pnpacpi_encode_mem32(struct acpi_resource *resource,
747 struct resource *p) 837 struct resource *p)
748{ 838{
749 resource->id = ACPI_RSTYPE_MEM32; 839 resource->type = ACPI_RESOURCE_TYPE_MEMORY32;
750 resource->length = sizeof(struct acpi_resource); 840 resource->length = sizeof(struct acpi_resource);
751 resource->data.memory32.read_write_attribute = 841 resource->data.memory32.write_protect =
752 (p->flags & IORESOURCE_MEM_WRITEABLE) ? 842 (p->flags & IORESOURCE_MEM_WRITEABLE) ?
753 ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; 843 ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
754 resource->data.memory32.min_base_address = p->start; 844 resource->data.memory32.minimum = p->start;
755 resource->data.memory32.max_base_address = p->end; 845 resource->data.memory32.maximum = p->end;
756 resource->data.memory32.alignment = 0; 846 resource->data.memory32.alignment = 0;
757 resource->data.memory32.range_length = p->end - p->start + 1; 847 resource->data.memory32.address_length = p->end - p->start + 1;
758} 848}
759 849
760static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, 850static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource,
761 struct resource *p) 851 struct resource *p)
762{ 852{
763 resource->id = ACPI_RSTYPE_FIXED_MEM32; 853 resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32;
764 resource->length = sizeof(struct acpi_resource); 854 resource->length = sizeof(struct acpi_resource);
765 resource->data.fixed_memory32.read_write_attribute = 855 resource->data.fixed_memory32.write_protect =
766 (p->flags & IORESOURCE_MEM_WRITEABLE) ? 856 (p->flags & IORESOURCE_MEM_WRITEABLE) ?
767 ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; 857 ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
768 resource->data.fixed_memory32.range_base_address = p->start; 858 resource->data.fixed_memory32.address = p->start;
769 resource->data.fixed_memory32.range_length = p->end - p->start + 1; 859 resource->data.fixed_memory32.address_length = p->end - p->start + 1;
770} 860}
771 861
772int pnpacpi_encode_resources(struct pnp_resource_table *res_table, 862int pnpacpi_encode_resources(struct pnp_resource_table *res_table,
773 struct acpi_buffer *buffer) 863 struct acpi_buffer *buffer)
774{ 864{
775 int i = 0; 865 int i = 0;
@@ -780,58 +870,67 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table,
780 870
781 pnp_dbg("res cnt %d", res_cnt); 871 pnp_dbg("res cnt %d", res_cnt);
782 while (i < res_cnt) { 872 while (i < res_cnt) {
783 switch(resource->id) { 873 switch(resource->type) {
784 case ACPI_RSTYPE_IRQ: 874 case ACPI_RESOURCE_TYPE_IRQ:
785 pnp_dbg("Encode irq"); 875 pnp_dbg("Encode irq");
786 pnpacpi_encode_irq(resource, 876 pnpacpi_encode_irq(resource,
787 &res_table->irq_resource[irq]); 877 &res_table->irq_resource[irq]);
788 irq++; 878 irq++;
789 break; 879 break;
790 880
791 case ACPI_RSTYPE_EXT_IRQ: 881 case ACPI_RESOURCE_TYPE_DMA:
792 pnp_dbg("Encode ext irq");
793 pnpacpi_encode_ext_irq(resource,
794 &res_table->irq_resource[irq]);
795 irq++;
796 break;
797 case ACPI_RSTYPE_DMA:
798 pnp_dbg("Encode dma"); 882 pnp_dbg("Encode dma");
799 pnpacpi_encode_dma(resource, 883 pnpacpi_encode_dma(resource,
800 &res_table->dma_resource[dma]); 884 &res_table->dma_resource[dma]);
801 dma ++; 885 dma ++;
802 break; 886 break;
803 case ACPI_RSTYPE_IO: 887 case ACPI_RESOURCE_TYPE_IO:
804 pnp_dbg("Encode io"); 888 pnp_dbg("Encode io");
805 pnpacpi_encode_io(resource, 889 pnpacpi_encode_io(resource,
806 &res_table->port_resource[port]); 890 &res_table->port_resource[port]);
807 port ++; 891 port ++;
808 break; 892 break;
809 case ACPI_RSTYPE_FIXED_IO: 893 case ACPI_RESOURCE_TYPE_FIXED_IO:
810 pnp_dbg("Encode fixed io"); 894 pnp_dbg("Encode fixed io");
811 pnpacpi_encode_fixed_io(resource, 895 pnpacpi_encode_fixed_io(resource,
812 &res_table->port_resource[port]); 896 &res_table->port_resource[port]);
813 port ++; 897 port ++;
814 break; 898 break;
815 case ACPI_RSTYPE_MEM24: 899 case ACPI_RESOURCE_TYPE_MEMORY24:
816 pnp_dbg("Encode mem24"); 900 pnp_dbg("Encode mem24");
817 pnpacpi_encode_mem24(resource, 901 pnpacpi_encode_mem24(resource,
818 &res_table->mem_resource[mem]); 902 &res_table->mem_resource[mem]);
819 mem ++; 903 mem ++;
820 break; 904 break;
821 case ACPI_RSTYPE_MEM32: 905 case ACPI_RESOURCE_TYPE_MEMORY32:
822 pnp_dbg("Encode mem32"); 906 pnp_dbg("Encode mem32");
823 pnpacpi_encode_mem32(resource, 907 pnpacpi_encode_mem32(resource,
824 &res_table->mem_resource[mem]); 908 &res_table->mem_resource[mem]);
825 mem ++; 909 mem ++;
826 break; 910 break;
827 case ACPI_RSTYPE_FIXED_MEM32: 911 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
828 pnp_dbg("Encode fixed mem32"); 912 pnp_dbg("Encode fixed mem32");
829 pnpacpi_encode_fixed_mem32(resource, 913 pnpacpi_encode_fixed_mem32(resource,
830 &res_table->mem_resource[mem]); 914 &res_table->mem_resource[mem]);
831 mem ++; 915 mem ++;
832 break; 916 break;
917 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
918 pnp_dbg("Encode ext irq");
919 pnpacpi_encode_ext_irq(resource,
920 &res_table->irq_resource[irq]);
921 irq++;
922 break;
923 case ACPI_RESOURCE_TYPE_START_DEPENDENT:
924 case ACPI_RESOURCE_TYPE_END_DEPENDENT:
925 case ACPI_RESOURCE_TYPE_VENDOR:
926 case ACPI_RESOURCE_TYPE_END_TAG:
927 case ACPI_RESOURCE_TYPE_ADDRESS16:
928 case ACPI_RESOURCE_TYPE_ADDRESS32:
929 case ACPI_RESOURCE_TYPE_ADDRESS64:
930 case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
931 case ACPI_RESOURCE_TYPE_GENERIC_REGISTER:
833 default: /* other type */ 932 default: /* other type */
834 pnp_warn("unknown resource type %d", resource->id); 933 pnp_warn("unknown resource type %d", resource->type);
835 return -EINVAL; 934 return -EINVAL;
836 } 935 }
837 resource ++; 936 resource ++;
diff --git a/drivers/pnp/pnpbios/bioscalls.c b/drivers/pnp/pnpbios/bioscalls.c
index 6b7583f497d0..a1f0b0ba2bfe 100644
--- a/drivers/pnp/pnpbios/bioscalls.c
+++ b/drivers/pnp/pnpbios/bioscalls.c
@@ -31,15 +31,6 @@ static struct {
31} pnp_bios_callpoint; 31} pnp_bios_callpoint;
32 32
33 33
34/* The PnP BIOS entries in the GDT */
35#define PNP_GDT (GDT_ENTRY_PNPBIOS_BASE * 8)
36
37#define PNP_CS32 (PNP_GDT+0x00) /* segment for calling fn */
38#define PNP_CS16 (PNP_GDT+0x08) /* code segment for BIOS */
39#define PNP_DS (PNP_GDT+0x10) /* data segment for BIOS */
40#define PNP_TS1 (PNP_GDT+0x18) /* transfer data segment */
41#define PNP_TS2 (PNP_GDT+0x20) /* another data segment */
42
43/* 34/*
44 * These are some opcodes for a "static asmlinkage" 35 * These are some opcodes for a "static asmlinkage"
45 * As this code is *not* executed inside the linux kernel segment, but in a 36 * As this code is *not* executed inside the linux kernel segment, but in a
@@ -67,16 +58,11 @@ __asm__(
67 ".previous \n" 58 ".previous \n"
68); 59);
69 60
70#define Q_SET_SEL(cpu, selname, address, size) \
71do { \
72set_base(per_cpu(cpu_gdt_table,cpu)[(selname) >> 3], __va((u32)(address))); \
73set_limit(per_cpu(cpu_gdt_table,cpu)[(selname) >> 3], size); \
74} while(0)
75
76#define Q2_SET_SEL(cpu, selname, address, size) \ 61#define Q2_SET_SEL(cpu, selname, address, size) \
77do { \ 62do { \
78set_base(per_cpu(cpu_gdt_table,cpu)[(selname) >> 3], (u32)(address)); \ 63struct desc_struct *gdt = get_cpu_gdt_table((cpu)); \
79set_limit(per_cpu(cpu_gdt_table,cpu)[(selname) >> 3], size); \ 64set_base(gdt[(selname) >> 3], (u32)(address)); \
65set_limit(gdt[(selname) >> 3], size); \
80} while(0) 66} while(0)
81 67
82static struct desc_struct bad_bios_desc = { 0, 0x00409200 }; 68static struct desc_struct bad_bios_desc = { 0, 0x00409200 };
@@ -115,8 +101,8 @@ static inline u16 call_pnp_bios(u16 func, u16 arg1, u16 arg2, u16 arg3,
115 return PNP_FUNCTION_NOT_SUPPORTED; 101 return PNP_FUNCTION_NOT_SUPPORTED;
116 102
117 cpu = get_cpu(); 103 cpu = get_cpu();
118 save_desc_40 = per_cpu(cpu_gdt_table,cpu)[0x40 / 8]; 104 save_desc_40 = get_cpu_gdt_table(cpu)[0x40 / 8];
119 per_cpu(cpu_gdt_table,cpu)[0x40 / 8] = bad_bios_desc; 105 get_cpu_gdt_table(cpu)[0x40 / 8] = bad_bios_desc;
120 106
121 /* On some boxes IRQ's during PnP BIOS calls are deadly. */ 107 /* On some boxes IRQ's during PnP BIOS calls are deadly. */
122 spin_lock_irqsave(&pnp_bios_lock, flags); 108 spin_lock_irqsave(&pnp_bios_lock, flags);
@@ -158,7 +144,7 @@ static inline u16 call_pnp_bios(u16 func, u16 arg1, u16 arg2, u16 arg3,
158 ); 144 );
159 spin_unlock_irqrestore(&pnp_bios_lock, flags); 145 spin_unlock_irqrestore(&pnp_bios_lock, flags);
160 146
161 per_cpu(cpu_gdt_table,cpu)[0x40 / 8] = save_desc_40; 147 get_cpu_gdt_table(cpu)[0x40 / 8] = save_desc_40;
162 put_cpu(); 148 put_cpu();
163 149
164 /* If we get here and this is set then the PnP BIOS faulted on us. */ 150 /* If we get here and this is set then the PnP BIOS faulted on us. */
@@ -290,12 +276,15 @@ int pnp_bios_dev_node_info(struct pnp_dev_node_info *data)
290static int __pnp_bios_get_dev_node(u8 *nodenum, char boot, struct pnp_bios_node *data) 276static int __pnp_bios_get_dev_node(u8 *nodenum, char boot, struct pnp_bios_node *data)
291{ 277{
292 u16 status; 278 u16 status;
279 u16 tmp_nodenum;
293 if (!pnp_bios_present()) 280 if (!pnp_bios_present())
294 return PNP_FUNCTION_NOT_SUPPORTED; 281 return PNP_FUNCTION_NOT_SUPPORTED;
295 if ( !boot && pnpbios_dont_use_current_config ) 282 if ( !boot && pnpbios_dont_use_current_config )
296 return PNP_FUNCTION_NOT_SUPPORTED; 283 return PNP_FUNCTION_NOT_SUPPORTED;
284 tmp_nodenum = *nodenum;
297 status = call_pnp_bios(PNP_GET_SYS_DEV_NODE, 0, PNP_TS1, 0, PNP_TS2, boot ? 2 : 1, PNP_DS, 0, 285 status = call_pnp_bios(PNP_GET_SYS_DEV_NODE, 0, PNP_TS1, 0, PNP_TS2, boot ? 2 : 1, PNP_DS, 0,
298 nodenum, sizeof(char), data, 65536); 286 &tmp_nodenum, sizeof(tmp_nodenum), data, 65536);
287 *nodenum = tmp_nodenum;
299 return status; 288 return status;
300} 289}
301 290
@@ -535,10 +524,12 @@ void pnpbios_calls_init(union pnp_bios_install_struct *header)
535 524
536 set_base(bad_bios_desc, __va((unsigned long)0x40 << 4)); 525 set_base(bad_bios_desc, __va((unsigned long)0x40 << 4));
537 _set_limit((char *)&bad_bios_desc, 4095 - (0x40 << 4)); 526 _set_limit((char *)&bad_bios_desc, 4095 - (0x40 << 4));
538 for(i=0; i < NR_CPUS; i++) 527 for (i = 0; i < NR_CPUS; i++) {
539 { 528 struct desc_struct *gdt = get_cpu_gdt_table(i);
540 Q2_SET_SEL(i, PNP_CS32, &pnp_bios_callfunc, 64 * 1024); 529 if (!gdt)
541 Q_SET_SEL(i, PNP_CS16, header->fields.pm16cseg, 64 * 1024); 530 continue;
542 Q_SET_SEL(i, PNP_DS, header->fields.pm16dseg, 64 * 1024); 531 set_base(gdt[GDT_ENTRY_PNPBIOS_CS32], &pnp_bios_callfunc);
543 } 532 set_base(gdt[GDT_ENTRY_PNPBIOS_CS16], __va(header->fields.pm16cseg));
533 set_base(gdt[GDT_ENTRY_PNPBIOS_DS], __va(header->fields.pm16dseg));
534 }
544} 535}
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index f49674f07949..b154b3f52cbe 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -56,7 +56,6 @@
56#include <linux/mm.h> 56#include <linux/mm.h>
57#include <linux/smp.h> 57#include <linux/smp.h>
58#include <linux/slab.h> 58#include <linux/slab.h>
59#include <linux/kobject_uevent.h>
60#include <linux/completion.h> 59#include <linux/completion.h>
61#include <linux/spinlock.h> 60#include <linux/spinlock.h>
62#include <linux/dmi.h> 61#include <linux/dmi.h>
@@ -106,8 +105,6 @@ static int pnp_dock_event(int dock, struct pnp_docking_station_info *info)
106 char *argv [3], **envp, *buf, *scratch; 105 char *argv [3], **envp, *buf, *scratch;
107 int i = 0, value; 106 int i = 0, value;
108 107
109 if (!hotplug_path [0])
110 return -ENOENT;
111 if (!current->fs->root) { 108 if (!current->fs->root) {
112 return -EAGAIN; 109 return -EAGAIN;
113 } 110 }
@@ -119,8 +116,9 @@ static int pnp_dock_event(int dock, struct pnp_docking_station_info *info)
119 return -ENOMEM; 116 return -ENOMEM;
120 } 117 }
121 118
122 /* only one standardized param to hotplug command: type */ 119 /* FIXME: if there are actual users of this, it should be integrated into
123 argv [0] = hotplug_path; 120 * the driver core and use the usual infrastructure like sysfs and uevents */
121 argv [0] = "/sbin/pnpbios";
124 argv [1] = "dock"; 122 argv [1] = "dock";
125 argv [2] = NULL; 123 argv [2] = NULL;
126 124