aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2014-05-29 22:23:01 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-05-30 10:04:35 -0400
commiteec15edbb0e14485998635ea7c62e30911b465f0 (patch)
tree39d0f709737073e2351b4460fd9a1debe9b37d8a
parentaca0a4eb4e325914ddb22a8ed06fcb0222da2a26 (diff)
ACPI / PNP: use device ID list for PNPACPI device enumeration
ACPI can be used to enumerate PNP devices, but the code does not handle this in the right way currently. Namely, if an ACPI device object 1. Has a _CRS method, 2. Has an identification of "three capital characters followed by four hex digits", 3. Is not in the excluded IDs list, it will be enumerated to PNP bus (that is, a PNP device object will be create for it). This means that, actually, the PNP bus type is used as the default bus type for enumerating _HID devices in ACPI. However, more and more _HID devices need to be enumerated to the platform bus instead (that is, platform device objects need to be created for them). As a result, the device ID list in acpi_platform.c is used to enforce creating platform device objects rather than PNP device objects for matching devices. That list has been continuously growing recently, unfortunately, and it is pretty much guaranteed to grow even more in the future. To address that problem it is better to enumerate _HID devices as platform devices by default. To this end, change the way of enumerating PNP devices by adding a PNP ACPI scan handler that will use a device ID list to create PNP devices for the ACPI device objects whose device IDs are present in that list. The initial device ID list in the PNP ACPI scan handler contains all of the pnp_device_id strings from all the existing PNP drivers, so this change should be transparent to the PNP core and all of the PNP drivers. Still, in the future it should be possible to reduce its size by converting PNP drivers that need not be PNP for any technical reasons into platform drivers. Signed-off-by: Zhang Rui <rui.zhang@intel.com> [rjw: Rewrote the changelog, modified the PNP ACPI scan handler code] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
-rw-r--r--drivers/acpi/Makefile1
-rw-r--r--drivers/acpi/acpi_cmos_rtc.c2
-rw-r--r--drivers/acpi/acpi_pnp.c401
-rw-r--r--drivers/acpi/internal.h1
-rw-r--r--drivers/acpi/scan.c1
-rw-r--r--drivers/pnp/pnpacpi/core.c28
-rw-r--r--include/linux/acpi.h2
7 files changed, 411 insertions, 25 deletions
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index bce34afadcd0..144671a2030f 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -41,6 +41,7 @@ acpi-$(CONFIG_ACPI_DOCK) += dock.o
41acpi-y += pci_root.o pci_link.o pci_irq.o 41acpi-y += pci_root.o pci_link.o pci_irq.o
42acpi-$(CONFIG_X86_INTEL_LPSS) += acpi_lpss.o 42acpi-$(CONFIG_X86_INTEL_LPSS) += acpi_lpss.o
43acpi-y += acpi_platform.o 43acpi-y += acpi_platform.o
44acpi-y += acpi_pnp.o
44acpi-y += power.o 45acpi-y += power.o
45acpi-y += event.o 46acpi-y += event.o
46acpi-y += sysfs.o 47acpi-y += sysfs.o
diff --git a/drivers/acpi/acpi_cmos_rtc.c b/drivers/acpi/acpi_cmos_rtc.c
index 961b45d18a5d..2da8660262e5 100644
--- a/drivers/acpi/acpi_cmos_rtc.c
+++ b/drivers/acpi/acpi_cmos_rtc.c
@@ -68,7 +68,7 @@ static int acpi_install_cmos_rtc_space_handler(struct acpi_device *adev,
68 return -ENODEV; 68 return -ENODEV;
69 } 69 }
70 70
71 return 0; 71 return 1;
72} 72}
73 73
74static void acpi_remove_cmos_rtc_space_handler(struct acpi_device *adev) 74static void acpi_remove_cmos_rtc_space_handler(struct acpi_device *adev)
diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c
new file mode 100644
index 000000000000..567e7fc6330c
--- /dev/null
+++ b/drivers/acpi/acpi_pnp.c
@@ -0,0 +1,401 @@
1/*
2 * ACPI support for PNP bus type
3 *
4 * Copyright (C) 2014, Intel Corporation
5 * Authors: Zhang Rui <rui.zhang@intel.com>
6 * Rafael J. Wysocki <rafael.j.wysocki@intel.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/acpi.h>
14#include <linux/module.h>
15
16static const struct acpi_device_id acpi_pnp_device_ids[] = {
17 /* pata_isapnp */
18 {"PNP0600"}, /* Generic ESDI/IDE/ATA compatible hard disk controller */
19 /* floppy */
20 {"PNP0700"},
21 /* ipmi_si */
22 {"IPI0001"},
23 /* tpm_inf_pnp */
24 {"IFX0101"}, /* Infineon TPMs */
25 {"IFX0102"}, /* Infineon TPMs */
26 /*tpm_tis */
27 {"PNP0C31"}, /* TPM */
28 {"ATM1200"}, /* Atmel */
29 {"IFX0102"}, /* Infineon */
30 {"BCM0101"}, /* Broadcom */
31 {"BCM0102"}, /* Broadcom */
32 {"NSC1200"}, /* National */
33 {"ICO0102"}, /* Intel */
34 /* ide */
35 {"PNP0600"}, /* Generic ESDI/IDE/ATA compatible hard disk controller */
36 /* ns558 */
37 {"@P@0001"}, /* ALS 100 */
38 {"@P@0020"}, /* ALS 200 */
39 {"@P@1001"}, /* ALS 100+ */
40 {"@P@2001"}, /* ALS 120 */
41 {"ASB16fd"}, /* AdLib NSC16 */
42 {"AZT3001"}, /* AZT1008 */
43 {"CDC0001"}, /* Opl3-SAx */
44 {"CSC0001"}, /* CS4232 */
45 {"CSC000f"}, /* CS4236 */
46 {"CSC0101"}, /* CS4327 */
47 {"CTL7001"}, /* SB16 */
48 {"CTL7002"}, /* AWE64 */
49 {"CTL7005"}, /* Vibra16 */
50 {"ENS2020"}, /* SoundscapeVIVO */
51 {"ESS0001"}, /* ES1869 */
52 {"ESS0005"}, /* ES1878 */
53 {"ESS6880"}, /* ES688 */
54 {"IBM0012"}, /* CS4232 */
55 {"OPT0001"}, /* OPTi Audio16 */
56 {"YMH0006"}, /* Opl3-SA */
57 {"YMH0022"}, /* Opl3-SAx */
58 {"PNPb02f"}, /* Generic */
59 /* i8042 kbd */
60 {"PNP0300"},
61 {"PNP0301"},
62 {"PNP0302"},
63 {"PNP0303"},
64 {"PNP0304"},
65 {"PNP0305"},
66 {"PNP0306"},
67 {"PNP0309"},
68 {"PNP030a"},
69 {"PNP030b"},
70 {"PNP0320"},
71 {"PNP0343"},
72 {"PNP0344"},
73 {"PNP0345"},
74 {"CPQA0D7"},
75 /* i8042 aux */
76 {"AUI0200"},
77 {"FJC6000"},
78 {"FJC6001"},
79 {"PNP0f03"},
80 {"PNP0f0b"},
81 {"PNP0f0e"},
82 {"PNP0f12"},
83 {"PNP0f13"},
84 {"PNP0f19"},
85 {"PNP0f1c"},
86 {"SYN0801"},
87 /* fcpnp */
88 {"AVM0900"},
89 /* radio-cadet */
90 {"MSM0c24"}, /* ADS Cadet AM/FM Radio Card */
91 /* radio-gemtek */
92 {"ADS7183"}, /* AOpen FX-3D/Pro Radio */
93 /* radio-sf16fmr2 */
94 {"MFRad13"}, /* tuner subdevice of SF16-FMD2 */
95 /* ene_ir */
96 {"ENE0100"},
97 {"ENE0200"},
98 {"ENE0201"},
99 {"ENE0202"},
100 /* fintek-cir */
101 {"FIT0002"}, /* CIR */
102 /* ite-cir */
103 {"ITE8704"}, /* Default model */
104 {"ITE8713"}, /* CIR found in EEEBox 1501U */
105 {"ITE8708"}, /* Bridged IT8512 */
106 {"ITE8709"}, /* SRAM-Bridged IT8512 */
107 /* nuvoton-cir */
108 {"WEC0530"}, /* CIR */
109 {"NTN0530"}, /* CIR for new chip's pnp id */
110 /* Winbond CIR */
111 {"WEC1022"},
112 /* wbsd */
113 {"WEC0517"},
114 {"WEC0518"},
115 /* Winbond CIR */
116 {"TCM5090"}, /* 3Com Etherlink III (TP) */
117 {"TCM5091"}, /* 3Com Etherlink III */
118 {"TCM5094"}, /* 3Com Etherlink III (combo) */
119 {"TCM5095"}, /* 3Com Etherlink III (TPO) */
120 {"TCM5098"}, /* 3Com Etherlink III (TPC) */
121 {"PNP80f7"}, /* 3Com Etherlink III compatible */
122 {"PNP80f8"}, /* 3Com Etherlink III compatible */
123 /* nsc-ircc */
124 {"NSC6001"},
125 {"HWPC224"},
126 {"IBM0071"},
127 /* smsc-ircc2 */
128 {"SMCf010"},
129 /* sb1000 */
130 {"GIC1000"},
131 /* parport_pc */
132 {"PNP0400"}, /* Standard LPT Printer Port */
133 {"PNP0401"}, /* ECP Printer Port */
134 /* apple-gmux */
135 {"APP000B"},
136 /* fujitsu-laptop.c */
137 {"FUJ02bf"},
138 {"FUJ02B1"},
139 {"FUJ02E3"},
140 /* system */
141 {"PNP0c02"}, /* General ID for reserving resources */
142 {"PNP0c01"}, /* memory controller */
143 /* rtc_cmos */
144 {"PNP0b00"},
145 {"PNP0b01"},
146 {"PNP0b02"},
147 /* c6xdigio */
148 {"PNP0400"}, /* Standard LPT Printer Port */
149 {"PNP0401"}, /* ECP Printer Port */
150 /* ni_atmio.c */
151 {"NIC1900"},
152 {"NIC2400"},
153 {"NIC2500"},
154 {"NIC2600"},
155 {"NIC2700"},
156 /* serial */
157 {"AAC000F"}, /* Archtek America Corp. Archtek SmartLink Modem 3334BT Plug & Play */
158 {"ADC0001"}, /* Anchor Datacomm BV. SXPro 144 External Data Fax Modem Plug & Play */
159 {"ADC0002"}, /* SXPro 288 External Data Fax Modem Plug & Play */
160 {"AEI0250"}, /* PROLiNK 1456VH ISA PnP K56flex Fax Modem */
161 {"AEI1240"}, /* Actiontec ISA PNP 56K X2 Fax Modem */
162 {"AKY1021"}, /* Rockwell 56K ACF II Fax+Data+Voice Modem */
163 {"AZT4001"}, /* AZT3005 PnP SOUND DEVICE */
164 {"BDP3336"}, /* Best Data Products Inc. Smart One 336F PnP Modem */
165 {"BRI0A49"}, /* Boca Complete Ofc Communicator 14.4 Data-FAX */
166 {"BRI1400"}, /* Boca Research 33,600 ACF Modem */
167 {"BRI3400"}, /* Boca 33.6 Kbps Internal FD34FSVD */
168 {"BRI0A49"}, /* Boca 33.6 Kbps Internal FD34FSVD */
169 {"BDP3336"}, /* Best Data Products Inc. Smart One 336F PnP Modem */
170 {"CPI4050"}, /* Computer Peripherals Inc. EuroViVa CommCenter-33.6 SP PnP */
171 {"CTL3001"}, /* Creative Labs Phone Blaster 28.8 DSVD PnP Voice */
172 {"CTL3011"}, /* Creative Labs Modem Blaster 28.8 DSVD PnP Voice */
173 {"DAV0336"}, /* Davicom ISA 33.6K Modem */
174 {"DMB1032"}, /* Creative Modem Blaster Flash56 DI5601-1 */
175 {"DMB2001"}, /* Creative Modem Blaster V.90 DI5660 */
176 {"ETT0002"}, /* E-Tech CyberBULLET PC56RVP */
177 {"FUJ0202"}, /* Fujitsu 33600 PnP-I2 R Plug & Play */
178 {"FUJ0205"}, /* Fujitsu FMV-FX431 Plug & Play */
179 {"FUJ0206"}, /* Fujitsu 33600 PnP-I4 R Plug & Play */
180 {"FUJ0209"}, /* Fujitsu Fax Voice 33600 PNP-I5 R Plug & Play */
181 {"GVC000F"}, /* Archtek SmartLink Modem 3334BT Plug & Play */
182 {"GVC0303"}, /* Archtek SmartLink Modem 3334BRV 33.6K Data Fax Voice */
183 {"HAY0001"}, /* Hayes Optima 288 V.34-V.FC + FAX + Voice Plug & Play */
184 {"HAY000C"}, /* Hayes Optima 336 V.34 + FAX + Voice PnP */
185 {"HAY000D"}, /* Hayes Optima 336B V.34 + FAX + Voice PnP */
186 {"HAY5670"}, /* Hayes Accura 56K Ext Fax Modem PnP */
187 {"HAY5674"}, /* Hayes Accura 56K Ext Fax Modem PnP */
188 {"HAY5675"}, /* Hayes Accura 56K Fax Modem PnP */
189 {"HAYF000"}, /* Hayes 288, V.34 + FAX */
190 {"HAYF001"}, /* Hayes Optima 288 V.34 + FAX + Voice, Plug & Play */
191 {"IBM0033"}, /* IBM Thinkpad 701 Internal Modem Voice */
192 {"PNP4972"}, /* Intermec CV60 touchscreen port */
193 {"IXDC801"}, /* Intertex 28k8 33k6 Voice EXT PnP */
194 {"IXDC901"}, /* Intertex 33k6 56k Voice EXT PnP */
195 {"IXDD801"}, /* Intertex 28k8 33k6 Voice SP EXT PnP */
196 {"IXDD901"}, /* Intertex 33k6 56k Voice SP EXT PnP */
197 {"IXDF401"}, /* Intertex 28k8 33k6 Voice SP INT PnP */
198 {"IXDF801"}, /* Intertex 28k8 33k6 Voice SP EXT PnP */
199 {"IXDF901"}, /* Intertex 33k6 56k Voice SP EXT PnP */
200 {"KOR4522"}, /* KORTEX 28800 Externe PnP */
201 {"KORF661"}, /* KXPro 33.6 Vocal ASVD PnP */
202 {"LAS4040"}, /* LASAT Internet 33600 PnP */
203 {"LAS4540"}, /* Lasat Safire 560 PnP */
204 {"LAS5440"}, /* Lasat Safire 336 PnP */
205 {"MNP0281"}, /* Microcom TravelPorte FAST V.34 Plug & Play */
206 {"MNP0336"}, /* Microcom DeskPorte V.34 FAST or FAST+ Plug & Play */
207 {"MNP0339"}, /* Microcom DeskPorte FAST EP 28.8 Plug & Play */
208 {"MNP0342"}, /* Microcom DeskPorte 28.8P Plug & Play */
209 {"MNP0500"}, /* Microcom DeskPorte FAST ES 28.8 Plug & Play */
210 {"MNP0501"}, /* Microcom DeskPorte FAST ES 28.8 Plug & Play */
211 {"MNP0502"}, /* Microcom DeskPorte 28.8S Internal Plug & Play */
212 {"MOT1105"}, /* Motorola BitSURFR Plug & Play */
213 {"MOT1111"}, /* Motorola TA210 Plug & Play */
214 {"MOT1114"}, /* Motorola HMTA 200 (ISDN) Plug & Play */
215 {"MOT1115"}, /* Motorola BitSURFR Plug & Play */
216 {"MOT1190"}, /* Motorola Lifestyle 28.8 Internal */
217 {"MOT1501"}, /* Motorola V.3400 Plug & Play */
218 {"MOT1502"}, /* Motorola Lifestyle 28.8 V.34 Plug & Play */
219 {"MOT1505"}, /* Motorola Power 28.8 V.34 Plug & Play */
220 {"MOT1509"}, /* Motorola ModemSURFR External 28.8 Plug & Play */
221 {"MOT150A"}, /* Motorola Premier 33.6 Desktop Plug & Play */
222 {"MOT150F"}, /* Motorola VoiceSURFR 56K External PnP */
223 {"MOT1510"}, /* Motorola ModemSURFR 56K External PnP */
224 {"MOT1550"}, /* Motorola ModemSURFR 56K Internal PnP */
225 {"MOT1560"}, /* Motorola ModemSURFR Internal 28.8 Plug & Play */
226 {"MOT1580"}, /* Motorola Premier 33.6 Internal Plug & Play */
227 {"MOT15B0"}, /* Motorola OnlineSURFR 28.8 Internal Plug & Play */
228 {"MOT15F0"}, /* Motorola VoiceSURFR 56K Internal PnP */
229 {"MVX00A1"}, /* Deskline K56 Phone System PnP */
230 {"MVX00F2"}, /* PC Rider K56 Phone System PnP */
231 {"nEC8241"}, /* NEC 98NOTE SPEAKER PHONE FAX MODEM(33600bps) */
232 {"PMC2430"}, /* Pace 56 Voice Internal Plug & Play Modem */
233 {"PNP0500"}, /* Generic standard PC COM port */
234 {"PNP0501"}, /* Generic 16550A-compatible COM port */
235 {"PNPC000"}, /* Compaq 14400 Modem */
236 {"PNPC001"}, /* Compaq 2400/9600 Modem */
237 {"PNPC031"}, /* Dial-Up Networking Serial Cable between 2 PCs */
238 {"PNPC032"}, /* Dial-Up Networking Parallel Cable between 2 PCs */
239 {"PNPC100"}, /* Standard 9600 bps Modem */
240 {"PNPC101"}, /* Standard 14400 bps Modem */
241 {"PNPC102"}, /* Standard 28800 bps Modem */
242 {"PNPC103"}, /* Standard Modem */
243 {"PNPC104"}, /* Standard 9600 bps Modem */
244 {"PNPC105"}, /* Standard 14400 bps Modem */
245 {"PNPC106"}, /* Standard 28800 bps Modem */
246 {"PNPC107"}, /* Standard Modem */
247 {"PNPC108"}, /* Standard 9600 bps Modem */
248 {"PNPC109"}, /* Standard 14400 bps Modem */
249 {"PNPC10A"}, /* Standard 28800 bps Modem */
250 {"PNPC10B"}, /* Standard Modem */
251 {"PNPC10C"}, /* Standard 9600 bps Modem */
252 {"PNPC10D"}, /* Standard 14400 bps Modem */
253 {"PNPC10E"}, /* Standard 28800 bps Modem */
254 {"PNPC10F"}, /* Standard Modem */
255 {"PNP2000"}, /* Standard PCMCIA Card Modem */
256 {"ROK0030"}, /* Rockwell 33.6 DPF Internal PnP, Modular Technology 33.6 Internal PnP */
257 {"ROK0100"}, /* KORTEX 14400 Externe PnP */
258 {"ROK4120"}, /* Rockwell 28.8 */
259 {"ROK4920"}, /* Viking 28.8 INTERNAL Fax+Data+Voice PnP */
260 {"RSS00A0"}, /* Rockwell 33.6 DPF External PnP, BT Prologue 33.6 External PnP, Modular Technology 33.6 External PnP */
261 {"RSS0262"}, /* Viking 56K FAX INT */
262 {"RSS0250"}, /* K56 par,VV,Voice,Speakphone,AudioSpan,PnP */
263 {"SUP1310"}, /* SupraExpress 28.8 Data/Fax PnP modem */
264 {"SUP1381"}, /* SupraExpress 336i PnP Voice Modem */
265 {"SUP1421"}, /* SupraExpress 33.6 Data/Fax PnP modem */
266 {"SUP1590"}, /* SupraExpress 33.6 Data/Fax PnP modem */
267 {"SUP1620"}, /* SupraExpress 336i Sp ASVD */
268 {"SUP1760"}, /* SupraExpress 33.6 Data/Fax PnP modem */
269 {"SUP2171"}, /* SupraExpress 56i Sp Intl */
270 {"TEX0011"}, /* Phoebe Micro 33.6 Data Fax 1433VQH Plug & Play */
271 {"UAC000F"}, /* Archtek SmartLink Modem 3334BT Plug & Play */
272 {"USR0000"}, /* 3Com Corp. Gateway Telepath IIvi 33.6 */
273 {"USR0002"}, /* U.S. Robotics Sporster 33.6K Fax INT PnP */
274 {"USR0004"}, /* Sportster Vi 14.4 PnP FAX Voicemail */
275 {"USR0006"}, /* U.S. Robotics 33.6K Voice INT PnP */
276 {"USR0007"}, /* U.S. Robotics 33.6K Voice EXT PnP */
277 {"USR0009"}, /* U.S. Robotics Courier V.Everything INT PnP */
278 {"USR2002"}, /* U.S. Robotics 33.6K Voice INT PnP */
279 {"USR2070"}, /* U.S. Robotics 56K Voice INT PnP */
280 {"USR2080"}, /* U.S. Robotics 56K Voice EXT PnP */
281 {"USR3031"}, /* U.S. Robotics 56K FAX INT */
282 {"USR3050"}, /* U.S. Robotics 56K FAX INT */
283 {"USR3070"}, /* U.S. Robotics 56K Voice INT PnP */
284 {"USR3080"}, /* U.S. Robotics 56K Voice EXT PnP */
285 {"USR3090"}, /* U.S. Robotics 56K Voice INT PnP */
286 {"USR9100"}, /* U.S. Robotics 56K Message */
287 {"USR9160"}, /* U.S. Robotics 56K FAX EXT PnP */
288 {"USR9170"}, /* U.S. Robotics 56K FAX INT PnP */
289 {"USR9180"}, /* U.S. Robotics 56K Voice EXT PnP */
290 {"USR9190"}, /* U.S. Robotics 56K Voice INT PnP */
291 {"WACFXXX"}, /* Wacom tablets */
292 {"FPI2002"}, /* Compaq touchscreen */
293 {"FUJ02B2"}, /* Fujitsu Stylistic touchscreens */
294 {"FUJ02B3"},
295 {"FUJ02B4"}, /* Fujitsu Stylistic LT touchscreens */
296 {"FUJ02B6"}, /* Passive Fujitsu Stylistic touchscreens */
297 {"FUJ02B7"},
298 {"FUJ02B8"},
299 {"FUJ02B9"},
300 {"FUJ02BC"},
301 {"FUJ02E5"}, /* Fujitsu Wacom Tablet PC device */
302 {"FUJ02E6"}, /* Fujitsu P-series tablet PC device */
303 {"FUJ02E7"}, /* Fujitsu Wacom 2FGT Tablet PC device */
304 {"FUJ02E9"}, /* Fujitsu Wacom 1FGT Tablet PC device */
305 {"LTS0001"}, /* LG C1 EXPRESS DUAL (C1-PB11A3) touch screen (actually a FUJ02E6 in disguise) */
306 {"WCI0003"}, /* Rockwell's (PORALiNK) 33600 INT PNP */
307 {"WEC1022"}, /* Winbond CIR port, should not be probed. We should keep track of it to prevent the legacy serial driver from probing it */
308 {"PNPCXXX"}, /* Unknown PnP modems */
309 {"PNPDXXX"}, /* More unknown PnP modems */
310 /* scl200wdt */
311 {"NSC0800"}, /* National Semiconductor PC87307/PC97307 watchdog component */
312 /* mpu401 */
313 {"PNPb006"},
314 /* cs423x-pnpbios */
315 {"CSC0100"},
316 {"CSC0000"},
317 {"GIM0100"}, /* Guillemot Turtlebeach something appears to be cs4232 compatible */
318 /* es18xx-pnpbios */
319 {"ESS1869"},
320 {"ESS1879"},
321 /* snd-opl3sa2-pnpbios */
322 {"YMH0021"},
323 {"NMX2210"}, /* Gateway Solo 2500 */
324 {""},
325};
326
327static bool is_hex_digit(char c)
328{
329 return (c >= 0 && c <= '9') || (c >= 'A' && c <= 'F');
330}
331
332static bool matching_id(char *idstr, char *list_id)
333{
334 int i;
335
336 if (memcmp(idstr, list_id, 3))
337 return false;
338
339 for (i = 3; i < 7; i++) {
340 char c = toupper(idstr[i]);
341
342 if (!is_hex_digit(c)
343 || (list_id[i] != 'X' && c != toupper(list_id[i])))
344 return false;
345 }
346 return true;
347}
348
349static bool acpi_pnp_match(char *idstr, const struct acpi_device_id **matchid)
350{
351 const struct acpi_device_id *devid;
352
353 for (devid = acpi_pnp_device_ids; devid->id[0]; devid++)
354 if (matching_id(idstr, (char *)devid->id)) {
355 if (matchid)
356 *matchid = devid;
357
358 return true;
359 }
360
361 return false;
362}
363
364static int acpi_pnp_attach(struct acpi_device *adev,
365 const struct acpi_device_id *id)
366{
367 return 1;
368}
369
370static struct acpi_scan_handler acpi_pnp_handler = {
371 .ids = acpi_pnp_device_ids,
372 .match = acpi_pnp_match,
373 .attach = acpi_pnp_attach,
374};
375
376/*
377 * For CMOS RTC devices, the PNP ACPI scan handler does not work, because
378 * there is a CMOS RTC ACPI scan handler installed already, so we need to
379 * check those devices and enumerate them to the PNP bus directly.
380 */
381static int is_cmos_rtc_device(struct acpi_device *adev)
382{
383 struct acpi_device_id ids[] = {
384 { "PNP0B00" },
385 { "PNP0B01" },
386 { "PNP0B02" },
387 {""},
388 };
389 return !acpi_match_device_ids(adev, ids);
390}
391
392bool acpi_is_pnp_device(struct acpi_device *adev)
393{
394 return adev->handler == &acpi_pnp_handler || is_cmos_rtc_device(adev);
395}
396EXPORT_SYMBOL_GPL(acpi_is_pnp_device);
397
398void __init acpi_pnp_init(void)
399{
400 acpi_scan_add_handler(&acpi_pnp_handler);
401}
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index bb7de413d06d..5c16cb6bc76d 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -30,6 +30,7 @@ void acpi_pci_root_init(void);
30void acpi_pci_link_init(void); 30void acpi_pci_link_init(void);
31void acpi_processor_init(void); 31void acpi_processor_init(void);
32void acpi_platform_init(void); 32void acpi_platform_init(void);
33void acpi_pnp_init(void);
33int acpi_sysfs_init(void); 34int acpi_sysfs_init(void);
34#ifdef CONFIG_ACPI_CONTAINER 35#ifdef CONFIG_ACPI_CONTAINER
35void acpi_container_init(void); 36void acpi_container_init(void);
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index e44438f7917b..19d524c5c0c8 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -2253,6 +2253,7 @@ int __init acpi_scan_init(void)
2253 acpi_cmos_rtc_init(); 2253 acpi_cmos_rtc_init();
2254 acpi_container_init(); 2254 acpi_container_init();
2255 acpi_memory_hotplug_init(); 2255 acpi_memory_hotplug_init();
2256 acpi_pnp_init();
2256 2257
2257 mutex_lock(&acpi_scan_lock); 2258 mutex_lock(&acpi_scan_lock);
2258 /* 2259 /*
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index c31aa07b3ba5..b81448b2c75d 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -30,26 +30,6 @@
30 30
31static int num; 31static int num;
32 32
33/* We need only to blacklist devices that have already an acpi driver that
34 * can't use pnp layer. We don't need to blacklist device that are directly
35 * used by the kernel (PCI root, ...), as it is harmless and there were
36 * already present in pnpbios. But there is an exception for devices that
37 * have irqs (PIC, Timer) because we call acpi_register_gsi.
38 * Finally, only devices that have a CRS method need to be in this list.
39 */
40static struct acpi_device_id excluded_id_list[] __initdata = {
41 {"PNP0C09", 0}, /* EC */
42 {"PNP0C0F", 0}, /* Link device */
43 {"PNP0000", 0}, /* PIC */
44 {"PNP0100", 0}, /* Timer */
45 {"", 0},
46};
47
48static inline int __init is_exclusive_device(struct acpi_device *dev)
49{
50 return (!acpi_match_device_ids(dev, excluded_id_list));
51}
52
53/* 33/*
54 * Compatible Device IDs 34 * Compatible Device IDs
55 */ 35 */
@@ -266,7 +246,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
266 if (!pnpid) 246 if (!pnpid)
267 return 0; 247 return 0;
268 248
269 if (is_exclusive_device(device) || !device->status.present) 249 if (!device->status.present)
270 return 0; 250 return 0;
271 251
272 dev = pnp_alloc_dev(&pnpacpi_protocol, num, pnpid); 252 dev = pnp_alloc_dev(&pnpacpi_protocol, num, pnpid);
@@ -326,10 +306,10 @@ static acpi_status __init pnpacpi_add_device_handler(acpi_handle handle,
326{ 306{
327 struct acpi_device *device; 307 struct acpi_device *device;
328 308
329 if (!acpi_bus_get_device(handle, &device)) 309 if (acpi_bus_get_device(handle, &device))
330 pnpacpi_add_device(device);
331 else
332 return AE_CTRL_DEPTH; 310 return AE_CTRL_DEPTH;
311 if (acpi_is_pnp_device(device))
312 pnpacpi_add_device(device);
333 return AE_OK; 313 return AE_OK;
334} 314}
335 315
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 4c007262e891..0b9927f4edd2 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -184,6 +184,8 @@ extern int ec_transaction(u8 command,
184 u8 *rdata, unsigned rdata_len); 184 u8 *rdata, unsigned rdata_len);
185extern acpi_handle ec_get_handle(void); 185extern acpi_handle ec_get_handle(void);
186 186
187extern bool acpi_is_pnp_device(struct acpi_device *);
188
187#if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE) 189#if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE)
188 190
189typedef void (*wmi_notify_handler) (u32 value, void *context); 191typedef void (*wmi_notify_handler) (u32 value, void *context);