changeset 4017:03d59df3a040

6500293 prtdiag utility does not display the information of the pyramid HBA
author mb158278
date Thu, 12 Apr 2007 11:39:20 -0700
parents 6bbba7fb458e
children 72f0f2d75d29
files usr/src/lib/libprtdiag_psr/sparc/ontario/common/ontario.c
diffstat 1 files changed, 31 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/libprtdiag_psr/sparc/ontario/common/ontario.c	Thu Apr 12 09:39:08 2007 -0700
+++ b/usr/src/lib/libprtdiag_psr/sparc/ontario/common/ontario.c	Thu Apr 12 11:39:20 2007 -0700
@@ -88,7 +88,7 @@
 }
 
 static void
-get_slot_number(char *path, struct io_card *card)
+get_slot_number(picl_nodehdl_t nodeh, char *path, struct io_card *card)
 {
 	if (strncmp(path, PCIE_SLOT0, PCIE_COMP_NUM) == 0) {
 		(void) strcpy(card->slot_str, "0");
@@ -99,12 +99,29 @@
 	} else if (strncmp(path, PCIE_SLOT2, PCIE_COMP_NUM) == 0) {
 		(void) strcpy(card->slot_str, "2");
 		card->slot = 2;
-	} else if (strncmp(path, PCIX_SLOT1, strlen(PCIX_SLOT1)) == 0) {
+	} else if ((strncmp(path, PCIX_SLOT1, strlen(PCIX_SLOT1)) == 0) ||
+	    (strncmp(path, PCIX_SLOT0, strlen(PCIX_SLOT0)) == 0)) {
+		char	ua[MAXSTRLEN];
+		int	err;
+
 		(void) strcpy(card->slot_str, "PCIX");
 		card->slot = -1;
-	} else if (strncmp(path, PCIX_SLOT0, strlen(PCIX_SLOT0)) == 0) {
-		(void) strcpy(card->slot_str, "PCIX");
-		card->slot = -1;
+
+		/*
+		 * PCIX_SLOT0 and PCIX_SLOT1 are actually the same path so
+		 * use the unit address to distinguish the slot number.
+		 */
+		err = picl_get_propval_by_name(nodeh, PICL_PROP_UNIT_ADDRESS,
+		    ua, sizeof (ua));
+		if (err == PICL_SUCCESS) {
+			if (ua[0] == '2') {
+				card->slot = 0;
+				(void) strcpy(card->slot_str, "0");
+			} else if (ua[0] == '1') {
+				card->slot = 1;
+				(void) strcpy(card->slot_str, "1");
+			}
+		}
 	} else {
 		(void) strcpy(card->slot_str, IOBOARD);
 		card->slot = -1;
@@ -162,18 +179,17 @@
 		if (err !=  PICL_SUCCESS)
 			return (err);
 
-		if (strcmp(piclclass, "pciex") == 0) {
+		/*
+		 * Skip PCI and PCIEX devices because they will be processed
+		 * later in the picl tree walk.
+		 */
+		if ((strcmp(piclclass, "pci") == 0) ||
+		    (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) {
@@ -184,7 +200,7 @@
 
 		get_bus_type(parent_path, &pci_card);
 
-		get_slot_number(parent_path, &pci_card);
+		get_slot_number(nodeh, parent_path, &pci_card);
 
 		err = picl_get_propval_by_name(nodeh, PICL_PROP_NAME, &name,
 		    sizeof (name));
@@ -324,6 +340,8 @@
 		strlen(ONTARIO_PLATFORM2)) == 0)) {
 		(void) picl_walk_tree_by_class(plafh, "pciex",
 			"pciex", ontario_pci_callback);
+		(void) picl_walk_tree_by_class(plafh, "pci",
+			"pci", ontario_pci_callback);
 	} else if ((strncmp(platbuf, PELTON_PLATFORM,
 		strlen(PELTON_PLATFORM))) == 0) {
 		(void) picl_walk_tree_by_class(plafh, "pciex",