Skip to content

Commit

Permalink
Merge branch 'acpi-enumeration'
Browse files Browse the repository at this point in the history
* acpi-enumeration:
  ACPI / scan: use platform bus type by default for _HID enumeration
  ACPI / scan: always register ACPI LPSS scan handler
  ACPI / scan: always register memory hotplug scan handler
  ACPI / scan: always register container scan handler
  ACPI / scan: Change the meaning of missing .attach() in scan handlers
  ACPI / scan: introduce platform_id device PNP type flag
  ACPI / scan: drop unsupported serial IDs from PNP ACPI scan handler ID list
  ACPI / scan: drop IDs that do not comply with the ACPI PNP ID rule
  ACPI / PNP: use device ID list for PNPACPI device enumeration
  ACPI / scan: .match() callback for ACPI scan handlers
  • Loading branch information
Rafael J. Wysocki committed Jun 3, 2014
2 parents 864e055 + 4845934 commit b04c58b
Show file tree
Hide file tree
Showing 12 changed files with 556 additions and 108 deletions.
7 changes: 4 additions & 3 deletions drivers/acpi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ acpi-y += processor_core.o
acpi-y += ec.o
acpi-$(CONFIG_ACPI_DOCK) += dock.o
acpi-y += pci_root.o pci_link.o pci_irq.o
acpi-$(CONFIG_X86_INTEL_LPSS) += acpi_lpss.o
acpi-y += acpi_lpss.o
acpi-y += acpi_platform.o
acpi-y += acpi_pnp.o
acpi-y += power.o
acpi-y += event.o
acpi-y += sysfs.o
Expand All @@ -63,9 +64,9 @@ obj-$(CONFIG_ACPI_FAN) += fan.o
obj-$(CONFIG_ACPI_VIDEO) += video.o
obj-$(CONFIG_ACPI_PCI_SLOT) += pci_slot.o
obj-$(CONFIG_ACPI_PROCESSOR) += processor.o
obj-$(CONFIG_ACPI_CONTAINER) += container.o
obj-y += container.o
obj-$(CONFIG_ACPI_THERMAL) += thermal.o
obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o
obj-y += acpi_memhotplug.o
obj-$(CONFIG_ACPI_BATTERY) += battery.o
obj-$(CONFIG_ACPI_SBS) += sbshc.o
obj-$(CONFIG_ACPI_SBS) += sbs.o
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpi_cmos_rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static int acpi_install_cmos_rtc_space_handler(struct acpi_device *adev,
return -ENODEV;
}

return 0;
return 1;
}

static void acpi_remove_cmos_rtc_space_handler(struct acpi_device *adev)
Expand Down
65 changes: 45 additions & 20 deletions drivers/acpi/acpi_lpss.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@

ACPI_MODULE_NAME("acpi_lpss");

#ifdef CONFIG_X86_INTEL_LPSS

#define LPSS_ADDR(desc) ((unsigned long)&desc)

#define LPSS_CLK_SIZE 0x04
#define LPSS_LTR_SIZE 0x18

Expand Down Expand Up @@ -169,40 +173,48 @@ static struct lpss_device_desc byt_i2c_dev_desc = {
.shared_clock = &i2c_clock,
};

#else

#define LPSS_ADDR(desc) (0UL)

#endif /* CONFIG_X86_INTEL_LPSS */

static const struct acpi_device_id acpi_lpss_device_ids[] = {
/* Generic LPSS devices */
{ "INTL9C60", (unsigned long)&lpss_dma_desc },
{ "INTL9C60", LPSS_ADDR(lpss_dma_desc) },

/* Lynxpoint LPSS devices */
{ "INT33C0", (unsigned long)&lpt_dev_desc },
{ "INT33C1", (unsigned long)&lpt_dev_desc },
{ "INT33C2", (unsigned long)&lpt_i2c_dev_desc },
{ "INT33C3", (unsigned long)&lpt_i2c_dev_desc },
{ "INT33C4", (unsigned long)&lpt_uart_dev_desc },
{ "INT33C5", (unsigned long)&lpt_uart_dev_desc },
{ "INT33C6", (unsigned long)&lpt_sdio_dev_desc },
{ "INT33C0", LPSS_ADDR(lpt_dev_desc) },
{ "INT33C1", LPSS_ADDR(lpt_dev_desc) },
{ "INT33C2", LPSS_ADDR(lpt_i2c_dev_desc) },
{ "INT33C3", LPSS_ADDR(lpt_i2c_dev_desc) },
{ "INT33C4", LPSS_ADDR(lpt_uart_dev_desc) },
{ "INT33C5", LPSS_ADDR(lpt_uart_dev_desc) },
{ "INT33C6", LPSS_ADDR(lpt_sdio_dev_desc) },
{ "INT33C7", },

/* BayTrail LPSS devices */
{ "80860F09", (unsigned long)&byt_pwm_dev_desc },
{ "80860F0A", (unsigned long)&byt_uart_dev_desc },
{ "80860F0E", (unsigned long)&byt_spi_dev_desc },
{ "80860F14", (unsigned long)&byt_sdio_dev_desc },
{ "80860F41", (unsigned long)&byt_i2c_dev_desc },
{ "80860F09", LPSS_ADDR(byt_pwm_dev_desc) },
{ "80860F0A", LPSS_ADDR(byt_uart_dev_desc) },
{ "80860F0E", LPSS_ADDR(byt_spi_dev_desc) },
{ "80860F14", LPSS_ADDR(byt_sdio_dev_desc) },
{ "80860F41", LPSS_ADDR(byt_i2c_dev_desc) },
{ "INT33B2", },

{ "INT3430", (unsigned long)&lpt_dev_desc },
{ "INT3431", (unsigned long)&lpt_dev_desc },
{ "INT3432", (unsigned long)&lpt_i2c_dev_desc },
{ "INT3433", (unsigned long)&lpt_i2c_dev_desc },
{ "INT3434", (unsigned long)&lpt_uart_dev_desc },
{ "INT3435", (unsigned long)&lpt_uart_dev_desc },
{ "INT3436", (unsigned long)&lpt_sdio_dev_desc },
{ "INT3430", LPSS_ADDR(lpt_dev_desc) },
{ "INT3431", LPSS_ADDR(lpt_dev_desc) },
{ "INT3432", LPSS_ADDR(lpt_i2c_dev_desc) },
{ "INT3433", LPSS_ADDR(lpt_i2c_dev_desc) },
{ "INT3434", LPSS_ADDR(lpt_uart_dev_desc) },
{ "INT3435", LPSS_ADDR(lpt_uart_dev_desc) },
{ "INT3436", LPSS_ADDR(lpt_sdio_dev_desc) },
{ "INT3437", },

{ }
};

