aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpi_memhotplug.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2006-03-28 17:04:00 -0500
committerLen Brown <len.brown@intel.com>2006-04-01 22:05:18 -0500
commit459c7266d7a5c1730169258217e25fdd1b7ca854 (patch)
tree79b50e2c6d530539bfe4a468ab290069ddf8ac32 /drivers/acpi/acpi_memhotplug.c
parent683aa4012f53b2ada0f430487e05d37b0d94e90a (diff)
ACPI: fix memory hotplug range length handling
Address space descriptors contain _MIN, _MAX, and _LEN. _MIN and _MAX are the bounds within which the region can be moved (this is clarified in Table 6-38 of the ACPI 3.0 spec). We should use _LEN to determine the size of the region, not _MAX - _MIN + 1. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/acpi_memhotplug.c')
-rw-r--r--drivers/acpi/acpi_memhotplug.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index d882bf87fa96..e0a95ba72371 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -74,7 +74,7 @@ struct acpi_memory_device {
74 unsigned short caching; /* memory cache attribute */ 74 unsigned short caching; /* memory cache attribute */
75 unsigned short write_protect; /* memory read/write attribute */ 75 unsigned short write_protect; /* memory read/write attribute */
76 u64 start_addr; /* Memory Range start physical addr */ 76 u64 start_addr; /* Memory Range start physical addr */
77 u64 end_addr; /* Memory Range end physical addr */ 77 u64 length; /* Memory Range length */
78}; 78};
79 79
80static int 80static int
@@ -97,12 +97,11 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
97 if (ACPI_SUCCESS(status)) { 97 if (ACPI_SUCCESS(status)) {
98 if (address64.resource_type == ACPI_MEMORY_RANGE) { 98 if (address64.resource_type == ACPI_MEMORY_RANGE) {
99 /* Populate the structure */ 99 /* Populate the structure */
100 mem_device->caching = 100 mem_device->caching = address64.info.mem.caching;
101 address64.info.mem.caching;
102 mem_device->write_protect = 101 mem_device->write_protect =
103 address64.info.mem.write_protect; 102 address64.info.mem.write_protect;
104 mem_device->start_addr = address64.minimum; 103 mem_device->start_addr = address64.minimum;
105 mem_device->end_addr = address64.maximum; 104 mem_device->length = address64.address_length;
106 } 105 }
107 } 106 }
108 107
@@ -199,8 +198,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
199 * Tell the VM there is more memory here... 198 * Tell the VM there is more memory here...
200 * Note: Assume that this function returns zero on success 199 * Note: Assume that this function returns zero on success
201 */ 200 */
202 result = add_memory(mem_device->start_addr, 201 result = add_memory(mem_device->start_addr, mem_device->length);
203 (mem_device->end_addr - mem_device->start_addr) + 1);
204 if (result) { 202 if (result) {
205 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n")); 203 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n"));
206 mem_device->state = MEMORY_INVALID_STATE; 204 mem_device->state = MEMORY_INVALID_STATE;
@@ -249,7 +247,7 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
249{ 247{
250 int result; 248 int result;
251 u64 start = mem_device->start_addr; 249 u64 start = mem_device->start_addr;
252 u64 len = mem_device->end_addr - start + 1; 250 u64 len = mem_device->length;
253 251
254 ACPI_FUNCTION_TRACE("acpi_memory_disable_device"); 252 ACPI_FUNCTION_TRACE("acpi_memory_disable_device");
255 253