aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/motherboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/motherboard.c')
-rw-r--r--drivers/acpi/motherboard.c61
1 files changed, 33 insertions, 28 deletions
diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c
index 468244147ec1..d51d68f5dd8d 100644
--- a/drivers/acpi/motherboard.c
+++ b/drivers/acpi/motherboard.c
@@ -37,7 +37,7 @@ ACPI_MODULE_NAME("acpi_motherboard")
37#define ACPI_MB_HID2 "PNP0C02" 37#define ACPI_MB_HID2 "PNP0C02"
38/** 38/**
39 * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved 39 * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved
40 * Doesn't care about the failure of 'request_region', since other may reserve 40 * Doesn't care about the failure of 'request_region', since other may reserve
41 * the io ports as well 41 * the io ports as well
42 */ 42 */
43#define IS_RESERVED_ADDR(base, len) \ 43#define IS_RESERVED_ADDR(base, len) \
@@ -46,7 +46,7 @@ ACPI_MODULE_NAME("acpi_motherboard")
46/* 46/*
47 * Clearing the flag (IORESOURCE_BUSY) allows drivers to use 47 * Clearing the flag (IORESOURCE_BUSY) allows drivers to use
48 * the io ports if they really know they can use it, while 48 * the io ports if they really know they can use it, while
49 * still preventing hotplug PCI devices from using it. 49 * still preventing hotplug PCI devices from using it.
50 */ 50 */
51static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) 51static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data)
52{ 52{
@@ -123,49 +123,54 @@ static struct acpi_driver acpi_motherboard_driver2 = {
123 }, 123 },
124}; 124};
125 125
126static void __init acpi_request_region (struct acpi_generic_address *addr,
127 unsigned int length, char *desc)
128{
129 if (!addr->address || !length)
130 return;
131
132 if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_IO)
133 request_region(addr->address, length, desc);
134 else if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
135 request_mem_region(addr->address, length, desc);
136}
137
126static void __init acpi_reserve_resources(void) 138static void __init acpi_reserve_resources(void)
127{ 139{
128 if (acpi_gbl_FADT->xpm1a_evt_blk.address && acpi_gbl_FADT->pm1_evt_len) 140 acpi_request_region(&acpi_gbl_FADT->xpm1a_evt_blk,
129 request_region(acpi_gbl_FADT->xpm1a_evt_blk.address, 141 acpi_gbl_FADT->pm1_evt_len, "ACPI PM1a_EVT_BLK");
130 acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK");
131 142
132 if (acpi_gbl_FADT->xpm1b_evt_blk.address && acpi_gbl_FADT->pm1_evt_len) 143 acpi_request_region(&acpi_gbl_FADT->xpm1b_evt_blk,
133 request_region(acpi_gbl_FADT->xpm1b_evt_blk.address, 144 acpi_gbl_FADT->pm1_evt_len, "ACPI PM1b_EVT_BLK");
134 acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK");
135 145
136 if (acpi_gbl_FADT->xpm1a_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len) 146 acpi_request_region(&acpi_gbl_FADT->xpm1a_cnt_blk,
137 request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address, 147 acpi_gbl_FADT->pm1_cnt_len, "ACPI PM1a_CNT_BLK");
138 acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK");
139 148
140 if (acpi_gbl_FADT->xpm1b_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len) 149 acpi_request_region(&acpi_gbl_FADT->xpm1b_cnt_blk,
141 request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address, 150 acpi_gbl_FADT->pm1_cnt_len, "ACPI PM1b_CNT_BLK");
142 acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK");
143 151
144 if (acpi_gbl_FADT->xpm_tmr_blk.address && acpi_gbl_FADT->pm_tm_len == 4) 152 if (acpi_gbl_FADT->pm_tm_len == 4)
145 request_region(acpi_gbl_FADT->xpm_tmr_blk.address, 4, "PM_TMR"); 153 acpi_request_region(&acpi_gbl_FADT->xpm_tmr_blk, 4, "ACPI PM_TMR");
146 154
147 if (acpi_gbl_FADT->xpm2_cnt_blk.address && acpi_gbl_FADT->pm2_cnt_len) 155 acpi_request_region(&acpi_gbl_FADT->xpm2_cnt_blk,
148 request_region(acpi_gbl_FADT->xpm2_cnt_blk.address, 156 acpi_gbl_FADT->pm2_cnt_len, "ACPI PM2_CNT_BLK");
149 acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK");
150 157
151 /* Length of GPE blocks must be a non-negative multiple of 2 */ 158 /* Length of GPE blocks must be a non-negative multiple of 2 */
152 159
153 if (acpi_gbl_FADT->xgpe0_blk.address && acpi_gbl_FADT->gpe0_blk_len && 160 if (!(acpi_gbl_FADT->gpe0_blk_len & 0x1))
154 !(acpi_gbl_FADT->gpe0_blk_len & 0x1)) 161 acpi_request_region(&acpi_gbl_FADT->xgpe0_blk,
155 request_region(acpi_gbl_FADT->xgpe0_blk.address, 162 acpi_gbl_FADT->gpe0_blk_len, "ACPI GPE0_BLK");
156 acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK");
157 163
158 if (acpi_gbl_FADT->xgpe1_blk.address && acpi_gbl_FADT->gpe1_blk_len && 164 if (!(acpi_gbl_FADT->gpe1_blk_len & 0x1))
159 !(acpi_gbl_FADT->gpe1_blk_len & 0x1)) 165 acpi_request_region(&acpi_gbl_FADT->xgpe1_blk,
160 request_region(acpi_gbl_FADT->xgpe1_blk.address, 166 acpi_gbl_FADT->gpe1_blk_len, "ACPI GPE1_BLK");
161 acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK");
162} 167}
163 168
164static int __init acpi_motherboard_init(void) 169static int __init acpi_motherboard_init(void)
165{ 170{
166 acpi_bus_register_driver(&acpi_motherboard_driver1); 171 acpi_bus_register_driver(&acpi_motherboard_driver1);
167 acpi_bus_register_driver(&acpi_motherboard_driver2); 172 acpi_bus_register_driver(&acpi_motherboard_driver2);
168 /* 173 /*
169 * Guarantee motherboard IO reservation first 174 * Guarantee motherboard IO reservation first
170 * This module must run after scan.c 175 * This module must run after scan.c
171 */ 176 */