On Tue, 2006-06-20 at 18:28 -0700, keith mannthey wrote: > Hello again, > I am still without a working acpi memory driver for my hardware (with > extra patches). I posted patches a long while ago but have been off > doing other things for a while. > > 1. The current driver is unable to created the mem_device from the hot- > add event and the hot-add fails with out adding any memory to the > system. I have address_resources attached to the acpi handle but in > acpi_memory_get_device calling the path of > > acpi_bus_get_device > acpi_get_parent > acpi_bus_get_device /*for parent*/ > acpi_bus_add /*to created the memory device */ > > just doesn't create the memory_device and I don't know why. Perhaps > something about the event is off but I have had a fair amount of > communication with the bios writers about this issue and everything > looks ok to us. The odd things is acpi_bus_add doesn't complain it > happily returns success but no memory_device was attached to the > device. > > If you know how to debug this event better please advise. > > If I look at the resources associated with the handle there is > appropriate data to do the hot-add event (memory range data). I simply > insert a function that creates the memory device directly from the > handle and it's data(See attached patch) and the event carries on as > expected. > > The patch applies and work just fine against 2.6.17 and it doesn't break > the current call implementation. > > Any ideas? > > Signed-off-by: Keith Mannthey <kmannth@xxxxxxxxxx> Sorry for the repost to some I had the old acpi list on the cc.
--- linux-2.6.15-rc1-orig/drivers/acpi/acpi_memhotplug.c 2005-11-14 10:56:13.000000000 -0800 +++ linux-2.6.15-rc1/drivers/acpi/acpi_memhotplug.c 2005-11-16 20:06:47.000000000 -0800 @@ -110,6 +110,32 @@ return_VALUE(0); } +static int +acpi_memory_get_current_resource(acpi_handle handle, struct acpi_memory_device **return_device) { + + int result; + struct acpi_memory_device *mem_device; + + ACPI_FUNCTION_TRACE("acpi_memory_get_current_resource"); + + mem_device = kmalloc(sizeof(struct acpi_memory_device), GFP_KERNEL); + if (!mem_device) + return_VALUE(-ENOMEM); + memset(mem_device,0, sizeof(struct acpi_memory_device)); + + mem_device->handle = handle; + result = acpi_memory_get_device_resources(mem_device); + if (result) { + kfree(mem_device); + return_VALUE(result); + } + mem_device->state = MEMORY_POWER_ON_STATE; + *return_device = mem_device; + + return_VALUE(result); +} + + static int acpi_memory_get_device(acpi_handle handle, struct acpi_memory_device **mem_device) @@ -118,6 +144,7 @@ acpi_handle phandle; struct acpi_device *device = NULL; struct acpi_device *pdevice = NULL; + int result; ACPI_FUNCTION_TRACE("acpi_memory_get_device"); @@ -147,14 +174,17 @@ ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n")); return_VALUE(-EINVAL); } - end: *mem_device = acpi_driver_data(device); + if (!(*mem_device)) { - printk(KERN_ERR "\n driver data not found"); - return_VALUE(-ENODEV); + /* Try and get the memory_device from the current handle */ + result = acpi_memory_get_current_resource(handle,mem_device); + if (result) { + printk(KERN_ERR "\nThere is no data for this memory device\n"); + return_VALUE(-EINVAL); + } } - return_VALUE(0); }
Attachment:
SSDT.dsl.gz
Description: GNU Zip compressed data