Skip to content

Commit b04c58b

Browse files
committed
Merge branch 'acpi-enumeration'
* 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
2 parents 864e055 + 4845934 commit b04c58b

12 files changed

Lines changed: 556 additions & 108 deletions

File tree

‎drivers/acpi/Makefile‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ acpi-y += processor_core.o
3939
acpi-y += ec.o
4040
acpi-$(CONFIG_ACPI_DOCK) += dock.o
4141
acpi-y += pci_root.o pci_link.o pci_irq.o
42-
acpi-$(CONFIG_X86_INTEL_LPSS) += acpi_lpss.o
42+
acpi-y += acpi_lpss.o
4343
acpi-y += acpi_platform.o
44+
acpi-y += acpi_pnp.o
4445
acpi-y += power.o
4546
acpi-y += event.o
4647
acpi-y += sysfs.o
@@ -63,9 +64,9 @@ obj-$(CONFIG_ACPI_FAN) += fan.o
6364
obj-$(CONFIG_ACPI_VIDEO) += video.o
6465
obj-$(CONFIG_ACPI_PCI_SLOT) += pci_slot.o
6566
obj-$(CONFIG_ACPI_PROCESSOR) += processor.o
66-
obj-$(CONFIG_ACPI_CONTAINER) += container.o
67+
obj-y += container.o
6768
obj-$(CONFIG_ACPI_THERMAL) += thermal.o
68-
obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o
69+
obj-y += acpi_memhotplug.o
6970
obj-$(CONFIG_ACPI_BATTERY) += battery.o
7071
obj-$(CONFIG_ACPI_SBS) += sbshc.o
7172
obj-$(CONFIG_ACPI_SBS) += sbs.o

‎drivers/acpi/acpi_cmos_rtc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static int acpi_install_cmos_rtc_space_handler(struct acpi_device *adev,
6868
return -ENODEV;
6969
}
7070

71-
return 0;
71+
return 1;
7272
}
7373

7474
static void acpi_remove_cmos_rtc_space_handler(struct acpi_device *adev)

‎drivers/acpi/acpi_lpss.c‎

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525

2626
ACPI_MODULE_NAME("acpi_lpss");
2727

28+
#ifdef CONFIG_X86_INTEL_LPSS
29+
30+
#define LPSS_ADDR(desc) ((unsigned long)&desc)
31+
2832
#define LPSS_CLK_SIZE 0x04
2933
#define LPSS_LTR_SIZE 0x18
3034

@@ -169,40 +173,48 @@ static struct lpss_device_desc byt_i2c_dev_desc = {
169173
.shared_clock = &i2c_clock,
170174
};
171175

