]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
Pull motherboard into test branch
authorLen Brown <len.brown@intel.com>
Sat, 3 Feb 2007 06:38:16 +0000 (01:38 -0500)
committerLen Brown <len.brown@intel.com>
Sat, 3 Feb 2007 06:38:16 +0000 (01:38 -0500)
Conflicts:

drivers/acpi/motherboard.c

Signed-off-by: Len Brown <len.brown@intel.com>
arch/i386/defconfig
drivers/acpi/Makefile
drivers/acpi/motherboard.c [deleted file]
drivers/acpi/osl.c
drivers/pnp/pnpacpi/Kconfig
drivers/pnp/system.c

index 5d80edfc61b7f61f36ed0183c886921c8a79ffd1..bb0c376b62b32fcc8ee934ce281676908b6fd150 100644 (file)
@@ -466,7 +466,8 @@ CONFIG_FW_LOADER=y
 #
 # Plug and Play support
 #
-# CONFIG_PNP is not set
+CONFIG_PNP=y
+CONFIG_PNPACPI=y
 
 #
 # Block devices
index 399b0e8c41c4caeba71cf2e1a55490d992030cee..856c32bccacb04024b7036282bed0c865ef7395e 100644 (file)
@@ -37,7 +37,7 @@ endif
 
 obj-y                          += sleep/
 obj-y                          += bus.o glue.o
-obj-y                          += scan.o motherboard.o
+obj-y                          += scan.o
 obj-$(CONFIG_ACPI_AC)          += ac.o
 obj-$(CONFIG_ACPI_BATTERY)     += battery.o
 obj-$(CONFIG_ACPI_BUTTON)      += button.o
diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c
deleted file mode 100644 (file)
index 8f13b4f..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-/* 
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or (at
- *  your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful, but
- *  WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License along
- *  with this program; if not, write to the Free Software Foundation, Inc.,
- *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- */
-
-/* Purpose: Prevent PCMCIA cards from using motherboard resources. */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/types.h>
-#include <linux/pci.h>
-#include <linux/ioport.h>
-#include <asm/io.h>
-
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
-
-#define _COMPONENT             ACPI_SYSTEM_COMPONENT
-ACPI_MODULE_NAME("acpi_motherboard")
-
-/* Dell use PNP0C01 instead of PNP0C02 */
-#define ACPI_MB_HID                    "PNP0C01,PNP0C02"
-/**
- * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved
- * Doesn't care about the failure of 'request_region', since other may reserve
- * the io ports as well
- */
-#define IS_RESERVED_ADDR(base, len) \
-       (((len) > 0) && ((base) > 0) && ((base) + (len) < IO_SPACE_LIMIT) \
-       && ((base) + (len) > PCIBIOS_MIN_IO))
-/*
- * Clearing the flag (IORESOURCE_BUSY) allows drivers to use
- * the io ports if they really know they can use it, while
- * still preventing hotplug PCI devices from using it.
- */
-
-/*
- * When CONFIG_PNP is enabled, pnp/system.c binds to PNP0C01
- * and PNP0C02, redundant with acpi_reserve_io_ranges().
- * But acpi_reserve_io_ranges() is necessary for !CONFIG_PNP.
- */
-static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data)
-{
-       struct resource *requested_res = NULL;
-
-
-       if (res->type == ACPI_RESOURCE_TYPE_IO) {
-               struct acpi_resource_io *io_res = &res->data.io;
-
-               if (io_res->minimum != io_res->maximum)
-                       return AE_OK;
-               if (IS_RESERVED_ADDR
-                   (io_res->minimum, io_res->address_length)) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                         "Motherboard resources 0x%08x - 0x%08x\n",
-                                         io_res->minimum,
-                                         io_res->minimum +
-                                         io_res->address_length));
-                       requested_res =
-                           request_region(io_res->minimum,
-                                          io_res->address_length, "motherboard");
-               }
-       } else if (res->type == ACPI_RESOURCE_TYPE_FIXED_IO) {
-               struct acpi_resource_fixed_io *fixed_io_res =
-                   &res->data.fixed_io;
-
-               if (IS_RESERVED_ADDR
-                   (fixed_io_res->address, fixed_io_res->address_length)) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                         "Motherboard resources 0x%08x - 0x%08x\n",
-                                         fixed_io_res->address,
-                                         fixed_io_res->address +
-                                         fixed_io_res->address_length));
-                       requested_res =
-                           request_region(fixed_io_res->address,
-                                          fixed_io_res->address_length,
-                                          "motherboard");
-               }
-       } else {
-               /* Memory mapped IO? */
-       }
-
-       if (requested_res)
-               requested_res->flags &= ~IORESOURCE_BUSY;
-       return AE_OK;
-}
-
-static int acpi_motherboard_add(struct acpi_device *device)
-{
-       if (!device)
-               return -EINVAL;
-       acpi_walk_resources(device->handle, METHOD_NAME__CRS,
-                           acpi_reserve_io_ranges, NULL);
-
-       return 0;
-}
-
-static struct acpi_driver acpi_motherboard_driver = {
-       .name = "motherboard",
-       .class = "",
-       .ids = ACPI_MB_HID,
-       .ops = {
-               .add = acpi_motherboard_add,
-               },
-};
-
-static void __init acpi_request_region (struct acpi_generic_address *addr,
-       unsigned int length, char *desc)
-{
-       if (!addr->address || !length)
-               return;
-
-       if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_IO)
-               request_region(addr->address, length, desc);
-       else if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
-               request_mem_region(addr->address, length, desc);
-}
-
-static void __init acpi_reserve_resources(void)
-{
-       acpi_request_region(&acpi_gbl_FADT.xpm1a_event_block,
-                              acpi_gbl_FADT.pm1_event_length, "ACPI PM1a_EVT_BLK");
-
-       acpi_request_region(&acpi_gbl_FADT.xpm1b_event_block,
-                              acpi_gbl_FADT.pm1_event_length, "ACPI PM1b_EVT_BLK");
-
-       acpi_request_region(&acpi_gbl_FADT.xpm1a_control_block,
-                              acpi_gbl_FADT.pm1_control_length, "ACPI PM1a_CNT_BLK");
-
-       acpi_request_region(&acpi_gbl_FADT.xpm1b_control_block,
-                              acpi_gbl_FADT.pm1_control_length, "ACPI PM1b_CNT_BLK");
-
-       if (acpi_gbl_FADT.pm_timer_length == 4)
-               acpi_request_region(&acpi_gbl_FADT.xpm_timer_block, 4, "ACPI PM_TMR");
-
-       acpi_request_region(&acpi_gbl_FADT.xpm2_control_block,
-                              acpi_gbl_FADT.pm2_control_length, "ACPI PM2_CNT_BLK");
-
-       /* Length of GPE blocks must be a non-negative multiple of 2 */
-
-       if (!(acpi_gbl_FADT.gpe0_block_length & 0x1))
-               acpi_request_region(&acpi_gbl_FADT.xgpe0_block,
-                              acpi_gbl_FADT.gpe0_block_length, "ACPI GPE0_BLK");
-
-       if (!(acpi_gbl_FADT.gpe1_block_length & 0x1))
-               acpi_request_region(&acpi_gbl_FADT.xgpe1_block,
-                              acpi_gbl_FADT.gpe1_block_length, "ACPI GPE1_BLK");
-}
-
-static int __init acpi_motherboard_init(void)
-{
-       acpi_bus_register_driver(&acpi_motherboard_driver);
-       /*
-        * Guarantee motherboard IO reservation first
-        * This module must run after scan.c
-        */
-       if (!acpi_disabled)
-               acpi_reserve_resources();
-       return 0;
-}
-
-/**
- * Reserve motherboard resources after PCI claim BARs,
- * but before PCI assign resources for uninitialized PCI devices
- */
-fs_initcall(acpi_motherboard_init);
index a28f5b8972b42c6c589a2fd24126308fb4fecbe2..0f6f3bcbc8ebc2d4b0c06cb8f1443d1fb5e6e9b6 100644 (file)
@@ -76,6 +76,54 @@ static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
 static struct workqueue_struct *kacpid_wq;
 
