ia64/xen-unstable

changeset 7033:450b1224a6ac

Remove drivers/acpi/motherboard.c from sparse tree to match
xen-unstable. For now, copy it from elsewhere (see note
in xen-mkbuildtree-pre)
author djm@kirby.fc.hp.com
date Fri Sep 23 13:49:44 2005 -0600 (2005-09-23)
parents 60928c906666
children eaedc6b4ec0f
files linux-2.6-xen-sparse/arch/ia64/xen-mkbuildtree-pre linux-2.6-xen-sparse/arch/ia64/xen/drivers/motherboard.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen-mkbuildtree-pre	Fri Sep 23 11:15:48 2005 -0600
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen-mkbuildtree-pre	Fri Sep 23 13:49:44 2005 -0600
     1.3 @@ -40,6 +40,13 @@ cp arch/ia64/xen/drivers/coreMakefile dr
     1.4  cp arch/ia64/xen/drivers/xenia64_init.c drivers/xen/core
     1.5  cp arch/ia64/xen/drivers/evtchn_ia64.c drivers/xen/core
     1.6  
     1.7 +#this is a one-line change to avoid a nasty kernel crash resulting
     1.8 +#from a use of the FADT entry in the ACPI tree.  The fake ACPI
     1.9 +#tree that Xen sets up for guests has a NULL FADT.  This is a bug
    1.10 +#that needs to be fixed, at which point this can go away.  In the
    1.11 +#meantime, this file needs to be updated if the real motherboard.c is
    1.12 +cp arch/ia64/xen/drivers/evtchn_ia64.c drivers/acpi/motherboard.c
    1.13 +
    1.14  #still a few x86-ism's in various drivers/xen files, patch them
    1.15  cd drivers/xen
    1.16  if [ ! -e ia64.patch.semaphore ]
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/motherboard.c	Fri Sep 23 13:49:44 2005 -0600
     2.3 @@ -0,0 +1,178 @@
     2.4 +/* 
     2.5 + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     2.6 + *  This program is free software; you can redistribute it and/or modify
     2.7 + *  it under the terms of the GNU General Public License as published by
     2.8 + *  the Free Software Foundation; either version 2 of the License, or (at
     2.9 + *  your option) any later version.
    2.10 + *
    2.11 + *  This program is distributed in the hope that it will be useful, but
    2.12 + *  WITHOUT ANY WARRANTY; without even the implied warranty of
    2.13 + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    2.14 + *  General Public License for more details.
    2.15 + *
    2.16 + *  You should have received a copy of the GNU General Public License along
    2.17 + *  with this program; if not, write to the Free Software Foundation, Inc.,
    2.18 + *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
    2.19 + *
    2.20 + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    2.21 + */
    2.22 +
    2.23 +/* Purpose: Prevent PCMCIA cards from using motherboard resources. */
    2.24 +
    2.25 +#include <linux/kernel.h>
    2.26 +#include <linux/init.h>
    2.27 +#include <linux/types.h>
    2.28 +#include <linux/pci.h>
    2.29 +#include <linux/ioport.h>
    2.30 +#include <asm/io.h>
    2.31 +
    2.32 +#include <acpi/acpi_bus.h>
    2.33 +#include <acpi/acpi_drivers.h>
    2.34 +
    2.35 +#define _COMPONENT		ACPI_SYSTEM_COMPONENT
    2.36 +ACPI_MODULE_NAME		("acpi_motherboard")
    2.37 +
    2.38 +/* Dell use PNP0C01 instead of PNP0C02 */
    2.39 +#define ACPI_MB_HID1			"PNP0C01"
    2.40 +#define ACPI_MB_HID2			"PNP0C02"
    2.41 +
    2.42 +/**
    2.43 + * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved
    2.44 + * Doesn't care about the failure of 'request_region', since other may reserve 
    2.45 + * the io ports as well
    2.46 + */
    2.47 +#define IS_RESERVED_ADDR(base, len) \
    2.48 +	(((len) > 0) && ((base) > 0) && ((base) + (len) < IO_SPACE_LIMIT) \
    2.49 +	&& ((base) + (len) > PCIBIOS_MIN_IO))
    2.50 +
    2.51 +/*
    2.52 + * Clearing the flag (IORESOURCE_BUSY) allows drivers to use
    2.53 + * the io ports if they really know they can use it, while
    2.54 + * still preventing hotplug PCI devices from using it. 
    2.55 + */
    2.56 +
    2.57 +static acpi_status
    2.58 +acpi_reserve_io_ranges (struct acpi_resource *res, void *data)
    2.59 +{
    2.60 +	struct resource *requested_res = NULL;
    2.61 +
    2.62 +	ACPI_FUNCTION_TRACE("acpi_reserve_io_ranges");
    2.63 +
    2.64 +	if (res->id == ACPI_RSTYPE_IO) {
    2.65 +		struct acpi_resource_io *io_res = &res->data.io;
    2.66 +
    2.67 +		if (io_res->min_base_address != io_res->max_base_address)
    2.68 +			return_VALUE(AE_OK);
    2.69 +		if (IS_RESERVED_ADDR(io_res->min_base_address, io_res->range_length)) {
    2.70 +			ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n",
    2.71 +				io_res->min_base_address, 
    2.72 +				io_res->min_base_address + io_res->range_length));
    2.73 +			requested_res = request_region(io_res->min_base_address, 
    2.74 +				io_res->range_length, "motherboard");
    2.75 +		}
    2.76 +	} else if (res->id == ACPI_RSTYPE_FIXED_IO) {
    2.77 +		struct acpi_resource_fixed_io *fixed_io_res = &res->data.fixed_io;
    2.78 +
    2.79 +		if (IS_RESERVED_ADDR(fixed_io_res->base_address, fixed_io_res->range_length)) {
    2.80 +			ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n",
    2.81 +				fixed_io_res->base_address, 
    2.82 +				fixed_io_res->base_address + fixed_io_res->range_length));
    2.83 +			requested_res = request_region(fixed_io_res->base_address, 
    2.84 +				fixed_io_res->range_length, "motherboard");
    2.85 +		}
    2.86 +	} else {
    2.87 +		/* Memory mapped IO? */
    2.88 +	}
    2.89 +
    2.90 +	if (requested_res)
    2.91 +		requested_res->flags &= ~IORESOURCE_BUSY;
    2.92 +	return_VALUE(AE_OK);
    2.93 +}
    2.94 +
    2.95 +static int acpi_motherboard_add (struct acpi_device *device)
    2.96 +{
    2.97 +	if (!device)
    2.98 +		return -EINVAL;
    2.99 +	acpi_walk_resources(device->handle, METHOD_NAME__CRS, 
   2.100 +		acpi_reserve_io_ranges, NULL);
   2.101 +
   2.102 +	return 0;
   2.103 +}
   2.104 +
   2.105 +static struct acpi_driver acpi_motherboard_driver1 = {
   2.106 +	.name =		"motherboard",
   2.107 +	.class =	"",
   2.108 +	.ids =		ACPI_MB_HID1,
   2.109 +	.ops =	{
   2.110 +		.add =		acpi_motherboard_add,
   2.111 +	},
   2.112 +};
   2.113 +
   2.114 +static struct acpi_driver acpi_motherboard_driver2 = {
   2.115 +	.name =		"motherboard",
   2.116 +	.class =	"",
   2.117 +	.ids =		ACPI_MB_HID2,
   2.118 +	.ops =	{
   2.119 +		.add =		acpi_motherboard_add,
   2.120 +	},
   2.121 +};
   2.122 +
   2.123 +static void __init
   2.124 +acpi_reserve_resources (void)
   2.125 +{
   2.126 +	if (!acpi_gbl_FADT) return;
   2.127 +	if (acpi_gbl_FADT->xpm1a_evt_blk.address && acpi_gbl_FADT->pm1_evt_len)
   2.128 +		request_region(acpi_gbl_FADT->xpm1a_evt_blk.address, 
   2.129 +			acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK");
   2.130 +
   2.131 +	if (acpi_gbl_FADT->xpm1b_evt_blk.address && acpi_gbl_FADT->pm1_evt_len)
   2.132 +		request_region(acpi_gbl_FADT->xpm1b_evt_blk.address,
   2.133 +			acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK");
   2.134 +
   2.135 +	if (acpi_gbl_FADT->xpm1a_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len)
   2.136 +		request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address, 
   2.137 +			acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK");
   2.138 +
   2.139 +	if (acpi_gbl_FADT->xpm1b_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len)
   2.140 +		request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address, 
   2.141 +			acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK");
   2.142 +
   2.143 +	if (acpi_gbl_FADT->xpm_tmr_blk.address && acpi_gbl_FADT->pm_tm_len == 4)
   2.144 +		request_region(acpi_gbl_FADT->xpm_tmr_blk.address,
   2.145 +			4, "PM_TMR");
   2.146 +
   2.147 +	if (acpi_gbl_FADT->xpm2_cnt_blk.address && acpi_gbl_FADT->pm2_cnt_len)
   2.148 +		request_region(acpi_gbl_FADT->xpm2_cnt_blk.address,
   2.149 +			acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK");
   2.150 +
   2.151 +	/* Length of GPE blocks must be a non-negative multiple of 2 */
   2.152 +
   2.153 +	if (acpi_gbl_FADT->xgpe0_blk.address && acpi_gbl_FADT->gpe0_blk_len &&
   2.154 +			!(acpi_gbl_FADT->gpe0_blk_len & 0x1))
   2.155 +		request_region(acpi_gbl_FADT->xgpe0_blk.address,
   2.156 +			acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK");
   2.157 +
   2.158 +	if (acpi_gbl_FADT->xgpe1_blk.address && acpi_gbl_FADT->gpe1_blk_len &&
   2.159 +			!(acpi_gbl_FADT->gpe1_blk_len & 0x1))
   2.160 +		request_region(acpi_gbl_FADT->xgpe1_blk.address,
   2.161 +			acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK");
   2.162 +}
   2.163 +
   2.164 +static int __init acpi_motherboard_init(void)
   2.165 +{
   2.166 +	acpi_bus_register_driver(&acpi_motherboard_driver1);
   2.167 +	acpi_bus_register_driver(&acpi_motherboard_driver2);
   2.168 +	/* 
   2.169 +	 * Guarantee motherboard IO reservation first
   2.170 +	 * This module must run after scan.c
   2.171 +	 */
   2.172 +	if (!acpi_disabled)
   2.173 +		acpi_reserve_resources ();
   2.174 +	return 0;
   2.175 +}
   2.176 +
   2.177 +/**
   2.178 + * Reserve motherboard resources after PCI claim BARs,
   2.179 + * but before PCI assign resources for uninitialized PCI devices
   2.180 + */
   2.181 +fs_initcall(acpi_motherboard_init);
     3.1 --- a/linux-2.6-xen-sparse/drivers/acpi/motherboard.c	Fri Sep 23 11:15:48 2005 -0600
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,178 +0,0 @@
     3.4 -/* 
     3.5 - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     3.6 - *  This program is free software; you can redistribute it and/or modify
     3.7 - *  it under the terms of the GNU General Public License as published by
     3.8 - *  the Free Software Foundation; either version 2 of the License, or (at
     3.9 - *  your option) any later version.
    3.10 - *
    3.11 - *  This program is distributed in the hope that it will be useful, but
    3.12 - *  WITHOUT ANY WARRANTY; without even the implied warranty of
    3.13 - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    3.14 - *  General Public License for more details.
    3.15 - *
    3.16 - *  You should have received a copy of the GNU General Public License along
    3.17 - *  with this program; if not, write to the Free Software Foundation, Inc.,
    3.18 - *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
    3.19 - *
    3.20 - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3.21 - */
    3.22 -
    3.23 -/* Purpose: Prevent PCMCIA cards from using motherboard resources. */
    3.24 -
    3.25 -#include <linux/kernel.h>
    3.26 -#include <linux/init.h>
    3.27 -#include <linux/types.h>
    3.28 -#include <linux/pci.h>
    3.29 -#include <linux/ioport.h>
    3.30 -#include <asm/io.h>
    3.31 -
    3.32 -#include <acpi/acpi_bus.h>
    3.33 -#include <acpi/acpi_drivers.h>
    3.34 -
    3.35 -#define _COMPONENT		ACPI_SYSTEM_COMPONENT
    3.36 -ACPI_MODULE_NAME		("acpi_motherboard")
    3.37 -
    3.38 -/* Dell use PNP0C01 instead of PNP0C02 */
    3.39 -#define ACPI_MB_HID1			"PNP0C01"
    3.40 -#define ACPI_MB_HID2			"PNP0C02"
    3.41 -
    3.42 -/**
    3.43 - * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved
    3.44 - * Doesn't care about the failure of 'request_region', since other may reserve 
    3.45 - * the io ports as well
    3.46 - */
    3.47 -#define IS_RESERVED_ADDR(base, len) \
    3.48 -	(((len) > 0) && ((base) > 0) && ((base) + (len) < IO_SPACE_LIMIT) \
    3.49 -	&& ((base) + (len) > PCIBIOS_MIN_IO))
    3.50 -
    3.51 -/*
    3.52 - * Clearing the flag (IORESOURCE_BUSY) allows drivers to use
    3.53 - * the io ports if they really know they can use it, while
    3.54 - * still preventing hotplug PCI devices from using it. 
    3.55 - */
    3.56 -
    3.57 -static acpi_status
    3.58 -acpi_reserve_io_ranges (struct acpi_resource *res, void *data)
    3.59 -{
    3.60 -	struct resource *requested_res = NULL;
    3.61 -
    3.62 -	ACPI_FUNCTION_TRACE("acpi_reserve_io_ranges");
    3.63 -
    3.64 -	if (res->id == ACPI_RSTYPE_IO) {
    3.65 -		struct acpi_resource_io *io_res = &res->data.io;
    3.66 -
    3.67 -		if (io_res->min_base_address != io_res->max_base_address)
    3.68 -			return_VALUE(AE_OK);
    3.69 -		if (IS_RESERVED_ADDR(io_res->min_base_address, io_res->range_length)) {
    3.70 -			ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n",
    3.71 -				io_res->min_base_address, 
    3.72 -				io_res->min_base_address + io_res->range_length));
    3.73 -			requested_res = request_region(io_res->min_base_address, 
    3.74 -				io_res->range_length, "motherboard");
    3.75 -		}
    3.76 -	} else if (res->id == ACPI_RSTYPE_FIXED_IO) {
    3.77 -		struct acpi_resource_fixed_io *fixed_io_res = &res->data.fixed_io;
    3.78 -
    3.79 -		if (IS_RESERVED_ADDR(fixed_io_res->base_address, fixed_io_res->range_length)) {
    3.80 -			ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n",
    3.81 -				fixed_io_res->base_address, 
    3.82 -				fixed_io_res->base_address + fixed_io_res->range_length));
    3.83 -			requested_res = request_region(fixed_io_res->base_address, 
    3.84 -				fixed_io_res->range_length, "motherboard");
    3.85 -		}
    3.86 -	} else {
    3.87 -		/* Memory mapped IO? */
    3.88 -	}
    3.89 -
    3.90 -	if (requested_res)
    3.91 -		requested_res->flags &= ~IORESOURCE_BUSY;
    3.92 -	return_VALUE(AE_OK);
    3.93 -}
    3.94 -
    3.95 -static int acpi_motherboard_add (struct acpi_device *device)
    3.96 -{
    3.97 -	if (!device)
    3.98 -		return -EINVAL;
    3.99 -	acpi_walk_resources(device->handle, METHOD_NAME__CRS, 
   3.100 -		acpi_reserve_io_ranges, NULL);
   3.101 -
   3.102 -	return 0;
   3.103 -}
   3.104 -
   3.105 -static struct acpi_driver acpi_motherboard_driver1 = {
   3.106 -	.name =		"motherboard",
   3.107 -	.class =	"",
   3.108 -	.ids =		ACPI_MB_HID1,
   3.109 -	.ops =	{
   3.110 -		.add =		acpi_motherboard_add,
   3.111 -	},
   3.112 -};
   3.113 -
   3.114 -static struct acpi_driver acpi_motherboard_driver2 = {
   3.115 -	.name =		"motherboard",
   3.116 -	.class =	"",
   3.117 -	.ids =		ACPI_MB_HID2,
   3.118 -	.ops =	{
   3.119 -		.add =		acpi_motherboard_add,
   3.120 -	},
   3.121 -};
   3.122 -
   3.123 -static void __init
   3.124 -acpi_reserve_resources (void)
   3.125 -{
   3.126 -	if (!acpi_gbl_FADT) return;
   3.127 -	if (acpi_gbl_FADT->xpm1a_evt_blk.address && acpi_gbl_FADT->pm1_evt_len)
   3.128 -		request_region(acpi_gbl_FADT->xpm1a_evt_blk.address, 
   3.129 -			acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK");
   3.130 -
   3.131 -	if (acpi_gbl_FADT->xpm1b_evt_blk.address && acpi_gbl_FADT->pm1_evt_len)
   3.132 -		request_region(acpi_gbl_FADT->xpm1b_evt_blk.address,
   3.133 -			acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK");
   3.134 -
   3.135 -	if (acpi_gbl_FADT->xpm1a_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len)
   3.136 -		request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address, 
   3.137 -			acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK");
   3.138 -
   3.139 -	if (acpi_gbl_FADT->xpm1b_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len)
   3.140 -		request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address, 
   3.141 -			acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK");
   3.142 -
   3.143 -	if (acpi_gbl_FADT->xpm_tmr_blk.address && acpi_gbl_FADT->pm_tm_len == 4)
   3.144 -		request_region(acpi_gbl_FADT->xpm_tmr_blk.address,
   3.145 -			4, "PM_TMR");
   3.146 -
   3.147 -	if (acpi_gbl_FADT->xpm2_cnt_blk.address && acpi_gbl_FADT->pm2_cnt_len)
   3.148 -		request_region(acpi_gbl_FADT->xpm2_cnt_blk.address,
   3.149 -			acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK");
   3.150 -
   3.151 -	/* Length of GPE blocks must be a non-negative multiple of 2 */
   3.152 -
   3.153 -	if (acpi_gbl_FADT->xgpe0_blk.address && acpi_gbl_FADT->gpe0_blk_len &&
   3.154 -			!(acpi_gbl_FADT->gpe0_blk_len & 0x1))
   3.155 -		request_region(acpi_gbl_FADT->xgpe0_blk.address,
   3.156 -			acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK");
   3.157 -
   3.158 -	if (acpi_gbl_FADT->xgpe1_blk.address && acpi_gbl_FADT->gpe1_blk_len &&
   3.159 -			!(acpi_gbl_FADT->gpe1_blk_len & 0x1))
   3.160 -		request_region(acpi_gbl_FADT->xgpe1_blk.address,
   3.161 -			acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK");
   3.162 -}
   3.163 -
   3.164 -static int __init acpi_motherboard_init(void)
   3.165 -{
   3.166 -	acpi_bus_register_driver(&acpi_motherboard_driver1);
   3.167 -	acpi_bus_register_driver(&acpi_motherboard_driver2);
   3.168 -	/* 
   3.169 -	 * Guarantee motherboard IO reservation first
   3.170 -	 * This module must run after scan.c
   3.171 -	 */
   3.172 -	if (!acpi_disabled)
   3.173 -		acpi_reserve_resources ();
   3.174 -	return 0;
   3.175 -}
   3.176 -
   3.177 -/**
   3.178 - * Reserve motherboard resources after PCI claim BARs,
   3.179 - * but before PCI assign resources for uninitialized PCI devices
   3.180 - */
   3.181 -fs_initcall(acpi_motherboard_init);