176+
#else
177+
178+
#define LPSS_ADDR(desc) (0UL)
179+
180+
#endif /* CONFIG_X86_INTEL_LPSS */
181+
172182
static const struct acpi_device_id acpi_lpss_device_ids[] = {
173183
/* Generic LPSS devices */
174-
{ "INTL9C60", (unsigned long)&lpss_dma_desc },
184+
{ "INTL9C60", LPSS_ADDR(lpss_dma_desc) },
175185

176186
/* Lynxpoint LPSS devices */
177-
{ "INT33C0", (unsigned long)&lpt_dev_desc },
178-
{ "INT33C1", (unsigned long)&lpt_dev_desc },
179-
{ "INT33C2", (unsigned long)&lpt_i2c_dev_desc },
180-
{ "INT33C3", (unsigned long)&lpt_i2c_dev_desc },
181-
{ "INT33C4", (unsigned long)&lpt_uart_dev_desc },
182-
{ "INT33C5", (unsigned long)&lpt_uart_dev_desc },
183-
{ "INT33C6", (unsigned long)&lpt_sdio_dev_desc },
187+
{ "INT33C0", LPSS_ADDR(lpt_dev_desc) },
188+
{ "INT33C1", LPSS_ADDR(lpt_dev_desc) },
189+
{ "INT33C2", LPSS_ADDR(lpt_i2c_dev_desc) },
190+
{ "INT33C3", LPSS_ADDR(lpt_i2c_dev_desc) },
191+
{ "INT33C4", LPSS_ADDR(lpt_uart_dev_desc) },
192+
{ "INT33C5", LPSS_ADDR(lpt_uart_dev_desc) },
193+
{ "INT33C6", LPSS_ADDR(lpt_sdio_dev_desc) },
184194
{ "INT33C7", },
185195

186196
/* BayTrail LPSS devices */
187-
{ "80860F09", (unsigned long)&byt_pwm_dev_desc },
188-
{ "80860F0A", (unsigned long)&byt_uart_dev_desc },
189-
{ "80860F0E", (unsigned long)&byt_spi_dev_desc },
190-
{ "80860F14", (unsigned long)&byt_sdio_dev_desc },
191-
{ "80860F41", (unsigned long)&byt_i2c_dev_desc },
197+
{ "80860F09", LPSS_ADDR(byt_pwm_dev_desc) },
198+
{ "80860F0A", LPSS_ADDR(byt_uart_dev_desc) },
199+
{ "80860F0E", LPSS_ADDR(byt_spi_dev_desc) },
200+
{ "80860F14", LPSS_ADDR(byt_sdio_dev_desc) },
201+
{ "80860F41", LPSS_ADDR(byt_i2c_dev_desc) },
192202
{ "INT33B2", },
193203

194-
{ "INT3430", (unsigned long)&lpt_dev_desc },
195-
{ "INT3431", (unsigned long)&lpt_dev_desc },
196-
{ "INT3432", (unsigned long)&lpt_i2c_dev_desc },
197-
{ "INT3433", (unsigned long)&lpt_i2c_dev_desc },
198-
{ "INT3434", (unsigned long)&lpt_uart_dev_desc },
199-
{ "INT3435", (unsigned long)&lpt_uart_dev_desc },
200-
{ "INT3436", (unsigned long)&lpt_sdio_dev_desc },
204+
{ "INT3430", LPSS_ADDR(lpt_dev_desc) },
205+
{ "INT3431", LPSS_ADDR(lpt_dev_desc) },
206+
{ "INT3432", LPSS_ADDR(lpt_i2c_dev_desc) },
207+
{ "INT3433", LPSS_ADDR(lpt_i2c_dev_desc) },
208+
{ "INT3434", LPSS_ADDR(lpt_uart_dev_desc) },
209+
{ "INT3435", LPSS_ADDR(lpt_uart_dev_desc) },
210+
{ "INT3436", LPSS_ADDR(lpt_sdio_dev_desc) },
201211
{ "INT3437", },
202212

203213
{ }
204214
};
205215

216+
#ifdef CONFIG_X86_INTEL_LPSS
217+
206218
static int is_memory(struct acpi_resource *res, void *not_used)
207219
{
208220
struct resource r;
@@ -695,3 +707,16 @@ void __init acpi_lpss_init(void)
695707
acpi_scan_add_handler(&lpss_handler);
696708
}
697709
}
710+
711+
#else
712+
713+
static struct acpi_scan_handler lpss_handler = {
714+
.ids = acpi_lpss_device_ids,
715+
};
716+
717+
void __init acpi_lpss_init(void)
718+
{
719+
acpi_scan_add_handler(&lpss_handler);
720+
}
721+
722+
#endif /* CONFIG_X86_INTEL_LPSS */

‎drivers/acpi/acpi_memhotplug.c‎

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@
4444

4545
ACPI_MODULE_NAME("acpi_memhotplug");
4646

