1066 DBG_F(2, (stdout, "%c\n", buf[i]));
1067 }
1068 buf[i] = '\0'; str++;
1069 DBG(2, ("buf = %s\n", buf));
1070
1071 /* ACTIVE=3,ATTN=2,POWER=1,FAULT=0 */
1072 if (strcmp(buf, led_strs[POWER]) == 0)
1073 led_info.led = HPC_POWER_LED;
1074 else if (strcmp(buf, led_strs[FAULT]) == 0)
1075 led_info.led = HPC_FAULT_LED;
1076 else if (strcmp(buf, led_strs[ATTN]) == 0)
1077 led_info.led = HPC_ATTN_LED;
1078 else if (strcmp(buf, led_strs[ACTIVE]) == 0)
1079 led_info.led = HPC_ACTIVE_LED;
1080 else return (CFGA_INVAL);
1081
1082 len = strlen(func_strs[MODE]);
1083 if ((strncmp(str, func_strs[MODE], len) == 0) &&
1084 (*(str+(len)) == '=')) {
1085 for (str = (str+(++len)), i = 0;
1086 *str != NULL; i++, str++) {
1087 buf[i] = *str;
1088
1089 }
1090 }
1091 buf[i] = '\0';
1092 DBG(2, ("buf_mode= %s\n", buf));
1093
1094 /* ON = 1, OFF = 0 */
1095 if (strcmp(buf, mode_strs[ON]) == 0)
1096 led_info.state = HPC_LED_ON;
1097 else if (strcmp(buf, mode_strs[OFF]) == 0)
1098 led_info.state = HPC_LED_OFF;
1099 else if (strcmp(buf, mode_strs[BLINK]) == 0)
1100 led_info.state = HPC_LED_BLINK;
1101 else return (CFGA_INVAL);
1102
1103 /* sendin */
1104 build_control_data(&iocdata,
1105 HPC_CTRL_SET_LED_STATE,
1106 (void *)&led_info);
1264 return (fixup_slotname(rval, intp, slotarg));
1265 }
1266 prom_prop = di_prom_prop_next(ph, din, prom_prop);
1267 }
1268 *slotarg->slotnames[slotarg->minor] = '\0';
1269 return (DI_WALK_TERMINATE);
1270 } else
1271 return (DI_WALK_CONTINUE);
1272 }
1273
1274 static int
1275 find_physical_slot_names(const char *devcomp, struct searcharg *slotarg)
1276 {
1277 di_node_t root_node;
1278
1279 DBG(1, ("find_physical_slot_names\n"));
1280
1281 if ((root_node = di_init("/", DINFOCPYALL|DINFOPATH))
1282 == DI_NODE_NIL) {
1283 DBG(1, ("di_init() failed\n"));
1284 return (NULL);
1285 }
1286
1287 slotarg->devpath = (char *)devcomp;
1288
1289 if ((slotarg->promp = di_prom_init()) == DI_PROM_HANDLE_NIL) {
1290 DBG(1, ("di_prom_init() failed\n"));
1291 di_fini(root_node);
1292 return (NULL);
1293 }
1294
1295 (void) di_walk_minor(root_node, "ddi_ctl:attachment_point:pci",
1296 0, (void *)slotarg, find_slotname);
1297
1298 di_prom_fini(slotarg->promp);
1299 di_fini(root_node);
1300 if (slotarg->slotnames[0] != NULL)
1301 return (0);
1302 else
1303 return (-1);
1304 }
1305
1306 static void
1307 get_type(hpc_board_type_t boardtype, hpc_card_info_t cardinfo, char *buf)
1308 {
1309 int i;
1310
1311 DBG(1, ("class: %i\n", cardinfo.base_class));
1312 DBG(1, ("subclass: %i\n", cardinfo.sub_class));
|
1066 DBG_F(2, (stdout, "%c\n", buf[i]));
1067 }
1068 buf[i] = '\0'; str++;
1069 DBG(2, ("buf = %s\n", buf));
1070
1071 /* ACTIVE=3,ATTN=2,POWER=1,FAULT=0 */
1072 if (strcmp(buf, led_strs[POWER]) == 0)
1073 led_info.led = HPC_POWER_LED;
1074 else if (strcmp(buf, led_strs[FAULT]) == 0)
1075 led_info.led = HPC_FAULT_LED;
1076 else if (strcmp(buf, led_strs[ATTN]) == 0)
1077 led_info.led = HPC_ATTN_LED;
1078 else if (strcmp(buf, led_strs[ACTIVE]) == 0)
1079 led_info.led = HPC_ACTIVE_LED;
1080 else return (CFGA_INVAL);
1081
1082 len = strlen(func_strs[MODE]);
1083 if ((strncmp(str, func_strs[MODE], len) == 0) &&
1084 (*(str+(len)) == '=')) {
1085 for (str = (str+(++len)), i = 0;
1086 *str != '\0'; i++, str++) {
1087 buf[i] = *str;
1088
1089 }
1090 }
1091 buf[i] = '\0';
1092 DBG(2, ("buf_mode= %s\n", buf));
1093
1094 /* ON = 1, OFF = 0 */
1095 if (strcmp(buf, mode_strs[ON]) == 0)
1096 led_info.state = HPC_LED_ON;
1097 else if (strcmp(buf, mode_strs[OFF]) == 0)
1098 led_info.state = HPC_LED_OFF;
1099 else if (strcmp(buf, mode_strs[BLINK]) == 0)
1100 led_info.state = HPC_LED_BLINK;
1101 else return (CFGA_INVAL);
1102
1103 /* sendin */
1104 build_control_data(&iocdata,
1105 HPC_CTRL_SET_LED_STATE,
1106 (void *)&led_info);
1264 return (fixup_slotname(rval, intp, slotarg));
1265 }
1266 prom_prop = di_prom_prop_next(ph, din, prom_prop);
1267 }
1268 *slotarg->slotnames[slotarg->minor] = '\0';
1269 return (DI_WALK_TERMINATE);
1270 } else
1271 return (DI_WALK_CONTINUE);
1272 }
1273
1274 static int
1275 find_physical_slot_names(const char *devcomp, struct searcharg *slotarg)
1276 {
1277 di_node_t root_node;
1278
1279 DBG(1, ("find_physical_slot_names\n"));
1280
1281 if ((root_node = di_init("/", DINFOCPYALL|DINFOPATH))
1282 == DI_NODE_NIL) {
1283 DBG(1, ("di_init() failed\n"));
1284 return (0);
1285 }
1286
1287 slotarg->devpath = (char *)devcomp;
1288
1289 if ((slotarg->promp = di_prom_init()) == DI_PROM_HANDLE_NIL) {
1290 DBG(1, ("di_prom_init() failed\n"));
1291 di_fini(root_node);
1292 return (0);
1293 }
1294
1295 (void) di_walk_minor(root_node, "ddi_ctl:attachment_point:pci",
1296 0, (void *)slotarg, find_slotname);
1297
1298 di_prom_fini(slotarg->promp);
1299 di_fini(root_node);
1300 if (slotarg->slotnames[0] != NULL)
1301 return (0);
1302 else
1303 return (-1);
1304 }
1305
1306 static void
1307 get_type(hpc_board_type_t boardtype, hpc_card_info_t cardinfo, char *buf)
1308 {
1309 int i;
1310
1311 DBG(1, ("class: %i\n", cardinfo.base_class));
1312 DBG(1, ("subclass: %i\n", cardinfo.sub_class));
|