This source file includes following definitions.
- ACPI_MODULE_NAME
- acpi_ut_remove_address_range
- acpi_ut_check_address_range
- acpi_ut_delete_address_lists
1
2
3
4
5
6
7
8
9
10 #include <acpi/acpi.h>
11 #include "accommon.h"
12 #include "acnamesp.h"
13
14 #define _COMPONENT ACPI_UTILITIES
15 ACPI_MODULE_NAME("utaddress")
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 acpi_status
41 acpi_ut_add_address_range(acpi_adr_space_type space_id,
42 acpi_physical_address address,
43 u32 length, struct acpi_namespace_node *region_node)
44 {
45 struct acpi_address_range *range_info;
46
47 ACPI_FUNCTION_TRACE(ut_add_address_range);
48
49 if ((space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
50 (space_id != ACPI_ADR_SPACE_SYSTEM_IO)) {
51 return_ACPI_STATUS(AE_OK);
52 }
53
54
55
56 range_info = ACPI_ALLOCATE(sizeof(struct acpi_address_range));
57 if (!range_info) {
58 return_ACPI_STATUS(AE_NO_MEMORY);
59 }
60
61 range_info->start_address = address;
62 range_info->end_address = (address + length - 1);
63 range_info->region_node = region_node;
64
65 range_info->next = acpi_gbl_address_range_list[space_id];
66 acpi_gbl_address_range_list[space_id] = range_info;
67
68 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
69 "\nAdded [%4.4s] address range: 0x%8.8X%8.8X-0x%8.8X%8.8X\n",
70 acpi_ut_get_node_name(range_info->region_node),
71 ACPI_FORMAT_UINT64(address),
72 ACPI_FORMAT_UINT64(range_info->end_address)));
73
74 return_ACPI_STATUS(AE_OK);
75 }
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94 void
95 acpi_ut_remove_address_range(acpi_adr_space_type space_id,
96 struct acpi_namespace_node *region_node)
97 {
98 struct acpi_address_range *range_info;
99 struct acpi_address_range *prev;
100
101 ACPI_FUNCTION_TRACE(ut_remove_address_range);
102
103 if ((space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
104 (space_id != ACPI_ADR_SPACE_SYSTEM_IO)) {
105 return_VOID;
106 }
107
108
109
110 range_info = prev = acpi_gbl_address_range_list[space_id];
111 while (range_info) {
112 if (range_info->region_node == region_node) {
113 if (range_info == prev) {
114 acpi_gbl_address_range_list[space_id] =
115 range_info->next;
116 } else {
117 prev->next = range_info->next;
118 }
119
120 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
121 "\nRemoved [%4.4s] address range: 0x%8.8X%8.8X-0x%8.8X%8.8X\n",
122 acpi_ut_get_node_name(range_info->
123 region_node),
124 ACPI_FORMAT_UINT64(range_info->
125 start_address),
126 ACPI_FORMAT_UINT64(range_info->
127 end_address)));
128
129 ACPI_FREE(range_info);
130 return_VOID;
131 }
132
133 prev = range_info;
134 range_info = range_info->next;
135 }
136
137 return_VOID;
138 }
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160 u32
161 acpi_ut_check_address_range(acpi_adr_space_type space_id,
162 acpi_physical_address address, u32 length, u8 warn)
163 {
164 struct acpi_address_range *range_info;
165 acpi_physical_address end_address;
166 char *pathname;
167 u32 overlap_count = 0;
168
169 ACPI_FUNCTION_TRACE(ut_check_address_range);
170
171 if ((space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
172 (space_id != ACPI_ADR_SPACE_SYSTEM_IO)) {
173 return_UINT32(0);
174 }
175
176 range_info = acpi_gbl_address_range_list[space_id];
177 end_address = address + length - 1;
178
179
180
181 while (range_info) {
182
183
184
185
186
187
188
189
190
191
192 if ((address <= range_info->end_address) &&
193 (end_address >= range_info->start_address)) {
194
195
196
197 overlap_count++;
198 if (warn) {
199 pathname =
200 acpi_ns_get_normalized_pathname(range_info->
201 region_node,
202 TRUE);
203
204 ACPI_WARNING((AE_INFO,
205 "%s range 0x%8.8X%8.8X-0x%8.8X%8.8X conflicts with OpRegion 0x%8.8X%8.8X-0x%8.8X%8.8X (%s)",
206 acpi_ut_get_region_name(space_id),
207 ACPI_FORMAT_UINT64(address),
208 ACPI_FORMAT_UINT64(end_address),
209 ACPI_FORMAT_UINT64(range_info->
210 start_address),
211 ACPI_FORMAT_UINT64(range_info->
212 end_address),
213 pathname));
214 ACPI_FREE(pathname);
215 }
216 }
217
218 range_info = range_info->next;
219 }
220
221 return_UINT32(overlap_count);
222 }
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237 void acpi_ut_delete_address_lists(void)
238 {
239 struct acpi_address_range *next;
240 struct acpi_address_range *range_info;
241 int i;
242
243
244
245 for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) {
246 next = acpi_gbl_address_range_list[i];
247
248 while (next) {
249 range_info = next;
250 next = range_info->next;
251 ACPI_FREE(range_info);
252 }
253
254 acpi_gbl_address_range_list[i] = NULL;
255 }
256 }