47+
static const struct acpi_device_id memory_device_ids[] = {
48+
{ACPI_MEMORY_DEVICE_HID, 0},
49+
{"", 0},
50+
};
51+
52+
#ifdef CONFIG_ACPI_HOTPLUG_MEMORY
53+
4754
/* Memory Device States */
4855
#define MEMORY_INVALID_STATE 0
4956
#define MEMORY_POWER_ON_STATE 1
@@ -53,11 +60,6 @@ static int acpi_memory_device_add(struct acpi_device *device,
5360
const struct acpi_device_id *not_used);
5461
static void acpi_memory_device_remove(struct acpi_device *device);
5562

56-
static const struct acpi_device_id memory_device_ids[] = {
57-
{ACPI_MEMORY_DEVICE_HID, 0},
58-
{"", 0},
59-
};
60-
6163
static struct acpi_scan_handler memory_device_handler = {
6264
.ids = memory_device_ids,
6365
.attach = acpi_memory_device_add,
@@ -364,9 +366,11 @@ static bool __initdata acpi_no_memhotplug;
364366

365367
void __init acpi_memory_hotplug_init(void)
366368
{
367-
if (acpi_no_memhotplug)
369+
if (acpi_no_memhotplug) {
370+
memory_device_handler.attach = NULL;
371+
acpi_scan_add_handler(&memory_device_handler);
368372
return;
369-
373+
}
370374
acpi_scan_add_handler_with_hotplug(&memory_device_handler, "memory");
371375
}
372376

@@ -376,3 +380,16 @@ static int __init disable_acpi_memory_hotplug(char *str)
376380
return 1;
377381
}
378382
__setup("acpi_no_memhotplug", disable_acpi_memory_hotplug);
383+
384+
#else
385+
386+
static struct acpi_scan_handler memory_device_handler = {
387+
.ids = memory_device_ids,
388+
};
389+
390+
void __init acpi_memory_hotplug_init(void)
391+
{
392+
acpi_scan_add_handler(&memory_device_handler);
393+
}
394+
395+
#endif /* CONFIG_ACPI_HOTPLUG_MEMORY */

‎drivers/acpi/acpi_platform.c‎

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,11 @@
2222

2323
ACPI_MODULE_NAME("platform");
2424

25-
/*
26-
* The following ACPI IDs are known to be suitable for representing as
27-
* platform devices.
28-
*/
29-
static const struct acpi_device_id acpi_platform_device_ids[] = {
30-
31-
{ "PNP0D40" },
32-
{ "VPC2004" },
33-
{ "BCM4752" },
34-
{ "LNV4752" },
35-
{ "BCM2E1A" },
36-
{ "BCM2E39" },
37-
{ "BCM2E3D" },
38-
39-
/* Intel Smart Sound Technology */
40-
{ "INT33C8" },
41-
{ "80860F28" },
42-
43-
{ }
25+
static const struct acpi_device_id forbidden_id_list[] = {
26+
{"PNP0000", 0}, /* PIC */
27+
{"PNP0100", 0}, /* Timer */
28+
{"PNP0200", 0}, /* AT DMA Controller */
29+
{"", 0},
4430
};
4531

4632
/**
@@ -67,6 +53,9 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev)
6753
if (adev->physical_node_count)
6854
return NULL;
6955

56+
if (!acpi_match_device_ids(adev, forbidden_id_list))
57+
return ERR_PTR(-EINVAL);
58+
7059
INIT_LIST_HEAD(&resource_list);
7160
count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL);
7261
if (count < 0) {
@@ -124,20 +113,3 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev)
124113
kfree(resources);
125114
return pdev;
126115
}
127-
128-
static int acpi_platform_attach(struct acpi_device *adev,
129-
const struct acpi_device_id *id)
130-
{
131-
acpi_create_platform_device(adev);
132-
return 1;
133-
}
134-
135-
static struct acpi_scan_handler platform_handler = {
136-
.ids = acpi_platform_device_ids,
137-
.attach = acpi_platform_attach,
138-
};
139-
140-
void __init acpi_platform_init(void)
141-
{
142-
acpi_scan_add_handler(&platform_handler);
143-
}

0 commit comments

Comments
 (0)