devman: create device list

git-svn-id: svn://kolibrios.org@1867 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2011-02-15 17:45:12 +00:00
parent 33ec0c4a0c
commit c0a2886159
8 changed files with 312 additions and 334 deletions

View File

@ -1,7 +1,4 @@
CC = gcc CC = gcc
FASM = e:/fasm/fasm.exe FASM = e:/fasm/fasm.exe

View File

@ -7,6 +7,7 @@
#include "acpi.h" #include "acpi.h"
#include "acpi_bus.h" #include "acpi_bus.h"
#include "dmdev.h"
#define PREFIX "ACPI: " #define PREFIX "ACPI: "
@ -17,8 +18,9 @@
#define ACPI_IS_ROOT_DEVICE(device) (!(device)->parent) #define ACPI_IS_ROOT_DEVICE(device) (!(device)->parent)
static LIST_HEAD(acpi_device_list); LIST_HEAD(acpi_device_list);
static LIST_HEAD(acpi_bus_id_list); LIST_HEAD(acpi_bus_id_list);
LIST_HEAD(dmdev_tree);
struct acpi_device_bus_id struct acpi_device_bus_id
@ -65,6 +67,8 @@ static ACPI_HANDLE pci_root_handle;
#define acpi_remap( addr ) MapIoMem((void*)(addr),4096, 0x01) #define acpi_remap( addr ) MapIoMem((void*)(addr),4096, 0x01)
char* strdup(const char *str);
void print_pci_irqs(); void print_pci_irqs();
@ -79,6 +83,14 @@ enum pic_mode
IO_APIC IO_APIC
}; };
static ACPI_STATUS
resource_to_addr(ACPI_RESOURCE *resource, ACPI_RESOURCE_ADDRESS64 *addr);
static void create_dm_list();
static void print_dm_list();
static void set_pic_mode(enum pic_mode mode) static void set_pic_mode(enum pic_mode mode)
{ {
ACPI_OBJECT arg1; ACPI_OBJECT arg1;
@ -99,17 +111,8 @@ static void set_pic_mode(enum pic_mode mode)
dbgprintf(PREFIX "machine set to %s mode\n", mode ? "APIC" : "PIC"); dbgprintf(PREFIX "machine set to %s mode\n", mode ? "APIC" : "PIC");
} }
void print_device_tree(struct acpi_device *device)
{
struct acpi_device *child;
dbgprintf("%s\n", device->pnp.bus_id);
list_for_each_entry(child, &device->children, node)
{
print_device_tree(child);
};
};
@ -649,115 +652,13 @@ u32_t drvEntry(int action, char *cmdline)
acpi_scan(); acpi_scan();
// print_device_tree(acpi_root);
acpi_init_pci(acpi_root); acpi_init_pci(acpi_root);
print_pci_irqs(); print_pci_irqs();
/* create_dm_list();
ACPI_HANDLE bus_handle;
ACPI_HANDLE pci_root;
status = AcpiGetHandle(0, "\\_SB_", &bus_handle); print_dm_list();
dbgprintf("system bus handle %x\n", bus_handle);
status = AcpiGetHandle(bus_handle, "PCI0", &pci_root);
if (status != AE_OK) {
dbgprintf("AcpiGetHandle failed (%s)\n",
AcpiFormatException(status));
goto err;
}
AcpiWalkNamespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, 100,
get_device_by_hid_callback, NULL, NULL, NULL);
*/
#if 0
AcpiWalkNamespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 4,
get_device_by_hid_callback, NULL, NULL, NULL);
ACPI_OBJECT obj;
ACPI_HANDLE bus_handle;
ACPI_HANDLE pci_root;
status = AcpiGetHandle(0, "\\_SB_", &bus_handle);
dbgprintf("system bus handle %x\n", bus_handle);
status = AcpiGetHandle(bus_handle, "PCI0", &pci_root);
if (status != AE_OK) {
dbgprintf("AcpiGetHandle failed (%s)\n",
AcpiFormatException(status));
goto err;
}
dbgprintf("pci root handle %x\n\n", pci_root);
ACPI_BUFFER prt_buffer;
prt_buffer.Length = ACPI_ALLOCATE_BUFFER;
prt_buffer.Pointer = NULL;
status = AcpiGetIrqRoutingTable(pci_root, &prt_buffer);
if (status != AE_OK) {
dbgprintf("AcpiGetIrqRoutingTable failed (%s)\n",
AcpiFormatException(status));
goto err;
}
prt_walk_table(&prt_buffer);
ACPI_OBJECT arg = { ACPI_TYPE_INTEGER };
ACPI_OBJECT_LIST arg_list = { 1, &arg };
arg.Integer.Value = ACPI_IRQ_MODEL_IOAPIC;
dbgprintf("\nset ioapic mode\n\n");
status = AcpiEvaluateObject(NULL, "\\_PIC", &arg_list, NULL);
if (ACPI_FAILURE(status)) {
dbgprintf("AcpiEvaluateObject failed (%s)\n",
AcpiFormatException(status));
// goto err;
}
status = AcpiGetIrqRoutingTable(pci_root, &prt_buffer);
if (status != AE_OK) {
dbgprintf("AcpiGetIrqRoutingTable failed (%s)\n",
AcpiFormatException(status));
goto err;
}
prt_walk_table(&prt_buffer);
u8_t pin = PciRead8 (0, (31<<3) | 1, 0x3D);
dbgprintf("bus 0 device 31 function 1 pin %d\n", pin-1);
pin = PciRead8 (0, (31<<3) | 2, 0x3D);
dbgprintf("bus 0 device 31 function 2 pin %d\n", pin-1);
pin = PciRead8 (0, (31<<3) | 3, 0x3D);
dbgprintf("bus 0 device 31 function 3 pin %d\n", pin-1);
pin = PciRead8 (0, (31<<3) | 4, 0x3D);
dbgprintf("bus 0 device 31 function 4 pin %d\n", pin-1);
pin = PciRead8 (0, (31<<3) | 5, 0x3D);
dbgprintf("bus 0 device 31 function 5 pin %d\n", pin-1);
pin = PciRead8 (0, (31<<3) | 6, 0x3D);
dbgprintf("bus 0 device 31 function 6 pin %d\n", pin-1);
pin = PciRead8 (0, (31<<3) | 7, 0x3D);
dbgprintf("bus 0 device 31 function 7 pin %d\n", pin-1);
#endif
err: err:
@ -765,203 +666,6 @@ err:
}; };
#if 0
ACPI_STATUS
get_device_by_hid_callback(ACPI_HANDLE obj, u32_t depth, void* context,
void** retval)
{
static u32_t counter = 0;
static char buff[256];
ACPI_STATUS status;
ACPI_BUFFER buffer;
ACPI_DEVICE_INFO *info;
// *retval = NULL;
buffer.Length = 255;
buffer.Pointer = buff;
status = AcpiGetName(obj, ACPI_FULL_PATHNAME, &buffer);
if (status != AE_OK) {
return AE_CTRL_TERMINATE;
}
buff[buffer.Length] = '\0';
dbgprintf("device %d %s ", counter, buff);
status = AcpiGetObjectInfo(obj, &info);
if (ACPI_SUCCESS (status))
{
if (info->Valid & ACPI_VALID_HID)
dbgprintf (" HID: %s", info->HardwareId.String);
};
dbgprintf("\n");
counter++;
return AE_OK;
}
prt_walk_table(ACPI_BUFFER *prt)
{
ACPI_PCI_ROUTING_TABLE *entry;
char *prtptr;
/* First check to see if there is a table to walk. */
if (prt == NULL || prt->Pointer == NULL)
return;
/* Walk the table executing the handler function for each entry. */
prtptr = prt->Pointer;
entry = (ACPI_PCI_ROUTING_TABLE *)prtptr;
while (entry->Length != 0)
{
dbgprintf("adress: %x %x ", (u32_t)(entry->Address>>32),
(u32_t)entry->Address);
dbgprintf("pin: %d index: %d source: %s\n",
entry->Pin,
entry->SourceIndex,
entry->Source);
// handler(entry, arg);
prtptr += entry->Length;
entry = (ACPI_PCI_ROUTING_TABLE *)prtptr;
}
}
static void add_irq(unsigned dev, unsigned pin, u8_t irq)
{
// assert(dev < PCI_MAX_DEVICES && pin < PCI_MAX_PINS);
irqtable[dev * PCI_MAX_PINS + pin] = irq;
}
static ACPI_STATUS get_irq_resource(ACPI_RESOURCE *res, void *context)
{
ACPI_PCI_ROUTING_TABLE *tbl = (ACPI_PCI_ROUTING_TABLE *) context;
if (res->Type == ACPI_RESOURCE_TYPE_IRQ)
{
ACPI_RESOURCE_IRQ *irq;
irq = &res->Data.Irq;
add_irq(tbl->Address >> 16, tbl->Pin,
irq->Interrupts[tbl->SourceIndex]);
} else if (res->Type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ)
{
ACPI_RESOURCE_EXTENDED_IRQ *irq;
add_irq(tbl->Address >> 16, tbl->Pin,
irq->Interrupts[tbl->SourceIndex]);
}
return AE_OK;
}
char buff[4096];
static ACPI_STATUS get_pci_irq_routing(ACPI_HANDLE handle)
{
ACPI_STATUS status;
ACPI_BUFFER abuff;
ACPI_PCI_ROUTING_TABLE *tbl;
abuff.Length = sizeof(buff);
abuff.Pointer = buff;
status = AcpiGetIrqRoutingTable(handle, &abuff);
if (ACPI_FAILURE(status)) {
return AE_OK;
}
for (tbl = (ACPI_PCI_ROUTING_TABLE *)abuff.Pointer; tbl->Length;
tbl = (ACPI_PCI_ROUTING_TABLE *)
((char *)tbl + tbl->Length))
{
ACPI_HANDLE src_handle;
if (*(char*)tbl->Source == '\0') {
add_irq(tbl->Address >> 16, tbl->Pin, tbl->SourceIndex);
continue;
}
status = AcpiGetHandle(handle, tbl->Source, &src_handle);
if (ACPI_FAILURE(status)) {
printf("Failed AcpiGetHandle\n");
continue;
}
status = AcpiWalkResources(src_handle, METHOD_NAME__CRS,
get_irq_resource, tbl);
if (ACPI_FAILURE(status)) {
printf("Failed IRQ resource\n");
continue;
}
}
return AE_OK;
}
static ACPI_STATUS add_pci_root_dev(ACPI_HANDLE handle,
UINT32 level,
void *context,
void **retval)
{
int i;
static unsigned called;
if (++called > 1) {
dbgprintf("ACPI: Warning! Multi rooted PCI is not supported!\n");
return AE_OK;
}
for (i = 0; i < IRQ_TABLE_ENTRIES; i++)
irqtable[i] = -1;
return get_pci_irq_routing(handle);
}
static ACPI_STATUS add_pci_dev(ACPI_HANDLE handle,
UINT32 level,
void *context,
void **retval)
{
/* skip pci root when we get to it again */
if (handle == pci_root_handle)
return AE_OK;
return get_pci_irq_routing(handle);
}
static void scan_devices(void)
{
ACPI_STATUS status;
/* get the root first */
status = AcpiGetDevices("PNP0A03", add_pci_root_dev, NULL, NULL);
if (status != AE_OK) {
dbgprintf("scan_devices failed (%s)\n",
AcpiFormatException(status));
return;
}
// assert(ACPI_SUCCESS(status));
/* get the rest of the devices that implement _PRT */
status = AcpiGetDevices(NULL, add_pci_dev, NULL, NULL);
// assert(ACPI_SUCCESS(status));
}
#endif
char* strdup(const char *str) char* strdup(const char *str)
{ {
size_t len = strlen (str) + 1; size_t len = strlen (str) + 1;
@ -973,3 +677,247 @@ char* strdup(const char *str)
return copy; return copy;
} }
static void dm_add_pci_bus(struct pci_bus *bus)
{
struct pci_bus *tbus;
struct pci_dev *dev;
dmdev_t *dmdev;
dmdev = (dmdev_t*)kzalloc(sizeof(dmdev_t),GFP_KERNEL);
// INIT_LIST_HEAD(&dmdev->list);
// dmdev->type = 1;
// dmdev->acpi_dev = bus->self->acpi_dev;
// dmdev->pci_dev = bus->self;
// list_add_tail(&dmdev->list, &dmdev_tree);
list_for_each_entry(dev, &bus->devices, bus_list)
{
dmdev = (dmdev_t*)kzalloc(sizeof(dmdev_t),GFP_KERNEL);
INIT_LIST_HEAD(&dmdev->list);
dmdev->type = 1;
dmdev->acpi_dev = dev->acpi_dev;
dmdev->pci_dev = dev;
list_add_tail(&dmdev->list, &dmdev_tree);
};
list_for_each_entry(tbus, &bus->children, node)
{
dm_add_pci_bus(tbus);
};
};
static ACPI_STATUS
count_dev_resources(ACPI_RESOURCE *acpi_res, void *data)
{
(*(int*)data)++;
return AE_OK;
}
static void dm_add_acpi(struct acpi_device *device)
{
struct acpi_device *child;
ACPI_DEVICE_INFO *info = NULL;
ACPI_STATUS status;
dmdev_t *dmdev;
uint32_t res_num = 0;
status = AcpiGetObjectInfo(device->handle, &info);
if ( (status == AE_OK) && (info->Valid & ACPI_VALID_HID))
{
if( strcmp(info->HardwareId.String,"PNP0C0F") == 0)
{
kfree(info);
return;
};
};
kfree(info);
if(device->pci_dev == NULL)
{
AcpiWalkResources(device->handle, METHOD_NAME__CRS,
count_dev_resources, &res_num);
if(res_num != 0)
{
dmdev = (dmdev_t*)kzalloc(sizeof(dmdev_t),GFP_KERNEL);
INIT_LIST_HEAD(&dmdev->list);
dmdev->type = 0;
dmdev->acpi_dev = device;
dmdev->pci_dev = NULL;
list_add_tail(&dmdev->list, &dmdev_tree);
};
};
list_for_each_entry(child, &device->children, node)
{
dm_add_acpi(child);
};
};
static void create_dm_list()
{
struct acpi_pci_root *root;
list_for_each_entry(root, &acpi_pci_roots, node)
{
struct pci_bus *pbus, *tbus;
struct pci_dev *dev;
pbus = root->bus;
dm_add_pci_bus(pbus);
};
dm_add_acpi(acpi_root);
};
static void print_pci_resource(struct resource *res)
{
if(res->flags !=0 )
{
if(res->flags & IORESOURCE_IO)
dbgprintf(" IO range ");
else if(res->flags & IORESOURCE_MEM)
dbgprintf(" MMIO range ");
dbgprintf("%x - %x\n", res->start, res->end);
};
};
static ACPI_STATUS
print_acpi_resource(ACPI_RESOURCE *acpi_res, void *data)
{
ACPI_RESOURCE_ADDRESS64 addr;
ACPI_STATUS status;
int i;
switch (acpi_res->Type)
{
case ACPI_RESOURCE_TYPE_IRQ:
{
ACPI_RESOURCE_IRQ *irq_data = (ACPI_RESOURCE_IRQ*)&acpi_res->Data;
dbgprintf(" IRQ %d\n", irq_data->Interrupts[0]);
};
break;
case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
{
ACPI_RESOURCE_EXTENDED_IRQ *irq_data = (ACPI_RESOURCE_EXTENDED_IRQ*)&acpi_res->Data;
dbgprintf(" IRQ %d\n", irq_data->Interrupts[0]);
};
break;
case ACPI_RESOURCE_TYPE_DMA:
{
ACPI_RESOURCE_DMA *dma_data = (ACPI_RESOURCE_DMA*) &acpi_res->Data;
for(i=0; i < dma_data->ChannelCount; i++)
{
dbgprintf(" DMA %s channel %d\n",
dma_data->Type == ACPI_TYPE_A ? "Type A":
dma_data->Type == ACPI_TYPE_B ? "Type B" :
dma_data->Type == ACPI_TYPE_F ? "Type F" : "",
dma_data->Channels[i]);
}
};
break;
case ACPI_RESOURCE_TYPE_IO:
{
ACPI_RESOURCE_IO *io_data = (ACPI_RESOURCE_IO*) &acpi_res->Data;
dbgprintf(" IO range 0%x-0%x\n",io_data->Minimum,
io_data->Minimum+io_data->AddressLength-1);
}
break;
case ACPI_RESOURCE_TYPE_FIXED_IO:
{
ACPI_RESOURCE_FIXED_IO *io_data = (ACPI_RESOURCE_FIXED_IO*) &acpi_res->Data;
dbgprintf(" Fixed IO range 0%x-0%x\n",io_data->Address,
io_data->Address+io_data->AddressLength-1);
};
break;
case ACPI_RESOURCE_TYPE_MEMORY24:
case ACPI_RESOURCE_TYPE_MEMORY32:
case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
{
ACPI_RESOURCE_ADDRESS64 addr64;
resource_to_addr(acpi_res, &addr64);
dbgprintf(" Memory range 0%x-0%x\n",
(uint32_t)addr64.Minimum, (uint32_t)addr64.Maximum);
}
break;
case ACPI_RESOURCE_TYPE_ADDRESS16:
case ACPI_RESOURCE_TYPE_ADDRESS32:
case ACPI_RESOURCE_TYPE_ADDRESS64:
{
ACPI_RESOURCE_ADDRESS64 addr64;
ACPI_STATUS status;
status = AcpiResourceToAddress64(acpi_res, &addr64);
if (ACPI_SUCCESS(status))
{
dbgprintf(" Address range 0%x-0%x\n",
(uint32_t)addr64.Minimum, (uint32_t)addr64.Maximum);
}
};
break;
};
return AE_OK;
};
static void print_dm_list()
{
struct pci_dev *pcidev;
struct acpi_device *acpidev;
dmdev_t *dmdev;
uint32_t i;
dbgprintf("\nDevices:\n");
list_for_each_entry(dmdev, &dmdev_tree, list)
{
switch(dmdev->type)
{
case 0:
if(dmdev->acpi_dev != NULL)
{
acpidev = dmdev->acpi_dev;
dbgprintf("\n%s\n", acpidev->pnp.bus_id);
AcpiWalkResources(acpidev->handle, METHOD_NAME__CRS,
print_acpi_resource, NULL);
};
break;
case 1:
if(dmdev->pci_dev != NULL)
{
pcidev = dmdev->pci_dev;
dbgprintf("\nPCI_%x_%x bus:%d devfn: %x\n",
pcidev->vendor, pcidev->device,
pcidev->busnr, pcidev->devfn);
for(i = 0; i < DEVICE_COUNT_RESOURCE; i++)
print_pci_resource(&pcidev->resource[i]);
if(pcidev->pin)
dbgprintf(" APIC IRQ: %d\n", acpi_get_irq(pcidev));
};
break;
};
};
};

