usba.c (cbab2b26) | usba.c (d73ae94e) |
---|---|
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 --- 69 unchanged lines hidden (view full) --- 78 79/* 80 * modload support 81 */ 82extern struct mod_ops mod_miscops; 83 84struct modlmisc modlmisc = { 85 &mod_miscops, /* Type of module */ | 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 --- 69 unchanged lines hidden (view full) --- 78 79/* 80 * modload support 81 */ 82extern struct mod_ops mod_miscops; 83 84struct modlmisc modlmisc = { 85 &mod_miscops, /* Type of module */ |
86 "USBA: USB Architecture 2.0 %I%" | 86 "USBA: USB Architecture 2.0 1.66" |
87}; 88 89struct modlinkage modlinkage = { 90 MODREV_1, (void *)&modlmisc, NULL 91}; 92 93 94static usb_log_handle_t usba_log_handle; --- 52 unchanged lines hidden (view full) --- 147} 148 149int 150_info(struct modinfo *modinfop) 151{ 152 return (mod_info(&modlinkage, modinfop)); 153} 154 | 87}; 88 89struct modlinkage modlinkage = { 90 MODREV_1, (void *)&modlmisc, NULL 91}; 92 93 94static usb_log_handle_t usba_log_handle; --- 52 unchanged lines hidden (view full) --- 147} 148 149int 150_info(struct modinfo *modinfop) 151{ 152 return (mod_info(&modlinkage, modinfop)); 153} 154 |
155boolean_t 156usba_owns_ia(dev_info_t *dip) 157{ 158 int if_count = ddi_prop_get_int(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, 159 "interface-count", 0); |
|
155 | 160 |
161 return ((if_count) ? B_TRUE : B_FALSE); 162} 163 |
|
156/* 157 * common bus ctl for hcd, usb_mid, and hubd 158 */ 159int 160usba_bus_ctl(dev_info_t *dip, 161 dev_info_t *rdip, 162 ddi_ctl_enum_t op, 163 void *arg, --- 30 unchanged lines hidden (view full) --- 194 195 if (usba_device) { 196 if (usb_owns_device(rdip)) { 197 (void) snprintf(compat_name, 198 sizeof (compat_name), 199 "usb%x,%x", 200 usba_device->usb_dev_descr->idVendor, 201 usba_device->usb_dev_descr->idProduct); | 164/* 165 * common bus ctl for hcd, usb_mid, and hubd 166 */ 167int 168usba_bus_ctl(dev_info_t *dip, 169 dev_info_t *rdip, 170 ddi_ctl_enum_t op, 171 void *arg, --- 30 unchanged lines hidden (view full) --- 202 203 if (usba_device) { 204 if (usb_owns_device(rdip)) { 205 (void) snprintf(compat_name, 206 sizeof (compat_name), 207 "usb%x,%x", 208 usba_device->usb_dev_descr->idVendor, 209 usba_device->usb_dev_descr->idProduct); |
210 } else if (usba_owns_ia(rdip)) { 211 (void) snprintf(compat_name, 212 sizeof (compat_name), 213 "usbia%x,%x.config%x.%x", 214 usba_device->usb_dev_descr->idVendor, 215 usba_device->usb_dev_descr->idProduct, 216 usba_device->usb_cfg_value, 217 usb_get_if_number(rdip)); |
|
202 } else { 203 (void) snprintf(compat_name, 204 sizeof (compat_name), 205 "usbif%x,%x.config%x.%x", 206 usba_device->usb_dev_descr->idVendor, 207 usba_device->usb_dev_descr->idProduct, 208 usba_device->usb_cfg_value, 209 usb_get_if_number(rdip)); --- 15 unchanged lines hidden (view full) --- 225 } 226 227 cmn_err(CE_CONT, 228 "?USB %x.%x %s (%s) operating at %s on " 229 "USB %x.%x %s hub: " 230 "%s@%s, %s%d at bus address %d\n", 231 (usba_device->usb_dev_descr->bcdUSB & 0xff00) >> 8, 232 usba_device->usb_dev_descr->bcdUSB & 0xff, | 218 } else { 219 (void) snprintf(compat_name, 220 sizeof (compat_name), 221 "usbif%x,%x.config%x.%x", 222 usba_device->usb_dev_descr->idVendor, 223 usba_device->usb_dev_descr->idProduct, 224 usba_device->usb_cfg_value, 225 usb_get_if_number(rdip)); --- 15 unchanged lines hidden (view full) --- 241 } 242 243 cmn_err(CE_CONT, 244 "?USB %x.%x %s (%s) operating at %s on " 245 "USB %x.%x %s hub: " 246 "%s@%s, %s%d at bus address %d\n", 247 (usba_device->usb_dev_descr->bcdUSB & 0xff00) >> 8, 248 usba_device->usb_dev_descr->bcdUSB & 0xff, |
233 (usb_owns_device(rdip) ? "device" : "interface"), | 249 (usb_owns_device(rdip) ? "device" : 250 ((usba_owns_ia(rdip) ? "interface-association" : 251 "interface"))), |
234 compat_name, speed, 235 (hub_usba_device->usb_dev_descr->bcdUSB & 236 0xff00) >> 8, 237 hub_usba_device->usb_dev_descr->bcdUSB & 0xff, 238 usba_is_root_hub(hubdip) ? "root" : "external", 239 ddi_node_name(rdip), ddi_get_name_addr(rdip), 240 ddi_driver_name(rdip), 241 ddi_get_instance(rdip), usba_device->usb_addr); --- 1139 unchanged lines hidden (view full) --- 1381 * usba_set_node_name() according to class, subclass, and protocol 1382 * following the 1275 USB binding tables. 1383 */ 1384 1385/* device node table, refer to section 3.2.2.1 of 1275 binding */ 1386static node_name_entry_t device_node_name_table[] = { 1387{ USB_CLASS_COMM, DONTCARE, DONTCARE, "communications" }, 1388{ USB_CLASS_HUB, DONTCARE, DONTCARE, "hub" }, | 252 compat_name, speed, 253 (hub_usba_device->usb_dev_descr->bcdUSB & 254 0xff00) >> 8, 255 hub_usba_device->usb_dev_descr->bcdUSB & 0xff, 256 usba_is_root_hub(hubdip) ? "root" : "external", 257 ddi_node_name(rdip), ddi_get_name_addr(rdip), 258 ddi_driver_name(rdip), 259 ddi_get_instance(rdip), usba_device->usb_addr); --- 1139 unchanged lines hidden (view full) --- 1399 * usba_set_node_name() according to class, subclass, and protocol 1400 * following the 1275 USB binding tables. 1401 */ 1402 1403/* device node table, refer to section 3.2.2.1 of 1275 binding */ 1404static node_name_entry_t device_node_name_table[] = { 1405{ USB_CLASS_COMM, DONTCARE, DONTCARE, "communications" }, 1406{ USB_CLASS_HUB, DONTCARE, DONTCARE, "hub" }, |
1407{ USB_CLASS_DIAG, DONTCARE, DONTCARE, "diagnostics" }, 1408{ USB_CLASS_MISC, DONTCARE, DONTCARE, "miscellaneous" }, |
|
1389{ DONTCARE, DONTCARE, DONTCARE, "device" } 1390}; 1391 | 1409{ DONTCARE, DONTCARE, DONTCARE, "device" } 1410}; 1411 |
1412/* interface-association node table */ 1413static node_name_entry_t ia_node_name_table[] = { 1414{ USB_CLASS_AUDIO, DONTCARE, DONTCARE, "audio" }, 1415{ USB_CLASS_VIDEO, DONTCARE, DONTCARE, "video" }, 1416{ USB_CLASS_WIRELESS, USB_SUBCLS_WUSB_2, USB_PROTO_WUSB_DWA, 1417 "device-wire-adaptor" }, 1418{ USB_CLASS_WIRELESS, DONTCARE, DONTCARE, "wireless-controller" }, 1419{ DONTCARE, DONTCARE, DONTCARE, "interface-association" } 1420}; 1421 |
|
1392/* interface node table, refer to section 3.3.2.1 */ 1393static node_name_entry_t if_node_name_table[] = { 1394{ USB_CLASS_AUDIO, USB_SUBCLS_AUD_CONTROL, DONTCARE, "sound-control" }, 1395{ USB_CLASS_AUDIO, USB_SUBCLS_AUD_STREAMING, DONTCARE, "sound" }, 1396{ USB_CLASS_AUDIO, USB_SUBCLS_AUD_MIDI_STREAMING, DONTCARE, "midi" }, 1397{ USB_CLASS_AUDIO, DONTCARE, DONTCARE, "sound" }, 1398 1399{ USB_CLASS_COMM, USB_SUBCLS_CDCC_DIRECT_LINE, DONTCARE, "line" }, 1400{ USB_CLASS_COMM, USB_SUBCLS_CDCC_ABSTRCT_CTRL, DONTCARE, "modem" }, 1401{ USB_CLASS_COMM, USB_SUBCLS_CDCC_PHONE_CTRL, DONTCARE, "telephone" }, 1402{ USB_CLASS_COMM, USB_SUBCLS_CDCC_MULTCNL_ISDN, DONTCARE, "isdn" }, 1403{ USB_CLASS_COMM, USB_SUBCLS_CDCC_ISDN, DONTCARE, "isdn" }, 1404{ USB_CLASS_COMM, USB_SUBCLS_CDCC_ETHERNET, DONTCARE, "ethernet" }, 1405{ USB_CLASS_COMM, USB_SUBCLS_CDCC_ATM_NETWORK, DONTCARE, "atm-network" }, | 1422/* interface node table, refer to section 3.3.2.1 */ 1423static node_name_entry_t if_node_name_table[] = { 1424{ USB_CLASS_AUDIO, USB_SUBCLS_AUD_CONTROL, DONTCARE, "sound-control" }, 1425{ USB_CLASS_AUDIO, USB_SUBCLS_AUD_STREAMING, DONTCARE, "sound" }, 1426{ USB_CLASS_AUDIO, USB_SUBCLS_AUD_MIDI_STREAMING, DONTCARE, "midi" }, 1427{ USB_CLASS_AUDIO, DONTCARE, DONTCARE, "sound" }, 1428 1429{ USB_CLASS_COMM, USB_SUBCLS_CDCC_DIRECT_LINE, DONTCARE, "line" }, 1430{ USB_CLASS_COMM, USB_SUBCLS_CDCC_ABSTRCT_CTRL, DONTCARE, "modem" }, 1431{ USB_CLASS_COMM, USB_SUBCLS_CDCC_PHONE_CTRL, DONTCARE, "telephone" }, 1432{ USB_CLASS_COMM, USB_SUBCLS_CDCC_MULTCNL_ISDN, DONTCARE, "isdn" }, 1433{ USB_CLASS_COMM, USB_SUBCLS_CDCC_ISDN, DONTCARE, "isdn" }, 1434{ USB_CLASS_COMM, USB_SUBCLS_CDCC_ETHERNET, DONTCARE, "ethernet" }, 1435{ USB_CLASS_COMM, USB_SUBCLS_CDCC_ATM_NETWORK, DONTCARE, "atm-network" }, |
1406{ USB_CLASS_COMM, DONTCARE, DONTCARE, "control" }, | 1436{ USB_CLASS_COMM, DONTCARE, DONTCARE, "communications" }, |
1407 1408{ USB_CLASS_HID, USB_SUBCLS_HID_1, USB_PROTO_HID_KEYBOARD, "keyboard" }, 1409{ USB_CLASS_HID, USB_SUBCLS_HID_1, USB_PROTO_HID_MOUSE, "mouse" }, 1410{ USB_CLASS_HID, DONTCARE, DONTCARE, "input" }, 1411 1412{ USB_CLASS_HUB, DONTCARE, DONTCARE, "hub" }, 1413 1414{ USB_CLASS_PHYSICAL, DONTCARE, DONTCARE, "physical" }, 1415 | 1437 1438{ USB_CLASS_HID, USB_SUBCLS_HID_1, USB_PROTO_HID_KEYBOARD, "keyboard" }, 1439{ USB_CLASS_HID, USB_SUBCLS_HID_1, USB_PROTO_HID_MOUSE, "mouse" }, 1440{ USB_CLASS_HID, DONTCARE, DONTCARE, "input" }, 1441 1442{ USB_CLASS_HUB, DONTCARE, DONTCARE, "hub" }, 1443 1444{ USB_CLASS_PHYSICAL, DONTCARE, DONTCARE, "physical" }, 1445 |
1446{ USB_CLASS_IMAGE, DONTCARE, DONTCARE, "image" }, 1447 |
|
1416{ USB_CLASS_PRINTER, DONTCARE, DONTCARE, "printer" }, 1417 1418{ USB_CLASS_MASS_STORAGE, DONTCARE, DONTCARE, "storage" }, 1419 1420{ USB_CLASS_CDC_DATA, DONTCARE, DONTCARE, "data" }, 1421 1422{ USB_CLASS_SECURITY, DONTCARE, DONTCARE, "security" }, 1423 | 1448{ USB_CLASS_PRINTER, DONTCARE, DONTCARE, "printer" }, 1449 1450{ USB_CLASS_MASS_STORAGE, DONTCARE, DONTCARE, "storage" }, 1451 1452{ USB_CLASS_CDC_DATA, DONTCARE, DONTCARE, "data" }, 1453 1454{ USB_CLASS_SECURITY, DONTCARE, DONTCARE, "security" }, 1455 |
1456{ USB_CLASS_VIDEO, USB_SUBCLS_VIDEO_CONTROL, DONTCARE, "video-control" }, 1457{ USB_CLASS_VIDEO, USB_SUBCLS_VIDEO_STREAM, DONTCARE, "video-stream" }, 1458{ USB_CLASS_VIDEO, DONTCARE, DONTCARE, "video" }, 1459 |
|
1424{ USB_CLASS_APP, USB_SUBCLS_APP_FIRMWARE, DONTCARE, "firmware" }, 1425{ USB_CLASS_APP, USB_SUBCLS_APP_IRDA, DONTCARE, "IrDa" }, 1426{ USB_CLASS_APP, USB_SUBCLS_APP_TEST, DONTCARE, "test" }, 1427 1428{ DONTCARE, DONTCARE, DONTCARE, "interface" }, 1429 1430}; 1431 --- 6 unchanged lines hidden (view full) --- 1438 1439{ USB_CLASS_COMM, USB_SUBCLS_CDCC_DIRECT_LINE, DONTCARE, "line" }, 1440{ USB_CLASS_COMM, USB_SUBCLS_CDCC_ABSTRCT_CTRL, DONTCARE, "modem" }, 1441{ USB_CLASS_COMM, USB_SUBCLS_CDCC_PHONE_CTRL, DONTCARE, "telephone" }, 1442{ USB_CLASS_COMM, USB_SUBCLS_CDCC_MULTCNL_ISDN, DONTCARE, "isdn" }, 1443{ USB_CLASS_COMM, USB_SUBCLS_CDCC_ISDN, DONTCARE, "isdn" }, 1444{ USB_CLASS_COMM, USB_SUBCLS_CDCC_ETHERNET, DONTCARE, "ethernet" }, 1445{ USB_CLASS_COMM, USB_SUBCLS_CDCC_ATM_NETWORK, DONTCARE, "atm-network" }, | 1460{ USB_CLASS_APP, USB_SUBCLS_APP_FIRMWARE, DONTCARE, "firmware" }, 1461{ USB_CLASS_APP, USB_SUBCLS_APP_IRDA, DONTCARE, "IrDa" }, 1462{ USB_CLASS_APP, USB_SUBCLS_APP_TEST, DONTCARE, "test" }, 1463 1464{ DONTCARE, DONTCARE, DONTCARE, "interface" }, 1465 1466}; 1467 --- 6 unchanged lines hidden (view full) --- 1474 1475{ USB_CLASS_COMM, USB_SUBCLS_CDCC_DIRECT_LINE, DONTCARE, "line" }, 1476{ USB_CLASS_COMM, USB_SUBCLS_CDCC_ABSTRCT_CTRL, DONTCARE, "modem" }, 1477{ USB_CLASS_COMM, USB_SUBCLS_CDCC_PHONE_CTRL, DONTCARE, "telephone" }, 1478{ USB_CLASS_COMM, USB_SUBCLS_CDCC_MULTCNL_ISDN, DONTCARE, "isdn" }, 1479{ USB_CLASS_COMM, USB_SUBCLS_CDCC_ISDN, DONTCARE, "isdn" }, 1480{ USB_CLASS_COMM, USB_SUBCLS_CDCC_ETHERNET, DONTCARE, "ethernet" }, 1481{ USB_CLASS_COMM, USB_SUBCLS_CDCC_ATM_NETWORK, DONTCARE, "atm-network" }, |
1446{ USB_CLASS_COMM, DONTCARE, DONTCARE, "control" }, | 1482{ USB_CLASS_COMM, DONTCARE, DONTCARE, "communications" }, |
1447 1448{ USB_CLASS_HID, USB_SUBCLS_HID_1, USB_PROTO_HID_KEYBOARD, "keyboard" }, 1449{ USB_CLASS_HID, USB_SUBCLS_HID_1, USB_PROTO_HID_MOUSE, "mouse" }, 1450{ USB_CLASS_HID, DONTCARE, DONTCARE, "input" }, 1451 1452{ USB_CLASS_PHYSICAL, DONTCARE, DONTCARE, "physical" }, 1453 | 1483 1484{ USB_CLASS_HID, USB_SUBCLS_HID_1, USB_PROTO_HID_KEYBOARD, "keyboard" }, 1485{ USB_CLASS_HID, USB_SUBCLS_HID_1, USB_PROTO_HID_MOUSE, "mouse" }, 1486{ USB_CLASS_HID, DONTCARE, DONTCARE, "input" }, 1487 1488{ USB_CLASS_PHYSICAL, DONTCARE, DONTCARE, "physical" }, 1489 |
1490{ USB_CLASS_IMAGE, DONTCARE, DONTCARE, "image" }, 1491 |
|
1454{ USB_CLASS_PRINTER, DONTCARE, DONTCARE, "printer" }, 1455 | 1492{ USB_CLASS_PRINTER, DONTCARE, DONTCARE, "printer" }, 1493 |
1494{ USB_CLASS_MASS_STORAGE, USB_SUBCLS_MS_RBC_T10, DONTCARE, "storage" }, 1495{ USB_CLASS_MASS_STORAGE, USB_SUBCLS_MS_SFF8020I, DONTCARE, "cdrom" }, 1496{ USB_CLASS_MASS_STORAGE, USB_SUBCLS_MS_QIC_157, DONTCARE, "tape" }, 1497{ USB_CLASS_MASS_STORAGE, USB_SUBCLS_MS_UFI, DONTCARE, "floppy" }, 1498{ USB_CLASS_MASS_STORAGE, USB_SUBCLS_MS_SFF8070I, DONTCARE, "storage" }, 1499{ USB_CLASS_MASS_STORAGE, USB_SUBCLS_MS_SCSI, DONTCARE, "storage" }, |
|
1456{ USB_CLASS_MASS_STORAGE, DONTCARE, DONTCARE, "storage" }, 1457 1458{ USB_CLASS_CDC_DATA, DONTCARE, DONTCARE, "data" }, 1459 1460{ USB_CLASS_SECURITY, DONTCARE, DONTCARE, "security" }, 1461 | 1500{ USB_CLASS_MASS_STORAGE, DONTCARE, DONTCARE, "storage" }, 1501 1502{ USB_CLASS_CDC_DATA, DONTCARE, DONTCARE, "data" }, 1503 1504{ USB_CLASS_SECURITY, DONTCARE, DONTCARE, "security" }, 1505 |
1506{ USB_CLASS_VIDEO, USB_SUBCLS_VIDEO_CONTROL, DONTCARE, "video-control" }, 1507{ USB_CLASS_VIDEO, USB_SUBCLS_VIDEO_STREAM, DONTCARE, "video-stream" }, 1508{ USB_CLASS_VIDEO, DONTCARE, DONTCARE, "video" }, 1509 |
|
1462{ USB_CLASS_APP, USB_SUBCLS_APP_FIRMWARE, DONTCARE, "firmware" }, 1463{ USB_CLASS_APP, USB_SUBCLS_APP_IRDA, DONTCARE, "IrDa" }, 1464{ USB_CLASS_APP, USB_SUBCLS_APP_TEST, DONTCARE, "test" }, 1465 | 1510{ USB_CLASS_APP, USB_SUBCLS_APP_FIRMWARE, DONTCARE, "firmware" }, 1511{ USB_CLASS_APP, USB_SUBCLS_APP_IRDA, DONTCARE, "IrDa" }, 1512{ USB_CLASS_APP, USB_SUBCLS_APP_TEST, DONTCARE, "test" }, 1513 |
1466{ USB_CLASS_HUB, DONTCARE, DONTCARE, "hub" }, | |
1467{ USB_CLASS_COMM, DONTCARE, DONTCARE, "communications" }, | 1514{ USB_CLASS_COMM, DONTCARE, DONTCARE, "communications" }, |
1468{ DONTCARE, DONTCARE, DONTCARE, "device" }, | 1515{ USB_CLASS_HUB, DONTCARE, DONTCARE, "hub" }, 1516{ USB_CLASS_DIAG, DONTCARE, DONTCARE, "diagnostics" }, 1517{ USB_CLASS_MISC, DONTCARE, DONTCARE, "miscellaneous" }, 1518{ DONTCARE, DONTCARE, DONTCARE, "device" } |
1469}; 1470 1471static size_t device_node_name_table_size = 1472 sizeof (device_node_name_table)/sizeof (struct node_name_entry); | 1519}; 1520 1521static size_t device_node_name_table_size = 1522 sizeof (device_node_name_table)/sizeof (struct node_name_entry); |
1523static size_t ia_node_name_table_size = 1524 sizeof (ia_node_name_table)/sizeof (struct node_name_entry); |
|
1473static size_t if_node_name_table_size = 1474 sizeof (if_node_name_table)/sizeof (struct node_name_entry); 1475static size_t combined_node_name_table_size = 1476 sizeof (combined_node_name_table)/sizeof (struct node_name_entry); 1477 1478 1479static void 1480usba_set_node_name(dev_info_t *dip, uint8_t class, uint8_t subclass, 1481 uint8_t protocol, uint_t flag) 1482{ 1483 int i; 1484 size_t size; 1485 node_name_entry_t *node_name_table; 1486 1487 switch (flag) { | 1525static size_t if_node_name_table_size = 1526 sizeof (if_node_name_table)/sizeof (struct node_name_entry); 1527static size_t combined_node_name_table_size = 1528 sizeof (combined_node_name_table)/sizeof (struct node_name_entry); 1529 1530 1531static void 1532usba_set_node_name(dev_info_t *dip, uint8_t class, uint8_t subclass, 1533 uint8_t protocol, uint_t flag) 1534{ 1535 int i; 1536 size_t size; 1537 node_name_entry_t *node_name_table; 1538 1539 switch (flag) { |
1540 /* interface share node names with interface-association */ 1541 case FLAG_INTERFACE_ASSOCIATION_NODE: 1542 node_name_table = ia_node_name_table; 1543 size = ia_node_name_table_size; 1544 break; |
|
1488 case FLAG_INTERFACE_NODE: 1489 node_name_table = if_node_name_table; 1490 size = if_node_name_table_size; 1491 break; 1492 case FLAG_DEVICE_NODE: 1493 node_name_table = device_node_name_table; 1494 size = device_node_name_table_size; 1495 break; --- 10 unchanged lines hidden (view full) --- 1506 int16_t c = node_name_table[i].class; 1507 int16_t s = node_name_table[i].subclass; 1508 int16_t p = node_name_table[i].protocol; 1509 1510 if (((c == DONTCARE) || (c == class)) && 1511 ((s == DONTCARE) || (s == subclass)) && 1512 ((p == DONTCARE) || (p == protocol))) { 1513 char *name = node_name_table[i].name; | 1545 case FLAG_INTERFACE_NODE: 1546 node_name_table = if_node_name_table; 1547 size = if_node_name_table_size; 1548 break; 1549 case FLAG_DEVICE_NODE: 1550 node_name_table = device_node_name_table; 1551 size = device_node_name_table_size; 1552 break; --- 10 unchanged lines hidden (view full) --- 1563 int16_t c = node_name_table[i].class; 1564 int16_t s = node_name_table[i].subclass; 1565 int16_t p = node_name_table[i].protocol; 1566 1567 if (((c == DONTCARE) || (c == class)) && 1568 ((s == DONTCARE) || (s == subclass)) && 1569 ((p == DONTCARE) || (p == protocol))) { 1570 char *name = node_name_table[i].name; |
1571 |
|
1514 (void) ndi_devi_set_nodename(dip, name, 0); 1515 break; 1516 } 1517 } 1518} 1519 1520 1521#ifdef DEBUG --- 567 unchanged lines hidden (view full) --- 2089 2090 ASSERT(!mutex_owned(&(usba_get_usba_device(child_dip)->usb_mutex))); 2091 2092 return (child_dip); 2093} 2094 2095 2096/* | 1572 (void) ndi_devi_set_nodename(dip, name, 0); 1573 break; 1574 } 1575 } 1576} 1577 1578 1579#ifdef DEBUG --- 567 unchanged lines hidden (view full) --- 2147 2148 ASSERT(!mutex_owned(&(usba_get_usba_device(child_dip)->usb_mutex))); 2149 2150 return (child_dip); 2151} 2152 2153 2154/* |
2155 * driver binding at interface association level. the first arg is the parent 2156 * dip. if_count returns amount of interfaces which are associated within 2157 * this interface-association that starts from first_if. 2158 */ 2159/*ARGSUSED*/ 2160dev_info_t * 2161usba_ready_interface_association_node(dev_info_t *dip, 2162 uint_t first_if, 2163 uint_t *if_count) 2164{ 2165 dev_info_t *child_dip = NULL; 2166 usba_device_t *child_ud = usba_get_usba_device(dip); 2167 usb_dev_descr_t *usb_dev_descr; 2168 size_t usb_cfg_length; 2169 uchar_t *usb_cfg; 2170 usb_ia_descr_t ia_descr; 2171 int i, n, rval; 2172 int reg[2]; 2173 size_t size; 2174 usb_port_status_t port_status; 2175 char *force_bind = NULL; 2176 2177 usb_cfg = usb_get_raw_cfg_data(dip, &usb_cfg_length); 2178 2179 mutex_enter(&child_ud->usb_mutex); 2180 2181 usb_dev_descr = child_ud->usb_dev_descr; 2182 2183 /* 2184 * for each interface association, determine all compatible names 2185 */ 2186 USB_DPRINTF_L3(DPRINT_MASK_USBA, usba_log_handle, 2187 "usba_ready_ia_node: " 2188 "port %d, interface = %d, port_status = %x", 2189 child_ud->usb_port, first_if, child_ud->usb_port_status); 2190 2191 /* Parse the interface descriptor */ 2192 size = usb_parse_ia_descr( 2193 usb_cfg, 2194 usb_cfg_length, 2195 first_if, /* interface index */ 2196 &ia_descr, 2197 USB_IA_DESCR_SIZE); 2198 2199 *if_count = 1; 2200 if (size != USB_IA_DESCR_SIZE) { 2201 USB_DPRINTF_L2(DPRINT_MASK_USBA, usba_log_handle, 2202 "parsing ia: size (%lu) != USB_IA_DESCR_SIZE (%d)", 2203 size, USB_IA_DESCR_SIZE); 2204 mutex_exit(&child_ud->usb_mutex); 2205 2206 return (NULL); 2207 } 2208 2209 port_status = child_ud->usb_port_status; 2210 2211 /* create reg property */ 2212 reg[0] = first_if; 2213 reg[1] = child_ud->usb_cfg_value; 2214 2215 mutex_exit(&child_ud->usb_mutex); 2216 2217 /* clone this dip */ 2218 rval = usba_create_child_devi(dip, 2219 "interface-association", 2220 NULL, /* usba_hcdi ops */ 2221 NULL, /* root hub dip */ 2222 port_status, /* port status */ 2223 child_ud, /* share this usba_device */ 2224 &child_dip); 2225 2226 if (rval != USB_SUCCESS) { 2227 2228 goto fail; 2229 } 2230 2231 rval = ndi_prop_update_int_array( 2232 DDI_DEV_T_NONE, child_dip, "reg", reg, 2); 2233 2234 if (rval != DDI_PROP_SUCCESS) { 2235 2236 goto fail; 2237 } 2238 2239 usba_set_node_name(child_dip, ia_descr.bFunctionClass, 2240 ia_descr.bFunctionSubClass, ia_descr.bFunctionProtocol, 2241 FLAG_INTERFACE_ASSOCIATION_NODE); 2242 2243 /* check force binding */ 2244 if (usba_ugen_force_binding == 2245 USBA_UGEN_INTERFACE_ASSOCIATION_BINDING) { 2246 force_bind = "ugen"; 2247 } 2248 2249 /* 2250 * check whether there is another dip with this name and address 2251 */ 2252 ASSERT(usba_find_existing_node(child_dip) == NULL); 2253 2254 mutex_enter(&usba_mutex); 2255 n = 0; 2256 2257 if (force_bind) { 2258 (void) ndi_devi_set_nodename(child_dip, force_bind, 0); 2259 (void) strncpy(usba_name[n++], force_bind, 2260 USBA_MAX_COMPAT_NAME_LEN); 2261 } 2262 2263 /* 1) usbiaVID,PID.REV.configCN.FN */ 2264 (void) sprintf(usba_name[n++], 2265 "usbia%x,%x.%x.config%x.%x", 2266 usb_dev_descr->idVendor, 2267 usb_dev_descr->idProduct, 2268 usb_dev_descr->bcdDevice, 2269 child_ud->usb_cfg_value, 2270 first_if); 2271 2272 /* 2) usbiaVID,PID.configCN.FN */ 2273 (void) sprintf(usba_name[n++], 2274 "usbia%x,%x.config%x.%x", 2275 usb_dev_descr->idVendor, 2276 usb_dev_descr->idProduct, 2277 child_ud->usb_cfg_value, 2278 first_if); 2279 2280 2281 if (ia_descr.bFunctionClass) { 2282 /* 3) usbiaVID,classFC.FSC.FPROTO */ 2283 (void) sprintf(usba_name[n++], 2284 "usbia%x,class%x.%x.%x", 2285 usb_dev_descr->idVendor, 2286 ia_descr.bFunctionClass, 2287 ia_descr.bFunctionSubClass, 2288 ia_descr.bFunctionProtocol); 2289 2290 /* 4) usbiaVID,classFC.FSC */ 2291 (void) sprintf(usba_name[n++], 2292 "usbia%x,class%x.%x", 2293 usb_dev_descr->idVendor, 2294 ia_descr.bFunctionClass, 2295 ia_descr.bFunctionSubClass); 2296 2297 /* 5) usbiaVID,classFC */ 2298 (void) sprintf(usba_name[n++], 2299 "usbia%x,class%x", 2300 usb_dev_descr->idVendor, 2301 ia_descr.bFunctionClass); 2302 2303 /* 6) usbia,classFC.FSC.FPROTO */ 2304 (void) sprintf(usba_name[n++], 2305 "usbia,class%x.%x.%x", 2306 ia_descr.bFunctionClass, 2307 ia_descr.bFunctionSubClass, 2308 ia_descr.bFunctionProtocol); 2309 2310 /* 7) usbia,classFC.FSC */ 2311 (void) sprintf(usba_name[n++], 2312 "usbia,class%x.%x", 2313 ia_descr.bFunctionClass, 2314 ia_descr.bFunctionSubClass); 2315 2316 /* 8) usbia,classFC */ 2317 (void) sprintf(usba_name[n++], 2318 "usbia,class%x", 2319 ia_descr.bFunctionClass); 2320 } 2321 2322 if (usba_get_ugen_binding(child_dip) == 2323 USBA_UGEN_INTERFACE_ASSOCIATION_BINDING) { 2324 /* 9) ugen */ 2325 (void) sprintf(usba_name[n++], "ugen"); 2326 } else { 2327 2328 (void) sprintf(usba_name[n++], "usb,ia"); 2329 } 2330 2331 for (i = 0; i < n; i += 2) { 2332 USB_DPRINTF_L3(DPRINT_MASK_USBA, usba_log_handle, 2333 "compatible name:\t%s\t%s", usba_compatible[i], 2334 (((i+1) < n)? usba_compatible[i+1] : "")); 2335 } 2336 mutex_exit(&usba_mutex); 2337 2338 /* create compatible property */ 2339 if (n) { 2340 rval = ndi_prop_update_string_array( 2341 DDI_DEV_T_NONE, child_dip, 2342 "compatible", (char **)usba_compatible, 2343 n); 2344 2345 if (rval != DDI_PROP_SUCCESS) { 2346 2347 goto fail; 2348 } 2349 } 2350 2351 /* update the address property */ 2352 rval = ndi_prop_update_int(DDI_DEV_T_NONE, child_dip, 2353 "assigned-address", child_ud->usb_addr); 2354 if (rval != DDI_PROP_SUCCESS) { 2355 USB_DPRINTF_L2(DPRINT_MASK_USBA, usba_log_handle, 2356 "usba_ready_interface_node: address update failed"); 2357 } 2358 2359 /* create property with first interface number */ 2360 rval = ndi_prop_update_int(DDI_DEV_T_NONE, child_dip, 2361 "interface", ia_descr.bFirstInterface); 2362 2363 if (rval != DDI_PROP_SUCCESS) { 2364 2365 goto fail; 2366 } 2367 2368 /* create property with the count of interfaces in this ia */ 2369 rval = ndi_prop_update_int(DDI_DEV_T_NONE, child_dip, 2370 "interface-count", ia_descr.bInterfaceCount); 2371 2372 if (rval != DDI_PROP_SUCCESS) { 2373 2374 goto fail; 2375 } 2376 2377 USB_DPRINTF_L2(DPRINT_MASK_USBA, usba_log_handle, 2378 "%s%d port %d: %s, dip = 0x%p", 2379 ddi_node_name(ddi_get_parent(dip)), 2380 ddi_get_instance(ddi_get_parent(dip)), 2381 child_ud->usb_port, ddi_node_name(child_dip), child_dip); 2382 2383 *if_count = ia_descr.bInterfaceCount; 2384 usba_set_usba_device(child_dip, child_ud); 2385 ASSERT(!mutex_owned(&(usba_get_usba_device(child_dip)->usb_mutex))); 2386 2387 return (child_dip); 2388 2389fail: 2390 (void) usba_destroy_child_devi(child_dip, NDI_DEVI_REMOVE); 2391 2392 return (NULL); 2393} 2394 2395 2396/* |
|
2097 * driver binding at interface level, the first arg will be the 2098 * the parent dip 2099 */ 2100/*ARGSUSED*/ 2101dev_info_t * 2102usba_ready_interface_node(dev_info_t *dip, uint_t intf) 2103{ 2104 dev_info_t *child_dip = NULL; --- 74 unchanged lines hidden (view full) --- 2179 if_descr.bInterfaceSubClass, if_descr.bInterfaceProtocol, 2180 FLAG_INTERFACE_NODE); 2181 2182 /* check force binding */ 2183 if (usba_ugen_force_binding == USBA_UGEN_INTERFACE_BINDING) { 2184 force_bind = "ugen"; 2185 } 2186 | 2397 * driver binding at interface level, the first arg will be the 2398 * the parent dip 2399 */ 2400/*ARGSUSED*/ 2401dev_info_t * 2402usba_ready_interface_node(dev_info_t *dip, uint_t intf) 2403{ 2404 dev_info_t *child_dip = NULL; --- 74 unchanged lines hidden (view full) --- 2479 if_descr.bInterfaceSubClass, if_descr.bInterfaceProtocol, 2480 FLAG_INTERFACE_NODE); 2481 2482 /* check force binding */ 2483 if (usba_ugen_force_binding == USBA_UGEN_INTERFACE_BINDING) { 2484 force_bind = "ugen"; 2485 } 2486 |
2187#ifdef DEBUG | |
2188 /* 2189 * check whether there is another dip with this name and address 2190 */ 2191 ASSERT(usba_find_existing_node(child_dip) == NULL); | 2487 /* 2488 * check whether there is another dip with this name and address 2489 */ 2490 ASSERT(usba_find_existing_node(child_dip) == NULL); |
2192#endif | |
2193 2194 mutex_enter(&usba_mutex); 2195 n = 0; 2196 2197 if (force_bind) { 2198 (void) ndi_devi_set_nodename(child_dip, force_bind, 0); 2199 (void) strncpy(usba_name[n++], force_bind, 2200 USBA_MAX_COMPAT_NAME_LEN); --- 617 unchanged lines hidden --- | 2491 2492 mutex_enter(&usba_mutex); 2493 n = 0; 2494 2495 if (force_bind) { 2496 (void) ndi_devi_set_nodename(child_dip, force_bind, 0); 2497 (void) strncpy(usba_name[n++], force_bind, 2498 USBA_MAX_COMPAT_NAME_LEN); --- 617 unchanged lines hidden --- |