+static void __init acpi_request_region (struct acpi_generic_address *addr,
+       unsigned int length, char *desc)
+{
+       struct resource *res;
+
+       if (!addr->address || !length)
+               return;
+
+       if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_IO)
+               res = request_region(addr->address, length, desc);
+       else if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
+               res = request_mem_region(addr->address, length, desc);
+}
+
+static int __init acpi_reserve_resources(void)
+{
+       acpi_request_region(&acpi_gbl_FADT.xpm1a_event_block, acpi_gbl_FADT.pm1_event_length,
+               "ACPI PM1a_EVT_BLK");
+
+       acpi_request_region(&acpi_gbl_FADT.xpm1b_event_block, acpi_gbl_FADT.pm1_event_length,
+               "ACPI PM1b_EVT_BLK");
+
+       acpi_request_region(&acpi_gbl_FADT.xpm1a_control_block, acpi_gbl_FADT.pm1_control_length,
+               "ACPI PM1a_CNT_BLK");
+
+       acpi_request_region(&acpi_gbl_FADT.xpm1b_control_block, acpi_gbl_FADT.pm1_control_length,
+               "ACPI PM1b_CNT_BLK");
+
+       if (acpi_gbl_FADT.pm_timer_length == 4)
+               acpi_request_region(&acpi_gbl_FADT.xpm_timer_block, 4, "ACPI PM_TMR");
+
+       acpi_request_region(&acpi_gbl_FADT.xpm2_control_block, acpi_gbl_FADT.pm2_control_length,
+               "ACPI PM2_CNT_BLK");
+
+       /* Length of GPE blocks must be a non-negative multiple of 2 */
+
+       if (!(acpi_gbl_FADT.gpe0_block_length & 0x1))
+               acpi_request_region(&acpi_gbl_FADT.xgpe0_block,
+                              acpi_gbl_FADT.gpe0_block_length, "ACPI GPE0_BLK");
+
+       if (!(acpi_gbl_FADT.gpe1_block_length & 0x1))
+               acpi_request_region(&acpi_gbl_FADT.xgpe1_block,
+                              acpi_gbl_FADT.gpe1_block_length, "ACPI GPE1_BLK");
+
+       return 0;
+}
+device_initcall(acpi_reserve_resources);
+
 acpi_status acpi_os_initialize(void)
 {
        return AE_OK;
index b1854171b9632b8ef260cf34ab6f0d0641a0f487..ad27e5e0101fd178bc9dbeeb84a94e855f0fc89e 100644 (file)
@@ -2,8 +2,8 @@
 # Plug and Play ACPI configuration
 #
 config PNPACPI
-       bool "Plug and Play ACPI support (EXPERIMENTAL)"
-       depends on PNP && ACPI && EXPERIMENTAL
+       bool "Plug and Play ACPI support"
+       depends on PNP && ACPI
        default y
        ---help---
          Linux uses the PNPACPI to autodetect built-in
index d42015c382af5aa7fd106081403c490ad3673317..2065e74bb63f530d6fae0b99279d24058d1493b1 100644 (file)
@@ -3,7 +3,8 @@
  *
  * Some code is based on pnpbios_core.c
  * Copyright 2002 Adam Belay <ambx1@neo.rr.com>
- *
+ * (c) Copyright 2007 Hewlett-Packard Development Company, L.P.
+ *     Bjorn Helgaas <bjorn.helgaas@hp.com>
  */
 
 #include <linux/pnp.h>
@@ -21,18 +22,21 @@ static const struct pnp_device_id pnp_dev_table[] = {
        {       "",                     0       }
 };
 
-static void reserve_ioport_range(char *pnpid, int start, int end)
+static void reserve_range(char *pnpid, int start, int end, int port)
 {
        struct resource *res;
        char *regionid;
 
        regionid = kmalloc(16, GFP_KERNEL);
-       if ( regionid == NULL )
+       if (regionid == NULL)
                return;
        snprintf(regionid, 16, "pnp %s", pnpid);
-       res = request_region(start,end-start+1,regionid);
-       if ( res == NULL )
-               kfree( regionid );
+       if (port)
+               res = request_region(start,end-start+1,regionid);
+       else
+               res = request_mem_region(start,end-start+1,regionid);
+       if (res == NULL)
+               kfree(regionid);
        else
                res->flags &= ~IORESOURCE_BUSY;
        /*
@@ -41,26 +45,20 @@ static void reserve_ioport_range(char *pnpid, int start, int end)
         * have double reservations.
         */
        printk(KERN_INFO
-               "pnp: %s: ioport range 0x%x-0x%x %s reserved\n",
-               pnpid, start, end,
-               NULL != res ? "has been" : "could not be"
-       );
-
-       return;
+               "pnp: %s: %s range 0x%x-0x%x %s reserved\n",
+               pnpid, port ? "ioport" : "iomem", start, end,
+               NULL != res ? "has been" : "could not be");
 }
 
-static void reserve_resources_of_dev( struct pnp_dev *dev )
+static void reserve_resources_of_dev(struct pnp_dev *dev)
 {
        int i;
 
-       for (i=0;i<PNP_MAX_PORT;i++) {
+       for (i = 0; i < PNP_MAX_PORT; i++) {
                if (!pnp_port_valid(dev, i))
-                       /* end of resources */
                        continue;
                if (pnp_port_start(dev, i) == 0)
-                       /* disabled */
-                       /* Do nothing */
-                       continue;
+                       continue;       /* disabled */
                if (pnp_port_start(dev, i) < 0x100)
                        /*
                         * Below 0x100 is only standard PC hardware
@@ -72,14 +70,18 @@ static void reserve_resources_of_dev( struct pnp_dev *dev )
                         */
                        continue;
                if (pnp_port_end(dev, i) < pnp_port_start(dev, i))
-                       /* invalid endpoint */
-                       /* Do nothing */
+                       continue;       /* invalid */
+
+               reserve_range(dev->dev.bus_id, pnp_port_start(dev, i),
+                       pnp_port_end(dev, i), 1);
+       }
+
+       for (i = 0; i < PNP_MAX_MEM; i++) {
+               if (!pnp_mem_valid(dev, i))
                        continue;
-               reserve_ioport_range(
-                       dev->dev.bus_id,
-                       pnp_port_start(dev, i),
-                       pnp_port_end(dev, i)
-               );
+
+               reserve_range(dev->dev.bus_id, pnp_mem_start(dev, i),
+                       pnp_mem_end(dev, i), 0);
        }
 
        return;