diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2007-01-18 18:42:55 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-01-26 02:08:12 -0500 |
commit | 9a47cdb1bb85e7944fb7419e4078c46516ef7335 (patch) | |
tree | 5ced6375a6c7299190cba4c700c9fa9269002a9e /drivers | |
parent | bb0958544f3c7c016b2a3025ab3694363e403aa1 (diff) |
ACPI: move FADT resource reservations from motherboard driver to osl
Resources described by the FADT aren't really a good fit for the
ACPI motherboard driver.
The motherboard driver cares about PNP0C01 and PNP0C02 devices and
their resources.
The FADT describes some resources used by the ACPI core. Often, they
are also described by by the _CRS of a motherboard device, but I think
it's better to reserve them specifically in the ACPI osl.c because
(a) the motherboard driver is optional and ACPI uses the resources even
if the driver is absent, and (b) I want to remove the ACPI motherboard
driver because it's mostly redundant with the PNP system.c driver.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/motherboard.c | 49 | ||||
-rw-r--r-- | drivers/acpi/osl.c | 48 |
2 files changed, 48 insertions, 49 deletions
diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c index bedb5118e312..cddab7b29de8 100644 --- a/drivers/acpi/motherboard.c +++ b/drivers/acpi/motherboard.c | |||
@@ -118,58 +118,9 @@ static struct acpi_driver acpi_motherboard_driver = { | |||
118 | }, | 118 | }, |
119 | }; | 119 | }; |
120 | 120 | ||
121 | static void __init acpi_request_region (struct acpi_generic_address *addr, | ||
122 | unsigned int length, char *desc) | ||
123 | { | ||
124 | if (!addr->address || !length) | ||
125 | return; | ||
126 | |||
127 | if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_IO) | ||
128 | request_region(addr->address, length, desc); | ||
129 | else if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) | ||
130 | request_mem_region(addr->address, length, desc); | ||
131 | } | ||
132 | |||
133 | static void __init acpi_reserve_resources(void) | ||
134 | { | ||
135 | acpi_request_region(&acpi_gbl_FADT->xpm1a_evt_blk, | ||
136 | acpi_gbl_FADT->pm1_evt_len, "ACPI PM1a_EVT_BLK"); | ||
137 | |||
138 | acpi_request_region(&acpi_gbl_FADT->xpm1b_evt_blk, | ||
139 | acpi_gbl_FADT->pm1_evt_len, "ACPI PM1b_EVT_BLK"); | ||
140 | |||
141 | acpi_request_region(&acpi_gbl_FADT->xpm1a_cnt_blk, | ||
142 | acpi_gbl_FADT->pm1_cnt_len, "ACPI PM1a_CNT_BLK"); | ||
143 | |||
144 | acpi_request_region(&acpi_gbl_FADT->xpm1b_cnt_blk, | ||
145 | acpi_gbl_FADT->pm1_cnt_len, "ACPI PM1b_CNT_BLK"); | ||
146 | |||
147 | if (acpi_gbl_FADT->pm_tm_len == 4) | ||
148 | acpi_request_region(&acpi_gbl_FADT->xpm_tmr_blk, 4, "ACPI PM_TMR"); | ||
149 | |||
150 | acpi_request_region(&acpi_gbl_FADT->xpm2_cnt_blk, | ||
151 | acpi_gbl_FADT->pm2_cnt_len, "ACPI PM2_CNT_BLK"); | ||
152 | |||
153 | /* Length of GPE blocks must be a non-negative multiple of 2 */ | ||
154 | |||
155 | if (!(acpi_gbl_FADT->gpe0_blk_len & 0x1)) | ||
156 | acpi_request_region(&acpi_gbl_FADT->xgpe0_blk, | ||
157 | acpi_gbl_FADT->gpe0_blk_len, "ACPI GPE0_BLK"); | ||
158 | |||
159 | if (!(acpi_gbl_FADT->gpe1_blk_len & 0x1)) | ||
160 | acpi_request_region(&acpi_gbl_FADT->xgpe1_blk, | ||
161 | acpi_gbl_FADT->gpe1_blk_len, "ACPI GPE1_BLK"); | ||
162 | } | ||
163 | |||
164 | static int __init acpi_motherboard_init(void) | 121 | static int __init acpi_motherboard_init(void) |
165 | { | 122 | { |
166 | acpi_bus_register_driver(&acpi_motherboard_driver); | 123 | acpi_bus_register_driver(&acpi_motherboard_driver); |
167 | /* | ||
168 | * Guarantee motherboard IO reservation first | ||
169 | * This module must run after scan.c | ||
170 | */ | ||
171 | if (!acpi_disabled) | ||
172 | acpi_reserve_resources(); | ||
173 | return 0; | 124 | return 0; |
174 | } | 125 | } |
175 | 126 | ||
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 02b30ae6a68e..0acd0e716ba4 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -75,6 +75,54 @@ static acpi_osd_handler acpi_irq_handler; | |||
75 | static void *acpi_irq_context; | 75 | static void *acpi_irq_context; |
76 | static struct workqueue_struct *kacpid_wq; | 76 | static struct workqueue_struct *kacpid_wq; |
77 | 77 | ||
78 | static void __init acpi_request_region (struct acpi_generic_address *addr, | ||
79 | unsigned int length, char *desc) | ||
80 | { | ||
81 | struct resource *res; | ||
82 | |||
83 | if (!addr->address || !length) | ||
84 | return; | ||
85 | |||
86 | if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_IO) | ||
87 | res = request_region(addr->address, length, desc); | ||
88 | else if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) | ||
89 | res = request_mem_region(addr->address, length, desc); | ||
90 | } | ||
91 | |||
92 | static int __init acpi_reserve_resources(void) | ||
93 | { | ||
94 | acpi_request_region(&acpi_fadt.xpm1a_evt_blk, acpi_fadt.pm1_evt_len, | ||
95 | "ACPI PM1a_EVT_BLK"); | ||
96 | |||
97 | acpi_request_region(&acpi_fadt.xpm1b_evt_blk, acpi_fadt.pm1_evt_len, | ||
98 | "ACPI PM1b_EVT_BLK"); | ||
99 | |||
100 | acpi_request_region(&acpi_fadt.xpm1a_cnt_blk, acpi_fadt.pm1_cnt_len, | ||
101 | "ACPI PM1a_CNT_BLK"); | ||
102 | |||
103 | acpi_request_region(&acpi_fadt.xpm1b_cnt_blk, acpi_fadt.pm1_cnt_len, | ||
104 | "ACPI PM1b_CNT_BLK"); | ||
105 | |||
106 | if (acpi_fadt.pm_tm_len == 4) | ||
107 | acpi_request_region(&acpi_fadt.xpm_tmr_blk, 4, "ACPI PM_TMR"); | ||
108 | |||
109 | acpi_request_region(&acpi_fadt.xpm2_cnt_blk, acpi_fadt.pm2_cnt_len, | ||
110 | "ACPI PM2_CNT_BLK"); | ||
111 | |||
112 | /* Length of GPE blocks must be a non-negative multiple of 2 */ | ||
113 | |||
114 | if (!(acpi_fadt.gpe0_blk_len & 0x1)) | ||
115 | acpi_request_region(&acpi_fadt.xgpe0_blk, | ||
116 | acpi_fadt.gpe0_blk_len, "ACPI GPE0_BLK"); | ||
117 | |||
118 | if (!(acpi_fadt.gpe1_blk_len & 0x1)) | ||
119 | acpi_request_region(&acpi_fadt.xgpe1_blk, | ||
120 | acpi_fadt.gpe1_blk_len, "ACPI GPE1_BLK"); | ||
121 | |||
122 | return 0; | ||
123 | } | ||
124 | device_initcall(acpi_reserve_resources); | ||
125 | |||
78 | acpi_status acpi_os_initialize(void) | 126 | acpi_status acpi_os_initialize(void) |
79 | { | 127 | { |
80 | return AE_OK; | 128 | return AE_OK; |