View File

@ -130,6 +130,7 @@ struct acpi_device
struct acpi_device_ops ops; struct acpi_device_ops ops;
// struct acpi_driver *driver; // struct acpi_driver *driver;
void *driver_data; void *driver_data;
struct pci_dev *pci_dev;
// struct device dev; // struct device dev;
struct acpi_bus_ops bus_ops; /* workaround for different code path for hotplug */ struct acpi_bus_ops bus_ops; /* workaround for different code path for hotplug */
// enum acpi_bus_removal_type removal_type; /* indicate for different removal type */ // enum acpi_bus_removal_type removal_type; /* indicate for different removal type */

View File

@ -899,6 +899,7 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)
return NULL; return NULL;
dev->bus = bus; dev->bus = bus;
dev->busnr = bus->number;
dev->devfn = devfn; dev->devfn = devfn;
dev->vendor = l & 0xffff; dev->vendor = l & 0xffff;
dev->device = (l >> 16) & 0xffff; dev->device = (l >> 16) & 0xffff;

View File

@ -47,6 +47,13 @@ static int acpi_pci_bind(struct acpi_device *device)
if (!dev) if (!dev)
return 0; return 0;
device->pci_dev = dev;
dev->acpi_dev = device;
dbgprintf("bind ACPI %s PCI_%x_%x\n", device->pnp.bus_id,
dev->vendor, dev->device);
// pci_acpi_add_pm_notifier(device, dev); // pci_acpi_add_pm_notifier(device, dev);
// if (device->wakeup.flags.run_wake) // if (device->wakeup.flags.run_wake)
// device_set_run_wake(&dev->dev, true); // device_set_run_wake(&dev->dev, true);

