Exemple #1
0
/*
 * Print adapter configuration information
 * 
 * Arguments:
 *	si	pointer to a struct air_cfg_rsp
 *
 * Returns:
 *	none
 *
 */
void
print_cfg_info(struct air_cfg_rsp *si)
{
	const char	*adapter, *bus, *media, *vendor;

	/*
	 * Print a header if it hasn't been done yet.
	 */
	if (!cfg_hdr) {
		printf(CFG_HDR);
		cfg_hdr = 1;
	}

	/*
	 * Format the vendor name and adapter type
	 */
	vendor = get_vendor(si->acp_vendor);
	adapter = get_adapter(si->acp_device);

	/*
	 * Format the communications medium
	 */
	media = get_media_type(si->acp_media);
	bus = get_bus_type(si->acp_bustype);

	/*
	 * Print the ARP server information
	 */
	printf("%-8s  %-8s  %-8s  %-14s  %-4s  %ld\n",
			si->acp_intf,
			vendor,
			adapter,
			media,
			bus,
			si->acp_serial);
	printf("    MAC address = %s\n",
			format_mac_addr(&si->acp_macaddr));
	printf("    Hardware version = %s\n", si->acp_hard_vers);
	printf("    Firmware version = %s\n", si->acp_firm_vers);
}
Exemple #2
0
/* ARGSUSED */
static int
montoya_pci_callback(picl_nodehdl_t pcih, void *args)
{
    int		err = PICL_SUCCESS;
    picl_nodehdl_t	nodeh;
    char		path[MAXSTRLEN];
    char		parent_path[MAXSTRLEN];
    char		piclclass[PICL_CLASSNAMELEN_MAX];
    char		name[MAXSTRLEN];
    char		model[MAXSTRLEN];
    char		*compatible;
    char		binding_name[MAXSTRLEN];
    struct io_card	pci_card;
    int32_t		instance;

    err = picl_get_propval_by_name(pcih, PICL_PROP_DEVFS_PATH, parent_path,
                                   sizeof (parent_path));
    if (err != PICL_SUCCESS) {
        return (err);
    }

    /* Walk through the children */

    err = picl_get_propval_by_name(pcih, PICL_PROP_CHILD, &nodeh,
                                   sizeof (picl_nodehdl_t));

    while (err == PICL_SUCCESS) {
        err = picl_get_propval_by_name(nodeh, PICL_PROP_CLASSNAME,
                                       piclclass, sizeof (piclclass));
        if (err !=  PICL_SUCCESS)
            return (err);

        if (strcmp(piclclass, PCIEX) == 0) {
            err = picl_get_propval_by_name(nodeh, PICL_PROP_PEER,
                                           &nodeh, sizeof (picl_nodehdl_t));
            continue;
        }

        if (strcmp(piclclass, PICL_CLASS_PCI) == 0) {
            err = picl_get_propval_by_name(nodeh, PICL_PROP_CHILD,
                                           &nodeh, sizeof (picl_nodehdl_t));
            continue;
        }

        err = picl_get_propval_by_name(nodeh, PICL_PROP_DEVFS_PATH,
                                       path, sizeof (path));
        if (err != PICL_SUCCESS) {
            return (err);
        }

        (void) strlcpy(pci_card.notes, path, sizeof (pci_card.notes));

        get_bus_type(parent_path, &pci_card);

        get_slot_number(parent_path, &pci_card);

        err = picl_get_propval_by_name(nodeh, PICL_PROP_NAME, &name,
                                       sizeof (name));
        if (err == PICL_PROPNOTFOUND)
            (void) strcpy(name, "");
        else if (err != PICL_SUCCESS)
            return (err);

        /* Figure NAC name */
        if ((strcmp(name, NETWORK) == 0 ||
                strcmp(name, ETHERNET) == 0) &&
                (strcmp(pci_card.slot_str, MOTHERBOARD) == 0)) {
            instance = montoya_get_network_instance(path);

            (void) snprintf(pci_card.status,
                            sizeof (pci_card.status), "%s/%s%d", MOTHERBOARD,
                            "NET", instance);
        } else {
            if (pci_card.slot != -1) {
                (void) snprintf(pci_card.status,
                                sizeof (pci_card.status), "%s/%s%d",
                                IOBOARD, pci_card.bus_type, pci_card.slot);
            } else {
                (void) snprintf(pci_card.status,
                                sizeof (pci_card.status),
                                "%s/%s", MOTHERBOARD, pci_card.bus_type);
            }
        }

        /*
         * Get the name of this card. If binding_name is found,
         * name will be <nodename>-<binding_name>
         */

        err = picl_get_propval_by_name(nodeh, PICL_PROP_BINDING_NAME,
                                       &binding_name, sizeof (binding_name));
        if (err == PICL_PROPNOTFOUND) {
            /*
             * if compatible prop is found, name will be
             * <nodename>-<compatible>
             */
            err = montoya_get_first_compatible_value(nodeh,
                    &compatible);
            if (err == PICL_SUCCESS) {
                (void) strlcat(name, "-", MAXSTRLEN);
                (void) strlcat(name, compatible, MAXSTRLEN);
                free(compatible);
            } else if (err != PICL_PROPNOTFOUND) {
                return (err);
            }
        } else if (err != PICL_SUCCESS) {
            return (err);
        } else if (strcmp(name, binding_name) != 0) {
            (void) strlcat(name, "-", MAXSTRLEN);
            (void) strlcat(name, binding_name, MAXSTRLEN);
        }

        (void) strlcpy(pci_card.name, name, sizeof (pci_card.name));

        /* Get the model of this card */

        err = picl_get_propval_by_name(nodeh, OBP_PROP_MODEL,
                                       &model, sizeof (model));
        if (err == PICL_PROPNOTFOUND)
            (void) strcpy(model, "");
        else if (err != PICL_SUCCESS)
            return (err);
        (void) strlcpy(pci_card.model, model, sizeof (pci_card.model));

        /* Print NAC name */
        log_printf("%-11s", pci_card.status);
        /* Print IO Type */
        log_printf("%6s", pci_card.bus_type);
        /* Print Slot # */
        log_printf("%5s", pci_card.slot_str);
        /* Print Parent Path */
        log_printf("%46.45s", pci_card.notes);
        /* Printf Card Name */
        if (strlen(pci_card.name) > 24)
            log_printf("%25.24s+", pci_card.name);
        else
            log_printf("%26s", pci_card.name);
        /* Print Card Model */
        if (strlen(pci_card.model) > 10)
            log_printf("%10.9s+", pci_card.model);
        else
            log_printf("%10s", pci_card.model);
        log_printf("\n");

        err = picl_get_propval_by_name(nodeh, PICL_PROP_PEER, &nodeh,
                                       sizeof (picl_nodehdl_t));

    }

    return (PICL_WALK_CONTINUE);
}
Exemple #3
0
static int
do_wscan(char letter, int show_bt, int scsi_scan)
{
    int k, j, n;
    struct storage_elem * sp;

    if (scsi_scan < 2) {
        k = enum_pds();
        if (k)
            return k;
        k = enum_cdroms();
        if (k)
            return k;
        k = enum_tapes();
        if (k)
            return k;
        k = enum_volumes(letter);
        if (k)
            return k;

        for (k = 0; k < next_unused_elem; ++k) {
            sp = storage_arr + k;
            if ('\0' == sp->name[0])
                continue;
            printf("%-7s ", sp->name);
            n = strlen(sp->volume_letters);
            if (0 == n)
                printf("        ");
            else if (1 == n)
                printf("[%s]     ", sp->volume_letters);
            else if (2 == n)
                printf("[%s]    ", sp->volume_letters);
            else if (3 == n)
                printf("[%s]   ", sp->volume_letters);
            else if (4 == n)
                printf("[%s]  ", sp->volume_letters);
            else
                printf("[%4s+] ", sp->volume_letters);
            if (sp->qp_descriptor_valid) {
                if (show_bt)
                    printf("<%s>  ",
                           get_bus_type(sp->qp_descriptor.desc.BusType));
                j = sp->qp_descriptor.desc.VendorIdOffset;
                if (j > 0)
                    printf("%s  ", sp->qp_descriptor.raw + j);
                j = sp->qp_descriptor.desc.ProductIdOffset;
                if (j > 0)
                    printf("%s  ", sp->qp_descriptor.raw + j);
                j = sp->qp_descriptor.desc.ProductRevisionOffset;
                if (j > 0)
                    printf("%s  ", sp->qp_descriptor.raw + j);
                j = sp->qp_descriptor.desc.SerialNumberOffset;
                if (j > 0)
                    printf("%s", sp->qp_descriptor.raw + j);
                printf("\n");
                if (verbose > 2)
                    dStrHexErr(sp->qp_descriptor.raw, 144, 0);
            } else
                printf("\n");
            if ((verbose > 3) && sp->qp_uid_valid) {
                printf("  UID valid, in hex:\n");
                dStrHexErr(sp->qp_uid.raw, sizeof(sp->qp_uid.raw), 1);
            }
        }
    }

    if (scsi_scan) {
        if (scsi_scan < 2)
            printf("\n");
        enum_scsi_adapters();
    }
    return 0;
}