1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24
25 #include <sys/acpica.h>
26 #include <sys/kmem.h>
27 #include <sys/types.h>
28
29 /*
30 * For historical reasons certain ISA or onboard devices have their name in
31 * the device tree altered and other changes made.
32 *
33 * If a device ID matches here, we will create the devi node name, model, and
34 * (if set) compatible property. The compatible property should already be in
35 * 1275 form, and _overwrites_ any identifier from enumeration.
36 *
37 * In most cases, ISA-like devices not present in this table _will not be
38 * enumerated_. Serial ports are a special case handled because of bugs in
39 * old ACPI tables, see enumerate_BIOS_serial() in the isa(4D) nexus.
40 */
41 static const isapnp_desc_t isapnp_descs[] = {
42 /*
43 * This wildcard entry catches anything in the PNP keyboard class, and
44 * sets it compatible with the IBM Enhanced 101/102-key, to which
45 * kb8042 actually binds
46 */
47 { "PNP03", B_TRUE, "keyboard", "pnpPNP,303", "System keyboard" },
48
49 /* ecpp(4D) binds to "lp" */
50 { "PNP0400", B_FALSE, "lp", NULL, "Standard LPT printer port" },
51 { "PNP0401", B_FALSE, "lp", NULL, "ECP printer port" },
52 { "ISY0060", B_FALSE, "lp", NULL, "Parallel port" },
53
54 /* asy(4D) binds to "asy" */
55 { "PNP0500", B_FALSE, "asy", NULL, "Standard PC COM port" },
56 { "PNP0501", B_FALSE, "asy", NULL, "16550A-compatible COM port" },
57 { "ISY0020", B_FALSE, "asy", NULL, "Serial port" },
58
59 /* fdc(4D) binds to "fdc" */
60 { "PNP0700", B_FALSE, "fdc", NULL,
61 "PC standard floppy disk controller" },
62 { "PNP0701", B_FALSE, "fdc", NULL,
63 "Standard floppy controller supporting MS Device Bay Spec" },
64 { "ISY0050", B_FALSE, "fdc", NULL,
65 "Floppy disk controller" },
66
67 /* tpm(4D) binds to "tpm" */
68 { "PNP0C31", B_FALSE, "tpm", NULL, "Generic Trusted Platform Module" },
69 { "ATM1200", B_FALSE, "tpm", NULL, "Generic Trusted Platform Module" },
70 { "IFX0102", B_FALSE, "tpm", NULL, "Generic Trusted Platform Module" },
71 { "BCM0101", B_FALSE, "tpm", NULL, "Generic Trusted Platform Module" },
72 { "NSC1200", B_FALSE, "tpm", NULL, "Generic Trusted Platform Module" },
73
74 /*
75 * This wildcard entry catches anything in the PNP mouse class, and
76 * sets it compatible with the Microsoft PS/2-style, to which
77 * mouse8042 actually binds.
78 */
79 { "PNP0F", B_TRUE, "mouse", "pnpPNP,f03", "System mouse" },
80
81 { "ISY0030", B_FALSE, "mouse", "pnpPNP,f03", "System mouse" },
82 { "SYN010B", B_FALSE, "mouse", "pnpPNP,f03", "Synaptics mouse pad" },
83
84 { NULL, B_FALSE, NULL, NULL, NULL },
85 };
86
87 /*
88 * Return the first record found matching the pnpid list
89 */
90 const isapnp_desc_t *
isapnp_desc_lookup(const device_id_t * pnpid)91 isapnp_desc_lookup(const device_id_t *pnpid)
92 {
93 const device_id_t *d;
94 const isapnp_desc_t *m;
95
96 while (pnpid != NULL) {
97 for (m = isapnp_descs; m->ipnp_id != NULL; m++) {
98 if (m->ipnp_prefix) {
99 if (strncmp(pnpid->id, m->ipnp_id,
100 strlen(m->ipnp_id)) == 0) {
101 return (m);
102 }
103 } else if (strcmp(pnpid->id, m->ipnp_id) == 0) {
104 return (m);
105 }
106 }
107 pnpid = pnpid->next;
108 }
109
110 return (NULL);
111 }
112