| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: subr_autoconf.c,v 1.235 2015/04/13 16:46:33 riastradh Exp $ */ | | 1 | /* $NetBSD: subr_autoconf.c,v 1.236 2015/11/08 21:03:00 joerg Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1996, 2000 Christopher G. Demetriou | | 4 | * Copyright (c) 1996, 2000 Christopher G. Demetriou |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -67,27 +67,27 @@ | | | @@ -67,27 +67,27 @@ |
67 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 67 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
68 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 68 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
69 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 69 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
70 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 70 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
71 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 71 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
72 | * SUCH DAMAGE. | | 72 | * SUCH DAMAGE. |
73 | * | | 73 | * |
74 | * from: Header: subr_autoconf.c,v 1.12 93/02/01 19:31:48 torek Exp (LBL) | | 74 | * from: Header: subr_autoconf.c,v 1.12 93/02/01 19:31:48 torek Exp (LBL) |
75 | * | | 75 | * |
76 | * @(#)subr_autoconf.c 8.3 (Berkeley) 5/17/94 | | 76 | * @(#)subr_autoconf.c 8.3 (Berkeley) 5/17/94 |
77 | */ | | 77 | */ |
78 | | | 78 | |
79 | #include <sys/cdefs.h> | | 79 | #include <sys/cdefs.h> |
80 | __KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.235 2015/04/13 16:46:33 riastradh Exp $"); | | 80 | __KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.236 2015/11/08 21:03:00 joerg Exp $"); |
81 | | | 81 | |
82 | #ifdef _KERNEL_OPT | | 82 | #ifdef _KERNEL_OPT |
83 | #include "opt_ddb.h" | | 83 | #include "opt_ddb.h" |
84 | #include "drvctl.h" | | 84 | #include "drvctl.h" |
85 | #endif | | 85 | #endif |
86 | | | 86 | |
87 | #include <sys/param.h> | | 87 | #include <sys/param.h> |
88 | #include <sys/device.h> | | 88 | #include <sys/device.h> |
89 | #include <sys/disklabel.h> | | 89 | #include <sys/disklabel.h> |
90 | #include <sys/conf.h> | | 90 | #include <sys/conf.h> |
91 | #include <sys/kauth.h> | | 91 | #include <sys/kauth.h> |
92 | #include <sys/kmem.h> | | 92 | #include <sys/kmem.h> |
93 | #include <sys/systm.h> | | 93 | #include <sys/systm.h> |
| @@ -1425,26 +1425,30 @@ config_devalloc(const device_t parent, c | | | @@ -1425,26 +1425,30 @@ config_devalloc(const device_t parent, c |
1425 | ia = cfiattr_lookup(cfdata_ifattr(cf), parent->dv_cfdriver); | | 1425 | ia = cfiattr_lookup(cfdata_ifattr(cf), parent->dv_cfdriver); |
1426 | dev->dv_locators = | | 1426 | dev->dv_locators = |
1427 | kmem_alloc(sizeof(int [ia->ci_loclen + 1]), KM_SLEEP); | | 1427 | kmem_alloc(sizeof(int [ia->ci_loclen + 1]), KM_SLEEP); |
1428 | *dev->dv_locators++ = sizeof(int [ia->ci_loclen + 1]); | | 1428 | *dev->dv_locators++ = sizeof(int [ia->ci_loclen + 1]); |
1429 | memcpy(dev->dv_locators, locs, sizeof(int [ia->ci_loclen])); | | 1429 | memcpy(dev->dv_locators, locs, sizeof(int [ia->ci_loclen])); |
1430 | } | | 1430 | } |
1431 | dev->dv_properties = prop_dictionary_create(); | | 1431 | dev->dv_properties = prop_dictionary_create(); |
1432 | KASSERT(dev->dv_properties != NULL); | | 1432 | KASSERT(dev->dv_properties != NULL); |
1433 | | | 1433 | |
1434 | prop_dictionary_set_cstring_nocopy(dev->dv_properties, | | 1434 | prop_dictionary_set_cstring_nocopy(dev->dv_properties, |
1435 | "device-driver", dev->dv_cfdriver->cd_name); | | 1435 | "device-driver", dev->dv_cfdriver->cd_name); |
1436 | prop_dictionary_set_uint16(dev->dv_properties, | | 1436 | prop_dictionary_set_uint16(dev->dv_properties, |
1437 | "device-unit", dev->dv_unit); | | 1437 | "device-unit", dev->dv_unit); |
| | | 1438 | if (parent != NULL) { |
| | | 1439 | prop_dictionary_set_cstring(dev->dv_properties, |
| | | 1440 | "device-parent", device_xname(parent)); |
| | | 1441 | } |
1438 | | | 1442 | |
1439 | if (dev->dv_cfdriver->cd_attrs != NULL) | | 1443 | if (dev->dv_cfdriver->cd_attrs != NULL) |
1440 | config_add_attrib_dict(dev); | | 1444 | config_add_attrib_dict(dev); |
1441 | | | 1445 | |
1442 | return dev; | | 1446 | return dev; |
1443 | } | | 1447 | } |
1444 | | | 1448 | |
1445 | /* | | 1449 | /* |
1446 | * Create an array of device attach attributes and add it | | 1450 | * Create an array of device attach attributes and add it |
1447 | * to the device's dv_properties dictionary. | | 1451 | * to the device's dv_properties dictionary. |
1448 | * | | 1452 | * |
1449 | * <key>interface-attributes</key> | | 1453 | * <key>interface-attributes</key> |
1450 | * <array> | | 1454 | * <array> |