summaryrefslogtreecommitdiff
path: root/usr/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib')
-rw-r--r--usr/src/lib/fm/topo/libtopo/common/topo_2xml.c23
-rw-r--r--usr/src/lib/fm/topo/libtopo/common/topo_hc.h1
-rw-r--r--usr/src/lib/fm/topo/libtopo/common/topo_parse.h1
-rw-r--r--usr/src/lib/fm/topo/modules/common/pcibus/did_props.c26
-rw-r--r--usr/src/lib/fm/topo/modules/common/pcibus/did_props.h3
5 files changed, 51 insertions, 3 deletions
diff --git a/usr/src/lib/fm/topo/libtopo/common/topo_2xml.c b/usr/src/lib/fm/topo/libtopo/common/topo_2xml.c
index 088a290849..0f3e69ae70 100644
--- a/usr/src/lib/fm/topo/libtopo/common/topo_2xml.c
+++ b/usr/src/lib/fm/topo/libtopo/common/topo_2xml.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -107,7 +107,7 @@ txml_print_prop(topo_hdl_t *thp, FILE *fp, topo_propval_t *pv)
{
int err;
char *fmri = NULL;
- char vbuf[INT64BUFSZ], tbuf[10], *pval;
+ char vbuf[INT64BUFSZ], tbuf[10], *pval, *aval;
nvpair_t *nvp;
nvp = nvlist_next_nvpair(pv->tp_val, NULL);
@@ -169,6 +169,25 @@ txml_print_prop(topo_hdl_t *thp, FILE *fp, topo_propval_t *pv)
(void) snprintf(tbuf, 10, "%s", FMRI);
break;
}
+ case TOPO_TYPE_UINT32_ARRAY: {
+ uint32_t *val;
+ uint_t nelem, i;
+
+ (void) nvpair_value_uint32_array(nvp, &val, &nelem);
+
+ if (nelem > 0) {
+ aval = calloc((nelem*9-1), sizeof (uchar_t));
+
+ (void) sprintf(aval, "0x%x", val[0]);
+ for (i = 1; i < nelem; i++) {
+ (void) sprintf(vbuf, " 0x%x", val[i]);
+ (void) strcat(aval, vbuf);
+ }
+ (void) snprintf(tbuf, 10, "%s", UInt32_Arr);
+ pval = aval;
+ }
+ break;
+ }
}
begin_end_element(fp, Propval, Name, pv->tp_name, Type, tbuf,
diff --git a/usr/src/lib/fm/topo/libtopo/common/topo_hc.h b/usr/src/lib/fm/topo/libtopo/common/topo_hc.h
index 83eeb991e8..ba49a8bbb0 100644
--- a/usr/src/lib/fm/topo/libtopo/common/topo_hc.h
+++ b/usr/src/lib/fm/topo/libtopo/common/topo_hc.h
@@ -91,6 +91,7 @@ extern "C" {
#define TOPO_PCI_EXCAP "extended-capabilities"
#define TOPO_PCI_BDF "BDF"
#define TOPO_PCI_CLASS "class-code"
+#define TOPO_PCI_AADDR "assigned-addresses"
#ifdef __cplusplus
}
diff --git a/usr/src/lib/fm/topo/libtopo/common/topo_parse.h b/usr/src/lib/fm/topo/libtopo/common/topo_parse.h
index f60bf6ec21..bed769dac0 100644
--- a/usr/src/lib/fm/topo/libtopo/common/topo_parse.h
+++ b/usr/src/lib/fm/topo/libtopo/common/topo_parse.h
@@ -155,6 +155,7 @@ typedef struct tf_info {
#define Topology "topology"
#define Type "type"
#define UInt32 "uint32"
+#define UInt32_Arr "uint32arr"
#define UInt64 "uint64"
#define Value "value"
#define Verify "verify"
diff --git a/usr/src/lib/fm/topo/modules/common/pcibus/did_props.c b/usr/src/lib/fm/topo/modules/common/pcibus/did_props.c
index 1cd14cb709..07406fdb4e 100644
--- a/usr/src/lib/fm/topo/modules/common/pcibus/did_props.c
+++ b/usr/src/lib/fm/topo/modules/common/pcibus/did_props.c
@@ -64,6 +64,8 @@ static int maybe_di_chars_copy(tnode_t *, did_t *,
const char *, const char *, const char *);
static int maybe_di_uint_to_str(tnode_t *, did_t *,
const char *, const char *, const char *);
+static int AADDR_set(tnode_t *, did_t *,
+ const char *, const char *, const char *);
/*
* Arrays of "property translation routines" to set the properties a
@@ -101,6 +103,7 @@ txprop_t Fn_common_props[] = {
{ NULL, &pci_pgroup, TOPO_PCI_EXCAP, EXCAP_set },
{ DI_CLASSPROP, &pci_pgroup, TOPO_PCI_CLASS, maybe_di_uint_to_str },
{ DI_VENDIDPROP, &pci_pgroup, TOPO_PCI_VENDID, maybe_di_uint_to_str },
+ { DI_AADDRPROP, &pci_pgroup, TOPO_PCI_AADDR, AADDR_set },
{ NULL, &protocol_pgroup, TOPO_PROP_LABEL, label_set },
{ NULL, &protocol_pgroup, TOPO_PROP_FRU, FRU_set },
{ NULL, &protocol_pgroup, TOPO_PROP_ASRU, ASRU_set }
@@ -792,6 +795,29 @@ maybe_di_uint_to_str(tnode_t *tn, did_t *pd,
return (uint_to_strprop(did_mod(pd), v, tn, tpgrp, tpnm));
}
+static int
+AADDR_set(tnode_t *tn, did_t *pd, const char *dpnm, const char *tpgrp,
+ const char *tpnm)
+{
+ topo_mod_t *mp;
+ uchar_t *typbuf;
+ int sz = -1;
+ int err, e;
+
+ if (di_bytes_get(did_mod(pd), did_dinode(pd), dpnm, &sz, &typbuf) < 0)
+ return (0);
+
+ mp = did_mod(pd);
+
+ e = topo_prop_set_uint32_array(tn, tpgrp, tpnm, TOPO_PROP_IMMUTABLE,
+ /*LINTED*/
+ (uint32_t *)typbuf, sz/4, &err);
+
+ if (e != 0)
+ return (topo_mod_seterrno(mp, err));
+ return (0);
+}
+
/*ARGSUSED*/
static int
BDF_set(tnode_t *tn, did_t *pd, const char *dpnm, const char *tpgrp,
diff --git a/usr/src/lib/fm/topo/modules/common/pcibus/did_props.h b/usr/src/lib/fm/topo/modules/common/pcibus/did_props.h
index 8314bf0131..af2e2a5316 100644
--- a/usr/src/lib/fm/topo/modules/common/pcibus/did_props.h
+++ b/usr/src/lib/fm/topo/modules/common/pcibus/did_props.h
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -69,6 +69,7 @@ typedef struct txprop {
#define DI_CCPROP "class-code"
#define DI_PHYSPROP "physical-slot#"
#define DI_SLOTPROP "slot-names"
+#define DI_AADDRPROP "assigned-addresses"
extern int did_props_set(tnode_t *, did_t *, txprop_t[], int);