View File

@ -222,9 +222,11 @@ int acpi_get_irq(struct pci_dev *dev)
int rc; int rc;
pin = dev->pin; pin = dev->pin;
if (!pin) {
dbgprintf(("No interrupt pin configured for device %s\n", if ( !pin )
pci_name(dev))); {
dbgprintf("No interrupt pin configured for device %s\n",
pci_name(dev));
return 0; return 0;
} }
@ -295,7 +297,6 @@ int acpi_get_irq(struct pci_dev *dev)
(triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
(polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
#endif #endif
return gsi; return gsi;
} }
@ -505,7 +506,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
* forget active IRQ that is not in possible list * forget active IRQ that is not in possible list
*/ */
if (i == link->irq.possible_count) { if (i == link->irq.possible_count) {
printk(KERN_WARNING PREFIX "_CRS %d not found" dbgprintf(KERN_WARNING PREFIX "_CRS %d not found"
" in _PRS\n", link->irq.active); " in _PRS\n", link->irq.active);
link->irq.active = 0; link->irq.active = 0;
} }

View File

@ -154,9 +154,12 @@ static void print_bus_irqs(struct pci_bus *bus)
list_for_each_entry(dev, &bus->devices, bus_list) list_for_each_entry(dev, &bus->devices, bus_list)
{ {
dbgprintf("PCI_%x_%x bus:%d devfn: %x bios irq %d acpi irq %d\n", if(dev->pin)
{
dbgprintf("PCI_%x_%x bus:%d devfn: %x pin %d bios irq: %d acpi irq: %d\n",
dev->vendor, dev->device, dev->busnr, dev->devfn, dev->vendor, dev->device, dev->busnr, dev->devfn,
dev->irq, acpi_get_irq(dev)); dev->pin, dev->irq, acpi_get_irq(dev));
};
}; };
} }
@ -164,7 +167,6 @@ void print_pci_irqs()
{ {
struct acpi_pci_root *root; struct acpi_pci_root *root;
ENTER();
list_for_each_entry(root, &acpi_pci_roots, node) list_for_each_entry(root, &acpi_pci_roots, node)
{ {
struct pci_bus *pbus, *tbus; struct pci_bus *pbus, *tbus;
@ -174,9 +176,10 @@ void print_pci_irqs()
list_for_each_entry(dev, &pbus->devices, bus_list) list_for_each_entry(dev, &pbus->devices, bus_list)
{ {
dbgprintf("PCI_%x_%x bus:%d devfn: %x bios irq %d acpi irq %d\n", if(dev->pin)
dbgprintf("PCI_%x_%x bus:%d devfn: %x pin %d bios irq: %d acpi irq: %d\n",
dev->vendor, dev->device, dev->busnr, dev->devfn, dev->vendor, dev->device, dev->busnr, dev->devfn,
dev->irq, acpi_get_irq(dev)); dev->pin, dev->irq, acpi_get_irq(dev));
}; };
list_for_each_entry(tbus, &pbus->children, node) list_for_each_entry(tbus, &pbus->children, node)
@ -184,7 +187,6 @@ void print_pci_irqs()
print_bus_irqs(tbus); print_bus_irqs(tbus);
}; };
} }
LEAVE();
}; };

