aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/motherboard.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c
index 468244147ec1..14ffe68a094e 100644
--- a/drivers/acpi/motherboard.c
+++ b/drivers/acpi/motherboard.c
@@ -123,41 +123,46 @@ 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,
130 acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK"); 141 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,
134 acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK"); 144 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,
138 acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK"); 147 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,
142 acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK"); 150 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, "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,
149 acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK"); 156 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,
156 acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK"); 162 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,
161 acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK"); 166 acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK");
162} 167}
163 168