Lines Matching defs:sghsc

48 #include <sys/sghsc.h>
213 * other hand we have register them after the sghsc has been attached.
316 sghsc_t *sghsc;
331 cmn_err(CE_WARN, "sghsc%d: unsupported cmd %d",
336 DEBUGF(1, (CE_NOTE, "attach sghsc driver. "));
343 cmn_err(CE_WARN, "sghsc%d: property %s out of bounds %d\n",
351 sghsc = (sghsc_t *)ddi_get_soft_state(sghsc_state, instance);
353 sghsc->sghsc_dip = dip;
354 sghsc->sghsc_instance = instance;
355 sghsc->sghsc_board = SG_PORTID_TO_BOARD_NUM(portid);
356 sghsc->sghsc_node_id = SG_PORTID_TO_NODEID(portid);
357 sghsc->sghsc_portid = portid;
359 ddi_set_driver_private(dip, sghsc);
361 mutex_init(SGHSC_MUTEX(sghsc), NULL, MUTEX_DRIVER, NULL);
363 rc = sghsc_scctl(SGHSC_GET_NUM_SLOTS, sghsc->sghsc_node_id,
364 sghsc->sghsc_board, 0, (int *)&sghsc->sghsc_num_slots);
367 cmn_err(CE_WARN, "sghsc%d: unable to size node %d / board %d",
368 instance, sghsc->sghsc_node_id, sghsc->sghsc_board);
372 DEBUGF(1, (CE_NOTE, "sghsc%d: node %d / board %d has %d slots",
373 instance, sghsc->sghsc_node_id, sghsc->sghsc_board,
374 sghsc->sghsc_num_slots));
376 switch (sghsc->sghsc_num_slots) {
387 cmn_err(CE_WARN, "sghsc%d: wrong num of slots %d for node %d"
388 " / board %d", instance, sghsc->sghsc_num_slots,
389 sghsc->sghsc_node_id, sghsc->sghsc_board);
393 rc = sghsc_scctl(SGHSC_GET_CPCI_BOARD_TYPE, sghsc->sghsc_node_id,
394 sghsc->sghsc_board, 0, &board_type);
396 DEBUGF(1, (CE_NOTE, "sghsc%d: node %d / board %d is type %d",
397 instance, sghsc->sghsc_node_id, sghsc->sghsc_board, board_type));
399 sghsc->sghsc_slot_table = (sghsc_slot_t *)kmem_zalloc((size_t)
400 (sghsc->sghsc_num_slots * sizeof (sghsc_slot_t)), KM_SLEEP);
403 if (sghsc_register_slots(sghsc, board_type) != DDI_SUCCESS) {
404 DEBUGF(1, (CE_NOTE, "sghsc%d: sghsc_register_slots"
406 instance, sghsc->sghsc_node_id, sghsc->sghsc_board));
410 if (sghsc_connect((caddr_t)sghsc, 0, 0, SGHSC_ALL_SLOTS_ENABLE)
412 DEBUGF(1, (CE_NOTE, "sghsc%d: sghsc_connect failed for"
413 " node %d / board %d", instance, sghsc->sghsc_node_id,
414 sghsc->sghsc_board));
440 cmn_err(CE_WARN, "sghsc%d: failed to register events"
441 " for node %d", instance, sghsc->sghsc_node_id);
449 DEBUGF(1, (CE_NOTE, "sghsc: creating event thread"
450 "for node %d", sghsc->sghsc_node_id));
463 sghsc->sghsc_valid = 1;
472 sghsc_freemem(sghsc);
475 DEBUGF(1, (CE_NOTE, "sghsc%d: attach failed for node %d",
476 instance, sghsc->sghsc_node_id));
477 mutex_destroy(SGHSC_MUTEX(sghsc));
490 sghsc_t *sghsc;
495 sghsc = (sghsc_t *)ddi_get_soft_state(sghsc_state, instance);
497 if (sghsc == NULL)
508 for (i = 0; i < sghsc->sghsc_num_slots; i++) {
509 if (sghsc->sghsc_slot_table[i].handle &&
511 sghsc->sghsc_slot_table[i].handle)) {
513 "sghsc: must detach buses first");
521 sghsc->sghsc_valid = 0;
522 sghsc_freemem(sghsc);
523 mutex_destroy(SGHSC_MUTEX(sghsc));
553 sghsc_register_slots(sghsc_t *sghsc, int board_type)
556 dev_info_t *dip = sghsc->sghsc_dip;
561 DEBUGF(1, (CE_NOTE, "sghsc%d: slot table has %d entries for "
562 "node %d / board %d", sghsc->sghsc_instance, sghsc->sghsc_num_slots,
563 sghsc->sghsc_node_id, sghsc->sghsc_board));
568 if (sghsc->sghsc_slot_table == NULL)
581 switch (sghsc->sghsc_num_slots) {
589 cmn_err(CE_WARN, "sghsc%d: unknown size %d for"
591 sghsc->sghsc_instance,
592 sghsc->sghsc_num_slots,
593 sghsc->sghsc_node_id, sghsc->sghsc_board);
604 cmn_err(CE_WARN, "sghsc%d: unknown type %d for"
605 " node %d / board %d", sghsc->sghsc_instance,
606 board_type, sghsc->sghsc_node_id,
607 sghsc->sghsc_board);
616 for (i = 0; i < sghsc->sghsc_num_slots; i++) {
637 base_id = sghsc->sghsc_portid & SGHSC_SAFARI_ID_EVEN;
638 nexuspath = sghsc->sghsc_slot_table[i].nexus_path;
640 (void) sprintf(nexuspath, SGHSC_PATH, sghsc->sghsc_node_id,
642 sghsc->sghsc_slot_table[i].pci_device_num =
648 slot_info = &sghsc->sghsc_slot_table[i].slot_info;
657 "sg%dslot%d", sghsc->sghsc_board, i);
660 slot_info->pci_dev_num, sghsc->sghsc_node_id,
661 sghsc->sghsc_board));
667 sghsc->sghsc_slot_table[i].slot_ops = slot_ops;
680 * sghsc has no way of knowing it. The HP Framwork will
683 sghsc->sghsc_slot_table[i].flags = SGHSC_SLOT_AUTO_CFG_EN;
684 sghsc->sghsc_slot_table[i].board_type = HPC_BOARD_UNKNOWN;
697 &sghsc->sghsc_slot_table[i].handle,
698 slot_ops, (caddr_t)sghsc, 0)) != 0) {
704 cmn_err(CE_WARN, "sghsc%d: Slot <%s> failed during HPS"
706 sghsc->sghsc_instance, slot_info->pci_slot_name,
707 sghsc->sghsc_node_id, sghsc->sghsc_board);
712 DEBUGF(1, (CE_NOTE, "sghsc registered successfully for"
713 " node %d / board %d", sghsc->sghsc_node_id, sghsc->sghsc_board));
735 sghsc_t *sghsc = (sghsc_t *)op_arg;
738 int slot_num = sghsc_get_slotnum(sghsc, sloth);
743 for (i = 0; i < sghsc->sghsc_num_slots; i++) {
748 sghsc->sghsc_slot_table[i].slot_status =
758 SGHSC_MUTEX_ENTER(sghsc);
760 DEBUGF(1, (CE_NOTE, "sghsc%d: connecting logical slot%d for"
761 " node %d / board %d", sghsc->sghsc_instance, slot_num,
762 sghsc->sghsc_node_id, sghsc->sghsc_board));
770 rc = sghsc_scctl(SGHSC_GET_SLOT_STATUS, sghsc->sghsc_node_id,
771 sghsc->sghsc_board, slot_num, &result);
774 SGHSC_MUTEX_EXIT(sghsc);
779 cmn_err(CE_NOTE, "sghsc%d: unable to stat slot %d for"
780 " node %d / board %d", sghsc->sghsc_instance, slot_num,
781 sghsc->sghsc_node_id, sghsc->sghsc_board);
782 sghsc->sghsc_slot_table[i].slot_status = HPC_SLOT_UNKNOWN;
783 SGHSC_MUTEX_EXIT(sghsc);
789 sghsc->sghsc_slot_table[i].slot_status = HPC_SLOT_EMPTY;
790 SGHSC_MUTEX_EXIT(sghsc);
794 rc = sghsc_scctl(SGHSC_SET_SLOT_POWER_ON, sghsc->sghsc_node_id,
795 sghsc->sghsc_board, slot_num, &result);
797 cmn_err(CE_WARN, "sghsc%d: unable to poweron slot %d for"
798 " node %d / board %d", sghsc->sghsc_instance,
799 slot_num, sghsc->sghsc_node_id, sghsc->sghsc_board);
800 SGHSC_MUTEX_EXIT(sghsc);
803 sghsc->sghsc_slot_table[slot_num].slot_status =
807 SGHSC_MUTEX_EXIT(sghsc);
825 sghsc_t *sghsc = (sghsc_t *)op_arg;
828 int slot_num = sghsc_get_slotnum(sghsc, sloth);
839 SGHSC_MUTEX_ENTER(sghsc);
845 if (sghsc->sghsc_slot_table[slot_num].slot_status !=
847 SGHSC_MUTEX_EXIT(sghsc);
851 rc = sghsc_scctl(SGHSC_SET_SLOT_POWER_OFF, sghsc->sghsc_node_id,
852 sghsc->sghsc_board, slot_num, &result);
854 cmn_err(CE_WARN, "sghsc%d: unable to poweroff slot %d for"
855 " node %d / board %d", sghsc->sghsc_instance,
856 slot_num, sghsc->sghsc_node_id, sghsc->sghsc_board);
857 SGHSC_MUTEX_EXIT(sghsc);
860 sghsc->sghsc_slot_table[slot_num].slot_status =
864 SGHSC_MUTEX_EXIT(sghsc);
881 sghsc_t *sghsc = (sghsc_t *)op_arg;
882 int slot = sghsc_get_slotnum(sghsc, sloth);
887 if ((sghsc == NULL) || (slot < 0) ||
888 (slot >= sghsc->sghsc_num_slots)) {
889 cmn_err(CE_WARN, "sghsc%d: sghsc_control fails with slot = %d"
891 sghsc->sghsc_instance, slot, sghsc->sghsc_num_slots,
892 sloth, sghsc->sghsc_node_id, sghsc->sghsc_board);
896 SGHSC_MUTEX_ENTER(sghsc);
906 DEBUGF(1, (CE_NOTE, "sghsc%d: sghsc_control"
908 sghsc->sghsc_instance, sghsc->sghsc_node_id,
909 sghsc->sghsc_board, slot));
916 error = sghsc_led_state(sghsc, sloth,
920 cmn_err(CE_WARN, "sghsc%d: sghsc_control"
923 " slot handle 0x%p", sghsc->sghsc_instance,
924 ledinfo->led, sghsc->sghsc_node_id,
925 sghsc->sghsc_board, sloth);
939 DEBUGF(1, (CE_NOTE, "sghsc%d: sghsc_control"
941 sghsc->sghsc_instance, sghsc->sghsc_node_id,
942 sghsc->sghsc_board, slot));
949 DEBUGF(1, (CE_NOTE, "sghsc:"
954 DEBUGF(1, (CE_NOTE, "sghsc:"
962 DEBUGF(1, (CE_NOTE, "sghsc%d: sghsc_control"
964 sghsc->sghsc_instance, sghsc->sghsc_node_id,
965 sghsc->sghsc_board, slot));
970 rc = sghsc_scctl(SGHSC_GET_SLOT_STATUS, sghsc->sghsc_node_id,
971 sghsc->sghsc_board, slot, &result);
979 cmn_err(CE_NOTE, "sghsc%d: unable to stat slot %d for "
980 "node %d / board %d", sghsc->sghsc_instance, slot,
981 sghsc->sghsc_node_id, sghsc->sghsc_board);
982 sghsc->sghsc_slot_table[slot].slot_status =
993 sghsc->sghsc_slot_table[slot].slot_status =
996 sghsc->sghsc_slot_table[slot].slot_status =
998 } else if (sghsc->sghsc_slot_table[slot].slot_status ==
1000 sghsc->sghsc_slot_table[slot].slot_status ==
1002 sghsc->sghsc_slot_table[slot].slot_status =
1009 sghsc->sghsc_slot_table[slot].slot_status;
1015 DEBUGF(1, (CE_NOTE, "sghsc%d: sghsc_control"
1017 sghsc->sghsc_instance, sghsc->sghsc_node_id,
1018 sghsc->sghsc_board, slot));
1021 cmn_err(CE_NOTE, "sghsc%d:"
1023 sghsc->sghsc_instance, sghsc->sghsc_node_id,
1024 sghsc->sghsc_board, slot);
1029 if (sghsc->sghsc_slot_table[slot].flags &
1032 sghsc->sghsc_node_id, sghsc->sghsc_board,
1045 DEBUGF(1, (CE_NOTE, "sghsc%d: sghsc_control "
1047 sghsc->sghsc_instance, sghsc->sghsc_node_id,
1048 sghsc->sghsc_board, slot));
1050 SGHSC_MUTEX_EXIT(sghsc);
1058 cmn_err(CE_NOTE, "sghsc%d: node %d / board %d "
1059 "slot %d unconfigured", sghsc->sghsc_instance,
1060 sghsc->sghsc_node_id, sghsc->sghsc_board, slot);
1067 DEBUGF(1, (CE_NOTE, "sghsc%d: sghsc_control"
1069 sghsc->sghsc_instance, sghsc->sghsc_node_id,
1070 sghsc->sghsc_board, slot));
1073 sghsc->sghsc_slot_table[slot].board_type;
1079 DEBUGF(1, (CE_NOTE, "sghsc%d: sghsc_control"
1081 sghsc->sghsc_instance, sghsc->sghsc_node_id,
1082 sghsc->sghsc_board, slot));
1084 sghsc->sghsc_slot_table[slot].flags |= SGHSC_SLOT_AUTO_CFG_EN;
1091 rc = sghsc_scctl(SGHSC_SET_ENUM_CLEARED, sghsc->sghsc_node_id,
1092 sghsc->sghsc_board, slot, &result);
1095 cmn_err(CE_WARN, "sghsc%d: unable to arm ENUM for"
1097 sghsc->sghsc_instance, sghsc->sghsc_node_id,
1098 sghsc->sghsc_board, slot);
1102 DEBUGF(1, (CE_NOTE, "sghsc%d: sghsc_control"
1104 sghsc->sghsc_instance, sghsc->sghsc_node_id,
1105 sghsc->sghsc_board, slot));
1107 sghsc->sghsc_slot_table[slot].flags &= ~SGHSC_SLOT_AUTO_CFG_EN;
1120 DEBUGF(1, (CE_CONT, "sghsc%d: sghsc_control "
1121 "request (0x%x) not supported", sghsc->sghsc_instance,
1128 SGHSC_MUTEX_EXIT(sghsc);
1141 sghsc_led_state(sghsc_t *sghsc, hpc_slot_t sloth, int op,
1148 slot_num = sghsc_get_slotnum(sghsc, sloth);
1149 rval = sghsc_scctl(SGHSC_GET_SLOT_STATUS, sghsc->sghsc_node_id,
1150 sghsc->sghsc_board, slot_num, &result);
1196 sghsc_get_slotnum(sghsc_t *sghsc, hpc_slot_t sloth)
1200 if (sloth == NULL || sghsc == NULL)
1203 for (i = 0; i < sghsc->sghsc_num_slots; i++) {
1205 if (sghsc->sghsc_slot_table[i].handle == sloth)
1312 cmn_err(CE_WARN, "sghsc: unrecognized action code 0x%x\n",
1317 "sghsc: sending mbox command type=%d subtype=0x%x size=%d buf=%p",
1322 "sghsc: sending buf cmd_id=0x%x node_id=0x%x board=0x%x "
1334 DEBUGF(1, (CE_NOTE, "sghsc: mailbox command error = 0x%x, "
1339 DEBUGF(1, (CE_NOTE, "sghsc: reply request status=0x%x",
1341 DEBUGF(1, (CE_NOTE, "sghsc: reply resp status=0x%x",
1343 DEBUGF(1, (CE_NOTE, "sghsc: reply buf cmd_id=0x%x result=0x%x\n",
1348 DEBUGF(1, (CE_NOTE, "sghsc: node %d / board %d has %d slots",
1356 DEBUGF(1, (CE_NOTE, "sghsc: cpower on"));
1359 DEBUGF(1, (CE_NOTE, "sghsc: power led on"));
1362 DEBUGF(1, (CE_NOTE, "sghsc: fault led on"));
1365 DEBUGF(1, (CE_NOTE, "sghsc: remove(hp) led on"));
1368 DEBUGF(1, (CE_NOTE, "sghsc: slot empty"));
1374 "sghsc: slot condition(hot swap status) is 0x%x", tmp));
1378 "sghsc: freq cap %x", cmd_info_r_p->result &
1383 "sghsc: freq setting %x", cmd_info_r_p->result &
1388 DEBUGF(1, (CE_NOTE, "sghsc: healthy"));
1391 DEBUGF(1, (CE_NOTE, "sghsc: in reset"));
1394 DEBUGF(1, (CE_NOTE, "sghsc: power good"));
1397 DEBUGF(1, (CE_NOTE, "sghsc: power fault"));
1400 DEBUGF(1, (CE_NOTE, "sghsc: pci present"));
1414 sghsc_freemem(sghsc_t *sghsc)
1422 for (i = 0; i < sghsc->sghsc_num_slots; i++) {
1423 if (sghsc->sghsc_slot_table[i].slot_ops)
1424 hpc_free_slot_ops(sghsc->sghsc_slot_table[i].slot_ops);
1425 if (sghsc->sghsc_slot_table[i].handle)
1427 &sghsc->sghsc_slot_table[i].handle);
1431 kmem_free(sghsc->sghsc_slot_table,
1432 (size_t)(sghsc->sghsc_num_slots * sizeof (sghsc_slot_t)));
1445 sghsc_t *sghsc;
1448 sghsc = (sghsc_t *)ddi_get_soft_state(sghsc_state, instance);
1450 if (sghsc == NULL || sghsc->sghsc_node_id != node_id ||
1451 sghsc->sghsc_board != board)
1457 if (sghsc->sghsc_num_slots < (slot + 1)) {
1458 cmn_err(CE_WARN, "sghsc%d: slot data corruption at"
1463 if (sghsc->sghsc_valid == 0)
1469 return (sghsc->sghsc_slot_table[slot].handle);
1490 DEBUGF(1, (CE_NOTE, "sghsc: sghsc_event_handler called"))
1496 ("sghsc: sghsc_event_handler argument is null\n"));
1503 * On a board disconnect sghsc soft state may not exist
1508 DEBUGF(1, (CE_WARN, "sghsc: slot info not available for"
1517 cmn_err(CE_WARN, "sghsc: soft state not available for"
1523 DEBUGF(1, (CE_NOTE, "sghsc: node %d", rsp_data->node_id));
1524 DEBUGF(1, (CE_NOTE, "sghsc: board %d", rsp_data->board));
1525 DEBUGF(1, (CE_NOTE, "sghsc: slot %d", rsp_data->slot));
1526 DEBUGF(1, (CE_NOTE, "sghsc: event info %d", rsp_data->info));
1530 DEBUGF(1, (CE_NOTE, "sghsc: card inserted node %d / board %d"
1539 DEBUGF(1, (CE_NOTE, "sghsc: card removed node %d / board %d"
1548 DEBUGF(1, (CE_NOTE, "sghsc: power on node %d / board %d"
1553 DEBUGF(1, (CE_NOTE, "sghsc: power off node %d / board %d"
1558 DEBUGF(1, (CE_NOTE, "sghsc: healthy lost node %d / board %d"
1563 DEBUGF(1, (CE_NOTE, "sghsc: ENUM generated for node %d /"
1568 DEBUGF(1, (CE_NOTE, "sghsc: unrecognized event info for"
1581 cmn_err(CE_WARN, "sghsc: no space to store #ENUM info");
1601 sghsc_t *sghsc;
1622 sghsc = sghsc_find_softstate(rsp_data.node_id,
1624 if (sghsc == NULL)
1631 if (!(sghsc->sghsc_slot_table[rsp_data.slot].flags &
1639 rc = sghsc_connect((caddr_t)sghsc, sloth,
1642 cmn_err(CE_WARN, "sghsc:"
1659 "sghsc: unable to clear ENUM"));
1668 "sghsc: unable to ACK cleared ENUM"));
1680 "sghsc: could not process ENUM"));
1685 DEBUGF(1, (CE_NOTE, "sghsc: thread_exit"));
1701 sghsc_t *sghsc;
1704 sghsc = (sghsc_t *)ddi_get_soft_state(sghsc_state, instance);
1706 if (sghsc == NULL || sghsc->sghsc_node_id != node_id ||
1707 sghsc->sghsc_board != board)
1710 if (sghsc->sghsc_num_slots < (slot + 1)) {
1711 cmn_err(CE_WARN, "sghsc%d: "
1716 if (sghsc->sghsc_valid == 0)
1722 return (sghsc);
1725 cmn_err(CE_WARN, "sghsc: soft state not found");