diff options
Diffstat (limited to 'usr/src/lib')
43 files changed, 358 insertions, 3316 deletions
diff --git a/usr/src/lib/fm/libfmd_snmp/common/module.c b/usr/src/lib/fm/libfmd_snmp/common/module.c index 6f6161f366..0521cf40fb 100644 --- a/usr/src/lib/fm/libfmd_snmp/common/module.c +++ b/usr/src/lib/fm/libfmd_snmp/common/module.c @@ -270,9 +270,8 @@ modinfo_update(sunFmModule_update_ctx_t *update_ctx) return (SNMP_ERR_NOERROR); } -/*ARGSUSED*/ -static void -update_thread(void *arg) +__NORETURN static void * +update_thread(void *arg __unused) { /* * The current modinfo_update implementation offers minimal savings @@ -357,8 +356,7 @@ sunFmModuleTable_init(void) return (MIB_REGISTRATION_FAILED); } - if ((err = pthread_create(NULL, NULL, (void *(*)(void *))update_thread, - NULL)) != 0) { + if ((err = pthread_create(NULL, NULL, update_thread, NULL)) != 0) { (void) snmp_log(LOG_ERR, MODNAME_STR ": error creating update " "thread: %s\n", strerror(err)); return (MIB_REGISTRATION_FAILED); diff --git a/usr/src/lib/fm/libfmd_snmp/common/problem.c b/usr/src/lib/fm/libfmd_snmp/common/problem.c index dc1fc7a158..21835ec8a0 100644 --- a/usr/src/lib/fm/libfmd_snmp/common/problem.c +++ b/usr/src/lib/fm/libfmd_snmp/common/problem.c @@ -274,9 +274,8 @@ problem_update(sunFmProblem_update_ctx_t *update_ctx) return (SNMP_ERR_NOERROR); } -/*ARGSUSED*/ -static void -update_thread(void *arg) +__NORETURN static void * +update_thread(void *arg __unused) { /* * The current problem_update implementation offers minimal savings @@ -348,8 +347,7 @@ sunFmProblemTable_init(void) return (MIB_REGISTRATION_FAILED); } - if ((err = pthread_create(NULL, NULL, (void *(*)(void *))update_thread, - NULL)) != 0) { + if ((err = pthread_create(NULL, NULL, update_thread, NULL)) != 0) { (void) snmp_log(LOG_ERR, MODNAME_STR ": error creating update " "thread: %s\n", strerror(err)); return (MIB_REGISTRATION_FAILED); diff --git a/usr/src/lib/fm/libfmd_snmp/common/resource.c b/usr/src/lib/fm/libfmd_snmp/common/resource.c index 59e202337e..7cf3e1131c 100644 --- a/usr/src/lib/fm/libfmd_snmp/common/resource.c +++ b/usr/src/lib/fm/libfmd_snmp/common/resource.c @@ -265,9 +265,8 @@ rsrcinfo_update(sunFmResource_update_ctx_t *update_ctx) return (SNMP_ERR_NOERROR); } -/*ARGSUSED*/ -static void -update_thread(void *arg) +__NORETURN static void * +update_thread(void *arg __unused) { /* * The current rsrcinfo_update implementation offers minimal savings @@ -354,8 +353,7 @@ sunFmResourceTable_init(void) return (MIB_REGISTRATION_FAILED); } - if ((err = pthread_create(NULL, NULL, (void *(*)(void *))update_thread, - NULL)) != 0) { + if ((err = pthread_create(NULL, NULL, update_thread, NULL)) != 0) { (void) snmp_log(LOG_ERR, MODNAME_STR ": error creating update " "thread: %s\n", strerror(err)); return (MIB_REGISTRATION_FAILED); diff --git a/usr/src/lib/fm/libfmd_snmp/common/scheme.c b/usr/src/lib/fm/libfmd_snmp/common/scheme.c index 55c45a7ae3..771763f6d1 100644 --- a/usr/src/lib/fm/libfmd_snmp/common/scheme.c +++ b/usr/src/lib/fm/libfmd_snmp/common/scheme.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/fm/protocol.h> #include <sys/types.h> #include <sys/systeminfo.h> @@ -75,13 +73,19 @@ static fmd_scheme_t *sch_list; /* list of cached schemes */ static char *g_root; /* fmd root dir */ static struct topo_hdl *g_thp; -static long -fmd_scheme_notsup(void) +static ssize_t +fmd_scheme_notsup(nvlist_t *nv __unused, char *arg1 __unused, + size_t arg2 __unused) { errno = ENOTSUP; return (-1); } +static void +fmd_scheme_vnop(void) +{ +} + static int fmd_scheme_nop(void) { @@ -93,9 +97,9 @@ fmd_scheme_nop(void) * the module, then this operation is implemented using the default function. */ static const fmd_scheme_ops_t _fmd_scheme_default_ops = { - (int (*)())fmd_scheme_nop, /* sop_init */ - (void (*)())fmd_scheme_nop, /* sop_fini */ - (ssize_t (*)())fmd_scheme_notsup, /* sop_nvl2str */ + .sop_init = fmd_scheme_nop, /* sop_init */ + .sop_fini = fmd_scheme_vnop, /* sop_fini */ + .sop_nvl2str = fmd_scheme_notsup /* sop_nvl2str */ }; /* diff --git a/usr/src/lib/fm/topo/modules/i86pc/hostbridge/hb_i86pc.c b/usr/src/lib/fm/topo/modules/i86pc/hostbridge/hb_i86pc.c index b8d89db32d..8968c70c95 100644 --- a/usr/src/lib/fm/topo/modules/i86pc/hostbridge/hb_i86pc.c +++ b/usr/src/lib/fm/topo/modules/i86pc/hostbridge/hb_i86pc.c @@ -93,6 +93,18 @@ pci_hostbridges_find(topo_mod_t *mod, tnode_t *ptn) pnode = di_drv_first_node(PCI, devtree); while (pnode != DI_NODE_NIL) { + /* + * We've seen cases where certain phantom PCI hostbridges have + * appeared on systems. If we encounter a host bridge without a + * bus address assigned to it, then we should skip processing it + * here as that indicates that it generally doesn't have any + * devices under it and we'll otherwise blow up in devinfo. + */ + if (di_bus_addr(pnode) == NULL) { + pnode = di_drv_next_node(pnode); + continue; + } + if (hb_process(mod, ptn, hbcnt, pnode) < 0) { if (hbcnt == 0) topo_node_range_destroy(ptn, HOSTBRIDGE); diff --git a/usr/src/lib/krb5/plugins/kdb/ldap/Makefile.com b/usr/src/lib/krb5/plugins/kdb/ldap/Makefile.com index 72a6b80cab..966241305e 100644 --- a/usr/src/lib/krb5/plugins/kdb/ldap/Makefile.com +++ b/usr/src/lib/krb5/plugins/kdb/ldap/Makefile.com @@ -22,6 +22,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright 2020 Joyent, Inc. # LIBRARY= kldap.a @@ -46,7 +47,7 @@ include $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5 #override liblink INS.liblink= -$(RM) $@; $(SYMLINK) $(LIBLINKS)$(VERS) $@ -CPPFLAGS += -DHAVE_CONFIG_H \ +CPPFLAGS += -DHAVE_CONFIG_H \ -I$(SRC)/cmd/krb5/iprop \ -I$(SRC)/lib/krb5 \ -I$(SRC)/lib/krb5/kdb \ @@ -65,15 +66,12 @@ CERRWARN += -_gcc=-Wno-unused-function DYNFLAGS += $(KERBRUNPATH) # setting -L $(ROOT)/usr/lib/gss because libkdb_ldap needs mech_krb5 -LDLIBS += -L $(ROOT)/usr/lib/gss -L $(ROOTLIBDIR) -lkdb_ldap \ - -lc +LDLIBS += -L $(ROOT)/usr/lib/gss -L $(ROOTLIBDIR) -lkdb_ldap .KEEP_STATE: all: $(LIBS) -lint: lintcheck - # include library targets include $(SRC)/lib/krb5/Makefile.targ diff --git a/usr/src/lib/libc/amd64/Makefile b/usr/src/lib/libc/amd64/Makefile index dfd4069e85..c0a065c9df 100644 --- a/usr/src/lib/libc/amd64/Makefile +++ b/usr/src/lib/libc/amd64/Makefile @@ -24,7 +24,7 @@ # Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. # Copyright 2013 Garrett D'Amore <garrett@damore.org> # Copyright 2018 Nexenta Systems, Inc. -# Copyright (c) 2019, Joyent, Inc. +# Copyright 2019 Joyent, Inc. # Copyright 2019 OmniOS Community Edition (OmniOSce) Association. # diff --git a/usr/src/lib/libc/i386/sys/gettimeofday.c b/usr/src/lib/libc/i386/sys/gettimeofday.c index 7539c2143e..c2396e582a 100644 --- a/usr/src/lib/libc/i386/sys/gettimeofday.c +++ b/usr/src/lib/libc/i386/sys/gettimeofday.c @@ -28,7 +28,7 @@ gettimeofday(struct timeval *tv, void *tz) /* * Perform a NULL check before attempting to store the result directly. - * The old fasttrop logic would perform this same check, but after the + * The old fasttrap logic would perform this same check, but after the * call into hrestime(). */ if (tv == NULL) { diff --git a/usr/src/lib/libc/port/gen/pt.c b/usr/src/lib/libc/port/gen/pt.c index 26dd4dd376..3372f7133c 100644 --- a/usr/src/lib/libc/port/gen/pt.c +++ b/usr/src/lib/libc/port/gen/pt.c @@ -24,10 +24,12 @@ * Use is subject to license terms. */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ +/* + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. + */ -#pragma ident "%Z%%M% %I% %E% SMI" +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ #pragma weak _ptsname = ptsname #pragma weak _grantpt = grantpt @@ -133,6 +135,45 @@ unlockpt(int fd) return (0); } +/* + * XPG4v2 requires that open of a slave pseudo terminal device + * provides the process with an interface that is identical to + * the terminal interface. + * + * To satisfy this, in strict XPG4v2 mode, this routine also sends + * a message down the stream that sets a flag in the kernel module + * so that additional actions are performed when opening an + * associated slave PTY device. When this happens, modules are + * automatically pushed onto the stream to provide terminal + * semantics and those modules are then informed that they should + * behave in strict XPG4v2 mode which modifies their behaviour. In + * particular, in strict XPG4v2 mode, empty blocks will be sent up + * the master side of the stream rather than being suppressed. + * + * Most applications do not expect this behaviour so it is only + * enabled for programs compiled in strict XPG4v2 mode (see + * stdlib.h). + */ +int +__unlockpt_xpg4(int fd) +{ + int ret; + + if ((ret = unlockpt(fd)) == 0) { + struct strioctl istr; + + istr.ic_cmd = PTSSTTY; + istr.ic_len = 0; + istr.ic_timout = 0; + istr.ic_dp = NULL; + + if (ioctl(fd, I_STR, &istr) < 0) + ret = -1; + } + + return (ret); +} + int grantpt(int fd) { diff --git a/usr/src/lib/libc/port/mapfile-vers b/usr/src/lib/libc/port/mapfile-vers index f2c12c1b4b..dbe33eb9d1 100644 --- a/usr/src/lib/libc/port/mapfile-vers +++ b/usr/src/lib/libc/port/mapfile-vers @@ -27,7 +27,7 @@ # Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. # Copyright (c) 2013 Gary Mills # Copyright 2014 Garrett D'Amore <garrett@damore.org> -# Copyright 2019 OmniOS Community Edition (OmniOSce) Association. +# Copyright 2020 OmniOS Community Edition (OmniOSce) Association. # # @@ -78,6 +78,11 @@ $if _x86 && _ELF64 $add amd64 $endif +SYMBOL_VERSION ILLUMOS_0.31 { + protected: + __unlockpt_xpg4; +} ILLUMOS_0.30; + SYMBOL_VERSION ILLUMOS_0.30 { protected: reallocf; diff --git a/usr/src/lib/libc/port/sys/open.c b/usr/src/lib/libc/port/sys/open.c index 067bb72d69..2ea6c567f4 100644 --- a/usr/src/lib/libc/port/sys/open.c +++ b/usr/src/lib/libc/port/sys/open.c @@ -22,44 +22,32 @@ /* * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. */ /* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ +/* All Rights Reserved */ #include "lint.h" -#include <sys/mkdev.h> #include <limits.h> #include <stdarg.h> #include <unistd.h> -#include <strings.h> -#include <errno.h> -#include <sys/stat.h> #include <sys/fcntl.h> -#include <sys/stropts.h> -#include <sys/stream.h> -#include <sys/ptms.h> #include <sys/syscall.h> #include "libc.h" -static int xpg4_fixup(int fd); -static void push_module(int fd); -static int isptsfd(int fd); -static void itoa(int i, char *ptr); - int __openat(int dfd, const char *path, int oflag, mode_t mode) { - int fd = syscall(SYS_openat, dfd, path, oflag, mode); - return (xpg4_fixup(fd)); + return (syscall(SYS_openat, dfd, path, oflag, mode)); } int __open(const char *path, int oflag, mode_t mode) { #if defined(_RETAIN_OLD_SYSCALLS) - int fd = syscall(SYS_open, path, oflag, mode); - return (xpg4_fixup(fd)); + return (syscall(SYS_open, path, oflag, mode)); #else return (__openat(AT_FDCWD, path, oflag, mode)); #endif @@ -70,114 +58,17 @@ __open(const char *path, int oflag, mode_t mode) int __openat64(int dfd, const char *path, int oflag, mode_t mode) { - int fd = syscall(SYS_openat64, dfd, path, oflag, mode); - return (xpg4_fixup(fd)); + return (syscall(SYS_openat64, dfd, path, oflag, mode)); } int __open64(const char *path, int oflag, mode_t mode) { #if defined(_RETAIN_OLD_SYSCALLS) - int fd = syscall(SYS_open64, path, oflag, mode); - return (xpg4_fixup(fd)); + return (syscall(SYS_open64, path, oflag, mode)); #else return (__openat64(AT_FDCWD, path, oflag, mode)); #endif } #endif /* !_LP64 */ - -/* - * XPG4v2 requires that open of a slave pseudo terminal device - * provides the process with an interface that is identical to - * the terminal interface. For a more detailed discussion, - * see bugid 4025044. - */ -static int -xpg4_fixup(int fd) -{ - if (libc__xpg4 != 0 && fd >= 0 && isptsfd(fd)) - push_module(fd); - return (fd); -} - -/* - * Check if the file matches an entry in the /dev/pts directory. - * Be careful to preserve errno. - */ -static int -isptsfd(int fd) -{ - char buf[TTYNAME_MAX]; - char *str1 = buf; - const char *str2 = "/dev/pts/"; - struct stat64 fsb, stb; - int oerrno = errno; - int rval = 0; - - if (fstat64(fd, &fsb) == 0 && S_ISCHR(fsb.st_mode)) { - /* - * Do this without strcpy() or strlen(), - * to avoid invoking the dynamic linker. - */ - while (*str2 != '\0') - *str1++ = *str2++; - /* - * Inline version of minor(dev), to avoid the dynamic linker. - */ - itoa(fsb.st_rdev & MAXMIN, str1); - if (stat64(buf, &stb) == 0) - rval = (stb.st_rdev == fsb.st_rdev); - } - errno = oerrno; - return (rval); -} - -/* - * Converts a number to a string (null terminated). - */ -static void -itoa(int i, char *ptr) -{ - int dig = 0; - int tempi; - - tempi = i; - do { - dig++; - tempi /= 10; - } while (tempi); - - ptr += dig; - *ptr = '\0'; - while (--dig >= 0) { - *(--ptr) = i % 10 + '0'; - i /= 10; - } -} - -/* - * Push modules to provide tty semantics - */ -static void -push_module(int fd) -{ - struct strioctl istr; - int oerrno = errno; - - istr.ic_cmd = PTSSTTY; - istr.ic_len = 0; - istr.ic_timout = 0; - istr.ic_dp = NULL; - if (ioctl(fd, I_STR, &istr) != -1) { - (void) ioctl(fd, __I_PUSH_NOCTTY, "ptem"); - (void) ioctl(fd, __I_PUSH_NOCTTY, "ldterm"); - (void) ioctl(fd, __I_PUSH_NOCTTY, "ttcompat"); - istr.ic_cmd = PTSSTTY; - istr.ic_len = 0; - istr.ic_timout = 0; - istr.ic_dp = NULL; - (void) ioctl(fd, I_STR, &istr); - } - errno = oerrno; -} diff --git a/usr/src/lib/libdisasm/common/dis_riscv.c b/usr/src/lib/libdisasm/common/dis_riscv.c index fa7cc30610..f246a19137 100644 --- a/usr/src/lib/libdisasm/common/dis_riscv.c +++ b/usr/src/lib/libdisasm/common/dis_riscv.c @@ -313,7 +313,7 @@ typedef void (*dis_riscv_func_t)(dis_handle_t *, uint32_t, struct dis_riscv_instr *, char *, size_t); typedef struct dis_riscv_instr { - const char *drv_name; + const char *drv_name; dis_riscv_itype_t drv_type; dis_riscv_func_t drv_print; uint_t drv_opcode; @@ -959,7 +959,7 @@ dis_riscv_fp_rm(dis_handle_t *dhp, uint32_t instr, #define DIS_RISCV_FP_R_RS2_IFP_NR(str, op, f3, rs2, f7) \ { str, DIS_RISCV_I_FP_R_RS2_TYPE, dis_riscv_fp_rs2_ifp_nr, op, f3, \ f7, rs2 } -#define DIS_RISCV_FP_RI(str, op, f3, f7) \ +#define DIS_RISCV_FP_RI(str, op, f3, f7) \ { str, DIS_RISCV_I_R_TYPE, dis_riscv_fp_r_fpi, op, f3, f7 } /* @@ -1300,7 +1300,7 @@ typedef struct dis_riscv_c_instr { const char *drv_c_name; dis_riscv_ctype_t drv_c_type; dis_riscv_c_func_t drv_c_print; - dis_riscv_c_class_t drv_c_class; + dis_riscv_c_class_t drv_c_class; uint_t drv_c_opcode; uint_t drv_c_funct; uint_t drv_c_mask; @@ -1680,7 +1680,7 @@ dis_riscv_c_int(dis_handle_t *dhp, uint32_t instr, #define DIS_RISCV_CFUNCT3(name, class, op, funct, print) \ { name, DIS_RISCV_C_FUNCT3, print, class, op, funct, 0, 0 } -#define DIS_RISCV_CMATCH(name, class, op, funct, mask, match, print) \ +#define DIS_RISCV_CMATCH(name, class, op, funct, mask, match, print) \ { name, DIS_RISCV_C_MATCH, print, class, op, funct, mask, match } static dis_riscv_c_instr_t dis_riscv_2byte[] = { @@ -1972,7 +1972,6 @@ dis_riscv_max_instrlen(dis_handle_t *dhp) static int dis_riscv_instrlen(dis_handle_t *dhp, uint64_t addr) { - int ret; uint16_t parcel; dhp->dh_addr = addr; @@ -1980,15 +1979,7 @@ dis_riscv_instrlen(dis_handle_t *dhp, uint64_t addr) if (dis_riscv_read_parcel(dhp, &parcel) != 0) return (-1); - /* - * Get length based on this parcel. Check for required alignment. 2-byte - * alignment was already taken care of when we read the parcel. - */ - ret = dis_riscv_decode_len(parcel); - if (ret >= 4 && (addr % 4) != 0) - return (-1); - - return (ret); + return (dis_riscv_decode_len(parcel)); } dis_arch_t dis_arch_riscv = { diff --git a/usr/src/lib/libdladm/common/libdladm.c b/usr/src/lib/libdladm/common/libdladm.c index d0a34ef23d..446a15893b 100644 --- a/usr/src/lib/libdladm/common/libdladm.c +++ b/usr/src/lib/libdladm/common/libdladm.c @@ -27,6 +27,10 @@ * Copyright 2019 OmniOS Community Edition (OmniOSce) Association. */ +/* + * Copyright 2020 Peter Tribble. + */ + #include <unistd.h> #include <errno.h> #include <ctype.h> @@ -70,23 +74,23 @@ static media_type_t media_type_table[] = { { DL_HDLC, "HDLC" }, { DL_CHAR, "SyncCharacter" }, { DL_CTCA, "CTCA" }, - { DL_FDDI, "FDDI" }, - { DL_FC, "FiberChannel" }, - { DL_ATM, "ATM" }, - { DL_IPATM, "ATM(ClassicIP)" }, - { DL_X25, "X.25" }, - { DL_IPX25, "X.25(ClassicIP)" }, - { DL_ISDN, "ISDN" }, - { DL_HIPPI, "HIPPI" }, - { DL_100VG, "100BaseVGEthernet" }, - { DL_100VGTPR, "100BaseVGTokenRing" }, - { DL_ETH_CSMA, "IEEE802.3" }, - { DL_100BT, "100BaseT" }, - { DL_FRAME, "FrameRelay" }, - { DL_MPFRAME, "MPFrameRelay" }, - { DL_ASYNC, "AsyncCharacter" }, - { DL_IPNET, "IPNET" }, - { DL_OTHER, "Other" } + { DL_FDDI, "FDDI" }, + { DL_FC, "FiberChannel" }, + { DL_ATM, "ATM" }, + { DL_IPATM, "ATM(ClassicIP)" }, + { DL_X25, "X.25" }, + { DL_IPX25, "X.25(ClassicIP)" }, + { DL_ISDN, "ISDN" }, + { DL_HIPPI, "HIPPI" }, + { DL_100VG, "100BaseVGEthernet" }, + { DL_100VGTPR, "100BaseVGTokenRing" }, + { DL_ETH_CSMA, "IEEE802.3" }, + { DL_100BT, "100BaseT" }, + { DL_FRAME, "FrameRelay" }, + { DL_MPFRAME, "MPFrameRelay" }, + { DL_ASYNC, "AsyncCharacter" }, + { DL_IPNET, "IPNET" }, + { DL_OTHER, "Other" } }; #define MEDIATYPECOUNT (sizeof (media_type_table) / sizeof (media_type_t)) @@ -452,6 +456,9 @@ dladm_status2str(dladm_status_t status, char *buf) case DLADM_STATUS_BAD_ENCAP: s = "invalid encapsulation protocol"; break; + case DLADM_STATUS_PERSIST_ON_TEMP: + s = "can't create persistent object on top of temporary object"; + break; default: s = "<unknown error>"; break; @@ -594,11 +601,7 @@ dladm_bw2str(int64_t bw, char *buf) kbps = (bw%1000000)/1000; mbps = bw/1000000; if (kbps != 0) { - if (mbps == 0) - (void) snprintf(buf, DLADM_STRSIZE, "0.%03u", kbps); - else - (void) snprintf(buf, DLADM_STRSIZE, "%5u.%03u", mbps, - kbps); + (void) snprintf(buf, DLADM_STRSIZE, "%5u.%03u", mbps, kbps); } else { (void) snprintf(buf, DLADM_STRSIZE, "%5u", mbps); } diff --git a/usr/src/lib/libdladm/common/libdladm.h b/usr/src/lib/libdladm/common/libdladm.h index f5ae0e6ace..685356fa64 100644 --- a/usr/src/lib/libdladm/common/libdladm.h +++ b/usr/src/lib/libdladm/common/libdladm.h @@ -24,7 +24,7 @@ */ /* - * Copyright 2019 OmniOS Community Edition (OmniOSce) Association + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association */ #ifndef _LIBDLADM_H @@ -185,7 +185,8 @@ typedef enum { DLADM_STATUS_INVALID_PKEY_TBL_SIZE, DLADM_STATUS_PORT_NOPROTO, DLADM_STATUS_INVALID_MTU, - DLADM_STATUS_BAD_ENCAP + DLADM_STATUS_BAD_ENCAP, + DLADM_STATUS_PERSIST_ON_TEMP } dladm_status_t; typedef enum { diff --git a/usr/src/lib/libdladm/common/libdlvnic.c b/usr/src/lib/libdladm/common/libdlvnic.c index 47d007a1e2..7ff0cd5530 100644 --- a/usr/src/lib/libdladm/common/libdlvnic.c +++ b/usr/src/lib/libdladm/common/libdlvnic.c @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2015, Joyent Inc. + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. */ #include <stdio.h> @@ -406,6 +407,7 @@ dladm_vnic_create(dladm_handle_t handle, const char *vnic, datalink_id_t linkid, datalink_id_t vnic_id; datalink_class_t class; uint32_t media = DL_ETHER; + uint32_t link_flags; char name[MAXLINKNAMELEN]; uchar_t tmp_addr[MAXMACADDRLEN]; dladm_status_t status; @@ -421,6 +423,15 @@ dladm_vnic_create(dladm_handle_t handle, const char *vnic, datalink_id_t linkid, if ((flags & DLADM_OPT_ACTIVE) == 0) return (DLADM_STATUS_NOTSUP); + /* + * It's an anchor VNIC - linkid must be set to DATALINK_INVALID_LINKID + * and the VLAN id must be 0 + */ + if ((flags & DLADM_OPT_ANCHOR) != 0 && + (linkid != DATALINK_INVALID_LINKID || vid != 0)) { + return (DLADM_STATUS_BADARG); + } + is_vlan = ((flags & DLADM_OPT_VLAN) != 0); if (is_vlan && ((vid < 1 || vid > 4094))) return (DLADM_STATUS_VIDINVAL); @@ -430,18 +441,20 @@ dladm_vnic_create(dladm_handle_t handle, const char *vnic, datalink_id_t linkid, if (!dladm_vnic_macaddrtype2str(mac_addr_type)) return (DLADM_STATUS_INVALIDMACADDRTYPE); - if ((flags & DLADM_OPT_ANCHOR) == 0) { - if ((status = dladm_datalink_id2info(handle, linkid, NULL, - &class, &media, NULL, 0)) != DLADM_STATUS_OK) + if (!is_etherstub) { + if ((status = dladm_datalink_id2info(handle, linkid, + &link_flags, &class, &media, NULL, 0)) != DLADM_STATUS_OK) return (status); + /* Disallow persistent objects on top of temporary ones */ + if ((flags & DLADM_OPT_PERSIST) != 0 && + (link_flags & DLMGMT_PERSIST) == 0) + return (DLADM_STATUS_PERSIST_ON_TEMP); + + /* Links cannot be created on top of these object types */ if (class == DATALINK_CLASS_VNIC || class == DATALINK_CLASS_VLAN) return (DLADM_STATUS_BADARG); - } else { - /* it's an anchor VNIC */ - if (linkid != DATALINK_INVALID_LINKID || vid != 0) - return (DLADM_STATUS_BADARG); } /* diff --git a/usr/src/lib/libfakekernel/common/callout.c b/usr/src/lib/libfakekernel/common/callout.c index b2e5048bab..6752e2f44a 100644 --- a/usr/src/lib/libfakekernel/common/callout.c +++ b/usr/src/lib/libfakekernel/common/callout.c @@ -46,7 +46,7 @@ timeout(void (*func)(void *), void *arg, clock_t delta) bzero(&sev, sizeof (sev)); sev.sigev_notify = SIGEV_THREAD; sev.sigev_value.sival_ptr = arg; - sev.sigev_notify_function = (sigev_notify_func_t)func; + sev.sigev_notify_function = (sigev_notify_func_t)(uintptr_t)func; err = timer_create(CLOCK_REALTIME, &sev, &tid); if (err != 0) return (NULL); diff --git a/usr/src/lib/libfakekernel/common/thread.c b/usr/src/lib/libfakekernel/common/thread.c index 7cfac712a8..31421a723b 100644 --- a/usr/src/lib/libfakekernel/common/thread.c +++ b/usr/src/lib/libfakekernel/common/thread.c @@ -70,7 +70,7 @@ thread_create( break; } - thr_func = (void *(*)(void *))func; + thr_func = (void *(*)(void *))(uintptr_t)func; rc = thr_create(NULL, 0, thr_func, arg, thr_flags, &newtid); if (rc != 0) cmn_err(CE_PANIC, "thread_create failed, rc=%d", rc); diff --git a/usr/src/lib/libidspace/Makefile.com b/usr/src/lib/libidspace/Makefile.com index 8cc60ffc4c..ef259c3d2f 100644 --- a/usr/src/lib/libidspace/Makefile.com +++ b/usr/src/lib/libidspace/Makefile.com @@ -10,7 +10,7 @@ # # -# Copyright (c) 2014 Joyent, Inc. All rights reserved. +# Copyright 2020 Joyent, Inc. # LIBRARY = libidspace.a @@ -23,18 +23,14 @@ include ../../Makefile.lib SRCDIR = ../common SRCS = ../../../common/idspace/id_space.c -LIBS = $(DYNLIB) $(LINTLIB) +LIBS = $(DYNLIB) -LDLIBS += -lc -lumem - -$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC) +LDLIBS += -lumem .KEEP_STATE: all: $(LIBS) -lint: lintcheck - include ../../Makefile.targ objs/%.o pics/%.o: $(COMDIR)/%.c diff --git a/usr/src/lib/libjedec/Makefile.com b/usr/src/lib/libjedec/Makefile.com index 755004d099..a2138ed9ea 100644 --- a/usr/src/lib/libjedec/Makefile.com +++ b/usr/src/lib/libjedec/Makefile.com @@ -10,7 +10,7 @@ # # -# Copyright (c) 2018 Joyent, Inc. +# Copyright 2020 Joyent, Inc. # LIBRARY = libjedec.a @@ -19,8 +19,7 @@ OBJECTS = libjedec.o include ../../Makefile.lib -LIBS = $(DYNLIB) $(LINTLIB) -LDLIBS += -lc +LIBS = $(DYNLIB) CPPFLAGS += -I../common SRCDIR = ../common @@ -29,6 +28,4 @@ SRCDIR = ../common all: $(LIBS) -lint: lintcheck - include ../../Makefile.targ diff --git a/usr/src/lib/libprtdiag/Makefile.com b/usr/src/lib/libprtdiag/Makefile.com index 6994883b47..406fcfc96f 100644 --- a/usr/src/lib/libprtdiag/Makefile.com +++ b/usr/src/lib/libprtdiag/Makefile.com @@ -21,6 +21,7 @@ # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. +# Copyright 2020 Peter Tribble. # # @@ -39,8 +40,7 @@ include $(SRC)/Makefile.psm LIBS = $(DYNLIB) $(LINTLIB) IFLAGS = -I ../../inc -I $(USR_PSM_INCL_DIR) IFLAGS += -I $(SRC)/cmd/picl/plugins/inc -IFLAGS += -I $(UTSBASE)/sun4u -IFLAGS += -I $(UTSBASE)/sun4u/sunfire +IFLAGS += -I $(UTSBASE)/sun4u IFLAGS += -I $(UTSBASE)/sun4u/serengeti CPPFLAGS = $(IFLAGS) $(CPPFLAGS.master) CFLAGS += $(CCVERBOSE) diff --git a/usr/src/lib/libprtdiag/common/display_sun4u.c b/usr/src/lib/libprtdiag/common/display_sun4u.c index a68246600f..56e2716e38 100644 --- a/usr/src/lib/libprtdiag/common/display_sun4u.c +++ b/usr/src/lib/libprtdiag/common/display_sun4u.c @@ -20,6 +20,7 @@ */ /* * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020 Peter Tribble. */ #include <stdio.h> @@ -62,7 +63,6 @@ display(Sys_tree *tree, int exit_code = 0; /* init to all OK */ void *value; /* used for opaque PROM data */ struct mem_total memory_total; /* Total memory in system */ - struct grp_info grps; /* Info on all groups in system */ sys_clk = -1; /* System clock freq. (in MHz) */ @@ -96,7 +96,7 @@ display(Sys_tree *tree, } /* Display the Memory Size */ - display_memorysize(tree, kstats, &grps, &memory_total); + display_memorysize(tree, kstats, &memory_total); /* Display platform specific configuration info */ display_platform_specific_header(); @@ -105,7 +105,7 @@ display(Sys_tree *tree, display_cpu_devices(tree); /* Display the Memory configuration */ - display_memoryconf(tree, &grps); + display_memoryconf(tree); /* Display all the IO cards. */ (void) display_io_devices(tree); diff --git a/usr/src/lib/libprtdiag/common/display_sun4v.c b/usr/src/lib/libprtdiag/common/display_sun4v.c index e4a2408537..9ec03878b5 100644 --- a/usr/src/lib/libprtdiag/common/display_sun4v.c +++ b/usr/src/lib/libprtdiag/common/display_sun4v.c @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020 Peter Tribble. */ #include <stdio.h> @@ -119,7 +120,6 @@ sun4v_display(Sys_tree *tree, Prom_node *root, int log, { void *value; /* used for opaque PROM data */ struct mem_total memory_total; /* Total memory in system */ - struct grp_info grps; /* Info on all groups in system */ char machine[MAXSTRLEN]; int exit_code = 0; @@ -155,7 +155,7 @@ sun4v_display(Sys_tree *tree, Prom_node *root, int log, } /* Display the Memory Size */ - display_memorysize(tree, NULL, &grps, &memory_total); + display_memorysize(tree, NULL, &memory_total); /* Display the CPU devices */ sun4v_display_cpu_devices(plafh); diff --git a/usr/src/lib/libprtdiag/common/kstat.c b/usr/src/lib/libprtdiag/common/kstat.c index 1c29e96642..5aaf523441 100644 --- a/usr/src/lib/libprtdiag/common/kstat.c +++ b/usr/src/lib/libprtdiag/common/kstat.c @@ -22,10 +22,9 @@ /* * Copyright (c) 1999 by Sun Microsystems, Inc. * All rights reserved. + * Copyright (c) 2020 Peter Tribble. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -54,369 +53,33 @@ /* * This module does the reading and interpreting of sun4u system - * kstats. These kstats are created by the following drivers: - * fhc, environ, sysctrl. Each board in the tree should have - * kstats created for it. There are also system wide kstats that - * are created. + * kstats. It is overlaid by a platform-specific implementation as + * appropriate. */ void read_platform_kstats(Sys_tree *tree, struct system_kstat_data *sys_kstat, - struct bd_kstat_data *bdp, struct envctrl_kstat_data *ep) + struct envctrl_kstat_data *ep) { - Board_node *bnode; - kstat_ctl_t *kc; - kstat_t *ksp; - kstat_named_t *knp; - int i; - struct hp_info *hp; - -#ifdef lint - ep = ep; -#endif - if ((kc = kstat_open()) == NULL) { - return; - } - - /* For each board in the system, read the kstats for it. */ - for (bnode = tree->bd_list; bnode != NULL; bnode = bnode->next) { - int board; - - /* - * Kstat instances numbers are set by fhc, ac, simmstat, - * and environ drivers based on their board# property. - */ - board = bnode->board_num; - bdp = &sys_kstat->bd_ksp_list[board]; - - /* Try to find an FHC instance for this board number */ - ksp = kstat_lookup(kc, UNIX, board, FHC_KSTAT_NAME); - - /* Atempt to read the FHC kstat */ - if ((ksp != NULL) && (kstat_read(kc, ksp, NULL) == -1)) { - ksp = NULL; - } - - /* Now read out the data if the kstat read OK */ - if (ksp != NULL) { - /* - * We set the kstats_ok flag to good here. If we - * fail one of the data reads, we set it to bad. - */ - bdp->fhc_kstats_ok = 1; - - /* - * For each data value, If the Kstat named struct - * is found, then get the data out. - */ - knp = kstat_data_lookup(ksp, CSR_KSTAT_NAMED); - if (knp != NULL) { - bdp->fhc_csr = knp->value.ul; - } else { - bdp->fhc_kstats_ok = 0; - } - knp = kstat_data_lookup(ksp, BSR_KSTAT_NAMED); - if (knp != NULL) { - bdp->fhc_bsr = knp->value.ul; - } else { - bdp->fhc_kstats_ok = 0; - } - } - - /* Try to find an AC instance for this board number */ - ksp = kstat_lookup(kc, UNIX, board, AC_KSTAT_NAME); - - /* Attempt to read the AC kstat. */ - if ((ksp != NULL) && (kstat_read(kc, ksp, NULL) == -1)) { - ksp = NULL; - } - - /* If the AC kstat exists, try to read the data from it. */ - if (ksp != NULL) { - /* - * We set the kstats_ok flag to good here. If we - * fail one of the data reads, we set it to bad. - */ - bdp->ac_kstats_ok = 1; - bdp->ac_memstat_ok = 1; - - /* - * For each data value, If the Kstat named struct - * is found, then get the data out. - */ - - knp = kstat_data_lookup(ksp, MEMCTL_KSTAT_NAMED); - if (knp != NULL) { - bdp->ac_memctl = knp->value.ull; - } else { - bdp->ac_kstats_ok = 0; - } - - knp = kstat_data_lookup(ksp, MEMDECODE0_KSTAT_NAMED); - if (knp != NULL) { - bdp->ac_memdecode[0] = knp->value.ull; - } else { - bdp->ac_kstats_ok = 0; - } - - knp = kstat_data_lookup(ksp, MEMDECODE1_KSTAT_NAMED); - if (knp != NULL) { - bdp->ac_memdecode[1] = knp->value.ull; - } else { - bdp->ac_kstats_ok = 0; - } - - knp = kstat_data_lookup(ksp, BANK_0_KSTAT_NAMED); - if (knp != NULL) { - bdp->mem_stat[0].status = knp->value.c[0]; - bdp->mem_stat[0].condition = knp->value.c[1]; - } else { - bdp->ac_memstat_ok = 0; - } - - knp = kstat_data_lookup(ksp, BANK_1_KSTAT_NAMED); - if (knp != NULL) { - bdp->mem_stat[1].status = knp->value.c[0]; - bdp->mem_stat[1].condition = knp->value.c[1]; - } else { - bdp->ac_memstat_ok = 0; - } - - } - - /* Try to find an simmstat instance for this board number */ - ksp = kstat_lookup(kc, UNIX, board, SIMMSTAT_KSTAT_NAME); - - if (ksp != NULL) { - if (kstat_read(kc, ksp, NULL) == -1) { - bdp->simmstat_kstats_ok = 0; - } else { - bdp->simmstat_kstats_ok = 1; - (void) memcpy(&bdp->simm_status, ksp->ks_data, - sizeof (bdp->simm_status)); - } - } - - /* Try to find an overtemp kstat instance for this board */ - ksp = kstat_lookup(kc, UNIX, board, OVERTEMP_KSTAT_NAME); - - if (ksp != NULL) { - if (kstat_read(kc, ksp, NULL) == -1) { - bdp->temp_kstat_ok = 0; - } else { - bdp->temp_kstat_ok = 1; - (void) memcpy(&bdp->tempstat, ksp->ks_data, - sizeof (bdp->tempstat)); - /* XXX - this is for 2.5.1 testing. remove */ - if (sizeof (bdp->tempstat) > ksp->ks_data_size) - bdp->tempstat.trend = TREND_UNKNOWN; - } - } - } - - /* Read the kstats for the system control board */ - ksp = kstat_lookup(kc, UNIX, 0, SYSCTRL_KSTAT_NAME); - - if ((ksp != NULL) && (kstat_read(kc, ksp, NULL) == -1)) { - sys_kstat->sys_kstats_ok = 0; - ksp = NULL; - } - - if (ksp != NULL) { - sys_kstat->sys_kstats_ok = 1; - - knp = kstat_data_lookup(ksp, CSR_KSTAT_NAMED); - if (knp != NULL) { - sys_kstat->sysctrl = knp->value.c[0]; - } else { - sys_kstat->sys_kstats_ok = 0; - } - - knp = kstat_data_lookup(ksp, STAT1_KSTAT_NAMED); - if (knp != NULL) { - sys_kstat->sysstat1 = knp->value.c[0]; - } else { - sys_kstat->sys_kstats_ok = 0; - } - - knp = kstat_data_lookup(ksp, STAT2_KSTAT_NAMED); - if (knp != NULL) { - sys_kstat->sysstat2 = knp->value.c[0]; - } else { - sys_kstat->sys_kstats_ok = 0; - } - - knp = kstat_data_lookup(ksp, CLK_FREQ2_KSTAT_NAMED); - if (knp != NULL) { - sys_kstat->clk_freq2 = knp->value.c[0]; - } else { - sys_kstat->sys_kstats_ok = 0; - } - - knp = kstat_data_lookup(ksp, FAN_KSTAT_NAMED); - if (knp != NULL) { - sys_kstat->fan_status = knp->value.c[0]; - } else { - sys_kstat->sys_kstats_ok = 0; - } - - knp = kstat_data_lookup(ksp, KEY_KSTAT_NAMED); - if (knp != NULL) { - sys_kstat->keysw_status = knp->value.c[0]; - } else { - sys_kstat->sys_kstats_ok = 0; - } - - knp = kstat_data_lookup(ksp, POWER_KSTAT_NAMED); - if (knp != NULL) { - sys_kstat->power_state = - (enum power_state)knp->value.l; - } else { - sys_kstat->sys_kstats_ok = 0; - } - - knp = kstat_data_lookup(ksp, CLK_VER_KSTAT_NAME); - if (knp != NULL) { - sys_kstat->clk_ver = knp->value.c[0]; - } else { - /* - * the clock version register only appears - * on new clock boards - */ - sys_kstat->clk_ver = 0; - } - - } - - /* Read the kstats for the power supply stats */ - ksp = kstat_lookup(kc, UNIX, 0, PSSHAD_KSTAT_NAME); - - if ((ksp != NULL) && (kstat_read(kc, ksp, NULL) != -1)) { - sys_kstat->psstat_kstat_ok = 1; - (void) memcpy(&sys_kstat->ps_shadow[0], ksp->ks_data, - sizeof (sys_kstat->ps_shadow)); - } else { - sys_kstat->psstat_kstat_ok = 0; - } - - /* read the overtemp kstat for the system control board */ - /* Try to find an overtemp kstat instance for this board */ - ksp = kstat_lookup(kc, UNIX, CLOCK_BOARD_INDEX, OVERTEMP_KSTAT_NAME); - - if (ksp != NULL) { - if (kstat_read(kc, ksp, NULL) == -1) { - sys_kstat->temp_kstat_ok = 0; - } else { - sys_kstat->temp_kstat_ok = 1; - (void) memcpy(&sys_kstat->tempstat, ksp->ks_data, - sizeof (sys_kstat->tempstat)); - /* XXX - this is for 2.5.1 testing. remove */ - if (sizeof (sys_kstat->tempstat) > ksp->ks_data_size) - sys_kstat->tempstat.trend = TREND_UNKNOWN; - } - } - - /* Read the reset-info kstat from one of the boards. */ - ksp = kstat_lookup(kc, UNIX, 0, RESETINFO_KSTAT_NAME); - - if (ksp == NULL) { - sys_kstat->reset_kstats_ok = 0; - } else if (kstat_read(kc, ksp, NULL) == -1) { - sys_kstat->reset_kstats_ok = 0; - } else { - sys_kstat->reset_kstats_ok = 1; - (void) memcpy(&sys_kstat->reset_info, ksp->ks_data, - sizeof (sys_kstat->reset_info)); - } - - /* read kstats for hotplugged boards */ - for (i = 0, hp = &sys_kstat->hp_info[0]; i < MAX_BOARDS; i++, hp++) { - ksp = kstat_lookup(kc, UNIX, i, BDLIST_KSTAT_NAME); - - if (ksp == NULL) { - continue; - } - - if (kstat_read(kc, ksp, NULL) == -1) { - hp->kstat_ok = 0; - } else { - hp->kstat_ok = 1; - (void) memcpy(&hp->bd_info, ksp->ks_data, - sizeof (hp->bd_info)); - } - } - - /* read in the kstat for the fault list. */ - ksp = kstat_lookup(kc, UNIX, 0, FT_LIST_KSTAT_NAME); - - if (ksp == NULL) { - sys_kstat->ft_kstat_ok = 0; - } else { - if (kstat_read(kc, ksp, NULL) == -1) { - perror("kstat read"); - sys_kstat->ft_kstat_ok = 0; - return; - } - - sys_kstat->nfaults = ksp->ks_data_size / - sizeof (struct ft_list); - - sys_kstat->ft_array = - (struct ft_list *)malloc(ksp->ks_data_size); - - if (sys_kstat->ft_array == NULL) { - perror("Malloc"); - exit(2); - } - sys_kstat->ft_kstat_ok = 1; - (void) memcpy(sys_kstat->ft_array, ksp->ks_data, - ksp->ks_data_size); - } } /* * This function does the reading and interpreting of sun4u system - * kstats. These kstats are created by the following drivers: - * fhc, environ, sysctrl. Each board in the tree should have - * kstats created for it. There are also system wide kstats that - * are created. + * kstats. */ void read_sun4u_kstats(Sys_tree *tree, struct system_kstat_data *sys_kstat) { -#if 0 - Board_node *bnode; - kstat_t *ksp; - kstat_named_t *knp; - struct hp_info *hp; - struct envctrltwo_kstat_data *ecp; -#endif - kstat_ctl_t *kc; + kstat_ctl_t *kc; int i; - struct bd_kstat_data *bdp; struct envctrl_kstat_data *ep; if ((kc = kstat_open()) == NULL) { return; } -#ifdef lint - kc = kc; -#endif /* Initialize the kstats structure */ sys_kstat->sys_kstats_ok = 0; - sys_kstat->temp_kstat_ok = 0; - sys_kstat->reset_kstats_ok = 0; - sys_kstat->ft_kstat_ok = 0; sys_kstat->envctrl_kstat_ok = 0; - for (i = 0; i < MAX_BOARDS; i++) { - bdp = &sys_kstat->bd_ksp_list[i]; - bdp->ac_kstats_ok = 0; - bdp->fhc_kstats_ok = 0; - bdp->simmstat_kstats_ok = 0; - bdp->temp_kstat_ok = 0; - - sys_kstat->hp_info[i].kstat_ok = 0; - } for (i = 0; i < MAX_DEVS; i++) { ep = &sys_kstat->env_data; ep->ps_kstats[i].instance = I2C_NODEV; @@ -424,5 +87,5 @@ read_sun4u_kstats(Sys_tree *tree, struct system_kstat_data *sys_kstat) ep->encl_kstats[i].instance = I2C_NODEV; } - read_platform_kstats(tree, sys_kstat, bdp, ep); + read_platform_kstats(tree, sys_kstat, ep); } diff --git a/usr/src/lib/libprtdiag/common/memory.c b/usr/src/lib/libprtdiag/common/memory.c index 1e1aaff425..575f94e956 100644 --- a/usr/src/lib/libprtdiag/common/memory.c +++ b/usr/src/lib/libprtdiag/common/memory.c @@ -22,10 +22,9 @@ /* * Copyright (c) 1999-2001 by Sun Microsystems, Inc. * All rights reserved. + * Copyright (c) 2020 Peter Tribble. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -86,7 +85,7 @@ static memory_seg_t *match_seg(uint64_t); /*ARGSUSED0*/ void display_memorysize(Sys_tree *tree, struct system_kstat_data *kstats, - struct grp_info *grps, struct mem_total *memory_total) + struct mem_total *memory_total) { log_printf(dgettext(TEXT_DOMAIN, "Memory size: "), 0); @@ -110,7 +109,7 @@ display_memorysize(Sys_tree *tree, struct system_kstat_data *kstats, /*ARGSUSED0*/ void -display_memoryconf(Sys_tree *tree, struct grp_info *grps) +display_memoryconf(Sys_tree *tree) { /* * This function is intentionally blank diff --git a/usr/src/lib/libprtdiag/inc/libprtdiag.h b/usr/src/lib/libprtdiag/inc/libprtdiag.h index e9361b8e9c..41e6227c18 100644 --- a/usr/src/lib/libprtdiag/inc/libprtdiag.h +++ b/usr/src/lib/libprtdiag/inc/libprtdiag.h @@ -21,13 +21,12 @@ /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2020 Peter Tribble. */ #ifndef _SYS_LIBPRTDIAG_H #define _SYS_LIBPRTDIAG_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -132,15 +131,15 @@ void decode_qlc_card_model_prop(Prom_node *card_node, struct io_card *card); */ void read_platform_kstats(Sys_tree *tree, struct system_kstat_data *sys_kstat, - struct bd_kstat_data *bdp, struct envctrl_kstat_data *ep); + struct envctrl_kstat_data *ep); void read_sun4u_kstats(Sys_tree *, struct system_kstat_data *); /* * memory functions */ void display_memorysize(Sys_tree *tree, struct system_kstat_data *kstats, - struct grp_info *grps, struct mem_total *memory_total); -void display_memoryconf(Sys_tree *tree, struct grp_info *grps); + struct mem_total *memory_total); +void display_memoryconf(Sys_tree *tree); /* * prom functions diff --git a/usr/src/lib/libprtdiag/inc/pdevinfo_sun4u.h b/usr/src/lib/libprtdiag/inc/pdevinfo_sun4u.h index 7273d62b8d..c4038e4535 100644 --- a/usr/src/lib/libprtdiag/inc/pdevinfo_sun4u.h +++ b/usr/src/lib/libprtdiag/inc/pdevinfo_sun4u.h @@ -22,68 +22,45 @@ /* * Copyright (c) 1999 by Sun Microsystems, Inc. * All rights reserved. + * Copyright (c) 2020 Peter Tribble. */ #ifndef _PDEVINFO_SUN4U_H #define _PDEVINFO_SUN4U_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/obpdefs.h> -#include <sys/fhc.h> -#include <sys/sysctrl.h> -#include <sys/environ.h> #include <sys/envctrl_gen.h> #include <sys/envctrl_ue250.h> #include <sys/envctrl_ue450.h> -#include <sys/simmstat.h> -#include <sys/ac.h> -#include <sys/sram.h> -#include <reset_info.h> #ifdef __cplusplus extern "C" { #endif -#define UNIX "unix" +/* + * These were formerly defined in sys/ac.h, which was specific to sunfire, + * but usage has leaked into generic code. + */ +#ifndef TRUE +#define TRUE (1) +#endif +#ifndef FALSE +#define FALSE (0) +#endif + +/* + * These were formerly defined as part of the board_type enum in sys/fhc.h, + * which was specific to sunfire, but usage has leaked into generic code. + */ +#define UNKNOWN_BOARD 1 +#define CPU_BOARD 2 /* Define names of nodes to search for */ -#define CPU_NAME "SUNW,UltraSPARC" #define SBUS_NAME "sbus" #define PCI_NAME "pci" #define FFB_NAME "SUNW,ffb" #define AFB_NAME "SUNW,afb" -struct mem_stat_data { - enum ac_bank_status status; /* bank status values */ - enum ac_bank_condition condition; /* bank conditions */ -}; - -struct bd_kstat_data { - u_longlong_t ac_memctl; /* Memctl register contents */ - u_longlong_t ac_memdecode[2]; /* memory decode registers . */ - int ac_kstats_ok; /* successful kstat read occurred */ - uint_t fhc_bsr; /* FHC Board Status Register */ - uint_t fhc_csr; /* FHC Control Status Register */ - int fhc_kstats_ok; /* successful kstat read occurred */ - uchar_t simm_status[SIMM_COUNT]; /* SIMM status */ - int simmstat_kstats_ok; /* successful read occurred */ - struct temp_stats tempstat; - int temp_kstat_ok; - struct mem_stat_data mem_stat[2]; /* raw kstat bank information */ - int ac_memstat_ok; /* successful read of memory status */ -}; - -/* - * Hot plug info structure. If a hotplug kstat is found, the bd_info - * structure from the kstat is filled in the the hp_info structure - * is marked OK. - */ -struct hp_info { - struct bd_info bd_info; - int kstat_ok; -}; - /* Environmental info for Tazmo */ struct envctrl_kstat_data { envctrl_ps_t ps_kstats[MAX_DEVS]; /* kstats for powersupplies */ @@ -106,69 +83,15 @@ struct envctrltwo_kstat_data { }; struct system_kstat_data { - uchar_t sysctrl; /* sysctrl register contents */ - uchar_t sysstat1; /* system status1 register contents. */ - uchar_t sysstat2; /* system status2 register contents. */ - uchar_t ps_shadow[SYS_PS_COUNT]; /* power supply shadow */ - int psstat_kstat_ok; - uchar_t clk_freq2; /* clock frequency register 2 contents */ - uchar_t fan_status; /* shadow fan status */ - uchar_t keysw_status; /* status of the key switch */ - enum power_state power_state; /* redundant power state */ - uchar_t clk_ver; /* clock version register */ int sys_kstats_ok; /* successful kstat read occurred */ - struct temp_stats tempstat; - int temp_kstat_ok; - struct reset_info reset_info; - int reset_kstats_ok; /* kstat read OK */ - struct bd_kstat_data bd_ksp_list[MAX_BOARDS]; - struct hp_info hp_info[MAX_BOARDS]; - struct ft_list *ft_array; /* fault array */ - int nfaults; /* number of faults in fault array */ - int ft_kstat_ok; /* Fault kstats OK */ struct envctrl_kstat_data env_data; /* environment data for Tazmo */ int envctrl_kstat_ok; struct envctrltwo_kstat_data envc_data; /* environ data for Javelin */ int envctrltwo_kstat_ok; }; -/* Description of a single memory group */ -struct grp { - int valid; /* active memory group present */ - u_longlong_t base; /* Phyiscal base of group */ - uint_t size; /* size in bytes */ - uint_t curr_size; /* current size in bytes */ - int board; /* board number */ - enum board_type type; /* board type */ - int group; /* group # on board (0 or 1) */ - int factor; /* interleave factor (0,2,4,8,16) */ - int speed; /* Memory speed (in ns) */ - char groupid; /* Alpha tag for group ID */ - enum ac_bank_status status; /* bank status values */ - enum ac_bank_condition condition; /* bank conditions */ -}; - -#define MAX_GROUPS 32 #define MAXSTRLEN 256 -/* Array of all possible groups in the system. */ -struct grp_info { - struct grp grp[MAX_GROUPS]; -}; - -/* A memory interleave structure */ -struct inter_grp { - u_longlong_t base; /* Physical base of group */ - int valid; - int count; - char groupid; -}; - -/* Array of all possible memory interleave structures */ -struct mem_inter { - struct inter_grp i_grp[MAX_GROUPS]; -}; - /* FFB info structure */ struct ffbinfo { int board; diff --git a/usr/src/lib/libprtdiag/inc/reset_info.h b/usr/src/lib/libprtdiag/inc/reset_info.h deleted file mode 100644 index 8f94813a6f..0000000000 --- a/usr/src/lib/libprtdiag/inc/reset_info.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1999 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ifndef _RESET_INFO_H -#define _RESET_INFO_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * All of the following data structures and defines come from sun4u server - * POST. If the data in POST changes, then these structures must reflect - * those changes. - */ - -#include <sys/fhc.h> /* To get MAX_BOARDS constant */ - -/* BDA bit assignments */ -#define BOARD_PRESENT (1<<0) -#define BOARD_OK (1<<1) -#define BOARD_TYPE_MSK (7<<2) -#define BOARD_TYPE(x) (((x) & BOARD_TYPE_MSK) >> 2) - -/* Board state mask and defines */ -#define BD_STATE_MASK 0x3 -#define BD_LPM_FZN 0 -#define BD_ONLINE_FAIL 1 -#define BD_NOT_PRESENT 2 -#define BD_ONLINE_NORMAL 3 - -/* define CPU 0 fields */ -#define CPU0_PRESENT (1<<8) -#define CPU0_OK (1<<9) -#define CPU0_FAIL_CODE_MSK (7<<10) - -/* define CPU 1 fields */ -#define CPU1_PRESENT (1<<16) -#define CPU1_OK (1<<17) -#define CPU1_FAIL_CODE_MSK (7<<18) - -/* supported board types */ -#define CPU_TYPE 0 -#define MEM_TYPE 1 /* CPU/MEM board with only memory */ -#define IO_TYPE1 2 -#define IO_TYPE2 3 -#define IO_TYPE3 4 -#define IO_TYPE4 5 /* same as IO TYPE 1 but no HM or PHY chip */ -#define CLOCK_TYPE 7 - -/* for CPU type UPA ports */ -typedef struct { - u_longlong_t afsr; /* Fault status register for CPU */ - u_longlong_t afar; /* Fault address register for CPU */ -} cpu_reset_state; - -/* For the clock board */ -typedef struct { - unsigned long clk_ssr_1; /* reset status for the clock board */ -} clock_reset_state; - -struct board_info { - u_longlong_t board_desc; - cpu_reset_state cpu[2]; /* could be a CPU */ - u_longlong_t ac_error_status; - u_longlong_t dc_shadow_chain; - uint_t fhc_csr; - uint_t fhc_rcsr; -}; - -struct reset_info { - int length; /* size of the structure */ - int version; /* Version of the structure */ - struct board_info bd_reset_info[MAX_BOARDS]; - clock_reset_state clk; /* one clock board */ - unsigned char tod_timestamp[7]; -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _RESET_INFO_H */ diff --git a/usr/src/lib/libprtdiag_psr/sparc/Makefile b/usr/src/lib/libprtdiag_psr/sparc/Makefile index 2755dcd558..5ca9074498 100644 --- a/usr/src/lib/libprtdiag_psr/sparc/Makefile +++ b/usr/src/lib/libprtdiag_psr/sparc/Makefile @@ -21,11 +21,11 @@ # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. -# Copyright 2019 Peter Tribble. +# Copyright 2020 Peter Tribble. # # lib/libprtdiag_psr/sparc/Makefile -PRTDIAG_PLATFORMS= desktop tazmo javelin sunfire serengeti \ +PRTDIAG_PLATFORMS= desktop tazmo javelin serengeti \ littleneck daktari cherrystone \ lw8 ontario schumacher opl montoya monza diff --git a/usr/src/lib/libprtdiag_psr/sparc/Makefile.com b/usr/src/lib/libprtdiag_psr/sparc/Makefile.com index af44a80223..d3f93b3e06 100644 --- a/usr/src/lib/libprtdiag_psr/sparc/Makefile.com +++ b/usr/src/lib/libprtdiag_psr/sparc/Makefile.com @@ -21,7 +21,7 @@ # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. -# Copyright 2019 Peter Tribble. +# Copyright 2020 Peter Tribble. # LIBRARY= libprtdiag_psr.a @@ -34,7 +34,7 @@ VERS= .1 # PSR_MACH= sun4u # -# PLATFORM_OBJECTS is defined in ./desktop ./wgs ./sunfire Makefiles +# PLATFORM_OBJECTS is defined in ./desktop ./wgs Makefiles # OBJECTS= $(PLATFORM_OBJECTS) @@ -56,9 +56,8 @@ CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-unused-function CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-address -IFLAGS += -I $(UTSBASE)/sun4u -IFLAGS += -I $(UTSCLOSED)/sun4u -IFLAGS += -I $(UTSCLOSED)/sun4u/sunfire -I $(UTSBASE)/sun4u/sunfire +IFLAGS += -I $(UTSBASE)/sun4u +IFLAGS += -I $(UTSCLOSED)/sun4u CPPFLAGS = $(IFLAGS) $(CPPFLAGS.master) LDLIBS += -L $(ROOT)/usr/platform/$(PSR_MACH)/lib -lprtdiag -lc DYNFLAGS += -R /usr/platform/$(PSR_MACH)/lib diff --git a/usr/src/lib/libprtdiag_psr/sparc/cherrystone/common/cherrystone.c b/usr/src/lib/libprtdiag_psr/sparc/cherrystone/common/cherrystone.c index 74731ac662..29e8703a5a 100644 --- a/usr/src/lib/libprtdiag_psr/sparc/cherrystone/common/cherrystone.c +++ b/usr/src/lib/libprtdiag_psr/sparc/cherrystone/common/cherrystone.c @@ -21,6 +21,7 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2020 Peter Tribble. */ /* @@ -29,8 +30,6 @@ * */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -75,7 +74,7 @@ void display_io_cards(struct io_card *list); void display_diaginfo(int flag, Prom_node *root, Sys_tree *tree, struct system_kstat_data *kstats); void display_ffb(Board_node *board, int table); -void display_memoryconf(Sys_tree *tree, struct grp_info *grps); +void display_memoryconf(Sys_tree *tree); /* local functions */ static void disp_envc_status(void); @@ -229,9 +228,8 @@ display_cpus(Board_node *board) } } -/*ARGSUSED0*/ void -display_memoryconf(Sys_tree *tree, struct grp_info *grps) +display_memoryconf(Sys_tree *tree) { Board_node *bnode = tree->bd_list; diff --git a/usr/src/lib/libprtdiag_psr/sparc/daktari/common/daktari.c b/usr/src/lib/libprtdiag_psr/sparc/daktari/common/daktari.c index d4fc81913b..fd28266b86 100644 --- a/usr/src/lib/libprtdiag_psr/sparc/daktari/common/daktari.c +++ b/usr/src/lib/libprtdiag_psr/sparc/daktari/common/daktari.c @@ -21,18 +21,17 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2020 Peter Tribble. */ /* * Daktari Platform specific functions. * - * called when : + * called when : * machine_type == MTYPE_DAKTARI * */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -85,7 +84,7 @@ void display_io_cards(struct io_card *list); void display_diaginfo(int flag, Prom_node *root, Sys_tree *tree, struct system_kstat_data *kstats); void display_ffb(Board_node *board, int table); -void display_memoryconf(Sys_tree *tree, struct grp_info *grps); +void display_memoryconf(Sys_tree *tree); /* local functions */ static int disp_envc_status(void); @@ -241,9 +240,8 @@ display_hp_fail_fault(Sys_tree *tree, struct system_kstat_data *kstats) (void) disp_fail_parts(tree); } -/*ARGSUSED*/ void -display_memoryconf(Sys_tree *tree, struct grp_info *grps) +display_memoryconf(Sys_tree *tree) { Board_node *bnode = tree->bd_list; diff --git a/usr/src/lib/libprtdiag_psr/sparc/desktop/common/desktop.c b/usr/src/lib/libprtdiag_psr/sparc/desktop/common/desktop.c index 29d72ee246..91c02cb8ae 100644 --- a/usr/src/lib/libprtdiag_psr/sparc/desktop/common/desktop.c +++ b/usr/src/lib/libprtdiag_psr/sparc/desktop/common/desktop.c @@ -22,6 +22,7 @@ /* * Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2020 Peter Tribble. * * Desktop Platform specific functions. * @@ -31,8 +32,6 @@ * */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -89,15 +88,11 @@ extern int print_flag; * at runtime (desktop systems only) */ int error_check(Sys_tree *tree, struct system_kstat_data *kstats); -void display_memoryconf(Sys_tree *tree, struct grp_info *grps); int disp_fail_parts(Sys_tree *tree); void display_hp_fail_fault(Sys_tree *tree, struct system_kstat_data *kstats); void display_diaginfo(int flag, Prom_node *root, Sys_tree *tree, struct system_kstat_data *kstats); void display_pci(Board_node *bnode); -void read_platform_kstats(Sys_tree *tree, - struct system_kstat_data *sys_kstat, - struct bd_kstat_data *bdp, struct envctrl_kstat_data *ep); void display_sbus(Board_node *); @@ -130,22 +125,13 @@ error_check(Sys_tree *tree, struct system_kstat_data *kstats) } -void -display_memoryconf(Sys_tree *tree, struct grp_info *grps) -{ -#ifdef lint - tree = tree; - grps = grps; -#endif -} - /* * disp_fail_parts * * Display the failed parts in the system. This function looks for * the status property in all PROM nodes. On systems where - * the PROM does not supports passing diagnostic information - * thruogh the device tree, this routine will be silent. + * the PROM does not support passing diagnostic information + * through the device tree, this routine will be silent. */ int disp_fail_parts(Sys_tree *tree) @@ -318,20 +304,6 @@ display_pci(Board_node *bnode) } } -void -read_platform_kstats(Sys_tree *tree, struct system_kstat_data *sys_kstat, - struct bd_kstat_data *bdp, struct envctrl_kstat_data *ep) - -{ -#ifdef lint - tree = tree; - sys_kstat = sys_kstat; - bdp = bdp; - ep = ep; -#endif -} - - /* * local functions */ diff --git a/usr/src/lib/libprtdiag_psr/sparc/javelin/common/javelin.c b/usr/src/lib/libprtdiag_psr/sparc/javelin/common/javelin.c index 1327ae9248..cae193a670 100644 --- a/usr/src/lib/libprtdiag_psr/sparc/javelin/common/javelin.c +++ b/usr/src/lib/libprtdiag_psr/sparc/javelin/common/javelin.c @@ -22,6 +22,7 @@ /* * Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2020 Peter Tribble. * * Javelin Platform specific functions. * @@ -67,7 +68,7 @@ extern int print_flag; * at runtime (workgroup server systems only) */ int error_check(Sys_tree *tree, struct system_kstat_data *kstats); -void display_memoryconf(Sys_tree *tree, struct grp_info *grps); +void display_memoryconf(Sys_tree *tree); int disp_fail_parts(Sys_tree *tree); void display_hp_fail_fault(Sys_tree *tree, struct system_kstat_data *kstats); void display_diaginfo(int flag, Prom_node *root, Sys_tree *tree, @@ -78,7 +79,7 @@ void display_io_cards(struct io_card *list); void display_ffb(Board_node *, int); void read_platform_kstats(Sys_tree *tree, struct system_kstat_data *sys_kstat, - struct bd_kstat_data *bdp, struct envctrl_kstat_data *ep); + struct envctrl_kstat_data *ep); /* local functions */ static int disp_envc_status(struct system_kstat_data *); @@ -129,7 +130,7 @@ dev_next_node_sibling(Prom_node *root, char *name) * DIMM sizes, DIMM socket names. */ void -display_memoryconf(Sys_tree *tree, struct grp_info *grps) +display_memoryconf(Sys_tree *tree) { Board_node *bnode; Prom_node *memory; @@ -144,9 +145,6 @@ display_memoryconf(Sys_tree *tree, struct grp_info *grps) Prop *status_prop; char interleave[8]; int total_size = 0; -#ifdef lint - grps = grps; -#endif log_printf("\n", 0); log_printf("=========================", 0); @@ -752,11 +750,11 @@ display_ffb(Board_node *board, int table) /* * This module does the reading and interpreting of javelin system - * kstats. These kstats are created by the environ drivers. + * kstats. These kstats are created by the envctrl drivers. */ void read_platform_kstats(Sys_tree *tree, struct system_kstat_data *sys_kstat, - struct bd_kstat_data *bdp, struct envctrl_kstat_data *ep) + struct envctrl_kstat_data *ep) { kstat_ctl_t *kc; struct envctrltwo_kstat_data *ecp; @@ -765,11 +763,6 @@ read_platform_kstats(Sys_tree *tree, struct system_kstat_data *sys_kstat, if ((kc = kstat_open()) == NULL) { return; } -#ifdef lint - tree = tree; - bdp = bdp; - ep = ep; -#endif /* read the envctrltwo kstats */ ecp = &sys_kstat->envc_data; diff --git a/usr/src/lib/libprtdiag_psr/sparc/littleneck/common/littleneck.c b/usr/src/lib/libprtdiag_psr/sparc/littleneck/common/littleneck.c index 89321c0455..828b26a95e 100644 --- a/usr/src/lib/libprtdiag_psr/sparc/littleneck/common/littleneck.c +++ b/usr/src/lib/libprtdiag_psr/sparc/littleneck/common/littleneck.c @@ -21,16 +21,15 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2020 Peter Tribble. * * Littleneck Platform specific functions. * - * called when : + * called when : * machine_type == MTYPE_LITTLENECK * */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -81,7 +80,7 @@ void display_io_cards(struct io_card *list); void display_diaginfo(int flag, Prom_node *root, Sys_tree *tree, struct system_kstat_data *kstats); void display_ffb(Board_node *board, int table); -void display_memoryconf(Sys_tree *tree, struct grp_info *grps); +void display_memoryconf(Sys_tree *tree); /* local functions */ static int disp_envc_status(void); @@ -231,9 +230,8 @@ display_cpus(Board_node *board) } } -/*ARGSUSED0*/ void -display_memoryconf(Sys_tree *tree, struct grp_info *grps) +display_memoryconf(Sys_tree *tree) { Board_node *bnode = tree->bd_list; diff --git a/usr/src/lib/libprtdiag_psr/sparc/opl/common/opl.c b/usr/src/lib/libprtdiag_psr/sparc/opl/common/opl.c index e12330a75a..640cda2970 100644 --- a/usr/src/lib/libprtdiag_psr/sparc/opl/common/opl.c +++ b/usr/src/lib/libprtdiag_psr/sparc/opl/common/opl.c @@ -21,10 +21,11 @@ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2020 Peter Tribble. * * Opl Platform specific functions. * - * called when : + * called when : * machine_type == MTYPE_OPL */ @@ -85,12 +86,12 @@ void display_ffb(Board_node *, int); void display_sbus(Board_node *board); void display_cpu_devices(Sys_tree *tree); void display_cpus(Board_node *board); -void display_memoryconf(Sys_tree *tree, struct grp_info *grps); +void display_memoryconf(Sys_tree *tree); void display_io_cards(struct io_card *list); void display_io_devices(Sys_tree *tree); void display_diaginfo(int flag, Prom_node *root, Sys_tree *tree, struct system_kstat_data *kstats); -Prop *find_prop(Prom_node *pnode, char *name); +Prop *find_prop(Prom_node *pnode, char *name); int do_piclinfo(int); int get_proc_mode(void); @@ -500,9 +501,8 @@ get_opl_mem_regs(Board_node *bnode) /* * Display memory information. */ -/*ARGSUSED*/ void -display_memoryconf(Sys_tree *tree, struct grp_info *grps) +display_memoryconf(Sys_tree *tree) { Board_node *bnode = tree->bd_list; uint64_t total_mem = 0, total_sys_mem = 0; diff --git a/usr/src/lib/libprtdiag_psr/sparc/serengeti/common/serengeti.c b/usr/src/lib/libprtdiag_psr/sparc/serengeti/common/serengeti.c index d77455e83d..6d95747413 100644 --- a/usr/src/lib/libprtdiag_psr/sparc/serengeti/common/serengeti.c +++ b/usr/src/lib/libprtdiag_psr/sparc/serengeti/common/serengeti.c @@ -21,6 +21,7 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2020 Peter Tribble. * * Serengeti Platform specific functions. * @@ -136,7 +137,7 @@ void display_diaginfo(int flag, Prom_node *root, Sys_tree *tree, void display_hp_fail_fault(Sys_tree *tree, struct system_kstat_data *kstats); void get_failed_parts(void); int display_failed_parts(Sys_tree *tree); -void display_memoryconf(Sys_tree *tree, struct grp_info *grps); +void display_memoryconf(Sys_tree *tree); void print_us3_memory_line(int portid, int bank_id, uint64_t bank_size, char *bank_status, uint64_t dimm_size, uint32_t intlv, int seg_id); @@ -1766,9 +1767,8 @@ display_failed_parts(Sys_tree *tree) * This routine displays the memory configuration for all boards in the * system. */ -/*ARGSUSED0*/ void -display_memoryconf(Sys_tree *tree, struct grp_info *grps) +display_memoryconf(Sys_tree *tree) { Board_node *bnode = tree->bd_list; diff --git a/usr/src/lib/libprtdiag_psr/sparc/sunfire/Makefile b/usr/src/lib/libprtdiag_psr/sparc/sunfire/Makefile deleted file mode 100644 index 8bec1ea7d7..0000000000 --- a/usr/src/lib/libprtdiag_psr/sparc/sunfire/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2016 Gary Mills -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# lib/libprtdiag_psr/sparc/sunfire/Makefile - -UTSBASE = ../../../../uts - -PLATFORM_OBJECTS= sunfire.o - -include ../Makefile.com - -IFLAGS += -I$(USR_PLAT_DIR)/sun4u/include -I ../../../libprtdiag/inc -LINTFLAGS += $(IFLAGS) - -PLATFORM=SUNW,Ultra-Enterprise - -$(USR_PLAT_DIR)/$(PLATFORM)/lib/libprtdiag_psr.so.1 := FILEMODE= 0755 - -.KEEP_STATE: - -PLATLIBS= $(USR_PLAT_DIR)/$(PLATFORM)/lib/ - -install: all $(USR_PSM_LIBS) - -$(USR_PSM_LIB_DIR): - cd $(UTSBASE)/sun4u/sunfire; $(MAKE) $(USR_PSM_LIB_DIR) - -# -# install rule -# -$(USR_PSM_LIB_DIR)/%: % $(USR_PSM_LIB_DIR) - $(INS.file) - - -POFILE= libprtdiag_psr_sunfire.po -POFILES= sunfire.po - -_msg: $(MSGDOMAIN) $(POFILE) - $(RM) $(MSGDOMAIN)/$(POFILE) - $(CP) $(POFILE) $(MSGDOMAIN) - -$(POFILE): $(POFILES) - $(RM) $@ - $(CAT) $(POFILES) > $@ - -$(POFILES): - $(RM) messages.po - $(XGETTEXT) $(XGETFLAGS) `$(GREP) -l gettext common/sunfire.c` - $(SED) -e '/^# msg/d' -e '/^domain/d' messages.po > $@ - $(RM) messages.po diff --git a/usr/src/lib/libprtdiag_psr/sparc/sunfire/common/sunfire.c b/usr/src/lib/libprtdiag_psr/sparc/sunfire/common/sunfire.c deleted file mode 100644 index cfb83f25a0..0000000000 --- a/usr/src/lib/libprtdiag_psr/sparc/sunfire/common/sunfire.c +++ /dev/null @@ -1,2284 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - * - * Sunfire Platform specific functions. - * - * called when : - * machine_type == MTYPE_SUNFIRE - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <ctype.h> -#include <string.h> -#include <kvm.h> -#include <varargs.h> -#include <time.h> -#include <dirent.h> -#include <fcntl.h> -#include <errno.h> -#include <sys/param.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <sys/utsname.h> -#include <sys/openpromio.h> -#include <libintl.h> -#include <syslog.h> -#include <sys/dkio.h> -#include "pdevinfo.h" -#include "display.h" -#include "pdevinfo_sun4u.h" -#include "display_sun4u.h" -#include "libprtdiag.h" - -#if !defined(TEXT_DOMAIN) -#define TEXT_DOMAIN "SYS_TEST" -#endif - -/* Macros for manipulating UPA IDs and board numbers on Sunfire. */ -#define bd_to_upa(bd) ((bd) << 1) -#define upa_to_bd(upa) ((upa) >> 1) - -#define MAX_MSGS 64 - -extern int print_flag; - -/* - * these functions will overlay the symbol table of libprtdiag - * at runtime (sunfire systems only) - */ -int error_check(Sys_tree *tree, struct system_kstat_data *kstats); -void display_memoryconf(Sys_tree *tree, struct grp_info *grps); -int disp_fail_parts(Sys_tree *tree); -void display_memorysize(Sys_tree *tree, struct system_kstat_data *kstats, - struct grp_info *grps, struct mem_total *memory_total); -void display_hp_fail_fault(Sys_tree *tree, struct system_kstat_data *kstats); -void display_diaginfo(int flag, Prom_node *root, Sys_tree *tree, - struct system_kstat_data *kstats); -void display_mid(int mid); -void display_pci(Board_node *); -void display_ffb(Board_node *, int); -void add_node(Sys_tree *, Prom_node *); -void resolve_board_types(Sys_tree *); - -/* local functions */ -static void build_mem_tables(Sys_tree *, struct system_kstat_data *, - struct grp_info *); -static void get_mem_total(struct mem_total *, struct grp_info *); -static int disp_fault_list(Sys_tree *, struct system_kstat_data *); -static int disp_err_log(struct system_kstat_data *); -static int disp_env_status(struct system_kstat_data *); -static int disp_keysw_and_leds(struct system_kstat_data *); -static void sunfire_disp_prom_versions(Sys_tree *); -static void erase_msgs(char **); -static void display_msgs(char **msgs, int board); -static void sunfire_disp_asic_revs(Sys_tree *, struct system_kstat_data *); -static void display_hp_boards(struct system_kstat_data *); -static int disp_parts(char **, u_longlong_t, int); -/* - * Error analysis routines. These routines decode data from specified - * error registers. They are meant to be used for decoding the fatal - * hardware reset data passed to the kernel by sun4u POST. - */ -static int analyze_cpu(char **, int, u_longlong_t); -static int analyze_ac(char **, u_longlong_t); -static int analyze_dc(int, char **, u_longlong_t); - -#define RESERVED_STR "Reserved" - -#define MAX_PARTS 5 -#define MAX_FRUS 5 - -#define MAXSTRLEN 256 - -/* Define special bits */ -#define UPA_PORT_A 0x1 -#define UPA_PORT_B 0x2 - - -/* - * These defines comne from async.h, but it does not get exported from - * uts/sun4u/sys, so they must be redefined. - */ -#define P_AFSR_ISAP 0x0000000040000000ULL /* incoming addr. parity err */ -#define P_AFSR_ETP 0x0000000020000000ULL /* ecache tag parity */ -#define P_AFSR_ETS 0x00000000000F0000ULL /* cache tag parity syndrome */ -#define ETS_SHIFT 16 - -/* List of parts possible */ -#define RSVD_PART 1 -#define UPA_PART 2 -#define UPA_A_PART 3 -#define UPA_B_PART 4 -#define SOFTWARE_PART 5 -#define AC_PART 6 -#define AC_ANY_PART 7 -#define DTAG_PART 8 -#define DTAG_A_PART 9 -#define DTAG_B_PART 10 -#define FHC_PART 11 -#define BOARD_PART 12 -#define BOARD_ANY_PART 13 -#define BOARD_CONN_PART 14 -#define BACK_PIN_PART 15 -#define BACK_TERM_PART 16 -#define CPU_PART 17 - -/* List of possible parts */ -static char *part_str[] = { - "", /* 0, a placeholder for indexing */ - "", /* 1, reserved strings shouldn't be printed */ - "UPA devices", /* 2 */ - "UPA Port A device", /* 3 */ - "UPA Port B device", /* 4 */ - "Software error", /* 5 */ - "Address Controller", /* 6 */ - "Undetermined Address Controller in system", /* 7 */ - "Data Tags", /* 8 */ - "Data Tags for UPA Port A", /* 9 */ - "Data Tags for UPA Port B", /* 10 */ - "Firehose Controller", /* 11 */ - "This Board", /* 12 */ - "Undetermined Board in system", /* 13 */ - "Board Connector", /* 14 */ - "Centerplane pins ", /* 15 */ - "Centerplane terminators", /* 16 */ - "CPU", /* 17 */ -}; - -/* Ecache parity error messages. Tells which bits are bad. */ -static char *ecache_parity[] = { - "Bits 7:0 ", - "Bits 15:8 ", - "Bits 21:16 ", - "Bits 24:22 " -}; - - -struct ac_error { - char *error; - int part[MAX_PARTS]; -}; - -typedef struct ac_error ac_err; - -/* - * Hardware error register meanings, failed parts and FRUs. The - * following strings are indexed for the bit positions of the - * corresponding bits in the hardware. The code checks bit x of - * the hardware error register and prints out string[x] if the bit - * is turned on. - * - * This database of parts which are probably failed and which FRU's - * to replace was based on knowledge of the Sunfire Programmers Spec. - * and discussions with the hardware designers. The order of the part - * lists and consequently the FRU lists are in the order of most - * likely cause first. - */ -static ac_err ac_errors[] = { - { /* 0 */ - "UPA Port A Error", - { UPA_A_PART, 0, 0, 0, 0 }, - }, - { /* 1 */ - "UPA Port B Error", - { UPA_B_PART, 0, 0, 0, 0 }, - }, - { /* 2 */ - NULL, - { RSVD_PART, 0, 0, 0, 0 }, - }, - { /* 3 */ - NULL, - { RSVD_PART, 0, 0, 0, 0 }, - }, - { /* 4 */ - "UPA Interrupt to unmapped destination", - { BOARD_PART, 0, 0, 0, 0 }, - }, - { /* 5 */ - "UPA Non-cacheable write to unmapped destination", - { BOARD_PART, 0, 0, 0, 0 }, - }, - { /* 6 */ - "UPA Cacheable write to unmapped destination", - { BOARD_PART, 0, 0, 0, 0 }, - }, - { /* 7 */ - "Illegal Write Received", - { BOARD_PART, 0, 0, 0, 0 }, - }, - { /* 8 */ - "Local Writeback match with line in state S", - { AC_PART, DTAG_PART, 0, 0, 0 }, - }, - { /* 9 */ - "Local Read match with valid line in Tags", - { AC_PART, DTAG_PART, 0, 0, 0 }, - }, - { /* 10 */ - NULL, - { RSVD_PART, 0, 0, 0, 0 }, - }, - { /* 11 */ - NULL, - { RSVD_PART, 0, 0, 0, 0 }, - }, - { /* 12 */ - "Tag and Victim were valid during lookup", - { AC_PART, DTAG_PART, 0, 0, 0 }, - }, - { /* 13 */ - "Local Writeback matches a victim in state S", - { AC_PART, CPU_PART, 0, 0, 0 }, - }, - { /* 14 */ - "Local Read matches valid line in victim buffer", - { AC_PART, CPU_PART, 0, 0, 0 }, - }, - { /* 15 */ - "Local Read victim bit set and victim is S state", - { AC_PART, CPU_PART, 0, 0, 0 }, - }, - { /* 16 */ - "Local Read Victim bit set and Valid Victim Buffer", - { AC_PART, CPU_PART, 0, 0, 0 }, - }, - { /* 17 */ - NULL, - { RSVD_PART, 0, 0, 0, 0 }, - }, - { /* 18 */ - NULL, - { RSVD_PART, 0, 0, 0, 0 }, - }, - { /* 19 */ - NULL, - { RSVD_PART, 0, 0, 0, 0 }, - }, - { /* 20 */ - "UPA Transaction received in Sleep mode", - { AC_PART, 0, 0, 0, 0 }, - }, - { /* 21 */ - "P_FERR error P_REPLY received from UPA Port", - { CPU_PART, AC_PART, 0, 0, 0 }, - }, - { /* 22 */ - "Illegal P_REPLY received from UPA Port", - { CPU_PART, AC_PART, 0, 0, 0 }, - }, - { /* 23 */ - NULL, - { RSVD_PART, 0, 0, 0, 0 }, - }, - { /* 24 */ - "Timeout on a UPA Master Port", - { AC_ANY_PART, BOARD_ANY_PART, 0, 0, 0 }, - }, - { /* 25 */ - NULL, - { RSVD_PART, 0, 0, 0, 0 }, - }, - { /* 26 */ - NULL, - { RSVD_PART, 0, 0, 0, 0 }, - }, - { /* 27 */ - NULL, - { RSVD_PART, 0, 0, 0, 0 }, - }, - { /* 28 */ - "Coherent Transactions Queue Overflow Error", - { BACK_PIN_PART, BOARD_CONN_PART, AC_PART, AC_ANY_PART, 0 }, - }, - { /* 29 */ - "Non-cacheable Request Queue Overflow Error", - { AC_PART, AC_ANY_PART, 0, 0, 0 }, - }, - { /* 30 */ - "Non-cacheable Reply Queue Overflow Error", - { AC_PART, 0, 0, 0, 0 }, - }, - { /* 31 */ - "PREQ Queue Overflow Error", - { CPU_PART, AC_PART, 0, 0, 0 }, - }, - { /* 32 */ - "Foreign DID CAM Overflow Error", - { AC_PART, AC_ANY_PART, 0, 0, 0 }, - }, - { /* 33 */ - "FT->UPA Queue Overflow Error", - { BACK_PIN_PART, BOARD_CONN_PART, AC_PART, AC_ANY_PART, 0 }, - }, - { /* 34 */ - NULL, - { RSVD_PART, 0, 0, 0, 0 }, - }, - { /* 35 */ - NULL, - { RSVD_PART, 0, 0, 0, 0 }, - }, - { /* 36 */ - "UPA Port B Dtag Parity Error", - { DTAG_B_PART, AC_PART, 0, 0, 0 }, - }, - { /* 37 */ - "UPA Port A Dtag Parity Error", - { DTAG_A_PART, AC_PART, 0, 0, 0 }, - }, - { /* 38 */ - NULL, - { RSVD_PART, 0, 0, 0, 0 }, - }, - { /* 39 */ - NULL, - { RSVD_PART, 0, 0, 0, 0 }, - }, - { /* 40 */ - "UPA Bus Parity Error", - { UPA_PART, AC_PART, 0, 0, 0 }, - }, - { /* 41 */ - "Data ID Line Mismatch", - { BACK_PIN_PART, BOARD_CONN_PART, AC_PART, 0, 0 }, - }, - { /* 42 */ - "Arbitration Line Mismatch", - { BACK_PIN_PART, BOARD_CONN_PART, AC_PART, 0, 0 }, - }, - { /* 43 */ - "Shared Line Parity Mismatch", - { BACK_PIN_PART, BOARD_CONN_PART, AC_PART, 0, 0 }, - }, - { /* 44 */ - "FireTruck Control Line Parity Error", - { AC_PART, BACK_PIN_PART, 0, 0, 0 }, - }, - { /* 45 */ - "FireTruck Address Bus Parity Error", - { AC_PART, BACK_PIN_PART, 0, 0, 0 }, - }, - { /* 46 */ - "Internal RAM Parity Error", - { AC_PART, 0, 0, 0, 0 }, - }, - { /* 47 */ - NULL, - { RSVD_PART, 0, 0, 0, 0 }, - }, - { /* 48 */ - "Internal Hardware Error", - { AC_PART, 0, 0, 0, 0 }, - }, - { /* 49 */ - "FHC Communications Error", - { FHC_PART, AC_PART, 0, 0, 0 }, - }, - /* Bits 50-63 are reserved in this implementation. */ -}; - - -#define MAX_BITS (sizeof (ac_errors)/ sizeof (ac_err)) - -/* - * There are only two error bits in the DC shadow chain that are - * important. They indicate an overflow error and a parity error, - * respectively. The other bits are not error bits and should not - * be checked for. - */ -#define DC_OVERFLOW 0x2 -#define DC_PARITY 0x4 - -static char dc_overflow_txt[] = "Board %d DC %d Overflow Error"; -static char dc_parity_txt[] = "Board %d DC %d Parity Error"; - -/* defines for the sysio */ -#define UPA_APERR 0x4 - -int -error_check(Sys_tree *tree, struct system_kstat_data *kstats) -{ - int exit_code = 0; /* init to all OK */ - - /* - * silently check for any types of machine errors - */ - print_flag = 0; - if (disp_fail_parts(tree) || disp_fault_list(tree, kstats) || - disp_err_log(kstats) || disp_env_status(kstats)) { - /* set exit_code to show failures */ - exit_code = 1; - } - print_flag = 1; - - return (exit_code); -} - -/* - * disp_fail_parts - * - * Display the failed parts in the system. This function looks for - * the status property in all PROM nodes. On systems where - * the PROM does not supports passing diagnostic information - * thruogh the device tree, this routine will be silent. - */ -int -disp_fail_parts(Sys_tree *tree) -{ - int exit_code; - int system_failed = 0; - Board_node *bnode = tree->bd_list; - Prom_node *pnode; - - exit_code = 0; - - /* go through all of the boards looking for failed units. */ - while (bnode != NULL) { - /* find failed chips */ - pnode = find_failed_node(bnode->nodes); - if ((pnode != NULL) && !system_failed) { - system_failed = 1; - exit_code = 1; - if (print_flag == 0) { - return (exit_code); - } - log_printf("\n", 0); - log_printf(dgettext(TEXT_DOMAIN, - "Failed Field Replaceable Units (FRU) " - "in System:\n"), 0); - log_printf("==========================" - "====================\n", 0); - } - - while (pnode != NULL) { - void *value; - char *name; /* node name string */ - char *type; /* node type string */ - char *board_type = NULL; - - value = get_prop_val(find_prop(pnode, "status")); - name = get_node_name(pnode); - - /* sanity check of data retreived from PROM */ - if ((value == NULL) || (name == NULL)) { - pnode = next_failed_node(pnode); - continue; - } - - /* Find the board type of this board */ - if (bnode->board_type == CPU_BOARD) { - board_type = "CPU"; - } else { - board_type = "IO"; - } - - log_printf(dgettext(TEXT_DOMAIN, - "%s unavailable on %s Board #%d\n"), - name, board_type, bnode->board_num, 0); - - log_printf(dgettext(TEXT_DOMAIN, - "\tPROM fault string: %s\n"), value, 0); - - log_printf(dgettext(TEXT_DOMAIN, - "\tFailed Field Replaceable Unit is "), 0); - - /* - * Determine whether FRU is CPU module, system - * board, or SBus card. - */ - if ((name != NULL) && (strstr(name, "sbus"))) { - - log_printf(dgettext(TEXT_DOMAIN, - "SBus Card %d\n"), - get_sbus_slot(pnode), 0); - - } else if (((name = get_node_name(pnode->parent)) != - NULL) && (strstr(name, "pci"))) { - - log_printf(dgettext(TEXT_DOMAIN, - "PCI Card %d"), - get_pci_device(pnode), 0); - - } else if (((type = get_node_type(pnode)) != NULL) && - (strstr(type, "cpu"))) { - - log_printf(dgettext(TEXT_DOMAIN, - "UltraSPARC module " - "Board %d Module %d\n"), - get_id(pnode) >> 1, - get_id(pnode) & 0x1); - - } else { - log_printf(dgettext(TEXT_DOMAIN, - "%s board %d\n"), board_type, - bnode->board_num, 0); - } - pnode = next_failed_node(pnode); - } - bnode = bnode->next; - } - - if (!system_failed) { - log_printf("\n", 0); - log_printf(dgettext(TEXT_DOMAIN, - "No failures found in System\n"), 0); - log_printf("===========================\n", 0); - } - - if (system_failed) - return (1); - else - return (0); -} - -void -display_memorysize(Sys_tree *tree, struct system_kstat_data *kstats, - struct grp_info *grps, struct mem_total *memory_total) { - - /* Build the memory group tables and interleave data */ - build_mem_tables(tree, kstats, grps); - - /* display total usable installed memory */ - get_mem_total(memory_total, grps); - (void) log_printf(dgettext(TEXT_DOMAIN, - "Memory size: %4dMb\n"), memory_total->dram, 0); - - /* We display the NVSIMM size totals separately. */ - if (memory_total->nvsimm != 0) { - (void) log_printf(dgettext(TEXT_DOMAIN, - "NVSIMM size: %4dMb\n"), memory_total->nvsimm); - } -} - -/* - * This routine displays the memory configuration for all boards in the - * system. - */ -void -display_memoryconf(Sys_tree *tree, struct grp_info *grps) -{ - int group; - char *status_str[] = { "Unknown", " Empty ", " Failed", " Active", - " Spare " }; - char *cond_str[] = { " Unknown ", " OK ", " Failing ", - " Failed ", " Uninit. " }; - -#ifdef lint - tree = tree; -#endif - /* Print the header for the memory section. */ - log_printf("\n", 0); - log_printf("=========================", 0); - log_printf(dgettext(TEXT_DOMAIN, " Memory "), 0); - log_printf("=========================", 0); - log_printf("\n", 0); - log_printf("\n", 0); - log_printf(" Intrlv. " - "Intrlv.\n", 0); - log_printf("Brd Bank MB Status Condition Speed Factor " - " With\n", 0); - log_printf("--- ----- ---- ------- ---------- ----- ------- " - "-------\n", 0); - - /* Print the Memory groups information. */ - for (group = 0; group < MAX_GROUPS; group++) { - struct grp *grp; - - grp = &grps->grp[group]; - - /* If this board is not a CPU or MEM board, skip it. */ - if ((grp->type != MEM_BOARD) && (grp->type != CPU_BOARD)) { - continue; - } - - if (grp->valid) { - log_printf("%2d ", grp->board, 0); - log_printf(" %1d ", grp->group, 0); - log_printf("%4d ", grp->size, 0); - log_printf("%7s ", status_str[grp->status], 0); - log_printf("%10s ", cond_str[grp->condition], 0); - log_printf("%3dns ", grp->speed, 0); - log_printf("%3d-way ", grp->factor, 0); - if (grp->factor > 1) { - log_printf("%4c", grp->groupid, 0); - } - log_printf("\n", 0); - } - } - -} - - -void -display_hp_fail_fault(Sys_tree *tree, struct system_kstat_data *kstats) -{ - /* Display Hot plugged, disabled and failed boards */ - (void) display_hp_boards(kstats); - - /* Display failed units */ - (void) disp_fail_parts(tree); - - /* Display fault info */ - (void) disp_fault_list(tree, kstats); -} - -void -display_diaginfo(int flag, Prom_node *root, Sys_tree *tree, - struct system_kstat_data *kstats) -{ - /* - * Now display the last powerfail time and the fatal hardware - * reset information. We do this under a couple of conditions. - * First if the user asks for it. The second is iof the user - * told us to do logging, and we found a system failure. - */ - if (flag) { - /* - * display time of latest powerfail. Not all systems - * have this capability. For those that do not, this - * is just a no-op. - */ - disp_powerfail(root); - - /* Display system environmental conditions. */ - (void) disp_env_status(kstats); - - /* Display ASIC Chip revs for all boards. */ - sunfire_disp_asic_revs(tree, kstats); - - /* Print the PROM revisions here */ - sunfire_disp_prom_versions(tree); - - /* - * Display the latest system fatal hardware - * error data, if any. The system holds this - * data in SRAM, so it does not persist - * across power-on resets. - */ - (void) disp_err_log(kstats); - } -} - -void -display_mid(int mid) -{ - log_printf(" %2d ", mid % 2, 0); -} - -/* - * display_pci - * Call the generic psycho version of this function. - */ -void -display_pci(Board_node *board) -{ - display_psycho_pci(board); -} - -/* - * display_ffb - * Display all FFBs on this board. It can either be in tabular format, - * or a more verbose format. - */ -void -display_ffb(Board_node *board, int table) -{ - Prom_node *ffb; - void *value; - struct io_card *card_list = NULL; - struct io_card card; - - if (board == NULL) - return; - - /* Fill in common information */ - card.display = 1; - card.board = board->board_num; - (void) sprintf(card.bus_type, "UPA"); - card.freq = sys_clk; - - for (ffb = dev_find_node(board->nodes, FFB_NAME); ffb != NULL; - ffb = dev_next_node(ffb, FFB_NAME)) { - if (table == 1) { - /* Print out in table format */ - - /* XXX - Get the slot number (hack) */ - card.slot = get_id(ffb); - - /* Find out if it's single or double buffered */ - (void) sprintf(card.name, "FFB"); - value = get_prop_val(find_prop(ffb, "board_type")); - if (value != NULL) - if ((*(int *)value) & FFB_B_BUFF) - (void) sprintf(card.name, "FFB, " - "Double Buffered"); - else - (void) sprintf(card.name, "FFB, " - "Single Buffered"); - - /* Print model number */ - card.model[0] = '\0'; - value = get_prop_val(find_prop(ffb, "model")); - if (value != NULL) - (void) sprintf(card.model, "%s", - (char *)value); - - card_list = insert_io_card(card_list, &card); - } else { - /* print in long format */ - char device[MAXSTRLEN]; - int fd = -1; - struct dirent *direntp; - DIR *dirp; - union strap_un strap; - struct ffb_sys_info fsi; - - /* Find the device node using upa address */ - value = get_prop_val(find_prop(ffb, "upa-portid")); - if (value == NULL) - continue; - - (void) sprintf(device, "%s@%x", FFB_NAME, - *(int *)value); - if ((dirp = opendir("/devices")) == NULL) - continue; - - while ((direntp = readdir(dirp)) != NULL) { - if (strstr(direntp->d_name, device) != NULL) { - (void) sprintf(device, "/devices/%s", - direntp->d_name); - fd = open(device, O_RDWR, 0666); - break; - } - } - (void) closedir(dirp); - - if (fd == -1) - continue; - - if (ioctl(fd, FFB_SYS_INFO, &fsi) < 0) - continue; - - log_printf("Board %d FFB Hardware Configuration:\n", - board->board_num, 0); - log_printf("-----------------------------------\n", 0); - - strap.ffb_strap_bits = fsi.ffb_strap_bits; - log_printf("\tBoard rev: %d\n", - (int)strap.fld.board_rev, 0); - log_printf("\tFBC version: 0x%x\n", fsi.fbc_version, 0); - log_printf("\tDAC: %s\n", - fmt_manf_id(fsi.dac_version, device), 0); - log_printf("\t3DRAM: %s\n", - fmt_manf_id(fsi.fbram_version, device), 0); - log_printf("\n", 0); - } - } - - display_io_cards(card_list); - free_io_cards(card_list); -} - -/* - * add_node - * - * This function adds a board node to the board structure where that - * that node's physical component lives. - */ -void -add_node(Sys_tree *root, Prom_node *pnode) -{ - int board; - Board_node *bnode; - char *name = get_node_name(pnode); - Prom_node *p; - - /* add this node to the Board list of the appropriate board */ - if ((board = get_board_num(pnode)) == -1) { - void *value; - - /* - * if it is a server, pci nodes and ffb nodes never have - * board number properties and software can find the board - * number from the reg property. It is derived from the - * high word of the 'reg' property, which contains the - * mid. - */ - if ((name != NULL) && - ((strcmp(name, FFB_NAME) == 0) || - (strcmp(name, "pci") == 0) || - (strcmp(name, "counter-timer") == 0))) { - /* extract the board number from the 'reg' prop. */ - if ((value = get_prop_val(find_prop(pnode, - "reg"))) == NULL) { - (void) printf("add_node() no reg property\n"); - exit(2); - } - board = (*(int *)value - 0x1c0) / 4; - } - } - - /* find the node with the same board number */ - if ((bnode = find_board(root, board)) == NULL) { - bnode = insert_board(root, board); - bnode->board_type = UNKNOWN_BOARD; - } - - /* now attach this prom node to the board list */ - /* Insert this node at the end of the list */ - pnode->sibling = NULL; - if (bnode->nodes == NULL) - bnode->nodes = pnode; - else { - p = bnode->nodes; - while (p->sibling != NULL) - p = p->sibling; - p->sibling = pnode; - } - -} - -/* - * Function resolve_board_types - * - * After the tree is walked and all the information is gathered, this - * function is called to resolve the type of each board. - */ -void -resolve_board_types(Sys_tree *tree) -{ - Board_node *bnode; - Prom_node *pnode; - char *type; - - bnode = tree->bd_list; - while (bnode != NULL) { - bnode->board_type = UNKNOWN_BOARD; - - pnode = dev_find_node(bnode->nodes, "fhc"); - type = get_prop_val(find_prop(pnode, "board-type")); - if (type == NULL) { - bnode = bnode->next; - continue; - } - - if (strcmp(type, CPU_BD_NAME) == 0) { - bnode->board_type = CPU_BOARD; - } else if (strcmp(type, MEM_BD_NAME) == 0) { - bnode->board_type = MEM_BOARD; - } else if (strcmp(type, DISK_BD_NAME) == 0) { - bnode->board_type = DISK_BOARD; - } else if (strcmp(type, IO_SBUS_FFB_BD_NAME) == 0) { - bnode->board_type = IO_SBUS_FFB_BOARD; - } else if (strcmp(type, IO_2SBUS_BD_NAME) == 0) { - bnode->board_type = IO_2SBUS_BOARD; - } else if (strcmp(type, IO_PCI_BD_NAME) == 0) { - bnode->board_type = IO_PCI_BOARD; - } else if (strcmp(type, IO_2SBUS_SOCPLUS_BD_NAME) == 0) { - bnode->board_type = IO_2SBUS_SOCPLUS_BOARD; - } else if (strcmp(type, IO_SBUS_FFB_SOCPLUS_BD_NAME) == 0) { - bnode->board_type = IO_SBUS_FFB_SOCPLUS_BOARD; - } - - bnode = bnode->next; - } - -} - -/* - * local functions - */ - -static void -sunfire_disp_prom_versions(Sys_tree *tree) -{ - Board_node *bnode; - - /* Display Prom revision header */ - log_printf("System Board PROM revisions:\n", 0); - log_printf("----------------------------\n", 0); - - /* For each board, print the POST and OBP versions */ - for (bnode = tree->bd_list; bnode != NULL; bnode = bnode->next) { - Prom_node *flashprom; /* flashprom device node */ - - /* find a flashprom node for this board */ - flashprom = dev_find_node(bnode->nodes, "flashprom"); - - /* If no flashprom node found, continue */ - if (flashprom == NULL) - continue; - - /* flashprom node found, display board# */ - log_printf("Board %2d: ", bnode->board_num, 0); - - disp_prom_version(flashprom); - } -} - - -/* - * functions that are only needed inside this library - */ - -/* - * build_mem_tables - * - * This routine builds the memory table which tells how much memory - * is present in each SIMM group of each board, what the interleave - * factors are, and the group ID of the interleave group. - * - * The algorithms used are: - * First fill in the sizes of groups. - * Next build lists of all groups with same physical base. - * From #of members in each list, interleave factor is - * determined. - * All members of a certain list get the same interleave - * group ID. - */ -static void -build_mem_tables(Sys_tree *tree, - struct system_kstat_data *kstats, - struct grp_info *grps) -{ - struct mem_inter inter_grps; /* temp structure for interleaves */ - struct inter_grp *intrp; - int group; - int i; - - /* initialize the interleave lists */ - for (i = 0, intrp = &inter_grps.i_grp[0]; i < MAX_GROUPS; i++, - intrp++) { - intrp->valid = 0; - intrp->count = 0; - intrp->groupid = '\0'; - intrp->base = 0; - } - - for (group = 0; group < MAX_GROUPS; group++) { - int found; - int board; - struct grp *grp; - struct bd_kstat_data *bksp; - uchar_t simm_reg; - Board_node *bnode; - - board = group/2; - bksp = &kstats->bd_ksp_list[board]; - grp = &grps->grp[group]; - grp->group = group % 2; - - /* - * Copy the board type field into the group record. - */ - if ((bnode = find_board(tree, board)) != NULL) { - grp->type = bnode->board_type; - } else { - grp->type = UNKNOWN_BOARD; - continue; - } - - /* Make sure we have kstats for this board */ - if (bksp->ac_kstats_ok == 0) { - /* Mark this group as invalid and move to next one */ - grp->valid = 0; - continue; - } - - /* Find the bank status property */ - if (bksp->ac_memstat_ok) { - grp->status = bksp->mem_stat[grp->group].status; - grp->condition = bksp->mem_stat[grp->group].condition; - } else { - grp->status = StUnknown; - grp->condition = ConUnknown; - } - - switch (grp->status) { - case StBad: - case StActive: - case StSpare: - break; - default: - grp->status = StUnknown; - break; - } - - switch (grp->condition) { - case ConOK: - case ConFailing: - case ConFailed: - case ConTest: - case ConBad: - break; - default: - grp->condition = ConUnknown; - break; - } - - /* base the group size off of the simmstat kstat. */ - if (bksp->simmstat_kstats_ok == 0) { - grp->valid = 0; - continue; - } - - /* Is it bank 0 or bank 1 */ - if (grp->group == 0) { - simm_reg = bksp->simm_status[0]; - } else { - simm_reg = bksp->simm_status[1]; - } - - /* Now decode the size field. */ - switch (simm_reg & 0x1f) { - case MEM_SIZE_64M: - grp->size = 64; - break; - case MEM_SIZE_256M: - grp->size = 256; - break; - case MEM_SIZE_1G: - grp->size = 1024; - break; - case MEM_SIZE_2G: - grp->size = 2048; - break; - default: - grp->valid = 0; - continue; - } - - /* Decode the speed field */ - switch ((simm_reg & 0x60) >> 5) { - case MEM_SPEED_50ns: - grp->speed = 50; - break; - case MEM_SPEED_60ns: - grp->speed = 60; - break; - case MEM_SPEED_70ns: - grp->speed = 70; - break; - case MEM_SPEED_80ns: - grp->speed = 80; - break; - } - - grp->valid = 1; - grp->base = GRP_BASE(bksp->ac_memdecode[grp->group]); - grp->board = board; - if (grp->group == 0) { - grp->factor = INTLV0(bksp->ac_memctl); - } else { /* assume it is group 1 */ - grp->factor = INTLV1(bksp->ac_memctl); - } - grp->groupid = '\0'; /* Not in a group yet */ - - /* - * find the interleave list this group belongs on. If the - * interleave list corresponding to this base address is - * not found, then create a new one. - */ - - i = 0; - intrp = &inter_grps.i_grp[0]; - found = 0; - while ((i < MAX_GROUPS) && !found && (intrp->valid != 0)) { - if ((intrp->valid != 0) && - (intrp->base == grp->base)) { - grp->groupid = intrp->groupid; - intrp->count++; - found = 1; - } - i++; - intrp++; - } - /* - * We did not find a matching base. So now i and intrp - * now point to the next interleave group in the list. - */ - if (!found) { - intrp->count++; - intrp->valid = 1; - intrp->groupid = 'A' + (char)i; - intrp->base = grp->base; - grp->groupid = intrp->groupid; - } - } -} - - -static void -get_mem_total(struct mem_total *mem_total, struct grp_info *grps) -{ - struct grp *grp; - int i; - - /* Start with total of zero */ - mem_total->dram = 0; - mem_total->nvsimm = 0; - - /* For now we ignore NVSIMMs. We might want to fix this later. */ - for (i = 0, grp = &grps->grp[0]; i < MAX_GROUPS; i++, grp++) { - if (grp->valid == 1 && grp->status == StActive) { - mem_total->dram += grp->size; - } - } -} - -static int -disp_fault_list(Sys_tree *tree, struct system_kstat_data *kstats) -{ - struct ft_list *ftp; - int i; - int result = 0; - time_t t; - - if (!kstats->ft_kstat_ok) { - return (result); - } - - for (i = 0, ftp = kstats->ft_array; i < kstats->nfaults; i++, ftp++) { - if (!result) { - log_printf("\n", 0); - log_printf("Detected System Faults\n", 0); - log_printf("======================\n", 0); - } - result = 1; - if (ftp->fclass == FT_BOARD) { - log_printf("Board %d fault: %s\n", ftp->unit, - ftp->msg, 0); - - /* - * If the fault on this board is PROM inherited, see - * if we can find some failed component information - * in the PROM device tree. The general solution - * would be to fix the fhc driver and have it put in - * more descriptive messages, but that's for another - * day. - */ - - if (ftp->type == FT_PROM) { - Board_node *bn; - Prom_node *pn; - char *str; - - bn = find_board(tree, ftp->unit); - /* - * If any nodes under this board have a - * status containing "fail", print it out. - */ - pn = find_failed_node(bn->nodes); - while (pn) { - str = get_prop_val(find_prop(pn, - "status")); - if (str != NULL) { - log_printf("Fault: %s\n", str, - 0); - } - - pn = next_failed_node(pn); - } - } - } else if ((ftp->type == FT_CORE_PS) || (ftp->type == FT_PPS)) { - log_printf("Unit %d %s failure\n", ftp->unit, - ftp->msg, 0); - } else if ((ftp->type == FT_OVERTEMP) && - (ftp->fclass == FT_SYSTEM)) { - log_printf("Clock board %s\n", ftp->msg, 0); - } else { - log_printf("%s failure\n", ftp->msg, 0); - } - - t = (time_t)ftp->create_time; - log_printf("\tDetected %s", - asctime(localtime(&t)), 0); - } - - if (!result) { - log_printf("\n", 0); - log_printf("No System Faults found\n", 0); - log_printf("======================\n", 0); - } - - log_printf("\n", 0); - - return (result); -} - - -/* - * disp_err_log - * - * Display the fatal hardware reset system error logs. These logs are - * collected by POST and passed up through the kernel to userland. - * They will not necessarily be present in all systems. Their form - * might also be different in different systems. - * - * NOTE - We are comparing POST defined board types here. Do not confuse - * them with kernel board types. The structure being analyzed in this - * function is created by POST. All the defines for it are in reset_info.h, - * which was ported from POST header files. - */ -static int -disp_err_log(struct system_kstat_data *kstats) -{ - int exit_code = 0; - int i; - struct reset_info *rst_info; - struct board_info *bdp; - char *err_msgs[MAX_MSGS]; /* holds all messages for a system board */ - int msg_idx; /* current msg number */ - int count; /* number added by last analyze call */ - char **msgs; - - /* start by initializing the err_msgs array to all NULLs */ - for (i = 0; i < MAX_MSGS; i++) { - err_msgs[i] = NULL; - } - - /* First check to see that the reset-info kstats are present. */ - if (kstats->reset_kstats_ok == 0) { - return (exit_code); - } - - rst_info = &kstats->reset_info; - - /* Everything is OK, so print out time/date stamp first */ - log_printf("\n", 0); - log_printf( - dgettext(TEXT_DOMAIN, - "Analysis of most recent Fatal Hardware Watchdog:\n"), - 0); - log_printf("======================================================\n", - 0); - log_printf("Log Date: %s\n", - get_time(&kstats->reset_info.tod_timestamp[0]), 0); - - /* initialize the vector and the message index. */ - msgs = err_msgs; - msg_idx = 0; - - /* Loop Through all of the boards. */ - bdp = &rst_info->bd_reset_info[0]; - for (i = 0; i < MAX_BOARDS; i++, bdp++) { - - /* Is there data for this board? */ - if ((bdp->board_desc & BD_STATE_MASK) == BD_NOT_PRESENT) { - continue; - } - - /* If it is a CPU Board, look for CPU data. */ - if (BOARD_TYPE(bdp->board_desc) == CPU_TYPE) { - /* analyze CPU 0 if present */ - if (bdp->board_desc & CPU0_OK) { - count = analyze_cpu(msgs, 0, - bdp->cpu[0].afsr); - msgs += count; - msg_idx += count; - } - - /* analyze CPU1 if present. */ - if (bdp->board_desc & CPU1_OK) { - count = analyze_cpu(msgs, 1, - bdp->cpu[1].afsr); - msgs += count; - msg_idx += count; - } - } - - /* Always Analyze the AC and the DCs on a board. */ - count = analyze_ac(msgs, bdp->ac_error_status); - msgs += count; - msg_idx += count; - - count = analyze_dc(i, msgs, bdp->dc_shadow_chain); - msgs += count; - msg_idx += count; - - if (msg_idx != 0) - display_msgs(err_msgs, i); - - erase_msgs(err_msgs); - - /* If any messages are logged, we have errors */ - if (msg_idx != 0) { - exit_code = 1; - } - - /* reset the vector and the message index */ - msg_idx = 0; - msgs = &err_msgs[0]; - } - - return (exit_code); -} - -static void -erase_msgs(char **msgs) -{ - int i; - - for (i = 0; (*msgs != NULL) && (i < MAX_MSGS); i++, msgs++) { - free(*msgs); - *msgs = NULL; - } -} - - -static void -display_msgs(char **msgs, int board) -{ - int i; - - /* display the header for this board */ - print_header(board); - - for (i = 0; (*msgs != NULL) && (i < MAX_MSGS); i++, msgs++) { - log_printf(*msgs, 0); - } -} - - - -/* - * disp_keysw_and_leds - * - * This routine displays the position of the keyswitch and the front panel - * system LEDs. The keyswitch can be in either normal, diagnostic, or - * secure position. The three front panel LEDs are of importance because - * the center LED indicates component failure on the system. - */ -static int -disp_keysw_and_leds(struct system_kstat_data *kstats) -{ - int board; - int diag_mode = 0; - int secure_mode = 0; - int result = 0; - - /* Check the first valid board to determeine the diag bit */ - /* Find the first valid board */ - for (board = 0; board < MAX_BOARDS; board++) { - if (kstats->bd_ksp_list[board].fhc_kstats_ok != 0) { - /* If this was successful, break out of loop */ - if ((kstats->bd_ksp_list[board].fhc_bsr & - FHC_DIAG_MODE) == 0) - diag_mode = 1; - break; - } - } - - /* - * Check the register on the clock-board to determine the - * secure bit. - */ - if (kstats->sys_kstats_ok) { - /* The secure bit is negative logic. */ - if (kstats->keysw_status == KEY_SECURE) { - secure_mode = 1; - } - } - - /* - * The system cannot be in diag and secure mode. This is - * illegal. - */ - if (secure_mode && diag_mode) { - result = 2; - return (result); - } - - /* Now print the keyswitch position. */ - log_printf("Keyswitch position is in ", 0); - - if (diag_mode) { - log_printf("Diagnostic Mode\n"); - } else if (secure_mode) { - log_printf("Secure Mode\n", 0); - } else { - log_printf("Normal Mode\n"); - } - - /* display the redundant power status */ - if (kstats->sys_kstats_ok) { - log_printf("System Power Status: ", 0); - - switch (kstats->power_state) { - case REDUNDANT: - log_printf("Redundant\n", 0); - break; - - case MINIMUM: - log_printf("Minimum Available\n", 0); - break; - - case BELOW_MINIMUM: - log_printf("Insufficient Power Available\n", 0); - break; - - default: - log_printf("Unknown\n", 0); - break; - } - } - - if (kstats->sys_kstats_ok) { - /* - * If the center LED is on, then we return a non-zero - * result. - */ - log_printf("System LED Status: GREEN YELLOW " - "GREEN\n", 0); - if ((kstats->sysctrl & SYS_LED_MID) != 0) { - log_printf("WARNING ", 0); - } else { - log_printf("Normal ", 0); - } - - /* - * Left LED is negative logic, center and right LEDs - * are positive logic. - */ - if ((kstats->sysctrl & SYS_LED_LEFT) == 0) { - log_printf("ON ", 0); - } else { - log_printf("OFF", 0); - } - - log_printf(" ", 0); - if ((kstats->sysctrl & SYS_LED_MID) != 0) { - log_printf("ON ", 0); - } else { - log_printf("OFF", 0); - } - - log_printf(" BLINKING", 0); - } - - log_printf("\n", 0); - return (result); -} - -/* - * disp_env_status - * - * This routine displays the environmental status passed up from - * device drivers via kstats. The kstat names are defined in - * kernel header files included by this module. - */ -static int -disp_env_status(struct system_kstat_data *kstats) -{ - struct bd_kstat_data *bksp; - int exit_code = 0; - int i; - uchar_t curr_temp; - int is4slot = 0; - - /* - * Define some message arrays to make life simpler. These - * messages correspond to definitions in <sys/fhc.c> for - * temperature trend (enum temp_trend) and temperature state - * (enum temp_state). - */ - static char *temp_trend_msg[] = { "unknown", - "rapidly falling", - "falling", - "stable", - "rising", - "rapidly rising", - "unknown (noisy)" - }; - static char *temp_state_msg[] = { " OK ", - "WARNING ", - " DANGER " - }; - - log_printf("\n", 0); - log_printf("=========================", 0); - log_printf(dgettext(TEXT_DOMAIN, " Environmental Status "), 0); - log_printf("=========================", 0); - log_printf("\n", 0); - - exit_code = disp_keysw_and_leds(kstats); - - if (!kstats->sys_kstats_ok) { - log_printf(dgettext(TEXT_DOMAIN, - "*** Error: Unavailable ***\n\n")); - return (1); - } - - /* - * for purposes within this routine, - * 5 slot behaves the same as a 4 slot - */ - if (SYS_TYPE(kstats->sysstat1) == SYS_4_SLOT) - is4slot = 1; - - log_printf("\n", 0); - log_printf("\nFans:\n", 0); - log_printf("-----\n", 0); - - log_printf("Unit Status\n", 0); - log_printf("---- ------\n", 0); - - log_printf("%-4s ", is4slot ? "Disk" : "Rack", 0); - /* Check the status of the Rack Fans */ - if ((kstats->fan_status & SYS_RACK_FANFAIL) == 0) { - log_printf("OK\n", 0); - } else { - log_printf("FAIL\n", 0); - exit_code = 1; - } - - if (!is4slot) { - /* - * keyswitch and ac box are on 8 & 16 slot only - */ - /* Check the status of the Keyswitch Fan assembly. */ - log_printf("%-4s ", "Key", 0); - if ((kstats->fan_status & SYS_KEYSW_FAN_OK) != 0) { - log_printf("OK\n", 0); - } else { - log_printf("FAIL\n", 0); - exit_code = 1; - } - - log_printf("%-4s ", "AC", 0); - if ((kstats->fan_status & SYS_AC_FAN_OK) != 0) { - log_printf("OK\n", 0); - } else { - log_printf("FAIL\n", 0); - exit_code = 1; - } - } else { - /* - * peripheral fan is on 4 slot only - * XXX might want to indicate transient states too - */ - if (kstats->psstat_kstat_ok) { - if (kstats->ps_shadow[SYS_P_FAN_INDEX] == PS_OK) { - log_printf("PPS OK\n", 0); - } else if (kstats->ps_shadow[SYS_P_FAN_INDEX] == - PS_FAIL) { - log_printf("PPS FAIL\n", 0); - exit_code = 1; - } - } - } - - log_printf("\n", 0); - - - log_printf("System Temperatures (Celsius):\n", 0); - log_printf("------------------------------\n", 0); - log_printf("Brd State Current Min Max Trend\n", 0); - log_printf("--- ------- ------- --- --- -----\n", 0); - - for (i = 0, bksp = &kstats->bd_ksp_list[0]; i < MAX_BOARDS; - i++, bksp++) { - - /* Make sure we have kstats for this board first */ - if (!bksp->temp_kstat_ok) { - continue; - } - log_printf("%2d ", i, 0); - - /* Print the current state of the temperature */ - log_printf("%s", temp_state_msg[bksp->tempstat.state], 0); - /* Set exit code for WARNING and DANGER */ - if (bksp->tempstat.state != 0) - exit_code = 1; - - /* Print the current temperature */ - curr_temp = bksp->tempstat.l1[bksp->tempstat.index % L1_SZ]; - log_printf(" %2d ", curr_temp, 0); - - /* Print the minimum recorded temperature */ - log_printf(" %2d ", bksp->tempstat.min, 0); - - /* Print the maximum recorded temperature */ - log_printf(" %2d ", bksp->tempstat.max, 0); - - /* Print the current trend in temperature (if available) */ - if (bksp->tempstat.version < 2) - log_printf("unknown\n", 0); - else - log_printf("%s\n", temp_trend_msg[bksp->tempstat.trend], 0); - } - if (kstats->temp_kstat_ok) { - log_printf("CLK ", 0); - - /* Print the current state of the temperature */ - log_printf("%s", temp_state_msg[kstats->tempstat.state], 0); - /* Set exit code for WARNING or DANGER */ - if (kstats->tempstat.state != 0) - exit_code = 1; - - /* Print the current temperature */ - curr_temp = kstats->tempstat.l1[kstats->tempstat.index % L1_SZ]; - log_printf(" %2d ", curr_temp, 0); - - /* Print the minimum recorded temperature */ - log_printf(" %2d ", kstats->tempstat.min, 0); - - /* Print the maximum recorded temperature */ - log_printf(" %2d ", kstats->tempstat.max, 0); - - /* Print the current trend in temperature (if available) */ - if (kstats->tempstat.version < 2) - log_printf("unknown\n\n", 0); - else - log_printf("%s\n\n", - temp_trend_msg[kstats->tempstat.trend], 0); - } else { - log_printf("\n"); - } - - log_printf("\n", 0); - log_printf("Power Supplies:\n", 0); - log_printf("---------------\n", 0); - log_printf("Supply Status\n", 0); - log_printf("--------- ------\n", 0); - if (kstats->psstat_kstat_ok) { - for (i = 0; i < SYS_PS_COUNT; i++) { - char *ps, *state; - - /* skip core power supplies that are not present */ - if (i <= SYS_PPS0_INDEX && kstats->ps_shadow[i] == - PS_OUT) - continue; - - /* Display the unit Number */ - switch (i) { - case 0: ps = "0"; break; - case 1: ps = "1"; break; - case 2: ps = "2"; break; - case 3: ps = "3"; break; - case 4: ps = "4"; break; - case 5: ps = "5"; break; - case 6: ps = "6"; break; - case 7: ps = is4slot ? "2nd PPS" : "7"; break; - - case SYS_PPS0_INDEX: ps = "PPS"; break; - case SYS_CLK_33_INDEX: ps = " System 3.3v"; break; - case SYS_CLK_50_INDEX: ps = " System 5.0v"; break; - case SYS_V5_P_INDEX: ps = " Peripheral 5.0v"; break; - case SYS_V12_P_INDEX: ps = " Peripheral 12v"; break; - case SYS_V5_AUX_INDEX: ps = " Auxiliary 5.0v"; break; - case SYS_V5_P_PCH_INDEX: ps = - " Peripheral 5.0v precharge"; - break; - case SYS_V12_P_PCH_INDEX: ps = - " Peripheral 12v precharge"; - break; - case SYS_V3_PCH_INDEX: ps = - " System 3.3v precharge"; break; - case SYS_V5_PCH_INDEX: ps = - " System 5.0v precharge"; break; - - /* skip the peripheral fan here */ - case SYS_P_FAN_INDEX: - continue; - } - - /* what is the state? */ - switch (kstats->ps_shadow[i]) { - case PS_OK: - state = "OK"; - break; - - case PS_FAIL: - state = "FAIL"; - exit_code = 1; - break; - - /* XXX is this an exit_code condition? */ - case PS_OUT: - state = "PPS Out"; - exit_code = 1; - break; - - case PS_UNKNOWN: - state = "Unknown"; - break; - - default: - state = "Illegal State"; - break; - } - - log_printf("%-32s %s\n", ps, state, 0); - } - } - - /* Check status of the system AC Power Source */ - log_printf("%-32s ", "AC Power", 0); - if ((kstats->sysstat2 & SYS_AC_FAIL) == 0) { - log_printf("OK\n", 0); - } else { - log_printf("failed\n", 0); - exit_code = 1; - } - log_printf("\n", 0); - - return (exit_code); -} - - -/* - * Many of the ASICs present in fusion machines have implementation and - * version numbers stored in the OBP device tree. These codes are displayed - * in this routine in an effort to aid Engineering and Field service - * in detecting old ASICs which may have bugs in them. - */ -static void -sunfire_disp_asic_revs(Sys_tree *tree, struct system_kstat_data *kstats) -{ - Board_node *bnode; - Prom_node *pnode; - int isplusbrd; - char *board_str[] = { "Uninitialized", "Unknown", "CPU", - "Memory", "Dual-SBus", "UPA-SBus", - "Dual-PCI", "Disk", "Clock", - "Dual-SBus-SOC+", "UPA-SBus-SOC+"}; - - /* Print the header */ - log_printf("\n", 0); - log_printf("=========================", 0); - log_printf(" HW Revisions ", 0); - log_printf("=========================", 0); - log_printf("\n", 0); - log_printf("\n", 0); - - /* Else this is a Sunfire or campfire */ - log_printf("ASIC Revisions:\n", 0); - log_printf("---------------\n", 0); - - /* Display Firetruck ASIC Revisions first */ - log_printf("Brd FHC AC SBus0 SBus1 PCI0 PCI1 FEPS", 0); - log_printf(" Board Type Attributes", 0); - log_printf("\n", 0); - log_printf("--- --- -- ----- ----- ---- ---- ----", 0); - log_printf(" ---------- ----------", 0); - log_printf("\n", 0); - - /* - * Display all of the FHC, AC, and chip revisions for the entire - * machine. The AC anf FHC chip revs are available from the device - * tree that was read out of the PROM, but the DC chip revs will be - * read via a kstat. The interfaces for this are not completely - * available at this time. - */ - bnode = tree->bd_list; - while (bnode != NULL) { - int *version; - int upa = bd_to_upa(bnode->board_num); - - /* Display the header with the board number */ - log_printf("%2d ", bnode->board_num, 0); - - /* display the FHC version */ - if ((pnode = dev_find_node(bnode->nodes, "fhc")) == NULL) { - log_printf(" ", 0); - } else { - if ((version = (int *)get_prop_val(find_prop(pnode, - "version#"))) == NULL) { - log_printf(" ", 0); - } else { - log_printf(" %d ", *version, 0); - } - } - - /* display the AC version */ - if ((pnode = dev_find_node(bnode->nodes, "ac")) == NULL) { - log_printf(" ", 0); - } else { - if ((version = (int *)get_prop_val(find_prop(pnode, - "version#"))) == NULL) { - log_printf(" ", 0); - } else { - log_printf(" %d ", *version, 0); - } - } - - /* Find sysio 0 on board and print rev */ - if ((pnode = find_device(bnode, upa, "sbus")) == NULL) { - log_printf(" ", 0); - } else { - if ((version = (int *)get_prop_val(find_prop(pnode, - "version#"))) == NULL) { - log_printf(" ", 0); - } else { - log_printf(" %d ", *version, 0); - } - } - - /* Find sysio 1 on board and print rev */ - if ((pnode = find_device(bnode, upa+1, "sbus")) == NULL) { - log_printf(" ", 0); - } else { - if ((version = (int *)get_prop_val(find_prop(pnode, - "version#"))) == NULL) { - log_printf(" ", 0); - } else { - log_printf(" %d ", *version, 0); - } - } - - /* Find Psycho 0 on board and print rev */ - if ((pnode = find_device(bnode, upa, "pci")) == NULL) { - log_printf(" ", 0); - } else { - if ((version = (int *)get_prop_val(find_prop(pnode, - "version#"))) == NULL) { - log_printf(" ", 0); - } else { - log_printf(" %d ", *version, 0); - } - } - - /* Find Psycho 1 on board and print rev */ - if ((pnode = find_device(bnode, upa+1, "pci")) == NULL) { - log_printf(" ", 0); - } else { - if ((version = (int *)get_prop_val(find_prop(pnode, - "version#"))) == NULL) { - log_printf(" ", 0); - } else { - log_printf(" %d ", *version, 0); - } - } - - /* Find the FEPS on board and print rev */ - if ((pnode = dev_find_node(bnode->nodes, "SUNW,hme")) != NULL) { - if ((version = (int *)get_prop_val(find_prop(pnode, - "hm-rev"))) != NULL) { - if (*version == 0xa0) { - log_printf(" 2.0 ", 0); - } else if (*version == 0x20) { - log_printf(" 2.1 ", 0); - } else { - log_printf(" %2x ", *version, 0); - } - } - } else - log_printf(" ", 0); - - /* print out the board type */ - isplusbrd = ISPLUSBRD(kstats->bd_ksp_list - [bnode->board_num].fhc_bsr); - - log_printf("%-16s", board_str[bnode->board_type], 0); - if (isplusbrd) - log_printf("100MHz Capable", 0); - else - log_printf("84MHz Capable", 0); - - log_printf("\n", 0); - bnode = bnode->next; - } - log_printf("\n", 0); - - /* Now display the FFB board component revisions */ - for (bnode = tree->bd_list; bnode != NULL; bnode = bnode->next) { - display_ffb(bnode, 0); - } -} - -static void -display_hp_boards(struct system_kstat_data *kstats) -{ - int i; - int j; - int hp_found = 0; - struct hp_info *hp; - char *state; - - for (i = 0, hp = &kstats->hp_info[0]; i < MAX_BOARDS; i++, hp++) { - if (!hp->kstat_ok) { - continue; - } - - hp_found = 1; - } - - /* return if there are no hotplug boards in the system. */ - if (!hp_found) { - return; - } - - if (hp_found != 0) { - log_printf("\n", 0); - log_printf("Detached Boards\n", 0); - log_printf("===============\n", 0); - log_printf(" Slot State Type Info\n", 0); - log_printf(" ---- --------- ------ ----" - "-------------------------------------\n", 0); - } - - /* Display all detached boards */ - for (i = 0, hp = &kstats->hp_info[0]; i < MAX_BOARDS; i++, hp++) { - struct cpu_info *cpu; - - if (hp->kstat_ok == 0) { - continue; - } - - - switch (hp->bd_info.state) { - case UNKNOWN_STATE: - state = "unknown"; - break; - - case ACTIVE_STATE: - state = "active"; - break; - - case LOWPOWER_STATE: - state = "low-power"; - break; - - case HOTPLUG_STATE: - state = "hot-plug"; - break; - - case DISABLED_STATE: - state = "disabled"; - break; - - case FAILED_STATE: - state = "failed"; - break; - - default: - state = "unknown"; - break; - } - - log_printf(" %2d %9s ", i, state, 0); - - switch (hp->bd_info.type) { - case MEM_BOARD: - log_printf("%-14s ", MEM_BD_NAME, 0); - break; - - case CPU_BOARD: - log_printf("%-14s ", CPU_BD_NAME, 0); - - /* Cannot display CPU info for disabled boards */ - if ((hp->bd_info.state == DISABLED_STATE) || - (hp->bd_info.state == FAILED_STATE)) { - break; - } - - /* Display both CPUs if present */ - cpu = &hp->bd_info.bd.cpu[0]; - for (j = 0; j < 2; j++, cpu++) { - log_printf("CPU %d: ", j, 0); - /* Print the rated speed of the CPU. */ - if (cpu->cpu_speed > 1) { - log_printf("%3d MHz", cpu->cpu_speed, - 0); - } else { - log_printf("no CPU ", 0); - continue; - } - - /* Display the size of the cache */ - if (cpu->cache_size != 0) { - log_printf(" %0.1fM ", - (float)cpu->cache_size / - (float)(1024*1024), 0); - } else { - log_printf(" ", 0); - } - } - break; - - case IO_2SBUS_BOARD: - log_printf("%-14s ", IO_2SBUS_BD_NAME, 0); - break; - - case IO_2SBUS_SOCPLUS_BOARD: - log_printf("%-14s ", IO_2SBUS_SOCPLUS_BD_NAME, 0); - break; - - case IO_SBUS_FFB_BOARD: - log_printf("%-14s ", IO_SBUS_FFB_BD_NAME, 0); - switch (hp->bd_info.bd.io2.ffb_size) { - case FFB_SINGLE: - log_printf("Single buffered FFB", 0); - break; - - case FFB_DOUBLE: - log_printf("Double buffered FFB", 0); - break; - - case FFB_NOT_FOUND: - log_printf("No FFB installed", 0); - break; - - default: - log_printf("Illegal FFB size", 0); - break; - } - break; - - case IO_SBUS_FFB_SOCPLUS_BOARD: - log_printf("%-14s ", IO_SBUS_FFB_SOCPLUS_BD_NAME, 0); - switch (hp->bd_info.bd.io2.ffb_size) { - case FFB_SINGLE: - log_printf("Single buffered FFB", 0); - break; - - case FFB_DOUBLE: - log_printf("Double buffered FFB", 0); - break; - - case FFB_NOT_FOUND: - log_printf("No FFB installed", 0); - break; - - default: - log_printf("Illegal FFB size", 0); - break; - } - break; - - case IO_PCI_BOARD: - log_printf("%-14s ", IO_PCI_BD_NAME, 0); - break; - - case DISK_BOARD: - log_printf("%-14s ", "disk", 0); - for (j = 0; j < 2; j++) { - log_printf("Disk %d:", j, 0); - if (hp->bd_info.bd.dsk.disk_pres[j]) { - log_printf(" Target: %2d ", - hp->bd_info.bd.dsk.disk_id[j], - 0); - } else { - log_printf(" no disk ", 0); - } - } - break; - - case UNKNOWN_BOARD: - case UNINIT_BOARD: - default: - log_printf("UNKNOWN ", 0); - break; - } - log_printf("\n"); - } -} - -/* - * Analysis functions: - * - * Most of the Fatal error data analyzed from error registers is not - * very complicated. This is because the FRUs for errors detected by - * most parts is either a CPU module, a FFB, or the system board - * itself. - * The analysis of the Address Controller errors is the most complicated. - * These errors can be caused by other boards as well as the local board. - */ - -/* - * analyze_cpu - * - * Analyze the CPU MFSR passed in and determine what type of fatal - * hardware errors occurred at the time of the crash. This function - * returns a pointer to a string to the calling routine. - */ -static int -analyze_cpu(char **msgs, int cpu_id, u_longlong_t afsr) -{ - int count = 0; - int i; - int syndrome; - char msgbuf[MAXSTRLEN]; - - if (msgs == NULL) { - return (count); - } - - if (afsr & P_AFSR_ETP) { - (void) sprintf(msgbuf, "CPU %d Ecache Tag Parity Error, ", - cpu_id); - - /* extract syndrome for afsr */ - syndrome = (afsr & P_AFSR_ETS) >> ETS_SHIFT; - - /* now concat the parity syndrome msg */ - for (i = 0; i < 4; i++) { - if ((0x1 << i) & syndrome) { - (void) strcat(msgbuf, ecache_parity[i]); - } - } - (void) strcat(msgbuf, "\n"); - *msgs++ = strdup(msgbuf); - count++; - } - - if (afsr & P_AFSR_ISAP) { - (void) sprintf(msgbuf, - "CPU %d Incoming System Address Parity Error\n", - cpu_id); - *msgs++ = strdup(msgbuf); - count++; - } - - return (count); -} - -/* - * analyze_ac - * - * This function checks the AC error register passed in and checks - * for any errors that occured during the fatal hardware reset. - */ -static int -analyze_ac(char **msgs, u_longlong_t ac_error) -{ - int i; - int count = 0; - char msgbuf[MAXSTRLEN]; - int tmp_cnt; - - if (msgs == NULL) { - return (count); - } - - for (i = 2; i < MAX_BITS; i++) { - if ((((u_longlong_t)0x1 << i) & ac_error) != 0) { - if (ac_errors[i].error != NULL) { - (void) sprintf(msgbuf, "AC: %s\n", - ac_errors[i].error); - *msgs++ = strdup(msgbuf); - count++; - - /* display the part that might cause this */ - tmp_cnt = disp_parts(msgs, ac_error, i); - count += tmp_cnt; - msgs += tmp_cnt; - } - } - } - - return (count); -} - -/* - * analyze_dc - * - * This routine checks the DC shdow chain and tries to determine - * what type of error might have caused the fatal hardware reset - * error. - */ -static int -analyze_dc(int board, char **msgs, u_longlong_t dc_error) -{ - int i; - int count = 0; - char msgbuf[MAXSTRLEN]; - - if (msgs == NULL) { - return (count); - } - - /* - * The DC scan data is contained in 8 bytes, one byte per - * DC. There are 8 DCs on a system board. - */ - - for (i = 0; i < 8; i++) { - if (dc_error & DC_OVERFLOW) { - (void) sprintf(msgbuf, dc_overflow_txt, board, i); - *msgs++ = strdup(msgbuf); - count++; - } - - if (dc_error & DC_PARITY) { - (void) sprintf(msgbuf, dc_parity_txt, board, i); - *msgs++ = strdup(msgbuf); - count++; - } - dc_error = dc_error >> 8; /* shift over to next byte */ - } - - return (count); -} - -static int -disp_parts(char **msgs, u_longlong_t ac_error, int type) -{ - int count = 0; - int part; - char msgbuf[MAXSTRLEN]; - int i; - - if (msgs == NULL) { - return (count); - } - - (void) sprintf(msgbuf, "\tThe error could be caused by:\n"); - *msgs++ = strdup(msgbuf); - count++; - - for (i = 0; (i < MAX_FRUS) && ac_errors[type].part[i]; i++) { - part = ac_errors[type].part[i]; - - if (part == UPA_PART) { - if (ac_error & UPA_PORT_A) { - part = UPA_A_PART; - } else if (ac_error & UPA_PORT_B) { - part = UPA_B_PART; - } - } - - if (part == DTAG_PART) { - if (ac_error & UPA_PORT_A) { - part = DTAG_A_PART; - } else if (ac_error & UPA_PORT_B) { - part = DTAG_B_PART; - } - } - - (void) sprintf(msgbuf, "\t\t%s\n", part_str[part]); - - *msgs++ = strdup(msgbuf); - count++; - } - - return (count); -} diff --git a/usr/src/lib/libprtdiag_psr/sparc/tazmo/common/tazmo.c b/usr/src/lib/libprtdiag_psr/sparc/tazmo/common/tazmo.c index 58d4634164..9b3e739f76 100644 --- a/usr/src/lib/libprtdiag_psr/sparc/tazmo/common/tazmo.c +++ b/usr/src/lib/libprtdiag_psr/sparc/tazmo/common/tazmo.c @@ -22,6 +22,7 @@ /* * Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2020 Peter Tribble. * * Tazmo Platform specific functions. * @@ -67,7 +68,7 @@ extern int print_flag; * at runtime (workgroup server systems only) */ int error_check(Sys_tree *tree, struct system_kstat_data *kstats); -void display_memoryconf(Sys_tree *tree, struct grp_info *grps); +void display_memoryconf(Sys_tree *tree); int disp_fail_parts(Sys_tree *tree); void display_hp_fail_fault(Sys_tree *tree, struct system_kstat_data *kstats); void display_diaginfo(int flag, Prom_node *root, Sys_tree *tree, @@ -78,7 +79,7 @@ void display_io_cards(struct io_card *list); void display_ffb(Board_node *, int); void read_platform_kstats(Sys_tree *tree, struct system_kstat_data *sys_kstat, - struct bd_kstat_data *bdp, struct envctrl_kstat_data *ep); + struct envctrl_kstat_data *ep); /* local functions */ static int disp_envctrl_status(Sys_tree *, struct system_kstat_data *); @@ -132,7 +133,7 @@ dev_next_node_sibling(Prom_node *root, char *name) * DIMM sizes, DIMM socket names. */ void -display_memoryconf(Sys_tree *tree, struct grp_info *grps) +display_memoryconf(Sys_tree *tree) { Board_node *bnode; Prom_node *memory; @@ -147,9 +148,6 @@ display_memoryconf(Sys_tree *tree, struct grp_info *grps) Prop *status_prop; char interleave[8]; int total_size = 0; -#ifdef lint - grps = grps; -#endif log_printf("\n", 0); log_printf("=========================", 0); @@ -755,11 +753,11 @@ display_ffb(Board_node *board, int table) /* * This module does the reading and interpreting of tazmo system - * kstats. These kstats are created by the environ driver: + * kstats. These kstats are created by the envctrl driver: */ void read_platform_kstats(Sys_tree *tree, struct system_kstat_data *sys_kstat, - struct bd_kstat_data *bdp, struct envctrl_kstat_data *ep) + struct envctrl_kstat_data *ep) { kstat_ctl_t *kc; kstat_t *ksp; @@ -767,10 +765,6 @@ read_platform_kstats(Sys_tree *tree, struct system_kstat_data *sys_kstat, if ((kc = kstat_open()) == NULL) { return; } -#ifdef lint - tree = tree; - bdp = bdp; -#endif ep = &sys_kstat->env_data; diff --git a/usr/src/lib/librsc/sparc/mpxu/common/librsc.c b/usr/src/lib/librsc/sparc/mpxu/common/librsc.c index 863c304fcc..c39719f473 100644 --- a/usr/src/lib/librsc/sparc/mpxu/common/librsc.c +++ b/usr/src/lib/librsc/sparc/mpxu/common/librsc.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * ENXS platform-specific functions */ @@ -151,7 +149,7 @@ rscp_init(void) /* * 'erase' the rx buffer */ - (void) memset(rsc_rx_buffer, 0, sizeof (RSC_MAX_RX_BUFFER)); + (void) memset(rsc_rx_buffer, 0, sizeof (rsc_rx_buffer)); rsc_rx_resp_len = 0; rsc_rx_error = 0; rsc_rx_resp_type = DP_NULL_MSG; diff --git a/usr/src/lib/libzfs_core/common/libzfs_core.c b/usr/src/lib/libzfs_core/common/libzfs_core.c index aad4104fa5..628b1cc8ff 100644 --- a/usr/src/lib/libzfs_core/common/libzfs_core.c +++ b/usr/src/lib/libzfs_core/common/libzfs_core.c @@ -25,6 +25,7 @@ * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 RackTop Systems. * Copyright (c) 2017 Datto Inc. + * Copyright 2020 Joyent, Inc. */ /* @@ -1021,6 +1022,7 @@ lzc_channel_program_impl(const char *pool, const char *program, boolean_t sync, { int error; nvlist_t *args; + nvlist_t *hidden_args = NULL; args = fnvlist_alloc(); fnvlist_add_string(args, ZCP_ARG_PROGRAM, program); @@ -1028,6 +1030,22 @@ lzc_channel_program_impl(const char *pool, const char *program, boolean_t sync, fnvlist_add_boolean_value(args, ZCP_ARG_SYNC, sync); fnvlist_add_uint64(args, ZCP_ARG_INSTRLIMIT, instrlimit); fnvlist_add_uint64(args, ZCP_ARG_MEMLIMIT, memlimit); + + /* + * If any hidden arguments are passed, we pull them out of 'args' + * and into a separate nvlist so spa_history_nvl() doesn't log + * their values. + */ + if (nvlist_lookup_nvlist(argnvl, ZPOOL_HIDDEN_ARGS, + &hidden_args) == 0) { + nvlist_t *argcopy = fnvlist_dup(argnvl); + + fnvlist_add_nvlist(args, ZPOOL_HIDDEN_ARGS, hidden_args); + fnvlist_remove(argcopy, ZPOOL_HIDDEN_ARGS); + fnvlist_add_nvlist(args, ZCP_ARG_ARGLIST, argcopy); + nvlist_free(argcopy); + } + error = lzc_ioctl(ZFS_IOC_CHANNEL_PROGRAM, pool, args, outnvl); fnvlist_free(args); diff --git a/usr/src/lib/udapl/udapl_tavor/common/dapl_evd_util.c b/usr/src/lib/udapl/udapl_tavor/common/dapl_evd_util.c index 19e2eaaa5d..b40dd626db 100644 --- a/usr/src/lib/udapl/udapl_tavor/common/dapl_evd_util.c +++ b/usr/src/lib/udapl/udapl_tavor/common/dapl_evd_util.c @@ -77,16 +77,16 @@ dapli_evd_event_alloc( * to create the default async evd. * * Input: - * ia_ptr + * ia_ptr * cno_ptr * qlen * evd_flags * * Output: - * evd_ptr_ptr + * evd_ptr_ptr * * Returns: - * none + * none * */ @@ -136,6 +136,13 @@ dapls_evd_internal_create( goto bail; } +#if 0 + /* + * Current implementation of dapls_ib_setup_async_callback() does + * nothing and returns DAT_SUCCESS. However, it is declared to expect + * function pointers with different signatures. We do leave the code + * block out till dapls_ib_setup_async_callback() is implemented. + */ dat_status = dapls_ib_setup_async_callback( ia_ptr, DAPL_ASYNC_CQ_COMPLETION, @@ -145,6 +152,7 @@ dapls_evd_internal_create( if (dat_status != DAT_SUCCESS) { goto bail; } +#endif /* * cq_notify is not required since when evd_wait is called * time we go and poll cq anyways. @@ -181,13 +189,13 @@ bail: * alloc and initialize an EVD struct * * Input: - * ia + * ia * * Output: - * evd_ptr + * evd_ptr * * Returns: - * none + * none * */ DAPL_EVD * @@ -250,14 +258,14 @@ bail: * alloc events into an EVD. * * Input: - * evd_ptr + * evd_ptr * qlen * * Output: - * NONE + * NONE * * Returns: - * DAT_SUCCESS + * DAT_SUCCESS * ERROR * */ @@ -328,13 +336,13 @@ bail: * error. * * Input: - * evd_ptr + * evd_ptr * * Output: - * none + * none * * Returns: - * status + * status * */ DAT_RETURN @@ -413,8 +421,7 @@ bail: #ifdef DAPL_DBG /* For debugging. */ void -dapli_evd_eh_print_cqe( - IN ib_work_completion_t cqe) +dapli_evd_eh_print_cqe(IN ib_work_completion_t cqe) { static char *optable[] = { "", @@ -481,7 +488,7 @@ dapli_evd_eh_print_cqe( * that the lock is held. * * Input: - * evd_ptr + * evd_ptr * * Output: * event @@ -518,8 +525,8 @@ dapli_evd_get_event( * entry to this function. * * Input: - * evd_ptr - * event + * evd_ptr + * event * * Output: * none @@ -532,7 +539,7 @@ dapli_evd_post_event( IN const DAT_EVENT *event_ptr) { DAT_RETURN dat_status; - DAPL_CNO *cno_to_trigger = NULL; + DAPL_CNO *cno_to_trigger = NULL; dapl_dbg_log(DAPL_DBG_TYPE_EVD, "dapli_evd_post_event: Called with event # %x\n", @@ -606,8 +613,8 @@ dapli_evd_post_event( * entry to this function. * * Input: - * evd_ptr - * event + * evd_ptr + * event * * Output: * none @@ -643,8 +650,8 @@ dapli_evd_post_event_nosignal( * format an overflow event for posting * * Input: - * evd_ptr - * event_ptr + * evd_ptr + * event_ptr * * Output: * none @@ -671,8 +678,8 @@ dapli_evd_format_overflow_event( * post an overflow event * * Input: - * async_evd_ptr - * evd_ptr + * async_evd_ptr + * evd_ptr * * Output: * none @@ -711,7 +718,7 @@ dapli_evd_get_and_init_event( IN DAPL_EVD *evd_ptr, IN DAT_EVENT_NUMBER event_number) { - DAT_EVENT *event_ptr; + DAT_EVENT *event_ptr; event_ptr = dapli_evd_get_event(evd_ptr); if (NULL == event_ptr) { @@ -734,7 +741,7 @@ dapls_evd_post_cr_arrival_event( DAT_CONN_QUAL conn_qual, DAT_CR_HANDLE cr_handle) { - DAT_EVENT *event_ptr; + DAT_EVENT *event_ptr; event_ptr = dapli_evd_get_and_init_event(evd_ptr, event_number); /* * Note event lock may be held on successful return @@ -765,7 +772,7 @@ dapls_evd_post_connection_event( IN DAT_COUNT private_data_size, IN DAT_PVOID private_data) { - DAT_EVENT *event_ptr; + DAT_EVENT *event_ptr; event_ptr = dapli_evd_get_and_init_event(evd_ptr, event_number); /* * Note event lock may be held on successful return @@ -793,7 +800,7 @@ dapls_evd_post_async_error_event( IN DAT_EVENT_NUMBER event_number, IN DAT_IA_HANDLE ia_handle) { - DAT_EVENT *event_ptr; + DAT_EVENT *event_ptr; event_ptr = dapli_evd_get_and_init_event(evd_ptr, event_number); /* * Note event lock may be held on successful return @@ -818,7 +825,7 @@ dapls_evd_post_software_event( IN DAT_EVENT_NUMBER event_number, IN DAT_PVOID pointer) { - DAT_EVENT *event_ptr; + DAT_EVENT *event_ptr; event_ptr = dapli_evd_get_and_init_event(evd_ptr, event_number); /* * Note event lock may be held on successful return @@ -911,13 +918,13 @@ dapls_evd_post_premature_events(IN DAPL_EP *ep_ptr) * * Input: * evd_ptr - * cqe_ptr + * cqe_ptr * * Output: - * event_ptr + * event_ptr * * Returns: - * none + * none * */ static DAT_BOOLEAN @@ -1206,10 +1213,10 @@ dapli_evd_cqe_to_event( * evd_ptr * * Output: - * nevents + * nevents * * Returns: - * none + * none * */ void @@ -1296,16 +1303,14 @@ dapls_evd_copy_cq( * timeout * * Output: - * return status + * return status * * Returns: - * none + * none * */ DAT_RETURN -dapls_evd_copy_events( - DAPL_EVD *evd_ptr, - DAT_TIMEOUT timeout) +dapls_evd_copy_events(DAPL_EVD *evd_ptr, DAT_TIMEOUT timeout) { dapl_ib_event_t evp_arr[NUM_EVENTS_PER_POLL]; dapl_ib_event_t *evpp_start; @@ -1584,16 +1589,14 @@ dapls_evd_copy_events( * evd_ptr * * Output: - * event + * event * * Returns: - * Status of operation + * Status of operation * */ DAT_RETURN -dapls_evd_cq_poll_to_event( - IN DAPL_EVD *evd_ptr, - OUT DAT_EVENT *event) +dapls_evd_cq_poll_to_event(IN DAPL_EVD *evd_ptr, OUT DAT_EVENT *event) { DAT_RETURN dat_status; ib_work_completion_t cur_cqe; diff --git a/usr/src/lib/udapl/udapl_tavor/common/dapl_ia_util.c b/usr/src/lib/udapl/udapl_tavor/common/dapl_ia_util.c index bc16ef69b4..714d60eac7 100644 --- a/usr/src/lib/udapl/udapl_tavor/common/dapl_ia_util.c +++ b/usr/src/lib/udapl/udapl_tavor/common/dapl_ia_util.c @@ -55,13 +55,13 @@ void dapli_ia_release_hca( * alloc and initialize an IA INFO struct * * Input: - * none + * none * * Output: - * ia_ptr + * ia_ptr * * Returns: - * none + * none * */ DAPL_IA * @@ -123,19 +123,18 @@ dapl_ia_alloc(DAT_PROVIDER * provider, DAPL_HCA * hca_ptr) * Performs an abrupt close of the IA * * Input: - * ia_ptr + * ia_ptr * * Output: - * none + * none * * Returns: - * status + * status * */ DAT_RETURN -dapl_ia_abrupt_close( - IN DAPL_IA *ia_ptr) +dapl_ia_abrupt_close(IN DAPL_IA *ia_ptr) { DAT_RETURN dat_status; DAPL_EP *ep_ptr, *next_ep_ptr; @@ -346,24 +345,23 @@ dapl_ia_abrupt_close( * Performs an graceful close of the IA * * Input: - * ia_ptr + * ia_ptr * * Output: - * none + * none * * Returns: - * status + * status * */ DAT_RETURN -dapl_ia_graceful_close( - IN DAPL_IA *ia_ptr) +dapl_ia_graceful_close(IN DAPL_IA *ia_ptr) { DAT_RETURN dat_status; DAT_RETURN cur_dat_status; DAPL_EVD *evd_ptr; - DAPL_LLIST_ENTRY *entry; + DAPL_LLIST_ENTRY *entry; DAPL_HCA *hca_ptr; dat_status = DAT_SUCCESS; @@ -491,13 +489,13 @@ dapli_ia_release_hca( * free an IA INFO struct * * Input: - * ia_ptr + * ia_ptr * * Output: - * one + * one * * Returns: - * none + * none * */ void @@ -535,10 +533,10 @@ dapls_ia_free(DAPL_IA *ia_ptr) * ep_ptr * * Output: - * none + * none * * Returns: - * none + * none * */ void @@ -563,10 +561,10 @@ dapl_ia_link_ep( * ep_ptr * * Output: - * none + * none * * Returns: - * none + * none * */ void @@ -590,10 +588,10 @@ dapl_ia_unlink_ep( * lmr_ptr * * Output: - * none + * none * * Returns: - * none + * none * */ void @@ -618,10 +616,10 @@ dapl_ia_link_lmr( * lmr_ptr * * Output: - * none + * none * * Returns: - * none + * none * */ void @@ -645,10 +643,10 @@ dapl_ia_unlink_lmr( * rmr_ptr * * Output: - * none + * none * * Returns: - * none + * none * */ void @@ -673,10 +671,10 @@ dapl_ia_link_rmr( * rmr_ptr * * Output: - * none + * none * * Returns: - * none + * none * */ void @@ -700,10 +698,10 @@ dapl_ia_unlink_rmr( * pz_ptr * * Output: - * none + * none * * Returns: - * none + * none * */ void @@ -728,10 +726,10 @@ dapl_ia_link_pz( * pz_ptr * * Output: - * none + * none * * Returns: - * none + * none * */ void @@ -755,10 +753,10 @@ dapl_ia_unlink_pz( * evd_ptr * * Output: - * none + * none * * Returns: - * none + * none * */ void @@ -783,10 +781,10 @@ dapl_ia_link_evd( * evd_ptr * * Output: - * none + * none * * Returns: - * none + * none * */ void @@ -810,10 +808,10 @@ dapl_ia_unlink_evd( * cno_ptr * * Output: - * none + * none * * Returns: - * none + * none * */ void @@ -838,10 +836,10 @@ dapl_ia_link_cno( * cno_ptr * * Output: - * none + * none * * Returns: - * none + * none * */ void @@ -865,10 +863,10 @@ dapl_ia_unlink_cno( * sp_ptr * * Output: - * none + * none * * Returns: - * none + * none * */ void @@ -893,10 +891,10 @@ dapl_ia_link_psp( * sp_ptr * * Output: - * none + * none * * Returns: - * none + * none * */ void @@ -930,10 +928,10 @@ dapls_ia_unlink_sp( * sp_ptr * * Output: - * none + * none * * Returns: - * none + * none * */ DAPL_SP * @@ -980,10 +978,10 @@ dapls_ia_sp_search( * sp_ptr * * Output: - * none + * none * * Returns: - * none + * none * */ void @@ -1008,10 +1006,10 @@ dapl_ia_link_rsp( * srq_ptr * * Output: - * none + * none * * Returns: - * none + * none * */ void @@ -1036,10 +1034,10 @@ dapl_ia_link_srq( * srq_ptr * * Output: - * none + * none * * Returns: - * none + * none * */ void @@ -1060,6 +1058,13 @@ dapls_ia_setup_callbacks( { DAT_RETURN dat_status = DAT_SUCCESS; +#if 0 + /* + * Current implementation of dapls_ib_setup_async_callback() does + * nothing and returns DAT_SUCCESS. However, it is declared to expect + * function pointers with different signatures. We do leave the code + * block out till dapls_ib_setup_async_callback() is implemented. + */ /* unaffiliated handler */ dat_status = dapls_ib_setup_async_callback( @@ -1104,8 +1109,8 @@ dapls_ia_setup_callbacks( dat_status); goto bail; } - bail: +#endif return (dat_status); } |