View File

@ -24,8 +24,9 @@
extern struct acpi_device *acpi_root; extern struct acpi_device *acpi_root;
static LIST_HEAD(acpi_device_list); extern struct list_head acpi_device_list;
static LIST_HEAD(acpi_bus_id_list); extern struct list_head acpi_bus_id_list;
DEFINE_MUTEX(acpi_device_lock); DEFINE_MUTEX(acpi_device_lock);
@ -584,6 +585,10 @@ static int acpi_add_single_object(struct acpi_device **child,
int result; int result;
struct acpi_device *device; struct acpi_device *device;
ACPI_BUFFER buffer = { ACPI_ALLOCATE_BUFFER, NULL }; ACPI_BUFFER buffer = { ACPI_ALLOCATE_BUFFER, NULL };
ACPI_DEVICE_INFO *info = NULL;
ACPI_DEVICE_ID_LIST *cid_list;
int i;
device = kzalloc(sizeof(struct acpi_device), GFP_KERNEL); device = kzalloc(sizeof(struct acpi_device), GFP_KERNEL);
if (!device) { if (!device) {
@ -632,10 +637,26 @@ static int acpi_add_single_object(struct acpi_device **child,
} }
end: end:
if (!result) {
AcpiGetName(handle, ACPI_FULL_PATHNAME, &buffer); AcpiGetName(handle, ACPI_FULL_PATHNAME, &buffer);
dbgprintf(PREFIX "Adding [%s]\n", (char *)buffer.Pointer); dbgprintf(PREFIX "Adding [%s]", (char *)buffer.Pointer);
kfree(buffer.Pointer); kfree(buffer.Pointer);
AcpiGetObjectInfo(handle, &info);
if (info->Valid & ACPI_VALID_HID)
dbgprintf (" HID: %s", info->HardwareId.String);
if (info->Valid & ACPI_VALID_CID)
{
cid_list = &info->CompatibleIdList;
for (i = 0; i < cid_list->Count; i++)
dbgprintf(" CID: %s\n", cid_list->Ids[i].String);
}
dbgprintf("\n");
kfree(info);
if (!result) {
*child = device; *child = device;
}; };
return result; return result;