#ifdef CONFIG_X86_INTEL_LPSS

static int is_memory(struct acpi_resource *res, void *not_used)
{
struct resource r;
Expand Down Expand Up @@ -695,3 +707,16 @@ void __init acpi_lpss_init(void)
acpi_scan_add_handler(&lpss_handler);
}
}

#else

static struct acpi_scan_handler lpss_handler = {
.ids = acpi_lpss_device_ids,
};

void __init acpi_lpss_init(void)
{
acpi_scan_add_handler(&lpss_handler);
}

#endif /* CONFIG_X86_INTEL_LPSS */
31 changes: 24 additions & 7 deletions drivers/acpi/acpi_memhotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@

ACPI_MODULE_NAME("acpi_memhotplug");

static const struct acpi_device_id memory_device_ids[] = {
{ACPI_MEMORY_DEVICE_HID, 0},
{"", 0},
};

#ifdef CONFIG_ACPI_HOTPLUG_MEMORY

/* Memory Device States */
#define MEMORY_INVALID_STATE 0
#define MEMORY_POWER_ON_STATE 1
Expand All @@ -53,11 +60,6 @@ static int acpi_memory_device_add(struct acpi_device *device,
const struct acpi_device_id *not_used);
static void acpi_memory_device_remove(struct acpi_device *device);

static const struct acpi_device_id memory_device_ids[] = {
{ACPI_MEMORY_DEVICE_HID, 0},
{"", 0},
};

static struct acpi_scan_handler memory_device_handler = {
.ids = memory_device_ids,
.attach = acpi_memory_device_add,
Expand Down Expand Up @@ -364,9 +366,11 @@ static bool __initdata acpi_no_memhotplug;

void __init acpi_memory_hotplug_init(void)
{
if (acpi_no_memhotplug)
if (acpi_no_memhotplug) {
memory_device_handler.attach = NULL;
acpi_scan_add_handler(&memory_device_handler);
return;

}
acpi_scan_add_handler_with_hotplug(&memory_device_handler, "memory");
}

Expand All @@ -376,3 +380,16 @@ static int __init disable_acpi_memory_hotplug(char *str)
return 1;
}
__setup("acpi_no_memhotplug", disable_acpi_memory_hotplug);

#else

static struct acpi_scan_handler memory_device_handler = {
.ids = memory_device_ids,
};

void __init acpi_memory_hotplug_init(void)
{
acpi_scan_add_handler(&memory_device_handler);
}

#endif /* CONFIG_ACPI_HOTPLUG_MEMORY */
44 changes: 8 additions & 36 deletions drivers/acpi/acpi_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,11 @@

ACPI_MODULE_NAME("platform");

/*
* The following ACPI IDs are known to be suitable for representing as
* platform devices.
*/
static const struct acpi_device_id acpi_platform_device_ids[] = {

{ "PNP0D40" },
{ "VPC2004" },
{ "BCM4752" },
{ "LNV4752" },
{ "BCM2E1A" },
{ "BCM2E39" },
{ "BCM2E3D" },

/* Intel Smart Sound Technology */
{ "INT33C8" },
{ "80860F28" },

{ }
static const struct acpi_device_id forbidden_id_list[] = {
{"PNP0000", 0}, /* PIC */
{"PNP0100", 0}, /* Timer */
{"PNP0200", 0}, /* AT DMA Controller */
{"", 0},
};

/**
Expand All @@ -67,6 +53,9 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev)
if (adev->physical_node_count)
return NULL;

if (!acpi_match_device_ids(adev, forbidden_id_list))
return ERR_PTR(-EINVAL);

INIT_LIST_HEAD(&resource_list);
count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL);
if (count < 0) {
Expand Down Expand Up @@ -124,20 +113,3 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev)
kfree(resources);
return pdev;
}

static int acpi_platform_attach(struct acpi_device *adev,
const struct acpi_device_id *id)
{
acpi_create_platform_device(adev);
return 1;
}

static struct acpi_scan_handler platform_handler = {
.ids = acpi_platform_device_ids,
.attach = acpi_platform_attach,
};

void __init acpi_platform_init(void)
{
acpi_scan_add_handler(&platform_handler);
}
Loading

0 comments on commit b04c58b

Please sign in to comment.