aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2007-01-18 18:44:48 -0500
committerLen Brown <len.brown@intel.com>2007-01-26 02:08:32 -0500
commit5eca338fb510af78eee5372ff6a3525768ab913f (patch)
treeb98d21158e4e3b444d112b89eb8d86815cdcf582
parent10fccf5fda7529258325769e9da136064b481aab (diff)
ACPI: remove motherboard driver (redundant with PNP system driver)
The PNP system board driver (drivers/pnp/system.c) contains all the same functionality, so we don't need the ACPI version. Previously, a motherboard device would be claimed by *both* the ACPI and PNP drivers, resulting in stuff like this in /proc/ioports: 1200-121f : motherboard <-- from drivers/acpi/motherboard.c 1200-121f : pnp 00:0d <-- from drivers/pnp/system.c Make sure to enable CONFIG_PNP (and CONFIG_PNPACPI) to include the PNP system board driver. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/acpi/Makefile2
-rw-r--r--drivers/acpi/motherboard.c131
2 files changed, 1 insertions, 132 deletions
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index a7495107057c..62b3dd5ce739 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -37,7 +37,7 @@ endif
37 37
38obj-y += sleep/ 38obj-y += sleep/
39obj-y += bus.o glue.o 39obj-y += bus.o glue.o
40obj-y += scan.o motherboard.o 40obj-y += scan.o
41obj-$(CONFIG_ACPI_AC) += ac.o 41obj-$(CONFIG_ACPI_AC) += ac.o
42obj-$(CONFIG_ACPI_BATTERY) += battery.o 42obj-$(CONFIG_ACPI_BATTERY) += battery.o
43obj-$(CONFIG_ACPI_BUTTON) += button.o 43obj-$(CONFIG_ACPI_BUTTON) += button.o
diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c
deleted file mode 100644
index cddab7b29de8..000000000000
--- a/drivers/acpi/motherboard.c
+++ /dev/null
@@ -1,131 +0,0 @@
1/*
2 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or (at
6 * your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
16 *
17 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 */
19
20/* Purpose: Prevent PCMCIA cards from using motherboard resources. */
21
22#include <linux/kernel.h>
23#include <linux/init.h>
24#include <linux/types.h>
25#include <linux/pci.h>
26#include <linux/ioport.h>
27#include <asm/io.h>
28
29#include <acpi/acpi_bus.h>
30#include <acpi/acpi_drivers.h>
31
32#define _COMPONENT ACPI_SYSTEM_COMPONENT
33ACPI_MODULE_NAME("acpi_motherboard")
34
35/* Dell use PNP0C01 instead of PNP0C02 */
36#define ACPI_MB_HID "PNP0C01,PNP0C02"
37/**
38 * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved
39 * Doesn't care about the failure of 'request_region', since other may reserve
40 * the io ports as well
41 */
42#define IS_RESERVED_ADDR(base, len) \
43 (((len) > 0) && ((base) > 0) && ((base) + (len) < IO_SPACE_LIMIT) \
44 && ((base) + (len) > PCIBIOS_MIN_IO))
45/*
46 * Clearing the flag (IORESOURCE_BUSY) allows drivers to use
47 * the io ports if they really know they can use it, while
48 * still preventing hotplug PCI devices from using it.
49 */
50
51/*
52 * When CONFIG_PNP is enabled, pnp/system.c binds to PNP0C01
53 * and PNP0C02, redundant with acpi_reserve_io_ranges().
54 * But acpi_reserve_io_ranges() is necessary for !CONFIG_PNP.
55 */
56static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data)
57{
58 struct resource *requested_res = NULL;
59
60
61 if (res->type == ACPI_RESOURCE_TYPE_IO) {
62 struct acpi_resource_io *io_res = &res->data.io;
63
64 if (io_res->minimum != io_res->maximum)
65 return AE_OK;
66 if (IS_RESERVED_ADDR
67 (io_res->minimum, io_res->address_length)) {
68 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
69 "Motherboard resources 0x%08x - 0x%08x\n",
70 io_res->minimum,
71 io_res->minimum +
72 io_res->address_length));
73 requested_res =
74 request_region(io_res->minimum,
75 io_res->address_length, "motherboard");
76 }
77 } else if (res->type == ACPI_RESOURCE_TYPE_FIXED_IO) {
78 struct acpi_resource_fixed_io *fixed_io_res =
79 &res->data.fixed_io;
80
81 if (IS_RESERVED_ADDR
82 (fixed_io_res->address, fixed_io_res->address_length)) {
83 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
84 "Motherboard resources 0x%08x - 0x%08x\n",
85 fixed_io_res->address,
86 fixed_io_res->address +
87 fixed_io_res->address_length));
88 requested_res =
89 request_region(fixed_io_res->address,
90 fixed_io_res->address_length,
91 "motherboard");
92 }
93 } else {
94 /* Memory mapped IO? */
95 }
96
97 if (requested_res)
98 requested_res->flags &= ~IORESOURCE_BUSY;
99 return AE_OK;
100}
101
102static int acpi_motherboard_add(struct acpi_device *device)
103{
104 if (!device)
105 return -EINVAL;
106 acpi_walk_resources(device->handle, METHOD_NAME__CRS,
107 acpi_reserve_io_ranges, NULL);
108
109 return 0;
110}
111
112static struct acpi_driver acpi_motherboard_driver = {
113 .name = "motherboard",
114 .class = "",
115 .ids = ACPI_MB_HID,
116 .ops = {
117 .add = acpi_motherboard_add,
118 },
119};
120
121static int __init acpi_motherboard_init(void)
122{
123 acpi_bus_register_driver(&acpi_motherboard_driver);
124 return 0;
125}
126
127/**
128 * Reserve motherboard resources after PCI claim BARs,
129 * but before PCI assign resources for uninitialized PCI devices
130 */
131fs_initcall(acpi_motherboard_init);