diff options
Diffstat (limited to 'usr/src/uts')
593 files changed, 587 insertions, 26616 deletions
diff --git a/usr/src/uts/Makefile.uts b/usr/src/uts/Makefile.uts index a774be7a78..245365c195 100644 --- a/usr/src/uts/Makefile.uts +++ b/usr/src/uts/Makefile.uts @@ -223,6 +223,11 @@ CERRWARN += -_gcc=-Wno-unknown-pragmas CERRWARN += -_gcc=-Wno-unused-parameter CERRWARN += -_gcc=-Wno-missing-field-initializers +# gcc4 lacks -Wno-maybe-uninitialized +CNOWARN_UNINIT = -_gcc4=-Wno-uninitialized \ + -_gcc7=-Wno-maybe-uninitialized \ + -_gcc8=-Wno-maybe-uninitialized + # DEBUG v. -nd make for frequent unused variables, empty conditions, etc. in # -nd builds $(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-unused diff --git a/usr/src/uts/common/fs/zfs/vdev.c b/usr/src/uts/common/fs/zfs/vdev.c index 73b7c8e2fc..3bf145a4ac 100644 --- a/usr/src/uts/common/fs/zfs/vdev.c +++ b/usr/src/uts/common/fs/zfs/vdev.c @@ -25,7 +25,7 @@ * Copyright 2017 Nexenta Systems, Inc. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Toomas Soome <tsoome@me.com> - * Copyright 2017 Joyent, Inc. + * Copyright 2019 Joyent, Inc. * Copyright (c) 2017, Intel Corporation. */ @@ -634,7 +634,8 @@ vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *nv, vdev_t *parent, uint_t id, alloc_bias = vdev_derive_alloc_bias(bias); /* spa_vdev_add() expects feature to be enabled */ - if (spa->spa_load_state != SPA_LOAD_CREATE && + if (alloc_bias != VDEV_BIAS_LOG && + spa->spa_load_state != SPA_LOAD_CREATE && !spa_feature_is_enabled(spa, SPA_FEATURE_ALLOCATION_CLASSES)) { return (SET_ERROR(ENOTSUP)); diff --git a/usr/src/uts/common/inet/ip/ip_attr.c b/usr/src/uts/common/inet/ip/ip_attr.c index 28379001d0..6dfbc53d77 100644 --- a/usr/src/uts/common/inet/ip/ip_attr.c +++ b/usr/src/uts/common/inet/ip/ip_attr.c @@ -24,6 +24,10 @@ */ /* Copyright (c) 1990 Mentat Inc. */ +/* + * Copyright 2019 Joyent, Inc. + */ + #include <sys/types.h> #include <sys/stream.h> #include <sys/strsun.h> @@ -97,6 +101,9 @@ /* * Release a reference on ip_xmit_attr. * The reference is acquired by conn_get_ixa() + * + * This macro has a lowercase function-call version for callers outside + * this file. */ #define IXA_REFRELE(ixa) \ { \ @@ -106,7 +113,7 @@ #define IXA_REFHOLD(ixa) \ { \ - ASSERT((ixa)->ixa_refcnt != 0); \ + ASSERT3U((ixa)->ixa_refcnt, !=, 0); \ atomic_inc_32(&(ixa)->ixa_refcnt); \ } @@ -151,7 +158,7 @@ typedef struct ixamblk_s { ipsec_latch_t *ixm_ipsec_latch; struct ipsa_s *ixm_ipsec_ah_sa; /* SA for AH */ struct ipsa_s *ixm_ipsec_esp_sa; /* SA for ESP */ - struct ipsec_policy_s *ixm_ipsec_policy; /* why are we here? */ + struct ipsec_policy_s *ixm_ipsec_policy; /* why are we here? */ struct ipsec_action_s *ixm_ipsec_action; /* For reflected packets */ ipsa_ref_t ixm_ipsec_ref[2]; /* Soft reference to SA */ @@ -746,36 +753,41 @@ ip_recv_attr_is_mblk(mblk_t *mp) static ip_xmit_attr_t * conn_get_ixa_impl(conn_t *connp, boolean_t replace, int kmflag) { - ip_xmit_attr_t *ixa; - ip_xmit_attr_t *oldixa; + ip_xmit_attr_t *oldixa; /* Already attached to conn_t */ + ip_xmit_attr_t *ixa; /* New one, which we return. */ + + /* + * NOTE: If the marked-below common case isn't, move the + * kmem_alloc() up here and put a free in what was marked as the + * (not really) common case instead. + */ mutex_enter(&connp->conn_lock); - ixa = connp->conn_ixa; + oldixa = connp->conn_ixa; - /* At least one references for the conn_t */ - ASSERT(ixa->ixa_refcnt >= 1); - if (atomic_inc_32_nv(&ixa->ixa_refcnt) == 2) { - /* No other thread using conn_ixa */ + /* At least one reference for the conn_t */ + ASSERT3U(oldixa->ixa_refcnt, >=, 1); + if (atomic_inc_32_nv(&oldixa->ixa_refcnt) == 2) { + /* No other thread using conn_ixa (common case) */ mutex_exit(&connp->conn_lock); - return (ixa); + return (oldixa); } + /* Do allocation inside-the-conn_lock because it's less common. */ ixa = kmem_alloc(sizeof (*ixa), kmflag); if (ixa == NULL) { mutex_exit(&connp->conn_lock); - ixa_refrele(connp->conn_ixa); + IXA_REFRELE(oldixa); return (NULL); } - ixa_safe_copy(connp->conn_ixa, ixa); + ixa_safe_copy(oldixa, ixa); /* Make sure we drop conn_lock before any refrele */ if (replace) { ixa->ixa_refcnt++; /* No atomic needed - not visible */ - oldixa = connp->conn_ixa; connp->conn_ixa = ixa; mutex_exit(&connp->conn_lock); IXA_REFRELE(oldixa); /* Undo refcnt from conn_t */ } else { - oldixa = connp->conn_ixa; mutex_exit(&connp->conn_lock); } IXA_REFRELE(oldixa); /* Undo above atomic_add_32_nv */ @@ -847,26 +859,21 @@ conn_replace_ixa(conn_t *connp, ip_xmit_attr_t *ixa) ip_xmit_attr_t * conn_get_ixa_exclusive(conn_t *connp) { + ip_xmit_attr_t *oldixa; ip_xmit_attr_t *ixa; - mutex_enter(&connp->conn_lock); - ixa = connp->conn_ixa; + ixa = kmem_alloc(sizeof (*ixa), KM_NOSLEEP | KM_NORMALPRI); + if (ixa == NULL) + return (NULL); - /* At least one references for the conn_t */ - ASSERT(ixa->ixa_refcnt >= 1); + mutex_enter(&connp->conn_lock); - /* Make sure conn_ixa doesn't disappear while we copy it */ - atomic_inc_32(&ixa->ixa_refcnt); + oldixa = connp->conn_ixa; + IXA_REFHOLD(oldixa); - ixa = kmem_alloc(sizeof (*ixa), KM_NOSLEEP); - if (ixa == NULL) { - mutex_exit(&connp->conn_lock); - ixa_refrele(connp->conn_ixa); - return (NULL); - } - ixa_safe_copy(connp->conn_ixa, ixa); + ixa_safe_copy(oldixa, ixa); mutex_exit(&connp->conn_lock); - IXA_REFRELE(connp->conn_ixa); + IXA_REFRELE(oldixa); return (ixa); } @@ -1357,7 +1364,7 @@ conn_ixa_cleanup(conn_t *connp, void *arg) } } ixa_cleanup_stale(ixa); - ixa_refrele(ixa); + IXA_REFRELE(ixa); } } diff --git a/usr/src/uts/common/vm/vm_pagelist.c b/usr/src/uts/common/vm/vm_pagelist.c index 0f481b423d..f494c3d2b4 100644 --- a/usr/src/uts/common/vm/vm_pagelist.c +++ b/usr/src/uts/common/vm/vm_pagelist.c @@ -4179,8 +4179,7 @@ page_get_replacement_page(page_t *orig_like_pp, struct lgrp *lgrp_target, if (PP_ISKAS(like_pp)) pgrflags |= PGR_SAMESZC; - /* LINTED */ - MTYPE_PGR_INIT(mtype, flags, like_pp, page_mnode, npgs); + MTYPE_PGR_INIT(mtype, flags, like_pp, npgs); while (npgs) { pplist = NULL; diff --git a/usr/src/uts/i86pc/acpidev/Makefile b/usr/src/uts/i86pc/acpidev/Makefile index f8d6280dc9..cb27b9311e 100644 --- a/usr/src/uts/i86pc/acpidev/Makefile +++ b/usr/src/uts/i86pc/acpidev/Makefile @@ -61,7 +61,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # LDFLAGS += -dy -N misc/acpica -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-type-limits diff --git a/usr/src/uts/i86pc/amd_iommu/Makefile b/usr/src/uts/i86pc/amd_iommu/Makefile index 225f0c1f77..975efd5ef3 100644 --- a/usr/src/uts/i86pc/amd_iommu/Makefile +++ b/usr/src/uts/i86pc/amd_iommu/Makefile @@ -57,7 +57,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # LDFLAGS += -dy -Nmisc/iommulib -Nmisc/acpica -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function diff --git a/usr/src/uts/i86pc/cpr/Makefile b/usr/src/uts/i86pc/cpr/Makefile index 2ecad49a61..787bb64645 100644 --- a/usr/src/uts/i86pc/cpr/Makefile +++ b/usr/src/uts/i86pc/cpr/Makefile @@ -69,7 +69,7 @@ CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses $(OBJS_DIR)/cpr_impl.o := CERRWARN += -_gcc=-Wno-unused-function diff --git a/usr/src/uts/i86pc/cpudrv/Makefile b/usr/src/uts/i86pc/cpudrv/Makefile index 590f8704bc..4caaf0aaea 100644 --- a/usr/src/uts/i86pc/cpudrv/Makefile +++ b/usr/src/uts/i86pc/cpudrv/Makefile @@ -52,7 +52,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function diff --git a/usr/src/uts/i86pc/dr/Makefile b/usr/src/uts/i86pc/dr/Makefile index d91a421993..d73182731f 100644 --- a/usr/src/uts/i86pc/dr/Makefile +++ b/usr/src/uts/i86pc/dr/Makefile @@ -62,7 +62,7 @@ ALL_BUILDS = $(ALL_BUILDS64) CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-empty-body # needs work diff --git a/usr/src/uts/i86pc/generic_cpu/Makefile b/usr/src/uts/i86pc/generic_cpu/Makefile index d474c3a9da..72bbfca250 100644 --- a/usr/src/uts/i86pc/generic_cpu/Makefile +++ b/usr/src/uts/i86pc/generic_cpu/Makefile @@ -43,7 +43,7 @@ ROOTMODULE = $(ROOT_PSM_CPU_DIR)/$(MODULE) include ../cpu/Makefile.cpu CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Define targets diff --git a/usr/src/uts/i86pc/gfx_private/Makefile b/usr/src/uts/i86pc/gfx_private/Makefile index f3f654c9d6..1281195fbd 100644 --- a/usr/src/uts/i86pc/gfx_private/Makefile +++ b/usr/src/uts/i86pc/gfx_private/Makefile @@ -65,7 +65,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # to investigate and remove these for maximum coverage. # Please do not carry these forward to new Makefiles. # -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # diff --git a/usr/src/uts/i86pc/i86hvm/xpvd/Makefile b/usr/src/uts/i86pc/i86hvm/xpvd/Makefile index 9766da5078..98885f4507 100644 --- a/usr/src/uts/i86pc/i86hvm/xpvd/Makefile +++ b/usr/src/uts/i86pc/i86hvm/xpvd/Makefile @@ -59,7 +59,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) CPPFLAGS += -DHVMPV_XPVD_VERS=1 LDFLAGS += -dy -Ndrv/xpv -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/i86pc/ioat/Makefile b/usr/src/uts/i86pc/ioat/Makefile index f73619635c..4cf0bae58a 100644 --- a/usr/src/uts/i86pc/ioat/Makefile +++ b/usr/src/uts/i86pc/ioat/Makefile @@ -57,7 +57,7 @@ ALL_TARGET = $(BINARY) $(SRC_CONFILE) INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Dependency diff --git a/usr/src/uts/i86pc/npe/Makefile b/usr/src/uts/i86pc/npe/Makefile index a5a66a00f8..34f38a787f 100644 --- a/usr/src/uts/i86pc/npe/Makefile +++ b/usr/src/uts/i86pc/npe/Makefile @@ -75,7 +75,7 @@ CFLAGS += -D_MODULE_NAME="\"$(MODULE)\"" # to investigate and remove these for maximum coverage. # Please do not carry these forward to new Makefiles. # -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function diff --git a/usr/src/uts/i86pc/pci/Makefile b/usr/src/uts/i86pc/pci/Makefile index 96e9380af9..fadba51d81 100644 --- a/usr/src/uts/i86pc/pci/Makefile +++ b/usr/src/uts/i86pc/pci/Makefile @@ -73,7 +73,7 @@ CFLAGS += -D_MODULE_NAME="\"$(MODULE)\"" # Please do not carry these forward to new Makefiles. # CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-function # diff --git a/usr/src/uts/i86pc/pcie/Makefile b/usr/src/uts/i86pc/pcie/Makefile index 1a849006f5..3b579e7363 100644 --- a/usr/src/uts/i86pc/pcie/Makefile +++ b/usr/src/uts/i86pc/pcie/Makefile @@ -57,6 +57,8 @@ ALL_TARGET = $(BINARY) INSTALL_TARGET = $(BINARY) $(ROOTMODULE) CERRWARN += -_gcc=-Wno-unused-value +CERRWARN += $(CNOWARN_UNINIT) +CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function # safe diff --git a/usr/src/uts/i86pc/ppm/Makefile b/usr/src/uts/i86pc/ppm/Makefile index 59ce4a85ea..4f9ae61a49 100644 --- a/usr/src/uts/i86pc/ppm/Makefile +++ b/usr/src/uts/i86pc/ppm/Makefile @@ -62,7 +62,7 @@ CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-variable # diff --git a/usr/src/uts/i86pc/rootnex/Makefile b/usr/src/uts/i86pc/rootnex/Makefile index d618a53590..9824f9dd54 100644 --- a/usr/src/uts/i86pc/rootnex/Makefile +++ b/usr/src/uts/i86pc/rootnex/Makefile @@ -64,7 +64,7 @@ LDFLAGS += -dy -N misc/iommulib -N misc/acpica CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/immu_qinv.o := SMOFF += index_overflow diff --git a/usr/src/uts/i86pc/tzmon/Makefile b/usr/src/uts/i86pc/tzmon/Makefile index cbbef0eb0c..48468e0131 100644 --- a/usr/src/uts/i86pc/tzmon/Makefile +++ b/usr/src/uts/i86pc/tzmon/Makefile @@ -70,7 +70,7 @@ LDFLAGS += -dy -N misc/acpica # to investigate and remove these for maximum coverage. # Please do not carry these forward to new Makefiles. # -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/i86pc/unix/Makefile b/usr/src/uts/i86pc/unix/Makefile index 4857b52922..188d72c6f8 100644 --- a/usr/src/uts/i86pc/unix/Makefile +++ b/usr/src/uts/i86pc/unix/Makefile @@ -129,7 +129,7 @@ CFLAGS += -DDIS_MEM # Please do not carry these forward to new Makefiles. # CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-char-subscripts CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function diff --git a/usr/src/uts/i86pc/vm/vm_dep.h b/usr/src/uts/i86pc/vm/vm_dep.h index 07e277cedf..e1f04fd5d7 100644 --- a/usr/src/uts/i86pc/vm/vm_dep.h +++ b/usr/src/uts/i86pc/vm/vm_dep.h @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2019 Joyent, Inc. */ /* * Copyright (c) 2010, Intel Corporation. @@ -305,9 +306,9 @@ extern int mtype_init(vnode_t *, caddr_t, uint_t *, size_t); } \ } -extern int mtype_pgr_init(int *, page_t *, int, pgcnt_t); -#define MTYPE_PGR_INIT(mtype, flags, pp, mnode, pgcnt) \ - (mtype = mtype_pgr_init(&flags, pp, mnode, pgcnt)) +extern int mtype_pgr_init(int *, page_t *, pgcnt_t); +#define MTYPE_PGR_INIT(mtype, flags, pp, pgcnt) \ + (mtype = mtype_pgr_init(&flags, pp, pgcnt)) #define MNODE_PGCNT(mnode) mnode_pgcnt(mnode) diff --git a/usr/src/uts/i86pc/vm/vm_machdep.c b/usr/src/uts/i86pc/vm/vm_machdep.c index 2ad5ff5aa2..9cba487a0a 100644 --- a/usr/src/uts/i86pc/vm/vm_machdep.c +++ b/usr/src/uts/i86pc/vm/vm_machdep.c @@ -1619,7 +1619,7 @@ mtype_init(vnode_t *vp, caddr_t vaddr, uint_t *flags, size_t pgsz) /* mtype init for page_get_replacement_page */ /*ARGSUSED*/ int -mtype_pgr_init(int *flags, page_t *pp, int mnode, pgcnt_t pgcnt) +mtype_pgr_init(int *flags, page_t *pp, pgcnt_t pgcnt) { int mtype = mtypetop; #if !defined(__xpv) diff --git a/usr/src/uts/i86pc/xsvc/Makefile b/usr/src/uts/i86pc/xsvc/Makefile index be21b26687..95deb601bc 100644 --- a/usr/src/uts/i86pc/xsvc/Makefile +++ b/usr/src/uts/i86pc/xsvc/Makefile @@ -67,7 +67,7 @@ LDFLAGS += -dy MODSTUBS_DIR = $(OBJS_DIR) CLEANFILES += $(MODSTUBS_O) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/i86xpv/generic_cpu/Makefile b/usr/src/uts/i86xpv/generic_cpu/Makefile index d5503c572b..cb5182ddad 100644 --- a/usr/src/uts/i86xpv/generic_cpu/Makefile +++ b/usr/src/uts/i86xpv/generic_cpu/Makefile @@ -45,7 +45,7 @@ include $(UTSBASE)/i86xpv/Makefile.i86xpv include $(UTSBASE)/i86pc/cpu/Makefile.files CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-variable # diff --git a/usr/src/uts/i86xpv/gfx_private/Makefile b/usr/src/uts/i86xpv/gfx_private/Makefile index 2415000d91..b2627ac283 100644 --- a/usr/src/uts/i86xpv/gfx_private/Makefile +++ b/usr/src/uts/i86xpv/gfx_private/Makefile @@ -66,7 +66,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_STATIC_UNUSED -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # diff --git a/usr/src/uts/i86xpv/ioat/Makefile b/usr/src/uts/i86xpv/ioat/Makefile index b1c1f1553c..880c968740 100644 --- a/usr/src/uts/i86xpv/ioat/Makefile +++ b/usr/src/uts/i86xpv/ioat/Makefile @@ -59,7 +59,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Dependency diff --git a/usr/src/uts/i86xpv/npe/Makefile b/usr/src/uts/i86xpv/npe/Makefile index 0a3ed67eb1..5bcbb397dd 100644 --- a/usr/src/uts/i86xpv/npe/Makefile +++ b/usr/src/uts/i86xpv/npe/Makefile @@ -74,7 +74,7 @@ LINTFLAGS += -D_MODULE_NAME="\"$(MODULE)\"" LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function diff --git a/usr/src/uts/i86xpv/pci/Makefile b/usr/src/uts/i86xpv/pci/Makefile index e032aa6018..ee10c510b8 100644 --- a/usr/src/uts/i86xpv/pci/Makefile +++ b/usr/src/uts/i86xpv/pci/Makefile @@ -72,7 +72,7 @@ LINTFLAGS += -D_MODULE_NAME="\"$(MODULE)\"" LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function diff --git a/usr/src/uts/i86xpv/privcmd/Makefile b/usr/src/uts/i86xpv/privcmd/Makefile index 8c5ce59e10..5c01fdfc79 100644 --- a/usr/src/uts/i86xpv/privcmd/Makefile +++ b/usr/src/uts/i86xpv/privcmd/Makefile @@ -58,7 +58,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/i86xpv/rootnex/Makefile b/usr/src/uts/i86xpv/rootnex/Makefile index 125f0c25f6..9b966d99ad 100644 --- a/usr/src/uts/i86xpv/rootnex/Makefile +++ b/usr/src/uts/i86xpv/rootnex/Makefile @@ -65,7 +65,7 @@ LDFLAGS += -dy LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function diff --git a/usr/src/uts/i86xpv/unix/Makefile b/usr/src/uts/i86xpv/unix/Makefile index bafa0b0417..28a20705b9 100644 --- a/usr/src/uts/i86xpv/unix/Makefile +++ b/usr/src/uts/i86xpv/unix/Makefile @@ -140,7 +140,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-char-subscripts CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function diff --git a/usr/src/uts/i86xpv/xdt/Makefile b/usr/src/uts/i86xpv/xdt/Makefile index e3d3f987db..7a5cf0844e 100644 --- a/usr/src/uts/i86xpv/xdt/Makefile +++ b/usr/src/uts/i86xpv/xdt/Makefile @@ -40,7 +40,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) LDFLAGS += -dy -Ndrv/dtrace -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) .KEEP_STATE: diff --git a/usr/src/uts/i86xpv/xnb/Makefile b/usr/src/uts/i86xpv/xnb/Makefile index 59d6c55882..f8ee1c9fd4 100644 --- a/usr/src/uts/i86xpv/xnb/Makefile +++ b/usr/src/uts/i86xpv/xnb/Makefile @@ -71,7 +71,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += signed diff --git a/usr/src/uts/i86xpv/xpv_psm/Makefile b/usr/src/uts/i86xpv/xpv_psm/Makefile index f971123f53..1c40f8790b 100644 --- a/usr/src/uts/i86xpv/xpv_psm/Makefile +++ b/usr/src/uts/i86xpv/xpv_psm/Makefile @@ -77,7 +77,7 @@ LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-empty-body CERRWARN += -_gcc=-Wno-unused-function diff --git a/usr/src/uts/i86xpv/xpvd/Makefile b/usr/src/uts/i86xpv/xpvd/Makefile index 83359e9cfe..3acabb2c10 100644 --- a/usr/src/uts/i86xpv/xpvd/Makefile +++ b/usr/src/uts/i86xpv/xpvd/Makefile @@ -58,7 +58,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/i86xpv/xsvc/Makefile b/usr/src/uts/i86xpv/xsvc/Makefile index 8414445dc1..ae3deaeb48 100644 --- a/usr/src/uts/i86xpv/xsvc/Makefile +++ b/usr/src/uts/i86xpv/xsvc/Makefile @@ -66,7 +66,7 @@ LDFLAGS += -dy MODSTUBS_DIR = $(OBJS_DIR) CLEANFILES += $(MODSTUBS_O) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/FSS/Makefile b/usr/src/uts/intel/FSS/Makefile index dd4ea315d6..1b6c91519a 100644 --- a/usr/src/uts/intel/FSS/Makefile +++ b/usr/src/uts/intel/FSS/Makefile @@ -63,7 +63,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/fss.o := SMOFF += deref_check diff --git a/usr/src/uts/intel/aac/Makefile b/usr/src/uts/intel/aac/Makefile index dc832d136e..c058765408 100644 --- a/usr/src/uts/intel/aac/Makefile +++ b/usr/src/uts/intel/aac/Makefile @@ -66,7 +66,7 @@ LDFLAGS += -dy -Nmisc/scsi # Overrides # -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-unused-label diff --git a/usr/src/uts/intel/acpica/Makefile b/usr/src/uts/intel/acpica/Makefile index e9ae57ab4c..f6e16ea479 100644 --- a/usr/src/uts/intel/acpica/Makefile +++ b/usr/src/uts/intel/acpica/Makefile @@ -63,7 +63,7 @@ LINTFLAGS += -errwarn=%none CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-function # diff --git a/usr/src/uts/intel/aggr/Makefile b/usr/src/uts/intel/aggr/Makefile index c1acf014c7..424dab4a53 100644 --- a/usr/src/uts/intel/aggr/Makefile +++ b/usr/src/uts/intel/aggr/Makefile @@ -64,7 +64,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/intel/ahci/Makefile b/usr/src/uts/intel/ahci/Makefile index be7d89e485..14d99eaa97 100644 --- a/usr/src/uts/intel/ahci/Makefile +++ b/usr/src/uts/intel/ahci/Makefile @@ -70,7 +70,7 @@ CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # diff --git a/usr/src/uts/intel/arcmsr/Makefile b/usr/src/uts/intel/arcmsr/Makefile index d389365c10..6f986864e5 100644 --- a/usr/src/uts/intel/arcmsr/Makefile +++ b/usr/src/uts/intel/arcmsr/Makefile @@ -45,7 +45,7 @@ include $(UTSBASE)/intel/Makefile.intel CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/arcmsr.o := SMOFF += deref_check diff --git a/usr/src/uts/intel/arn/Makefile b/usr/src/uts/intel/arn/Makefile index f25a80418f..95a5ace322 100644 --- a/usr/src/uts/intel/arn/Makefile +++ b/usr/src/uts/intel/arn/Makefile @@ -63,7 +63,7 @@ LDFLAGS += -dy -Nmisc/mac -Nmisc/net80211 LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-unused-variable -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-char-subscripts # various issues diff --git a/usr/src/uts/intel/asy/Makefile b/usr/src/uts/intel/asy/Makefile index fc51587b26..5766f59ad7 100644 --- a/usr/src/uts/intel/asy/Makefile +++ b/usr/src/uts/intel/asy/Makefile @@ -71,7 +71,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/intel/ata/Makefile b/usr/src/uts/intel/ata/Makefile index c0c0584bf2..4dde927f6a 100644 --- a/usr/src/uts/intel/ata/Makefile +++ b/usr/src/uts/intel/ata/Makefile @@ -73,7 +73,7 @@ INC_PATH += -I$(UTSBASE)/intel/io/dktp/hba/ghd LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Depends on scsi diff --git a/usr/src/uts/intel/atge/Makefile b/usr/src/uts/intel/atge/Makefile index dc5fb963d0..b9a1123efb 100644 --- a/usr/src/uts/intel/atge/Makefile +++ b/usr/src/uts/intel/atge/Makefile @@ -56,7 +56,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # Overrides # -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch # diff --git a/usr/src/uts/intel/audio/Makefile b/usr/src/uts/intel/audio/Makefile index 6b9547d4b5..3a7a1d6c21 100644 --- a/usr/src/uts/intel/audio/Makefile +++ b/usr/src/uts/intel/audio/Makefile @@ -45,7 +45,7 @@ CONF_SRCDIR = $(UTSBASE)/common/io/audio/impl # include $(UTSBASE)/intel/Makefile.intel -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/audio_grc3.o := SMOFF += index_overflow diff --git a/usr/src/uts/intel/audiocmi/Makefile b/usr/src/uts/intel/audiocmi/Makefile index d173c0442e..e8ac905821 100644 --- a/usr/src/uts/intel/audiocmi/Makefile +++ b/usr/src/uts/intel/audiocmi/Makefile @@ -54,7 +54,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) LDFLAGS += -dy -Ndrv/audio -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/audiocmihd/Makefile b/usr/src/uts/intel/audiocmihd/Makefile index fa3a3c43f6..21df6124ed 100644 --- a/usr/src/uts/intel/audiocmihd/Makefile +++ b/usr/src/uts/intel/audiocmihd/Makefile @@ -57,7 +57,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) LDFLAGS += -dy -Ndrv/audio -Nmisc/ac97 CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/audioemu10k/Makefile b/usr/src/uts/intel/audioemu10k/Makefile index c115cc4024..fe92af6169 100644 --- a/usr/src/uts/intel/audioemu10k/Makefile +++ b/usr/src/uts/intel/audioemu10k/Makefile @@ -59,7 +59,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) LDFLAGS += -dy -Ndrv/audio -Nmisc/ac97 -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += all_func_returns diff --git a/usr/src/uts/intel/audioens/Makefile b/usr/src/uts/intel/audioens/Makefile index 8170620e89..31dc4428b3 100644 --- a/usr/src/uts/intel/audioens/Makefile +++ b/usr/src/uts/intel/audioens/Makefile @@ -54,7 +54,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) LDFLAGS += -dy -Ndrv/audio -Nmisc/ac97 -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/audiohd/Makefile b/usr/src/uts/intel/audiohd/Makefile index 11b5ae03fb..2342e05ed0 100644 --- a/usr/src/uts/intel/audiohd/Makefile +++ b/usr/src/uts/intel/audiohd/Makefile @@ -62,7 +62,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) LDFLAGS += -dy -Ndrv/audio diff --git a/usr/src/uts/intel/audiop16x/Makefile b/usr/src/uts/intel/audiop16x/Makefile index e493e02fa5..5dfc4ef69b 100644 --- a/usr/src/uts/intel/audiop16x/Makefile +++ b/usr/src/uts/intel/audiop16x/Makefile @@ -54,7 +54,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) LDFLAGS += -dy -Ndrv/audio -Nmisc/ac97 -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/audiopci/Makefile b/usr/src/uts/intel/audiopci/Makefile index f33f56c260..046cdb639c 100644 --- a/usr/src/uts/intel/audiopci/Makefile +++ b/usr/src/uts/intel/audiopci/Makefile @@ -54,7 +54,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) LDFLAGS += -dy -Ndrv/audio -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/audiosolo/Makefile b/usr/src/uts/intel/audiosolo/Makefile index cc3e29e1ca..a0f5be43d3 100644 --- a/usr/src/uts/intel/audiosolo/Makefile +++ b/usr/src/uts/intel/audiosolo/Makefile @@ -53,7 +53,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) LDFLAGS += -dy -Ndrv/audio -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += assign_vs_compare diff --git a/usr/src/uts/intel/autofs/Makefile b/usr/src/uts/intel/autofs/Makefile index 13744bab48..2c016535d7 100644 --- a/usr/src/uts/intel/autofs/Makefile +++ b/usr/src/uts/intel/autofs/Makefile @@ -74,7 +74,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/av1394/Makefile b/usr/src/uts/intel/av1394/Makefile index acf063f91e..6aec73ec41 100644 --- a/usr/src/uts/intel/av1394/Makefile +++ b/usr/src/uts/intel/av1394/Makefile @@ -71,7 +71,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits diff --git a/usr/src/uts/intel/bfe/Makefile b/usr/src/uts/intel/bfe/Makefile index da2b8f55c5..1037153846 100644 --- a/usr/src/uts/intel/bfe/Makefile +++ b/usr/src/uts/intel/bfe/Makefile @@ -69,7 +69,7 @@ CPPFLAGS += $(VFLAGS) $(AFLAGS) $(DFLAGS) $(CFGFLAGS) $(CCVERBOSE) \ CFLAGS += $(CPPFLAGS) CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Driver depends on MAC & IP diff --git a/usr/src/uts/intel/bge/Makefile b/usr/src/uts/intel/bge/Makefile index eedd8c38c6..456cbc9043 100644 --- a/usr/src/uts/intel/bge/Makefile +++ b/usr/src/uts/intel/bge/Makefile @@ -65,7 +65,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/intel/blowfish/Makefile b/usr/src/uts/intel/blowfish/Makefile index dd40e59c1e..a80406a6f1 100644 --- a/usr/src/uts/intel/blowfish/Makefile +++ b/usr/src/uts/intel/blowfish/Makefile @@ -75,7 +75,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # needs work diff --git a/usr/src/uts/intel/bnxe/Makefile b/usr/src/uts/intel/bnxe/Makefile index 0c3441c161..9e686ee522 100644 --- a/usr/src/uts/intel/bnxe/Makefile +++ b/usr/src/uts/intel/bnxe/Makefile @@ -86,7 +86,7 @@ CPPFLAGS += -DLM_RXPKT_NON_CONTIGUOUS \ LDFLAGS += -dy -r -Ndrv/ip -Nmisc/mac CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-value diff --git a/usr/src/uts/intel/bofi/Makefile b/usr/src/uts/intel/bofi/Makefile index e419840e5f..5cd82b9879 100644 --- a/usr/src/uts/intel/bofi/Makefile +++ b/usr/src/uts/intel/bofi/Makefile @@ -69,7 +69,7 @@ CLEANFILES += $(MODSTUBS_O) CPPFLAGS += -I../../sun4 -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/bofi.o := SMOFF += signed_integer_overflow_check,deref_check diff --git a/usr/src/uts/intel/bpf/Makefile b/usr/src/uts/intel/bpf/Makefile index 08e92c6fc7..b1d3344ae7 100644 --- a/usr/src/uts/intel/bpf/Makefile +++ b/usr/src/uts/intel/bpf/Makefile @@ -73,7 +73,7 @@ INC_PATH += -I$(UTSBASE)/common/io/bpf LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/bpf.o := SMOFF += all_func_returns diff --git a/usr/src/uts/intel/bridge/Makefile b/usr/src/uts/intel/bridge/Makefile index 65b7f28ee8..c93ac30992 100644 --- a/usr/src/uts/intel/bridge/Makefile +++ b/usr/src/uts/intel/bridge/Makefile @@ -57,7 +57,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses diff --git a/usr/src/uts/intel/bscv/Makefile b/usr/src/uts/intel/bscv/Makefile index d450f08475..6a61281ca9 100644 --- a/usr/src/uts/intel/bscv/Makefile +++ b/usr/src/uts/intel/bscv/Makefile @@ -67,7 +67,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-value # diff --git a/usr/src/uts/intel/busra/Makefile b/usr/src/uts/intel/busra/Makefile index 9bb7ea39ec..c0b0aef680 100644 --- a/usr/src/uts/intel/busra/Makefile +++ b/usr/src/uts/intel/busra/Makefile @@ -52,7 +52,7 @@ ROOTMODULE = $(ROOT_MISC_DIR)/$(MODULE) include $(UTSBASE)/intel/Makefile.intel CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Define targets diff --git a/usr/src/uts/intel/c2audit/Makefile b/usr/src/uts/intel/c2audit/Makefile index 0afbc9383c..a0b21d0b52 100644 --- a/usr/src/uts/intel/c2audit/Makefile +++ b/usr/src/uts/intel/c2audit/Makefile @@ -77,7 +77,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-clobbered -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/cardbus/Makefile b/usr/src/uts/intel/cardbus/Makefile index a6eba6f056..f2576aba6b 100644 --- a/usr/src/uts/intel/cardbus/Makefile +++ b/usr/src/uts/intel/cardbus/Makefile @@ -81,7 +81,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/intel/cmdk/Makefile b/usr/src/uts/intel/cmdk/Makefile index 05532fd7b2..8de577e243 100644 --- a/usr/src/uts/intel/cmdk/Makefile +++ b/usr/src/uts/intel/cmdk/Makefile @@ -67,7 +67,7 @@ LDFLAGS += -dy -Nmisc/dadk -Nmisc/strategy -Nmisc/cmlb CPPFLAGS += -D_EXTVTOC CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits diff --git a/usr/src/uts/intel/cmlb/Makefile b/usr/src/uts/intel/cmlb/Makefile index 8e09b5c030..05c03ff23d 100644 --- a/usr/src/uts/intel/cmlb/Makefile +++ b/usr/src/uts/intel/cmlb/Makefile @@ -75,7 +75,7 @@ CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/cmlb.o := SMOFF += signed diff --git a/usr/src/uts/intel/core_pcbe/Makefile b/usr/src/uts/intel/core_pcbe/Makefile index 6286d956a9..25b49cc203 100644 --- a/usr/src/uts/intel/core_pcbe/Makefile +++ b/usr/src/uts/intel/core_pcbe/Makefile @@ -118,7 +118,7 @@ ROOTSOFTLINKS = $(SOFTLINKS:%=$(ROOT_PSM_PCBE_DIR)/%) # include $(UTSBASE)/intel/Makefile.intel -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-variable CPPFLAGS += -I$(UTSBASE)/intel/core_pcbe diff --git a/usr/src/uts/intel/cryptmod/Makefile b/usr/src/uts/intel/cryptmod/Makefile index 4e9e2d5d41..57be67a788 100644 --- a/usr/src/uts/intel/cryptmod/Makefile +++ b/usr/src/uts/intel/cryptmod/Makefile @@ -65,7 +65,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/crypto/Makefile b/usr/src/uts/intel/crypto/Makefile index adbd33bbc4..0ed9d0bd9a 100644 --- a/usr/src/uts/intel/crypto/Makefile +++ b/usr/src/uts/intel/crypto/Makefile @@ -56,7 +56,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOTLINK) $(ROOT_CONFFILE) LDFLAGS += -dy -Nmisc/kcf -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/cryptoadm/Makefile b/usr/src/uts/intel/cryptoadm/Makefile index 34917c1339..ddc0ad351b 100644 --- a/usr/src/uts/intel/cryptoadm/Makefile +++ b/usr/src/uts/intel/cryptoadm/Makefile @@ -66,7 +66,7 @@ LDFLAGS += -dy -Nmisc/kcf LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/ctf/Makefile b/usr/src/uts/intel/ctf/Makefile index 97457d0c0c..d3a359cb79 100644 --- a/usr/src/uts/intel/ctf/Makefile +++ b/usr/src/uts/intel/ctf/Makefile @@ -52,7 +52,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) .KEEP_STATE: diff --git a/usr/src/uts/intel/daplt/Makefile b/usr/src/uts/intel/daplt/Makefile index ef99701369..69e2435778 100644 --- a/usr/src/uts/intel/daplt/Makefile +++ b/usr/src/uts/intel/daplt/Makefile @@ -73,7 +73,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/daplt.o := SMOFF += all_func_returns,deref_check diff --git a/usr/src/uts/intel/dcam1394/Makefile b/usr/src/uts/intel/dcam1394/Makefile index c043878082..0b5f343a84 100644 --- a/usr/src/uts/intel/dcam1394/Makefile +++ b/usr/src/uts/intel/dcam1394/Makefile @@ -65,7 +65,7 @@ LDFLAGS += -dy -Nmisc/s1394 LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # Default build targets. # diff --git a/usr/src/uts/intel/dcfs/Makefile b/usr/src/uts/intel/dcfs/Makefile index ab0738de9c..8efff46405 100644 --- a/usr/src/uts/intel/dcfs/Makefile +++ b/usr/src/uts/intel/dcfs/Makefile @@ -59,7 +59,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/des/Makefile b/usr/src/uts/intel/des/Makefile index 2c8045b380..1807a56139 100644 --- a/usr/src/uts/intel/des/Makefile +++ b/usr/src/uts/intel/des/Makefile @@ -80,7 +80,7 @@ LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/dev/Makefile b/usr/src/uts/intel/dev/Makefile index 00c885fc3a..6cc3fda6cd 100644 --- a/usr/src/uts/intel/dev/Makefile +++ b/usr/src/uts/intel/dev/Makefile @@ -70,8 +70,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized -CERRWARN += -_gcc=-Wno-unused-function +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/devinfo/Makefile b/usr/src/uts/intel/devinfo/Makefile index 98219434c6..39790aed0c 100644 --- a/usr/src/uts/intel/devinfo/Makefile +++ b/usr/src/uts/intel/devinfo/Makefile @@ -62,7 +62,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) CPPFLAGS += -I$(SRC)/common CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-clobbered diff --git a/usr/src/uts/intel/dld/Makefile b/usr/src/uts/intel/dld/Makefile index d2bf772b82..1f2e3d7023 100644 --- a/usr/src/uts/intel/dld/Makefile +++ b/usr/src/uts/intel/dld/Makefile @@ -67,7 +67,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-parentheses diff --git a/usr/src/uts/intel/dls/Makefile b/usr/src/uts/intel/dls/Makefile index 5bf2bdbcf8..2c9c5a49f1 100644 --- a/usr/src/uts/intel/dls/Makefile +++ b/usr/src/uts/intel/dls/Makefile @@ -65,7 +65,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/dls_link.o := SMOFF += all_func_returns diff --git a/usr/src/uts/intel/dmfe/Makefile b/usr/src/uts/intel/dmfe/Makefile index 1bef101854..8fbef4c1e6 100644 --- a/usr/src/uts/intel/dmfe/Makefile +++ b/usr/src/uts/intel/dmfe/Makefile @@ -56,7 +56,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # extra link arguments diff --git a/usr/src/uts/intel/dnet/Makefile b/usr/src/uts/intel/dnet/Makefile index ea395c5f63..1fbfc68ee1 100644 --- a/usr/src/uts/intel/dnet/Makefile +++ b/usr/src/uts/intel/dnet/Makefile @@ -61,7 +61,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/dnet.o := SMOFF += index_overflow diff --git a/usr/src/uts/intel/doorfs/Makefile b/usr/src/uts/intel/doorfs/Makefile index 289992ea9f..c130144226 100644 --- a/usr/src/uts/intel/doorfs/Makefile +++ b/usr/src/uts/intel/doorfs/Makefile @@ -75,7 +75,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/door_sys.o := SMOFF += deref_check diff --git a/usr/src/uts/intel/dscpmk/Makefile b/usr/src/uts/intel/dscpmk/Makefile index 5d5ed6d3b5..be0c768aa4 100644 --- a/usr/src/uts/intel/dscpmk/Makefile +++ b/usr/src/uts/intel/dscpmk/Makefile @@ -68,7 +68,7 @@ LDFLAGS += -dy -Ndrv/ip LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/dtrace/Makefile b/usr/src/uts/intel/dtrace/Makefile index b3b5dd18ad..0462d6bd34 100644 --- a/usr/src/uts/intel/dtrace/Makefile +++ b/usr/src/uts/intel/dtrace/Makefile @@ -48,7 +48,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/dtrace.o := SMOFF += signed_integer_overflow_check,deref_check diff --git a/usr/src/uts/intel/e1000g/Makefile b/usr/src/uts/intel/e1000g/Makefile index d48b8f77a0..bf933f9b7e 100644 --- a/usr/src/uts/intel/e1000g/Makefile +++ b/usr/src/uts/intel/e1000g/Makefile @@ -58,7 +58,7 @@ CFLAGS_CPP_COMMENTS = -xCC CFLAGS += $(CFLAGS_CPP_COMMENTS) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-label diff --git a/usr/src/uts/intel/ecc/Makefile b/usr/src/uts/intel/ecc/Makefile index 04db887bcc..cfc6b066b2 100644 --- a/usr/src/uts/intel/ecc/Makefile +++ b/usr/src/uts/intel/ecc/Makefile @@ -66,7 +66,7 @@ LINTFLAGS += -I$(COM1_DIR) -I$(COM2_DIR) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-empty-body CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/intel/ecpp/Makefile b/usr/src/uts/intel/ecpp/Makefile index 9352ae18bf..6a847a8bc2 100644 --- a/usr/src/uts/intel/ecpp/Makefile +++ b/usr/src/uts/intel/ecpp/Makefile @@ -64,7 +64,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/intel/efe/Makefile b/usr/src/uts/intel/efe/Makefile index 687ffc28a0..3e53fa8aea 100644 --- a/usr/src/uts/intel/efe/Makefile +++ b/usr/src/uts/intel/efe/Makefile @@ -40,7 +40,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) CFLAGS += $(CCVERBOSE) LDFLAGS += -dy -N misc/mac -N misc/mii -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/ehci/Makefile b/usr/src/uts/intel/ehci/Makefile index acae04f03c..8c2192261e 100644 --- a/usr/src/uts/intel/ehci/Makefile +++ b/usr/src/uts/intel/ehci/Makefile @@ -43,7 +43,7 @@ CONF_SRCDIR = $(UTSBASE)/common/io/usb/hcd/ehci # include $(UTSBASE)/intel/Makefile.intel -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch # needs work diff --git a/usr/src/uts/intel/eibnx/Makefile b/usr/src/uts/intel/eibnx/Makefile index 417c96518d..85d5ea3310 100644 --- a/usr/src/uts/intel/eibnx/Makefile +++ b/usr/src/uts/intel/eibnx/Makefile @@ -76,7 +76,7 @@ LDFLAGS += -dy -Nmisc/ibcm -Nmisc/ibtl LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/enx_ibt.o := SMOFF += deref_check diff --git a/usr/src/uts/intel/elfexec/Makefile b/usr/src/uts/intel/elfexec/Makefile index 44b43721f9..4444623960 100644 --- a/usr/src/uts/intel/elfexec/Makefile +++ b/usr/src/uts/intel/elfexec/Makefile @@ -73,7 +73,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/elxl/Makefile b/usr/src/uts/intel/elxl/Makefile index 22f578c91d..0928deefb8 100644 --- a/usr/src/uts/intel/elxl/Makefile +++ b/usr/src/uts/intel/elxl/Makefile @@ -61,7 +61,7 @@ LDFLAGS += -dy -N misc/mac -N misc/mii # CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # diff --git a/usr/src/uts/intel/emlxs/Makefile b/usr/src/uts/intel/emlxs/Makefile index e29f1762ca..a59e9cdaa9 100644 --- a/usr/src/uts/intel/emlxs/Makefile +++ b/usr/src/uts/intel/emlxs/Makefile @@ -81,7 +81,7 @@ LDFLAGS += -Nmisc/bignum -Nmisc/fctl CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += indenting,deref_check,all_func_returns,index_overflow diff --git a/usr/src/uts/intel/emul64/Makefile b/usr/src/uts/intel/emul64/Makefile index f7fdba6865..4b40975a0e 100644 --- a/usr/src/uts/intel/emul64/Makefile +++ b/usr/src/uts/intel/emul64/Makefile @@ -69,7 +69,7 @@ CFLAGS += $(CCVERBOSE) LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += indenting,shift_to_zero diff --git a/usr/src/uts/intel/eoib/Makefile b/usr/src/uts/intel/eoib/Makefile index f9097dfa01..b91672cc9a 100644 --- a/usr/src/uts/intel/eoib/Makefile +++ b/usr/src/uts/intel/eoib/Makefile @@ -65,7 +65,7 @@ CPPFLAGS += -DEIB_DEBUG CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/eib_ibt.o := SMOFF += deref_check diff --git a/usr/src/uts/intel/fasttrap/Makefile b/usr/src/uts/intel/fasttrap/Makefile index f464ee90a9..259a685067 100644 --- a/usr/src/uts/intel/fasttrap/Makefile +++ b/usr/src/uts/intel/fasttrap/Makefile @@ -43,7 +43,7 @@ CFLAGS += $(CCVERBOSE) CPPFLAGS += -I$(SRC)/common LDFLAGS += -dy -Ndrv/dtrace -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) .KEEP_STATE: diff --git a/usr/src/uts/intel/fcp/Makefile b/usr/src/uts/intel/fcp/Makefile index 1dfb19035f..0707670f06 100644 --- a/usr/src/uts/intel/fcp/Makefile +++ b/usr/src/uts/intel/fcp/Makefile @@ -66,7 +66,7 @@ LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) SMATCH=off diff --git a/usr/src/uts/intel/fcsm/Makefile b/usr/src/uts/intel/fcsm/Makefile index 042e429b0b..159d41efed 100644 --- a/usr/src/uts/intel/fcsm/Makefile +++ b/usr/src/uts/intel/fcsm/Makefile @@ -71,7 +71,7 @@ LDFLAGS += -dy -Nmisc/fctl LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/fct/Makefile b/usr/src/uts/intel/fct/Makefile index ba4aa67b61..ffdcf940b6 100644 --- a/usr/src/uts/intel/fct/Makefile +++ b/usr/src/uts/intel/fct/Makefile @@ -71,7 +71,7 @@ LINTTAGS += -erroff=E_IF_ELSE_ANNOTATION CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += strcpy_overflow diff --git a/usr/src/uts/intel/fctl/Makefile b/usr/src/uts/intel/fctl/Makefile index 5d6dd01b08..d590e8cf19 100644 --- a/usr/src/uts/intel/fctl/Makefile +++ b/usr/src/uts/intel/fctl/Makefile @@ -63,7 +63,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/fctl.o := SMOFF += all_func_returns,deref_check diff --git a/usr/src/uts/intel/fd/Makefile b/usr/src/uts/intel/fd/Makefile index fd08395482..18a0e03594 100644 --- a/usr/src/uts/intel/fd/Makefile +++ b/usr/src/uts/intel/fd/Makefile @@ -65,7 +65,7 @@ LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/fd.o := SMOFF += all_func_returns diff --git a/usr/src/uts/intel/flowacct/Makefile b/usr/src/uts/intel/flowacct/Makefile index 0b9f291825..5918b997d3 100644 --- a/usr/src/uts/intel/flowacct/Makefile +++ b/usr/src/uts/intel/flowacct/Makefile @@ -66,7 +66,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/fp/Makefile b/usr/src/uts/intel/fp/Makefile index 63bb075df0..a102ee87ab 100644 --- a/usr/src/uts/intel/fp/Makefile +++ b/usr/src/uts/intel/fp/Makefile @@ -71,7 +71,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON LINTTAGS += -erroff=E_STATIC_UNUSED -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-function # needs work diff --git a/usr/src/uts/intel/genunix/Makefile b/usr/src/uts/intel/genunix/Makefile index 58a50d801a..570674f903 100644 --- a/usr/src/uts/intel/genunix/Makefile +++ b/usr/src/uts/intel/genunix/Makefile @@ -85,7 +85,7 @@ CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-type-limits -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-clobbered CERRWARN += -_gcc=-Wno-empty-body diff --git a/usr/src/uts/intel/gld/Makefile b/usr/src/uts/intel/gld/Makefile index 53869c40df..3b88451670 100644 --- a/usr/src/uts/intel/gld/Makefile +++ b/usr/src/uts/intel/gld/Makefile @@ -66,7 +66,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # diff --git a/usr/src/uts/intel/hci1394/Makefile b/usr/src/uts/intel/hci1394/Makefile index 18c4f5ed6b..87902a5970 100644 --- a/usr/src/uts/intel/hci1394/Makefile +++ b/usr/src/uts/intel/hci1394/Makefile @@ -80,7 +80,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # diff --git a/usr/src/uts/intel/hermon/Makefile b/usr/src/uts/intel/hermon/Makefile index bfcc27f547..b580f00b55 100644 --- a/usr/src/uts/intel/hermon/Makefile +++ b/usr/src/uts/intel/hermon/Makefile @@ -71,7 +71,7 @@ CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMATCH=off diff --git a/usr/src/uts/intel/hidparser/Makefile b/usr/src/uts/intel/hidparser/Makefile index fa8db67f73..9aedf5edd7 100644 --- a/usr/src/uts/intel/hidparser/Makefile +++ b/usr/src/uts/intel/hidparser/Makefile @@ -46,7 +46,7 @@ ROOTMODULE = $(ROOT_MISC_DIR)/$(MODULE) # include $(UTSBASE)/intel/Makefile.intel -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Define targets diff --git a/usr/src/uts/intel/hme/Makefile b/usr/src/uts/intel/hme/Makefile index d84a20ab87..8f18f7c77d 100644 --- a/usr/src/uts/intel/hme/Makefile +++ b/usr/src/uts/intel/hme/Makefile @@ -60,7 +60,7 @@ LDFLAGS += -dy -Nmisc/mii -Nmisc/mac CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/hme.o := SMOFF += indenting,deref_check diff --git a/usr/src/uts/intel/hook/Makefile b/usr/src/uts/intel/hook/Makefile index ab9f0b8e04..c7e3804b3d 100644 --- a/usr/src/uts/intel/hook/Makefile +++ b/usr/src/uts/intel/hook/Makefile @@ -51,7 +51,7 @@ ROOTMODULE = $(ROOT_MISC_DIR)/$(MODULE) # include $(UTSBASE)/intel/Makefile.intel -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/hook.o := SMOFF += all_func_returns diff --git a/usr/src/uts/intel/hpcsvc/Makefile b/usr/src/uts/intel/hpcsvc/Makefile index 0a219218ce..a2a6e5e134 100644 --- a/usr/src/uts/intel/hpcsvc/Makefile +++ b/usr/src/uts/intel/hpcsvc/Makefile @@ -57,7 +57,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) DEBUG_FLGS = DEBUG_DEFS += $(DEBUG_FLGS) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/hpcsvc.o := SMOFF += all_func_returns diff --git a/usr/src/uts/intel/hsfs/Makefile b/usr/src/uts/intel/hsfs/Makefile index 10452c9754..88d4ecbbb0 100644 --- a/usr/src/uts/intel/hsfs/Makefile +++ b/usr/src/uts/intel/hsfs/Makefile @@ -70,7 +70,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-switch diff --git a/usr/src/uts/intel/hxge/Makefile b/usr/src/uts/intel/hxge/Makefile index 18e7597c86..911a3cecdf 100644 --- a/usr/src/uts/intel/hxge/Makefile +++ b/usr/src/uts/intel/hxge/Makefile @@ -83,7 +83,7 @@ LINTTAGS += -erroff=E_FALSE_LOGICAL_EXPR CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses SMOFF += deref_check,logical_instead_of_bitwise diff --git a/usr/src/uts/intel/ib/Makefile b/usr/src/uts/intel/ib/Makefile index 48b58d2c5f..8b3939c04b 100644 --- a/usr/src/uts/intel/ib/Makefile +++ b/usr/src/uts/intel/ib/Makefile @@ -59,7 +59,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # Overrides. # -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # lint pass one enforcement diff --git a/usr/src/uts/intel/ibcm/Makefile b/usr/src/uts/intel/ibcm/Makefile index 38b6520778..43db7246bc 100644 --- a/usr/src/uts/intel/ibcm/Makefile +++ b/usr/src/uts/intel/ibcm/Makefile @@ -63,7 +63,7 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-value # needs work diff --git a/usr/src/uts/intel/ibdm/Makefile b/usr/src/uts/intel/ibdm/Makefile index 0dca661c45..644cbeca3c 100644 --- a/usr/src/uts/intel/ibdm/Makefile +++ b/usr/src/uts/intel/ibdm/Makefile @@ -75,7 +75,7 @@ LDFLAGS += -dy -Nmisc/ibtl -Nmisc/ibmf LINTTAGS += -erroff=E_STATIC_UNUSED LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/ibmf/Makefile b/usr/src/uts/intel/ibmf/Makefile index 8fe06342ed..d2271a55b9 100644 --- a/usr/src/uts/intel/ibmf/Makefile +++ b/usr/src/uts/intel/ibmf/Makefile @@ -69,7 +69,7 @@ CFLAGS += $(CCVERBOSE) LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMATCH=off diff --git a/usr/src/uts/intel/ibp/Makefile b/usr/src/uts/intel/ibp/Makefile index 536aae0c8f..c1755b165f 100644 --- a/usr/src/uts/intel/ibp/Makefile +++ b/usr/src/uts/intel/ibp/Makefile @@ -59,7 +59,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch # needs work diff --git a/usr/src/uts/intel/ibtl/Makefile b/usr/src/uts/intel/ibtl/Makefile index 7d0343b89c..4d01e0f362 100644 --- a/usr/src/uts/intel/ibtl/Makefile +++ b/usr/src/uts/intel/ibtl/Makefile @@ -71,7 +71,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-value diff --git a/usr/src/uts/intel/idm/Makefile b/usr/src/uts/intel/idm/Makefile index 703ca57dd3..d8c9b38121 100644 --- a/usr/src/uts/intel/idm/Makefile +++ b/usr/src/uts/intel/idm/Makefile @@ -60,7 +60,7 @@ LDFLAGS += -dy -Nfs/sockfs -Nmisc/ksocket CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMATCH=off diff --git a/usr/src/uts/intel/igb/Makefile b/usr/src/uts/intel/igb/Makefile index 1f6864efbe..72d4b205b3 100644 --- a/usr/src/uts/intel/igb/Makefile +++ b/usr/src/uts/intel/igb/Makefile @@ -49,7 +49,7 @@ LINTFLAGS += \ -I$(UTSBASE)/common/io/e1000api CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_cc=-erroff=E_STATEMENT_NOT_REACHED # needs work diff --git a/usr/src/uts/intel/intel_nb5000/Makefile b/usr/src/uts/intel/intel_nb5000/Makefile index 54c012824e..5d469b5ee9 100644 --- a/usr/src/uts/intel/intel_nb5000/Makefile +++ b/usr/src/uts/intel/intel_nb5000/Makefile @@ -62,7 +62,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) LDFLAGS += -dy -N drv/smbios CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMATCH=off diff --git a/usr/src/uts/intel/intel_nhm/Makefile b/usr/src/uts/intel/intel_nhm/Makefile index 73e594c92f..9c72a19c02 100644 --- a/usr/src/uts/intel/intel_nhm/Makefile +++ b/usr/src/uts/intel/intel_nhm/Makefile @@ -56,7 +56,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) CPPFLAGS += -I$(UTSBASE)/i86pc LDFLAGS += -dy -N drv/smbios -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/ip/Makefile b/usr/src/uts/intel/ip/Makefile index 7ab08e4456..9cc6e5499f 100644 --- a/usr/src/uts/intel/ip/Makefile +++ b/usr/src/uts/intel/ip/Makefile @@ -66,7 +66,7 @@ CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits # false positives diff --git a/usr/src/uts/intel/ipc/Makefile b/usr/src/uts/intel/ipc/Makefile index 8bf9b9a67c..03969a22ad 100644 --- a/usr/src/uts/intel/ipc/Makefile +++ b/usr/src/uts/intel/ipc/Makefile @@ -64,7 +64,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/ipf/Makefile b/usr/src/uts/intel/ipf/Makefile index 7e0da79ba3..7387a62a15 100644 --- a/usr/src/uts/intel/ipf/Makefile +++ b/usr/src/uts/intel/ipf/Makefile @@ -71,7 +71,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-empty-body # needs work diff --git a/usr/src/uts/intel/ipgpc/Makefile b/usr/src/uts/intel/ipgpc/Makefile index 6de28b7aed..8c298cdf71 100644 --- a/usr/src/uts/intel/ipgpc/Makefile +++ b/usr/src/uts/intel/ipgpc/Makefile @@ -71,7 +71,7 @@ LDFLAGS += -dy -Ndrv/ip LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/filters.o := SMOFF += deref_check diff --git a/usr/src/uts/intel/ipsecah/Makefile b/usr/src/uts/intel/ipsecah/Makefile index 1111d5fe5d..d744c131f1 100644 --- a/usr/src/uts/intel/ipsecah/Makefile +++ b/usr/src/uts/intel/ipsecah/Makefile @@ -75,7 +75,7 @@ LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/ipsecahddi.o := SMOFF += index_overflow diff --git a/usr/src/uts/intel/ipsecesp/Makefile b/usr/src/uts/intel/ipsecesp/Makefile index 7e779dd409..713ad82d7c 100644 --- a/usr/src/uts/intel/ipsecesp/Makefile +++ b/usr/src/uts/intel/ipsecesp/Makefile @@ -73,7 +73,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/ipsecespddi.o := SMOFF += index_overflow diff --git a/usr/src/uts/intel/iptun/Makefile b/usr/src/uts/intel/iptun/Makefile index c71c39f911..b276ee8375 100644 --- a/usr/src/uts/intel/iptun/Makefile +++ b/usr/src/uts/intel/iptun/Makefile @@ -60,7 +60,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/ipw/Makefile b/usr/src/uts/intel/ipw/Makefile index 8b29857bda..1301d081d3 100644 --- a/usr/src/uts/intel/ipw/Makefile +++ b/usr/src/uts/intel/ipw/Makefile @@ -51,7 +51,7 @@ include $(UTSBASE)/intel/Makefile.intel CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/ipw2100.o := SMOFF += deref_check diff --git a/usr/src/uts/intel/iscsi/Makefile b/usr/src/uts/intel/iscsi/Makefile index a9f2dc2140..9a71674dfa 100644 --- a/usr/src/uts/intel/iscsi/Makefile +++ b/usr/src/uts/intel/iscsi/Makefile @@ -73,7 +73,7 @@ CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMATCH=off diff --git a/usr/src/uts/intel/iscsit/Makefile b/usr/src/uts/intel/iscsit/Makefile index 94bb0e9091..a35f7fc362 100644 --- a/usr/src/uts/intel/iscsit/Makefile +++ b/usr/src/uts/intel/iscsit/Makefile @@ -60,7 +60,7 @@ LDFLAGS += -dy -Ndrv/stmf -Nmisc/idm -Nfs/sockfs -Nmisc/md5 -Nmisc/ksocket C99LMODE= -Xc99=%all CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-label # needs work diff --git a/usr/src/uts/intel/iser/Makefile b/usr/src/uts/intel/iser/Makefile index 0a8f4a2e2f..6245ad5be0 100644 --- a/usr/src/uts/intel/iser/Makefile +++ b/usr/src/uts/intel/iser/Makefile @@ -45,7 +45,7 @@ CONF_SRCDIR = $(UTSBASE)/common/io/ib/clients/iser # include $(UTSBASE)/intel/Makefile.intel -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/iser_ib.o := SMOFF += deref_check diff --git a/usr/src/uts/intel/iwh/Makefile b/usr/src/uts/intel/iwh/Makefile index 89a2dde869..ee7e3d9fcf 100644 --- a/usr/src/uts/intel/iwh/Makefile +++ b/usr/src/uts/intel/iwh/Makefile @@ -60,7 +60,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CPPFLAGS += -I. -D_KERNEL diff --git a/usr/src/uts/intel/iwk/Makefile b/usr/src/uts/intel/iwk/Makefile index 9cb38a51b0..12c4766c98 100644 --- a/usr/src/uts/intel/iwk/Makefile +++ b/usr/src/uts/intel/iwk/Makefile @@ -65,7 +65,7 @@ CPPFLAGS += -I. -D_KERNEL -DIWL=4965 LDFLAGS += -dy -Nmisc/mac -Nmisc/net80211 -Ndrv/random -Ndrv/ip CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/iwk2.o := SMOFF += precedence diff --git a/usr/src/uts/intel/iwp/Makefile b/usr/src/uts/intel/iwp/Makefile index c0c086d685..faaa67e7af 100644 --- a/usr/src/uts/intel/iwp/Makefile +++ b/usr/src/uts/intel/iwp/Makefile @@ -64,7 +64,7 @@ CPPFLAGS += -I. -D_KERNEL LDFLAGS += -dy -Nmisc/mac -Nmisc/net80211 -Ndrv/random -Ndrv/ip CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/ixgbe/Makefile b/usr/src/uts/intel/ixgbe/Makefile index f19f151d60..27c747535a 100644 --- a/usr/src/uts/intel/ixgbe/Makefile +++ b/usr/src/uts/intel/ixgbe/Makefile @@ -57,7 +57,7 @@ INC_PATH += -I$(UTSBASE)/common/io/ixgbe/core CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_cc=-erroff=E_STATEMENT_NOT_REACHED diff --git a/usr/src/uts/intel/kaio/Makefile b/usr/src/uts/intel/kaio/Makefile index 4e2c736c9d..7e0c59ca89 100644 --- a/usr/src/uts/intel/kaio/Makefile +++ b/usr/src/uts/intel/kaio/Makefile @@ -73,7 +73,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/kcf/Makefile b/usr/src/uts/intel/kcf/Makefile index 3ce1d9720c..bb758d8fd5 100644 --- a/usr/src/uts/intel/kcf/Makefile +++ b/usr/src/uts/intel/kcf/Makefile @@ -66,7 +66,7 @@ AS_CPPFLAGS += -I../../$(PLATFORM) LINTTAGS += -I$(COM_DIR) CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label diff --git a/usr/src/uts/intel/kgssapi/Makefile b/usr/src/uts/intel/kgssapi/Makefile index ff27600ef6..936b08b18c 100644 --- a/usr/src/uts/intel/kgssapi/Makefile +++ b/usr/src/uts/intel/kgssapi/Makefile @@ -66,7 +66,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-unused-variable -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/gssd_clnt_stubs.o := SMOFF += indenting,deref_check diff --git a/usr/src/uts/intel/kmech_krb5/Makefile b/usr/src/uts/intel/kmech_krb5/Makefile index 27b311c000..718cb78994 100644 --- a/usr/src/uts/intel/kmech_krb5/Makefile +++ b/usr/src/uts/intel/kmech_krb5/Makefile @@ -71,7 +71,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # needs work diff --git a/usr/src/uts/intel/kssl/Makefile b/usr/src/uts/intel/kssl/Makefile index 27c4519f62..5a9096e243 100644 --- a/usr/src/uts/intel/kssl/Makefile +++ b/usr/src/uts/intel/kssl/Makefile @@ -68,7 +68,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/ksslf/Makefile b/usr/src/uts/intel/ksslf/Makefile index 569a6666bb..575af1dbb5 100644 --- a/usr/src/uts/intel/ksslf/Makefile +++ b/usr/src/uts/intel/ksslf/Makefile @@ -68,7 +68,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/kstat/Makefile b/usr/src/uts/intel/kstat/Makefile index c0321693a0..c4816b6a5c 100644 --- a/usr/src/uts/intel/kstat/Makefile +++ b/usr/src/uts/intel/kstat/Makefile @@ -64,7 +64,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/ldterm/Makefile b/usr/src/uts/intel/ldterm/Makefile index 9911d74a04..0eea144a40 100644 --- a/usr/src/uts/intel/ldterm/Makefile +++ b/usr/src/uts/intel/ldterm/Makefile @@ -67,7 +67,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/llc1/Makefile b/usr/src/uts/intel/llc1/Makefile index 1ad058e06c..ca5af56e24 100644 --- a/usr/src/uts/intel/llc1/Makefile +++ b/usr/src/uts/intel/llc1/Makefile @@ -67,7 +67,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/llc1.o := SMOFF += no_if_block,deref_check diff --git a/usr/src/uts/intel/lofi/Makefile b/usr/src/uts/intel/lofi/Makefile index 13b0bef650..c8d7e11770 100644 --- a/usr/src/uts/intel/lofi/Makefile +++ b/usr/src/uts/intel/lofi/Makefile @@ -49,7 +49,7 @@ include $(UTSBASE)/intel/Makefile.intel # INC_PATH += -I$(SRC)/common/lzma -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Define targets diff --git a/usr/src/uts/intel/mac/Makefile b/usr/src/uts/intel/mac/Makefile index 6766bd933b..7b9fefec25 100644 --- a/usr/src/uts/intel/mac/Makefile +++ b/usr/src/uts/intel/mac/Makefile @@ -59,7 +59,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/intel/mc-amd/Makefile b/usr/src/uts/intel/mc-amd/Makefile index e075b30b81..b9fdbc0b22 100644 --- a/usr/src/uts/intel/mc-amd/Makefile +++ b/usr/src/uts/intel/mc-amd/Makefile @@ -62,7 +62,7 @@ CLEANFILES += $(MCAMD_OFF_H) CLOBBERFILES += $(MCAMD_OFF_H) CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/mega_sas/Makefile b/usr/src/uts/intel/mega_sas/Makefile index 916b2350ab..0290183544 100644 --- a/usr/src/uts/intel/mega_sas/Makefile +++ b/usr/src/uts/intel/mega_sas/Makefile @@ -53,7 +53,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # LDFLAGS += -dy -Nmisc/scsi -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/megaraid_sas.o := SMOFF += snprintf_overflow,all_func_returns,index_overflow diff --git a/usr/src/uts/intel/mii/Makefile b/usr/src/uts/intel/mii/Makefile index cd987a3a31..0c54b575c7 100644 --- a/usr/src/uts/intel/mii/Makefile +++ b/usr/src/uts/intel/mii/Makefile @@ -54,7 +54,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) LDFLAGS += -dy -N misc/mac CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += all_func_returns diff --git a/usr/src/uts/intel/mpt_sas/Makefile b/usr/src/uts/intel/mpt_sas/Makefile index 53e66fc2f2..38b7b55634 100644 --- a/usr/src/uts/intel/mpt_sas/Makefile +++ b/usr/src/uts/intel/mpt_sas/Makefile @@ -54,7 +54,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # include $(UTSBASE)/intel/Makefile.intel -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/mptsas_raid.o := SMOFF += index_overflow diff --git a/usr/src/uts/intel/mr_sas/Makefile b/usr/src/uts/intel/mr_sas/Makefile index d2771c91c9..338da74946 100644 --- a/usr/src/uts/intel/mr_sas/Makefile +++ b/usr/src/uts/intel/mr_sas/Makefile @@ -58,7 +58,7 @@ LDFLAGS += -dy -Nmisc/scsi CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMATCH=off diff --git a/usr/src/uts/intel/msgsys/Makefile b/usr/src/uts/intel/msgsys/Makefile index bdf25b708b..160cfaa10f 100644 --- a/usr/src/uts/intel/msgsys/Makefile +++ b/usr/src/uts/intel/msgsys/Makefile @@ -67,7 +67,7 @@ LDFLAGS += -dy -Nmisc/ipc LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/mwl/Makefile b/usr/src/uts/intel/mwl/Makefile index 3606a28511..65ac0b1348 100644 --- a/usr/src/uts/intel/mwl/Makefile +++ b/usr/src/uts/intel/mwl/Makefile @@ -65,7 +65,7 @@ LDFLAGS += -dy -Nmisc/mac -Nmisc/net80211 # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-value # needs work diff --git a/usr/src/uts/intel/net80211/Makefile b/usr/src/uts/intel/net80211/Makefile index 525570481e..7bb82ef58c 100644 --- a/usr/src/uts/intel/net80211/Makefile +++ b/usr/src/uts/intel/net80211/Makefile @@ -67,7 +67,7 @@ LDFLAGS += -dy -Nmisc/mac -Nmac/mac_wifi -Ndrv/ip LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # needs work diff --git a/usr/src/uts/intel/nfs/Makefile b/usr/src/uts/intel/nfs/Makefile index c7eb9b02a1..b5ec5bcddd 100644 --- a/usr/src/uts/intel/nfs/Makefile +++ b/usr/src/uts/intel/nfs/Makefile @@ -80,7 +80,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-type-limits -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/intel/nfssrv/Makefile b/usr/src/uts/intel/nfssrv/Makefile index 5b2d459a8f..d8c93d684b 100644 --- a/usr/src/uts/intel/nfssrv/Makefile +++ b/usr/src/uts/intel/nfssrv/Makefile @@ -80,7 +80,7 @@ CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch # needs work diff --git a/usr/src/uts/intel/nge/Makefile b/usr/src/uts/intel/nge/Makefile index fbca64a4cb..35c262905a 100644 --- a/usr/src/uts/intel/nge/Makefile +++ b/usr/src/uts/intel/nge/Makefile @@ -70,7 +70,7 @@ LDFLAGS += -dy -N misc/mac LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += all_func_returns diff --git a/usr/src/uts/intel/nv_sata/Makefile b/usr/src/uts/intel/nv_sata/Makefile index df6a1b50fd..fa7ff76189 100644 --- a/usr/src/uts/intel/nv_sata/Makefile +++ b/usr/src/uts/intel/nv_sata/Makefile @@ -75,7 +75,7 @@ LDFLAGS += -dy -N misc/sata # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/nv_sata.o := SMOFF += deref_check diff --git a/usr/src/uts/intel/nxge/Makefile b/usr/src/uts/intel/nxge/Makefile index 61e3982ef5..f344535e90 100644 --- a/usr/src/uts/intel/nxge/Makefile +++ b/usr/src/uts/intel/nxge/Makefile @@ -87,7 +87,7 @@ LINTTAGS += -erroff=E_FALSE_LOGICAL_EXPR CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits # needs work diff --git a/usr/src/uts/intel/objfs/Makefile b/usr/src/uts/intel/objfs/Makefile index fad14923da..552be404bc 100644 --- a/usr/src/uts/intel/objfs/Makefile +++ b/usr/src/uts/intel/objfs/Makefile @@ -71,7 +71,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/objfs_vfs.o := SMOFF += signed_integer_overflow_check diff --git a/usr/src/uts/intel/oce/Makefile b/usr/src/uts/intel/oce/Makefile index 5725f7676a..e3df59db66 100644 --- a/usr/src/uts/intel/oce/Makefile +++ b/usr/src/uts/intel/oce/Makefile @@ -58,7 +58,7 @@ LDFLAGS += -dy -Nmisc/mac CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # diff --git a/usr/src/uts/intel/ohci/Makefile b/usr/src/uts/intel/ohci/Makefile index 39068183bc..30503428a2 100644 --- a/usr/src/uts/intel/ohci/Makefile +++ b/usr/src/uts/intel/ohci/Makefile @@ -64,7 +64,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/openeepr/Makefile b/usr/src/uts/intel/openeepr/Makefile index 1f7608e4ec..eeb42523f6 100644 --- a/usr/src/uts/intel/openeepr/Makefile +++ b/usr/src/uts/intel/openeepr/Makefile @@ -67,7 +67,7 @@ LDFLAGS += -dy -Ndacf/consconfig_dacf LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/openprom.o := SMOFF += cast_assign,strcpy_overflow diff --git a/usr/src/uts/intel/p4_pcbe/Makefile b/usr/src/uts/intel/p4_pcbe/Makefile index 42dc040eee..1f341b47d8 100644 --- a/usr/src/uts/intel/p4_pcbe/Makefile +++ b/usr/src/uts/intel/p4_pcbe/Makefile @@ -60,7 +60,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-type-limits -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/pcfs/Makefile b/usr/src/uts/intel/pcfs/Makefile index a9e4f7b085..6a8ac0136f 100644 --- a/usr/src/uts/intel/pcfs/Makefile +++ b/usr/src/uts/intel/pcfs/Makefile @@ -66,7 +66,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-function # needs work diff --git a/usr/src/uts/intel/pcic/Makefile b/usr/src/uts/intel/pcic/Makefile index 5312ac7c21..7b7da2a471 100644 --- a/usr/src/uts/intel/pcic/Makefile +++ b/usr/src/uts/intel/pcic/Makefile @@ -77,7 +77,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += no_if_block,indenting,all_func_returns diff --git a/usr/src/uts/intel/pcicfg/Makefile b/usr/src/uts/intel/pcicfg/Makefile index 68e00c9d1f..dbec8ad429 100644 --- a/usr/src/uts/intel/pcicfg/Makefile +++ b/usr/src/uts/intel/pcicfg/Makefile @@ -73,7 +73,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/pcicfg.o := SMOFF += deref_check diff --git a/usr/src/uts/intel/pcmcia/Makefile b/usr/src/uts/intel/pcmcia/Makefile index d48374ff64..ef5bd91de6 100644 --- a/usr/src/uts/intel/pcmcia/Makefile +++ b/usr/src/uts/intel/pcmcia/Makefile @@ -81,7 +81,7 @@ LDFLAGS += -dy -Nmisc/busra -Nmisc/pci_autoconfig LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # needs work diff --git a/usr/src/uts/intel/pm/Makefile b/usr/src/uts/intel/pm/Makefile index 66acca85d2..b7dd6fa040 100644 --- a/usr/src/uts/intel/pm/Makefile +++ b/usr/src/uts/intel/pm/Makefile @@ -66,7 +66,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/pmcs/Makefile b/usr/src/uts/intel/pmcs/Makefile index 62243ffa9f..6c779a76d1 100644 --- a/usr/src/uts/intel/pmcs/Makefile +++ b/usr/src/uts/intel/pmcs/Makefile @@ -63,7 +63,7 @@ CPPFLAGS += $(PMCS_DRV_FLGS) \ -DPMCS_FIRMWARE_VERSION_STRING=\"${PMCS_FW_VERSION_STRING}\" CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-parentheses diff --git a/usr/src/uts/intel/poll/Makefile b/usr/src/uts/intel/poll/Makefile index b4be5deb63..e89e52d63b 100644 --- a/usr/src/uts/intel/poll/Makefile +++ b/usr/src/uts/intel/poll/Makefile @@ -49,7 +49,7 @@ CONF_SRCDIR = $(UTSBASE)/common/io # include $(UTSBASE)/intel/Makefile.intel -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # It's unfortunate that we have to disable this; however, it's lint's fault. We diff --git a/usr/src/uts/intel/portfs/Makefile b/usr/src/uts/intel/portfs/Makefile index 2d784dcb70..162a152398 100644 --- a/usr/src/uts/intel/portfs/Makefile +++ b/usr/src/uts/intel/portfs/Makefile @@ -74,7 +74,7 @@ CLEANFILES += $(MODSTUBS_O) # LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # needs work diff --git a/usr/src/uts/intel/pppt/Makefile b/usr/src/uts/intel/pppt/Makefile index f492a4d1b0..d4d4dcbdbf 100644 --- a/usr/src/uts/intel/pppt/Makefile +++ b/usr/src/uts/intel/pppt/Makefile @@ -63,7 +63,7 @@ LDFLAGS += -dy -Ndrv/stmf C99LMODE= -Xc99=%all CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/procfs/Makefile b/usr/src/uts/intel/procfs/Makefile index 1e5fc27935..ce2c05dcbe 100644 --- a/usr/src/uts/intel/procfs/Makefile +++ b/usr/src/uts/intel/procfs/Makefile @@ -76,7 +76,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/prsubr.o := SMOFF += all_func_returns diff --git a/usr/src/uts/intel/ptem/Makefile b/usr/src/uts/intel/ptem/Makefile index 55cec27bcd..639f8d7797 100644 --- a/usr/src/uts/intel/ptem/Makefile +++ b/usr/src/uts/intel/ptem/Makefile @@ -66,7 +66,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/qlc/Makefile b/usr/src/uts/intel/qlc/Makefile index 22661960b6..c165f33852 100644 --- a/usr/src/uts/intel/qlc/Makefile +++ b/usr/src/uts/intel/qlc/Makefile @@ -78,7 +78,7 @@ FWIMAGES += 8100 FWMODULES = $(FWIMAGES:%=$(MODULE)_fw_%) FWMODULES_SRC = $(FWIMAGES:%=$(CONF_SRCDIR)/ql_fw_%.c) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-parentheses diff --git a/usr/src/uts/intel/qlge/Makefile b/usr/src/uts/intel/qlge/Makefile index 425923a037..ad10aadb72 100644 --- a/usr/src/uts/intel/qlge/Makefile +++ b/usr/src/uts/intel/qlge/Makefile @@ -65,7 +65,7 @@ LDFLAGS += -dy -Nmisc/mac -Ndrv/ip C99LMODE= -Xc99=%all CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/qlge.o := SMOFF += deref_check diff --git a/usr/src/uts/intel/qlt/Makefile b/usr/src/uts/intel/qlt/Makefile index 6285b973eb..9098c57c59 100644 --- a/usr/src/uts/intel/qlt/Makefile +++ b/usr/src/uts/intel/qlt/Makefile @@ -70,7 +70,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_STATIC_UNUSED LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/rds/Makefile b/usr/src/uts/intel/rds/Makefile index c70ffa30ad..71446fe7a0 100644 --- a/usr/src/uts/intel/rds/Makefile +++ b/usr/src/uts/intel/rds/Makefile @@ -42,7 +42,7 @@ CONF_SRCDIR = $(UTSBASE)/common/io/ib/clients/rds # include $(UTSBASE)/intel/Makefile.intel -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Define targets diff --git a/usr/src/uts/intel/rdsib/Makefile b/usr/src/uts/intel/rdsib/Makefile index 72d81caa89..6213028921 100644 --- a/usr/src/uts/intel/rdsib/Makefile +++ b/usr/src/uts/intel/rdsib/Makefile @@ -43,7 +43,7 @@ CONF_SRCDIR = $(UTSBASE)/common/io/ib/clients/rds include $(UTSBASE)/intel/Makefile.intel CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Define targets diff --git a/usr/src/uts/intel/rdsv3/Makefile b/usr/src/uts/intel/rdsv3/Makefile index 7ef904de97..c389402f37 100644 --- a/usr/src/uts/intel/rdsv3/Makefile +++ b/usr/src/uts/intel/rdsv3/Makefile @@ -63,7 +63,7 @@ LINTTAGS += -erroff=E_FUNC_SET_NOT_USED CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # needs work diff --git a/usr/src/uts/intel/rge/Makefile b/usr/src/uts/intel/rge/Makefile index 51ade3de5b..fb9a8da37e 100644 --- a/usr/src/uts/intel/rge/Makefile +++ b/usr/src/uts/intel/rge/Makefile @@ -66,7 +66,7 @@ LDFLAGS += -dy -N misc/mac -N drv/ip LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # looks like a real bug in rge_phy_update() ! $(OBJS_DIR)/rge_chip.o := SMOFF += indenting diff --git a/usr/src/uts/intel/rlmod/Makefile b/usr/src/uts/intel/rlmod/Makefile index c517b8ea5d..a1b90ed1de 100644 --- a/usr/src/uts/intel/rlmod/Makefile +++ b/usr/src/uts/intel/rlmod/Makefile @@ -66,7 +66,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/rpcib/Makefile b/usr/src/uts/intel/rpcib/Makefile index ce04217815..016dce38e9 100644 --- a/usr/src/uts/intel/rpcib/Makefile +++ b/usr/src/uts/intel/rpcib/Makefile @@ -76,7 +76,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMATCH=off diff --git a/usr/src/uts/intel/rpcmod/Makefile b/usr/src/uts/intel/rpcmod/Makefile index db4e739b07..6833fdd7c1 100644 --- a/usr/src/uts/intel/rpcmod/Makefile +++ b/usr/src/uts/intel/rpcmod/Makefile @@ -84,7 +84,7 @@ LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-label diff --git a/usr/src/uts/intel/rpcsec/Makefile b/usr/src/uts/intel/rpcsec/Makefile index 843d7dc880..ff8178bfb9 100644 --- a/usr/src/uts/intel/rpcsec/Makefile +++ b/usr/src/uts/intel/rpcsec/Makefile @@ -67,7 +67,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/auth_des.o := SMOFF += deref_check diff --git a/usr/src/uts/intel/rsa/Makefile b/usr/src/uts/intel/rsa/Makefile index cf9ba78959..4e61a69ad2 100644 --- a/usr/src/uts/intel/rsa/Makefile +++ b/usr/src/uts/intel/rsa/Makefile @@ -73,7 +73,7 @@ LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/rsm/Makefile b/usr/src/uts/intel/rsm/Makefile index c828628870..172022c0ad 100644 --- a/usr/src/uts/intel/rsm/Makefile +++ b/usr/src/uts/intel/rsm/Makefile @@ -79,7 +79,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # needs work diff --git a/usr/src/uts/intel/rtls/Makefile b/usr/src/uts/intel/rtls/Makefile index c688f5e940..aea726b2af 100644 --- a/usr/src/uts/intel/rtls/Makefile +++ b/usr/src/uts/intel/rtls/Makefile @@ -56,7 +56,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # Overrides # -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Driver depends on Mac diff --git a/usr/src/uts/intel/s1394/Makefile b/usr/src/uts/intel/s1394/Makefile index f7f8fd3299..2968cc45d4 100644 --- a/usr/src/uts/intel/s1394/Makefile +++ b/usr/src/uts/intel/s1394/Makefile @@ -80,7 +80,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-parentheses diff --git a/usr/src/uts/intel/sad/Makefile b/usr/src/uts/intel/sad/Makefile index 5220e4999c..d9c67f0357 100644 --- a/usr/src/uts/intel/sad/Makefile +++ b/usr/src/uts/intel/sad/Makefile @@ -71,7 +71,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/sata/Makefile b/usr/src/uts/intel/sata/Makefile index 03a67ad97c..436c53f4a3 100644 --- a/usr/src/uts/intel/sata/Makefile +++ b/usr/src/uts/intel/sata/Makefile @@ -90,7 +90,7 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-empty-body # needs work diff --git a/usr/src/uts/intel/scsa1394/Makefile b/usr/src/uts/intel/scsa1394/Makefile index 2545171295..9e8573e82d 100644 --- a/usr/src/uts/intel/scsa1394/Makefile +++ b/usr/src/uts/intel/scsa1394/Makefile @@ -65,7 +65,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/sbp2_driver.o := SMOFF += indenting diff --git a/usr/src/uts/intel/scsa2usb/Makefile b/usr/src/uts/intel/scsa2usb/Makefile index 342cc1f0fa..3542ef25de 100644 --- a/usr/src/uts/intel/scsa2usb/Makefile +++ b/usr/src/uts/intel/scsa2usb/Makefile @@ -72,7 +72,7 @@ LDFLAGS += -dy -Nmisc/usba -Nmisc/scsi LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/scsa2usb.o := SMOFF += deref_check diff --git a/usr/src/uts/intel/scsi/Makefile b/usr/src/uts/intel/scsi/Makefile index 60577c36d7..f29902c748 100644 --- a/usr/src/uts/intel/scsi/Makefile +++ b/usr/src/uts/intel/scsi/Makefile @@ -74,7 +74,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMATCH=off diff --git a/usr/src/uts/intel/scsi_vhci/Makefile b/usr/src/uts/intel/scsi_vhci/Makefile index 80191c40e0..f42501361b 100644 --- a/usr/src/uts/intel/scsi_vhci/Makefile +++ b/usr/src/uts/intel/scsi_vhci/Makefile @@ -50,7 +50,7 @@ CONF_SRCDIR = $(UTSBASE)/common/io/scsi/adapters/scsi_vhci include $(UTSBASE)/intel/Makefile.intel CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-label # needs work diff --git a/usr/src/uts/intel/semsys/Makefile b/usr/src/uts/intel/semsys/Makefile index 4691fd01dd..02c21c77b7 100644 --- a/usr/src/uts/intel/semsys/Makefile +++ b/usr/src/uts/intel/semsys/Makefile @@ -70,7 +70,7 @@ LDFLAGS += -dy -Nmisc/ipc LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/sfe/Makefile b/usr/src/uts/intel/sfe/Makefile index e0b2b5e461..2df44c6a42 100644 --- a/usr/src/uts/intel/sfe/Makefile +++ b/usr/src/uts/intel/sfe/Makefile @@ -78,7 +78,7 @@ CFLAGS += $(CPPFLAGS) CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += all_func_returns diff --git a/usr/src/uts/intel/sgen/Makefile b/usr/src/uts/intel/sgen/Makefile index 39e2c07e44..2fd9d9cd80 100644 --- a/usr/src/uts/intel/sgen/Makefile +++ b/usr/src/uts/intel/sgen/Makefile @@ -69,7 +69,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/sha2/Makefile b/usr/src/uts/intel/sha2/Makefile index 320d5700eb..bad616925f 100644 --- a/usr/src/uts/intel/sha2/Makefile +++ b/usr/src/uts/intel/sha2/Makefile @@ -68,7 +68,7 @@ CFLAGS += -I$(COMDIR) LINTFLAGS += -I$(COMDIR) CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/si3124/Makefile b/usr/src/uts/intel/si3124/Makefile index b778602e28..78fe0d92bc 100644 --- a/usr/src/uts/intel/si3124/Makefile +++ b/usr/src/uts/intel/si3124/Makefile @@ -64,7 +64,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) DEBUG_FLGS = DEBUG_DEFS += $(DEBUG_FLGS) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # lint pass one enforcement diff --git a/usr/src/uts/intel/smbfs/Makefile b/usr/src/uts/intel/smbfs/Makefile index 5a23cf0c54..8fc37428c3 100644 --- a/usr/src/uts/intel/smbfs/Makefile +++ b/usr/src/uts/intel/smbfs/Makefile @@ -64,7 +64,7 @@ LDFLAGS += -dy -Ndrv/nsmb # Until CR 4994570 is fixed... LINTTAGS += -erroff=E_BAD_FORMAT_ARG_TYPE2 CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += all_func_returns,signed,deref_check diff --git a/usr/src/uts/intel/sockfs/Makefile b/usr/src/uts/intel/sockfs/Makefile index a62b4eaf0a..7ca35b6e67 100644 --- a/usr/src/uts/intel/sockfs/Makefile +++ b/usr/src/uts/intel/sockfs/Makefile @@ -92,7 +92,7 @@ CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMATCH=off diff --git a/usr/src/uts/intel/sockpfp/Makefile b/usr/src/uts/intel/sockpfp/Makefile index 7b54398af3..614aae4d60 100644 --- a/usr/src/uts/intel/sockpfp/Makefile +++ b/usr/src/uts/intel/sockpfp/Makefile @@ -64,7 +64,7 @@ INC_PATH += -I$(UTSBASE)/common/inet/sockmods -I$(UTSBASE)/common/io/bpf # LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-label # needs work diff --git a/usr/src/uts/intel/socksctp/Makefile b/usr/src/uts/intel/socksctp/Makefile index 31efabc0d0..00e6ee4b75 100644 --- a/usr/src/uts/intel/socksctp/Makefile +++ b/usr/src/uts/intel/socksctp/Makefile @@ -69,7 +69,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/socksdp/Makefile b/usr/src/uts/intel/socksdp/Makefile index 17cda95dce..32248ae0a6 100644 --- a/usr/src/uts/intel/socksdp/Makefile +++ b/usr/src/uts/intel/socksdp/Makefile @@ -59,7 +59,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) LDFLAGS += -dy -Nfs/sockfs -Ndrv/ip -Ndrv/sdpib diff --git a/usr/src/uts/intel/softmac/Makefile b/usr/src/uts/intel/softmac/Makefile index 347b1bdc7a..5fe4962f88 100644 --- a/usr/src/uts/intel/softmac/Makefile +++ b/usr/src/uts/intel/softmac/Makefile @@ -62,7 +62,7 @@ LDFLAGS += -dy -Ndrv/dld -Nmisc/mac -Nmisc/strplumb -Nmisc/dls # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-label # diff --git a/usr/src/uts/intel/sol_ofs/Makefile b/usr/src/uts/intel/sol_ofs/Makefile index 133af5c292..ab17e465ad 100644 --- a/usr/src/uts/intel/sol_ofs/Makefile +++ b/usr/src/uts/intel/sol_ofs/Makefile @@ -60,7 +60,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_STATIC_UNUSED LINTTAGS += -erroff=E_CONST_TRUNCATED_BY_ASSIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/intel/sol_umad/Makefile b/usr/src/uts/intel/sol_umad/Makefile index 2d76f118a1..0d99bc8fb1 100644 --- a/usr/src/uts/intel/sol_umad/Makefile +++ b/usr/src/uts/intel/sol_umad/Makefile @@ -42,7 +42,7 @@ LDFLAGS += -dy -Nmisc/sol_ofs -Nmisc/ibmf -Nmisc/ibtl # include $(UTSBASE)/intel/Makefile.intel -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Define targets diff --git a/usr/src/uts/intel/spdsock/Makefile b/usr/src/uts/intel/spdsock/Makefile index cae0da72f8..e161960b33 100644 --- a/usr/src/uts/intel/spdsock/Makefile +++ b/usr/src/uts/intel/spdsock/Makefile @@ -65,7 +65,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/spdsockddi.o := SMOFF += index_overflow diff --git a/usr/src/uts/intel/specfs/Makefile b/usr/src/uts/intel/specfs/Makefile index ea18e2e9b7..77e6bf92d8 100644 --- a/usr/src/uts/intel/specfs/Makefile +++ b/usr/src/uts/intel/specfs/Makefile @@ -74,7 +74,7 @@ LDFLAGS += -dy -Nfs/fifofs LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/specvnops.o := SMOFF += signed diff --git a/usr/src/uts/intel/sppp/Makefile b/usr/src/uts/intel/sppp/Makefile index eafe63dc5d..7f57d575e5 100644 --- a/usr/src/uts/intel/sppp/Makefile +++ b/usr/src/uts/intel/sppp/Makefile @@ -77,7 +77,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/spppcomp/Makefile b/usr/src/uts/intel/spppcomp/Makefile index 30f6bb387f..f02988bdbf 100644 --- a/usr/src/uts/intel/spppcomp/Makefile +++ b/usr/src/uts/intel/spppcomp/Makefile @@ -62,7 +62,7 @@ CPPFLAGS += -DINTERNAL_BUILD -DSOL2 -DMUX_FRAME INC_PATH += -I$(UTSBASE)/common/io/ppp/common CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += indenting,index_overflow diff --git a/usr/src/uts/intel/sppptun/Makefile b/usr/src/uts/intel/sppptun/Makefile index 6bb25046bc..827c7e896f 100644 --- a/usr/src/uts/intel/sppptun/Makefile +++ b/usr/src/uts/intel/sppptun/Makefile @@ -78,7 +78,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/srn/Makefile b/usr/src/uts/intel/srn/Makefile index 37e7df0aec..7eca930ebf 100644 --- a/usr/src/uts/intel/srn/Makefile +++ b/usr/src/uts/intel/srn/Makefile @@ -50,7 +50,7 @@ CONF_SRCDIR = $(UTSBASE)/common/io # include $(UTSBASE)/intel/Makefile.intel -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Define targets diff --git a/usr/src/uts/intel/st/Makefile b/usr/src/uts/intel/st/Makefile index 7dbef2c9db..b4da8fff9f 100644 --- a/usr/src/uts/intel/st/Makefile +++ b/usr/src/uts/intel/st/Makefile @@ -69,7 +69,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMATCH=off diff --git a/usr/src/uts/intel/stmf/Makefile b/usr/src/uts/intel/stmf/Makefile index 32eb938f7b..351d4b5781 100644 --- a/usr/src/uts/intel/stmf/Makefile +++ b/usr/src/uts/intel/stmf/Makefile @@ -69,7 +69,7 @@ C99LMODE= -Xc99=%all LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_STATIC_UNUSED -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/intel/stmf_sbd/Makefile b/usr/src/uts/intel/stmf_sbd/Makefile index 4259f16b69..bbee85d605 100644 --- a/usr/src/uts/intel/stmf_sbd/Makefile +++ b/usr/src/uts/intel/stmf_sbd/Makefile @@ -73,7 +73,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/tavor/Makefile b/usr/src/uts/intel/tavor/Makefile index 397e2c3f5f..57d416e606 100644 --- a/usr/src/uts/intel/tavor/Makefile +++ b/usr/src/uts/intel/tavor/Makefile @@ -78,7 +78,7 @@ LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits # needs work diff --git a/usr/src/uts/intel/tem/Makefile b/usr/src/uts/intel/tem/Makefile index bfeecb298b..9eca2e7d98 100644 --- a/usr/src/uts/intel/tem/Makefile +++ b/usr/src/uts/intel/tem/Makefile @@ -63,7 +63,7 @@ LDFLAGS += -dy -Ndacf/consconfig_dacf LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/tl/Makefile b/usr/src/uts/intel/tl/Makefile index c820c5b179..f49cc7746c 100644 --- a/usr/src/uts/intel/tl/Makefile +++ b/usr/src/uts/intel/tl/Makefile @@ -76,7 +76,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += deref_check diff --git a/usr/src/uts/intel/tmpfs/Makefile b/usr/src/uts/intel/tmpfs/Makefile index bfc9769c6d..97a59fdb1a 100644 --- a/usr/src/uts/intel/tmpfs/Makefile +++ b/usr/src/uts/intel/tmpfs/Makefile @@ -67,7 +67,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-value # needs work diff --git a/usr/src/uts/intel/tnf/Makefile b/usr/src/uts/intel/tnf/Makefile index de264140d0..583f831a7f 100644 --- a/usr/src/uts/intel/tnf/Makefile +++ b/usr/src/uts/intel/tnf/Makefile @@ -68,7 +68,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/tnf_writer.o := SMOFF += all_func_returns diff --git a/usr/src/uts/intel/trill/Makefile b/usr/src/uts/intel/trill/Makefile index bc9f9ed05f..f3aa9d2178 100644 --- a/usr/src/uts/intel/trill/Makefile +++ b/usr/src/uts/intel/trill/Makefile @@ -44,7 +44,7 @@ ROOTMODULE = $(ROOT_SOCK_DIR)/$(MODULE) # include $(UTSBASE)/intel/Makefile.intel -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += all_func_returns diff --git a/usr/src/uts/intel/udfs/Makefile b/usr/src/uts/intel/udfs/Makefile index 244123e4f3..91b5c1cc87 100644 --- a/usr/src/uts/intel/udfs/Makefile +++ b/usr/src/uts/intel/udfs/Makefile @@ -76,7 +76,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits # needs work diff --git a/usr/src/uts/intel/ufs/Makefile b/usr/src/uts/intel/ufs/Makefile index 0264031fcd..8faca5b49d 100644 --- a/usr/src/uts/intel/ufs/Makefile +++ b/usr/src/uts/intel/ufs/Makefile @@ -79,7 +79,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-unused-label diff --git a/usr/src/uts/intel/ugen/Makefile b/usr/src/uts/intel/ugen/Makefile index 9c910827f1..9f128da034 100644 --- a/usr/src/uts/intel/ugen/Makefile +++ b/usr/src/uts/intel/ugen/Makefile @@ -47,7 +47,7 @@ ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE) # include $(UTSBASE)/intel/Makefile.intel -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Define targets diff --git a/usr/src/uts/intel/uhci/Makefile b/usr/src/uts/intel/uhci/Makefile index c8b5992927..687ef09254 100644 --- a/usr/src/uts/intel/uhci/Makefile +++ b/usr/src/uts/intel/uhci/Makefile @@ -71,7 +71,7 @@ LDFLAGS += -dy -Nmisc/usba # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/urf/Makefile b/usr/src/uts/intel/urf/Makefile index 93b6b1aafb..a9f2f815e8 100644 --- a/usr/src/uts/intel/urf/Makefile +++ b/usr/src/uts/intel/urf/Makefile @@ -34,7 +34,7 @@ include $(UTSBASE)/intel/Makefile.intel CPPFLAGS += -I$(UTSBASE)/common/io/usbgem CPPFLAGS += -DVERSION=\"2.0.0\" CPPFLAGS += -DUSBGEM_CONFIG_GLDv3 -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) LDFLAGS += -dy -N misc/mac -N drv/ip -N misc/usba -N misc/usbgem CERRWARN += -_gcc=-Wno-unused-function diff --git a/usr/src/uts/intel/urtw/Makefile b/usr/src/uts/intel/urtw/Makefile index 76d86130c7..12c20b148c 100644 --- a/usr/src/uts/intel/urtw/Makefile +++ b/usr/src/uts/intel/urtw/Makefile @@ -63,7 +63,7 @@ LDFLAGS += -dy -Nmisc/mac -Nmisc/net80211 -Nmisc/usba CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-char-subscripts -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += deref_check,no_if_block,all_func_returns diff --git a/usr/src/uts/intel/usb_ac/Makefile b/usr/src/uts/intel/usb_ac/Makefile index 43e880c9ee..a4cf979a15 100644 --- a/usr/src/uts/intel/usb_ac/Makefile +++ b/usr/src/uts/intel/usb_ac/Makefile @@ -62,7 +62,7 @@ CLEANFILES += $(MODSTUBS_O) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work $(OBJS_DIR)/usb_ac.o := SMOFF += deref_check,indenting,testing_index_after_use diff --git a/usr/src/uts/intel/usb_ah/Makefile b/usr/src/uts/intel/usb_ah/Makefile index a9984f9399..aac32060a4 100644 --- a/usr/src/uts/intel/usb_ah/Makefile +++ b/usr/src/uts/intel/usb_ah/Makefile @@ -72,7 +72,7 @@ LDFLAGS += -dy -Nmisc/usba -Nmisc/hidparser -Ndrv/usb_ac # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/usbftdi/Makefile b/usr/src/uts/intel/usbftdi/Makefile index 4f9da61490..8eb47fb6a8 100644 --- a/usr/src/uts/intel/usbftdi/Makefile +++ b/usr/src/uts/intel/usbftdi/Makefile @@ -46,7 +46,7 @@ CONF_SRCDIR = $(UTSBASE)/common/io/usb/clients/usbser/usbftdi # include $(UTSBASE)/intel/Makefile.intel -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) LDFLAGS += -dy -Nmisc/usba -Nmisc/usbser diff --git a/usr/src/uts/intel/usbgem/Makefile b/usr/src/uts/intel/usbgem/Makefile index 3d9bfe6e6e..6afc012974 100644 --- a/usr/src/uts/intel/usbgem/Makefile +++ b/usr/src/uts/intel/usbgem/Makefile @@ -42,7 +42,7 @@ CPPFLAGS += \ -DUSBGEM_CONFIG_MAC_PROP \ -DVERSION=\"1.6\" -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/intel/usbms/Makefile b/usr/src/uts/intel/usbms/Makefile index 0a184975d0..e6819d37a6 100644 --- a/usr/src/uts/intel/usbms/Makefile +++ b/usr/src/uts/intel/usbms/Makefile @@ -69,7 +69,7 @@ LDFLAGS += -dy -Nmisc/usba -Nmisc/hidparser LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += deref_check diff --git a/usr/src/uts/intel/usbsacm/Makefile b/usr/src/uts/intel/usbsacm/Makefile index 09cc016b1f..3d17fc199e 100644 --- a/usr/src/uts/intel/usbsacm/Makefile +++ b/usr/src/uts/intel/usbsacm/Makefile @@ -45,7 +45,7 @@ include $(UTSBASE)/intel/Makefile.intel LDFLAGS += -dy -Nmisc/usba -Nmisc/usbser -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += deref_check diff --git a/usr/src/uts/intel/usbsksp/Makefile b/usr/src/uts/intel/usbsksp/Makefile index 695d340f46..b34c75efe5 100644 --- a/usr/src/uts/intel/usbsksp/Makefile +++ b/usr/src/uts/intel/usbsksp/Makefile @@ -80,4 +80,4 @@ install: $(INSTALL_DEPS) # include $(UTSBASE)/intel/Makefile.targ -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) diff --git a/usr/src/uts/intel/usbsprl/Makefile b/usr/src/uts/intel/usbsprl/Makefile index a2fe99fea9..7e0e3d9539 100644 --- a/usr/src/uts/intel/usbsprl/Makefile +++ b/usr/src/uts/intel/usbsprl/Makefile @@ -45,7 +45,7 @@ ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE) # include $(UTSBASE)/intel/Makefile.intel -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) LDFLAGS += -dy -Nmisc/usba -Nmisc/usbser diff --git a/usr/src/uts/intel/usbvc/Makefile b/usr/src/uts/intel/usbvc/Makefile index 364d5f3139..5a641fc43a 100644 --- a/usr/src/uts/intel/usbvc/Makefile +++ b/usr/src/uts/intel/usbvc/Makefile @@ -73,7 +73,7 @@ LDFLAGS += -dy -Nmisc/usba # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += deref_check diff --git a/usr/src/uts/intel/usbwcm/Makefile b/usr/src/uts/intel/usbwcm/Makefile index 5202f40f6f..bf0e3c9f00 100644 --- a/usr/src/uts/intel/usbwcm/Makefile +++ b/usr/src/uts/intel/usbwcm/Makefile @@ -71,7 +71,7 @@ LDFLAGS += -dy -Nmisc/usba LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/vnic/Makefile b/usr/src/uts/intel/vnic/Makefile index 357600fa72..199e85fa5d 100644 --- a/usr/src/uts/intel/vnic/Makefile +++ b/usr/src/uts/intel/vnic/Makefile @@ -57,7 +57,7 @@ CFLAGS += $(CCVERBOSE) LDFLAGS += -dy -Ndrv/dld -Nmisc/mac -Nmisc/dls CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += deref_check diff --git a/usr/src/uts/intel/vr/Makefile b/usr/src/uts/intel/vr/Makefile index 05f33305b7..2a74aa40b4 100644 --- a/usr/src/uts/intel/vr/Makefile +++ b/usr/src/uts/intel/vr/Makefile @@ -58,7 +58,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += array_condition diff --git a/usr/src/uts/intel/vuid2ps2/Makefile b/usr/src/uts/intel/vuid2ps2/Makefile index 47f7c4fcd7..031574dc37 100644 --- a/usr/src/uts/intel/vuid2ps2/Makefile +++ b/usr/src/uts/intel/vuid2ps2/Makefile @@ -51,7 +51,7 @@ ROOTMODULE = $(ROOT_STRMOD_DIR)/$(MODULE) # include $(UTSBASE)/intel/Makefile.intel -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # needs work diff --git a/usr/src/uts/intel/vuid3ps2/Makefile b/usr/src/uts/intel/vuid3ps2/Makefile index 28664ccd9e..941929e64e 100644 --- a/usr/src/uts/intel/vuid3ps2/Makefile +++ b/usr/src/uts/intel/vuid3ps2/Makefile @@ -51,7 +51,7 @@ ROOTMODULE = $(ROOT_STRMOD_DIR)/$(MODULE) # include $(UTSBASE)/intel/Makefile.intel -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # needs work diff --git a/usr/src/uts/intel/vuidm3p/Makefile b/usr/src/uts/intel/vuidm3p/Makefile index 8084cbc35a..bf2b8420bc 100644 --- a/usr/src/uts/intel/vuidm3p/Makefile +++ b/usr/src/uts/intel/vuidm3p/Makefile @@ -63,7 +63,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # ALL_DEFS += -DVUIDM3P -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += deref_check diff --git a/usr/src/uts/intel/vuidm4p/Makefile b/usr/src/uts/intel/vuidm4p/Makefile index 23f2265cdd..d0427eea4c 100644 --- a/usr/src/uts/intel/vuidm4p/Makefile +++ b/usr/src/uts/intel/vuidm4p/Makefile @@ -63,7 +63,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # ALL_DEFS += -DVUIDM4P -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += deref_check diff --git a/usr/src/uts/intel/vuidm5p/Makefile b/usr/src/uts/intel/vuidm5p/Makefile index 4ddc855e60..ff26e2ad7e 100644 --- a/usr/src/uts/intel/vuidm5p/Makefile +++ b/usr/src/uts/intel/vuidm5p/Makefile @@ -60,7 +60,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) ALL_DEFS += -DVUIDM5P -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += deref_check diff --git a/usr/src/uts/intel/wc/Makefile b/usr/src/uts/intel/wc/Makefile index b855fa56bc..b8a4d2e366 100644 --- a/usr/src/uts/intel/wc/Makefile +++ b/usr/src/uts/intel/wc/Makefile @@ -56,7 +56,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # LDFLAGS += -dy -Nmisc/tem -Ndacf/consconfig_dacf -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += deref_check diff --git a/usr/src/uts/intel/xge/Makefile b/usr/src/uts/intel/xge/Makefile index c0407c1984..a02d05e84d 100644 --- a/usr/src/uts/intel/xge/Makefile +++ b/usr/src/uts/intel/xge/Makefile @@ -94,7 +94,7 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-empty-body -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # needs work SMOFF += indenting diff --git a/usr/src/uts/intel/zut/Makefile b/usr/src/uts/intel/zut/Makefile index 23db5c4405..1ec757e8e8 100644 --- a/usr/src/uts/intel/zut/Makefile +++ b/usr/src/uts/intel/zut/Makefile @@ -72,7 +72,7 @@ C99LMODE= -Xc99=%all LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/intel/zyd/Makefile b/usr/src/uts/intel/zyd/Makefile index 144dbad6b2..7d3e76e441 100644 --- a/usr/src/uts/intel/zyd/Makefile +++ b/usr/src/uts/intel/zyd/Makefile @@ -59,7 +59,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # LDFLAGS += -dy -Nmisc/mac -Nmisc/net80211 -Nmisc/usba -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/FSS/Makefile b/usr/src/uts/sparc/FSS/Makefile index 8bf1c25c85..095998c3f9 100644 --- a/usr/src/uts/sparc/FSS/Makefile +++ b/usr/src/uts/sparc/FSS/Makefile @@ -69,7 +69,7 @@ CFLAGS += $(CCVERBOSE) # LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/Makefile.sparc b/usr/src/uts/sparc/Makefile.sparc index 87ef72532a..e592b8a8ff 100644 --- a/usr/src/uts/sparc/Makefile.sparc +++ b/usr/src/uts/sparc/Makefile.sparc @@ -26,6 +26,7 @@ # Copyright 2019 Joyent, Inc. # Copyright 2016 Gary Mills # Copyright 2016 Nexenta Systems, Inc. +# Copyright 2019 Peter Tribble. # Copyright 2019 RackTop Systems # @@ -229,7 +230,7 @@ DRV_KMODS += log logindmux kssl mm nca physmem pm poll pool DRV_KMODS += pseudo ptc ptm pts ptsl ramdisk random rsm rts sad DRV_KMODS += simnet softmac sppp sppptun sy sysevent sysmsg DRV_KMODS += spdsock -DRV_KMODS += tcp tcp6 timerfd tl tnf ttymux udp udp6 wc winlock zcons zfd +DRV_KMODS += tcp tcp6 timerfd tl tnf udp udp6 wc winlock zcons DRV_KMODS += ippctl DRV_KMODS += dld DRV_KMODS += ipd diff --git a/usr/src/uts/sparc/aac/Makefile b/usr/src/uts/sparc/aac/Makefile index 53ee28aeba..a9b097d1f3 100644 --- a/usr/src/uts/sparc/aac/Makefile +++ b/usr/src/uts/sparc/aac/Makefile @@ -70,7 +70,7 @@ LDFLAGS += -dy -Nmisc/scsi # Overrides # -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-unused-label diff --git a/usr/src/uts/sparc/aggr/Makefile b/usr/src/uts/sparc/aggr/Makefile index d9ec754f15..06895b3c11 100644 --- a/usr/src/uts/sparc/aggr/Makefile +++ b/usr/src/uts/sparc/aggr/Makefile @@ -64,7 +64,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/sparc/audio/Makefile b/usr/src/uts/sparc/audio/Makefile index fde8cd522b..a77b4bd8c1 100644 --- a/usr/src/uts/sparc/audio/Makefile +++ b/usr/src/uts/sparc/audio/Makefile @@ -46,7 +46,7 @@ CONF_SRCDIR = $(UTSBASE)/common/io/audio/impl # include $(UTSBASE)/sparc/Makefile.sparc -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Define targets diff --git a/usr/src/uts/sparc/audiocs/Makefile b/usr/src/uts/sparc/audiocs/Makefile index 72b36a15d1..30f41da658 100644 --- a/usr/src/uts/sparc/audiocs/Makefile +++ b/usr/src/uts/sparc/audiocs/Makefile @@ -57,7 +57,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # Overrides # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Depends on misc/audiosup diff --git a/usr/src/uts/sparc/audioens/Makefile b/usr/src/uts/sparc/audioens/Makefile index aa4088266c..ef97517997 100644 --- a/usr/src/uts/sparc/audioens/Makefile +++ b/usr/src/uts/sparc/audioens/Makefile @@ -54,7 +54,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) LDFLAGS += -dy -Ndrv/audio -Nmisc/ac97 -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/audiop16x/Makefile b/usr/src/uts/sparc/audiop16x/Makefile index b11c93d68d..901d7781cf 100644 --- a/usr/src/uts/sparc/audiop16x/Makefile +++ b/usr/src/uts/sparc/audiop16x/Makefile @@ -54,7 +54,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) LDFLAGS += -dy -Ndrv/audio -Nmisc/ac97 -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/audiopci/Makefile b/usr/src/uts/sparc/audiopci/Makefile index d660a24994..53f3ee95a2 100644 --- a/usr/src/uts/sparc/audiopci/Makefile +++ b/usr/src/uts/sparc/audiopci/Makefile @@ -54,7 +54,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) LDFLAGS += -dy -Ndrv/audio -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/autofs/Makefile b/usr/src/uts/sparc/autofs/Makefile index 3c76d18c96..291808a5d2 100644 --- a/usr/src/uts/sparc/autofs/Makefile +++ b/usr/src/uts/sparc/autofs/Makefile @@ -78,7 +78,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/av1394/Makefile b/usr/src/uts/sparc/av1394/Makefile index 8699d8b0ee..b1daba5cae 100644 --- a/usr/src/uts/sparc/av1394/Makefile +++ b/usr/src/uts/sparc/av1394/Makefile @@ -75,7 +75,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits diff --git a/usr/src/uts/sparc/bge/Makefile b/usr/src/uts/sparc/bge/Makefile index 9fb4f205b9..a0b56a51b0 100644 --- a/usr/src/uts/sparc/bge/Makefile +++ b/usr/src/uts/sparc/bge/Makefile @@ -77,7 +77,7 @@ LDFLAGS += -dy -N misc/mac # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/sparc/blowfish/Makefile b/usr/src/uts/sparc/blowfish/Makefile index 88d56bb251..16cf0e6148 100644 --- a/usr/src/uts/sparc/blowfish/Makefile +++ b/usr/src/uts/sparc/blowfish/Makefile @@ -76,7 +76,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # diff --git a/usr/src/uts/sparc/bnxe/Makefile b/usr/src/uts/sparc/bnxe/Makefile index ba59f51fee..bba862b1e7 100644 --- a/usr/src/uts/sparc/bnxe/Makefile +++ b/usr/src/uts/sparc/bnxe/Makefile @@ -87,7 +87,7 @@ CPPFLAGS += -DLM_RXPKT_NON_CONTIGUOUS \ LDFLAGS += -dy -r -Ndrv/ip -Nmisc/mac #CERRWARN += -_gcc=-Wno-old-style-declaration CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-value diff --git a/usr/src/uts/sparc/bofi/Makefile b/usr/src/uts/sparc/bofi/Makefile index e133686cb0..4e5662616a 100644 --- a/usr/src/uts/sparc/bofi/Makefile +++ b/usr/src/uts/sparc/bofi/Makefile @@ -83,7 +83,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/bpf/Makefile b/usr/src/uts/sparc/bpf/Makefile index 8661ccd96e..b1226d51cb 100644 --- a/usr/src/uts/sparc/bpf/Makefile +++ b/usr/src/uts/sparc/bpf/Makefile @@ -71,7 +71,7 @@ INC_PATH += -I$(UTSBASE)/common/io/bpf LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/bridge/Makefile b/usr/src/uts/sparc/bridge/Makefile index 0d233275d9..0dc192e56d 100644 --- a/usr/src/uts/sparc/bridge/Makefile +++ b/usr/src/uts/sparc/bridge/Makefile @@ -57,7 +57,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses diff --git a/usr/src/uts/sparc/busra/Makefile b/usr/src/uts/sparc/busra/Makefile index 6c7373a899..36e3cbfd21 100644 --- a/usr/src/uts/sparc/busra/Makefile +++ b/usr/src/uts/sparc/busra/Makefile @@ -51,7 +51,7 @@ ROOTMODULE = $(ROOT_MISC_DIR)/$(MODULE) include $(UTSBASE)/sparc/Makefile.sparc CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Define targets diff --git a/usr/src/uts/sparc/c2audit/Makefile b/usr/src/uts/sparc/c2audit/Makefile index 90af18b7be..1453514a90 100644 --- a/usr/src/uts/sparc/c2audit/Makefile +++ b/usr/src/uts/sparc/c2audit/Makefile @@ -77,7 +77,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-clobbered -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/cardbus/Makefile b/usr/src/uts/sparc/cardbus/Makefile index 39b54137e8..c72edb640f 100644 --- a/usr/src/uts/sparc/cardbus/Makefile +++ b/usr/src/uts/sparc/cardbus/Makefile @@ -78,7 +78,7 @@ CPPFLAGS += -DHOTPLUG # dependency LDFLAGS += -dy -Nmisc/busra -Nmisc/pcmcia -Nmisc/hpcsvc -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/sparc/cmlb/Makefile b/usr/src/uts/sparc/cmlb/Makefile index e17426bf77..193a612279 100644 --- a/usr/src/uts/sparc/cmlb/Makefile +++ b/usr/src/uts/sparc/cmlb/Makefile @@ -77,7 +77,7 @@ CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/cryptmod/Makefile b/usr/src/uts/sparc/cryptmod/Makefile index ad24856510..2c22229d42 100644 --- a/usr/src/uts/sparc/cryptmod/Makefile +++ b/usr/src/uts/sparc/cryptmod/Makefile @@ -70,7 +70,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/crypto/Makefile b/usr/src/uts/sparc/crypto/Makefile index 786ff74b65..8a9e787a5d 100644 --- a/usr/src/uts/sparc/crypto/Makefile +++ b/usr/src/uts/sparc/crypto/Makefile @@ -61,7 +61,7 @@ CFLAGS += $(CCVERBOSE) LDFLAGS += -dy -Nmisc/kcf -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/cryptoadm/Makefile b/usr/src/uts/sparc/cryptoadm/Makefile index f992ce2af8..dc1890e064 100644 --- a/usr/src/uts/sparc/cryptoadm/Makefile +++ b/usr/src/uts/sparc/cryptoadm/Makefile @@ -71,7 +71,7 @@ LDFLAGS += -dy -Nmisc/kcf LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/ctf/Makefile b/usr/src/uts/sparc/ctf/Makefile index 0f463684dd..55dc972c1c 100644 --- a/usr/src/uts/sparc/ctf/Makefile +++ b/usr/src/uts/sparc/ctf/Makefile @@ -52,7 +52,7 @@ LDFLAGS += $(BREDUCE) -M$(UTSBASE)/common/ctf/mapfile -dy LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) .KEEP_STATE: diff --git a/usr/src/uts/sparc/dad/Makefile b/usr/src/uts/sparc/dad/Makefile index fe137a836d..f57c3fc370 100644 --- a/usr/src/uts/sparc/dad/Makefile +++ b/usr/src/uts/sparc/dad/Makefile @@ -76,7 +76,7 @@ LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-type-limits diff --git a/usr/src/uts/sparc/daplt/Makefile b/usr/src/uts/sparc/daplt/Makefile index 8000f5772c..bc346b9cfc 100644 --- a/usr/src/uts/sparc/daplt/Makefile +++ b/usr/src/uts/sparc/daplt/Makefile @@ -80,7 +80,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/dcam1394/Makefile b/usr/src/uts/sparc/dcam1394/Makefile index 6f8d4dce91..e43ec22386 100644 --- a/usr/src/uts/sparc/dcam1394/Makefile +++ b/usr/src/uts/sparc/dcam1394/Makefile @@ -66,7 +66,7 @@ CFLAGS += $(CCVERBOSE) LDFLAGS += -dy -Nmisc/s1394 CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # Default build targets. # diff --git a/usr/src/uts/sparc/dcfs/Makefile b/usr/src/uts/sparc/dcfs/Makefile index 0b6ef711dc..de6c0a6ae2 100644 --- a/usr/src/uts/sparc/dcfs/Makefile +++ b/usr/src/uts/sparc/dcfs/Makefile @@ -62,7 +62,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/des/Makefile b/usr/src/uts/sparc/des/Makefile index abf71ab827..b205c669ee 100644 --- a/usr/src/uts/sparc/des/Makefile +++ b/usr/src/uts/sparc/des/Makefile @@ -82,7 +82,7 @@ CFLAGS += $(CCVERBOSE) -I$(COM_DIR) LINTFLAGS += -I$(COM_DIR) CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # For now, disable these lint checks; maintainers should endeavor diff --git a/usr/src/uts/sparc/dev/Makefile b/usr/src/uts/sparc/dev/Makefile index e079a824c3..a918d401af 100644 --- a/usr/src/uts/sparc/dev/Makefile +++ b/usr/src/uts/sparc/dev/Makefile @@ -71,7 +71,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/devinfo/Makefile b/usr/src/uts/sparc/devinfo/Makefile index 9afc28426f..7f97558d29 100644 --- a/usr/src/uts/sparc/devinfo/Makefile +++ b/usr/src/uts/sparc/devinfo/Makefile @@ -66,7 +66,7 @@ CFLAGS += $(CCVERBOSE) CPPFLAGS += -I$(SRC)/common CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-clobbered diff --git a/usr/src/uts/sparc/dld/Makefile b/usr/src/uts/sparc/dld/Makefile index 2e6b29b719..fe74eb13a5 100644 --- a/usr/src/uts/sparc/dld/Makefile +++ b/usr/src/uts/sparc/dld/Makefile @@ -68,7 +68,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-parentheses diff --git a/usr/src/uts/sparc/dls/Makefile b/usr/src/uts/sparc/dls/Makefile index 3f15600549..6cdef15504 100644 --- a/usr/src/uts/sparc/dls/Makefile +++ b/usr/src/uts/sparc/dls/Makefile @@ -66,7 +66,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_STATIC_UNUSED -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/dmfe/Makefile b/usr/src/uts/sparc/dmfe/Makefile index 7d3b4a6957..1220b595fd 100644 --- a/usr/src/uts/sparc/dmfe/Makefile +++ b/usr/src/uts/sparc/dmfe/Makefile @@ -56,7 +56,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # extra link arguments diff --git a/usr/src/uts/sparc/doorfs/Makefile b/usr/src/uts/sparc/doorfs/Makefile index ebdfcb24fd..d8bd5421c0 100644 --- a/usr/src/uts/sparc/doorfs/Makefile +++ b/usr/src/uts/sparc/doorfs/Makefile @@ -76,7 +76,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/dscpmk/Makefile b/usr/src/uts/sparc/dscpmk/Makefile index f9c67ebd48..e4f488c306 100644 --- a/usr/src/uts/sparc/dscpmk/Makefile +++ b/usr/src/uts/sparc/dscpmk/Makefile @@ -72,7 +72,7 @@ LDFLAGS += -dy -Ndrv/ip LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/dtrace/Makefile b/usr/src/uts/sparc/dtrace/Makefile index 7fbedc8cbe..941f5873ca 100644 --- a/usr/src/uts/sparc/dtrace/Makefile +++ b/usr/src/uts/sparc/dtrace/Makefile @@ -41,7 +41,7 @@ DSF_DIR = $(UTSBASE)/$(PLATFORM)/genassym CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) ALL_TARGET = $(BINARY) $(SRC_CONFILE) LINT_TARGET = $(MODULE).lint diff --git a/usr/src/uts/sparc/e1000g/Makefile b/usr/src/uts/sparc/e1000g/Makefile index 6ddb183f62..f22795fdce 100644 --- a/usr/src/uts/sparc/e1000g/Makefile +++ b/usr/src/uts/sparc/e1000g/Makefile @@ -62,7 +62,7 @@ LINTFLAGS += \ -I$(UTSBASE)/common/io/e1000api -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-label diff --git a/usr/src/uts/sparc/ecc/Makefile b/usr/src/uts/sparc/ecc/Makefile index 8876c0ab9e..7930035fed 100644 --- a/usr/src/uts/sparc/ecc/Makefile +++ b/usr/src/uts/sparc/ecc/Makefile @@ -70,7 +70,7 @@ LINTFLAGS += -I$(COM1_DIR) -I$(COM2_DIR) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-empty-body CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/sparc/ecpp/Makefile b/usr/src/uts/sparc/ecpp/Makefile index 677fce57ee..bbf1a3a00c 100644 --- a/usr/src/uts/sparc/ecpp/Makefile +++ b/usr/src/uts/sparc/ecpp/Makefile @@ -64,7 +64,7 @@ CFLAGS += $(CCVERBOSE) # Turn this on once compiler understands v9 in it's backend #INLINES += $(UTSBASE)/sun/io/ecpp.il -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/sparc/efe/Makefile b/usr/src/uts/sparc/efe/Makefile index e0342d5ace..119d855117 100644 --- a/usr/src/uts/sparc/efe/Makefile +++ b/usr/src/uts/sparc/efe/Makefile @@ -40,7 +40,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) CFLAGS += $(CCVERBOSE) LDFLAGS += -dy -N misc/mac -N misc/mii -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/ehci/Makefile b/usr/src/uts/sparc/ehci/Makefile index 65fcbe5430..42f0e0d7bb 100644 --- a/usr/src/uts/sparc/ehci/Makefile +++ b/usr/src/uts/sparc/ehci/Makefile @@ -53,7 +53,7 @@ include $(UTSBASE)/sparc/Makefile.sparc # lint pass one enforcement # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch # diff --git a/usr/src/uts/sparc/eibnx/Makefile b/usr/src/uts/sparc/eibnx/Makefile index 7380f424ab..3dd9c47375 100644 --- a/usr/src/uts/sparc/eibnx/Makefile +++ b/usr/src/uts/sparc/eibnx/Makefile @@ -81,7 +81,7 @@ LDFLAGS += -dy -Nmisc/ibcm -Nmisc/ibtl LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets diff --git a/usr/src/uts/sparc/elfexec/Makefile b/usr/src/uts/sparc/elfexec/Makefile index cfe4e5e8e0..ba49e2b0d5 100644 --- a/usr/src/uts/sparc/elfexec/Makefile +++ b/usr/src/uts/sparc/elfexec/Makefile @@ -74,7 +74,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/emlxs/Makefile b/usr/src/uts/sparc/emlxs/Makefile index bf4e73799d..16ac3b05df 100644 --- a/usr/src/uts/sparc/emlxs/Makefile +++ b/usr/src/uts/sparc/emlxs/Makefile @@ -89,7 +89,7 @@ LINTTAGS += -erroff=E_INCONS_VAL_TYPE_DECL2 CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/emul64/Makefile b/usr/src/uts/sparc/emul64/Makefile index 337d3e9d95..86cfecacd1 100644 --- a/usr/src/uts/sparc/emul64/Makefile +++ b/usr/src/uts/sparc/emul64/Makefile @@ -66,7 +66,7 @@ CFLAGS += $(CCVERBOSE) LDFLAGS += -dy -N misc/scsi CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # For now, disable these lint checks; maintainers should endeavor diff --git a/usr/src/uts/sparc/eoib/Makefile b/usr/src/uts/sparc/eoib/Makefile index 01a11078fc..ffa1ac053d 100644 --- a/usr/src/uts/sparc/eoib/Makefile +++ b/usr/src/uts/sparc/eoib/Makefile @@ -70,7 +70,7 @@ CPPFLAGS += -DEIB_DEBUG CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Depends on misc/ibtl diff --git a/usr/src/uts/sparc/fas/Makefile b/usr/src/uts/sparc/fas/Makefile index 03dea3fc60..03eec24a86 100644 --- a/usr/src/uts/sparc/fas/Makefile +++ b/usr/src/uts/sparc/fas/Makefile @@ -74,7 +74,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/fasttrap/Makefile b/usr/src/uts/sparc/fasttrap/Makefile index a6fc8659cf..e69edd4f6f 100644 --- a/usr/src/uts/sparc/fasttrap/Makefile +++ b/usr/src/uts/sparc/fasttrap/Makefile @@ -43,7 +43,7 @@ CFLAGS += $(CCVERBOSE) CPPFLAGS += -I$(SRC)/common LDFLAGS += -dy -Ndrv/dtrace -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) .KEEP_STATE: diff --git a/usr/src/uts/sparc/fbt/Makefile b/usr/src/uts/sparc/fbt/Makefile index 1b2b5dcf75..79286b526e 100644 --- a/usr/src/uts/sparc/fbt/Makefile +++ b/usr/src/uts/sparc/fbt/Makefile @@ -51,7 +51,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) .KEEP_STATE: diff --git a/usr/src/uts/sparc/fcp/Makefile b/usr/src/uts/sparc/fcp/Makefile index ddc705e0ba..8ba05be670 100644 --- a/usr/src/uts/sparc/fcp/Makefile +++ b/usr/src/uts/sparc/fcp/Makefile @@ -67,7 +67,7 @@ LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/fcpci/Makefile b/usr/src/uts/sparc/fcpci/Makefile index ab429cd13c..eacdd19548 100644 --- a/usr/src/uts/sparc/fcpci/Makefile +++ b/usr/src/uts/sparc/fcpci/Makefile @@ -87,7 +87,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/fcsm/Makefile b/usr/src/uts/sparc/fcsm/Makefile index faaa084924..fc93e07a59 100644 --- a/usr/src/uts/sparc/fcsm/Makefile +++ b/usr/src/uts/sparc/fcsm/Makefile @@ -68,7 +68,7 @@ LDFLAGS += -dy -Nmisc/fctl LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/fct/Makefile b/usr/src/uts/sparc/fct/Makefile index b61a18873d..c4c89b3a46 100644 --- a/usr/src/uts/sparc/fct/Makefile +++ b/usr/src/uts/sparc/fct/Makefile @@ -72,7 +72,7 @@ LINTTAGS += -erroff=E_IF_ELSE_ANNOTATION CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/fctl/Makefile b/usr/src/uts/sparc/fctl/Makefile index 080e6afeb8..b0c525ed3e 100644 --- a/usr/src/uts/sparc/fctl/Makefile +++ b/usr/src/uts/sparc/fctl/Makefile @@ -69,7 +69,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/flowacct/Makefile b/usr/src/uts/sparc/flowacct/Makefile index 40e80edef4..56a16ddc8b 100644 --- a/usr/src/uts/sparc/flowacct/Makefile +++ b/usr/src/uts/sparc/flowacct/Makefile @@ -71,7 +71,7 @@ LDFLAGS += -dy -Ndrv/ip -Ndrv/tcp # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/fp/Makefile b/usr/src/uts/sparc/fp/Makefile index f1791f247e..5d446e7ca9 100644 --- a/usr/src/uts/sparc/fp/Makefile +++ b/usr/src/uts/sparc/fp/Makefile @@ -72,7 +72,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON LINTTAGS += -erroff=E_STATIC_UNUSED -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-function # diff --git a/usr/src/uts/sparc/gld/Makefile b/usr/src/uts/sparc/gld/Makefile index e4323878f1..d56548e81b 100644 --- a/usr/src/uts/sparc/gld/Makefile +++ b/usr/src/uts/sparc/gld/Makefile @@ -70,7 +70,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # diff --git a/usr/src/uts/sparc/hci1394/Makefile b/usr/src/uts/sparc/hci1394/Makefile index 5bdb63b1e0..07b8f1c907 100644 --- a/usr/src/uts/sparc/hci1394/Makefile +++ b/usr/src/uts/sparc/hci1394/Makefile @@ -85,7 +85,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # diff --git a/usr/src/uts/sparc/hermon/Makefile b/usr/src/uts/sparc/hermon/Makefile index 23ff5b1ecf..b91d41e52c 100644 --- a/usr/src/uts/sparc/hermon/Makefile +++ b/usr/src/uts/sparc/hermon/Makefile @@ -76,7 +76,7 @@ CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/hidparser/Makefile b/usr/src/uts/sparc/hidparser/Makefile index 1b6f99ef6e..31eb5a23b6 100644 --- a/usr/src/uts/sparc/hidparser/Makefile +++ b/usr/src/uts/sparc/hidparser/Makefile @@ -53,7 +53,7 @@ include $(UTSBASE)/sparc/Makefile.sparc # lint pass one enforcement # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # depends on misc/usba diff --git a/usr/src/uts/sparc/hme/Makefile b/usr/src/uts/sparc/hme/Makefile index b22c9eb8be..492dfe2a25 100644 --- a/usr/src/uts/sparc/hme/Makefile +++ b/usr/src/uts/sparc/hme/Makefile @@ -61,7 +61,7 @@ LDFLAGS += -dy -Nmisc/mii -Nmisc/mac CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/hook/Makefile b/usr/src/uts/sparc/hook/Makefile index 7f8a8a0f5e..5e68af14d3 100644 --- a/usr/src/uts/sparc/hook/Makefile +++ b/usr/src/uts/sparc/hook/Makefile @@ -49,7 +49,7 @@ ROOTMODULE = $(ROOT_MISC_DIR)/$(MODULE) # include $(UTSBASE)/sparc/Makefile.sparc -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Define targets diff --git a/usr/src/uts/sparc/hpcsvc/Makefile b/usr/src/uts/sparc/hpcsvc/Makefile index 74edaabac0..3472ca053a 100644 --- a/usr/src/uts/sparc/hpcsvc/Makefile +++ b/usr/src/uts/sparc/hpcsvc/Makefile @@ -63,7 +63,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) DEBUG_FLGS = DEBUG_DEFS += $(DEBUG_FLGS) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # lint pass one enforcement diff --git a/usr/src/uts/sparc/hsfs/Makefile b/usr/src/uts/sparc/hsfs/Makefile index 7a042ec007..1303c74a7e 100644 --- a/usr/src/uts/sparc/hsfs/Makefile +++ b/usr/src/uts/sparc/hsfs/Makefile @@ -78,7 +78,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-switch diff --git a/usr/src/uts/sparc/hxge/Makefile b/usr/src/uts/sparc/hxge/Makefile index e8064bf9a7..46343ada36 100644 --- a/usr/src/uts/sparc/hxge/Makefile +++ b/usr/src/uts/sparc/hxge/Makefile @@ -90,7 +90,7 @@ LINTTAGS += -erroff=E_FALSE_LOGICAL_EXPR CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # diff --git a/usr/src/uts/sparc/ib/Makefile b/usr/src/uts/sparc/ib/Makefile index 4432cce6a9..83e44c69f2 100644 --- a/usr/src/uts/sparc/ib/Makefile +++ b/usr/src/uts/sparc/ib/Makefile @@ -63,7 +63,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) ALL_BUILDS = $(ALL_BUILDSONLY64) DEF_BUILDS = $(DEF_BUILDSONLY64) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # lint pass one enforcement diff --git a/usr/src/uts/sparc/ibcm/Makefile b/usr/src/uts/sparc/ibcm/Makefile index 8cd008039b..71f1f79fcc 100644 --- a/usr/src/uts/sparc/ibcm/Makefile +++ b/usr/src/uts/sparc/ibcm/Makefile @@ -69,7 +69,7 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-value # diff --git a/usr/src/uts/sparc/ibdm/Makefile b/usr/src/uts/sparc/ibdm/Makefile index e713659ab8..1308ed72b3 100644 --- a/usr/src/uts/sparc/ibdm/Makefile +++ b/usr/src/uts/sparc/ibdm/Makefile @@ -78,7 +78,7 @@ LDFLAGS += -dy -Nmisc/ibtl -Nmisc/ibmf # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/ibmf/Makefile b/usr/src/uts/sparc/ibmf/Makefile index 70413eda4f..6de209c25c 100644 --- a/usr/src/uts/sparc/ibmf/Makefile +++ b/usr/src/uts/sparc/ibmf/Makefile @@ -76,7 +76,7 @@ CFLAGS += $(CCVERBOSE) LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/ibp/Makefile b/usr/src/uts/sparc/ibp/Makefile index 6017f36362..8e837ad67d 100644 --- a/usr/src/uts/sparc/ibp/Makefile +++ b/usr/src/uts/sparc/ibp/Makefile @@ -71,7 +71,7 @@ CFLAGS += $(CCVERBOSE) LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch # diff --git a/usr/src/uts/sparc/ibtl/Makefile b/usr/src/uts/sparc/ibtl/Makefile index acbd0b110f..31da41ff10 100644 --- a/usr/src/uts/sparc/ibtl/Makefile +++ b/usr/src/uts/sparc/ibtl/Makefile @@ -77,7 +77,7 @@ LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-value diff --git a/usr/src/uts/sparc/idm/Makefile b/usr/src/uts/sparc/idm/Makefile index ee54f9ca87..6ae749af13 100644 --- a/usr/src/uts/sparc/idm/Makefile +++ b/usr/src/uts/sparc/idm/Makefile @@ -62,7 +62,7 @@ LDFLAGS += -dy -Nfs/sockfs -Nmisc/ksocket CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # Include INC_PATH += -I$(SRC)/common/hdcrc diff --git a/usr/src/uts/sparc/igb/Makefile b/usr/src/uts/sparc/igb/Makefile index 51fb4cdfcc..3e8c78c94d 100644 --- a/usr/src/uts/sparc/igb/Makefile +++ b/usr/src/uts/sparc/igb/Makefile @@ -55,7 +55,7 @@ LINTFLAGS += \ -I$(UTSBASE)/common/io/e1000api CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_cc=-erroff=E_STATEMENT_NOT_REACHED # diff --git a/usr/src/uts/sparc/ip/Makefile b/usr/src/uts/sparc/ip/Makefile index c6c5ec3746..4b6ac89108 100644 --- a/usr/src/uts/sparc/ip/Makefile +++ b/usr/src/uts/sparc/ip/Makefile @@ -96,7 +96,7 @@ CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits # diff --git a/usr/src/uts/sparc/ipc/Makefile b/usr/src/uts/sparc/ipc/Makefile index 2298bb7c42..1ed5f1f9fe 100644 --- a/usr/src/uts/sparc/ipc/Makefile +++ b/usr/src/uts/sparc/ipc/Makefile @@ -68,7 +68,7 @@ CFLAGS += $(CCVERBOSE) LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/ipf/Makefile b/usr/src/uts/sparc/ipf/Makefile index a8bfc7171a..3250d51003 100644 --- a/usr/src/uts/sparc/ipf/Makefile +++ b/usr/src/uts/sparc/ipf/Makefile @@ -82,7 +82,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-empty-body # diff --git a/usr/src/uts/sparc/ipgpc/Makefile b/usr/src/uts/sparc/ipgpc/Makefile index 0e36efe1dc..a5d60bf915 100644 --- a/usr/src/uts/sparc/ipgpc/Makefile +++ b/usr/src/uts/sparc/ipgpc/Makefile @@ -67,7 +67,7 @@ CFLAGS += $(CCVERBOSE) LDFLAGS += -dy -Ndrv/ip -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # For now, disable these lint checks; maintainers should endeavor diff --git a/usr/src/uts/sparc/ipsecah/Makefile b/usr/src/uts/sparc/ipsecah/Makefile index 506645d988..55ee48c88f 100644 --- a/usr/src/uts/sparc/ipsecah/Makefile +++ b/usr/src/uts/sparc/ipsecah/Makefile @@ -78,7 +78,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/ipsecesp/Makefile b/usr/src/uts/sparc/ipsecesp/Makefile index fa3fc8f4d5..1a36e4fbc7 100644 --- a/usr/src/uts/sparc/ipsecesp/Makefile +++ b/usr/src/uts/sparc/ipsecesp/Makefile @@ -76,7 +76,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/iptun/Makefile b/usr/src/uts/sparc/iptun/Makefile index d63689a37a..b01cdfd7b4 100644 --- a/usr/src/uts/sparc/iptun/Makefile +++ b/usr/src/uts/sparc/iptun/Makefile @@ -60,7 +60,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/iscsi/Makefile b/usr/src/uts/sparc/iscsi/Makefile index 56e8b185f2..7b0c73fd6b 100644 --- a/usr/src/uts/sparc/iscsi/Makefile +++ b/usr/src/uts/sparc/iscsi/Makefile @@ -72,7 +72,7 @@ CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/iscsit/Makefile b/usr/src/uts/sparc/iscsit/Makefile index 73b9139ec9..45954abf12 100644 --- a/usr/src/uts/sparc/iscsit/Makefile +++ b/usr/src/uts/sparc/iscsit/Makefile @@ -63,7 +63,7 @@ LDFLAGS += -dy -Ndrv/stmf -Nmisc/idm -Nfs/sockfs -Nmisc/md5 -Nmisc/ksocket C99LMODE= -Xc99=%all CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-label # diff --git a/usr/src/uts/sparc/iser/Makefile b/usr/src/uts/sparc/iser/Makefile index bf5dd8e069..f4fd1b5c41 100644 --- a/usr/src/uts/sparc/iser/Makefile +++ b/usr/src/uts/sparc/iser/Makefile @@ -43,7 +43,7 @@ CONF_SRCDIR = $(UTSBASE)/common/io/ib/clients/iser # include $(UTSBASE)/sparc/Makefile.sparc -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Define targets diff --git a/usr/src/uts/sparc/ixgbe/Makefile b/usr/src/uts/sparc/ixgbe/Makefile index 90fbc215c8..493f91652d 100644 --- a/usr/src/uts/sparc/ixgbe/Makefile +++ b/usr/src/uts/sparc/ixgbe/Makefile @@ -56,7 +56,7 @@ INC_PATH += -I$(UTSBASE)/common/io/ixgbe/core CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_cc=-erroff=E_STATEMENT_NOT_REACHED diff --git a/usr/src/uts/sparc/kaio/Makefile b/usr/src/uts/sparc/kaio/Makefile index 9713927ed1..41f948fc03 100644 --- a/usr/src/uts/sparc/kaio/Makefile +++ b/usr/src/uts/sparc/kaio/Makefile @@ -77,7 +77,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/kb8042/Makefile b/usr/src/uts/sparc/kb8042/Makefile index 517bfd446d..258a09323a 100644 --- a/usr/src/uts/sparc/kb8042/Makefile +++ b/usr/src/uts/sparc/kb8042/Makefile @@ -64,7 +64,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/kcf/Makefile b/usr/src/uts/sparc/kcf/Makefile index 22d39a7c0e..7d7eee4c01 100644 --- a/usr/src/uts/sparc/kcf/Makefile +++ b/usr/src/uts/sparc/kcf/Makefile @@ -66,7 +66,7 @@ CFLAGS += $(CCVERBOSE) -I$(COM_DIR) LINTTAGS += -I$(COM_DIR) CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label diff --git a/usr/src/uts/sparc/kgssapi/Makefile b/usr/src/uts/sparc/kgssapi/Makefile index c33564a338..3e25d28a02 100644 --- a/usr/src/uts/sparc/kgssapi/Makefile +++ b/usr/src/uts/sparc/kgssapi/Makefile @@ -71,7 +71,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-unused-variable -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/kmech_krb5/Makefile b/usr/src/uts/sparc/kmech_krb5/Makefile index 0bf4c49d1c..dc76bb0d91 100644 --- a/usr/src/uts/sparc/kmech_krb5/Makefile +++ b/usr/src/uts/sparc/kmech_krb5/Makefile @@ -66,7 +66,7 @@ LDFLAGS += -dy -N misc/kgssapi -N crypto/md5 CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # diff --git a/usr/src/uts/sparc/kssl/Makefile b/usr/src/uts/sparc/kssl/Makefile index ba7750705b..566bbeb13a 100644 --- a/usr/src/uts/sparc/kssl/Makefile +++ b/usr/src/uts/sparc/kssl/Makefile @@ -73,7 +73,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_STATIC_UNUSED -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/ksslf/Makefile b/usr/src/uts/sparc/ksslf/Makefile index 17d6816547..a65199e8ec 100644 --- a/usr/src/uts/sparc/ksslf/Makefile +++ b/usr/src/uts/sparc/ksslf/Makefile @@ -68,7 +68,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/kstat/Makefile b/usr/src/uts/sparc/kstat/Makefile index 09d0f64722..efe30fdacd 100644 --- a/usr/src/uts/sparc/kstat/Makefile +++ b/usr/src/uts/sparc/kstat/Makefile @@ -68,7 +68,7 @@ CFLAGS += $(CCVERBOSE) # LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/ldterm/Makefile b/usr/src/uts/sparc/ldterm/Makefile index a76cdad21e..82f018cb9c 100644 --- a/usr/src/uts/sparc/ldterm/Makefile +++ b/usr/src/uts/sparc/ldterm/Makefile @@ -71,7 +71,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/llc1/Makefile b/usr/src/uts/sparc/llc1/Makefile index f2d79adf02..5cc83a519b 100644 --- a/usr/src/uts/sparc/llc1/Makefile +++ b/usr/src/uts/sparc/llc1/Makefile @@ -63,7 +63,7 @@ CFLAGS += $(CCVERBOSE) LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/lofi/Makefile b/usr/src/uts/sparc/lofi/Makefile index 3b9a1e5703..6fa0f0b8e0 100644 --- a/usr/src/uts/sparc/lofi/Makefile +++ b/usr/src/uts/sparc/lofi/Makefile @@ -58,7 +58,7 @@ LDFLAGS += -dy -Nmisc/cmlb # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) INC_PATH += -I$(SRC)/common/lzma diff --git a/usr/src/uts/sparc/mac/Makefile b/usr/src/uts/sparc/mac/Makefile index 3570c534b0..227702c1c3 100644 --- a/usr/src/uts/sparc/mac/Makefile +++ b/usr/src/uts/sparc/mac/Makefile @@ -65,7 +65,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/sparc/mii/Makefile b/usr/src/uts/sparc/mii/Makefile index a853240a72..3dce507659 100644 --- a/usr/src/uts/sparc/mii/Makefile +++ b/usr/src/uts/sparc/mii/Makefile @@ -55,7 +55,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) LDFLAGS += -dy -N misc/mac CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/mpt_sas/Makefile b/usr/src/uts/sparc/mpt_sas/Makefile index 4f7414a794..b63d1b04f4 100644 --- a/usr/src/uts/sparc/mpt_sas/Makefile +++ b/usr/src/uts/sparc/mpt_sas/Makefile @@ -63,7 +63,7 @@ include $(UTSBASE)/sparc/Makefile.sparc CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch # diff --git a/usr/src/uts/sparc/mr_sas/Makefile b/usr/src/uts/sparc/mr_sas/Makefile index 7a38c8cc50..3429251238 100644 --- a/usr/src/uts/sparc/mr_sas/Makefile +++ b/usr/src/uts/sparc/mr_sas/Makefile @@ -61,7 +61,7 @@ CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Turn on doubleword alignment for 64 bit registers diff --git a/usr/src/uts/sparc/msgsys/Makefile b/usr/src/uts/sparc/msgsys/Makefile index d0f1e78532..a16e294bea 100644 --- a/usr/src/uts/sparc/msgsys/Makefile +++ b/usr/src/uts/sparc/msgsys/Makefile @@ -68,7 +68,7 @@ LDFLAGS += -dy -Nmisc/ipc LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/nfs/Makefile b/usr/src/uts/sparc/nfs/Makefile index e29e28133c..4e85d846a5 100644 --- a/usr/src/uts/sparc/nfs/Makefile +++ b/usr/src/uts/sparc/nfs/Makefile @@ -85,7 +85,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-type-limits -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/sparc/nfssrv/Makefile b/usr/src/uts/sparc/nfssrv/Makefile index f71c2f10d8..b0dfc398d2 100644 --- a/usr/src/uts/sparc/nfssrv/Makefile +++ b/usr/src/uts/sparc/nfssrv/Makefile @@ -79,7 +79,7 @@ CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch # diff --git a/usr/src/uts/sparc/objfs/Makefile b/usr/src/uts/sparc/objfs/Makefile index f166f4ee54..9a0845e331 100644 --- a/usr/src/uts/sparc/objfs/Makefile +++ b/usr/src/uts/sparc/objfs/Makefile @@ -70,7 +70,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/oce/Makefile b/usr/src/uts/sparc/oce/Makefile index fe3521b2f9..375aba9280 100644 --- a/usr/src/uts/sparc/oce/Makefile +++ b/usr/src/uts/sparc/oce/Makefile @@ -58,7 +58,7 @@ LDFLAGS += -dy -Nmisc/mac CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # diff --git a/usr/src/uts/sparc/ohci/Makefile b/usr/src/uts/sparc/ohci/Makefile index 2360e3480c..3c0ee37ec4 100644 --- a/usr/src/uts/sparc/ohci/Makefile +++ b/usr/src/uts/sparc/ohci/Makefile @@ -66,7 +66,7 @@ ALL_TARGET = $(BINARY) $(SRC_CONFFILE) LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # For now, disable these lint checks; maintainers should endeavor diff --git a/usr/src/uts/sparc/openeepr/Makefile b/usr/src/uts/sparc/openeepr/Makefile index 80214c9e68..b536c6c58c 100644 --- a/usr/src/uts/sparc/openeepr/Makefile +++ b/usr/src/uts/sparc/openeepr/Makefile @@ -61,7 +61,7 @@ CFLAGS += $(CCVERBOSE) LDFLAGS += -dy -Ndacf/consconfig_dacf CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # For now, disable these lint checks; maintainers should endeavor diff --git a/usr/src/uts/sparc/os/dacf.conf b/usr/src/uts/sparc/os/dacf.conf index 971f50f751..83ec3d1abb 100644 --- a/usr/src/uts/sparc/os/dacf.conf +++ b/usr/src/uts/sparc/os/dacf.conf @@ -21,6 +21,7 @@ # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. +# Copyright 2019 Peter Tribble. # # # NOTICE: This file contains important KERNEL STATE. Do not edit this file. @@ -32,7 +33,7 @@ # # Configure and/or unconfigure a keyboard into the keyboard console stream. # pushmod is the STREAMS module to be pushed on the minor node specified by -# driver-minorname. The pushmod varies based on the keyboard hardware. +# driver-minorname. The pushmod varies based on the keyboard hardware. # driver-minorname="hid:internal_keyboard" consconfig_dacf:kb_config post-attach - pushmod="usbkbm" driver-minorname="hid:internal_keyboard" consconfig_dacf:kb_config pre-detach - pushmod="usbkbm" @@ -40,7 +41,7 @@ driver-minorname="hid:internal_keyboard" consconfig_dacf:kb_config pre-detach - # # Configure and/or unconfigure a mouse into the mouse console stream. pushmod # is the STREAMS module to be pushed on the minor node specified by -# driver-minorname. The pushmod varies based on the mouse hardware. +# driver-minorname. The pushmod varies based on the mouse hardware. # driver-minorname="hid:internal_mouse" consconfig_dacf:ms_config post-attach - pushmod="usbms" driver-minorname="hid:internal_mouse" consconfig_dacf:ms_config pre-detach - pushmod="usbms" @@ -51,11 +52,6 @@ driver-minorname="mouse8042:internal_mouse" consconfig_dacf:ms_config pre-detach driver-minorname="su_pnp:mouse" consconfig_dacf:ms_config post-attach - pushmod="ms" # -# Configure and/or unconfigure a console into the termio compliant streams for Monte Carlo -# -driver-minorname="ttymux:con" ttymux_dacf:ttymux_config post-attach - - -# # Devices directly supporting the keyboard API need no device-specific module, # but do need to be linked to the console stream. # diff --git a/usr/src/uts/sparc/pcfs/Makefile b/usr/src/uts/sparc/pcfs/Makefile index 3140a6d539..59c53e2458 100644 --- a/usr/src/uts/sparc/pcfs/Makefile +++ b/usr/src/uts/sparc/pcfs/Makefile @@ -64,7 +64,7 @@ CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-function # diff --git a/usr/src/uts/sparc/pcic/Makefile b/usr/src/uts/sparc/pcic/Makefile index be073df333..93e2eb1198 100644 --- a/usr/src/uts/sparc/pcic/Makefile +++ b/usr/src/uts/sparc/pcic/Makefile @@ -80,7 +80,7 @@ LDFLAGS += -dy -Nmisc/busra -Nmisc/pcmcia -Nmisc/cardbus CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # For now, disable these lint checks; maintainers should endeavor diff --git a/usr/src/uts/sparc/pcicfg/Makefile b/usr/src/uts/sparc/pcicfg/Makefile index 5cda1ade8e..b403c87670 100644 --- a/usr/src/uts/sparc/pcicfg/Makefile +++ b/usr/src/uts/sparc/pcicfg/Makefile @@ -89,7 +89,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-unused-variable -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/pcmcia/Makefile b/usr/src/uts/sparc/pcmcia/Makefile index 2efecbe522..e8d67d5fdb 100644 --- a/usr/src/uts/sparc/pcmcia/Makefile +++ b/usr/src/uts/sparc/pcmcia/Makefile @@ -83,7 +83,7 @@ LDFLAGS += -dy -Nmisc/busra LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # diff --git a/usr/src/uts/sparc/pm/Makefile b/usr/src/uts/sparc/pm/Makefile index da6092c328..ce992428df 100644 --- a/usr/src/uts/sparc/pm/Makefile +++ b/usr/src/uts/sparc/pm/Makefile @@ -71,7 +71,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/pmcs/Makefile b/usr/src/uts/sparc/pmcs/Makefile index 82414a28bf..6689465afd 100644 --- a/usr/src/uts/sparc/pmcs/Makefile +++ b/usr/src/uts/sparc/pmcs/Makefile @@ -67,7 +67,7 @@ CPPFLAGS += $(PMCS_DRV_FLGS) \ -DPMCS_FIRMWARE_VERSION_STRING=\"${PMCS_FW_VERSION_STRING}\" CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-parentheses diff --git a/usr/src/uts/sparc/poll/Makefile b/usr/src/uts/sparc/poll/Makefile index c8722105ee..af97f9371f 100644 --- a/usr/src/uts/sparc/poll/Makefile +++ b/usr/src/uts/sparc/poll/Makefile @@ -54,7 +54,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # lint pass one enforcement # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # See uts/intel/poll/Makefile for why this is necessary. diff --git a/usr/src/uts/sparc/portfs/Makefile b/usr/src/uts/sparc/portfs/Makefile index 3f2465e7ed..faad9243ee 100644 --- a/usr/src/uts/sparc/portfs/Makefile +++ b/usr/src/uts/sparc/portfs/Makefile @@ -74,7 +74,7 @@ CFLAGS += $(CCVERBOSE) # LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # diff --git a/usr/src/uts/sparc/pppt/Makefile b/usr/src/uts/sparc/pppt/Makefile index f492a4d1b0..d4d4dcbdbf 100644 --- a/usr/src/uts/sparc/pppt/Makefile +++ b/usr/src/uts/sparc/pppt/Makefile @@ -63,7 +63,7 @@ LDFLAGS += -dy -Ndrv/stmf C99LMODE= -Xc99=%all CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/procfs/Makefile b/usr/src/uts/sparc/procfs/Makefile index 6c4ec3fb7c..8dd05fe72b 100644 --- a/usr/src/uts/sparc/procfs/Makefile +++ b/usr/src/uts/sparc/procfs/Makefile @@ -75,7 +75,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/ptem/Makefile b/usr/src/uts/sparc/ptem/Makefile index 202a3250a9..0031ebe676 100644 --- a/usr/src/uts/sparc/ptem/Makefile +++ b/usr/src/uts/sparc/ptem/Makefile @@ -70,7 +70,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/qlc/Makefile b/usr/src/uts/sparc/qlc/Makefile index 92494ed283..2d492a8baa 100644 --- a/usr/src/uts/sparc/qlc/Makefile +++ b/usr/src/uts/sparc/qlc/Makefile @@ -77,7 +77,7 @@ FWIMAGES += 8100 FWMODULES = $(FWIMAGES:%=$(MODULE)_fw_%) FWMODULES_SRC = $(FWIMAGES:%=$(CONF_SRCDIR)/ql_fw_%.c) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-parentheses diff --git a/usr/src/uts/sparc/qlge/Makefile b/usr/src/uts/sparc/qlge/Makefile index d9951b0d1a..a823631732 100644 --- a/usr/src/uts/sparc/qlge/Makefile +++ b/usr/src/uts/sparc/qlge/Makefile @@ -64,7 +64,7 @@ LDFLAGS += -dy -Nmisc/mac -Ndrv/ip C99LMODE= -Xc99=%all CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/qlt/Makefile b/usr/src/uts/sparc/qlt/Makefile index f145c2e880..16fd3ef9ed 100644 --- a/usr/src/uts/sparc/qlt/Makefile +++ b/usr/src/uts/sparc/qlt/Makefile @@ -70,7 +70,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_STATIC_UNUSED LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/rds/Makefile b/usr/src/uts/sparc/rds/Makefile index 8a19251b1d..8e078da5da 100644 --- a/usr/src/uts/sparc/rds/Makefile +++ b/usr/src/uts/sparc/rds/Makefile @@ -61,7 +61,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) LDFLAGS += -dy -Nfs/sockfs -Ndrv/ip diff --git a/usr/src/uts/sparc/rdsib/Makefile b/usr/src/uts/sparc/rdsib/Makefile index 9a71c4cc92..8325150c18 100644 --- a/usr/src/uts/sparc/rdsib/Makefile +++ b/usr/src/uts/sparc/rdsib/Makefile @@ -62,7 +62,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) LDFLAGS += -dy -Ndrv/rds -Nmisc/ibtl -Nmisc/ibcm -Ndrv/ip diff --git a/usr/src/uts/sparc/rdsv3/Makefile b/usr/src/uts/sparc/rdsv3/Makefile index ec1fa4ac0a..42218769c8 100644 --- a/usr/src/uts/sparc/rdsv3/Makefile +++ b/usr/src/uts/sparc/rdsv3/Makefile @@ -61,7 +61,7 @@ CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # diff --git a/usr/src/uts/sparc/rge/Makefile b/usr/src/uts/sparc/rge/Makefile index 56ebef3144..48b7f673ed 100644 --- a/usr/src/uts/sparc/rge/Makefile +++ b/usr/src/uts/sparc/rge/Makefile @@ -69,7 +69,7 @@ CFLAGS += -dalign LDFLAGS += -dy -N misc/mac -N drv/ip CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # For now, disable these lint checks; maintainers should endeavor diff --git a/usr/src/uts/sparc/rlmod/Makefile b/usr/src/uts/sparc/rlmod/Makefile index b9f6254a5e..dc8cdff3a3 100644 --- a/usr/src/uts/sparc/rlmod/Makefile +++ b/usr/src/uts/sparc/rlmod/Makefile @@ -70,7 +70,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/rpcib/Makefile b/usr/src/uts/sparc/rpcib/Makefile index 82f1206b40..7d8e43ea31 100644 --- a/usr/src/uts/sparc/rpcib/Makefile +++ b/usr/src/uts/sparc/rpcib/Makefile @@ -75,7 +75,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/rpcmod/Makefile b/usr/src/uts/sparc/rpcmod/Makefile index dad440934b..e25ca4bb83 100644 --- a/usr/src/uts/sparc/rpcmod/Makefile +++ b/usr/src/uts/sparc/rpcmod/Makefile @@ -87,7 +87,7 @@ LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-label diff --git a/usr/src/uts/sparc/rpcsec/Makefile b/usr/src/uts/sparc/rpcsec/Makefile index 87f385f29d..ac2536bc4f 100644 --- a/usr/src/uts/sparc/rpcsec/Makefile +++ b/usr/src/uts/sparc/rpcsec/Makefile @@ -71,7 +71,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/rsa/Makefile b/usr/src/uts/sparc/rsa/Makefile index ea61e30cea..048e02f81e 100644 --- a/usr/src/uts/sparc/rsa/Makefile +++ b/usr/src/uts/sparc/rsa/Makefile @@ -80,7 +80,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/rsm/Makefile b/usr/src/uts/sparc/rsm/Makefile index 6d830fa2b1..cfd0eccedc 100644 --- a/usr/src/uts/sparc/rsm/Makefile +++ b/usr/src/uts/sparc/rsm/Makefile @@ -83,7 +83,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # diff --git a/usr/src/uts/sparc/rtls/Makefile b/usr/src/uts/sparc/rtls/Makefile index d19674b6ed..6a9e60d6a3 100644 --- a/usr/src/uts/sparc/rtls/Makefile +++ b/usr/src/uts/sparc/rtls/Makefile @@ -56,7 +56,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # Overrides # -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Driver depends on Mac diff --git a/usr/src/uts/sparc/s1394/Makefile b/usr/src/uts/sparc/s1394/Makefile index 5122529ec5..67e21511cd 100644 --- a/usr/src/uts/sparc/s1394/Makefile +++ b/usr/src/uts/sparc/s1394/Makefile @@ -84,7 +84,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-parentheses diff --git a/usr/src/uts/sparc/sad/Makefile b/usr/src/uts/sparc/sad/Makefile index 92d7bedcdc..f55534c3e7 100644 --- a/usr/src/uts/sparc/sad/Makefile +++ b/usr/src/uts/sparc/sad/Makefile @@ -72,7 +72,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/sata/Makefile b/usr/src/uts/sparc/sata/Makefile index cb1c0878a1..71ed1be9ae 100644 --- a/usr/src/uts/sparc/sata/Makefile +++ b/usr/src/uts/sparc/sata/Makefile @@ -90,7 +90,7 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-empty-body # needs work diff --git a/usr/src/uts/sparc/scsa1394/Makefile b/usr/src/uts/sparc/scsa1394/Makefile index f8f2543772..5eab76a7ed 100644 --- a/usr/src/uts/sparc/scsa1394/Makefile +++ b/usr/src/uts/sparc/scsa1394/Makefile @@ -78,7 +78,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LDFLAGS += -dy -Nmisc/scsi -Nmisc/s1394 -Nmisc/sbp2 CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # Default build targets. # diff --git a/usr/src/uts/sparc/scsa2usb/Makefile b/usr/src/uts/sparc/scsa2usb/Makefile index c122b2b7cb..eb7fdbbf9c 100644 --- a/usr/src/uts/sparc/scsa2usb/Makefile +++ b/usr/src/uts/sparc/scsa2usb/Makefile @@ -67,7 +67,7 @@ LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # For now, disable these lint checks; maintainers should endeavor diff --git a/usr/src/uts/sparc/scsi/Makefile b/usr/src/uts/sparc/scsi/Makefile index 54479da2f5..1d464fca09 100644 --- a/usr/src/uts/sparc/scsi/Makefile +++ b/usr/src/uts/sparc/scsi/Makefile @@ -72,7 +72,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/scsi_vhci/Makefile b/usr/src/uts/sparc/scsi_vhci/Makefile index 9213f4ff57..fbe826d733 100644 --- a/usr/src/uts/sparc/scsi_vhci/Makefile +++ b/usr/src/uts/sparc/scsi_vhci/Makefile @@ -49,7 +49,7 @@ CONF_SRCDIR = $(UTSBASE)/common/io/scsi/adapters/scsi_vhci include $(UTSBASE)/sparc/Makefile.sparc CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-label # diff --git a/usr/src/uts/sparc/semsys/Makefile b/usr/src/uts/sparc/semsys/Makefile index d7ffa310bd..9f7dba60b4 100644 --- a/usr/src/uts/sparc/semsys/Makefile +++ b/usr/src/uts/sparc/semsys/Makefile @@ -71,7 +71,7 @@ LDFLAGS += -dy -Nmisc/ipc LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/sfe/Makefile b/usr/src/uts/sparc/sfe/Makefile index 235f9df0b7..ff245466d1 100644 --- a/usr/src/uts/sparc/sfe/Makefile +++ b/usr/src/uts/sparc/sfe/Makefile @@ -76,7 +76,7 @@ CFLAGS += $(CPPFLAGS) CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Driver depends on MAC & IP diff --git a/usr/src/uts/sparc/sgen/Makefile b/usr/src/uts/sparc/sgen/Makefile index 723344d539..c342af394e 100644 --- a/usr/src/uts/sparc/sgen/Makefile +++ b/usr/src/uts/sparc/sgen/Makefile @@ -74,7 +74,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/sha2/Makefile b/usr/src/uts/sparc/sha2/Makefile index e9d255252d..df8e453ddc 100644 --- a/usr/src/uts/sparc/sha2/Makefile +++ b/usr/src/uts/sparc/sha2/Makefile @@ -72,7 +72,7 @@ CFLAGS += $(CCVERBOSE) -I$(COM_DIR) LINTFLAGS += -I$(COM_DIR) CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/smbfs/Makefile b/usr/src/uts/sparc/smbfs/Makefile index 9525c70171..346972e300 100644 --- a/usr/src/uts/sparc/smbfs/Makefile +++ b/usr/src/uts/sparc/smbfs/Makefile @@ -68,7 +68,7 @@ LDFLAGS += -dy -Ndrv/nsmb # Until CR 4994570 is fixed... LINTTAGS += -erroff=E_BAD_FORMAT_ARG_TYPE2 CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # The mb_put/md_get functions are intentionally used with and without # return value checks, so filter those out like LGREP.2 does. diff --git a/usr/src/uts/sparc/socal/Makefile b/usr/src/uts/sparc/socal/Makefile index fa38e547c5..e79fdc9bd2 100644 --- a/usr/src/uts/sparc/socal/Makefile +++ b/usr/src/uts/sparc/socal/Makefile @@ -73,7 +73,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/sockfs/Makefile b/usr/src/uts/sparc/sockfs/Makefile index 1b9600ab01..d2d43d640a 100644 --- a/usr/src/uts/sparc/sockfs/Makefile +++ b/usr/src/uts/sparc/sockfs/Makefile @@ -92,7 +92,7 @@ CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/sockpfp/Makefile b/usr/src/uts/sparc/sockpfp/Makefile index d01d241549..21e526a81b 100644 --- a/usr/src/uts/sparc/sockpfp/Makefile +++ b/usr/src/uts/sparc/sockpfp/Makefile @@ -69,7 +69,7 @@ INC_PATH += -I$(UTSBASE)/common/inet/sockmods -I$(UTSBASE)/common/io/bpf LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-label # diff --git a/usr/src/uts/sparc/socksctp/Makefile b/usr/src/uts/sparc/socksctp/Makefile index 066cfd9982..50ce165fd1 100644 --- a/usr/src/uts/sparc/socksctp/Makefile +++ b/usr/src/uts/sparc/socksctp/Makefile @@ -70,7 +70,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/socksdp/Makefile b/usr/src/uts/sparc/socksdp/Makefile index 0b2ca3d837..746f8c90c5 100644 --- a/usr/src/uts/sparc/socksdp/Makefile +++ b/usr/src/uts/sparc/socksdp/Makefile @@ -60,7 +60,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) LDFLAGS += -dy -Nfs/sockfs -Ndrv/ip -Ndrv/sdpib diff --git a/usr/src/uts/sparc/softmac/Makefile b/usr/src/uts/sparc/softmac/Makefile index 23a54a8098..dc9a3f53de 100644 --- a/usr/src/uts/sparc/softmac/Makefile +++ b/usr/src/uts/sparc/softmac/Makefile @@ -62,7 +62,7 @@ LDFLAGS += -dy -Ndrv/dld -Nmisc/mac -Nmisc/strplumb -Nmisc/dls # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-label # diff --git a/usr/src/uts/sparc/sol_ofs/Makefile b/usr/src/uts/sparc/sol_ofs/Makefile index 31d0f9ca94..1b2c55fd77 100644 --- a/usr/src/uts/sparc/sol_ofs/Makefile +++ b/usr/src/uts/sparc/sol_ofs/Makefile @@ -59,7 +59,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_STATIC_UNUSED LINTTAGS += -erroff=E_CONST_TRUNCATED_BY_ASSIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/sparc/sol_umad/Makefile b/usr/src/uts/sparc/sol_umad/Makefile index e1774a2943..8e7dcaa7ef 100644 --- a/usr/src/uts/sparc/sol_umad/Makefile +++ b/usr/src/uts/sparc/sol_umad/Makefile @@ -56,7 +56,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # INCLUDE_PATH += -I$(UTSBASE)/common/sys/ib/clients/of/sol_umad -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/spdsock/Makefile b/usr/src/uts/sparc/spdsock/Makefile index 6ed0ae89d2..8bda6fa848 100644 --- a/usr/src/uts/sparc/spdsock/Makefile +++ b/usr/src/uts/sparc/spdsock/Makefile @@ -74,7 +74,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/specfs/Makefile b/usr/src/uts/sparc/specfs/Makefile index bcb97f9b53..07a23b1309 100644 --- a/usr/src/uts/sparc/specfs/Makefile +++ b/usr/src/uts/sparc/specfs/Makefile @@ -66,7 +66,7 @@ CFLAGS += $(CCVERBOSE) LDFLAGS += -dy -Nfs/fifofs CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/sppp/Makefile b/usr/src/uts/sparc/sppp/Makefile index 287dd71ea5..c281897458 100644 --- a/usr/src/uts/sparc/sppp/Makefile +++ b/usr/src/uts/sparc/sppp/Makefile @@ -78,7 +78,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/spppcomp/Makefile b/usr/src/uts/sparc/spppcomp/Makefile index b1da4d5dda..7f603cc521 100644 --- a/usr/src/uts/sparc/spppcomp/Makefile +++ b/usr/src/uts/sparc/spppcomp/Makefile @@ -75,7 +75,7 @@ LDFLAGS += -dy -N drv/sppp CLEANLINTFILES += $(LINT64_FILES) CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # For now, disable these lint checks; maintainers should endeavor diff --git a/usr/src/uts/sparc/sppptun/Makefile b/usr/src/uts/sparc/sppptun/Makefile index 488d6cf6b0..94776f4695 100644 --- a/usr/src/uts/sparc/sppptun/Makefile +++ b/usr/src/uts/sparc/sppptun/Makefile @@ -81,7 +81,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/ssd/Makefile b/usr/src/uts/sparc/ssd/Makefile index 47159b3ba3..108607f00b 100644 --- a/usr/src/uts/sparc/ssd/Makefile +++ b/usr/src/uts/sparc/ssd/Makefile @@ -78,7 +78,7 @@ LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits # diff --git a/usr/src/uts/sparc/st/Makefile b/usr/src/uts/sparc/st/Makefile index 21f51215d6..d36ea2464a 100644 --- a/usr/src/uts/sparc/st/Makefile +++ b/usr/src/uts/sparc/st/Makefile @@ -76,7 +76,7 @@ LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/stmf/Makefile b/usr/src/uts/sparc/stmf/Makefile index 50ec544cbb..f32c38fab7 100644 --- a/usr/src/uts/sparc/stmf/Makefile +++ b/usr/src/uts/sparc/stmf/Makefile @@ -67,7 +67,7 @@ C99LMODE= -Xc99=%all LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_STATIC_UNUSED -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/sparc/stmf_sbd/Makefile b/usr/src/uts/sparc/stmf_sbd/Makefile index 4259f16b69..bbee85d605 100644 --- a/usr/src/uts/sparc/stmf_sbd/Makefile +++ b/usr/src/uts/sparc/stmf_sbd/Makefile @@ -73,7 +73,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/tavor/Makefile b/usr/src/uts/sparc/tavor/Makefile index 7bd88686ea..e5fe4d0452 100644 --- a/usr/src/uts/sparc/tavor/Makefile +++ b/usr/src/uts/sparc/tavor/Makefile @@ -84,7 +84,7 @@ LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits # diff --git a/usr/src/uts/sparc/tem/Makefile b/usr/src/uts/sparc/tem/Makefile index 1a9dcb12e1..12d9741c56 100644 --- a/usr/src/uts/sparc/tem/Makefile +++ b/usr/src/uts/sparc/tem/Makefile @@ -69,7 +69,7 @@ LDFLAGS += -dy -Ndacf/consconfig_dacf LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/tl/Makefile b/usr/src/uts/sparc/tl/Makefile index b63d5cb165..21104104ce 100644 --- a/usr/src/uts/sparc/tl/Makefile +++ b/usr/src/uts/sparc/tl/Makefile @@ -79,7 +79,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/tmpfs/Makefile b/usr/src/uts/sparc/tmpfs/Makefile index 7a74a3d693..42ec7b74c6 100644 --- a/usr/src/uts/sparc/tmpfs/Makefile +++ b/usr/src/uts/sparc/tmpfs/Makefile @@ -70,7 +70,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-value # diff --git a/usr/src/uts/sparc/tnf/Makefile b/usr/src/uts/sparc/tnf/Makefile index 5c4f539671..f450067556 100644 --- a/usr/src/uts/sparc/tnf/Makefile +++ b/usr/src/uts/sparc/tnf/Makefile @@ -71,7 +71,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/trill/Makefile b/usr/src/uts/sparc/trill/Makefile index 11e1f1202e..0a4229f9be 100644 --- a/usr/src/uts/sparc/trill/Makefile +++ b/usr/src/uts/sparc/trill/Makefile @@ -48,7 +48,7 @@ ROOTMODULE = $(ROOT_SOCK_DIR)/$(MODULE) # include $(UTSBASE)/sparc/Makefile.sparc -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Define targets diff --git a/usr/src/uts/sparc/ttymux/Makefile b/usr/src/uts/sparc/ttymux/Makefile deleted file mode 100644 index e798f51c21..0000000000 --- a/usr/src/uts/sparc/ttymux/Makefile +++ /dev/null @@ -1,117 +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 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -# -# This makefile drives the production of the ttymux driver -# kernel module. -# -# sparc implementation architecture dependent -# - -# -# Path to the base of the uts directory tree (usually /usr/src/uts). -# -UTSBASE = ../.. - -# -# Define the module and object file sets. -# -MODULE = ttymux -OBJECTS = $(TTYMUX_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(TTYMUX_OBJS:%.o=$(LINTS_DIR)/%.ln) -ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE) - -# -# Include common rules. -# -include $(UTSBASE)/sparc/Makefile.sparc - -# -#Overrides -# -ALL_BUILDS = $(ALL_BUILDSONLY64) -DEF_BUILDS = $(DEF_BUILDSONLY64) -CLEANLINTFILES += $(LINT32_FILES) - -# -# Define targets -# -ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint -INSTALL_TARGET = $(BINARY) $(ROOTMODULE) - -# -# Override defaults to build a unique, local modstubs.o. -# -MODSTUBS_DIR = $(OBJS_DIR) -$(MODSTUBS_O) := AS_CPPFLAGS += -DTTYMUX_MODULE -CLEANFILES += $(MODSTUBS_O) - - -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) - -# -# For now, disable these lint checks; maintainers should endeavor -# to investigate and remove these for maximum lint coverage. -# Please do not carry these forward to new Makefiles. -# -LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON - -CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized -CERRWARN += -_gcc=-Wno-type-limits - -# -# Default build targets. -# -.KEEP_STATE: - -def: $(DEF_DEPS) - -all: $(ALL_DEPS) - -clean: $(CLEAN_DEPS) - -clobber: $(CLOBBER_DEPS) - -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) lint32 - -clean.lint: $(CLEAN_LINT_DEPS) - -install: $(INSTALL_DEPS) - -# -# Include common targets. -# -include $(UTSBASE)/sparc/Makefile.targ diff --git a/usr/src/uts/sparc/udfs/Makefile b/usr/src/uts/sparc/udfs/Makefile index 93b7278ee3..a47ed38860 100644 --- a/usr/src/uts/sparc/udfs/Makefile +++ b/usr/src/uts/sparc/udfs/Makefile @@ -81,7 +81,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits # diff --git a/usr/src/uts/sparc/ufs/Makefile b/usr/src/uts/sparc/ufs/Makefile index d49a878102..0e13f2371f 100644 --- a/usr/src/uts/sparc/ufs/Makefile +++ b/usr/src/uts/sparc/ufs/Makefile @@ -78,7 +78,7 @@ CFLAGS += $(CCVERBOSE) LDFLAGS += -dy -Nfs/specfs -Nmisc/fssnap_if CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-unused-label diff --git a/usr/src/uts/sparc/ugen/Makefile b/usr/src/uts/sparc/ugen/Makefile index 3b494749cc..49918eeb70 100644 --- a/usr/src/uts/sparc/ugen/Makefile +++ b/usr/src/uts/sparc/ugen/Makefile @@ -53,7 +53,7 @@ include $(UTSBASE)/sparc/Makefile.sparc # lint pass one enforcement # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # depends on misc/usba diff --git a/usr/src/uts/sparc/uhci/Makefile b/usr/src/uts/sparc/uhci/Makefile index efd8d429f8..6895a2e161 100644 --- a/usr/src/uts/sparc/uhci/Makefile +++ b/usr/src/uts/sparc/uhci/Makefile @@ -66,7 +66,7 @@ ALL_TARGET = $(BINARY) $(SRC_CONFFILE) LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # For now, disable these lint checks; maintainers should endeavor diff --git a/usr/src/uts/sparc/usb_ac/Makefile b/usr/src/uts/sparc/usb_ac/Makefile index 1cb5902777..5915676942 100644 --- a/usr/src/uts/sparc/usb_ac/Makefile +++ b/usr/src/uts/sparc/usb_ac/Makefile @@ -66,7 +66,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # For now, disable these lint checks; maintainers should endeavor diff --git a/usr/src/uts/sparc/usb_ah/Makefile b/usr/src/uts/sparc/usb_ah/Makefile index d01c42d896..7ab174b77b 100644 --- a/usr/src/uts/sparc/usb_ah/Makefile +++ b/usr/src/uts/sparc/usb_ah/Makefile @@ -64,7 +64,7 @@ ALL_TARGET = $(BINARY) LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # For now, disable these lint checks; maintainers should endeavor diff --git a/usr/src/uts/sparc/usba/Makefile b/usr/src/uts/sparc/usba/Makefile index e90778e3ac..8443b068e5 100644 --- a/usr/src/uts/sparc/usba/Makefile +++ b/usr/src/uts/sparc/usba/Makefile @@ -51,7 +51,7 @@ include $(UTSBASE)/sparc/Makefile.sparc # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-label diff --git a/usr/src/uts/sparc/usbftdi/Makefile b/usr/src/uts/sparc/usbftdi/Makefile index 8a7e1b41d9..9e793402e4 100644 --- a/usr/src/uts/sparc/usbftdi/Makefile +++ b/usr/src/uts/sparc/usbftdi/Makefile @@ -46,7 +46,7 @@ CONF_SRCDIR = $(UTSBASE)/common/io/usb/clients/usbser/usbftdi # include $(UTSBASE)/sparc/Makefile.sparc -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) LDFLAGS += -dy -Nmisc/usba -Nmisc/usbser diff --git a/usr/src/uts/sparc/usbms/Makefile b/usr/src/uts/sparc/usbms/Makefile index 9223ef56a9..6d4be539a3 100644 --- a/usr/src/uts/sparc/usbms/Makefile +++ b/usr/src/uts/sparc/usbms/Makefile @@ -66,7 +66,7 @@ LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # For now, disable these lint checks; maintainers should endeavor diff --git a/usr/src/uts/sparc/usbsacm/Makefile b/usr/src/uts/sparc/usbsacm/Makefile index 3805e59c8b..6655e2b194 100644 --- a/usr/src/uts/sparc/usbsacm/Makefile +++ b/usr/src/uts/sparc/usbsacm/Makefile @@ -52,7 +52,7 @@ CFLAGS += $(CCVERBOSE) LDFLAGS += -dy -Nmisc/usba -Nmisc/usbser -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Define targets diff --git a/usr/src/uts/sparc/usbser/Makefile b/usr/src/uts/sparc/usbser/Makefile index 56f053c4cb..7f7c072d46 100644 --- a/usr/src/uts/sparc/usbser/Makefile +++ b/usr/src/uts/sparc/usbser/Makefile @@ -70,7 +70,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label diff --git a/usr/src/uts/sparc/usbsksp/Makefile b/usr/src/uts/sparc/usbsksp/Makefile index 951860f774..3172890fca 100644 --- a/usr/src/uts/sparc/usbsksp/Makefile +++ b/usr/src/uts/sparc/usbsksp/Makefile @@ -85,4 +85,4 @@ install: $(INSTALL_DEPS) # include $(UTSBASE)/sparc/Makefile.targ -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) diff --git a/usr/src/uts/sparc/usbsprl/Makefile b/usr/src/uts/sparc/usbsprl/Makefile index 6ecac0694f..a5e3449d2e 100644 --- a/usr/src/uts/sparc/usbsprl/Makefile +++ b/usr/src/uts/sparc/usbsprl/Makefile @@ -51,7 +51,7 @@ include $(UTSBASE)/sparc/Makefile.sparc # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) LDFLAGS += -dy -Nmisc/usba -Nmisc/usbser diff --git a/usr/src/uts/sparc/usbvc/Makefile b/usr/src/uts/sparc/usbvc/Makefile index eb747fe312..876c334829 100644 --- a/usr/src/uts/sparc/usbvc/Makefile +++ b/usr/src/uts/sparc/usbvc/Makefile @@ -67,7 +67,7 @@ ALL_TARGET = $(BINARY) LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Disable this because it is necessary for this driver diff --git a/usr/src/uts/sparc/usbwcm/Makefile b/usr/src/uts/sparc/usbwcm/Makefile index 9549f2bdc3..05e339f96f 100644 --- a/usr/src/uts/sparc/usbwcm/Makefile +++ b/usr/src/uts/sparc/usbwcm/Makefile @@ -66,7 +66,7 @@ LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # For now, disable these lint checks; maintainers should endeavor diff --git a/usr/src/uts/sparc/vnic/Makefile b/usr/src/uts/sparc/vnic/Makefile index 9be92ea9bc..4eb75ef18b 100644 --- a/usr/src/uts/sparc/vnic/Makefile +++ b/usr/src/uts/sparc/vnic/Makefile @@ -55,7 +55,7 @@ CFLAGS += $(CCVERBOSE) LDFLAGS += -dy -Ndrv/dld -Nmisc/mac -Nmisc/dls CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sparc/vr/Makefile b/usr/src/uts/sparc/vr/Makefile index 5679a7d12b..567d4c4f6b 100644 --- a/usr/src/uts/sparc/vr/Makefile +++ b/usr/src/uts/sparc/vr/Makefile @@ -58,7 +58,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Driver depends on GLD diff --git a/usr/src/uts/sparc/vuid3ps2/Makefile b/usr/src/uts/sparc/vuid3ps2/Makefile index 7c2dd06c67..ad7ce36c5b 100644 --- a/usr/src/uts/sparc/vuid3ps2/Makefile +++ b/usr/src/uts/sparc/vuid3ps2/Makefile @@ -48,7 +48,7 @@ ROOTMODULE = $(ROOT_STRMOD_DIR)/$(MODULE) # include $(UTSBASE)/sparc/Makefile.sparc -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # diff --git a/usr/src/uts/sparc/wc/Makefile b/usr/src/uts/sparc/wc/Makefile index 2e6438cff9..37482ac950 100644 --- a/usr/src/uts/sparc/wc/Makefile +++ b/usr/src/uts/sparc/wc/Makefile @@ -61,7 +61,7 @@ MODSTUBS_DIR = $(OBJS_DIR) $(MODSTUBS_O) := AS_CPPFLAGS += -DWC_MODULE CLEANFILES += $(MODSTUBS_O) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # lint pass one enforcement diff --git a/usr/src/uts/sparc/xge/Makefile b/usr/src/uts/sparc/xge/Makefile index 422a552783..5a252dc13d 100644 --- a/usr/src/uts/sparc/xge/Makefile +++ b/usr/src/uts/sparc/xge/Makefile @@ -110,7 +110,7 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-empty-body -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # diff --git a/usr/src/uts/sparc/zut/Makefile b/usr/src/uts/sparc/zut/Makefile index 23db5c4405..1ec757e8e8 100644 --- a/usr/src/uts/sparc/zut/Makefile +++ b/usr/src/uts/sparc/zut/Makefile @@ -72,7 +72,7 @@ C99LMODE= -Xc99=%all LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun/Makefile.files b/usr/src/uts/sun/Makefile.files index b8a819672b..d31bda8f11 100644 --- a/usr/src/uts/sun/Makefile.files +++ b/usr/src/uts/sun/Makefile.files @@ -22,6 +22,7 @@ # # Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. +# Copyright 2019 Peter Tribble. # # uts/sun/Makefile.files # @@ -67,19 +68,13 @@ DADA_OBJS += dcd_hba.o dcd_transport.o \ SSD_OBJS += sd.o sd_xbuf.o -WSDRV_OBJS += wsdrv.o +WSDRV_OBJS += wsdrv.o ZS_OBJS += zs_async.o zs_common.o ZSH_OBJS += zs_hdlc.o # -# streams modules -# - -TTYMUX_OBJS += ttymux.o ttymux_ioctl.o - -# # Section 3: Misc. # LINT_DEFS += -Dsun diff --git a/usr/src/uts/sun/Makefile.rules b/usr/src/uts/sun/Makefile.rules index ed0d87a09b..3394bde438 100644 --- a/usr/src/uts/sun/Makefile.rules +++ b/usr/src/uts/sun/Makefile.rules @@ -22,6 +22,7 @@ # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. +# Copyright 2019 Peter Tribble. # # uts/sun/Makefile.rules # @@ -53,10 +54,6 @@ $(OBJS_DIR)/%.o: $(UTSBASE)/sun/io/eri/%.c $(COMPILE.c) -o $@ $< $(CTFCONVERT_O) -$(OBJS_DIR)/%.o: $(UTSBASE)/sun/io/ttymux/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - $(OBJS_DIR)/%.o: $(UTSBASE)/sun/io/dada/conf/%.c $(COMPILE.c) -o $@ $< $(CTFCONVERT_O) @@ -77,7 +74,7 @@ $(OBJS_DIR)/%.o: $(UTSBASE)/sun/io/scsi/targets/%.c $(COMPILE.c) -I. -o $@ $< $(CTFCONVERT_O) -$(OBJS_DIR)/%.o: $(UTSBASE)/common/io/scsi/adapters/%.c +$(OBJS_DIR)/%.o: $(UTSBASE)/common/io/scsi/adapters/%.c $(COMPILE.c) -o $@ $< $(CTFCONVERT_O) @@ -110,6 +107,3 @@ $(LINTS_DIR)/%.ln: $(UTSBASE)/sun/io/dada/targets/%.c $(LINTS_DIR)/%.ln: $(UTSBASE)/common/io/scsi/adapters/%.c @($(LHEAD) $(LINT.c) $< $(LTAIL)) - -$(LINTS_DIR)/%.ln: $(UTSBASE)/sun/io/ttymux/%.c - @($(LHEAD) $(LINT.c) $< $(LTAIL)) diff --git a/usr/src/uts/sun/io/ttymux/ttymux.c b/usr/src/uts/sun/io/ttymux/ttymux.c deleted file mode 100644 index 22862fe8d9..0000000000 --- a/usr/src/uts/sun/io/ttymux/ttymux.c +++ /dev/null @@ -1,2879 +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 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - -/* - * DESCRIPTION - * - * ttymux - Multiplexer driver for multiplexing termio compliant streams onto - * a single upper stream. - * - * ADD2FRONT macro can be used to specify the order in which a console - * device is put in the queue of multiplexed physical serial devices, - * during the association and disassociation of a console interface. - * When this macro is defined, the device is placed in front of the queue, - * otherwise by default it is placed at the end. - * Console I/O happens to each of the physical devices in the order of - * their position in this queue. - */ - -#include <sys/types.h> -#include <sys/file.h> -#include <sys/stream.h> -#include <sys/strsubr.h> -#include <sys/strlog.h> -#include <sys/strsun.h> -#include <sys/modctl.h> -#include <sys/debug.h> -#include <sys/kbio.h> -#include <sys/devops.h> -#include <sys/errno.h> -#include <sys/stat.h> -#include <sys/kmem.h> -#include <sys/ddi.h> -#include <sys/consdev.h> -#include <sys/tty.h> -#include <sys/ptyvar.h> -#include <sys/termio.h> -#include <sys/fcntl.h> -#include <sys/mkdev.h> -#include <sys/ser_sync.h> -#include <sys/esunddi.h> -#include <sys/policy.h> - -#include <sys/ttymux.h> -#include "ttymux_impl.h" - -/* - * Extern declarations - */ -extern mblk_t *mkiocb(uint_t); -extern int nulldev(); -extern uintptr_t space_fetch(char *key); - -extern int sm_ioctl_cmd(sm_uqi_t *, mblk_t *); -extern int ttymux_abort_ioctl(mblk_t *); -extern int ttymux_device_fini(sm_lqi_t *); -extern int ttymux_device_init(sm_lqi_t *); - -/* - * Exported interfaces - */ -int sm_disassociate(int, sm_lqi_t *, ulong_t); -int sm_associate(int, sm_lqi_t *, ulong_t, uint_t, char *); - -/* - * Variables defined here and visible only internally - */ -sm_ss_t *sm_ssp = 0; -static int sm_instance = 0; -static int smctlunit; - -static uint_t sm_default_trflag = 0; -uint_t sm_max_units = 6; -uint_t sm_minor_cnt = 0; -static uint_t sm_refuse_opens = 0; - -/* - * Local definitions. - */ - -/* force these flags to be unset on console devices */ -static ulong_t sm_cmask = (ulong_t)(CRTSXOFF|CRTSCTS); - -/* - * SECTION - * Implementation Section: - */ -void -sm_debug(char *msg, ...) -{ - va_list args; - char buf[256]; - int sz; - - va_start(args, msg); - sz = vsnprintf(buf, sizeof (buf), msg, args); - va_end(args); - - if (sz < 0) - (void) strlog(ddi_driver_major(sm_ssp->sm_dip), sm_instance, 1, - SL_TRACE, "vsnprintf parse error\n"); - else if (sz > sizeof (buf)) { - char *b; - size_t len = sz + 1; - - b = kmem_alloc(len, KM_SLEEP); - va_start(args, msg); - sz = vsnprintf(b, len, msg, args); - va_end(args); - if (sz > 0) - (void) strlog(ddi_driver_major(sm_ssp->sm_dip), - sm_instance, 1, SL_TRACE, b); - kmem_free(b, len); - } else { - - (void) strlog(ddi_driver_major(sm_ssp->sm_dip), sm_instance, - 1, SL_TRACE, buf); - } -} - -void -sm_log(char *msg, ...) -{ - va_list args; - char buf[128]; - int sz; - - va_start(args, msg); - sz = vsnprintf(buf, sizeof (buf), msg, args); - va_end(args); - - if (sz < 0) - (void) strlog(ddi_driver_major(sm_ssp->sm_dip), sm_instance, 1, - SL_TRACE, "vsnprintf parse error\n"); - else if (sz > sizeof (buf)) { - char *b; - size_t len = sz + 1; - - b = kmem_alloc(len, KM_SLEEP); - va_start(args, msg); - sz = vsnprintf(b, len, msg, args); - va_end(args); - if (sz > 0) - (void) strlog(ddi_driver_major(sm_ssp->sm_dip), - sm_instance, 1, SL_NOTE, b); - kmem_free(b, len); - } else { - - (void) strlog(ddi_driver_major(sm_ssp->sm_dip), sm_instance, - 1, SL_NOTE, buf); - } -} - -/* - * Should only be called if the caller can guarantee that the vnode - * and/or the stream won't disappear while finding the dip. - * This routine is only called during an I_PLINK request so it's safe. - * The routine obtains the dev_t for a linked se stream. - */ -static void -sm_setdip(queue_t *q, sm_lqi_t *lqi) -{ - lqi->sm_dev = q && STREAM(q) ? STREAM(q)->sd_vnode->v_rdev : NODEV; -} - -/* - * Called from driver close, state change reports and I_PUNLINK ioctl. - * A lower stream has been unlinked - clean up the state associated with it. - */ -void -sm_lqifree(sm_lqi_t *lqi) -{ - int mu_owned; - sm_lqi_t **pplqi; - - ASSERT(mutex_owned(lqi->sm_umutex)); - ASSERT(SM_RQ(lqi) != 0); - - /* - * Clear all state associated with this lower queue except - * the identity of the queues themselves and the link id which - * can only be cleared by issuing a streams I_PUNLINK ioctl. - * - * The association of a lower queue is a two step process: - * 1. initialise the lower q data structure on I_PLINK - * 2. associate an upper q with the lower q on SM_CMD_ASSOCIATE. - * - * If step 2 has ocurred then - * remove this lower queue info from the logical unit. - */ - if (lqi->sm_uqi) { - sm_dbg('Y', ("lqifree unit %d, ", lqi->sm_uqi->sm_lunit)); - if ((mu_owned = mutex_owned(lqi->sm_uqi->sm_umutex)) == 0) - LOCK_UNIT(lqi->sm_uqi); - - pplqi = &lqi->sm_uqi->sm_lqs; - while (*pplqi != lqi) { - ASSERT(*pplqi); - pplqi = &((*pplqi)->sm_nlqi); - } - *pplqi = lqi->sm_nlqi; - lqi->sm_uqi->sm_nlqs--; - - if (mu_owned == 0) - UNLOCK_UNIT(lqi->sm_uqi); - - lqi->sm_uqi = 0; - } -} - -/* - * Given a q return the associated lower queue data structure or NULL. - * Return the data locked. - */ -static sm_lqi_t * -get_lqi_byq(queue_t *q) -{ - int i; - sm_lqi_t *lqi, *flqi = 0; - - for (i = 0; i < MAX_LQS; i++) { - lqi = &sm_ssp->sm_lqs[i]; - LOCK_UNIT(lqi); - if (flqi == 0 && lqi->sm_linkid == 0) /* assumes muxids != 0 */ - flqi = lqi; - else if (SM_RQ(lqi) == q || SM_WQ(lqi) == q) { - if (flqi) - UNLOCK_UNIT(flqi); - return (lqi); - } - else - UNLOCK_UNIT(lqi); - } - return (flqi); -} - -/* - * Given a streams link identifier return the associated lower queue data - * structure or NULL. - */ -sm_lqi_t * -get_lqi_byid(int linkid) -{ - int i; - sm_lqi_t *lqi; - - if (linkid == 0) - return (NULL); - for (i = 0; i < MAX_LQS; i++) { - lqi = &sm_ssp->sm_lqs[i]; - if (lqi->sm_linkid == linkid) - return (lqi); - } - return (NULL); -} - -/* - * Given a dev_t for a lower stream return the associated lower queue data - * structure or NULL. - */ -sm_lqi_t * -get_lqi_bydevt(dev_t dev) -{ - int i; - sm_lqi_t *lqi; - - if (dev == NODEV) - return (NULL); - - for (i = 0; i < MAX_LQS; i++) { - lqi = &sm_ssp->sm_lqs[i]; - if (lqi->sm_dev == dev) - return (lqi); - } - return (NULL); -} - -/* - * Determine whether the input flag is set on at least - * howmany queues. - */ -static int -sm_is_flag_set(sm_uqi_t *uqi, uint_t flag, uint_t howmany) -{ - sm_lqi_t *lqi; - - if (howmany == 0) - return (0); - - for (lqi = uqi->sm_lqs; lqi; lqi = lqi->sm_nlqi) { - if (lqi->sm_flags & flag) - if (--howmany == 0) - return (1); - } - return (0); -} - -/* - * How many usable queues are associated with a given upper stream - */ -static int -sm_uwq_error(sm_uqi_t *uqi) -{ - return (sm_is_flag_set(uqi, (WERROR_MODE|HANGUP_MODE), uqi->sm_nlqs)); -} - -/* - * How many of the queues associated with a given upper stream - * - do not - have the given flags set. - */ -static int -sm_q_count(sm_uqi_t *uqi, uint_t flag) -{ - sm_lqi_t *lqi; - int count = 0; - - for (lqi = uqi->sm_lqs; lqi; lqi = lqi->sm_nlqi) { - if ((lqi->sm_flags & flag) == 0) - count++; - } - return (count); -} - -/* - * How many of the queues associated with a given upper stream - * - do not - have the given flags set. - */ -static int -sm_qs_without(sm_uqi_t *uqi, uint_t flag, uint_t ioflag) -{ - sm_lqi_t *lqi; - int count = 0; - - for (lqi = uqi->sm_lqs; lqi; lqi = lqi->sm_nlqi) { - if ((lqi->sm_flags & flag) == 0 && - (lqi->sm_ioflag & ioflag) == 0) - count++; - } - return (count); -} - -/* - * How many usable queues are associated with a given upper stream - */ -static int -sm_good_qs(sm_uqi_t *uqi) -{ - return (sm_q_count(uqi, (WERROR_MODE|HANGUP_MODE))); -} - -static int -sm_cnt_oqs(sm_uqi_t *uqi) -{ - return (sm_qs_without(uqi, (WERROR_MODE|HANGUP_MODE), - (uint_t)FOROUTPUT)); -} - -/* - * Send an ioctl downstream and remember that it was sent so that - * its response can be caught on the way back up. - */ -static void -sm_issue_ioctl(void *arg) -{ - sm_lqi_t *lqi = arg; - uint_t cmdflag = 0; - queue_t *q = SM_WQ(lqi); - int iocmd, size; - - LOCK_UNIT(lqi); - - lqi->sm_bid = 0; - if ((lqi->sm_flags & (WERROR_MODE|HANGUP_MODE)) == 0 && - (lqi->sm_flags & (WANT_CDSTAT|WANT_TCSET))) { - mblk_t *pioc; - - if (lqi->sm_flags & WANT_TCSET) { - lqi->sm_flags &= ~WANT_TCSET; - iocmd = TCSETS; - cmdflag = WANT_TCSET; - } else if (lqi->sm_flags & WANT_SC) { - lqi->sm_flags &= ~WANT_SC; - iocmd = TIOCGSOFTCAR; - cmdflag = WANT_SC; - } else if (lqi->sm_flags & WANT_CD) { - lqi->sm_flags &= ~WANT_CD; - iocmd = TIOCMGET; - } else if (lqi->sm_flags & WANT_CL) { - lqi->sm_flags &= ~WANT_CL; - iocmd = TCGETS; - cmdflag = WANT_CL; - } else { - UNLOCK_UNIT(lqi); - return; - } - - if (pioc = mkiocb(iocmd)) { - if (cmdflag == WANT_TCSET) { - pioc->b_cont = - sm_allocb(sizeof (struct termios), - BPRI_MED); - if (pioc->b_cont == 0) { - freemsg(pioc); - pioc = 0; - } else { - struct termios *tc = (struct termios *) - pioc->b_cont->b_wptr; - - bzero((caddr_t)tc, - sizeof (struct termios)); - tc->c_cflag = lqi->sm_ttycommon-> - t_cflag; - pioc->b_cont->b_rptr = - pioc->b_cont->b_wptr; - pioc->b_cont->b_wptr += - sizeof (struct termios); - } - size = sizeof (struct iocblk) + - sizeof (struct termios); - } - else - size = sizeof (struct iocblk); - } - else - size = sizeof (struct iocblk); - - if (pioc != 0) { - - lqi->sm_piocid = ((struct iocblk *)pioc->b_rptr)-> - ioc_id; - lqi->sm_flags |= SM_IOCPENDING; - - /* lqi->sm_flags |= cmdflag; */ - UNLOCK_UNIT(lqi); - (void) putq(q, pioc); - } else { - UNLOCK_UNIT(lqi); - lqi->sm_bid = qbufcall(WR(q), size, BPRI_MED, - sm_issue_ioctl, lqi); - } - } - else - UNLOCK_UNIT(lqi); -} - -/* - * Associate one of the drivers minor nodes with a serial device. - */ -int -sm_associate(int unit, sm_lqi_t *plqi, ulong_t tag, uint_t ioflag, char *dp) -{ - sm_uqi_t *uqi; - int rval = 0; - - sm_dbg('Y', ("sm_associate(%d, %d, %d): ", - (plqi) ? plqi->sm_linkid : 0, unit, ioflag)); - /* - * Check the data is valid. - * Associate a lower queue with a logical unit. - */ - - if (unit < 0 || unit >= NLUNITS || plqi == 0 || - (uqi = get_uqi(sm_ssp, unit)) == 0) { - sm_dbg('@', (" invalid: lqi=0x%p lui=0x%p:", plqi, uqi)); - rval = EINVAL; - } else { - if ((ioflag & FORIO) == 0) - ioflag = FORIO; - - LOCK_UNIT(plqi); - - if (plqi->sm_uqi) { - if (plqi->sm_uqi->sm_lunit == unit) { - if ((ioflag & (uint_t)FORIO) != 0) - plqi->sm_ioflag = - (ioflag & (uint_t)FORIO); - rval = 0; - } else { - sm_dbg('@', ("already associated with unit %d:", - plqi->sm_uqi->sm_lunit)); - rval = EINVAL; - } - } else { - - LOCK_UNIT(uqi); - - if ((ioflag & (uint_t)FORIO) != 0) - plqi->sm_ioflag = (ioflag & (uint_t)FORIO); - - plqi->sm_ttycommon->t_cflag = uqi->sm_ttycommon-> - t_cflag; - plqi->sm_ttycommon->t_flags = uqi->sm_ttycommon-> - t_flags; - plqi->sm_uqi = uqi; - plqi->sm_mbits = 0; - plqi->sm_tag = tag; - - if (*dp == '/') - (void) strncpy(plqi->sm_path, dp, MAXPATHLEN); - else - *(plqi->sm_path) = '\0'; - - plqi->sm_flags |= WANT_TCSET; -#ifdef ADD2FRONT - plqi->sm_nlqi = uqi->sm_lqs; - uqi->sm_lqs = plqi; -#else - plqi->sm_nlqi = 0; - if (uqi->sm_lqs) { - sm_lqi_t *lq; - for (lq = uqi->sm_lqs; lq->sm_nlqi; - lq = lq->sm_nlqi) { - } - lq->sm_nlqi = plqi; - } else - uqi->sm_lqs = plqi; -#endif - uqi->sm_nlqs++; - - (void) ttymux_device_init(plqi); - - UNLOCK_UNIT(uqi); - rval = 0; - /* - * Everything looks good so it's now ok to enable lower - * queue processing. - * Note the lower queue should be enabled as soon as - * I_PLINK returns (used in sm_get_ttymodes etc). - * Schedule ioctls to obtain the terminal settings. - */ - - if ((uqi->sm_flags & FULLY_OPEN) || uqi->sm_waitq) - plqi->sm_uqflags |= SM_UQVALID; - - qenable(SM_RQ(plqi)); - if (plqi->sm_flags & (WANT_CDSTAT|WANT_TCSET)) { - /* - * Bypass the lower half of the driver (hence - * no qwriter) and apply the current termio - * settings on the lower stream. - */ - UNLOCK_UNIT(plqi); - if (plqi->sm_bid) { - qunbufcall(SM_WQ(plqi), plqi->sm_bid); - plqi->sm_bid = 0; - } - /* - * Only set cflags on the lower q if we know - * the settings on any other lower queue. - */ - sm_issue_ioctl(plqi); - LOCK_UNIT(plqi); - - } - } - - UNLOCK_UNIT(plqi); - } - sm_dbg('Y', ("sm_associate: rval=%d.\n", rval)); - return (rval); -} - -/* - * Break an association between one of the driver's minor nodes and - * a serial device. - */ -int -sm_disassociate(int unit, sm_lqi_t *plqi, ulong_t tag) -{ - sm_uqi_t *uqi; - int rval = 0; - - sm_dbg('Y', ("sm_disassociate: link %d, unit %d: ", - (plqi) ? plqi->sm_linkid : 0, unit)); - /* - * Check the data is valid. - * Disassociate a lower queue with a logical unit. - */ - if (unit < 0 || unit >= NLUNITS || plqi == 0 || - (uqi = get_uqi(sm_ssp, unit)) == 0) { - sm_dbg('@', ("invalid: lqi=0x%p lui=0x%p", plqi, uqi)); - rval = EINVAL; - } else { - LOCK_UNIT(plqi); - - if (plqi->sm_uqi == NULL) { - sm_dbg('@', ("unit not associated")); - rval = EINVAL; - } else if (plqi->sm_uqi->sm_lunit != unit) { - sm_dbg('@', ("unit and linkid not related", - plqi->sm_uqi->sm_lunit)); - rval = EINVAL; - } else if (plqi->sm_tag != tag) { - sm_dbg('@', - ("Invalid tag for TTYMUX_DISASSOC ioctl\n")); - rval = EPERM; - } else { - sm_dbg('Y', ("disassociating ")); - - (void) ttymux_device_fini(plqi); - - /* - * Indicate that carrier status is no - * longer required and that the upper - * queue should not be used by plqi - */ - plqi->sm_flags &= ~(WANT_CDSTAT|WANT_TCSET); - plqi->sm_uqflags &= ~(SM_UQVALID|SM_OBPCNDEV); - plqi->sm_ioflag = 0u; - - sm_lqifree(plqi); - rval = 0; - } - UNLOCK_UNIT(plqi); - } - sm_dbg('Y', (" rval=%d.\n", rval)); - return (rval); - -} - -/* - * Streams helper routines; - */ - -/* - * Schedule a qbufcall for an upper queue. - * Must be called within the perimiter of the parameter q. - * fn must reenable the q. - * Called: - * whenever a message must be placed on multiple queues and allocb fails; - */ -static void -sm_sched_uqcb(queue_t *q, int memreq, int pri, void (*fn)()) -{ - sm_uqi_t *uqi = q->q_ptr; - - if (uqi->sm_ttybid != 0) - qunbufcall(q, uqi->sm_ttybid); - - noenable(q); - - uqi->sm_ttybid = qbufcall(q, memreq, pri, fn, uqi); -} - -/* - * qbufcall routine to restart the queues when memory is available. - */ -static void -sm_reenable_q(sm_uqi_t *uqi) -{ - queue_t *wq = SM_WQ(uqi); - - if ((uqi->sm_flags & SM_STOPPED) == 0) { - enableok(wq); - qenable(wq); - } -} - -/* - * Place a message on the write queue of each stream associated with - * the given upper stream. - */ -static void -sm_senddown(sm_uqi_t *uqi) -{ - sm_lqi_t *lqi; - - for (lqi = uqi->sm_lqs; lqi != 0; lqi = lqi->sm_nlqi) { - if (lqi->sm_mp != 0) { - putnext(SM_WQ(lqi), lqi->sm_mp); - lqi->sm_mp = 0; - } - } -} - -/* - * For each lower device that should receive a write message duplicate - * the message block. - */ -static int -sm_dupmsg(sm_uqi_t *uqi, mblk_t *mp) -{ - sm_lqi_t *lqi; - mblk_t *origmp = mp; - - for (lqi = uqi->sm_lqs; lqi != 0; lqi = lqi->sm_nlqi) { - lqi->sm_mp = 0; - if (lqi->sm_flags & WERROR_MODE) { - continue; - } - if ((lqi->sm_ioflag & (uint_t)FOROUTPUT) == 0) { - if (DB_TYPE(mp) == M_DATA) - continue; - } - if (lqi->sm_nlqi == 0) { - lqi->sm_mp = mp; - origmp = NULL; - } else if ((lqi->sm_mp = sm_copymsg(mp)) == 0) { - sm_lqi_t *flqi; - - for (flqi = uqi->sm_lqs; flqi != lqi; - flqi = flqi->sm_nlqi) { - if (lqi->sm_mp) { - /* must have been sm_copymsg */ - sm_freemsg(lqi->sm_mp); - lqi->sm_mp = 0; - } - } - return (sm_cnt_oqs(uqi) * msgdsize(mp)); - } - } - if (origmp != NULL) - freemsg(origmp); - return (0); -} - -/* - * Return 1 if all associated lower devices have room for another message - * otherwise return 0. - */ -static int -sm_cansenddown(sm_uqi_t *uqi) -{ - - register sm_lqi_t *lqi; - - if (uqi->sm_lqs == 0) - return (0); - - for (lqi = uqi->sm_lqs; lqi != 0; lqi = lqi->sm_nlqi) { - if ((lqi->sm_flags & WERROR_MODE) == 0 && - canputnext(SM_WQ(lqi)) == 0) - return (0); - } - return (1); -} - -/* - * Put a message down all associated lower queues. - * Return 1 if the q function was called. - */ -static int -sm_putqs(queue_t *q, mblk_t *mp, int (*qfn)()) -{ - register sm_uqi_t *uqi = (sm_uqi_t *)q->q_ptr; - register int memreq; - int pri = (DB_TYPE(mp) < QPCTL) ? BPRI_MED : BPRI_HI; - int rval = 0; - - if (uqi->sm_lqs == 0 || (uqi->sm_flags & WERROR_MODE)) { - - sm_dbg('Q', ("sm_putqs: freeing (0x%p 0x%p).\n", uqi->sm_lqs, - uqi->sm_flags)); - freemsg(mp); - } else if (pri != BPRI_HI && sm_cansenddown(uqi) == 0) { - /* a lower q is flow controlled */ - (void) qfn(q, mp); - rval = 1; - } else if ((memreq = sm_dupmsg(uqi, mp)) == 0) { - - sm_senddown(uqi); - - } else { - sm_log("sm_putqs: msg 0x%x - can't alloc %d bytes (pri %d).\n", - DB_TYPE(mp), memreq, pri); - sm_sched_uqcb(q, memreq, pri, sm_reenable_q); - - (void) qfn(q, mp); - rval = 1; - - } - - return (rval); -} - -/* - * Service a streams link and unlink requests. - */ -static void -sm_link_req(queue_t *wq, mblk_t *mp) -{ - struct linkblk *linkp; - int rval; - int cmd; - sm_lqi_t *plqi; - - ASSERT(DB_TYPE(mp) == M_IOCTL); - - cmd = ((struct iocblk *)mp->b_rptr)->ioc_cmd; - switch (cmd) { - - case I_LINK: - case I_PLINK: - sm_dbg('G', ("sm_link_req: M_IOCTL %x (I_PLINK).\n", cmd)); - - linkp = (struct linkblk *)mp->b_cont->b_rptr; - - /* - * 1. Sanity check the link block. - * 2. Validate that the queue is not already linked - * (and resources available). - * 3. Validate that the lower queue is not associated with - * a logical unit. - * 4. Remember that this lower queue is linked to the driver. - */ - if ((linkp == NULL) || (MBLKL(mp) < sizeof (*linkp)) || - linkp->l_qbot == NULL) { - sm_dbg('I', ("sm_link_req: invalid link block.\n")); - rval = EINVAL; - } else if ((plqi = get_lqi_byq(linkp->l_qbot)) == 0) { - sm_dbg('I', ("sm_link_req: out of resources.\n")); - rval = EBUSY; /* out of resources */ - } else if (plqi->sm_uqi) { - UNLOCK_UNIT(plqi); /* was aquired by get_lqi_byq */ - sm_dbg('I', ("sm_link_req: already associated.\n")); - rval = EBUSY; /* already linked */ - } else { - SM_WQ(plqi) = linkp->l_qbot; - SM_RQ(plqi) = OTHERQ(linkp->l_qbot); - - linkp->l_qbot->q_ptr = - OTHERQ(linkp->l_qbot)->q_ptr = plqi; - plqi->sm_linkid = linkp->l_index; - UNLOCK_UNIT(plqi); /* was aquired by get_lqi_byq */ - - sm_dbg('H', ("sm_link_req: linkid = %d.\n", - linkp->l_index)); - - sm_setdip(linkp->l_qbot, plqi); - plqi->sm_ttycommon->t_flags = 0; - plqi->sm_ttycommon->t_cflag = 0; - plqi->sm_mbits = 0; - (void) ttymux_device_init(plqi); - rval = 0; - } - - break; - - case I_UNLINK: - case I_PUNLINK: - sm_dbg('G', ("sm_link_req: M_IOCTL (I_PUNLINK).\n")); - - linkp = (struct linkblk *)mp->b_cont->b_rptr; - - if ((linkp == NULL) || - (MBLKL(mp) < sizeof (*linkp)) || - linkp->l_qbot == NULL) { - rval = EINVAL; - } else if ((plqi = get_lqi_byid(linkp->l_index)) == 0) { - rval = EINVAL; - } else { - sm_uqi_t *uqi; - int werrmode; - - /* - * Mark the lower q as invalid. - */ - sm_dbg('G', ("I_PUNLINK: freeing link %d\n", - linkp->l_index)); - - if (plqi->sm_bid) { - qunbufcall(SM_RQ(plqi), plqi->sm_bid); - plqi->sm_bid = 0; - } - if (plqi->sm_ttybid) { - qunbufcall(SM_RQ(plqi), plqi->sm_ttybid); - plqi->sm_ttybid = 0; - } - - uqi = plqi->sm_uqi; - - - (void) ttymux_device_fini(plqi); - - if (uqi) - (void) sm_disassociate(uqi->sm_lunit, - plqi, plqi->sm_tag); - - LOCK_UNIT(plqi); - - plqi->sm_piocid = 0; - - werrmode = (plqi->sm_flags & (WERROR_MODE|HANGUP_MODE)) - ? 1 : 0; - - plqi->sm_mbits = 0; - plqi->sm_flags = 0; - - ttycommon_close(plqi->sm_ttycommon); - /* SM_RQ(plqi) = SM_WQ(plqi) = 0; */ - plqi->sm_ttycommon->t_flags = 0; - plqi->sm_ttycommon->t_cflag = 0; - plqi->sm_ttycommon->t_iflag = 0; - plqi->sm_linkid = 0; - plqi->sm_dev = NODEV; - plqi->sm_hadkadbchar = 0; - plqi->sm_nachar = sm_ssp->sm_abs; - - UNLOCK_UNIT(plqi); - if (uqi && - werrmode && - (uqi->sm_flags & FULLY_OPEN) && - sm_uwq_error(uqi) && - putnextctl(SM_RQ(uqi), M_HANGUP) == 0) { - sm_log("sm_link_req: putnextctl(M_HANGUP)" - " failed.\n"); - } - - rval = 0; - } - - break; - default: - rval = EINVAL; - } - if (rval != 0) - miocnak(wq, mp, 0, rval); - else - miocack(wq, mp, 0, 0); -} - -static int -sm_getiocinfo(mblk_t *mp, struct sm_iocinfo *info) -{ - switch (DB_TYPE(mp)) { - case M_COPYOUT: - info->sm_id = ((struct copyreq *)mp->b_rptr)->cq_id; - info->sm_cmd = ((struct copyreq *)mp->b_rptr)->cq_cmd; - info->sm_data = (((struct copyreq *)mp->b_rptr)->cq_size && - mp->b_cont) ? (void *)mp->b_cont->b_rptr : 0; - break; - case M_COPYIN: - info->sm_id = ((struct copyresp *)mp->b_rptr)->cp_id; - info->sm_cmd = ((struct copyresp *)mp->b_rptr)->cp_cmd; - info->sm_data = 0; - break; - case M_IOCACK: - info->sm_id = ((struct iocblk *)mp->b_rptr)->ioc_id; - info->sm_cmd = ((struct iocblk *)mp->b_rptr)->ioc_cmd; - /* the se driver has bug so we cannot use ioc_count */ - info->sm_data = (((struct iocblk *)mp->b_rptr)-> - ioc_error == 0 && mp->b_cont) ? - (void *)mp->b_cont->b_rptr : 0; - break; - case M_IOCNAK: - info->sm_id = ((struct iocblk *)mp->b_rptr)->ioc_id; - info->sm_cmd = ((struct iocblk *)mp->b_rptr)->ioc_cmd; - info->sm_data = 0; - break; - case M_IOCDATA: - info->sm_id = ((struct copyresp *)mp->b_rptr)->cp_id; - info->sm_cmd = ((struct copyresp *)mp->b_rptr)->cp_cmd; - info->sm_data = (((struct copyresp *)mp->b_rptr)-> - cp_rval == 0 && mp->b_cont) ? - (void *)mp->b_cont->b_rptr : 0; - break; - case M_IOCTL: - info->sm_id = ((struct iocblk *)mp->b_rptr)->ioc_id; - info->sm_cmd = ((struct iocblk *)mp->b_rptr)->ioc_cmd; - info->sm_data = 0; - break; - default: - return (EINVAL); - } - return (0); -} - -/* - * Record the termio settings that have been set on the upper stream - */ -static int -sm_update_ttyinfo(mblk_t *mp, sm_uqi_t *uqi) -{ - int err; - struct sm_iocinfo info; - - if ((err = sm_getiocinfo(mp, &info)) != 0) - return (err); - - switch (info.sm_cmd) { - case TIOCSPPS: - case TIOCGPPS: - case TIOCGPPSEV: - return (ENOTSUP); - case TIOCGWINSZ: - case TIOCSWINSZ: - break; - case TCSBRK: - case TIOCSBRK: - case TIOCCBRK: - break; - case TCSETSF: - uqi->sm_flags |= FLUSHR_PEND; - sm_dbg('I', ("TCSETSF: FLUSH is pending\n")); - /*FALLTHROUGH*/ - case TCSETSW: - case TCSETS: - case TCGETS: - if (info.sm_data != 0) { - ((struct termios *)info.sm_data)->c_cflag &= - (tcflag_t)(~uqi->sm_cmask); - uqi->sm_ttycommon->t_cflag = - ((struct termios *)info.sm_data)->c_cflag; - } - break; - case TCSETAF: - sm_dbg('I', ("TCSETAF: FLUSH is pending\n")); - uqi->sm_flags |= FLUSHR_PEND; - /*FALLTHROUGH*/ - case TCSETAW: - case TCSETA: - case TCGETA: - if (info.sm_data != 0) { - ((struct termio *)info.sm_data)->c_cflag &= - (tcflag_t)(~uqi->sm_cmask); - uqi->sm_ttycommon->t_cflag = - (tcflag_t)((struct termio *)info.sm_data)->c_cflag; - } - break; - case TIOCSSOFTCAR: - case TIOCGSOFTCAR: - if (info.sm_data != 0) { - if (*(int *)info.sm_data == 1) - uqi->sm_ttycommon->t_flags |= TS_SOFTCAR; - else - uqi->sm_ttycommon->t_flags &= ~TS_SOFTCAR; - } - break; - case TIOCMSET: - case TIOCMGET: - if (info.sm_data != 0) - uqi->sm_mbits = *(int *)info.sm_data; - break; - case TIOCMBIS: - if (info.sm_data != 0) - uqi->sm_mbits |= *(int *)info.sm_data; - break; - case TIOCMBIC: - if (info.sm_data != 0) - uqi->sm_mbits &= ~(*(int *)info.sm_data); - break; - default: - return (EINVAL); - /* NOTREACHED */ - } /* end switch cmd */ - - if ((uqi->sm_mbits & TIOCM_CD) || - (uqi->sm_ttycommon->t_flags & TS_SOFTCAR) || - (uqi->sm_ttycommon->t_cflag & CLOCAL)) - uqi->sm_flags |= SM_CARON; - else - uqi->sm_flags &= ~SM_CARON; - - return (0); -} - -/* - * SECTION - * STREAM's interface to the OS. - * Routines directly callable from the OS. - */ - -/* - * Processes high priority messages comming from modules above the - * multiplexor. - * Return 1 if the queue was disabled. - */ -static int -sm_hp_uwput(queue_t *wq, mblk_t *mp) -{ - sm_uqi_t *uqi = (sm_uqi_t *)(wq->q_ptr); - int rval = 0; - sm_lqi_t *plqi; - int msgtype = DB_TYPE(mp); - - switch (msgtype) { - - case M_FLUSH: - /* - * How to flush the bottom half: - * putctl1(SM_WQ(plqi), *mp->b_rptr) - * will work on the bottom half but if FLUSHR is set - * when is the right time to flush the upper read queue. - * - * Could set uqi->sm_flags & WANT_FLUSH but then what happens - * if FLUSHR is set and the driver sends up a FLUSHR - * before it handles the current FLUSHR request - * (if only there was an id for the message that could - * be matched when it returns back from the drivers. - * - * Thus I'm going by the book - the bottom half acts like - * a stream head and turns around FLUSHW back down to - * the driver (see lrput). The upper half acts like a - * driver and turns around FLUSHR: - */ - - sm_dbg('I', ("sm_hp_uwput: FLUSH request 0x%x\n", *mp->b_rptr)); - /* flush the upper write queue */ - if (*mp->b_rptr & FLUSHW) - flushq(wq, FLUSHDATA); - - /* - * flush each associated lower write queue - * and pass down the driver (ignore the FLUSHR and deal with - * it when it comes back up the read side. - */ - for (plqi = uqi->sm_lqs; plqi != 0; plqi = plqi->sm_nlqi) { - if ((plqi->sm_flags & WERROR_MODE) == 0 && - SM_WQ(plqi)) { - sm_dbg('I', ("flush lq 0x%p\n", SM_WQ(plqi))); - if (*mp->b_rptr & FLUSHW) - flushq(SM_WQ(plqi), FLUSHDATA); - (void) putnextctl1(SM_WQ(plqi), M_FLUSH, - *mp->b_rptr); - } - } - break; - - case M_STARTI: - for (plqi = uqi->sm_lqs; plqi != 0; plqi = plqi->sm_nlqi) { - plqi->sm_flags &= ~SM_ISTOPPED; - if ((plqi->sm_flags & WERROR_MODE) == 0) - (void) putnextctl(SM_WQ(plqi), msgtype); - } - break; - - case M_STOPI: - for (plqi = uqi->sm_lqs; plqi != 0; plqi = plqi->sm_nlqi) { - plqi->sm_flags |= SM_ISTOPPED; - if ((plqi->sm_flags & WERROR_MODE) == 0) - (void) putnextctl(SM_WQ(plqi), msgtype); - } - break; - - case M_STOP: /* must never be queued */ - uqi->sm_flags |= SM_STOPPED; - noenable(wq); - for (plqi = uqi->sm_lqs; plqi != 0; plqi = plqi->sm_nlqi) - if ((plqi->sm_flags & WERROR_MODE) == 0) - (void) putnextctl(SM_WQ(plqi), msgtype); - - rval = 1; - break; - - case M_START: /* never be queued */ - uqi->sm_flags &= ~SM_STOPPED; - enableok(wq); - qenable(wq); - for (plqi = uqi->sm_lqs; plqi != 0; plqi = plqi->sm_nlqi) - if ((plqi->sm_flags & WERROR_MODE) == 0) - (void) putnextctl(SM_WQ(plqi), msgtype); - - break; - - case M_PCSIG: - case M_COPYOUT: - case M_COPYIN: - case M_IOCACK: - case M_IOCNAK: - /* Wrong direction for message */ - break; - case M_READ: - break; - case M_PCPROTO: - case M_PCRSE: - default: - sm_dbg('I', ("sm_hp_uwput: default case %d.\n", msgtype)); - break; - } /* end switch on high pri message type */ - - freemsg(mp); - return (rval); -} - -static int -sm_default_uwioctl(queue_t *wq, mblk_t *mp, int (*qfn)()) -{ - int err; - struct iocblk *iobp; - sm_uqi_t *uqi; - - uqi = (sm_uqi_t *)(wq->q_ptr); - iobp = (struct iocblk *)mp->b_rptr; - - switch (iobp->ioc_cmd) { - case TIOCEXCL: - case TIOCNXCL: - case TIOCSTI: - /* - * The three ioctl types we support do not require any - * additional allocation and should not return a pending - * ioctl state. For this reason it is safe for us to ignore - * the return value from ttycommon_ioctl(). - * Additionally, we translate any error response from - * ttycommon_ioctl() into EINVAL. - */ - (void) ttycommon_ioctl(uqi->sm_ttycommon, wq, mp, &err); - if (err < 0) - miocnak(wq, mp, 0, EINVAL); - else - miocack(wq, mp, 0, 0); - return (0); - default: - break; - } - if ((err = sm_update_ttyinfo(mp, uqi)) != 0) { - miocnak(wq, mp, 0, err); - return (0); - } - - /* - * If uqi->sm_siocdata.sm_iocid just overwrite it since the stream - * head will have timed it out - */ - uqi->sm_siocdata.sm_iocid = iobp->ioc_id; - uqi->sm_siocdata.sm_acked = 0; - uqi->sm_siocdata.sm_nacks = sm_good_qs(uqi); - uqi->sm_siocdata.sm_acnt = 0; - uqi->sm_siocdata.sm_policy = uqi->sm_policy; - uqi->sm_siocdata.sm_flags = 0; - sm_dbg('Z', (" want %d acks for id %d.\n", - uqi->sm_siocdata.sm_nacks, iobp->ioc_id)); - - return (sm_putqs(wq, mp, qfn)); -} - -/* - * - * sm_uwput - put function for an upper STREAM write. - */ -static int -sm_uwput(queue_t *wq, mblk_t *mp) -{ - sm_uqi_t *uqi; - uchar_t msgtype; - int cmd; - struct iocblk *iobp; - - uqi = (sm_uqi_t *)(wq->q_ptr); - msgtype = DB_TYPE(mp); - - ASSERT(uqi != 0 && sm_ssp != 0); - - if (msgtype >= QPCTL && msgtype != M_IOCDATA) { - (void) sm_hp_uwput(wq, mp); - return (0); - } - - switch (DB_TYPE(mp)) { - case M_DATA: - case M_DELAY: - case M_BREAK: - default: - (void) sm_putqs(wq, mp, putq); - break; - - case M_CTL: - if (((struct iocblk *)mp->b_rptr)->ioc_cmd == MC_CANONQUERY) { - (void) putnextctl1(OTHERQ(wq), M_CTL, MC_NOCANON); - } - freemsg(mp); - break; - case M_IOCDATA: /* not handled as high pri because may need to putbq */ - sm_dbg('M', ("sm_uwput(M_IOCDATA)\n")); - /*FALLTHROUGH*/ - case M_IOCTL: - cmd = (msgtype == M_IOCDATA) ? - ((struct copyresp *)mp->b_rptr)->cp_cmd : - ((struct iocblk *)mp->b_rptr)->ioc_cmd; - - iobp = (struct iocblk *)mp->b_rptr; - iobp->ioc_rval = 0; - - sm_dbg('M', ("sm_uwput(M_IOCTL:%d)\n", cmd)); - - switch (cmd) { - - case CONSGETABORTENABLE: - iobp->ioc_error = ttymux_abort_ioctl(mp); - DB_TYPE(mp) = iobp->ioc_error ? M_IOCNAK : M_IOCACK; - qreply(wq, mp); - break; - case CONSSETABORTENABLE: - iobp->ioc_error = - secpolicy_sys_config(iobp->ioc_cr, B_FALSE) != 0 ? - EPERM : ttymux_abort_ioctl(mp); - DB_TYPE(mp) = iobp->ioc_error ? M_IOCNAK : M_IOCACK; - qreply(wq, mp); - break; - case TTYMUX_SETABORT: - if (secpolicy_sys_config(iobp->ioc_cr, B_FALSE) != 0) { - iobp->ioc_error = EPERM; - DB_TYPE(mp) = M_IOCNAK; - qreply(wq, mp); - break; - } - /*FALLTHROUGH*/ - case TTYMUX_GETABORT: - case TTYMUX_GETABORTSTR: - case TTYMUX_ASSOC: - case TTYMUX_DISASSOC: - case TTYMUX_SETCTL: - case TTYMUX_GETLINK: - case TTYMUX_CONSDEV: - case TTYMUX_GETCTL: - case TTYMUX_LIST: - (void) sm_ioctl_cmd(uqi, mp); - qreply(wq, mp); - break; - case I_LINK: - case I_PLINK: - case I_UNLINK: - case I_PUNLINK: - qwriter(wq, mp, sm_link_req, PERIM_OUTER); - break; - case TCSETSW: - case TCSETSF: - case TCSETAW: - case TCSETAF: - case TCSBRK: - if (wq->q_first) { - sm_dbg('A', ("sm_uwput: TCSET-> on srv q.\n")); - /* keep message order intact */ - (void) putq(wq, mp); - break; - } - /*FALLTHROUGH*/ - default: - (void) sm_default_uwioctl(wq, mp, putq); - break; - } - - break; /* M_IOCTL */ - - } /* end switch on message type */ - - return (0); -} - -/* - * sm_uwsrv - service function for an upper STREAM write. - * 'sm_uwsrv' takes a q parameter. The q parameter specifies the queue - * which is to be serviced. This function reads the messages which are on - * this service queue and passes them to the appropriate lower driver queue. - */ -static int -sm_uwsrv(queue_t *q) -{ - mblk_t *mp; - sm_uqi_t *uqi = (sm_uqi_t *)(q->q_ptr); - int msgtype; - - ASSERT(q == SM_WQ(uqi)); - - /* - * Empty the queue unless explicitly stopped. - */ - while (mp = getq(q)) { - msgtype = DB_TYPE(mp); - - if (msgtype >= QPCTL && msgtype != M_IOCDATA) - if (sm_hp_uwput(q, mp)) { - sm_dbg('T', ("sm_uwsrv: flowcontrolled.\n")); - break; /* indicates that the is disabled */ - } - else - continue; - - if (uqi->sm_flags & SM_STOPPED) { - (void) putbq(q, mp); - sm_dbg('T', ("sm_uwsrv: SM_STOPPED.\n")); - break; - } - - /* - * Read any ttycommon data that may - * change (TS_SOFTCAR, CREAD, etc.). - */ - switch (DB_TYPE(mp)) { - case M_IOCTL: - case M_IOCDATA: - if (sm_default_uwioctl(q, mp, putbq)) - return (0); - break; - - default: - if (sm_putqs(q, mp, putbq)) - return (0); - } - } - return (0); -} - -/* - * Lower write side service routine used for backenabling upstream - * flow control. - */ -static int -sm_lwsrv(queue_t *q) -{ - sm_lqi_t *lqi = (sm_lqi_t *)q->q_ptr; - queue_t *uwq; - - LOCK_UNIT(lqi); - if (lqi->sm_uqflags & SM_UQVALID) { - /* - * It's safe to lock uqi since lwsrv runs asynchronously - * with the upper write routines so this cannot be an - * upper half thread. While holding the lqi lock and - * if SM_UQVALID is set we are guaranteed that - * lqi->sm_uqi will be valid. - */ - sm_dbg('I', ("sm_lwsrv: re-enabling upper queue.\n")); - - uwq = SM_WQ(lqi->sm_uqi); - UNLOCK_UNIT(lqi); - qenable(uwq); - } else { - UNLOCK_UNIT(lqi); - } - return (0); -} - -/* - * Upper read queue ioctl response handler for messages - * passed from the lower half of the driver. - */ -static int -sm_uriocack(queue_t *rq, mblk_t *mp) -{ - sm_uqi_t *uqi = (sm_uqi_t *)rq->q_ptr; - int err, flag; - sm_iocdata_t *iodp; - struct sm_iocinfo info; - - if ((err = sm_getiocinfo(mp, &info)) != 0) { - sm_dbg('I', ("Unknown ioctl response\n")); - return (err); - } - - if (info.sm_id == uqi->sm_piocdata.sm_iocid) { - iodp = &uqi->sm_piocdata; - } else if (info.sm_id == uqi->sm_siocdata.sm_iocid) { - iodp = &uqi->sm_siocdata; - } else { - sm_log("Unexpected ioctl response\n"); - sm_dbg('I', ("Unexpected ioctl response (id %d)\n", - info.sm_id)); - - /* - * If the response is sent up it will result in - * duplicate ioctl responses. The ioctl has probably been - * timed out by the stream head so dispose of the response - * (since it has arrived too late. - */ - goto out; - } - - flag = SM_COPYIN; - - switch (DB_TYPE(mp)) { - case M_COPYOUT: - flag = SM_COPYOUT; - /*FALLTHRU*/ - case M_COPYIN: - if (iodp->sm_flags & flag) - goto out; - iodp->sm_flags |= flag; - - break; - case M_IOCACK: - iodp->sm_ackcnt += 1; - iodp->sm_acnt += 1; - if (iodp->sm_policy == FIRSTACK) { - if (iodp->sm_acnt == iodp->sm_nacks) - iodp->sm_iocid = 0; - if (iodp->sm_acnt == 1) - iodp->sm_acked = 1; - else - goto out; - } else { - if (iodp->sm_acnt == iodp->sm_nacks) { - iodp->sm_iocid = 0; - iodp->sm_acked = 1; - } else - goto out; - } - break; - case M_IOCNAK: - iodp->sm_nakcnt += 1; - iodp->sm_acnt += 1; - if (iodp->sm_acnt == iodp->sm_nacks) { - iodp->sm_iocid = 0; - if (iodp->sm_acked == 0) { - iodp->sm_acked = 1; - break; - } - } - goto out; - default: - goto out; - } - - /* - * Merge the tty settings each of the associated lower streams. - */ - if (info.sm_data) - (void) sm_update_ttyinfo(mp, uqi); - - if (iodp == &uqi->sm_piocdata) { - if (iodp->sm_iocid == 0) { - uqi->sm_flags &= ~SM_IOCPENDING; - } - } else { - sm_dbg('I', ("sm_uriocack: forwarding response for %d.\n", - info.sm_id)); - putnext(rq, mp); - return (0); - } -out: - sm_dbg('I', ("sm_uriocack: freeing response for %d.\n", info.sm_id)); - freemsg(mp); - return (0); -} - -/* - * Transfer a message from the lower read side of the multiplexer onto - * the associated upper stream. - */ -static int -sm_ursendup(queue_t *q, mblk_t *mp) -{ - sm_uqi_t *uqi = (sm_uqi_t *)q->q_ptr; - - if (!canputnext(q) && DB_TYPE(mp) < QPCTL) { - sm_dbg('I', ("sm_ursendup: flow controlled.\n")); - return (1); - } - - switch (DB_TYPE(mp)) { - case M_COPYIN: - case M_COPYOUT: - case M_IOCACK: - case M_IOCNAK: - (void) sm_uriocack(q, mp); - break; - case M_HANGUP: - if (sm_uwq_error(uqi)) { - /* there are no usable lower q's */ - uqi->sm_flags &= ~SM_CARON; - putnext(q, mp); - } else { - /* there are still usable q's - don't send up */ - freemsg(mp); - } - break; - case M_ERROR: - if (sm_uwq_error(uqi)) { - /* there are no usable lower q's */ - uqi->sm_flags &= ~SM_CARON; - putnext(q, mp); - } else if (*mp->b_rptr == NOERROR) { - /* the error has cleared */ - uqi->sm_flags &= ~ERROR_MODE; - putnext(q, mp); - } else { - /* there are still usable q's - don't send up */ - freemsg(mp); - } - break; - case M_FLUSH: - flushq(q, FLUSHDATA); - putnext(q, mp); /* time to use FLUSHR_PEND flag */ - break; - case M_CTL: - /* wrong direction - must have come from sm_close */ - uqi->sm_flags |= SM_CLOSE; - sm_dbg('I', ("sm_ursrv: had SM_CLOSE.\n")); - freemsg(mp); - break; - case M_UNHANGUP: - /* just pass them all up - they're harmless */ - uqi->sm_flags |= SM_CARON; - /* FALLTHROUGH */ - default: - putnext(q, mp); - break; - } - - return (0); -} - -/* - * sm_urput - put function for a lower STREAM read. - */ -static int -sm_urput(queue_t *q, mblk_t *mp) -{ - if (sm_ursendup(q, mp) != 0) - (void) putq(q, mp); - - return (0); -} - -/* - * Upper read side service routine. - * Read side needs to be fast so only check for duplicate M_IOCTL acks. - */ -static int -sm_ursrv(queue_t *q) -{ - sm_uqi_t *uqi = (sm_uqi_t *)q->q_ptr; - mblk_t *mp; - int flags = uqi->sm_flags; - - while ((mp = getq(q))) { - if (sm_ursendup(q, mp) != 0) { - sm_dbg('I', ("sm_ursrv: flow controlled.\n")); - (void) putbq(q, mp); - uqi->sm_flags |= WANT_RENB; - break; - } - } - - /* - * If the q service was called because it was no longer - * flow controled then enable each of the driver queues. - */ - if ((flags & WANT_RENB) && !(uqi->sm_flags & WANT_RENB)) { - sm_lqi_t *lqi; - queue_t *drq; /* read q of linked driver */ - - uqi->sm_flags &= ~WANT_RENB; - for (lqi = uqi->sm_lqs; lqi != 0; lqi = lqi->sm_nlqi) { - drq = SM_RQ(lqi)->q_next; - if (drq && drq->q_first != 0) - qenable(drq); - } - } - - return (0); -} - -/* - * Check a message sent from a linked device for abort requests and - * for flow control. - */ -static int -sm_lrmsg_check(queue_t *q, mblk_t *mp) -{ - sm_lqi_t *lqi = (sm_lqi_t *)q->q_ptr; - - switch (DB_TYPE(mp)) { - case M_DATA: - LOCK_UNIT(lqi); - /* - * check for abort - only allow abort on I/O consoles - * known to OBP - - * fix it when we do polled io - */ - if ((lqi->sm_ioflag & (uint_t)FORINPUT) == 0) { - freemsg(mp); - UNLOCK_UNIT(lqi); - return (1); - } - if ((lqi->sm_uqflags & SM_OBPCNDEV) && - lqi->sm_ctrla_abort_on && - abort_enable == KIOCABORTALTERNATE) { - - uchar_t *rxc; - boolean_t aborted = B_FALSE; - - for (rxc = mp->b_rptr; - rxc != mp->b_wptr; - rxc++) - - if (*rxc == *lqi->sm_nachar) { - lqi->sm_nachar++; - if (*lqi->sm_nachar == '\0') { - abort_sequence_enter( - (char *)NULL); - lqi->sm_nachar = sm_ssp->sm_abs; - aborted = B_TRUE; - } - } else - lqi->sm_nachar = (*rxc == *sm_ssp-> - sm_abs) ? - sm_ssp-> - sm_abs + 1 : - sm_ssp->sm_abs; - - if (aborted) { - freemsg(mp); - UNLOCK_UNIT(lqi); - return (1); - } - } - UNLOCK_UNIT(lqi); - break; - case M_BREAK: /* we'll eventually see this as a flush */ - LOCK_UNIT(lqi); - /* - * Only allow abort on OBP devices. When polled I/O is - * supported allow abort on any console device. - * Parity errors are reported upstream as breaks so - * ensure that there is no data in the message before - * deciding whether to abort. - */ - if ((lqi->sm_uqflags & SM_OBPCNDEV) && /* console stream */ - (mp->b_wptr - mp->b_rptr == 0 && - msgdsize(mp) == 0)) { /* not due to parity */ - - if (lqi->sm_break_abort_on && - abort_enable != KIOCABORTALTERNATE) - abort_sequence_enter((char *)NULL); - - freemsg(mp); - UNLOCK_UNIT(lqi); - return (1); - } else { - UNLOCK_UNIT(lqi); - } - break; - default: - break; - } - - if (DB_TYPE(mp) >= QPCTL) - return (0); - - LOCK_UNIT(lqi); /* lock out the upper half */ - if ((lqi->sm_uqflags & SM_UQVALID) && SM_RQ(lqi->sm_uqi)) { - UNLOCK_UNIT(lqi); - if (!canput(SM_RQ(lqi->sm_uqi))) { - sm_dbg('I', ("sm_lrmsg_check: flow controlled.\n")); - (void) putq(q, mp); - return (1); - } - } else { - UNLOCK_UNIT(lqi); - } - - return (0); -} - -/* - * sm_sendup - deliver a message to the upper read side of the multiplexer - */ -static int -sm_sendup(queue_t *q, mblk_t *mp) -{ - sm_lqi_t *lqi = (sm_lqi_t *)q->q_ptr; - - if (sm_ssp == NULL) { - freemsg(mp); - return (0); - } - - /* - * Check for CD status change messages from driver. - * (Remark: this is an se driver thread running at soft interupt - * priority and the waiters are in user context). - */ - switch (DB_TYPE(mp)) { - case M_DATA: - case M_BREAK: /* we'll eventually see this as a flush */ - break; - - /* high priority messages */ - case M_IOCACK: - case M_IOCNAK: - if ((lqi->sm_flags & SM_IOCPENDING) && lqi->sm_piocid == - ((struct iocblk *)mp->b_rptr)->ioc_id) { - freemsg(mp); - lqi->sm_flags &= ~SM_IOCPENDING; - sm_issue_ioctl(lqi); - return (0); - } - break; - case M_UNHANGUP: - /* - * If the driver can send an M_UNHANGUP it must be able to - * accept messages from above (ie clear WERROR_MODE if set). - */ - sm_dbg('E', ("lrput: M_UNHANGUP\n")); - lqi->sm_mbits |= TIOCM_CD; - lqi->sm_flags &= ~(WERROR_MODE|HANGUP_MODE); - - break; - - case M_HANGUP: - sm_dbg('E', ("lrput: MHANGUP\n")); - lqi->sm_mbits &= ~TIOCM_CD; - lqi->sm_flags |= (WERROR_MODE|HANGUP_MODE); - break; - - case M_ERROR: - - sm_dbg('E', ("lrput: MERROR\n")); - /* - * Tell the driver to flush rd/wr queue if its read/write error. - * if its a read/write error flush rq/wq (type in first bytes). - */ - if ((mp->b_wptr - mp->b_rptr) == 2) { - uchar_t rw = 0; - - if (*mp->b_rptr == NOERROR) { - /* not in error anymore */ - lqi->sm_flags &= ~ERROR_MODE; - lqi->sm_flags |= WANT_CD; - } else { - if (*mp->b_rptr != 0) { - /* read error */ - rw |= FLUSHR; - lqi->sm_flags |= RERROR_MODE; - } - mp->b_rptr++; - if (*mp->b_rptr != 0) { - /* write error */ - rw |= FLUSHW; - lqi->sm_flags |= WERROR_MODE; - } - - mp->b_rptr--; - /* has next driver done qprocsoff */ - if (rw && OTHERQ(q)->q_next != NULL) { - (void) putnextctl1(OTHERQ(q), M_FLUSH, - rw); - } - } - } else if (*mp->b_rptr != 0 && OTHERQ(q)->q_next != NULL) { - sm_dbg('E', ("lrput: old style MERROR (?)\n")); - - lqi->sm_flags |= (RERROR_MODE | WERROR_MODE); - (void) putnextctl1(OTHERQ(q), M_FLUSH, FLUSHRW); - } - break; - - case M_PCSIG: - case M_SIG: - break; - case M_COPYOUT: - case M_COPYIN: - break; - case M_FLUSH: - /* flush the read queue and pass on up */ - flushq(q, FLUSHDATA); - break; - default: - break; - } - - LOCK_UNIT(lqi); /* lock out the upper half */ - if (lqi->sm_uqflags & SM_UQVALID && SM_RQ(lqi->sm_uqi)) { - UNLOCK_UNIT(lqi); - (void) putq(SM_RQ(lqi->sm_uqi), mp); - return (0); - } else { - sm_dbg('I', ("sm_sendup: uq not valid\n")); - freemsg(mp); - } - UNLOCK_UNIT(lqi); - - return (0); -} - -/* - * sm_lrput - put function for a lower STREAM read. - */ -static int -sm_lrput(queue_t *q, mblk_t *mp) -{ - if (sm_lrmsg_check(q, mp) == 0) - (void) sm_sendup(q, mp); - return (0); -} - -/* - * sm_lrsrv - service function for the lower read STREAM. - */ -static int -sm_lrsrv(queue_t *q) -{ - mblk_t *mp; - - sm_dbg('I', ("sm_lrsrv: not controlled.\n")); - while (mp = getq(q)) - (void) sm_sendup(q, mp); - - return (0); -} - -/* - * Check whether a thread is allowed to open the requested device. - */ -static int -sm_ok_to_open(sm_uqi_t *uqi, int protocol, cred_t *credp, int *abort_waiters) -{ - int rval = 0; - int proto; - - *abort_waiters = 0; - - switch (protocol) { - case ASYNC_DEVICE: /* Standard async protocol */ - if ((uqi->sm_protocol == NULL_PROTOCOL) || - (uqi->sm_protocol == ASYN_PROTOCOL)) { - /* - * Lock out other incompatible protocol requests. - */ - proto = ASYN_PROTOCOL; - rval = 0; - } else - rval = EBUSY; - break; - - case OUTLINE: /* Outdial protocol */ - if ((uqi->sm_protocol == NULL_PROTOCOL) || - (uqi->sm_protocol == OUTD_PROTOCOL)) { - proto = OUTD_PROTOCOL; - rval = 0; - } else if (uqi->sm_protocol == ASYN_PROTOCOL) { - /* - * check for dialout request on a line that is already - * open for dial in: - * kick off any thread that is waiting to fully open - */ - if (uqi->sm_flags & FULLY_OPEN) - rval = EBUSY; - else { - proto = OUTD_PROTOCOL; - *abort_waiters = 1; - } - } else - rval = EBUSY; - break; - default: - rval = ENOTSUP; - } - - if (rval == 0 && - (uqi->sm_ttycommon->t_flags & TS_XCLUDE) && - secpolicy_excl_open(credp) != 0) { - - if (uqi->sm_flags & FULLY_OPEN) { - rval = EBUSY; /* exclusive device already open */ - } else { - /* NB TS_XCLUDE cant be set during open so NOTREACHED */ - /* force any waiters to yield TS_XCLUDE */ - *abort_waiters = 1; - } - } - - if (rval == 0) - uqi->sm_protocol = proto; - - sm_dbg('A', ("ok_to_open (0x%p, %d) proto=%d rval %d (wabort=%d)", - uqi, protocol, uqi->sm_protocol, rval, *abort_waiters)); - - return (rval); -} - -/* wait for memory to become available whilst performing a qwait */ -/*ARGSUSED*/ -static void dummy_callback(void *arg) -{} - -/* ARGSUSED */ -static int -sm_dump_msg(queue_t *q, mblk_t *mp) -{ - freemsg(mp); - return (0); -} - -/* - * Wait for a message to arrive - must be called with exclusive - * access at the outer perimiter. - */ -static int -sm_qwait_sig(sm_uqi_t *uqi, queue_t *q) -{ - int err; - - sm_dbg('C', ("sm_qwait_sig: waiting.\n")); - - uqi->sm_waitq = q; - uqi->sm_nwaiters++; /* required by the close routine */ - err = qwait_sig(q); - if (--uqi->sm_nwaiters == 0) - uqi->sm_waitq = 0; - - if (err == 0) - err = EINTR; - else if (q->q_ptr == 0) /* can happen if there are multiple waiters */ - err = -1; - else if (uqi->sm_flags & SM_CLOSE) { - uqi->sm_flags &= ~SM_CLOSE; - err = 1; /* a different protocol has closed its stream */ - } - else - err = 0; /* was worth waiting for */ - - sm_dbg('C', ("sm_qwait_sig: rval %d\n", err)); - return (err); -} - -/* - * Defer the opening of one the drivers devices until the state of each - * associated lower stream is known. - */ -static int -sm_defer_open(sm_uqi_t *uqi, queue_t *q) -{ - uint_t cmdflags = WANT_CDSTAT; - int err, nqs; - - while ((nqs = sm_good_qs(uqi)) == 0) { - sm_dbg('C', ("sm_defer_open: no good qs\n")); - if (err = sm_qwait_sig(uqi, q)) - return (err); - } - - while ((uqi->sm_flags & SM_CARON) == 0) { - int iocmd; - mblk_t *pioc; - - sm_dbg('C', ("sm_defer_open: flags 0x%x cmdflags 0x%x\n", - uqi->sm_flags, cmdflags)); - if (cmdflags == 0) { - if (err = sm_qwait_sig(uqi, q)) - return (err); - continue; /* waiting for an M_UNHANGUP */ - } else if (cmdflags & WANT_SC) { - cmdflags &= ~WANT_SC; - iocmd = TIOCGSOFTCAR; - } else if (cmdflags & WANT_CD) { - cmdflags &= ~WANT_CD; - iocmd = TIOCMGET; - } else if (cmdflags & WANT_CL) { - cmdflags &= ~WANT_CL; - iocmd = TCGETS; - } - - if (uqi->sm_piocdata.sm_iocid == 0) { - while ((pioc = mkiocb(iocmd)) == 0) { - bufcall_id_t id = - qbufcall(q, sizeof (struct iocblk), - BPRI_MED, dummy_callback, 0); - if (err = sm_qwait_sig(uqi, q)) { - /* wait for the bufcall */ - qunbufcall(q, id); - return (err); - } - qunbufcall(q, id); - } - - uqi->sm_flags |= SM_IOCPENDING; - - uqi->sm_piocdata.sm_iocid = - ((struct iocblk *)pioc->b_rptr)->ioc_id; - uqi->sm_piocdata.sm_acked = 0; - uqi->sm_piocdata.sm_nacks = nqs; - uqi->sm_piocdata.sm_acnt = 0; - uqi->sm_piocdata.sm_ackcnt = uqi-> - sm_piocdata.sm_nakcnt = 0; - uqi->sm_piocdata.sm_policy = uqi->sm_policy; - uqi->sm_piocdata.sm_flags = SM_INTERNALIOC; - if (sm_putqs(WR(q), pioc, sm_dump_msg) != 0) { - uqi->sm_piocdata.sm_iocid = 0; - sm_log("sm_defer_open: bad putqs\n"); - return (-1); - } - } - - sm_dbg('C', ("sm_defer_open: flags 0x%x\n", uqi->sm_flags)); - while ((uqi->sm_flags & SM_CARON) == 0 && - (uqi->sm_flags & SM_IOCPENDING) != 0) - if (err = sm_qwait_sig(uqi, q)) - return (err); - - sm_dbg('C', ("defer_open: uq flags 0x%x.\n", uqi->sm_flags)); - } - sm_dbg('C', ("defer_open: return 0.\n")); - return (0); -} - -static int -sm_open(queue_t *rq, dev_t *devp, int flag, int sflag, cred_t *credp) -{ - int ftstat; - int unit; - int protocol; - sm_uqi_t *uqi; - int abort_waiters; - - if (sm_ssp == NULL) - return (ENXIO); - /* - * sflag = 0 => streams device. - */ - if (sflag != 0 || DEV_TO_UNIT(*devp) >= NLUNITS) { - sm_dbg('C', ("open: sflag=%d or bad dev_t.\n", sflag)); - return (ENXIO); - } - - unit = DEV_TO_UNIT(*devp); - protocol = DEV_TO_PROTOBITS(*devp); - - uqi = get_uqi(sm_ssp, unit); - - sm_dbg('C', ("open(0x%p, %d, 0x%x) :- unit=%d, proto=%d, uqi=0x%p\n", - rq, *devp, flag, unit, protocol, uqi)); - - if (uqi == 0) - return (ENXIO); - - if (sm_refuse_opens && unit > smctlunit && uqi->sm_nlqs == 0) - return (ENXIO); - - if (uqi->sm_flags & EXCL_OPEN && (flag & FEXCL)) { - return (EBUSY); /* device in use */ - } - - if ((flag & FEXCL)) { - if (secpolicy_excl_open(credp) != 0) - return (EPERM); - - if ((uqi->sm_flags & FULLY_OPEN) || uqi->sm_nwaiters > 0) - return (EBUSY); /* device in use */ - - uqi->sm_flags |= EXCL_OPEN; - } - - if (uqi->sm_protocol == NULL_PROTOCOL) { - struct termios *termiosp; - int len; - - if (ddi_getlongprop(DDI_DEV_T_ANY, ddi_root_node(), - DDI_PROP_NOTPROM, "ttymodes", (caddr_t)&termiosp, &len) - == DDI_PROP_SUCCESS && - (len == sizeof (struct termios))) { - - sm_dbg('C', ("open: c_cflag=0x%x\n", - termiosp->c_cflag)); - - uqi->sm_ttycommon->t_iflag = termiosp->c_iflag; - uqi->sm_ttycommon->t_cflag = termiosp->c_cflag; - uqi->sm_ttycommon->t_stopc = termiosp->c_cc[VSTOP]; - uqi->sm_ttycommon->t_startc = termiosp->c_cc[VSTART]; - - /* - * IGNBRK,BRKINT,INPCK,IXON,IXANY,IXOFF - drivers - * PARMRK,IGNPAR,ISTRIP - how to report parity - * INLCR,IGNCR,ICRNL,IUCLC - ldterm (sophisticated I/O) - * IXON, IXANY, IXOFF - flow control input - * CBAUD,CSIZE,CS5-8,CSTOPB,PARENB,PARODD,HUPCL, - * RCV1EN,XMT1EN,LOBLK,XCLUDE,CRTSXOFF,CRTSCTS, - * CIBAUD,PAREXT,CBAUDEXT,CIBAUDEXT,CREAD,CLOCAL - */ - - kmem_free(termiosp, len); - } - else - bzero((caddr_t)uqi->sm_ttycommon, - sizeof (uqi->sm_ttycommon)); - - if (*devp == rconsdev) { - uqi->sm_cmask = sm_cmask; - uqi->sm_ttycommon->t_flags |= TS_SOFTCAR; - } else { - uqi->sm_ttycommon->t_flags &= ~TS_SOFTCAR; - } - - /* - * Clear the default CLOCAL and TS_SOFTCAR flags since - * they must correspond to the settings on the real devices. - */ - - uqi->sm_ttycommon->t_cflag &= ~(uqi->sm_cmask|CLOCAL); - uqi->sm_mbits = 0; - uqi->sm_policy = FIRSTACK; - if (unit == 0 && sm_ssp->sm_ms == 0) - sm_ssp->sm_ms = (sm_mux_state_t *) - space_fetch(TTYMUXPTR); - if (sm_ssp->sm_ms) { - if (sm_ssp->sm_ms->sm_cons_stdin.sm_dev == *devp || - sm_ssp->sm_ms->sm_cons_stdout.sm_dev == *devp) - sm_ssp->sm_lconsole = uqi; - } - } - - /* - * Does this thread need to wait? - */ - - sm_dbg('C', ("sm_open: %d %d 0x%p 0x%x\n", - !(flag & (FNDELAY|FNONBLOCK)), !(protocol == OUTLINE), uqi->sm_lqs, - uqi->sm_flags)); - -tryopen: - - abort_waiters = 0; - if (ftstat = sm_ok_to_open(uqi, protocol, credp, &abort_waiters)) { - sm_dbg('C', ("open failed stat=%d.\n", ftstat)); - - if ((uqi->sm_flags & FULLY_OPEN) == 0 && uqi->sm_nwaiters == 0) - uqi->sm_protocol = NULL_PROTOCOL; - if (flag & FEXCL) - uqi->sm_flags &= ~EXCL_OPEN; - return (ftstat); - } - - if (abort_waiters) { - uqi->sm_dev = *devp; - /* different device wants to use the unit */ - SM_RQ(uqi) = rq; - SM_WQ(uqi) = WR(rq); - } - if (rq->q_ptr == 0) { - sm_lqi_t *lqi; - - uqi->sm_dev = *devp; - rq->q_ptr = WR(rq)->q_ptr = uqi; - SM_RQ(uqi) = rq; - SM_WQ(uqi) = WR(rq); - qprocson(rq); - for (lqi = uqi->sm_lqs; lqi != 0; lqi = lqi->sm_nlqi) { - LOCK_UNIT(lqi); - lqi->sm_uqflags |= SM_UQVALID; - UNLOCK_UNIT(lqi); - } - - sm_dbg('C', ("sm_open: SM_UQVALID set on lqs.\n")); - } - - if (*devp != rconsdev && BLOCKING(uqi, protocol, flag)) { - - uqi->sm_flags |= WANT_CDSTAT; - - do { - /* - * Wait for notifications of changes in the CLOCAL - * and TS_SOFTCAR flags and a TIOCM_CD flag of a - * TIOCMGET request (come in on the write side queue). - */ - - if ((ftstat = sm_defer_open(uqi, rq)) != EINTR) { - if (ftstat) { - goto tryopen; - } else { - continue; - } - } - - if (uqi->sm_nwaiters == 0) { /* clean up */ - /* - * only opens on an asynchronous - * protocols reach here so checking - * nwaiters == 0 is sufficient to - * ensure that no other thread - * is waiting on this logical unit - */ - if ((uqi->sm_flags & FULLY_OPEN) == 0) { - - sm_lqi_t *lqi; - - uqi->sm_dev = NODEV; - sm_dbg('C', ("sm_open FULLY_OPEN=0\n")); - for (lqi = uqi->sm_lqs; lqi != 0; - lqi = lqi->sm_nlqi) { - LOCK_UNIT(lqi); - lqi->sm_uqflags &= ~SM_UQVALID; - UNLOCK_UNIT(lqi); - } - - qprocsoff(rq); - rq->q_ptr = WR(rq)->q_ptr = 0; - SM_RQ(uqi) = 0; - SM_WQ(uqi) = 0; - } - } - if ((uqi->sm_flags & FULLY_OPEN) == 0 && - uqi->sm_nwaiters == 0) - uqi->sm_protocol = NULL_PROTOCOL; - if (flag & FEXCL) - uqi->sm_flags &= ~EXCL_OPEN; - sm_dbg('C', ("sm_open: done (ret %d).\n", ftstat)); - return (ftstat); - } while (BLOCKING(uqi, protocol, flag)); - } - - uqi->sm_flags |= FULLY_OPEN; - - sm_dbg('C', ("sm_open done (ret %d).\n", ftstat)); - return (ftstat); -} - -/* - * Multiplexer device close routine. - */ -/*ARGSUSED*/ -static int -sm_close(queue_t *rq, int flag, cred_t *credp) -{ - sm_uqi_t *uqi = (sm_uqi_t *)rq->q_ptr; - sm_lqi_t *lqi; - - if (sm_ssp == NULL) - return (ENXIO); - - if (uqi == NULL) { - sm_dbg('C', ("close: WARN:- q 0x%p already closed.\n", rq)); - return (ENXIO); - } - - sm_dbg('C', ("close: uqi=0x%p unit=%d q=0x%p)\n", uqi, uqi->sm_lunit, - rq)); - - if (SM_RQ(uqi) != rq) - sm_dbg('C', ("sm_close: rq != current uqi queue\n")); - - if (uqi->sm_ttybid) { - qunbufcall(SM_RQ(uqi), uqi->sm_ttybid); - uqi->sm_ttybid = 0; - } - - /* - * Tell all the linked queues that the upper queue has gone - * Note close will never get called on a stream while there is a - * thread blocked trying to open the same stream. - * If there is a blocked open on a different stream but on - * the same logical unit it will reset the lower queue flags. - */ - for (lqi = uqi->sm_lqs; lqi != 0; lqi = lqi->sm_nlqi) { - LOCK_UNIT(lqi); - lqi->sm_uqflags &= ~SM_UQVALID; - UNLOCK_UNIT(lqi); - } - - /* - * Turn off the STREAMs queue processing for this queue. - */ - qprocsoff(rq); - - /* - * Similarly we will never get here if there is thread trying to - * open ths stream. - */ - LOCK_UNIT(uqi); - if (uqi->sm_waitq == 0) - uqi->sm_flags = (uqi->sm_flags & SM_OBPCNDEV) ? SM_OBPCNDEV : - 0U; - - uqi->sm_dev = NODEV; - uqi->sm_protocol = NULL_PROTOCOL; - ttycommon_close(uqi->sm_ttycommon); - /* it just frees any pending ioctl */ - - uqi->sm_ttycommon->t_cflag = 0; - uqi->sm_ttycommon->t_flags = 0; - - /* - * Reset the queue pointers to NULL. - * If a thread is qwaiting in the open routine it will recheck - * the q_ptr. - */ - rq->q_ptr = NULL; - WR(rq)->q_ptr = NULL; - UNLOCK_UNIT(uqi); - - if (sm_ssp->sm_lconsole == uqi) { - /* this will never be the outdial device closing */ - sm_ssp->sm_lconsole = 0; - } - /* - * If there is another thread waiting for this close then unblock - * the thread by putting a message on its read queue. - */ - if (uqi->sm_waitq) { - sm_dbg('C', ("close(0x%p): doing putctl on 0x%p\n", - rq, uqi->sm_waitq)); - if (rq == uqi->sm_waitq) - sm_log("close: waitq and closeq are same q\n"); - (void) putctl(uqi->sm_waitq, M_CTL); - } - - uqi->sm_flags &= ~(EXCL_OPEN | FULLY_OPEN); - sm_dbg('C', ("close: returning ok.\n")); - return (0); -} - -/* - * Initialise the software abort sequence for use when one of the - * driver's nodes provides the system console. - */ -static void -sm_set_abort() -{ - char ds[3] = { '\r', '~', CNTRL('b') }; - char as[SM_MAX_ABSLEN]; - int len = SM_MAX_ABSLEN; - - if (ddi_prop_op(DDI_DEV_T_ANY, sm_ssp->sm_dip, PROP_LEN_AND_VAL_BUF, 0, - "abort-str", as, &len) != DDI_PROP_SUCCESS || - (len = strlen(as)) < SM_MIN_ABSLEN) { - (void) strcpy(as, ds); - len = strlen(as); - } else { - char *s; - int i; - - for (s = as, i = 0; i < len-1; i++, s++) { - if (as[i] == '^' && as[i+1] >= 'a' && as[i+1] <= 'z') { - *s = as[i+1] - 'a' + 1; - i++; - } else { - *s = as[i]; - } - } - *s++ = as[i]; - *s = '\0'; - len = strlen(as); - } - - if (len < SM_MIN_ABSLEN) - (void) strcpy(sm_ssp->sm_abs, ds); - else - (void) strcpy(sm_ssp->sm_abs, as); -} - -/* - * - * sm_attach - initialisation routine per driver instance. - */ -static int -sm_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) -{ - int unit; - char name[32]; - sm_uqi_t *uqi; - sm_lqi_t *lqip; - - /* - * Is this an attach? - */ - if (cmd != DDI_ATTACH) { - return (DDI_FAILURE); - } - - /* - * Validate the instance number (sm is a single instance driver). - */ - if (sm_ssp) { /* only one instance allowed */ - return (DDI_FAILURE); - } - - sm_instance = ddi_get_instance(dip); - - /* - * Create the default minor node which will become the console. - * (create it with three different names).: - * con which appears in the /dev filesystem; - * input which matches the prom /multiplexer:input node; - * output which matches the prom /multiplexer:input node - * Create a minor node for control operations. - */ - if (ddi_create_minor_node(dip, "con", S_IFCHR, 0, - DDI_PSEUDO, 0) != DDI_SUCCESS || - ddi_create_minor_node(dip, "input", S_IFCHR, 0, - DDI_PSEUDO, 0) != DDI_SUCCESS || - ddi_create_minor_node(dip, "output", S_IFCHR, 0, - DDI_PSEUDO, 0) != DDI_SUCCESS || - ddi_create_minor_node(dip, "ctl", S_IFCHR, 1, - DDI_PSEUDO, 0) != DDI_SUCCESS) { - - cmn_err(CE_WARN, "sm_attach: create minors failed.\n"); - ddi_remove_minor_node(dip, NULL); - return (DDI_FAILURE); - } - - smctlunit = 1; - - /* - * Allocate private state for this instance. - */ - sm_ssp = (sm_ss_t *)kmem_zalloc(sizeof (sm_ss_t), KM_SLEEP); - - /* - * Initialise per instance data. - */ - sm_ssp->sm_dip = dip; - - /* - * Get required debug level. - */ - sm_ssp->sm_trflag = ddi_prop_get_int(DDI_DEV_T_ANY, dip, - DDI_PROP_DONTPASS, "sm-trlv", sm_default_trflag); - - sm_max_units = ddi_prop_get_int(DDI_DEV_T_ANY, dip, - DDI_PROP_DONTPASS, "sm-max-units", sm_max_units); - sm_minor_cnt = ddi_prop_get_int(DDI_DEV_T_ANY, dip, - DDI_PROP_DONTPASS, "sm-minor-cnt", 0); - - sm_refuse_opens = ddi_prop_get_int(DDI_DEV_T_ANY, dip, - DDI_PROP_DONTPASS, "sm-refuse-opens", sm_refuse_opens); - - sm_ssp->sm_ctrla_abort_on = ddi_prop_get_int(DDI_DEV_T_ANY, dip, - DDI_PROP_DONTPASS, "sm-ctrla-abort-on", 1); - sm_ssp->sm_break_abort_on = ddi_prop_get_int(DDI_DEV_T_ANY, dip, - DDI_PROP_DONTPASS, "sm-break-abort-on", 0); - - sm_set_abort(); - - sm_ssp->sm_lqs = (sm_lqi_t *)kmem_zalloc(sizeof (sm_lqi_t) * MAX_LQS, - KM_SLEEP); - sm_ssp->sm_uqs = (sm_uqi_t *)kmem_zalloc(sizeof (sm_uqi_t) * NLUNITS, - KM_SLEEP); - - for (unit = 2; unit < NLUNITS && unit < sm_minor_cnt + 2; unit++) { - - if (snprintf(name, sizeof (name), "sm%c", 'a' + unit-2) > - sizeof (name)) { - cmn_err(CE_WARN, - "sm_attach: create device for unit %d failed.\n", - unit); - } else if (ddi_create_minor_node(dip, name, S_IFCHR, - unit, DDI_NT_SERIAL, NULL) != DDI_SUCCESS) { - ddi_remove_minor_node(dip, NULL); - return (DDI_FAILURE); - } - - if (snprintf(name, sizeof (name), "sm%c,cu", 'a' + unit-2) > - sizeof (name)) { - cmn_err(CE_WARN, - "sm_attach: create cu device for unit %d failed.\n", - unit); - continue; - } else if (ddi_create_minor_node(dip, name, S_IFCHR, - unit|OUTLINE, DDI_NT_SERIAL_DO, NULL) != DDI_SUCCESS) { - ddi_remove_minor_node(dip, NULL); - return (DDI_FAILURE); - } - } - - for (unit = 0; unit < NLUNITS; unit++) { - - uqi = get_uqi(sm_ssp, unit); - uqi->sm_lqs = 0; - uqi->sm_dev = NODEV; - uqi->sm_nlqs = 0; - uqi->sm_lunit = unit; - uqi->sm_protocol = NULL_PROTOCOL; - mutex_init(uqi->sm_umutex, NULL, MUTEX_DRIVER, NULL); - cv_init(uqi->sm_ucv, NULL, CV_DRIVER, NULL); - mutex_init(&uqi->sm_ttycommon->t_excl, NULL, - MUTEX_DRIVER, NULL); - } - - for (unit = 0; unit < MAX_LQS; unit++) { - lqip = get_lqi(sm_ssp, unit); - lqip->sm_unit = unit; - lqip->sm_hadkadbchar = 0; - lqip->sm_nachar = sm_ssp->sm_abs; - lqip->sm_ioflag = FORIO; - lqip->sm_ctrla_abort_on = sm_ssp->sm_ctrla_abort_on; - lqip->sm_break_abort_on = sm_ssp->sm_break_abort_on; - mutex_init(lqip->sm_umutex, NULL, MUTEX_DRIVER, NULL); - cv_init(lqip->sm_ucv, NULL, CV_DRIVER, NULL); - mutex_init(&lqip->sm_ttycommon->t_excl, NULL, - MUTEX_DRIVER, NULL); - } - - return (DDI_SUCCESS); -} - -/* - * - * sm_detach - detach routine per driver instance. - */ -static int -sm_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) -{ - sm_uqi_t *lu; - sm_lqi_t *pu; - int unit; - - /* - * Is this a detach request for instance 0 (single instance driver). - */ - if (cmd != DDI_DETACH) - return (DDI_FAILURE); - - if (sm_ssp == NULL) - return (DDI_FAILURE); - - sm_dbg('V', ("detach ...")); - - - /* - * Check that all the upper and lower queues are closed. - */ - - for (unit = 0; unit < NLUNITS; unit++) { - lu = &sm_ssp->sm_uqs[unit]; - if (lu && lu->sm_protocol != NULL_PROTOCOL) { - sm_dbg('V', ("detach: upper unit still open.\n")); - return (DDI_FAILURE); - } - } - for (unit = 0; unit < MAX_LQS; unit++) { - pu = &sm_ssp->sm_lqs[unit]; - if (pu && pu->sm_linkid != 0) { - sm_dbg('V', ("detach: lower unit still linked (%d)\n", - pu->sm_linkid)); - return (DDI_FAILURE); - } - } - - for (unit = 0; unit < NLUNITS; unit++) { - lu = &sm_ssp->sm_uqs[unit]; - mutex_destroy(lu->sm_umutex); - cv_destroy(lu->sm_ucv); - mutex_destroy(&lu->sm_ttycommon->t_excl); - } - for (unit = 0; unit < MAX_LQS; unit++) { - pu = &sm_ssp->sm_lqs[unit]; - mutex_destroy(pu->sm_umutex); - cv_destroy(pu->sm_ucv); - mutex_destroy(&pu->sm_ttycommon->t_excl); - } - - /* - * Tidy up per instance state. - */ - kmem_free(sm_ssp->sm_lqs, sizeof (sm_lqi_t) * MAX_LQS); - kmem_free(sm_ssp->sm_uqs, sizeof (sm_uqi_t) * NLUNITS); - kmem_free(sm_ssp, sizeof (sm_ss_t)); - - sm_ssp = 0; - - /* - * Remove all of the devices created in attach. - */ - ddi_remove_minor_node(dip, NULL); - - return (DDI_SUCCESS); -} - -/* - * SECTION - * Driver interface to the OS. - */ - -/* - * The driver is responsible for managing the mapping between the file system - * device types (major/minor pairs) and the corresponding instance of the driver - * or device information pointer (dip). - * sm_info - return the instance or dip corresponding to the dev_t. - */ -/*ARGSUSED*/ -static int -sm_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result) -{ - int res = DDI_SUCCESS; - - switch (infocmd) { - case DDI_INFO_DEVT2DEVINFO: - if (sm_ssp == NULL) - res = DDI_FAILURE; - else - *result = (void *)sm_ssp->sm_dip; - break; - - case DDI_INFO_DEVT2INSTANCE: - *result = (void*)0; /* single instance driver */ - break; - - default: - res = DDI_FAILURE; - break; - } - - return (res); -} - -/* - * End of driver implementation - */ - -/* - * Loadable module interface to the kernel - */ - -/* - * Firstly the Streams specific interface - */ - -/* - * Solaris driver/STREAM initialisation structures. - */ -static struct module_info uinfo = -{ - SM_MOD_ID, - TTYMUX_DRVNAME, - 0, /* min packet size */ - INFPSZ, /* max packet size */ - 2048, /* high water mark */ - 256, /* low water mark */ -}; - -/* - * Use zero water marks becuase the lower queues are used only for flow control. - */ -static struct module_info linfo = -{ - SM_MOD_ID, - TTYMUX_DRVNAME, - 0, /* min packet size */ - INFPSZ, /* max packet size */ - 0, /* high water mark */ - 0 /* low water mark */ -}; - - -/* - * Solaris upper read STREAM initialisation structure. - */ -static struct qinit urinit = -{ - sm_urput, /* put */ - sm_ursrv, /* service */ - sm_open, /* open */ - sm_close, /* close */ - NULL, /* admin */ - &uinfo, /* module info */ - NULL /* stats */ -}; - -/* - * Solaris upper write STREAM initialisation structure. - */ -static struct qinit uwinit = -{ - sm_uwput, - sm_uwsrv, - NULL, - NULL, - NULL, - &uinfo, - NULL -}; - -/* - * Solaris lower read STREAM initialisation structure. - */ -static struct qinit lrinit = -{ - sm_lrput, - sm_lrsrv, - NULL, - NULL, NULL, - &linfo, - NULL -}; - -/* - * Solaris lower write STREAM initialisation structure. - */ -static struct qinit lwinit = -{ - putq, - sm_lwsrv, - NULL, - NULL, - NULL, - &linfo, - NULL -}; - -/* - * Multiplexing STREAM structure. - */ -struct streamtab sm_streamtab = -{ - &urinit, - &uwinit, - &lrinit, - &lwinit -}; - -/* - * Driver operations structure (struct cb_ops) and - * driver dynamic loading functions (struct dev_ops). - */ - -/* - * Fold the Stream interface to the kernel into the driver interface - * to the OS. - */ - -DDI_DEFINE_STREAM_OPS(sm_ops, \ - nulldev, nulldev, \ - sm_attach, sm_detach, nodev, \ - sm_info, (D_NEW | D_MTQPAIR|D_MTOUTPERIM|D_MTOCEXCL | D_MP), - &sm_streamtab, ddi_quiesce_not_supported); - -/* - * Driver module information. - */ -extern struct mod_ops mod_driverops; -static struct modldrv modldrv = -{ - &mod_driverops, - "serial mux driver", - &sm_ops -}; - -static struct modlinkage modlinkage = -{ - MODREV_1, - &modldrv, - NULL -}; - -/* - * Define the body of our interface to the OS. - */ - -/* - * '_init' is called by Solaris to initialise any driver - * specific state and to install the driver. - */ -int -_init(void) -{ - return (mod_install(&modlinkage)); -} - -/* - * _info - return this drivers interface to the kernel. - */ -int -_info(struct modinfo *modinfop) -{ - return (mod_info(&modlinkage, modinfop)); -} - -/* - * _fini - the OS is finished with the services provided by the driver. - * remove ourself and then remove any footprint that remains. - */ -int -_fini(void) -{ - return (mod_remove(&modlinkage)); -} diff --git a/usr/src/uts/sun/io/ttymux/ttymux_impl.h b/usr/src/uts/sun/io/ttymux/ttymux_impl.h deleted file mode 100644 index d0a44e81f5..0000000000 --- a/usr/src/uts/sun/io/ttymux/ttymux_impl.h +++ /dev/null @@ -1,239 +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) 2001 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ifndef _TTYMUX_IMPL_H -#define _TTYMUX_IMPL_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/types32.h> -#include <sys/param.h> - -/* - * Local definitions. - */ -#define SM_TRBIT(code) (1 << (code)-'@') - -extern uint_t sm_max_units; - -#define MAX_LQS (sm_max_units) -#define NLUNITS (MAX_LQS + 2) - -/* - * Re-use minor device encoding used by the se(7D) driver. - */ -#define ASYNC_DEVICE (0) -#define OUTLINE (1 << (NBITSMINOR32 - 1)) -#define NULL_PROTOCOL 0 -#define ASYN_PROTOCOL 1 -#define OUTD_PROTOCOL 2 - -#define DEV_TO_UNIT(dev) (getminor(dev) & ~OUTLINE) -#define DEV_TO_PROTOBITS(dev) (getminor(dev) & OUTLINE) - -/* - * Driver id - */ -#define SM_MOD_ID 0x534d - -/* - * Access modes of the two halves to each others flags - * Q uq->flags lq->flags - * uq rw r - * lq - rw - */ -/* - * A lower queue is associated with an upper queue - * (used for synchronising dissasociate reqests with the lower half) - * A lower q will not forward messages if SM_UQVALID is set in uqflags. - */ -#define SM_UQVALID (0x1) /* written by an upper q read by a lower q */ -#define SM_OBPCNDEV (0x2) /* set when this device is an OBP console */ - -/* - * unused flags - */ -#define FLUSHR_PEND (0x1) /* M_FLUSH is expected on all the lr q's */ - -/* - * An open has completed on this stream. - */ -#define FULLY_OPEN (0x2) -#define EXCL_OPEN (0x4) - -#define SM_CARON (0x8) -/* - * Flags to disable queues controlled from below. - */ -#define HANGUP_MODE (0x10) /* not used (sets WERROR_MODE instead) */ -#define RERROR_MODE (0x20) /* read error on stream (unset by closing) */ -#define WERROR_MODE (0x40) /* write side error on the stream (set by */ - /* M_HANGUP/M_ERROR */ - /* unset by M_UNHANGUP/M_ERROR) */ -#define ERROR_MODE (0x60) /* read error on stream (unset by M_ERROR) */ - -/* - * Flags to disable queues controlled from above. - * Also used by set on queues which are OBP consoles - */ -#define SM_STOPPED (0x080) /* M_STOP has been seen */ -#define SM_ISTOPPED (0x100) /* M_STOPI has been seen */ - -/* - * A stream wants something. - */ -#define WANT_SC (0x200) /* carrier status of a stream required */ -#define WANT_CL (0x400) /* CLOCAL status of a stream required */ -#define WANT_CD (0x800) /* CD modem status of a line required */ -#define WANT_CDSTAT (0xe00) -#define WANT_TCSET (0x20000) /* send down initial termios settings */ - -#define WANT_RENB (0x40000) /* read q is flowcontrolled */ - -#define SM_IOCPENDING (0x80000) -#define SM_CLOSE (0x100000) -#define SM_INTERNALIOC (0x200000) - -#define SM_LOGINREQ (0x400000) - -#define LOCK_UNIT(u) (mutex_enter(u->sm_umutex)) /* Lock per-stream data */ -#define UNLOCK_UNIT(u) (mutex_exit(u->sm_umutex)) /* Unlock per-stream data */ - -/* - * Checks whether an open could potentially block. - */ -#define BLOCKING(unitp, proto, flag) \ - (!(flag & (FNDELAY|FNONBLOCK)) && \ - !(proto == OUTLINE) && \ - unitp->sm_lqs && \ - (unitp->sm_flags & SM_CARON) == 0) - -/* - * Update termios style control flag with a termio style flag. - */ -#define SM_SETCFLAG(qi, tc) \ - qi->sm_ttycommon->t_cflag = \ - (qi->sm_ttycommon->t_cflag & 0xffff0000 | (tc)->c_cflag) -#define SM_SETLFLAG(qi, tc) \ - qi->sm_ttycommon->t_iflag = \ - (qi->sm_ttycommon->t_iflag & 0xffff0000 | (tc)->c_iflag) - -#define SM_WQ(qi) (qi->sm_ttycommon->t_writeq) -#define SM_RQ(qi) (qi->sm_ttycommon->t_readq) - -/* - * - */ -struct sm_iocinfo { - int sm_id; - int sm_cmd; - void *sm_data; -}; - -/* - * Perform a per instance search for a specified per stream structure. - */ -#define get_lqi(ssp, unit) \ - ((unit < MAX_LQS) ? &ssp->sm_lqs[unit] : 0) - -#define get_uqi(ssp, unit) \ - ((unit < NLUNITS) ? &ssp->sm_uqs[unit] : NULL) - -#define CNTRL(c) ((c)&037) - -#define sm_allocb(size, pri) allocb(size, pri) -#define sm_copymsg(mp) ((DB_TYPE(mp) == M_DATA) ? dupmsg(mp) : copymsg(mp)) -#define sm_freemsg(mp) freemsg(mp) - -/* - * macro to improve performance. The cond is checked before deciding whether - * to create a new stack frame for the debug call - * Calls to sm_dbg should not occur in hanging statements - alternatively - * bracket SM_CMD with a do .... while (0) - */ - -#define SM_CMD(cond, stmt) { if (cond) stmt; } -#define sm_dbg(lvl, args) SM_CMD(sm_ssp->sm_trflag & SM_TRBIT(lvl), \ - sm_debug args) - -#define SM_SLOT_RED 3 -#define SM_MAX_SLOT_WAIT 3 - -#define sm_dev2unit(dev) (getminor(dev) & ~OUTLINE) - -#define LQI2ASSOC(a, l) \ - (a)->ttymux_linkid = (l)->sm_linkid; \ - (a)->ttymux_tag = (l)->sm_tag; \ - (a)->ttymux_ioflag = (l)->sm_ioflag; \ - (a)->ttymux_ldev = (l)->sm_dev; \ - (a)->ttymux_udev = ((l)->sm_uqi == 0) ? NODEV : \ - makedevice(ddi_driver_major(sm_ssp->sm_dip), \ - (l)->sm_uqi->sm_lunit); \ - (void) strncpy((a)->ttymux_path, (l)->sm_path, MAXPATHLEN) - -#define LQI2ASSOC32(a, l) \ - (a)->ttymux32_linkid = (l)->sm_linkid; \ - (a)->ttymux32_tag = (uint32_t)(l)->sm_tag; \ - (a)->ttymux32_ioflag = (l)->sm_ioflag; \ - (void) cmpldev(&(a)->ttymux32_ldev, (l)->sm_dev);\ - (a)->ttymux32_udev = ((l)->sm_uqi == 0) ? NODEV32 : \ - ((void) cmpldev(&(a)->ttymux32_udev, \ - makedevice(ddi_driver_major(sm_ssp->sm_dip), \ - (l)->sm_uqi->sm_lunit)), \ - (a)->ttymux32_udev); \ - (void) strncpy((a)->ttymux32_path, (l)->sm_path, MAXPATHLEN) - -#define CNTRL(c) ((c)&037) - -/* - * 32 bit eqivalents of structures defined in sys/ttymuxuser.h - */ -typedef struct ttymux_association32 { - - dev32_t ttymux32_udev; /* the upper device to be associated */ - dev32_t ttymux32_ldev; - /* the device type of a linked lower stream */ - int ttymux32_linkid; - /* the linkid of a linked lower stream */ - uint32_t ttymux32_tag; /* tagged association */ - uint_t ttymux32_ioflag; /* FORINPUT FOROUTPUT FORIO */ - char ttymux32_path[MAXPATHLEN]; /* device path */ -} ttymux_assoc32_t; - -typedef struct ttymux_associations32 { - uint32_t ttymux32_nlinks; - caddr32_t ttymux32_assocs; -} ttymux_assocs32_t; - -#ifdef __cplusplus -} -#endif - -#endif /* _TTYMUX_IMPL_H */ diff --git a/usr/src/uts/sun/io/ttymux/ttymux_ioctl.c b/usr/src/uts/sun/io/ttymux/ttymux_ioctl.c deleted file mode 100644 index dd03a8a842..0000000000 --- a/usr/src/uts/sun/io/ttymux/ttymux_ioctl.c +++ /dev/null @@ -1,1358 +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. - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * DESCRIPTION - * - * ttymux_ioctl - Handler for ttymux specific ioctl calls. - * - */ - -#include <sys/types.h> -#include <sys/strsubr.h> -#include <sys/strsun.h> -#include <sys/errno.h> -#include <sys/stat.h> -#include <sys/kmem.h> -#include <sys/ddi.h> -#include <sys/termio.h> -#include <sys/mkdev.h> -#include <sys/sunddi.h> -#include <sys/esunddi.h> -#include <sys/consdev.h> -#include <sys/promif.h> - -#include <sys/ttymux.h> -#include "ttymux_impl.h" - -/* - * Extern declarations - */ -extern mblk_t *mkiocb(uint_t); -extern int nulldev(); -extern uintptr_t space_fetch(char *key); -extern void prom_interpret(char *, uintptr_t, uintptr_t, uintptr_t, - uintptr_t, uintptr_t); - -/* - * Imported ttymux routines - */ -extern void sm_debug(char *, ...); -extern void sm_log(char *, ...); -extern sm_lqi_t *get_lqi_byid(int); -extern sm_lqi_t *get_lqi_bydevt(dev_t); -extern int sm_associate(int, sm_lqi_t *, ulong_t, uint_t, char *); -extern int sm_disassociate(int, sm_lqi_t *, ulong_t); - -/* - * Exported ttymux routines - */ -int ttymux_abort_ioctl(mblk_t *); -int ttymux_device_init(sm_lqi_t *); -int ttymux_device_fini(sm_lqi_t *); -int sm_ioctl_cmd(sm_uqi_t *, mblk_t *); - -/* - * Imported ttymux variables - */ -extern sm_ss_t *sm_ssp; - -static int -mblk2assoc(mblk_t *mp, ttymux_assoc_t *assoc) -{ - struct iocblk *iobp = (struct iocblk *)mp->b_rptr; - - sm_dbg('M', ("mblk2assoc:\n")); - if (mp->b_cont == NULL) - return (EINVAL); - -#ifdef _SYSCALL32_IMPL - if ((iobp->ioc_flag & IOC_MODELS) != IOC_NATIVE) { - ttymux_assoc32_t *assoc32; - - sm_dbg('I', ("mblk2assoc: b_cont 0x%p count %d (sz %d)\n", - mp->b_cont, iobp->ioc_count, sizeof (*assoc32))); - - if (iobp->ioc_count < sizeof (ttymux_assoc32_t)) - return (EINVAL); - - assoc32 = (ttymux_assoc32_t *)mp->b_cont->b_rptr; - assoc->ttymux_udev = expldev(assoc32->ttymux32_udev); - assoc->ttymux_ldev = expldev(assoc32->ttymux32_ldev); - assoc->ttymux_linkid = assoc32->ttymux32_linkid; - assoc->ttymux_tag = assoc32->ttymux32_tag; - assoc->ttymux_ioflag = assoc32->ttymux32_ioflag; - (void) strncpy(assoc->ttymux_path, assoc32->ttymux32_path, - MAXPATHLEN); - - } else -#endif - if (iobp->ioc_count < sizeof (*assoc)) { - return (EINVAL); - } else { - *assoc = *(ttymux_assoc_t *)mp->b_cont->b_rptr; - } - sm_dbg('M', ("mblk2assoc (%d): dev %d:%d not found\n", - assoc->ttymux_linkid, getmajor(assoc->ttymux_ldev), - getminor(assoc->ttymux_ldev))); - return (0); -} - -/* - * Given a device path return an OBP alias for it if it exists. - */ -static char * -val2alias(pnode_t node, char *path) -{ - char *buf1; - char *buf2; - char *propname, *propval; - int proplen; - - if (node == OBP_BADNODE) - return (NULL); - - sm_dbg('A', ("Looking for an alias for: %s (len %d)\n", - path, strlen(path))); - - /* - * Ask for first property by passing a NULL string - */ - buf1 = kmem_alloc(OBP_MAXPROPNAME, KM_SLEEP); - buf2 = kmem_zalloc(OBP_MAXPROPNAME, KM_SLEEP); - buf1[0] = '\0'; - - while (propname = (char *)prom_nextprop(node, buf1, buf2)) { - if (strlen(propname) == 0) - break; /* end of prop list */ - - (void) strcpy(buf1, propname); - - proplen = prom_getproplen(node, propname); - if (proplen == 0) - continue; - propval = kmem_zalloc(proplen + 1, KM_SLEEP); - (void) prom_getprop(node, propname, propval); - - if (strcmp(propval, path) == 0) { - kmem_free(propval, proplen + 1); - kmem_free(buf1, OBP_MAXPROPNAME); - sm_dbg('A', ("Alias is : %s\n", buf2)); - return (buf2); - } - - kmem_free(propval, proplen + 1); - bzero(buf2, OBP_MAXPROPNAME); - } - - kmem_free(buf1, OBP_MAXPROPNAME); - kmem_free(buf2, OBP_MAXPROPNAME); - - return (NULL); -} - -/* - * Tell OBP that this device is now usable - */ -static void -enable_device(sm_mux_state_t *ms, sm_console_t *cn) -{ - char *enb_str = "\" enable-device\" rot $call-method"; - - if (!cn->sm_obp_con) - return; - - sm_dbg('A', ("ttymux: enabling %d:%d\n", - getmajor(cn->sm_dev), getminor(cn->sm_dev))); - - if (cn->sm_i_ihdl != 0) - prom_interpret(enb_str, (caddr32_t)ms->sm_cons_stdin.sm_i_ihdl, - (caddr32_t)cn->sm_i_ihdl, 0, 0, 0); - - if (cn->sm_o_ihdl != 0 && cn->sm_o_ihdl != cn->sm_i_ihdl) - prom_interpret(enb_str, (caddr32_t)ms->sm_cons_stdout.sm_o_ihdl, - (caddr32_t)cn->sm_o_ihdl, 0, 0, 0); -} - -/* - * Tell OBP that this device is no longer usable - */ -static void -disable_device(sm_mux_state_t *ms, sm_console_t *cn) -{ - char *dis_str = "\" disable-device\" rot $call-method"; - - if (!cn->sm_obp_con) - return; - - sm_dbg('A', ("ttymux: disabling %d:%d\n", - getmajor(cn->sm_dev), getminor(cn->sm_dev))); - - if (cn->sm_i_ihdl != 0) - prom_interpret(dis_str, (caddr32_t)ms->sm_cons_stdin.sm_i_ihdl, - (caddr32_t)cn->sm_i_ihdl, 0, 0, 0); - if (cn->sm_o_ihdl != 0 && cn->sm_o_ihdl != cn->sm_i_ihdl) - prom_interpret(dis_str, (caddr32_t)ms->sm_cons_stdout.sm_o_ihdl, - (caddr32_t)cn->sm_o_ihdl, 0, 0, 0); -} - -static void -device_init_impl(sm_mux_state_t *ms, sm_console_t *cn, sm_lqi_t *plqi) -{ - uint_t flags = 0; - dev_info_t *ldip; - - sm_dbg('I', ("device_init_impl:\n")); - - if (plqi == NULL || cn == NULL) - return; - - flags = (uint_t)cn->sm_mode; - sm_dbg('I', ("device_init_impl: flgs %d con %d\n", flags, - cn->sm_obp_con)); - if (ldip = e_ddi_hold_devi_by_dev(cn->sm_dev, 0)) { - - /* - * Indicate to the linked device that it is - * providing a multiplexed console. - */ - if (flags & (uint_t)FORINPUT) - (void) e_ddi_prop_create(cn->sm_dev, ldip, - DDI_PROP_CANSLEEP, "obp-input-console", 0, 0); - if (flags & (uint_t)FOROUTPUT) - (void) e_ddi_prop_create(cn->sm_dev, ldip, - DDI_PROP_CANSLEEP, "obp-output-console", 0, 0); - - ddi_release_devi(ldip); - } - - if (flags) { - plqi->sm_ioflag = flags; - if (cn->sm_obp_con) - plqi->sm_uqflags |= SM_OBPCNDEV; - plqi->sm_ctrla_abort_on = sm_ssp->sm_ctrla_abort_on; - plqi->sm_break_abort_on = sm_ssp->sm_break_abort_on; - } - - /* - * Tell OBP that its ok to use this console - */ - enable_device(ms, cn); -} - -static void -device_fini_impl(sm_mux_state_t *ms, sm_console_t *cn, sm_lqi_t *plqi) -{ - dev_info_t *ldip; - - if (plqi == NULL || cn == NULL) - return; - /* - * Indicate to the linked device that it is no longer - * providing a multiplexed console. - */ - if (ldip = e_ddi_hold_devi_by_dev(plqi->sm_dev, 0)) { - if (plqi->sm_ioflag & (uint_t)FORINPUT) - (void) e_ddi_prop_remove(plqi->sm_dev, - ldip, "obp-input-console"); - if (plqi->sm_ioflag & (uint_t)FOROUTPUT) - (void) e_ddi_prop_remove(plqi->sm_dev, - ldip, "obp-output-console"); - - ddi_release_devi(ldip); - } - plqi->sm_ioflag = 0; - plqi->sm_uqflags &= ~SM_OBPCNDEV; - disable_device(ms, cn); -} - -static int -read_prop(pnode_t node, char *propname, char **propval) -{ - int proplen = prom_getproplen(node, propname); - - if (proplen < 0) - return (proplen); - *propval = kmem_zalloc(proplen + 1, KM_SLEEP); - if (proplen > 0) - (void) prom_getprop(node, propname, *propval); - else - *propval = 0; - - return (proplen); -} - -/* - * Parse a list of tokens - */ -static char * -sm_strtok_r(char *p, char *sep, char **lasts) -{ - char *e, *tok = NULL; - - if (p == 0 || *p == 0) - return (NULL); - - e = p + strlen(p); - - do { - if (strchr(sep, *p) != NULL) { - if (tok != NULL) { - *p = 0; - *lasts = p + 1; - return (tok); - } - } else if (tok == NULL) { - tok = p; - } - } while (++p < e); - - *lasts = NULL; - if (tok != NULL) - return (tok); - return (NULL); -} - -/* - * Add or remove an alias from a property list of aliases: - * path: an OBP device path - * pname: property name containing a space separated list of aliases - * append: if true include the alias for path in the property list - * otherwise remove the alias from the list. - */ -static int -upd_config(boolean_t append, char *pname, char *path) -{ - pnode_t onode, anode; - size_t plen; /* length of property name */ - char *pval; /* value of property */ - char *tok, *lasts; - char *aliases[TTYMUX_MAX_LINKS]; - size_t i, cnt, len; - boolean_t found; - char *nval, *alias = NULL; - - if ((anode = prom_alias_node()) == OBP_BADNODE || - (onode = prom_optionsnode()) == OBP_BADNODE) { - sm_dbg('I', ("upd_config: no alias or options node.\n")); - return (1); - } - - if ((plen = read_prop(onode, pname, &pval)) < 0) - return (1); - - sm_dbg('I', ("upd_config: %s=%s (%s)\n", pname, pval, path)); - found = B_FALSE; - for (len = 0, cnt = 0, tok = sm_strtok_r(pval, " \t", &lasts); - tok != NULL && cnt < TTYMUX_MAX_LINKS; - tok = sm_strtok_r(lasts, " \t", &lasts)) { - char *aval; - size_t alen; - - if ((alen = read_prop(anode, tok, &aval)) < 0) - continue; - - /* does this alias match the requested path */ - if (strcmp(aval, path) == 0 || - (strstr(path, aval) != NULL && - strchr(aval, ':') == NULL && strchr(path, ':') != NULL && - strcmp(strchr(path, ':'), ":a") == 0)) { - if (!found && append) { - kmem_free(aval, alen + 1); - goto out; - } - found = B_TRUE; - } else { - aliases[cnt++] = tok; - len += strlen(tok) + 1; - } - kmem_free(aval, alen + 1); - } - - sm_dbg('I', ("%d aliases\n", cnt)); - if (append) { - if (cnt + 1 == TTYMUX_MAX_LINKS) - goto out; - - if ((alias = val2alias(anode, path)) == NULL) { - char *mnode = strstr(path, ":a"); - - if (mnode != 0) { - *mnode = '\0'; - alias = val2alias(anode, path); - *mnode = ':'; - } - } - if (alias == NULL) { - sm_dbg('I', ("No alias for %s\n", path)); - goto out; - } - aliases[cnt++] = alias; - len += strlen(alias) + 1; - } else if (!found) { - goto out; - } - - sm_dbg('I', ("%d aliases (len %d)\n", cnt, len)); - if (len == 0) - goto out; - ASSERT(len > 1 && cnt > 0); - - nval = kmem_zalloc(len, KM_SLEEP); - for (i = 0; ; ) { - ASSERT(strlen(nval) + strlen(aliases[i]) + 1 <= len); - sm_dbg('I', ("alias %s\n", aliases[i])); - (void) strcat(nval, aliases[i]); - if (++i == cnt) - break; - (void) strcat(nval, " "); - } - - sm_dbg('I', ("setprop: %s=%s (%d)\n", pname, nval, len)); - - (void) prom_setprop(onode, pname, nval, len); - - kmem_free(nval, len); - - if (alias != NULL) - kmem_free(alias, OBP_MAXPROPNAME); -out: - sm_dbg('I', ("upd_config: returning.\n")); - kmem_free(pval, plen + 1); - return (0); -} - -/* - * - */ -static int -update_config(sm_mux_state_t *ms, char *path, io_mode_t mode, int cmd) -{ - sm_dbg('I', ("update_config: path %s io %d\n", path ? path : "", mode)); - if (path == 0 || *path == 0) { - sm_dbg('I', ("update_config: EINVAL - no path\n")); - return (1); - } - if (prom_is_openprom() == 0) - return (0); - - if ((mode & FORINPUT) && ms->sm_ialias != NULL) - (void) upd_config((cmd == TTYMUX_ASSOC), ms->sm_ialias, path); - if ((mode & FOROUTPUT) && ms->sm_oalias != NULL) - (void) upd_config((cmd == TTYMUX_ASSOC), ms->sm_oalias, path); - return (0); -} - -/* - * Convert a dev_t to a device path - */ -static char * -sm_di_path(dev_t dev) -{ - char *p, *path; - - if (dev == NODEV) - return (NULL); - - p = kmem_zalloc(MAXPATHLEN + 1, KM_SLEEP); - if (ddi_dev_pathname(dev, S_IFCHR, p) == DDI_SUCCESS) { - path = kmem_alloc(strlen(p) + 1, KM_SLEEP); - (void) strcpy(path, p); - } - kmem_free(p, MAXPATHLEN + 1); - - return (path); -} - -static int -console_cmd(int cmd, ttymux_assoc_t *assoc) -{ - sm_mux_state_t *ms; - sm_console_t *cn; - uint_t j; - - sm_dbg('I', ("console_cmd ENTER: %s\n", cmd == TTYMUX_DISASSOC ? - "TTYMUX_DISASSOC" : "TTYMUX_ASSOC")); - - if (assoc->ttymux_ldev == NODEV && *assoc->ttymux_path != '/') { - sm_lqi_t *lqi = get_lqi_byid(assoc->ttymux_linkid); - if (lqi == 0 || lqi->sm_dev == NODEV) { - sm_dbg('I', ("console_cmd: no id link %d cmd %d\n", - assoc->ttymux_linkid, cmd)); - return (EINVAL); - } - assoc->ttymux_ldev = lqi->sm_dev; - } - - sm_dbg('I', ("console_cmd: path %s\n", assoc->ttymux_path)); - - if ((ms = (sm_mux_state_t *)space_fetch(TTYMUXPTR)) == 0) { - sm_dbg('I', ("console_cmd: No muxstate\n")); - return (0); - } - - mutex_enter(&ms->sm_cons_mutex); - - for (cn = ms->sm_cons_links, j = 0; - j < ms->sm_cons_cnt; cn++, j++) { - if (assoc->ttymux_ldev != NODEV && assoc->ttymux_ldev == - cn->sm_dev) { - break; - } else if (cn->sm_path != NULL && - strncmp(cn->sm_path, assoc->ttymux_path, MAXPATHLEN) == 0) { - break; - } - } - - assoc->ttymux_path[MAXPATHLEN - 1] = 0; - if (cmd == TTYMUX_DISASSOC) { - if (j == ms->sm_cons_cnt) { - mutex_exit(&ms->sm_cons_mutex); - return (0); - } - - /* - * Disable the console in OBP and then delete this console - * this console - note that this also deletes OBP - * information - i.e. once it is disassociated it cannot - * be reused as an OBP console - roll on polled I/O! - */ - sm_dbg('I', ("console_cmd: cleaning up\n")); - device_fini_impl(ms, cn, get_lqi_bydevt(assoc->ttymux_ldev)); - - if (cn->sm_path == NULL) { - if (assoc->ttymux_ldev != NODEV) - cn->sm_path = sm_di_path(assoc->ttymux_ldev); - else - (void) update_config(ms, assoc->ttymux_path, - assoc->ttymux_ioflag, cmd); - } - if (cn->sm_path) { - (void) update_config(ms, cn->sm_path, cn->sm_mode, cmd); - kmem_free(cn->sm_path, strlen(cn->sm_path) + 1); - cn->sm_path = NULL; - } - ms->sm_cons_cnt -= 1; - if (ms->sm_cons_cnt > 0) - *cn = ms->sm_cons_links[ms->sm_cons_cnt]; - - sm_dbg('I', ("console_cmd: console %d removed (cnt %d)\n", - j, ms->sm_cons_cnt)); - - } else if (cmd == TTYMUX_ASSOC) { - - if (j == ms->sm_cons_cnt) { - - if (j == TTYMUX_MAX_LINKS) { - mutex_exit(&ms->sm_cons_mutex); - return (ENOMEM); - } - - ms->sm_cons_cnt += 1; - - bzero((caddr_t)cn, sizeof (*cn)); - cn->sm_dev = assoc->ttymux_ldev; - cn->sm_muxid = assoc->ttymux_linkid; - cn->sm_mode = assoc->ttymux_ioflag; - device_init_impl(ms, cn, - get_lqi_bydevt(assoc->ttymux_ldev)); - } else { - cn->sm_dev = assoc->ttymux_ldev; - cn->sm_muxid = assoc->ttymux_linkid; - cn->sm_mode = assoc->ttymux_ioflag; - } - - if (assoc->ttymux_ldev != NODEV) { - cn->sm_path = sm_di_path(assoc->ttymux_ldev); - } else { - cn->sm_path = kmem_alloc(strlen(assoc->ttymux_path) + 1, - KM_SLEEP); - (void) strcpy(cn->sm_path, assoc->ttymux_path); - } - if (cn->sm_path != NULL) - (void) update_config(ms, cn->sm_path, cn->sm_mode, cmd); - else - sm_dbg('I', ("console_cmd: ASSOC No path info")); - } - mutex_exit(&ms->sm_cons_mutex); - sm_dbg('I', ("console_cmd EXIT: %s\n", cmd == TTYMUX_DISASSOC ? - "TTYMUX_DISASSOC" : "TTYMUX_ASSOC")); - return (0); -} - -static int -get_unconfigured_consoles(sm_mux_state_t *ms, ttymux_assoc_t *a) -{ - sm_console_t *cn; - int j, cnt; - - if (ms == 0) - return (0); - - mutex_enter(&ms->sm_cons_mutex); - for (cn = ms->sm_cons_links, cnt = j = 0; j < ms->sm_cons_cnt; - cn++, j++) { - if (cn->sm_path && get_lqi_bydevt(cn->sm_dev) == NULL) { - a->ttymux_linkid = cn->sm_muxid; - a->ttymux_tag = (uint_t)0; - a->ttymux_ioflag = cn->sm_mode; - a->ttymux_udev = cn->sm_mode & FORINPUT ? - ms->sm_cons_stdin.sm_dev : - ms->sm_cons_stdout.sm_dev; - a->ttymux_ldev = NODEV; - (void) strncpy(a->ttymux_path, cn->sm_path, MAXPATHLEN); - cnt++; - a++; - } - } - mutex_exit(&ms->sm_cons_mutex); - return (cnt); -} - -#ifdef _SYSCALL32_IMPL -/* - * Look for any consoles that are not currently plumbed under the multiplexer. - */ -static int -get_unconfigured_consoles32(sm_mux_state_t *ms, ttymux_assoc32_t *a) -{ - sm_console_t *cn; - int j, cnt; - - if (ms == 0) - return (0); - - mutex_enter(&ms->sm_cons_mutex); - for (cn = ms->sm_cons_links, cnt = j = 0; j < ms->sm_cons_cnt; - cn++, j++) { - sm_dbg('I', ("get_unconfigured_consoles: check %s (%d:%d)", - cn->sm_path ? cn->sm_path : "NULL", - getmajor(cn->sm_dev), getminor(cn->sm_dev))); - if (cn->sm_path && get_lqi_bydevt(cn->sm_dev) == NULL) { - a->ttymux32_linkid = 0; - a->ttymux32_tag = (uint32_t)0; - a->ttymux32_ioflag = (uint32_t)cn->sm_mode; - a->ttymux32_ldev = NODEV32; - (void) cmpldev(&a->ttymux32_udev, cn->sm_mode & - FORINPUT ? ms->sm_cons_stdin.sm_dev : - ms->sm_cons_stdout.sm_dev); - - (void) strncpy(a->ttymux32_path, cn->sm_path, - MAXPATHLEN); - cnt++; - a++; - } - } - mutex_exit(&ms->sm_cons_mutex); - return (cnt); -} -#endif - -static int -count_unconfigured_consoles(sm_mux_state_t *ms) -{ - sm_console_t *cn; - int j, cnt; - - if (ms == 0) - return (0); - - mutex_enter(&ms->sm_cons_mutex); - for (cn = ms->sm_cons_links, cnt = j = 0; j < ms->sm_cons_cnt; - cn++, j++) { - sm_dbg('I', ("cnt_unconfigured_consoles: check %s (%d:%d)", - cn->sm_path ? cn->sm_path : "NULL", - getmajor(cn->sm_dev), getminor(cn->sm_dev))); - if (cn->sm_path && get_lqi_bydevt(cn->sm_dev) == NULL) - cnt++; - } - mutex_exit(&ms->sm_cons_mutex); - return (cnt); -} - -/* - * Exported interfaces - */ - -/* - * A console device is no longer associated. - */ -int -ttymux_device_fini(sm_lqi_t *plqi) -{ - int j; - sm_mux_state_t *ms; - - ms = (sm_mux_state_t *)space_fetch(TTYMUXPTR); - - if (plqi == NULL || ms == NULL) - return (0); - - mutex_enter(&ms->sm_cons_mutex); - - for (j = 0; j < ms->sm_cons_cnt; j++) { - - if (ms->sm_cons_links[j].sm_dev == plqi->sm_dev) { - - device_fini_impl(ms, &ms->sm_cons_links[j], plqi); - - mutex_exit(&ms->sm_cons_mutex); - return (0); - } - } - mutex_exit(&ms->sm_cons_mutex); - - return (1); -} - -/* - * A console device is being introduced. - */ -int -ttymux_device_init(sm_lqi_t *plqi) -{ - int j; - sm_mux_state_t *ms; - - ms = (sm_mux_state_t *)space_fetch(TTYMUXPTR); - - if (ms == NULL) - return (0); - - mutex_enter(&ms->sm_cons_mutex); - - for (j = 0; j < ms->sm_cons_cnt; j++) { - - if (ms->sm_cons_links[j].sm_dev == plqi->sm_dev) { - - device_init_impl(ms, &ms->sm_cons_links[j], plqi); - - mutex_exit(&ms->sm_cons_mutex); - return (0); - } - } - mutex_exit(&ms->sm_cons_mutex); - return (1); -} - -/* - * Process a TTYMUX_ASSOCIATE or TTYMUX_DISASSOCIATE ioctl. - */ -static int -ttymux_link_ioctl(mblk_t *mp) -{ - ttymux_assoc_t assoc; - int err; - sm_lqi_t *lqi; - struct iocblk *iobp = (struct iocblk *)mp->b_rptr; - dev_t cidev, codev; - - sm_dbg('I', ("ttymux_link_ioctl:\n")); - if ((err = mblk2assoc(mp, &assoc)) != 0) - return (err); - - sm_dbg('I', ("uminor is %d\n", getminor(assoc.ttymux_udev))); - - if (assoc.ttymux_udev == NODEV) - return (EINVAL); - - err = 0; - - if ((lqi = get_lqi_bydevt(assoc.ttymux_ldev)) == NULL) { - if (assoc.ttymux_linkid < 0) - err = EINVAL; - else if ((lqi = get_lqi_byid(assoc.ttymux_linkid)) == 0) - err = ENOLINK; - } - - if (sm_ssp->sm_ms) { - mutex_enter(&sm_ssp->sm_ms->sm_cons_mutex); - cidev = sm_ssp->sm_ms->sm_cons_stdin.sm_dev; - codev = sm_ssp->sm_ms->sm_cons_stdout.sm_dev; - mutex_exit(&sm_ssp->sm_ms->sm_cons_mutex); - } else { - cidev = codev = NODEV; - } - - if (err != 0) { - if (assoc.ttymux_udev != cidev && assoc.ttymux_udev != codev) - return (err); - (void) console_cmd(iobp->ioc_cmd, &assoc); - return (0); - } else if (assoc.ttymux_udev == cidev || assoc.ttymux_udev == codev) { - (void) console_cmd(iobp->ioc_cmd, &assoc); - } - - if (iobp->ioc_cmd == TTYMUX_ASSOC) - return (sm_associate(sm_dev2unit(assoc.ttymux_udev), - lqi, assoc.ttymux_tag, assoc.ttymux_ioflag, - assoc.ttymux_path)); - else if (iobp->ioc_cmd == TTYMUX_DISASSOC) - return (sm_disassociate(sm_dev2unit(assoc.ttymux_udev), - lqi, assoc.ttymux_tag)); - - return (0); -} - -/* - * Process a TTYMUX_GETLINK ioctl. - */ -int -ttymux_query_link_ioctl(mblk_t *mp) -{ - sm_lqi_t *lqi; - - struct iocblk *iobp = (struct iocblk *)mp->b_rptr; - - sm_dbg('I', ("ttymux_query_link_ioctl:\n")); - - if (mp->b_cont == NULL) - return (EINVAL); - -#ifdef _SYSCALL32_IMPL - if ((iobp->ioc_flag & IOC_MODELS) != IOC_NATIVE) { - ttymux_assoc32_t *assoc32; - ttymux_assoc_t assoc; - - if (mblk2assoc(mp, &assoc) != 0) - return (EINVAL); - - if ((lqi = get_lqi_bydevt(assoc.ttymux_ldev)) == NULL && - (lqi = get_lqi_byid(assoc.ttymux_linkid)) == NULL) { - sm_dbg('M', ("Query Link (%d): dev %d:%d not found\n", - assoc.ttymux_linkid, - getmajor(assoc.ttymux_ldev), - getminor(assoc.ttymux_ldev))); - return (ENOLINK); - } - assoc32 = (ttymux_assoc32_t *)mp->b_cont->b_rptr; - LQI2ASSOC32(assoc32, lqi); - } else -#endif - { - ttymux_assoc_t *assoc; - - if (iobp->ioc_count < sizeof (ttymux_assoc_t)) - return (EINVAL); - - assoc = (ttymux_assoc_t *)mp->b_cont->b_rptr; - if ((lqi = get_lqi_bydevt(assoc->ttymux_ldev)) == NULL && - (lqi = get_lqi_byid(assoc->ttymux_linkid)) == NULL) { - return (ENOLINK); - } - LQI2ASSOC(assoc, lqi); - } - return (0); -} - -/* - * Response to receiving an M_IOCDATA message for the TTYMUX_LIST ioctl. - */ -static int -sm_iocresp(mblk_t *mp) -{ - struct copyresp *csp = (struct copyresp *)mp->b_rptr; - struct iocblk *iobp = (struct iocblk *)mp->b_rptr; - mblk_t *pmp; - - sm_dbg('M', ("(M_IOCDATA: cmd %d)\n", csp->cp_cmd)); - - if (csp->cp_cmd != TTYMUX_LIST) { - sm_dbg('M', ("(M_IOCDATA: unknown cmd)\n")); - DB_TYPE(mp) = M_IOCNAK; - return (EINVAL); - } - if (csp->cp_rval) { - if (csp->cp_private) - freemsg((mblk_t *)csp->cp_private); - - sm_dbg('M', ("M_IOCDATA: result is %d\n", csp->cp_rval)); - DB_TYPE(mp) = M_IOCNAK; - iobp->ioc_error = (int)(uintptr_t)csp->cp_rval; - iobp->ioc_rval = 0; - return (iobp->ioc_error); - } - - pmp = (mblk_t *)csp->cp_private; - -#ifdef _SYSCALL32_IMPL - if ((csp->cp_flag & IOC_MODELS) != IOC_NATIVE) { - iobp->ioc_count = sizeof (ttymux_assocs32_t); - iobp->ioc_rval = pmp == NULL ? 0 : - ((ttymux_assocs32_t *)pmp->b_rptr)->ttymux32_nlinks; - } else -#endif - { - iobp->ioc_count = sizeof (ttymux_assocs_t); - iobp->ioc_rval = pmp == NULL ? 0 : - ((ttymux_assocs_t *)pmp->b_rptr)->ttymux_nlinks; - - } - - DB_TYPE(mp) = (pmp) ? M_IOCACK : M_IOCNAK; - mp->b_wptr = mp->b_rptr + sizeof (struct iocblk); - - if (mp->b_cont) - freemsg(unlinkb(mp)); - if (pmp) - linkb(mp, pmp); - else - iobp->ioc_count = 0; - - iobp->ioc_error = 0; - - sm_dbg('M', ("(M_IOCDATA: rval %d cnt %d private 0x%p)\n", - iobp->ioc_rval, iobp->ioc_count, pmp)); - return (0); -} - -/* - * Process a TTYMUX_LIST ioctl. - */ -int -ttymux_query_links_ioctl(mblk_t *mp) -{ - struct iocblk *iobp = (struct iocblk *)mp->b_rptr; - struct copyreq *cqp; - int unit; - sm_lqi_t *lqi; - mblk_t *nmp; - int cnt; - void *asl; - void *uaddr; - size_t sz; - - if (DB_TYPE(mp) == M_IOCDATA) { - return (sm_iocresp(mp)); - } - /* - * Is this a query for the number of linked devices? - */ - if (iobp->ioc_count == 0) { - - for (unit = 0, iobp->ioc_rval = 0; - unit < MAX_LQS && (lqi = get_lqi(sm_ssp, unit)); - unit++) - if (lqi->sm_linkid != 0) - iobp->ioc_rval += 1; - - iobp->ioc_rval += count_unconfigured_consoles(sm_ssp->sm_ms); - DB_TYPE(mp) = M_IOCACK; - iobp->ioc_error = 0; - - return (0); - } - - if (mp->b_cont == NULL) { - sm_dbg('Y', ("TTYMUX_LIST: b_cont is NULL\n")); - DB_TYPE(mp) = M_IOCNAK; - iobp->ioc_error = EINVAL; - return (EINVAL); - } - - asl = mp->b_cont->b_rptr; - -#ifdef _SYSCALL32_IMPL - if ((iobp->ioc_flag & IOC_MODELS) != IOC_NATIVE) { - cnt = ((ttymux_assocs32_t *)asl)->ttymux32_nlinks; - sz = cnt * sizeof (ttymux_assoc32_t); - uaddr = (void *)(uintptr_t) - ((ttymux_assocs32_t *)asl)->ttymux32_assocs; - } else -#endif - { - cnt = ((ttymux_assocs_t *)asl)->ttymux_nlinks; - sz = cnt * sizeof (ttymux_assoc_t); - uaddr = (void *)((ttymux_assocs_t *)asl)->ttymux_assocs; - } - if ((nmp = sm_allocb(sz, BPRI_MED)) == NULL) { - DB_TYPE(mp) = M_IOCNAK; - iobp->ioc_error = EINVAL; - return (EAGAIN); - } - - sm_dbg('Y', ("TTYMUX_LIST: cnt %d sz %d uaddr 0x%p\n", cnt, sz, uaddr)); - - iobp->ioc_rval = 0; - -#ifdef _SYSCALL32_IMPL - if ((iobp->ioc_flag & IOC_MODELS) != IOC_NATIVE) { - ttymux_assoc32_t *assoc; - - sm_dbg('Y', ("!Native: %d structures\n", cnt)); - assoc = (ttymux_assoc32_t *)nmp->b_rptr; - - for (unit = 0; - unit < MAX_LQS && (lqi = get_lqi(sm_ssp, unit)); - unit++) { - if (lqi->sm_linkid != 0) { - if (cnt-- == 0) - break; - LQI2ASSOC32(assoc, lqi); - assoc++; - iobp->ioc_rval += 1; - } - } - if (cnt > 0) { - /* see if there are unconfigured consoles */ - iobp->ioc_rval += - get_unconfigured_consoles32(sm_ssp->sm_ms, assoc); - sm_dbg('I', ("%d unconfigured consoles\n", - iobp->ioc_rval)); - } else { - sm_dbg('I', ("no more space in user addr\n")); - } - ((ttymux_assocs32_t *)asl)->ttymux32_nlinks = iobp->ioc_rval; - } else -#endif - { - ttymux_assoc_t *assoc; - - sm_dbg('Y', ("!Native: %d structures\n", cnt)); - assoc = (ttymux_assoc_t *)nmp->b_wptr; - - for (unit = 0; - unit < MAX_LQS && (lqi = get_lqi(sm_ssp, unit)); - unit++) { - if (lqi->sm_linkid != 0) { - if (cnt-- == 0) - break; - LQI2ASSOC(assoc, lqi); - assoc++; - iobp->ioc_rval += 1; - } - } - if (cnt > 0) { - /* see if there are unconfigured consoles */ - iobp->ioc_rval += - get_unconfigured_consoles(sm_ssp->sm_ms, assoc); - sm_dbg('I', ("%d unconfigured consoles\n", - iobp->ioc_rval)); - } else { - sm_dbg('I', ("no more space in user addr\n")); - } - ((ttymux_assocs_t *)asl)->ttymux_nlinks = iobp->ioc_rval; - } - - cqp = (struct copyreq *)mp->b_rptr; - cqp->cq_addr = uaddr; - cqp->cq_size = sz; - cqp->cq_flag = 0; - cqp->cq_private = mp->b_cont; - mp->b_cont = nmp; - nmp->b_wptr = nmp->b_rptr + sz; - - DB_TYPE(mp) = M_COPYOUT; - mp->b_wptr = mp->b_rptr + sizeof (struct copyreq); - - return (0); -} - -/* - * Process a TTYMUX_CONSDEV ioctl. - */ -static int -ttymux_console_ioctl(mblk_t *mp) -{ - struct iocblk *iobp = (struct iocblk *)mp->b_rptr; - int err = EINVAL; - - sm_dbg('I', ("ttymux_console_ioctl:\n")); -#ifdef _SYSCALL32_IMPL - if ((iobp->ioc_flag & IOC_MODELS) != IOC_NATIVE) { - if (mp->b_cont && iobp->ioc_count >= sizeof (dev32_t)) { - dev32_t dev; - - (void) cmpldev(&dev, rconsdev); - - *(dev32_t *)mp->b_cont->b_rptr = dev; - mp->b_cont->b_wptr = mp->b_cont->b_rptr + sizeof (dev); - iobp->ioc_count = sizeof (dev); - err = 0; - } else { - sm_dbg('I', ("TTYMUX_CONSDEV: b_cont 0x%p count %d\n", - mp->b_cont, iobp->ioc_count)); - } - } else -#endif - if (mp->b_cont && iobp->ioc_count >= sizeof (dev_t)) { - *(dev_t *)mp->b_cont->b_rptr = rconsdev; - mp->b_cont->b_wptr = mp->b_cont->b_rptr + sizeof (rconsdev); - iobp->ioc_count = sizeof (rconsdev); - err = 0; - } - return (err); -} - -/* - * Process a ioctl relating to aborting on the console. - */ -int -ttymux_abort_ioctl(mblk_t *mp) -{ - struct iocblk *iobp; - int cmd, err = 0; - sm_lqi_t *lqi; - ttymux_abort_t *abreq; -#ifdef _SYSCALL32_IMPL - struct ttymux_abort32 { - dev32_t ldev; - enum ttymux_break_type method; - uint32_t enable; - } *abreq32; -#endif - dev_t ldev; - enum ttymux_break_type method; - uint_t enable; - - iobp = (struct iocblk *)mp->b_rptr; - cmd = iobp->ioc_cmd; - - iobp->ioc_error = 0; - iobp->ioc_rval = 0; - sm_dbg('I', ("ttymux_abort_ioctl:\n")); - switch (cmd) { - case CONSSETABORTENABLE: - lqi = (sm_ssp->sm_lconsole) ? sm_ssp->sm_lconsole->sm_lqs : 0; - enable = (*(intptr_t *)mp->b_cont->b_rptr) ? 1 : 0; - sm_ssp->sm_ctrla_abort_on = sm_ssp->sm_break_abort_on = enable; - for (; lqi != 0; lqi = lqi->sm_nlqi) { - lqi->sm_ctrla_abort_on = enable; - lqi->sm_break_abort_on = enable; - } - break; - case CONSGETABORTENABLE: - if (mp->b_cont == 0 || iobp->ioc_count < sizeof (intptr_t)) { - iobp->ioc_error = EINVAL; - iobp->ioc_rval = -1; - } else { - *(intptr_t *)mp->b_cont->b_rptr = - (sm_ssp->sm_ctrla_abort_on || - sm_ssp->sm_break_abort_on); - mp->b_cont->b_wptr = - mp->b_cont->b_rptr + sizeof (intptr_t); - iobp->ioc_count = sizeof (intptr_t); - } - break; - case TTYMUX_GETABORTSTR: - - if (iobp->ioc_count < strlen(sm_ssp->sm_abs) + 1 || - mp->b_cont == 0 || - mp->b_cont->b_cont) { - iobp->ioc_error = EINVAL; - iobp->ioc_rval = -1; - } else { - (void) strcpy((char *)mp->b_cont->b_rptr, - sm_ssp->sm_abs); - iobp->ioc_count = strlen(sm_ssp->sm_abs) + 1; - mp->b_cont->b_wptr = - mp->b_cont->b_rptr + iobp->ioc_count; - } - break; - case TTYMUX_GETABORT: - case TTYMUX_SETABORT: - - lqi = 0; -#ifdef _SYSCALL32_IMPL - if ((iobp->ioc_flag & IOC_MODELS) != IOC_NATIVE) { - if (iobp->ioc_count < sizeof (*abreq32) || - mp->b_cont == 0) { - err = EINVAL; - } else { - abreq32 = (struct ttymux_abort32 *) - mp->b_cont->b_rptr; - ldev = expldev(abreq32->ldev); - method = abreq32->method; - enable = (uint_t)abreq32->enable; - iobp->ioc_count = sizeof (*abreq32); - } - } else -#endif - if (iobp->ioc_count < sizeof (*abreq) || - mp->b_cont == 0) { - err = EINVAL; - } else { - abreq = (ttymux_abort_t *)mp->b_cont->b_rptr; - ldev = abreq->ttymux_ldev; - method = abreq->ttymux_method; - enable = abreq->ttymux_enable; - iobp->ioc_count = sizeof (*abreq); - } - - if (err != 0) { - iobp->ioc_rval = -1; - return ((iobp->ioc_error = err)); - } - - sm_dbg('Y', ("ttymux_abort_ioctl: type %d how %d ldev %d:%d\n", - method, enable, getmajor(ldev), getminor(ldev))); - - lqi = get_lqi_bydevt(ldev); - if (ldev != NODEV && lqi == 0) { - err = ENOLINK; - } else if (cmd == TTYMUX_GETABORT && lqi == 0) { - err = ENODEV; - } else if (cmd == TTYMUX_GETABORT) { - if (lqi->sm_break_abort_on == 0 && - lqi->sm_ctrla_abort_on == 0) { - method = SOFTHARD_BREAK; - enable = 0; - } else { - enable = 1; - if (lqi->sm_break_abort_on == 0) - method = SOFTWARE_BREAK; - else if (lqi->sm_ctrla_abort_on == 0) - method = HARDWARE_BREAK; - else - method = SOFTHARD_BREAK; - } - -#ifdef _SYSCALL32_IMPL - if ((iobp->ioc_flag & IOC_MODELS) != IOC_NATIVE) { - abreq32->method = method; - abreq32->enable = (uint32_t)enable; - } else -#endif - { - abreq->ttymux_method = method; - abreq->ttymux_enable = enable; - } - } else { - iobp->ioc_count = 0; - sm_dbg('I', ("lqi is 0x%p\n", lqi)); - if (lqi == 0) { - if (method == HARDWARE_BREAK) - sm_ssp->sm_break_abort_on = enable; - else if (method == SOFTWARE_BREAK) - sm_ssp->sm_ctrla_abort_on = enable; - else if (method == SOFTHARD_BREAK) { - sm_ssp->sm_break_abort_on = enable; - sm_ssp->sm_ctrla_abort_on = enable; - } else { - sm_dbg('I', ("%d - invalid\n", method)); - iobp->ioc_rval = -1; - return ((iobp->ioc_error = EINVAL)); - } - - if (sm_ssp->sm_lconsole) { - sm_dbg('I', ("lconsole 0x%p (0x%p)\n", - sm_ssp->sm_lconsole, - sm_ssp->sm_lconsole->sm_lqs)); - } else { - sm_dbg('I', ("lconsole is null\n")); - } - - lqi = (sm_ssp->sm_lconsole) ? - sm_ssp->sm_lconsole->sm_lqs : 0; - } - while (lqi) { - if (method == HARDWARE_BREAK) - lqi->sm_break_abort_on = enable; - else if (method == SOFTWARE_BREAK) - lqi->sm_ctrla_abort_on = enable; - else if (method == SOFTHARD_BREAK) { - lqi->sm_break_abort_on = enable; - lqi->sm_ctrla_abort_on = enable; - } else { - sm_dbg('I', ("%d: invalid\n", method)); - iobp->ioc_rval = -1; - return ((iobp->ioc_error = EINVAL)); - } - - lqi = (ldev == NODEV) ? lqi->sm_nlqi : 0; - } - } - iobp->ioc_rval = err ? -1 : 0; - iobp->ioc_error = err; - break; - default: - iobp->ioc_rval = -1; - iobp->ioc_error = EINVAL; - } - return (iobp->ioc_error); -} - -/* - * Process ioctls specific to the ttymux driver. - */ -/*ARGSUSED*/ -int -sm_ioctl_cmd(sm_uqi_t *uqi, mblk_t *mp) -{ - struct iocblk *iobp = (struct iocblk *)mp->b_rptr; - - iobp->ioc_rval = 0; - - /* - * This routine does not support transparent ioctls - */ - if (iobp->ioc_count == TRANSPARENT) { - sm_dbg('Y', ("sm_ioctl_cmd: unsupported ioctl\n")); - iobp->ioc_error = ENOTSUP; - DB_TYPE(mp) = M_IOCNAK; - if (mp->b_cont) - freemsg(unlinkb(mp)); - return (ENOTSUP); - } - - switch (iobp->ioc_cmd) { - case TTYMUX_CONSDEV: - iobp->ioc_error = ttymux_console_ioctl(mp); - break; - case TTYMUX_ASSOC: - case TTYMUX_DISASSOC: - iobp->ioc_error = ttymux_link_ioctl(mp); - break; - case TTYMUX_GETLINK: - iobp->ioc_error = ttymux_query_link_ioctl(mp); - break; - case TTYMUX_LIST: - return (ttymux_query_links_ioctl(mp)); - case TTYMUX_SETCTL: - case TTYMUX_GETCTL: - iobp->ioc_error = ENOTSUP; - break; - case TTYMUX_GETABORTSTR: - case TTYMUX_SETABORT: - case TTYMUX_GETABORT: - iobp->ioc_error = ttymux_abort_ioctl(mp); - break; - default: - iobp->ioc_error = EINVAL; - break; - } - - DB_TYPE(mp) = iobp->ioc_error ? M_IOCNAK : M_IOCACK; - - if ((iobp->ioc_error || iobp->ioc_count == 0) && mp->b_cont) - freemsg(unlinkb(mp)); - - sm_dbg('I', ("TTYMUX IOCTL: err %d rval %d count %d\n", - iobp->ioc_error, iobp->ioc_rval, iobp->ioc_count)); - - return (iobp->ioc_error); -} diff --git a/usr/src/uts/sun/sys/Makefile b/usr/src/uts/sun/sys/Makefile index 778e8394f4..a85f7bae30 100644 --- a/usr/src/uts/sun/sys/Makefile +++ b/usr/src/uts/sun/sys/Makefile @@ -22,6 +22,7 @@ # # Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. +# Copyright 2019 Peter Tribble. # # include global definitions include ../../../Makefile.master @@ -36,7 +37,6 @@ promif.h promimpl.h \ ser_async.h ser_zscc.h \ socalio.h socalreg.h \ socal_cq_defs.h socalmap.h socalvar.h \ -ttymux.h ttymuxuser.h \ zsdev.h SCSIADHDRS= \ @@ -103,7 +103,7 @@ devops.check := CSTYLE_TAIL = | grep -v "line > 80 characters" | true $(ROOTSCSIADHDRS) $(ROOTSCSITARGHDRS) $(ROOTXHDRS) \ $(ROOTFCHDRS) -install_h: $(ROOTDIRS) .WAIT $(ROOTHDRS) \ +install_h: $(ROOTDIRS) .WAIT $(ROOTHDRS) \ $(ROOTAUDHDRS) $(ROOTAUDIMPLHDRS) \ $(ROOTSCSIADHDRS) $(ROOTSCSITARGHDRS) $(ROOTFCHDRS) diff --git a/usr/src/uts/sun/sys/ttymux.h b/usr/src/uts/sun/sys/ttymux.h deleted file mode 100644 index 56596a66dc..0000000000 --- a/usr/src/uts/sun/sys/ttymux.h +++ /dev/null @@ -1,192 +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) 2001 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ifndef _TTYMUX_H -#define _TTYMUX_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/obpdefs.h> -#include <sys/tty.h> -#include <sys/ttymuxuser.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define SM_MAX_ABSLEN 24 /* maximum length for the s/w abort sequence */ -#define SM_MIN_ABSLEN 2 - -#define SM_COPYIN 0x1 -#define SM_COPYOUT 0x2 - -typedef -struct sm_iocdata { - int sm_iocid; - int sm_nacks; /* number of responses expected */ - int sm_ackcnt; /* number of ACKs received */ - int sm_nakcnt; /* number of NAKs received */ - int sm_acnt; /* number of responses received */ - int sm_acked; /* has the message been acked (only one of them) */ - int sm_policy; /* which policy is used for acknowleding this ioctl */ - uint_t sm_flags; - /* indicates when copyin/out has been sent upstream */ - ulong_t sm_timeval; -} sm_iocdata_t; - -/* - * Each minor (refered to as a logical device) created by the multiplexor - * maps onto multiple real devices. - * I/O on a logical device is duplicated across multiple real devices. - * i.e. input from any of the real devices (identified by lqs) is funneled - * through the queue identified in the ttycommon field of a logical unit. - * output arriving on the queue identified in the ttycommon field of a logical - * unit is distributed to all real devices identified by lqs. - * - * When a logical unit is open there is a unique queue upstream (identified - * by ttycommon). - * When a real unit is open there is a unique lower queue to the h/w driver - * (identified by ttycommon). - * - * If the control lines on RS232 port for a physical unit are unknown and - * a request for their status has been issued then flags contains the bits - * TIOCM_PEND and tiocmgetid contains the id of the M_IOCTL streams message - * sent down the write queue to obtain the current status (placed in mbits). - */ -typedef -struct sm_uqi { - int sm_lunit; /* logical unit */ - int sm_protocol; /* in use for this protocol */ - uint_t sm_flags; /* flags */ - uint_t sm_mbits; /* consolidated status of modem lines */ - tcflag_t sm_cmask; /* ignore these control bits */ - uint_t sm_policy; /* ioctl response policy */ - struct sm_lqi *sm_lqs; /* lower queues mapped to this lunit */ - int sm_nlqs; - kmutex_t sm_umutex[1]; /* protects uflags */ - kcondvar_t sm_ucv[1]; /* waiting for uflags to change */ - bufcall_id_t sm_ttybid; /* ttycommon bufcall */ - dev_t sm_dev; /* currently attached device */ - int sm_nwaiters; /* no. of threads waiting for carrier */ - queue_t *sm_waitq; /* identity of blocked queue */ - tty_common_t sm_ttycommon[1]; - /* queue common data when is open */ - sm_iocdata_t sm_siocdata; /* active ioctl */ - sm_iocdata_t sm_piocdata; /* active private ioctl */ -} sm_uqi_t; - -typedef -struct sm_lqi { - struct sm_lqi *sm_nlqi; /* chain units together into lists */ - sm_uqi_t *sm_uqi; /* this lunit and uqi are associated */ - int sm_linkid; /* mux id for the link */ - uint64_t sm_tag; /* tag for the link */ - uint_t sm_flags; /* flags */ - uint_t sm_uqflags; /* written by an upper queue */ - io_mode_t sm_ioflag; /* input and/or output stream */ - int sm_ctrla_abort_on; - int sm_break_abort_on; - uint_t sm_mbits; /* status of the modem control lines */ - tcflag_t sm_cmask; /* ignore these control bits */ - mblk_t *sm_mp; /* mblk for next write */ - bufcall_id_t sm_bid; /* bufcall id */ - bufcall_id_t sm_ttybid; /* ttymodes changed bufcall */ - kmutex_t sm_umutex[1]; /* protects open code */ - kcondvar_t sm_ucv[1]; - dev_info_t *sm_dip; - dev_t sm_dev; - int sm_unit; - unsigned char *sm_hadkadbchar; - char *sm_nachar; - int sm_piocid; - tty_common_t sm_ttycommon[1]; - /* queue common data when open */ - char sm_path[MAXPATHLEN]; -} sm_lqi_t; - -/* - * This structure maintains the state of the console. - */ -typedef struct console { - dev_t sm_dev; /* the minor node of a console */ - int sm_muxid; /* STREAM's link identifier */ - io_mode_t sm_mode; /* I/O mode */ - boolean_t sm_obp_con; /* is it an OBP console */ - ihandle_t sm_i_ihdl; /* ihandle of the OBP input device */ - ihandle_t sm_o_ihdl; /* ihandle of the OBP output device */ - char *sm_path; /* device tree device path */ - char *sm_alias; /* device path alias */ -} sm_console_t; - -/* - * This structure contains the information for an open device. - * If an instance of it exists it is available as a named pointer: - */ -#define TTYMUXPTR "ttymuxconfig" - -typedef struct mux_state { - - /* protects ttymux configuration */ - kmutex_t sm_cons_mutex; - - /* Information about the standard I/O devices */ - sm_console_t sm_cons_stdin; - sm_console_t sm_cons_stdout; - - /* List of multiplexed serial consoles */ - uint_t sm_cons_cnt; - char *sm_ialias; - char *sm_oalias; - sm_console_t sm_cons_links[TTYMUX_MAX_LINKS]; - -} sm_mux_state_t; - -/* - * Driver instance private information. - */ -typedef -struct sm_ss -{ - dev_info_t *sm_dip; /* device tree information */ - uint_t sm_trflag; /* debug and information levels */ - sm_uqi_t *sm_lconsole; /* the current logical console */ - sm_mux_state_t *sm_ms; /* state associated with a console */ - - sm_lqi_t *sm_lqs; - sm_uqi_t *sm_uqs; - uint_t sm_break_abort_on; - uint_t sm_ctrla_abort_on; - - int sm_min_redundancy; - char sm_abs[SM_MAX_ABSLEN]; - -} sm_ss_t; - -#ifdef __cplusplus -} -#endif - -#endif /* _TTYMUX_H */ diff --git a/usr/src/uts/sun/sys/ttymuxuser.h b/usr/src/uts/sun/sys/ttymuxuser.h deleted file mode 100644 index deb0d7b2e8..0000000000 --- a/usr/src/uts/sun/sys/ttymuxuser.h +++ /dev/null @@ -1,138 +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) 2001 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ifndef _TTYMUXUSER_H -#define _TTYMUXUSER_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/param.h> -#include <sys/termios.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define TTYMUX_MOD_ID (0x540d) /* T^m */ -#define TTYMUX_DRVNAME "ttymux" - -#define TTYMUX_MAX_LINKS (16) -/* - * Generic serial multiplexor ioctls. - */ -#define _TTYMUXIOC (TTYMUX_MOD_ID<<8) -#define TTYMUX_ASSOC (_TTYMUXIOC | 1) -#define TTYMUX_DISASSOC (_TTYMUXIOC | 2) -#define TTYMUX_LIST (_TTYMUXIOC | 3) -#define TTYMUX_GETLINK (_TTYMUXIOC | 4) -/* - * Ioctls for serial multiplexors acting as the system console. - */ -#define TTYMUX_SETABORT (_TTYMUXIOC | 100) -#define TTYMUX_GETABORT (_TTYMUXIOC | 101) -#define TTYMUX_CONSDEV (_TTYMUXIOC | 102) -#define TTYMUX_GETABORTSTR (_TTYMUXIOC | 103) -#define TTYMUX_GETCONSOLES (_TTYMUXIOC | 104) -/* - * Optional control ioctl. - */ -#define TTYMUX_SETCTL (_TTYMUXIOC | 200) -#define TTYMUX_GETCTL (_TTYMUXIOC | 201) - -typedef enum {FORINPUT = 1, FOROUTPUT = 2, FORIO = 3} io_mode_t; - -/* - * Create or destroy associations TTYMUX_ASSOC and TTYMUX_DISASSOC - */ -#define AMSTAG (0x414d5354) -typedef struct ttymux_association { - dev_t ttymux_udev; /* the upper device to be associated */ - /* the device type of a linked lower stream */ - dev_t ttymux_ldev; - /* the linkid of a linked lower stream */ - int ttymux_linkid; - ulong_t ttymux_tag; /* tagged association */ - io_mode_t ttymux_ioflag; /* FORINPUT FOROUTPUT FORIO */ - /* OBP device path of ldev */ - char ttymux_path[MAXPATHLEN]; -} ttymux_assoc_t; - -/* - * List all links known to a mux driver TTYMUX_LIST - * If the user ioctl arg is NULL the return value is the - * number of links in the driver (to facilitate the user - * allocating enough space for the link information. - * Otherwise the ioctl arg should point to the following - * structure. nlinks indicates how many entries the user - * has allocated in the array. The return value indicates the - * number of entries that have been filled in. - * EINVAL if nlinks is < 1 - * EAGAIN if no resources. - */ -typedef struct ttymux_associations { - ulong_t ttymux_nlinks; - ttymux_assoc_t *ttymux_assocs; -} ttymux_assocs_t; - -/* - * Enable or disable aborting to the system monitor - * TTYMUX_SETABORT and TTYMUX_GETABORT - */ -enum ttymux_break_type {SOFTWARE_BREAK, HARDWARE_BREAK, SOFTHARD_BREAK}; - -typedef struct ttymux_abort { - /* apply request to this device */ - dev_t ttymux_ldev; - enum ttymux_break_type ttymux_method; - uint_t ttymux_enable; -} ttymux_abort_t; - -/* - * Ioctl acknowledgement policies. - */ -#define FIRSTACK 0 -#define LASTACK 1 -#define CONSENSUS 2 -#define PERIOCTL 3 - -/* - * Set or get the ioctl acknowledgement policy and masking of control bits - * TTYMUX_SETCTL and TTYMUX_GETCTL - */ - -struct ttymux_policy { - dev_t ttymux_udev; /* apply the request to this device */ - /* determines the method used to ack M_IOCTLS */ - int ttymux_policy; - tcflag_t ttymux_cmask; /* never set these control bits */ -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _TTYMUXUSER_H */ diff --git a/usr/src/uts/sun4/vm/vm_dep.h b/usr/src/uts/sun4/vm/vm_dep.h index 3828665f63..4923173d81 100644 --- a/usr/src/uts/sun4/vm/vm_dep.h +++ b/usr/src/uts/sun4/vm/vm_dep.h @@ -20,6 +20,7 @@ */ /* * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2019 Joyent, Inc. */ /* @@ -55,7 +56,7 @@ extern u_longlong_t randtick(void); mtype = (flags & PG_NORELOC) ? MTYPE_NORELOC : MTYPE_RELOC; /* mtype init for page_get_replacement_page */ -#define MTYPE_PGR_INIT(mtype, flags, pp, mnode, pgcnt) \ +#define MTYPE_PGR_INIT(mtype, flags, pp, pgcnt) \ mtype = (flags & PG_NORELOC) ? MTYPE_NORELOC : MTYPE_RELOC; #define MNODETYPE_2_PFN(mnode, mtype, pfnlo, pfnhi) \ diff --git a/usr/src/uts/sun4u/Makefile.sun4u b/usr/src/uts/sun4u/Makefile.sun4u index febac584d2..c69198cb2e 100644 --- a/usr/src/uts/sun4u/Makefile.sun4u +++ b/usr/src/uts/sun4u/Makefile.sun4u @@ -168,13 +168,11 @@ IMPLEMENTATIONS += enchilada IMPLEMENTATIONS += taco IMPLEMENTATIONS += mpxu IMPLEMENTATIONS += excalibur -IMPLEMENTATIONS += montecarlo IMPLEMENTATIONS += serengeti IMPLEMENTATIONS += littleneck IMPLEMENTATIONS += daktari IMPLEMENTATIONS += cherrystone IMPLEMENTATIONS += fjlite -IMPLEMENTATIONS += snowbird IMPLEMENTATIONS += schumacher IMPLEMENTATIONS += blade IMPLEMENTATIONS += boston @@ -182,7 +180,6 @@ IMPLEMENTATIONS += seattle IMPLEMENTATIONS += chicago IMPLEMENTATIONS += sunfire IMPLEMENTATIONS += lw8 -IMPLEMENTATIONS += makaha IMPLEMENTATIONS += opl IMPLEMENTATIONS += lw2plus diff --git a/usr/src/uts/sun4u/blade/bscv/Makefile b/usr/src/uts/sun4u/blade/bscv/Makefile index ca20d5a1e8..b87a1cb5fd 100644 --- a/usr/src/uts/sun4u/blade/bscv/Makefile +++ b/usr/src/uts/sun4u/blade/bscv/Makefile @@ -66,7 +66,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # lint pass one enforcement # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/bootdev/Makefile b/usr/src/uts/sun4u/bootdev/Makefile index c430b580b2..89e6f1964f 100644 --- a/usr/src/uts/sun4u/bootdev/Makefile +++ b/usr/src/uts/sun4u/bootdev/Makefile @@ -66,7 +66,7 @@ CFLAGS += $(CCVERBOSE) # LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/cheetah/Makefile b/usr/src/uts/sun4u/cheetah/Makefile index 09e23457b4..d9a17fd409 100644 --- a/usr/src/uts/sun4u/cheetah/Makefile +++ b/usr/src/uts/sun4u/cheetah/Makefile @@ -124,6 +124,6 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-clobbered diff --git a/usr/src/uts/sun4u/cheetahplus/Makefile b/usr/src/uts/sun4u/cheetahplus/Makefile index 0e92f69cb6..f4bb408f25 100644 --- a/usr/src/uts/sun4u/cheetahplus/Makefile +++ b/usr/src/uts/sun4u/cheetahplus/Makefile @@ -130,7 +130,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-clobbered diff --git a/usr/src/uts/sun4u/cpr/Makefile b/usr/src/uts/sun4u/cpr/Makefile index 5d5b047b47..af9b3a9635 100644 --- a/usr/src/uts/sun4u/cpr/Makefile +++ b/usr/src/uts/sun4u/cpr/Makefile @@ -91,7 +91,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits diff --git a/usr/src/uts/sun4u/db21554/Makefile b/usr/src/uts/sun4u/db21554/Makefile index 860ed675f7..ef3d37f0f3 100644 --- a/usr/src/uts/sun4u/db21554/Makefile +++ b/usr/src/uts/sun4u/db21554/Makefile @@ -87,7 +87,7 @@ LDFLAGS += -dy -Nmisc/pcihp LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits # Default build targets. diff --git a/usr/src/uts/sun4u/des/Makefile b/usr/src/uts/sun4u/des/Makefile index e4b2fa80d0..d8b27d3d66 100644 --- a/usr/src/uts/sun4u/des/Makefile +++ b/usr/src/uts/sun4u/des/Makefile @@ -90,7 +90,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/ebus/Makefile b/usr/src/uts/sun4u/ebus/Makefile index aa391f1ccd..ac9d584723 100644 --- a/usr/src/uts/sun4u/ebus/Makefile +++ b/usr/src/uts/sun4u/ebus/Makefile @@ -76,7 +76,7 @@ CFLAGS += -dalign LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/excalibur/xcalppm/Makefile b/usr/src/uts/sun4u/excalibur/xcalppm/Makefile index 76c4b45f68..719ffcf517 100644 --- a/usr/src/uts/sun4u/excalibur/xcalppm/Makefile +++ b/usr/src/uts/sun4u/excalibur/xcalppm/Makefile @@ -65,7 +65,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch # diff --git a/usr/src/uts/sun4u/fd/Makefile b/usr/src/uts/sun4u/fd/Makefile index 9d7036feb7..2da88952a2 100644 --- a/usr/src/uts/sun4u/fd/Makefile +++ b/usr/src/uts/sun4u/fd/Makefile @@ -83,7 +83,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-char-subscripts diff --git a/usr/src/uts/sun4u/genunix/Makefile b/usr/src/uts/sun4u/genunix/Makefile index f617c121c7..48ccc65750 100644 --- a/usr/src/uts/sun4u/genunix/Makefile +++ b/usr/src/uts/sun4u/genunix/Makefile @@ -117,7 +117,7 @@ CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-type-limits -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-clobbered CERRWARN += -_gcc=-Wno-empty-body diff --git a/usr/src/uts/sun4u/hummingbird/Makefile b/usr/src/uts/sun4u/hummingbird/Makefile index ce2dcf25f8..1e114e429e 100644 --- a/usr/src/uts/sun4u/hummingbird/Makefile +++ b/usr/src/uts/sun4u/hummingbird/Makefile @@ -121,4 +121,4 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_BAD_FORMAT_STR2 -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) diff --git a/usr/src/uts/sun4u/jalapeno/Makefile b/usr/src/uts/sun4u/jalapeno/Makefile index 83eccaaffd..90606a8e04 100644 --- a/usr/src/uts/sun4u/jalapeno/Makefile +++ b/usr/src/uts/sun4u/jalapeno/Makefile @@ -129,6 +129,6 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-clobbered diff --git a/usr/src/uts/sun4u/javelin/envctrltwo/Makefile b/usr/src/uts/sun4u/javelin/envctrltwo/Makefile index 11efab8ed6..cee65d58e4 100644 --- a/usr/src/uts/sun4u/javelin/envctrltwo/Makefile +++ b/usr/src/uts/sun4u/javelin/envctrltwo/Makefile @@ -59,7 +59,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Turn on doubleword alignment for 64 bit registers diff --git a/usr/src/uts/sun4u/lw8/ntwdt/Makefile b/usr/src/uts/sun4u/lw8/ntwdt/Makefile index 004558ea7a..6a66d5c2f1 100644 --- a/usr/src/uts/sun4u/lw8/ntwdt/Makefile +++ b/usr/src/uts/sun4u/lw8/ntwdt/Makefile @@ -66,7 +66,7 @@ CLEANLINTFILES += $(LINT32_FILES) # lint pass one enforcement # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) LDFLAGS += -dy -Ndrv/sgsbbc diff --git a/usr/src/uts/sun4u/lw8/platmod/Makefile b/usr/src/uts/sun4u/lw8/platmod/Makefile index 3c2c2e27b3..65ed6d1ac9 100644 --- a/usr/src/uts/sun4u/lw8/platmod/Makefile +++ b/usr/src/uts/sun4u/lw8/platmod/Makefile @@ -75,7 +75,7 @@ CLEANLINTFILES += $(LINT32_FILES) # CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-unused-variable -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/makaha/Makefile b/usr/src/uts/sun4u/makaha/Makefile deleted file mode 100644 index 39130fb82b..0000000000 --- a/usr/src/uts/sun4u/makaha/Makefile +++ /dev/null @@ -1,154 +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 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# uts/sun4u/makaha/Makefile -# -# This makefile drives the production of all Makaha system -# dependent modules for the sun4u architecture. -# - -# -# Path to the base of the uts directory tree (usually /usr/src/uts). -# -UTSBASE = ../.. - -# -# Include common rules. -# -include $(UTSBASE)/sun4u/makaha/Makefile.makaha - -def := TARGET= def -all := TARGET= all -install := TARGET= install -install_h := TARGET= install_h -clean := TARGET= clean -clobber := TARGET= clobber -lint := TARGET= lint -lintlib := TARGET= lintlib -modlintlib := TARGET= modlintlib -modlist := TARGET= modlist -modlist := NO_STATE= -K $$MODSTATE$$$$ -clean.lint := TARGET= clean.lint -check := TARGET= check - -# -# Default build targets. -# -.KEEP_STATE: - -def all clean.lint clean clobber modlist: $(MAKAHA_KMODS) - -modlintlib: $(MAKAHA_KMODS) - -install: $(ROOT_MAKAHA_DIR) $(USR_MAKAHA_DIR) \ - $(USR_MAKAHA_INC_DIR) \ - $(USR_MAKAHA_SBIN_DIR) \ - $(USR_MAKAHA_LIB_DIR) \ - $(ROOT_SPUTNIK_DIR) \ - $(USR_SPUTNIK_DIR) \ - $(USR_SPUTNIK_INC_DIR) \ - $(USR_SPUTNIK_SBIN_DIR) \ - $(USR_SPUTNIK_LIB_DIR) \ - .WAIT $(MAKAHA_KMODS) \ - scsb acebus pcf8574 \ - acebus.conf se.conf scsb.conf \ - ttymux_dacf ttymux.conf - -acebus.conf: $(ROOT_MAKAHA_DRV_DIR_32) - -@$(RM) $(ROOT_MAKAHA_DRV_DIR_32)/$@ - $(CP) $(UTSBASE)/sun4u/makaha/io/$@ \ - $(ROOT_MAKAHA_DRV_DIR_32)/$@ - $(CHMOD) $(CFILEMODE) $(ROOT_MAKAHA_DRV_DIR_32)/$@ - -pcf8574: $(ROOT_MAKAHA_DRV_DIR_64) - -@$(RM) $(ROOT_MAKAHA_DRV_DIR_64)/$@ - $(SYMLINK) $(ROOT_MAKAHA_DRV_LINK_64)/$@ \ - $(ROOT_MAKAHA_DRV_DIR_64)/$@ - -acebus: $(ROOT_MAKAHA_DRV_DIR_64) - -@$(RM) $(ROOT_MAKAHA_DRV_DIR_64)/$@ - $(SYMLINK) $(ROOT_MAKAHA_DRV_LINK_64)/$@ \ - $(ROOT_MAKAHA_DRV_DIR_64)/$@ - -scsb: $(ROOT_MAKAHA_DRV_DIR_64) - -@$(RM) $(ROOT_MAKAHA_DRV_DIR_64)/$@ - $(SYMLINK) $(ROOT_MAKAHA_DRV_LINK_64)/$@ \ - $(ROOT_MAKAHA_DRV_DIR_64)/$@ - -scsb.conf: $(ROOT_MAKAHA_DRV_DIR_32) - -@$(RM) $(ROOT_MAKAHA_DRV_DIR_32)/$@ - $(SYMLINK) $(ROOT_MAKAHA_DRV_LINK_32)/$@ \ - $(ROOT_MAKAHA_DRV_DIR_32)/$@ - -se.conf: $(ROOT_MAKAHA_DRV_DIR_32) - -@$(RM) $(ROOT_MAKAHA_DRV_DIR_32)/$@ - $(SYMLINK) $(ROOT_MAKAHA_DRV_LINK_32)/$@ \ - $(ROOT_MAKAHA_DRV_DIR_32)/$@ - -ttymux_dacf: $(ROOT_MAKAHA_DACF_DIR_64) \ - $(ROOT_SPUTNIK_DACF_DIR_64) - -@$(RM) $(ROOT_MAKAHA_DACF_DIR_64)/$@ - -@$(RM) $(ROOT_SPUTNIK_DACF_DIR_64)/$@ - $(SYMLINK) $(ROOT_MAKAHA_DACF_LINK_64)/$@ \ - $(ROOT_MAKAHA_DACF_DIR_64)/$@ - $(SYMLINK) $(ROOT_SPUTNIK_DACF_LINK_64)/$@ \ - $(ROOT_SPUTNIK_DACF_DIR_64)/$@ - - -ttymux.conf: $(ROOT_MAKAHA_DRV_DIR_32) $(ROOT_SPUTNIK_DRV_DIR_32) - -@$(RM) $(ROOT_MAKAHA_DRV_DIR_32)/$@ - -@$(RM) $(ROOT_SPUTNIK_DRV_DIR_32)/$@ - $(SYMLINK) $(ROOT_MAKAHA_DRV_LINK_32)/$@ \ - $(ROOT_MAKAHA_DRV_DIR_32)/$@ - $(SYMLINK) $(ROOT_MAKAHA_DRV_LINK_32)/$@ \ - $(ROOT_SPUTNIK_DRV_DIR_32)/$@ - -install_h check: - -lint: modlintlib - -# -# The 'lint.platmod' target lints the makaha platform module against -# the sun4u kernel. This ends up doing all the kernel cross-checks, -# so it takes a couple of minutes. -# Due to the low ROI, it's not run by default, but it's a good -# idea to run this if you change os/makaha.c. -# -LINT_LIBS = $(LINT_LIB) \ - -L$(MAKAHA_LINT_LIB_DIR) \ - -L$(LINT_LIB_DIR) $(LINT_KMODS:%=-l%) \ - $(CLOSED_LINT_KMODS:%=-l%) \ - -L$(SPARC_LIB_DIR) $(SPARC_LINTS:%=-l%) - -lint.platmod: modlintlib - @-$(ECHO) "\nMakaha Platform-dependent module: global crosschecks:" - @-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.2) - -$(MAKAHA_KMODS): FRC - @cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET) - -# -# Include common targets. -# -include $(UTSBASE)/sun4u/makaha/Makefile.targ diff --git a/usr/src/uts/sun4u/makaha/Makefile.files b/usr/src/uts/sun4u/makaha/Makefile.files deleted file mode 100644 index 75c46641f3..0000000000 --- a/usr/src/uts/sun4u/makaha/Makefile.files +++ /dev/null @@ -1,43 +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 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" -# -# uts/sun4u/makaha/Makefile.files -# -# -# This Makefile defines all file modules for the directory -# ust/sun4u/makaha and it's children. These are the source files -# which are sun4u "implementation architecture" dependent. -# - -# -# object lists -# -# Makaha specific driver relate modules -# -# -# Miscellaneous -# -INC_PATH += -I$(UTSBASE)/sun4u/makaha diff --git a/usr/src/uts/sun4u/makaha/Makefile.makaha b/usr/src/uts/sun4u/makaha/Makefile.makaha deleted file mode 100644 index e357e379e0..0000000000 --- a/usr/src/uts/sun4u/makaha/Makefile.makaha +++ /dev/null @@ -1,137 +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 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" -# -# -# uts/sun4u/makaha/Makefile.makaha -# -# This makefile contains the common definitions for the -# sun4u Makaha system dependent modules. -# - -# -# Define directories. -# -MONTECARLO = SUNW,UltraSPARC-IIi-Netract -MAKAHA = SUNW,UltraSPARC-IIe-NetraCT-40 -SPUTNIK = SUNW,UltraSPARC-IIe-NetraCT-60 -ROOT_MAKAHA_DIR = $(ROOT_PLAT_DIR)/$(MAKAHA) -ROOT_MAKAHA_MOD_DIR = $(ROOT_MAKAHA_DIR)/kernel - -ROOT_MAKAHA_KERN_DIR_32 = $(ROOT_MAKAHA_MOD_DIR) -ROOT_MAKAHA_KERN_DIR_64 = $(ROOT_MAKAHA_MOD_DIR)/$(SUBDIR64) -ROOT_MAKAHA_DRV_DIR_32 = $(ROOT_MAKAHA_MOD_DIR)/drv -ROOT_MAKAHA_DRV_DIR_64 = $(ROOT_MAKAHA_MOD_DIR)/drv/$(SUBDIR64) -ROOT_MAKAHA_DRV_LINK_32 = $(ROOT_MAKAHA_DRV_DIR_32:$(ROOT_MAKAHA_DIR)%=../../../$(MONTECARLO)%) -ROOT_MAKAHA_DRV_LINK_64 = $(ROOT_MAKAHA_DRV_DIR_64:$(ROOT_MAKAHA_DIR)%=../../../../$(MONTECARLO)%) -ROOT_MAKAHA_MISC_DIR_32 = $(ROOT_MAKAHA_MOD_DIR)/misc -ROOT_MAKAHA_MISC_DIR_64 = $(ROOT_MAKAHA_MOD_DIR)/misc/$(SUBDIR64) -ROOT_MAKAHA_MISC_LINK_32 = $(ROOT_MAKAHA_MISC_DIR_32:$(ROOT_MAKAHA_DIR)%=../../../$(MONTECARLO)%) -ROOT_MAKAHA_MISC_LINK_64 = $(ROOT_MAKAHA_MISC_DIR_64:$(ROOT_MAKAHA_DIR)%=../../../../$(MONTECARLO)%) -ROOT_MAKAHA_DACF_DIR_32 = $(ROOT_MAKAHA_MOD_DIR)/dacf -ROOT_MAKAHA_DACF_DIR_64 = $(ROOT_MAKAHA_MOD_DIR)/dacf/$(SUBDIR64) -ROOT_MAKAHA_DACF_LINK_64 = $(ROOT_MAKAHA_DACF_DIR_64:$(ROOT_MAKAHA_DIR)%=../../../../$(MONTECARLO)%) - -ROOT_MAKAHA_KERN_DIR = $(ROOT_MAKAHA_KERN_DIR_$(CLASS)) -ROOT_MAKAHA_MISC_DIR = $(ROOT_MAKAHA_MISC_DIR_$(CLASS)) -ROOT_MAKAHA_DRV_DIR = $(ROOT_MAKAHA_DRV_DIR_$(CLASS)) -ROOT_MAKAHA_DACF_DIR = $(ROOT_MAKAHA_DACF_DIR_$(CLASS)) -ROOT_MAKAHA_DRV_LINK = $(ROOT_MAKAHA_DRV_LINK_$(CLASS)) -ROOT_MAKAHA_MISC_LINK = $(ROOT_MAKAHA_MISC_LINK_$(CLASS)) -ROOT_MAKAHA_DACF_LINK = $(ROOT_MAKAHA_DACF_LINK_$(CLASS)) - -ROOT_PLAT_MOD_DIRS += $(ROOT_MAKAHA_MOD_DIR) -ROOT_PLAT_MISC_DIRS += $(ROOT_MAKAHA_MISC_DIR) -ROOT_PLAT_MISC_DIRS_32 += $(ROOT_MAKAHA_MISC_DIR_32) -ROOT_PLAT_DRV_DIRS = $(ROOT_MAKAHA_DRV_DIR) - -USR_MAKAHA_DIR = $(USR_PLAT_DIR)/$(MAKAHA) -USR_MAKAHA_INC_DIR = $(USR_MAKAHA_DIR)/include -USR_MAKAHA_SBIN_DIR = $(USR_MAKAHA_DIR)/sbin -USR_MAKAHA_LIB_DIR = $(USR_MAKAHA_DIR)/lib -USR_MAKAHA_ISYS_DIR = $(USR_MAKAHA_INC_DIR)/sys - -MAKAHA_LINT_LIB_DIR= $(UTSBASE)/$(PLATFORM)/makaha/lint-libs/$(OBJS_DIR) -# -# Definitions for Sputnik, SUNW,UltraSPARC-IIe-NetraCT-60 platform -# -ROOT_SPUTNIK_DIR = $(ROOT_PLAT_DIR)/$(SPUTNIK) -ROOT_SPUTNIK_MOD_DIR = $(ROOT_SPUTNIK_DIR)/kernel - -ROOT_SPUTNIK_KERN_DIR_32 = $(ROOT_SPUTNIK_MOD_DIR) -ROOT_SPUTNIK_KERN_DIR_64 = $(ROOT_SPUTNIK_MOD_DIR)/$(SUBDIR64) -ROOT_SPUTNIK_DRV_DIR_32 = $(ROOT_SPUTNIK_MOD_DIR)/drv -ROOT_SPUTNIK_DRV_DIR_64 = $(ROOT_SPUTNIK_MOD_DIR)/drv/$(SUBDIR64) -ROOT_SPUTNIK_DRV_LINK_32 = $(ROOT_SPUTNIK_DRV_DIR_32:$(ROOT_SPUTNIK_DIR)%=../../../$(MAKAHA)%) -ROOT_SPUTNIK_DRV_LINK_64 = $(ROOT_SPUTNIK_DRV_DIR_64:$(ROOT_SPUTNIK_DIR)%=../../../../$(MAKAHA)%) -ROOT_SPUTNIK_MISC_DIR_32 = $(ROOT_SPUTNIK_MOD_DIR)/misc -ROOT_SPUTNIK_MISC_DIR_64 = $(ROOT_SPUTNIK_MOD_DIR)/misc/$(SUBDIR64) -ROOT_SPUTNIK_DACF_DIR_32 = $(ROOT_SPUTNIK_MOD_DIR)/dacf -ROOT_SPUTNIK_DACF_DIR_64 = $(ROOT_SPUTNIK_MOD_DIR)/dacf/$(SUBDIR64) -ROOT_SPUTNIK_DACF_LINK_64 = $(ROOT_SPUTNIK_DACF_DIR_64:$(ROOT_SPUTNIK_DIR)%=../../../../$(MONTECARLO)%) - -ROOT_SPUTNIK_KERN_DIR = $(ROOT_SPUTNIK_KERN_DIR_$(CLASS)) -ROOT_SPUTNIK_MISC_DIR = $(ROOT_SPUTNIK_MISC_DIR_$(CLASS)) -ROOT_SPUTNIK_DRV_DIR = $(ROOT_SPUTNIK_DRV_DIR_$(CLASS)) -ROOT_SPUTNIK_DACF_DIR = $(ROOT_SPUTNIK_DACF_DIR_$(CLASS)) -ROOT_SPUTNIK_DRV_LINK = $(ROOT_SPUTNIK_DRV_LINK_$(CLASS)) -ROOT_SPUTNIK_DACF_LINK = $(ROOT_SPUTNIK_DACF_LINK_$(CLASS)) - -ROOT_PLAT_MOD_DIRS += $(ROOT_SPUTNIK_MOD_DIR) -ROOT_PLAT_MISC_DIRS += $(ROOT_SPUTNIK_MISC_DIR) -ROOT_PLAT_MISC_DIRS_32 += $(ROOT_SPUTNIK_MISC_DIR_32) -ROOT_PLAT_DRV_DIRS = $(ROOT_SPUTNIK_DRV_DIR) - -USR_SPUTNIK_DIR = $(USR_PLAT_DIR)/$(SPUTNIK) -USR_SPUTNIK_INC_DIR = $(USR_SPUTNIK_DIR)/include -USR_SPUTNIK_SBIN_DIR = $(USR_SPUTNIK_DIR)/sbin -USR_SPUTNIK_LIB_DIR = $(USR_SPUTNIK_DIR)/lib -USR_SPUTNIK_ISYS_DIR = $(USR_SPUTNIK_INC_DIR)/sys - -# -# Montecarlo platform definitions for symbolic links -# -ROOT_MONTECARLO_DIR = $(ROOT_PLAT_DIR)/SUNW,UltraSPARC-IIi-Netract -ROOT_MONTECARLO_MOD_DIR = $(ROOT_MONTECARLO_DIR)/kernel -ROOT_MONTECARLO_KERN_DIR_32 = $(ROOT_MONTECARLO_MOD_DIR) -ROOT_MONTECARLO_KERN_DIR_64 = $(ROOT_MONTECARLO_MOD_DIR)/$(SUBDIR64) -ROOT_MONTECARLO_DRV_DIR_32 = $(ROOT_MONTECARLO_MOD_DIR)/drv -ROOT_MONTECARLO_DRV_DIR_64 = $(ROOT_MONTECARLO_MOD_DIR)/drv/$(SUBDIR64) -ROOT_MONTECARLO_MISC_DIR_32 = $(ROOT_MONTECARLO_MOD_DIR)/misc -ROOT_MONTECARLO_MISC_DIR_64 = $(ROOT_MONTECARLO_MOD_DIR)/misc/$(SUBDIR64) -ROOT_MONTECARLO_DACF_DIR_32 = $(ROOT_MONTECARLO_MOD_DIR)/dacf -ROOT_MONTECARLO_DACF_DIR_64 = $(ROOT_MONTECARLO_MOD_DIR)/dacf/$(SUBDIR64) - -ROOT_MONTECARLO_KERN_DIR = $(ROOT_MONTECARLO_KERN_DIR_$(CLASS)) -ROOT_MONTECARLO_MISC_DIR = $(ROOT_MONTECARLO_MISC_DIR_$(CLASS)) -ROOT_MONTECARLO_DRV_DIR = $(ROOT_MONTECARLO_DRV_DIR_$(CLASS)) -ROOT_MONTECARLO_DACF_DIR = $(ROOT_MONTECARLO_DACF_DIR_$(CLASS)) - -include $(UTSBASE)/sun4u/makaha/Makefile.files - -# -# Include common rules. -# -include $(UTSBASE)/sun4u/Makefile.sun4u diff --git a/usr/src/uts/sun4u/makaha/Makefile.targ b/usr/src/uts/sun4u/makaha/Makefile.targ deleted file mode 100644 index dfdaf2bc75..0000000000 --- a/usr/src/uts/sun4u/makaha/Makefile.targ +++ /dev/null @@ -1,146 +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 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -# -# -# Common targets for sun4u MAKAHA implementation specific modules. -# -# -# Platform targets -# -$(ROOT_MAKAHA_DIR): $(ROOT_PLAT_DIR) - -$(INS.dir) - -.KEEP_STATE: - -# -# Rules for implementation subdirectories. -# -$(ROOT_MAKAHA_MOD_DIR): $(ROOT_MAKAHA_DIR) - -$(INS.dir) - -$(ROOT_MAKAHA_DRV_DIR_32): $(ROOT_MAKAHA_MOD_DIR) - -$(INS.dir) - -$(ROOT_MAKAHA_DRV_DIR_64): $(ROOT_MAKAHA_DRV_DIR_32) - -$(INS.dir) - -$(ROOT_MAKAHA_MISC_DIR_32): $(ROOT_MAKAHA_MOD_DIR) - -$(INS.dir) - -$(ROOT_MAKAHA_MISC_DIR_64): $(ROOT_MAKAHA_MISC_DIR_32) - -$(INS.dir) - -$(USR_MAKAHA_DIR): $(USR_PLAT_DIR) - -$(INS.dir) - -$(USR_MAKAHA_INC_DIR): $(USR_MAKAHA_DIR) - -$(INS.slink4) - -$(USR_MAKAHA_SBIN_DIR): $(USR_MAKAHA_DIR) - -$(INS.slink5) - -$(USR_MAKAHA_LIB_DIR): $(USR_MAKAHA_DIR) - -$(INS.dir) - -$(USR_MAKAHA_ISYS_DIR): $(USR_MAKAHA_DIR) - -$(INS.dir) - -$(ROOT_MAKAHA_MOD_DIR)/%: $(OBJS_DIR)/% $(ROOT_MAKAHA_MOD_DIR) - $(INS.file) - -$(ROOT_MAKAHA_MISC_DIR)/%: $(OBJS_DIR)/% $(ROOT_MAKAHA_MISC_DIR) - $(INS.file) - -$(ROOT_MAKAHA_DACF_DIR_32): $(ROOT_MAKAHA_MOD_DIR) - -$(INS.dir) - -$(ROOT_MAKAHA_DACF_DIR_64): $(ROOT_MAKAHA_DACF_DIR_32) - -$(INS.dir) - -$(ROOT_MAKAHA_DACF_DIR)/%: $(OBJS_DIR)/% $(ROOT_MAKAHA_DACF_DIR) - $(INS.file) - -$(ROOT_MAKAHA_DRV_DIR)/%: $(OBJS_DIR)/% $(ROOT_MAKAHA_DRV_DIR) FRC - $(INS.file) - -# -# Create Sputnik platform directories -# -$(ROOT_SPUTNIK_DIR): $(ROOT_PLAT_DIR) - -$(INS.dir) - -$(ROOT_SPUTNIK_MOD_DIR): $(ROOT_SPUTNIK_DIR) - -$(INS.dir) - -$(ROOT_SPUTNIK_DRV_DIR_32): $(ROOT_SPUTNIK_MOD_DIR) - -$(INS.dir) - -$(ROOT_SPUTNIK_DRV_DIR_64): $(ROOT_SPUTNIK_DRV_DIR_32) - -$(INS.dir) - -$(ROOT_SPUTNIK_MISC_DIR_32): $(ROOT_SPUTNIK_MOD_DIR) - -$(INS.dir) - -$(ROOT_SPUTNIK_MISC_DIR_64): $(ROOT_SPUTNIK_MISC_DIR_32) - -$(INS.dir) - -$(USR_SPUTNIK_DIR): $(USR_PLAT_DIR) - -$(INS.dir) - -$(USR_SPUTNIK_INC_DIR): $(USR_SPUTNIK_DIR) - -$(INS.slink4) - -$(USR_SPUTNIK_SBIN_DIR): $(USR_SPUTNIK_DIR) - -$(INS.slink5) - -$(USR_SPUTNIK_LIB_DIR): $(USR_SPUTNIK_DIR) - -$(INS.dir) - -$(USR_SPUTNIK_ISYS_DIR): $(USR_SPUTNIK_DIR) - -$(INS.dir) - -$(ROOT_SPUTNIK_MOD_DIR)/%: $(OBJS_DIR)/% $(ROOT_SPUTNIK_MOD_DIR) - $(INS.file) - -$(ROOT_SPUTNIK_MISC_DIR)/%: $(OBJS_DIR)/% $(ROOT_SPUTNIK_MISC_DIR) - $(INS.file) - -$(ROOT_SPUTNIK_DRV_DIR)/%: $(OBJS_DIR)/% $(ROOT_SPUTNIK_DRV_DIR) - $(INS.file) - -$(ROOT_SPUTNIK_DACF_DIR_32): $(ROOT_SPUTNIK_MOD_DIR) - -$(INS.dir) - -$(ROOT_SPUTNIK_DACF_DIR_64): $(ROOT_SPUTNIK_DACF_DIR_32) - -$(INS.dir) - -$(ROOT_SPUTNIK_DACF_DIR)/%: $(OBJS_DIR)/% $(ROOT_SPUTNIK_DACF_DIR) - $(INS.file) - -# -# Include common targets. -# -include $(UTSBASE)/sun4u/Makefile.targ diff --git a/usr/src/uts/sun4u/makaha/io/acebus.conf b/usr/src/uts/sun4u/makaha/io/acebus.conf deleted file mode 100644 index b35403edb6..0000000000 --- a/usr/src/uts/sun4u/makaha/io/acebus.conf +++ /dev/null @@ -1,30 +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 2001 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" -# -# Configuration file for Alarm card ebus driver. -# -ac-interrupt-map=0x14,0x400000,1,0,3; diff --git a/usr/src/uts/sun4u/mc-us3i/Makefile b/usr/src/uts/sun4u/mc-us3i/Makefile index 3a233a7361..a4db4e00b0 100644 --- a/usr/src/uts/sun4u/mc-us3i/Makefile +++ b/usr/src/uts/sun4u/mc-us3i/Makefile @@ -62,7 +62,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Turn on doubleword alignment for 64 bit registers diff --git a/usr/src/uts/sun4u/montecarlo/Makefile b/usr/src/uts/sun4u/montecarlo/Makefile deleted file mode 100644 index 6c0dd673c7..0000000000 --- a/usr/src/uts/sun4u/montecarlo/Makefile +++ /dev/null @@ -1,110 +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 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# This makefile drives the production of all MonteCarlo system -# dependent modules for the sun4u architecture. -# - -# -# Path to the base of the uts directory tree (usually /usr/src/uts). -# -UTSBASE = ../.. - -# -# Include common rules. -# -include $(UTSBASE)/sun4u/montecarlo/Makefile.montecarlo - -def := TARGET= def -all := TARGET= all -install := TARGET= install -install_h := TARGET= install_h -clean := TARGET= clean -clobber := TARGET= clobber -lint := TARGET= lint -#lintlib := TARGET= lintlib -modlintlib := TARGET= modlintlib -modlist := TARGET= modlist -modlist := NO_STATE= -K $$MODSTATE$$$$ -clean.lint := TARGET= clean.lint -check := TARGET= check - -# -# Default build targets. -# -.KEEP_STATE: - -def all clean.lint clean clobber modlist: $(MONTECARLO_KMODS) - -modlintlib: $(MONTECARLO_KMODS) - -install: $(ROOT_MONTECARLO_DIR) \ - $(USR_MONTECARLO_DIR) \ - $(USR_MONTECARLO_INC_DIR) \ - $(USR_MONTECARLO_SBIN_DIR) \ - $(USR_MONTECARLO_LIB_DIR) \ - .WAIT $(MONTECARLO_KMODS) \ - se.conf ttymux.conf - -se.conf: $(ROOT_MONTECARLO_DRV_DIR_32) - -@$(RM) $(ROOT_MONTECARLO_DRV_DIR_32)/$@ - $(CP) $(UTSBASE)/sun4u/montecarlo/io/$@ \ - $(ROOT_MONTECARLO_DRV_DIR_32)/$@ - $(CHMOD) $(CFILEMODE) $(ROOT_MONTECARLO_DRV_DIR_32)/$@ - -ttymux.conf: $(ROOT_MONTECARLO_DRV_DIR_32) - -@$(RM) $(ROOT_MONTECARLO_DRV_DIR_32)/$@ - $(CP) $(UTSBASE)/sun4u/montecarlo/io/$@ \ - $(ROOT_MONTECARLO_DRV_DIR_32)/$@ - $(CHMOD) $(CFILEMODE) $(ROOT_MONTECARLO_DRV_DIR_32)/$@ - -install_h check: FRC - @cd sys; pwd; $(MAKE) $(TARGET) - -lint: modlintlib - -# -# The 'lint.platmod' target lints the montecarlo platform module against -# the sun4u kernel. This ends up doing all the kernel cross-checks, -# so it takes a couple of minutes. -# Due to the low ROI, it's not run by default, but it's a good -# idea to run this if you change os/montecarlo.c. -# -LINT_LIBS = $(LINT_LIB) \ - -L$(MONTECARLO_LINT_LIB_DIR) \ - -L$(LINT_LIB_DIR) $(LINT_KMODS:%=-l%) \ - $(CLOSED_LINT_KMODS:%=-l%) \ - -L$(SPARC_LIB_DIR) $(SPARC_LINTS:%=-l%) - -lint.platmod: modlintlib - @-$(ECHO) "\nMonteCarlo Platform-dependent module: global crosschecks:" - @-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.2) - -$(MONTECARLO_KMODS): FRC - @cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET) - -# -# Include common targets. -# -include $(UTSBASE)/sun4u/montecarlo/Makefile.targ diff --git a/usr/src/uts/sun4u/montecarlo/Makefile.files b/usr/src/uts/sun4u/montecarlo/Makefile.files deleted file mode 100644 index 6058f93212..0000000000 --- a/usr/src/uts/sun4u/montecarlo/Makefile.files +++ /dev/null @@ -1,52 +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 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" -# -# This Makefile defines all file modules for the directory -# ust/sun4u/montecarlo and it's children. These are the source files -# which are sun4u "implementation architecture" dependent. -# - -# -# object lists -# -# Montecarlo specific modules -# -# Format: -# XXX_OBJS = xxx.o [yyy.o ...] -# - -ACEBUS_OBJS = acebus.o -TTYMUX_DACF_OBJS = ttymux_dacf.o ttymux_dacf_util.o -PCF8574_NCT_OBJS = pcf8574_nct.o -PCF8591_NCT_OBJS = pcf8591_nct.o -SCSB_OBJS = scsb.o hsc.o - -# -# Miscellaneous -# -INC_PATH += -I$(UTSBASE)/sun4u/montecarlo \ - -I$(UTSBASE)/sun4u \ - -I$(UTSBASE)/common diff --git a/usr/src/uts/sun4u/montecarlo/Makefile.montecarlo b/usr/src/uts/sun4u/montecarlo/Makefile.montecarlo deleted file mode 100644 index 91bc30f4c0..0000000000 --- a/usr/src/uts/sun4u/montecarlo/Makefile.montecarlo +++ /dev/null @@ -1,98 +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 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# This makefile contains the common definitions for the -# sun4u MonteCarlo system dependent modules. -# - -# -# Define directories. -# -ROOT_MONTECARLO_DIR = $(ROOT_PLAT_DIR)/SUNW,UltraSPARC-IIi-Netract -ROOT_MONTECARLO_MOD_DIR = $(ROOT_MONTECARLO_DIR)/kernel - -ROOT_MONTECARLO_KERN_DIR_32 = $(ROOT_MONTECARLO_MOD_DIR) -ROOT_MONTECARLO_KERN_DIR_64 = $(ROOT_MONTECARLO_MOD_DIR)/$(SUBDIR64) -ROOT_MONTECARLO_DRV_DIR_32 = $(ROOT_MONTECARLO_MOD_DIR)/drv -ROOT_MONTECARLO_DACF_DIR_32 = $(ROOT_MONTECARLO_MOD_DIR)/dacf -ROOT_MONTECARLO_DACF_DIR_64 = $(ROOT_MONTECARLO_MOD_DIR)/dacf/$(SUBDIR64) -ROOT_MONTECARLO_DRV_DIR_64 = $(ROOT_MONTECARLO_MOD_DIR)/drv/$(SUBDIR64) -ROOT_MONTECARLO_MISC_DIR_32 = $(ROOT_MONTECARLO_MOD_DIR)/misc -ROOT_MONTECARLO_MISC_DIR_64 = $(ROOT_MONTECARLO_MOD_DIR)/misc/$(SUBDIR64) - -ROOT_MONTECARLO_KERN_DIR = $(ROOT_MONTECARLO_KERN_DIR_$(CLASS)) -ROOT_MONTECARLO_MISC_DIR = $(ROOT_MONTECARLO_MISC_DIR_$(CLASS)) -ROOT_MONTECARLO_DRV_DIR = $(ROOT_MONTECARLO_DRV_DIR_$(CLASS)) -ROOT_MONTECARLO_DACF_DIR = $(ROOT_MONTECARLO_DACF_DIR_$(CLASS)) - -ROOT_PLAT_MOD_DIRS += $(ROOT_MONTECARLO_MOD_DIR) -ROOT_PLAT_MISC_DIRS += $(ROOT_MONTECARLO_MISC_DIR) -ROOT_PLAT_MISC_DIRS_32 += $(ROOT_MONTECARLO_MISC_DIR_32) -ROOT_PLAT_DRV_DIRS = $(ROOT_MONTECARLO_DRV_DIR) -ROOT_PLAT_DACF_DIRS = $(ROOT_MONTECARLO_DACF_DIR) - -USR_MONTECARLO_DIR = $(USR_PLAT_DIR)/SUNW,UltraSPARC-IIi-Netract -USR_MONTECARLO_INC_DIR = $(USR_MONTECARLO_DIR)/include -USR_MONTECARLO_SBIN_DIR = $(USR_MONTECARLO_DIR)/sbin -USR_MONTECARLO_LIB_DIR = $(USR_MONTECARLO_DIR)/lib -USR_MONTECARLO_ISYS_DIR = $(USR_MONTECARLO_INC_DIR)/sys - -MONTECARLO_LINT_LIB_DIR= $(UTSBASE)/$(PLATFORM)/montecarlo/lint-libs/$(OBJS_DIR) - -# -# Define objects. -# - -include $(UTSBASE)/sun4u/montecarlo/Makefile.files - -# -# Include common rules. -# -include $(UTSBASE)/sun4u/Makefile.sun4u - -# -# Define modules -# -MONTECARLO_KMODS = acebus pcf8574_nct pcf8591_nct scsb ttymux_dacf - -# -# we need the official MONTECARLO name here, and for the sun4u/montecarlo -# directory and Makefile.montecarlo -# for now we'll use montecarlo for workspace file/dir names -# and NORDICA_CP1500 for conditional code compiles, since that's our current -# test platform -# -MACHINE_DEFS += -DNORDICA_CP1500 - -# -# For now, disable these lint checks; maintainers should endeavor -# to investigate and remove these for maximum lint coverage. -# Please do not carry these forward to new Makefiles. -# -LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON -LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED -LINTTAGS += -erroff=E_STATIC_UNUSED -LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV diff --git a/usr/src/uts/sun4u/montecarlo/Makefile.rules b/usr/src/uts/sun4u/montecarlo/Makefile.rules deleted file mode 100644 index e5370ad1ac..0000000000 --- a/usr/src/uts/sun4u/montecarlo/Makefile.rules +++ /dev/null @@ -1,57 +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 1999-2002 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" -# -# This Makefile defines the build rules for the directory -# uts/sun4u/montecarlo and its children. -# -# The following two-level ordering must be maintained in this file. -# Lines are sorted first in order of decreasing specificity based on -# the first directory component. That is, sun4u rules come before -# sparc rules come before common rules. -# -# Lines whose initial directory components are equal are sorted -# alphabetically by the remaining components. - -# -# Section 1a: C object build rules -# -$(OBJS_DIR)/%.o: $(UTSBASE)/sun4u/montecarlo/io/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -$(OBJS_DIR)/%.o: $(UTSBASE)/sun4u/montecarlo/io/ttymux_dacf/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -# -# Section 1b: Lint `object' build rules -# -$(LINTS_DIR)/%.ln: $(UTSBASE)/sun4u/montecarlo/io/%.c - @($(LHEAD) $(LINT.c) $< $(LTAIL)) - -$(LINTS_DIR)/%.ln: $(UTSBASE)/sun4u/montecarlo/io/ttymux_dacf/%.c - @($(LHEAD) $(LINT.c) $< $(LTAIL)) diff --git a/usr/src/uts/sun4u/montecarlo/Makefile.targ b/usr/src/uts/sun4u/montecarlo/Makefile.targ deleted file mode 100644 index 481d036cc5..0000000000 --- a/usr/src/uts/sun4u/montecarlo/Makefile.targ +++ /dev/null @@ -1,92 +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 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -# -# Common targets for sun4u MonteCarlo implementation specific modules. -# -# -# Platform targets -# -$(ROOT_MONTECARLO_DIR): $(ROOT_PLAT_DIR) - -$(INS.dir) - -.KEEP_STATE: - -# -# Rules for implementation subdirectories. -# -$(ROOT_MONTECARLO_MOD_DIR): $(ROOT_MONTECARLO_DIR) - -$(INS.dir) - -$(ROOT_MONTECARLO_DACF_DIR_32): $(ROOT_MONTECARLO_MOD_DIR) - -$(INS.dir) - -$(ROOT_MONTECARLO_DACF_DIR_64): $(ROOT_MONTECARLO_DACF_DIR_32) - -$(INS.dir) - -$(ROOT_MONTECARLO_DRV_DIR_32): $(ROOT_MONTECARLO_MOD_DIR) - -$(INS.dir) - -$(ROOT_MONTECARLO_DRV_DIR_64): $(ROOT_MONTECARLO_DRV_DIR_32) - -$(INS.dir) - -$(ROOT_MONTECARLO_MISC_DIR_32): $(ROOT_MONTECARLO_MOD_DIR) - -$(INS.dir) - -$(ROOT_MONTECARLO_MISC_DIR_64): $(ROOT_MONTECARLO_MISC_DIR_32) - -$(INS.dir) - -$(USR_MONTECARLO_DIR): $(USR_PLAT_DIR) - -$(INS.dir) - -$(USR_MONTECARLO_INC_DIR): $(USR_MONTECARLO_DIR) - -$(INS.slink4) - -$(USR_MONTECARLO_SBIN_DIR): $(USR_MONTECARLO_DIR) - -$(INS.slink5) - -$(USR_MONTECARLO_LIB_DIR): $(USR_MONTECARLO_DIR) - -$(INS.dir) - -$(USR_MONTECARLO_ISYS_DIR): $(USR_MONTECARLO_INC_DIR) - -$(INS.dir) - -$(ROOT_MONTECARLO_MOD_DIR)/%: $(OBJS_DIR)/% $(ROOT_MONTECARLO_MOD_DIR) FRC - $(INS.file) - -$(ROOT_MONTECARLO_MISC_DIR)/%: $(OBJS_DIR)/% $(ROOT_MONTECARLO_MISC_DIR) FRC - $(INS.file) - -$(ROOT_MONTECARLO_DACF_DIR)/%: $(OBJS_DIR)/% $(ROOT_MONTECARLO_DACF_DIR) - $(INS.file) - -$(ROOT_MONTECARLO_DRV_DIR)/%: $(OBJS_DIR)/% $(ROOT_MONTECARLO_DRV_DIR) FRC - $(INS.file) - -# -# Include common targets. -# -include $(UTSBASE)/sun4u/montecarlo/Makefile.rules -include $(UTSBASE)/sun4u/Makefile.targ diff --git a/usr/src/uts/sun4u/montecarlo/acebus/Makefile b/usr/src/uts/sun4u/montecarlo/acebus/Makefile deleted file mode 100644 index 03b756c375..0000000000 --- a/usr/src/uts/sun4u/montecarlo/acebus/Makefile +++ /dev/null @@ -1,99 +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 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -# -# This makefile drives the production of the acebus driver kernel module -# for the Alarm Card. -# -# sun4u implementation architecture dependent -# - -# -# Path to the base of the uts directory tree (usually /usr/src/uts). -# -UTSBASE = ../../.. - -# -# Define the module and object file sets. -# -MODULE = acebus -OBJECTS = $(ACEBUS_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(ACEBUS_OBJS:%.o=$(LINTS_DIR)/%.ln) -ROOTMODULE = $(ROOT_MONTECARLO_DRV_DIR)/$(MODULE) - -# -# Include common rules. -# -include $(UTSBASE)/sun4u/montecarlo/Makefile.montecarlo - -# -# Define targets -# -ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint -INSTALL_TARGET = $(BINARY) $(ROOTMODULE) - -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) -DNORDICA_CP1500 -DACEBUS_HOTPLUG -CERRWARN += -_gcc=-Wno-switch - -# -# Turn on doubleword alignment for 64 bit registers -# -CFLAGS += -dalign - -# Add our depedencies to LDFLAGS -# -LDFLAGS += -dy - -# -# Default build targets. -# -.KEEP_STATE: - -def: $(DEF_DEPS) - -all: $(ALL_DEPS) - -clean: $(CLEAN_DEPS) - -clobber: $(CLOBBER_DEPS) - -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - -install: $(INSTALL_DEPS) - -LINT_LIB_DIR = $(MONTECARLO_LINT_LIB_DIR) -# -# Include common targets. -# -include $(UTSBASE)/sun4u/montecarlo/Makefile.targ diff --git a/usr/src/uts/sun4u/montecarlo/io/acebus.c b/usr/src/uts/sun4u/montecarlo/io/acebus.c deleted file mode 100644 index f1c92ea5b2..0000000000 --- a/usr/src/uts/sun4u/montecarlo/io/acebus.c +++ /dev/null @@ -1,1119 +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 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ -/* - * Copyright 2012 Garrett D'Amore <garrett@damore.org>. All rights reserved. - */ - - -#include <sys/types.h> -#include <sys/conf.h> -#include <sys/ddi.h> -#include <sys/sunddi.h> -#include <sys/ddi_impldefs.h> -#include <sys/ddi_subrdefs.h> -#include <sys/pci.h> -#include <sys/pci/pci_nexus.h> -#include <sys/autoconf.h> -#include <sys/cmn_err.h> -#include <sys/errno.h> -#include <sys/kmem.h> -#include <sys/debug.h> -#include <sys/sysmacros.h> -#include <sys/acebus.h> - -#ifdef DEBUG -static uint_t acebus_debug_flags = 0; -#endif - -/* - * The values of the following variables are used to initialize - * the cache line size and latency timer registers in the ebus - * configuration header. Variables are used instead of constants - * to allow tuning from the /etc/system file. - */ -static uint8_t acebus_cache_line_size = 0x10; /* 64 bytes */ -static uint8_t acebus_latency_timer = 0x40; /* 64 PCI cycles */ - -/* - * function prototypes for bus ops routines: - */ -static int -acebus_map(dev_info_t *dip, dev_info_t *rdip, ddi_map_req_t *mp, - off_t offset, off_t len, caddr_t *addrp); -static int -acebus_ctlops(dev_info_t *dip, dev_info_t *rdip, - ddi_ctl_enum_t op, void *arg, void *result); -static int -acebus_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, - ddi_intr_handle_impl_t *hdlp, void *result); - -/* - * function prototypes for dev ops routines: - */ -static int acebus_attach(dev_info_t *dip, ddi_attach_cmd_t cmd); -static int acebus_detach(dev_info_t *dip, ddi_detach_cmd_t cmd); - -/* - * general function prototypes: - */ -static int acebus_config(ebus_devstate_t *ebus_p); -static int acebus_apply_range(ebus_devstate_t *ebus_p, dev_info_t *rdip, - ebus_regspec_t *ebus_rp, pci_regspec_t *rp); -static int acebus_get_ranges_prop(ebus_devstate_t *ebus_p); -#ifdef ACEBUS_HOTPLUG -static int acebus_update_props(ebus_devstate_t *ebus_p); -static int acebus_set_imap(dev_info_t *dip); -#endif - -#define getprop(dip, name, addr, intp) \ - ddi_getlongprop(DDI_DEV_T_ANY, (dip), DDI_PROP_DONTPASS, \ - (name), (caddr_t)(addr), (intp)) - -/* - * bus ops and dev ops structures: - */ -static struct bus_ops acebus_bus_ops = { - BUSO_REV, - acebus_map, - NULL, - NULL, - NULL, - i_ddi_map_fault, - NULL, - ddi_dma_allochdl, - ddi_dma_freehdl, - ddi_dma_bindhdl, - ddi_dma_unbindhdl, - ddi_dma_flush, - ddi_dma_win, - ddi_dma_mctl, - acebus_ctlops, - ddi_bus_prop_op, - 0, /* (*bus_get_eventcookie)(); */ - 0, /* (*bus_add_eventcall)(); */ - 0, /* (*bus_remove_eventcall)(); */ - 0, /* (*bus_post_event)(); */ - 0, /* (*bus_intr_ctl)(); */ - NULL, /* (*bus_config)(); */ - NULL, /* (*bus_unconfig)(); */ - NULL, /* (*bus_fm_init)(); */ - NULL, /* (*bus_fm_fini)(); */ - NULL, /* (*bus_fm_access_enter)(); */ - NULL, /* (*bus_fm_access_fini)(); */ - NULL, /* (*bus_power)(); */ - acebus_intr_ops /* (*bus_intr_op)(); */ -}; - -static struct dev_ops acebus_ops = { - DEVO_REV, - 0, - ddi_no_info, - nulldev, - nulldev, - acebus_attach, - acebus_detach, - nodev, - (struct cb_ops *)0, - &acebus_bus_ops, - NULL, - ddi_quiesce_not_supported, /* devo_quiesce */ -}; - -/* - * module definitions: - */ -#include <sys/modctl.h> -extern struct mod_ops mod_driverops; - -static struct modldrv modldrv = { - &mod_driverops, /* Type of module. This one is a driver */ - "Alarm Card ebus nexus", /* Name of module. */ - &acebus_ops, /* driver ops */ -}; - -static struct modlinkage modlinkage = { - MODREV_1, (void *)&modldrv, NULL -}; - -/* - * driver global data: - */ -static void *per_acebus_state; /* per-ebus soft state pointer */ - - -int -_init(void) -{ - int e; - - /* - * Initialize per-ebus soft state pointer. - */ - e = ddi_soft_state_init(&per_acebus_state, sizeof (ebus_devstate_t), 1); - if (e != 0) - return (e); - - /* - * Install the module. - */ - e = mod_install(&modlinkage); - if (e != 0) - ddi_soft_state_fini(&per_acebus_state); - return (e); -} - -int -_fini(void) -{ - int e; - - /* - * Remove the module. - */ - e = mod_remove(&modlinkage); - if (e != 0) - return (e); - - /* - * Free the soft state info. - */ - ddi_soft_state_fini(&per_acebus_state); - return (e); -} - -int -_info(struct modinfo *modinfop) -{ - return (mod_info(&modlinkage, modinfop)); -} - -/* device driver entry points */ - -/* - * attach entry point: - * - * normal attach: - * - * create soft state structure (dip, reg, nreg and state fields) - * map in configuration header - * make sure device is properly configured - * report device - */ -static int -acebus_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) -{ - ebus_devstate_t *ebus_p; /* per ebus state pointer */ - int instance; - - DBG1(D_ATTACH, NULL, "dip=%x\n", dip); - switch (cmd) { - case DDI_ATTACH: - - /* - * Allocate soft state for this instance. - */ - instance = ddi_get_instance(dip); - if (ddi_soft_state_zalloc(per_acebus_state, instance) - != DDI_SUCCESS) { - DBG(D_ATTACH, NULL, "failed to alloc soft state\n"); - return (DDI_FAILURE); - } - ebus_p = get_acebus_soft_state(instance); - ebus_p->dip = dip; - - /* - * Make sure the master enable and memory access enable - * bits are set in the config command register. - */ - if (!acebus_config(ebus_p)) { - free_acebus_soft_state(instance); - return (DDI_FAILURE); - } - - (void) ddi_prop_create(DDI_DEV_T_NONE, dip, - DDI_PROP_CANSLEEP, "no-dma-interrupt-sync", NULL, 0); - /* Get our ranges property for mapping child registers. */ - if (acebus_get_ranges_prop(ebus_p) != DDI_SUCCESS) { - free_acebus_soft_state(instance); - return (DDI_FAILURE); - } - - /* - * Make the state as attached and report the device. - */ - ebus_p->state = ATTACHED; - ddi_report_dev(dip); - DBG(D_ATTACH, ebus_p, "returning\n"); - return (DDI_SUCCESS); - - case DDI_RESUME: - - instance = ddi_get_instance(dip); - ebus_p = get_acebus_soft_state(instance); - - /* - * Make sure the master enable and memory access enable - * bits are set in the config command register. - */ - if (!acebus_config(ebus_p)) { - free_acebus_soft_state(instance); - return (DDI_FAILURE); - } - - ebus_p->state = RESUMED; - return (DDI_SUCCESS); - } - return (DDI_FAILURE); -} - -/* - * detach entry point: - */ -static int -acebus_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) -{ - int instance = ddi_get_instance(dip); - ebus_devstate_t *ebus_p = get_acebus_soft_state(instance); - - switch (cmd) { - case DDI_DETACH: - DBG1(D_DETACH, ebus_p, "DDI_DETACH dip=%p\n", dip); - ddi_prop_remove_all(dip); - kmem_free(ebus_p->rangep, ebus_p->range_cnt * - sizeof (struct ebus_pci_rangespec)); - free_acebus_soft_state(instance); - return (DDI_SUCCESS); - - case DDI_SUSPEND: - DBG1(D_DETACH, ebus_p, "DDI_SUSPEND dip=%p\n", dip); - ebus_p->state = SUSPENDED; - return (DDI_SUCCESS); - } - return (DDI_FAILURE); -} - - -static int -acebus_get_ranges_prop(ebus_devstate_t *ebus_p) -{ - struct ebus_pci_rangespec *rangep; - int nrange, range_len; - - if (ddi_getlongprop(DDI_DEV_T_ANY, ebus_p->dip, DDI_PROP_DONTPASS, - "ranges", (caddr_t)&rangep, &range_len) != DDI_SUCCESS) { - - cmn_err(CE_WARN, "%s%d: can't get ranges property", - ddi_get_name(ebus_p->dip), ddi_get_instance(ebus_p->dip)); - return (DDI_ME_REGSPEC_RANGE); - } - - nrange = range_len / sizeof (struct ebus_pci_rangespec); - - if (nrange == 0) { - kmem_free(rangep, range_len); - return (DDI_FAILURE); - } - -#ifdef DEBUG - { - int i; - - for (i = 0; i < nrange; i++) { - DBG5(D_MAP, ebus_p, - "ebus range addr 0x%x.0x%x PCI range " - "addr 0x%x.0x%x.0x%x ", rangep[i].ebus_phys_hi, - rangep[i].ebus_phys_low, rangep[i].pci_phys_hi, - rangep[i].pci_phys_mid, rangep[i].pci_phys_low); - DBG1(D_MAP, ebus_p, "Size 0x%x\n", rangep[i].rng_size); - } - } -#endif /* DEBUG */ - - ebus_p->rangep = rangep; - ebus_p->range_cnt = nrange; - - return (DDI_SUCCESS); -} - - -/* bus driver entry points */ - -/* - * bus map entry point: - * - * if map request is for an rnumber - * get the corresponding regspec from device node - * build a new regspec in our parent's format - * build a new map_req with the new regspec - * call up the tree to complete the mapping - */ -static int -acebus_map(dev_info_t *dip, dev_info_t *rdip, ddi_map_req_t *mp, - off_t off, off_t len, caddr_t *addrp) -{ - ebus_devstate_t *ebus_p = get_acebus_soft_state(ddi_get_instance(dip)); - ebus_regspec_t *ebus_rp, *ebus_regs; - pci_regspec_t pci_reg; - ddi_map_req_t p_map_request; - int rnumber, i, n; - int rval = DDI_SUCCESS; - - /* - * Handle the mapping according to its type. - */ - DBG4(D_MAP, ebus_p, "rdip=%s%d: off=%x len=%x\n", - ddi_get_name(rdip), ddi_get_instance(rdip), off, len); - switch (mp->map_type) { - case DDI_MT_REGSPEC: - - /* - * We assume the register specification is in ebus format. - * We must convert it into a PCI format regspec and pass - * the request to our parent. - */ - DBG3(D_MAP, ebus_p, "rdip=%s%d: REGSPEC - handlep=%x\n", - ddi_get_name(rdip), ddi_get_instance(rdip), - mp->map_handlep); - ebus_rp = (ebus_regspec_t *)mp->map_obj.rp; - break; - - case DDI_MT_RNUMBER: - - /* - * Get the "reg" property from the device node and convert - * it to our parent's format. - */ - rnumber = mp->map_obj.rnumber; - DBG4(D_MAP, ebus_p, "rdip=%s%d: rnumber=%x handlep=%x\n", - ddi_get_name(rdip), ddi_get_instance(rdip), - rnumber, mp->map_handlep); - - if (getprop(rdip, "reg", &ebus_regs, &i) != DDI_SUCCESS) { - DBG(D_MAP, ebus_p, "can't get reg property\n"); - return (DDI_ME_RNUMBER_RANGE); - } - n = i / sizeof (ebus_regspec_t); - - if (rnumber < 0 || rnumber >= n) { - DBG(D_MAP, ebus_p, "rnumber out of range\n"); - return (DDI_ME_RNUMBER_RANGE); - } - ebus_rp = &ebus_regs[rnumber]; - break; - - default: - return (DDI_ME_INVAL); - - } - - /* Adjust our reg property with offset and length */ - ebus_rp->addr_low += off; - if (len) - ebus_rp->size = len; - - /* - * Now we have a copy the "reg" entry we're attempting to map. - * Translate this into our parents PCI address using the ranges - * property. - */ - rval = acebus_apply_range(ebus_p, rdip, ebus_rp, &pci_reg); - - if (mp->map_type == DDI_MT_RNUMBER) - kmem_free((caddr_t)ebus_regs, i); - - if (rval != DDI_SUCCESS) - return (rval); - -#ifdef ACEBUS_HOTPLUG - /* - * The map operation provides a translated (not a re-assigned, or - * relocated) ebus address for the child in its address space(range). - * Ebus address space is relocatible but its child address space - * is not. As specified by their 'reg' properties, they reside - * at a fixed offset in their parent's (ebus's) space. - * - * By setting this bit, we will not run into HostPCI nexus - * trying to relocate a translated ebus address (which is already - * relocated) and failing the operation. - * The reason for doing this here is that the PCI hotplug configurator - * always marks the ebus space as relocatible (unlike OBP) and that - * information is implied for the child too, which is wrong. - */ - pci_reg.pci_phys_hi |= PCI_RELOCAT_B; -#endif -#ifdef DEBUG - DBG5(D_MAP, ebus_p, "(%x,%x,%x)(%x,%x)\n", - pci_reg.pci_phys_hi, - pci_reg.pci_phys_mid, - pci_reg.pci_phys_low, - pci_reg.pci_size_hi, - pci_reg.pci_size_low); -#endif - - p_map_request = *mp; - p_map_request.map_type = DDI_MT_REGSPEC; - p_map_request.map_obj.rp = (struct regspec *)&pci_reg; - rval = ddi_map(dip, &p_map_request, 0, 0, addrp); - DBG1(D_MAP, ebus_p, "parent returned %x\n", rval); - return (rval); -} - - -static int -acebus_apply_range(ebus_devstate_t *ebus_p, dev_info_t *rdip, - ebus_regspec_t *ebus_rp, pci_regspec_t *rp) -{ - int b; - int rval = DDI_SUCCESS; - struct ebus_pci_rangespec *rangep = ebus_p->rangep; - int nrange = ebus_p->range_cnt; - static const char out_of_range[] = - "Out of range register specification from device node <%s>"; - - DBG3(D_MAP, ebus_p, "Range Matching Addr 0x%x.%x size 0x%x\n", - ebus_rp->addr_hi, ebus_rp->addr_low, ebus_rp->size); - - for (b = 0; b < nrange; ++b, ++rangep) { - - /* Check for the correct space */ - if (ebus_rp->addr_hi == rangep->ebus_phys_hi) - /* See if we fit in this range */ - if ((ebus_rp->addr_low >= - rangep->ebus_phys_low) && - ((ebus_rp->addr_low + ebus_rp->size - 1) - <= (rangep->ebus_phys_low + - rangep->rng_size - 1))) { - uint_t addr_offset = ebus_rp->addr_low - - rangep->ebus_phys_low; - /* - * Use the range entry to translate - * the EBUS physical address into the - * parents PCI space. - */ - rp->pci_phys_hi = - rangep->pci_phys_hi; - rp->pci_phys_mid = rangep->pci_phys_mid; - rp->pci_phys_low = - rangep->pci_phys_low + addr_offset; - rp->pci_size_hi = 0; - rp->pci_size_low = - min(ebus_rp->size, (rangep->rng_size - - addr_offset)); - - DBG2(D_MAP, ebus_p, "Child hi0x%x lo0x%x ", - rangep->ebus_phys_hi, - rangep->ebus_phys_low); - DBG4(D_MAP, ebus_p, "Parent hi0x%x " - "mid0x%x lo0x%x size 0x%x\n", - rangep->pci_phys_hi, - rangep->pci_phys_mid, - rangep->pci_phys_low, - rangep->rng_size); - - break; - } - } - - if (b == nrange) { - cmn_err(CE_WARN, out_of_range, ddi_get_name(rdip)); - return (DDI_ME_REGSPEC_RANGE); - } - - return (rval); -} - - -/* - * control ops entry point: - * - * Requests handled completely: - * DDI_CTLOPS_INITCHILD - * DDI_CTLOPS_UNINITCHILD - * DDI_CTLOPS_REPORTDEV - * DDI_CTLOPS_REGSIZE - * DDI_CTLOPS_NREGS - * - * All others passed to parent. - */ -static int -acebus_ctlops(dev_info_t *dip, dev_info_t *rdip, - ddi_ctl_enum_t op, void *arg, void *result) -{ -#ifdef DEBUG - ebus_devstate_t *ebus_p = get_acebus_soft_state(ddi_get_instance(dip)); -#endif - ebus_regspec_t *ebus_rp; - int32_t reglen; - int i, n; - char name[10]; - - switch (op) { - case DDI_CTLOPS_INITCHILD: { - dev_info_t *child = (dev_info_t *)arg; - /* - * Set the address portion of the node name based on the - * address/offset. - */ - DBG2(D_CTLOPS, ebus_p, "DDI_CTLOPS_INITCHILD: rdip=%s%d\n", - ddi_get_name(child), ddi_get_instance(child)); - - if (ddi_getlongprop(DDI_DEV_T_ANY, child, DDI_PROP_DONTPASS, - "reg", (caddr_t)&ebus_rp, ®len) != DDI_SUCCESS) { - - DBG(D_CTLOPS, ebus_p, "can't get reg property\n"); - return (DDI_FAILURE); - - } - - (void) sprintf(name, "%x,%x", ebus_rp->addr_hi, - ebus_rp->addr_low); - ddi_set_name_addr(child, name); - kmem_free((caddr_t)ebus_rp, reglen); - - ddi_set_parent_data(child, NULL); - - return (DDI_SUCCESS); - - } - - case DDI_CTLOPS_UNINITCHILD: - DBG2(D_CTLOPS, ebus_p, "DDI_CTLOPS_UNINITCHILD: rdip=%s%d\n", - ddi_get_name((dev_info_t *)arg), - ddi_get_instance((dev_info_t *)arg)); - ddi_set_name_addr((dev_info_t *)arg, NULL); - ddi_remove_minor_node((dev_info_t *)arg, NULL); - impl_rem_dev_props((dev_info_t *)arg); - return (DDI_SUCCESS); - - case DDI_CTLOPS_REPORTDEV: - - DBG2(D_CTLOPS, ebus_p, "DDI_CTLOPS_REPORTDEV: rdip=%s%d\n", - ddi_get_name(rdip), ddi_get_instance(rdip)); - cmn_err(CE_CONT, "?%s%d at %s%d: offset %s\n", - ddi_driver_name(rdip), ddi_get_instance(rdip), - ddi_driver_name(dip), ddi_get_instance(dip), - ddi_get_name_addr(rdip)); - return (DDI_SUCCESS); - - case DDI_CTLOPS_REGSIZE: - - DBG2(D_CTLOPS, ebus_p, "DDI_CTLOPS_REGSIZE: rdip=%s%d\n", - ddi_get_name(rdip), ddi_get_instance(rdip)); - if (getprop(rdip, "reg", &ebus_rp, &i) != DDI_SUCCESS) { - DBG(D_CTLOPS, ebus_p, "can't get reg property\n"); - return (DDI_FAILURE); - } - n = i / sizeof (ebus_regspec_t); - if (*(int *)arg < 0 || *(int *)arg >= n) { - DBG(D_MAP, ebus_p, "rnumber out of range\n"); - kmem_free((caddr_t)ebus_rp, i); - return (DDI_FAILURE); - } - *((off_t *)result) = ebus_rp[*(int *)arg].size; - kmem_free((caddr_t)ebus_rp, i); - return (DDI_SUCCESS); - - case DDI_CTLOPS_NREGS: - - DBG2(D_CTLOPS, ebus_p, "DDI_CTLOPS_NREGS: rdip=%s%d\n", - ddi_get_name(rdip), ddi_get_instance(rdip)); - if (getprop(rdip, "reg", &ebus_rp, &i) != DDI_SUCCESS) { - DBG(D_CTLOPS, ebus_p, "can't get reg property\n"); - return (DDI_FAILURE); - } - *((uint_t *)result) = i / sizeof (ebus_regspec_t); - kmem_free((caddr_t)ebus_rp, i); - return (DDI_SUCCESS); - } - - /* - * Now pass the request up to our parent. - */ - DBG2(D_CTLOPS, ebus_p, "passing request to parent: rdip=%s%d\n", - ddi_get_name(rdip), ddi_get_instance(rdip)); - return (ddi_ctlops(dip, rdip, op, arg, result)); -} - -struct ebus_string_to_pil { - int8_t *string; - uint32_t pil; -}; - -static struct ebus_string_to_pil acebus_name_to_pil[] = {{"SUNW,CS4231", 9}, - {"fdthree", 8}, - {"ecpp", 3}, - {"su", 12}, - {"se", 12}, - {"power", 14}}; - -static struct ebus_string_to_pil acebus_device_type_to_pil[] = {{"serial", 12}, - {"block", 8}}; - -static int -acebus_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, - ddi_intr_handle_impl_t *hdlp, void *result) -{ -#ifdef DEBUG - ebus_devstate_t *ebus_p = get_acebus_soft_state(ddi_get_instance(dip)); -#endif - int8_t *name, *device_type; - int32_t i, max_children, max_device_types, len; - - /* - * NOTE: These ops below will never be supported in this nexus - * driver, hence they always return immediately. - */ - switch (intr_op) { - case DDI_INTROP_GETCAP: - *(int *)result = DDI_INTR_FLAG_LEVEL; - return (DDI_SUCCESS); - case DDI_INTROP_SUPPORTED_TYPES: - *(int *)result = i_ddi_get_intx_nintrs(rdip) ? - DDI_INTR_TYPE_FIXED : 0; - return (DDI_SUCCESS); - case DDI_INTROP_SETCAP: - case DDI_INTROP_SETMASK: - case DDI_INTROP_CLRMASK: - case DDI_INTROP_GETPENDING: - return (DDI_ENOTSUP); - default: - break; - } - - if (hdlp->ih_pri) - goto done; - - /* - * This is a hack to set the PIL for the devices under ebus. - * We first look up a device by it's specific name, if we can't - * match the name, we try and match it's device_type property. - * Lastly we default a PIL level of 1. - */ - DBG1(D_INTR, ebus_p, "ebus_p %p\n", ebus_p); - - name = ddi_get_name(rdip); - max_children = sizeof (acebus_name_to_pil) / - sizeof (struct ebus_string_to_pil); - - for (i = 0; i < max_children; i++) { - if (strcmp(acebus_name_to_pil[i].string, name) == 0) { - DBG2(D_INTR, ebus_p, "child name %s; match PIL %d\n", - acebus_name_to_pil[i].string, - acebus_name_to_pil[i].pil); - - hdlp->ih_pri = acebus_name_to_pil[i].pil; - goto done; - } - } - - if (ddi_getlongprop(DDI_DEV_T_ANY, rdip, DDI_PROP_DONTPASS, - "device_type", (caddr_t)&device_type, &len) == DDI_SUCCESS) { - - max_device_types = sizeof (acebus_device_type_to_pil) / - sizeof (struct ebus_string_to_pil); - - for (i = 0; i < max_device_types; i++) { - if (strcmp(acebus_device_type_to_pil[i].string, - device_type) == 0) { - DBG2(D_INTR, ebus_p, - "Device type %s; match PIL %d\n", - acebus_device_type_to_pil[i].string, - acebus_device_type_to_pil[i].pil); - - hdlp->ih_pri = acebus_device_type_to_pil[i].pil; - break; - } - } - - kmem_free(device_type, len); - } - - /* - * If we get here, we need to set a default value - * for the PIL. - */ - if (hdlp->ih_pri == 0) { - hdlp->ih_pri = 1; - cmn_err(CE_WARN, "%s%d assigning default interrupt level %d " - "for device %s%d", ddi_driver_name(dip), - ddi_get_instance(dip), hdlp->ih_pri, ddi_driver_name(rdip), - ddi_get_instance(rdip)); - } - -done: - /* Pass up the request to our parent. */ - return (i_ddi_intr_ops(dip, rdip, intr_op, hdlp, result)); -} - - -static int -acebus_config(ebus_devstate_t *ebus_p) -{ - ddi_acc_handle_t conf_handle; - uint16_t comm; -#ifdef ACEBUS_HOTPLUG - int tcr_reg; - caddr_t csr_io; - ddi_device_acc_attr_t csr_attr = { /* CSR map attributes */ - DDI_DEVICE_ATTR_V0, - DDI_STRUCTURE_LE_ACC, - DDI_STRICTORDER_ACC - }; - ddi_acc_handle_t csr_handle; -#endif - - /* - * Make sure the master enable and memory access enable - * bits are set in the config command register. - */ - if (pci_config_setup(ebus_p->dip, &conf_handle) != DDI_SUCCESS) - return (0); - - comm = pci_config_get16(conf_handle, PCI_CONF_COMM), -#ifdef DEBUG - DBG1(D_ATTACH, ebus_p, "command register was 0x%x\n", comm); -#endif - comm |= (PCI_COMM_ME|PCI_COMM_MAE|PCI_COMM_SERR_ENABLE| - PCI_COMM_PARITY_DETECT); - pci_config_put16(conf_handle, PCI_CONF_COMM, comm), -#ifdef DEBUG - DBG1(D_MAP, ebus_p, "command register is now 0x%x\n", - pci_config_get16(conf_handle, PCI_CONF_COMM)); -#endif - pci_config_put8(conf_handle, PCI_CONF_CACHE_LINESZ, - (uchar_t)acebus_cache_line_size); - pci_config_put8(conf_handle, PCI_CONF_LATENCY_TIMER, - (uchar_t)acebus_latency_timer); - pci_config_teardown(&conf_handle); - -#ifdef ACEBUS_HOTPLUG - if (acebus_update_props(ebus_p) != DDI_SUCCESS) { - cmn_err(CE_WARN, "%s%d: Could not update special properties.", - ddi_driver_name(ebus_p->dip), - ddi_get_instance(ebus_p->dip)); - return (0); - } - - if (ddi_regs_map_setup(ebus_p->dip, CSR_IO_RINDEX, - (caddr_t *)&csr_io, 0, CSR_SIZE, &csr_attr, - &csr_handle) != DDI_SUCCESS) { - cmn_err(CE_WARN, "%s%d: Could not map Ebus CSR.", - ddi_driver_name(ebus_p->dip), - ddi_get_instance(ebus_p->dip)); - } -#ifdef DEBUG - if (acebus_debug_flags) { - DBG3(D_ATTACH, ebus_p, "tcr[123] = %x,%x,%x\n", - ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io + - TCR1_OFF)), - ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io + - TCR2_OFF)), - ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io + - TCR3_OFF))); - DBG2(D_ATTACH, ebus_p, "pmd-aux=%x, freq-aux=%x\n", - ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io + - PMD_AUX_OFF)), - ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io + - FREQ_AUX_OFF))); -#ifdef ACEBUS_DEBUG - for (comm = 0; comm < 4; comm++) - prom_printf("dcsr%d=%x, dacr%d=%x, dbcr%d=%x\n", comm, - ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io + - 0x700000+(0x2000*comm))), comm, - ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io + - 0x700000+(0x2000*comm)+4)), comm, - ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io + - 0x700000+(0x2000*comm)+8))); -#endif - } /* acebus_debug_flags */ -#endif - /* If TCR registers are not initialized, initialize them here */ - tcr_reg = ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io + - TCR1_OFF)); - if ((tcr_reg == 0) || (tcr_reg == -1)) - ddi_put32(csr_handle, (uint32_t *)((caddr_t)csr_io + TCR1_OFF), - TCR1_REGVAL); - tcr_reg = ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io + - TCR2_OFF)); - if ((tcr_reg == 0) || (tcr_reg == -1)) - ddi_put32(csr_handle, (uint32_t *)((caddr_t)csr_io + TCR2_OFF), - TCR2_REGVAL); - tcr_reg = ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io + - TCR3_OFF)); - if ((tcr_reg == 0) || (tcr_reg == -1)) - ddi_put32(csr_handle, (uint32_t *)((caddr_t)csr_io + TCR3_OFF), - TCR3_REGVAL); -#ifdef DEBUG - if (acebus_debug_flags) { - DBG3(D_ATTACH, ebus_p, "wrote tcr[123] = %x,%x,%x\n", - ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io + - TCR1_OFF)), - ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io + - TCR2_OFF)), - ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io + - TCR3_OFF))); - } -#endif - - ddi_regs_map_free(&csr_handle); -#endif /* ACEBUS_HOTPLUG */ - return (1); /* return success */ -} - -#ifdef DEBUG -extern void prom_printf(const char *, ...); - -static void -acebus_debug(uint_t flag, ebus_devstate_t *ebus_p, char *fmt, - uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5) -{ - char *s; - - if (acebus_debug_flags & flag) { - switch (flag) { - case D_ATTACH: - s = "attach"; break; - case D_DETACH: - s = "detach"; break; - case D_MAP: - s = "map"; break; - case D_CTLOPS: - s = "ctlops"; break; - case D_INTR: - s = "intr"; break; - } - if (ebus_p) - cmn_err(CE_CONT, "%s%d: %s: ", - ddi_get_name(ebus_p->dip), - ddi_get_instance(ebus_p->dip), s); - else - cmn_err(CE_CONT, "ebus: "); - cmn_err(CE_CONT, fmt, a1, a2, a3, a4, a5); - } -} -#endif - -#ifdef ACEBUS_HOTPLUG -#define EBUS_CHILD_PHYS_LOW_RANGE 0x10 -#define EBUS_CHILD_PHYS_HI_RANGE 0x14 - -static int -acebus_update_props(ebus_devstate_t *ebus_p) -{ - dev_info_t *dip = ebus_p->dip; - struct ebus_pci_rangespec er[2], *erp; - pci_regspec_t *pci_rp, *prp; - int length, rnums, imask[3], i, found = 0; - - /* - * If "ranges" property is found, then the device is initialized - * by OBP, hence simply return. - * Otherwise we create all the properties here. - */ - if (ddi_prop_lookup_int_array(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, - "ranges", (int **)&erp, (uint_t *)&length) == DDI_PROP_SUCCESS) { - ddi_prop_free(erp); - return (DDI_SUCCESS); - } - - /* - * interrupt-map is the only property that comes from a .conf file. - * Since it doesn't have the nodeid field set, it must be done here. - * Other properties can come from OBP or created here. - */ - if (acebus_set_imap(dip) != DDI_SUCCESS) { - return (DDI_FAILURE); - } - - /* - * Create the "ranges" property. - * Ebus has BAR0 and BAR1 allocated (both in memory space). - * Other BARs are 0. - * Hence there are 2 memory ranges it operates in. (one for each BAR). - * ie. there are 2 entries in its ranges property. - */ - if (ddi_prop_lookup_int_array(DDI_DEV_T_ANY, dip, - DDI_PROP_DONTPASS, "assigned-addresses", - (int **)&pci_rp, (uint_t *)&length) != DDI_PROP_SUCCESS) { - cmn_err(CE_WARN, "%s%d: Could not get assigned-addresses", - ddi_driver_name(dip), ddi_get_instance(dip)); - return (DDI_FAILURE); - } - /* - * Create the 1st mem range in which it operates corresponding - * to BAR0 - */ - er[0].ebus_phys_hi = EBUS_CHILD_PHYS_LOW_RANGE; - rnums = (length * sizeof (int))/sizeof (pci_regspec_t); - for (i = 0; i < rnums; i++) { - prp = pci_rp + i; - if (PCI_REG_REG_G(prp->pci_phys_hi) == er[0].ebus_phys_hi) { - found = 1; - break; - } - } - if (!found) { - cmn_err(CE_WARN, "No assigned space for memory range 0."); - ddi_prop_free(pci_rp); - return (DDI_FAILURE); - } - found = 0; - er[0].ebus_phys_low = 0; - er[0].pci_phys_hi = prp->pci_phys_hi; - er[0].pci_phys_mid = prp->pci_phys_mid; - er[0].pci_phys_low = prp->pci_phys_low; - er[0].rng_size = prp->pci_size_low; - - /* - * Create the 2nd mem range in which it operates corresponding - * to BAR1 - */ - er[1].ebus_phys_hi = EBUS_CHILD_PHYS_HI_RANGE; - for (i = 0; i < rnums; i++) { - prp = pci_rp + i; - if (PCI_REG_REG_G(prp->pci_phys_hi) == er[1].ebus_phys_hi) { - found = 1; - break; - } - } - if (!found) { - cmn_err(CE_WARN, "No assigned space for memory range 1."); - ddi_prop_free(pci_rp); - return (DDI_FAILURE); - } - er[1].ebus_phys_low = 0; - er[1].pci_phys_hi = prp->pci_phys_hi; - er[1].pci_phys_mid = prp->pci_phys_mid; - er[1].pci_phys_low = prp->pci_phys_low; - er[1].rng_size = prp->pci_size_low; - - ddi_prop_free(pci_rp); - length = sizeof (er) / sizeof (int); - if (ddi_prop_update_int_array(DDI_DEV_T_NONE, dip, - "ranges", (int *)er, length) != DDI_PROP_SUCCESS) { - cmn_err(CE_WARN, "%s%d: Could not create ranges property", - ddi_driver_name(dip), ddi_get_instance(dip)); - return (DDI_FAILURE); - } - /* The following properties are as defined by PCI 1275 bindings. */ - if (ddi_prop_update_int(DDI_DEV_T_NONE, dip, - "#address-cells", 2) != DDI_PROP_SUCCESS) - return (DDI_FAILURE); - if (ddi_prop_update_int(DDI_DEV_T_NONE, dip, - "#size-cells", 1) != DDI_PROP_SUCCESS) - return (DDI_FAILURE); - if (ddi_prop_update_int(DDI_DEV_T_NONE, dip, - "#interrupt-cells", 1) != DDI_PROP_SUCCESS) - return (DDI_FAILURE); - - imask[0] = 0x1f; - imask[1] = 0x00ffffff; - imask[2] = 0x00000003; - length = sizeof (imask) / sizeof (int); - if (ddi_prop_update_int_array(DDI_DEV_T_NONE, dip, - "interrupt-map-mask", (int *)imask, length) != DDI_PROP_SUCCESS) { - cmn_err(CE_WARN, "%s%d: Could not update imap mask property", - ddi_driver_name(dip), ddi_get_instance(dip)); - return (DDI_FAILURE); - } - - return (DDI_SUCCESS); -} - -/* - * This function takes in the ac-interrupt-map property from the .conf file, - * fills in the 'nodeid' information and then creates the 'interrupt-map' - * property. - */ -static int -acebus_set_imap(dev_info_t *dip) -{ - int *imapp, *timapp, length, num, i, default_ival = 0; - dev_info_t *tdip = dip; - int *port_id, imap_ok = 1; - int ilength; - int acebus_default_se_imap[5]; - - /* - * interrupt-map is specified via .conf file in hotplug mode, - * since the child configuration is static. - * It could even be hardcoded in the driver. - */ - if (ddi_prop_lookup_int_array(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, - "ac-interrupt-map", (int **)&imapp, (uint_t *)&ilength) != - DDI_PROP_SUCCESS) { - /* assume default implementation */ - acebus_default_se_imap[0] = 0x14; - acebus_default_se_imap[1] = 0x400000; - acebus_default_se_imap[2] = 1; - acebus_default_se_imap[3] = 0; - acebus_default_se_imap[4] = 2; - imapp = acebus_default_se_imap; - ilength = 5; - default_ival = 1; - } - num = ilength / 5; /* there are 5 integer cells in our property */ - timapp = imapp; - for (i = 0; i < num; i++) { - if (*(timapp+i*5+3) == 0) - imap_ok = 0; - } - if (imap_ok) { - if (!default_ival) - ddi_prop_free(imapp); - return (DDI_SUCCESS); - } - - while (ddi_prop_lookup_int_array(DDI_DEV_T_ANY, tdip, - DDI_PROP_DONTPASS, "upa-portid", (int **)&port_id, - (uint_t *)&length) != DDI_PROP_SUCCESS) { - tdip = ddi_get_parent(tdip); - if (tdip == NULL) { - cmn_err(CE_WARN, "%s%d: Could not get imap parent", - ddi_driver_name(dip), ddi_get_instance(dip)); - if (!default_ival) - ddi_prop_free(imapp); - return (DDI_FAILURE); - } - } - timapp = imapp; - for (i = 0; i < num; i++) { - *(timapp+i*5+3) = ddi_get_nodeid(tdip); - } - - if (ddi_prop_update_int_array(DDI_DEV_T_NONE, dip, - "interrupt-map", imapp, ilength) != DDI_PROP_SUCCESS) { - cmn_err(CE_WARN, "%s%d: Could not update AC imap property", - ddi_driver_name(dip), ddi_get_instance(dip)); - if (!default_ival) - ddi_prop_free(imapp); - return (DDI_FAILURE); - } - if (!default_ival) - ddi_prop_free(imapp); - return (DDI_SUCCESS); -} -#endif /* ACEBUS_HOTPLUG */ diff --git a/usr/src/uts/sun4u/montecarlo/io/hsc.c b/usr/src/uts/sun4u/montecarlo/io/hsc.c deleted file mode 100644 index 00f88aa636..0000000000 --- a/usr/src/uts/sun4u/montecarlo/io/hsc.c +++ /dev/null @@ -1,2170 +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 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * MonteCarlo HotSwap Controller functionality - */ - -#include <sys/types.h> -#include <sys/stropts.h> -#include <sys/stream.h> -#include <sys/strsun.h> -#include <sys/kmem.h> -#include <sys/cmn_err.h> -#include <sys/errno.h> -#include <sys/cpuvar.h> -#include <sys/open.h> -#include <sys/stat.h> -#include <sys/conf.h> -#include <sys/ddi.h> -#include <sys/sunddi.h> -#include <sys/modctl.h> -#include <sys/promif.h> -#include <sys/hotplug/hpcsvc.h> - -#include <sys/hscimpl.h> -#include <sys/hsc.h> - -#include <sys/mct_topology.h> -#include <sys/scsbioctl.h> -#include <sys/scsb.h> - -#define HOTSWAP_MODE_PROP "hotswap-mode" -#define ALARM_CARD_ON_SLOT 1 -#define SCSB_HSC_FORCE_REMOVE 1 /* force remove enum intr handler */ - -/* TUNABLE PARAMETERS. Some are Debug Only. Please take care when using. */ - -/* - * Set this flag to 1, to enable full hotswap mode at boot time. - * Since HPS is threaded, it is not recommended that we set this flag - * to 1 because enabling full hotswap interrupt can invoke the ENUM - * event handler accessing the slot data structure which may have not - * been initialized in the hotplug framework since the HPS may not yet - * have called the slot registration function with the bus nexus. - */ -static int scsb_hsc_enable_fhs = 0; - -/* - * Every time a slot is registered with the hotswap framework, the - * framework calls back. This variable keeps a count on how many - * callbacks are done. - */ -static int scsb_hsc_numReg = 0; -/* - * When this flag is set, the board is taken offline (put in reset) after - * a unconfigure operation, in Basic Hotswap mode. - */ -static int scsb_hsc_bhs_slot_reset = 1; -/* - * When this flag is set, we take the board to reset after unconfigure - * operation when operating in full hotswap mode. - */ -static int scsb_hsc_fhs_slot_reset = 1; -/* - * Implementation of this counter will work only on Montecarlo since - * the ENUM# Interrupt line is not shared with other interrupts. - * When the hardware routing changes, then there may be need to remove - * or change this functionality. - * This functionality is provided so that a bad or non friendly full hotswap - * board does not hang the system in full hotswap mode. Atleast the - * intent is that! Eventually Solaris kernel will provide similar support - * for recovering from a stuck interrupt line. Till then, lets do this. - */ -static int scsb_hsc_max_intr_count = 8; -/* - * Since the hardware does not support enabling/disabling ENUM#, the - * following flag can be used for imitating that behaviour. - * Currently we can set this flag and use the remove op to remove the - * interrupt handler from the system. Care must be taken when using this - * function since trying to remove the interrupt handler when the interrupts - * are pending may hang the system permanently. - * Since the hardware does not support this functionality, we adopt this - * approach for debugs. - */ -static int scsb_hsc_enum_switch = 0; - -/* - * When the board loses Healthy# at runtime (with the board being configured), - * cPCI specs states that a Reset has to be asserted immediately. - * We dont do this currently, until satellite processor support is given - * and the implications of such a act is fully understood. - * To adopt the cPCI specs recommendation, set this flag to 1. - */ -static int scsb_hsc_healthy_reset = 0; - -/* - * According to PCI 2.2 specification, once a board comes out of PCI_RST#, - * it may take upto 2^25 clock cycles to respond to config cycles. For - * montecarlo using a 33MHz cPCI bus, it's around 1.024 s. The variable - * will specify the time in ms to wait before attempting config access. - */ -static int scsb_connect_delay = 1025; - -/* - * slot map property for MC should be - * - * hsc-slot-map="/pci@1f,0/pci@1/pci@1","15","2", - * "/pci@1f,0/pci@1/pci@1","14","3", - * "/pci@1f,0/pci@1/pci@1","13","4", - * "/pci@1f,0/pci@1/pci@1","12","5" - * "/pci@1f,0/pci@1/pci@1","11","6" - * "/pci@1f,0/pci@1/pci@1","10","7" - * "/pci@1f,0/pci@1/pci@1","8","8"; - * - * slot map property for Tonga should be - * hsc-slot-map="/pci@1f,0/pci@1/pci@1","8","1" - * "/pci@1f,0/pci@1/pci@1", "15", "2" - * "/pci@1f,0/pci@1/pci@1", "14", "4" - * "/pci@1f,0/pci@1/pci@1", "13", "5" - * - * Please note that the CPU slot number is 3 for Tonga. - */ - -/* - * Services we require from the SCSB - */ -extern int scsb_get_slot_state(void *, int, int *); -extern int scsb_read_bhealthy(scsb_state_t *scsb); -extern int scsb_read_slot_health(scsb_state_t *scsb, int pslotnum); -extern int scsb_connect_slot(void *, int, int); -extern int scsb_disconnect_slot(void *, int, int); - -static void *hsc_state; - -static uint_t hsc_enum_intr(char *); -static hsc_slot_t *hsc_get_slot_info(hsc_state_t *, int); -static int scsb_enable_enum(hsc_state_t *); -static int scsb_disable_enum(hsc_state_t *, int); -static int atoi(const char *); -static int isdigit(int); -static hsc_slot_t *hsc_find_slot(int); -static void hsc_led_op(hsc_slot_t *, int, hpc_led_t, hpc_led_state_t); -static int hsc_led_state(hsc_slot_t *, int, hpc_led_info_t *); -static int scsb_hsc_disable_slot(hsc_slot_t *); -static int scsb_hsc_enable_slot(hsc_slot_t *); -#ifndef lint -static int hsc_clear_all_enum(hsc_state_t *); -#endif -static int hsc_slot_register(hsc_state_t *, char *, uint16_t, uint_t, - boolean_t); -static int hsc_slot_unregister(int); -static int scsb_hsc_init_slot_state(hsc_state_t *, hsc_slot_t *); -static int hsc_slot_autoconnect(hsc_slot_t *); - -static hpc_slot_ops_t *hsc_slotops; -static hsc_slot_t *hsc_slot_list; /* linked list of slots */ - -/* - * This mutex protects the following variables: - * hsc_slot_list - */ -static kmutex_t hsc_mutex; - - -/* ARGSUSED */ -static int -hsc_connect(caddr_t ops_arg, hpc_slot_t slot_hdl, void *data, uint_t flags) -{ - hsc_slot_t *hsp = (hsc_slot_t *)ops_arg; - int rc, rstate; - hsc_state_t *hsc; - - DEBUG2("hsc_connect: slot %d, healthy %d", hsp->hs_slot_number, - hsp->hs_board_healthy); - - if (!(hsp->hs_flags & (HSC_ENABLED|HSC_SLOT_ENABLED))) - return (HPC_ERR_FAILED); - /* if SCB hotswapped, do not allow connect operations */ - if (hsp->hs_flags & HSC_SCB_HOTSWAPPED) - return (HPC_ERR_FAILED); - /* - * if previous occupant stayed configured, do not allow another - * occupant to be connected. - * This behaviour is an indication that the slot state - * is not clean. - */ - if (hsp->hs_flags & HSC_SLOT_BAD_STATE) { - /* - * In the current implementation, we turn both fault - * and active LEDs to ON state in this situation. - */ - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, HPC_ACTIVE_LED, - HPC_LED_ON); - return (HPC_ERR_FAILED); - } - /* - * Get the actual status from the i2c bus - */ - rc = scsb_get_slot_state(hsp->hs_hpchandle, hsp->hs_slot_number, - &rstate); - if (rc != DDI_SUCCESS) - return (HPC_ERR_FAILED); - - hsp->hs_slot_state = rstate; - if (hsp->hs_slot_state == HPC_SLOT_EMPTY) { -#ifdef DEBUG - cmn_err(CE_CONT, - "?hsc_connect: slot %d is empty\n", - hsp->hs_slot_number); -#endif - return (HPC_ERR_FAILED); - } - - if (hsp->hs_slot_state == HPC_SLOT_CONNECTED) - return (HPC_SUCCESS); - - rc = HPC_SUCCESS; - /* - * call scsb to connect the slot. This also makes sure board is healthy - */ - if (scsb_connect_slot(hsp->hs_hpchandle, hsp->hs_slot_number, - hsp->hs_board_healthy) != DDI_SUCCESS) { - DEBUG1("hsc_connect: slot %d connection failed", - hsp->hs_slot_number); - rc = HPC_ERR_FAILED; - } else { - if (hsp->hs_slot_state != HPC_SLOT_CONNECTED) { - if (hsp->hs_board_healthy == B_FALSE) { - cmn_err(CE_NOTE, "HEALTHY# not asserted on " - " slot %d", hsp->hs_slot_number); - return (HPC_ERR_FAILED); - } - hsc = hsp->hsc; - hsc->hsp_last = hsp; - if (scsb_reset_slot(hsp->hs_hpchandle, - hsp->hs_slot_number, SCSB_UNRESET_SLOT) != 0) { - - return (HPC_ERR_FAILED); - } - /* - * Unresetting a board may have caused an interrupt - * burst in case of non friendly boards. So it is - * important to make sure that the ISR has not - * put this board back to disconnect state. - */ - delay(1); - if (hsp->hs_flags & HSC_ENUM_FAILED) { - hsp->hs_flags &= ~HSC_ENUM_FAILED; - return (HPC_ERR_FAILED); - } - DEBUG1("hsc_connect: slot %d connected", - hsp->hs_slot_number); - rc = HPC_SUCCESS; - hsp->hs_slot_state = HPC_SLOT_CONNECTED; - (void) hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, - HPC_FAULT_LED, HPC_LED_OFF); - } - } - - /* - * PCI 2.2 specs recommend that the probe software wait - * for upto 2^25 PCI clock cycles after deassertion of - * PCI_RST# before the board is able to respond to config - * cycles. So, before we return, we wait for ~1 sec. - */ - delay(drv_usectohz(scsb_connect_delay * 1000)); - return (rc); -} - - -/* ARGSUSED */ -static int -hsc_disconnect(caddr_t ops_arg, hpc_slot_t slot_hdl, void *data, uint_t flags) -{ - hsc_slot_t *hsp = (hsc_slot_t *)ops_arg; - hsc_state_t *hsc; -#ifdef DEBUG - static const char func[] = "hsc_disconnect"; -#endif - - DEBUG1("hsc_disconnect: slot %d", hsp->hs_slot_number); - - if (hsp->hs_board_configured) { -#ifdef DEBUG - cmn_err(CE_NOTE, - "%s: cannot disconnect configured board in slot %d", - func, hsp->hs_slot_number); -#endif - return (HPC_ERR_FAILED); - } - - if (hsp->hs_slot_state == HPC_SLOT_EMPTY) { -#ifdef DEBUG - cmn_err(CE_NOTE, "%s: slot %d is empty", - func, hsp->hs_slot_number); -#endif - return (HPC_SUCCESS); - } - - if (hsp->hs_slot_state == HPC_SLOT_DISCONNECTED) { - /* - * if already disconnected, just return success - * Duplicate disconnect messages should not be failed! - */ - return (HPC_SUCCESS); - } - /* if SCB hotswapped, do not allow disconnect operations */ - if (hsp->hs_flags & HSC_SCB_HOTSWAPPED) - return (HPC_ERR_FAILED); - - /* call scsb to disconnect the slot */ - if (scsb_disconnect_slot(hsp->hs_hpchandle, B_TRUE, hsp->hs_slot_number) - != DDI_SUCCESS) - return (HPC_ERR_FAILED); - hsc = hsp->hsc; - if (hsc->hsp_last == hsp) - hsc->hsp_last = NULL; - - return (HPC_SUCCESS); -} - - -/* - * In the cPCI world, this operation is not applicable. - * However, we use this function to enable full hotswap mode in debug mode. - */ -/* ARGSUSED */ -static int -hsc_insert(caddr_t ops_arg, hpc_slot_t slot_hdl, void *data, uint_t flags) -{ - hsc_slot_t *hsp = (hsc_slot_t *)ops_arg; - - if (scsb_hsc_enum_switch && - (scsb_enable_enum(hsp->hsc) == DDI_SUCCESS)) { - return (HPC_SUCCESS); - } - return (HPC_ERR_NOTSUPPORTED); -} - - -/* - * In the cPCI world, this operation is not applicable. - * However, we use this function to disable full hotswap mode in debug mode. - */ -/* ARGSUSED */ -static int -hsc_remove(caddr_t ops_arg, hpc_slot_t slot_hdl, void *data, uint_t flags) -{ - hsc_slot_t *hsp = (hsc_slot_t *)ops_arg; - - if (scsb_hsc_enum_switch && - (scsb_disable_enum(hsp->hsc, SCSB_HSC_FORCE_REMOVE) - == DDI_SUCCESS)) { - hsp->hs_flags &= ~HSC_ENUM_FAILED; - return (HPC_SUCCESS); - } - return (HPC_ERR_NOTSUPPORTED); -} - -static void -hsc_led_op(hsc_slot_t *hsp, int cmd, hpc_led_t led, hpc_led_state_t led_state) -{ - hpc_led_info_t ledinfo; - - ledinfo.led = led; - ledinfo.state = led_state; - (void) hsc_led_state(hsp, cmd, &ledinfo); -} - -static int -hsc_led_state(hsc_slot_t *hsp, int cmd, hpc_led_info_t *hlip) -{ - hpc_led_state_t *hlsp; - scsb_uinfo_t sunit; - int res; - - DEBUG3("hsc_led_state: slot %d, led %x, state %x", - hsp->hs_slot_number, hlip->led, hlip->state); - - sunit.unit_type = SLOT; - sunit.unit_number = hsp->hs_slot_number; - /* - * We ignore operations on LEDs that we don't support - */ - switch (hlip->led) { - case HPC_FAULT_LED: - sunit.led_type = NOK; - hlsp = &hsp->hs_fault_led_state; - break; - case HPC_ACTIVE_LED: - sunit.led_type = OK; - hlsp = &hsp->hs_active_led_state; - break; - default: - return (HPC_ERR_NOTSUPPORTED); - } - - switch (hlip->state) { - case HPC_LED_BLINK: - sunit.unit_state = BLINK; - if (hlip->led != HPC_ACTIVE_LED) - return (HPC_ERR_NOTSUPPORTED); - break; - case HPC_LED_ON: - sunit.unit_state = ON; - break; - case HPC_LED_OFF: - sunit.unit_state = OFF; - break; - default: - break; - } - - switch (cmd) { - case HPC_CTRL_SET_LED_STATE: - res = scsb_led_set(hsp->hs_hpchandle, &sunit, sunit.led_type); - if (res != 0) - return (HPC_ERR_FAILED); - *hlsp = (hpc_led_state_t)sunit.unit_state; - break; - - case HPC_CTRL_GET_LED_STATE: - res = scsb_led_get(hsp->hs_hpchandle, &sunit, sunit.led_type); - if (res) - return (HPC_ERR_FAILED); - /* hlip->state = sunit.unit_state; */ - break; - - default: - return (HPC_ERR_INVALID); - } - - return (HPC_SUCCESS); - -} - - -static int -hsc_get_slot_state(hsc_slot_t *hsp, hpc_slot_state_t *hssp) -{ - int rstate = 0; - int rc; -#ifdef DEBUG - int orstate; /* original rstate */ -#endif - - DEBUG1("hsc_get_slot_state: slot %d", hsp->hs_slot_number); - rc = scsb_get_slot_state(hsp->hs_hpchandle, hsp->hs_slot_number, - &rstate); - if (rc != DDI_SUCCESS) - return (HPC_ERR_FAILED); -#ifdef DEBUG - orstate = hsp->hs_slot_state; -#endif - hsp->hs_slot_state = rstate; - switch (hsp->hs_slot_state) { - case HPC_SLOT_EMPTY: - DEBUG0("empty"); - break; - case HPC_SLOT_CONNECTED: - DEBUG0("connected"); - break; - case HPC_SLOT_DISCONNECTED: - DEBUG0("disconnected"); - break; - } - - *hssp = hsp->hs_slot_state; - - /* doing get-state above may have caused a freeze operation */ - if ((hsp->hs_flags & HSC_SCB_HOTSWAPPED) && - (rstate == HPC_SLOT_DISCONNECTED)) { - /* freeze puts disconnected boards to connected state */ - *hssp = HPC_SLOT_CONNECTED; -#if 0 - /* in FHS, deassertion of reset may have configured the board */ - if (hsp->hs_board_configured == B_TRUE) { - hsp->hs_slot_state = *hssp; - } -#endif - } -#ifdef DEBUG - /* a SCB hotswap may have forced a state change on the receptacle */ - if (orstate != *hssp) { - cmn_err(CE_NOTE, "hsc_get_state: slot%d state change due" - " to SCB hotswap!", hsp->hs_slot_number); - } -#endif - return (HPC_SUCCESS); -} - - -static int -hsc_set_config_state(hsc_slot_t *hsp, int cmd) -{ - hsc_state_t *hsc = hsp->hsc; - - DEBUG1("hsc_set_config_state: slot %d", hsp->hs_slot_number); - - switch (cmd) { - case HPC_CTRL_DEV_CONFIGURED: - /* - * Closing of the Ejector switch in configured/busy state can - * cause duplicate CONFIGURED messages to come down. - * Make sure our LED states are fine. - */ - if (hsp->hs_board_configured == B_TRUE) { - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, HPC_ACTIVE_LED, - HPC_LED_ON); - break; - } - hsp->hs_board_configured = B_TRUE; - hsp->hs_board_configuring = B_FALSE; - if ((hsc->state & HSC_ATTACHED) == HSC_ATTACHED && - hsp->hs_flags & HSC_ALARM_CARD_PRES) - (void) scsb_hsc_ac_op(hsp->hs_hpchandle, - hsp->hs_slot_number, SCSB_HSC_AC_CONFIGURED); - /* LED must be OFF on the occupant. */ - (void) hpc_slot_event_notify(hsp->hs_slot_handle, - HPC_EVENT_SLOT_BLUE_LED_OFF, 0); - if (hsp->hs_flags & HSC_AUTOCFG) - (void) hpc_slot_event_notify(hsp->hs_slot_handle, - HPC_EVENT_ENABLE_ENUM, 0); - else - (void) hpc_slot_event_notify(hsp->hs_slot_handle, - HPC_EVENT_DISABLE_ENUM, 0); - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, HPC_ACTIVE_LED, - HPC_LED_ON); - if (hsc->hsp_last == hsp) - hsc->hsp_last = NULL; - break; - case HPC_CTRL_DEV_UNCONFIGURED: - hsp->hs_board_configured = B_FALSE; - hsp->hs_board_unconfiguring = B_FALSE; - hsp->hs_flags &= ~HSC_SLOT_BAD_STATE; - if (hsp->hs_flags & HSC_ALARM_CARD_PRES) - (void) scsb_hsc_ac_op(hsp->hs_hpchandle, - hsp->hs_slot_number, SCSB_HSC_AC_UNCONFIGURED); - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, HPC_ACTIVE_LED, - HPC_LED_BLINK); - if (((hsc->state & HSC_ENUM_ENABLED) && - scsb_hsc_fhs_slot_reset) || - (((hsc->state & HSC_ENUM_ENABLED) != HSC_ENUM_ENABLED) && - scsb_hsc_bhs_slot_reset) || - ((hsp->hs_flags & HSC_AUTOCFG) != - HSC_AUTOCFG)) { - if (scsb_reset_slot(hsp->hs_hpchandle, - hsp->hs_slot_number, SCSB_RESET_SLOT) == 0) { - - hsp->hs_slot_state = HPC_SLOT_DISCONNECTED; - hsp->hs_board_healthy = B_FALSE; - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, - HPC_FAULT_LED, HPC_LED_ON); - } - } - break; - case HPC_CTRL_DEV_CONFIG_FAILURE: - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, HPC_ACTIVE_LED, - HPC_LED_BLINK); - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, - HPC_FAULT_LED, HPC_LED_ON); - break; - case HPC_CTRL_DEV_UNCONFIG_FAILURE: - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, HPC_ACTIVE_LED, - HPC_LED_ON); - break; - case HPC_CTRL_DEV_CONFIG_START: - case HPC_CTRL_DEV_UNCONFIG_START: - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, HPC_FAULT_LED, - HPC_LED_OFF); - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, HPC_ACTIVE_LED, - HPC_LED_BLINK); - break; - default: - return (HPC_ERR_INVALID); - } - - if (cmd != HPC_CTRL_DEV_CONFIG_START && - cmd != HPC_CTRL_DEV_UNCONFIG_START && - hsc->regDone == B_FALSE && - scsb_hsc_numReg < hsc->n_registered_occupants) { - scsb_hsc_numReg++; - - /* - * If the callback is invoked for all registered slots, - * enable ENUM. - */ - if (((hsc->state & HSC_ATTACHED) == HSC_ATTACHED) && - (scsb_hsc_numReg == hsc->n_registered_occupants)) { - hsc->regDone = B_TRUE; - if (hsc->hotswap_mode == HSC_HOTSWAP_MODE_FULL) { -#ifdef DEBUG - cmn_err(CE_CONT, "%s%d: Enabling full hotswap" - ":%d non-empty slots\n", - ddi_driver_name(hsc->dip), - ddi_get_instance(hsc->dip), - hsc->n_registered_occupants); -#endif - if (scsb_enable_enum(hsc) != DDI_SUCCESS) { - cmn_err(CE_WARN, "%s#%d: Cannot enable " - "Full Hotswap", - ddi_driver_name(hsc->dip), - ddi_get_instance(hsc->dip)); - - return (HPC_ERR_FAILED); - } - } - } - } - - return (HPC_SUCCESS); -} - - -/*ARGSUSED*/ -static int -hsc_get_board_type(hsc_slot_t *hsp, hpc_board_type_t *hbtp) -{ - *hbtp = hsp->hs_board_type; - return (HPC_SUCCESS); -} - - -/* ARGSUSED */ -static int -hsc_autoconfig(hsc_slot_t *hsp, int cmd) -{ - int res = HPC_SUCCESS, enum_disable = B_TRUE, i; - char slotautocfg_prop[18]; - hsc_state_t *hsc; - - DEBUG1("hsc_autoconfig: slot %d", hsp->hs_slot_number); - (void) sprintf(slotautocfg_prop, "slot%d-autoconfig", - hsp->hs_slot_number); - - if (cmd == HPC_CTRL_ENABLE_AUTOCFG) { - hsp->hs_flags |= HSC_AUTOCFG; - (void) ddi_prop_update_string(DDI_DEV_T_NONE, hsp->hsc->dip, - slotautocfg_prop, "enabled"); - if ((res = scsb_enable_enum(hsp->hsc)) == DDI_SUCCESS) { - (void) hpc_slot_event_notify(hsp->hs_slot_handle, - HPC_EVENT_ENABLE_ENUM, 0); - } - } else { - (void) ddi_prop_update_string(DDI_DEV_T_NONE, hsp->hsc->dip, - slotautocfg_prop, "disabled"); - hsp->hs_flags &= ~HSC_AUTOCFG; - hsc = hsp->hsc; - if (hsc->state & HSC_ATTACHED) { - (void) hpc_slot_event_notify(hsp->hs_slot_handle, - HPC_EVENT_DISABLE_ENUM, 0); - for (i = 0; i < hsc->slot_table_size; i++) { - hsc_slot_t *thsp; - int slotnum; - - slotnum = hsc->slot_table_prop[i].pslotnum; - thsp = hsc_find_slot(slotnum); - if (thsp == NULL) { - cmn_err(CE_WARN, "%s#%d: hsc_autocfg:" - "No Slot Info for slot %d", - ddi_driver_name(hsc->dip), - ddi_get_instance(hsc->dip), - slotnum); - continue; - } - if (thsp->hs_flags & HSC_AUTOCFG) { - enum_disable = B_FALSE; - break; - } - } - if (enum_disable == B_TRUE) - (void) scsb_disable_enum(hsc, - SCSB_HSC_FORCE_REMOVE); - } - } - return (res); -} - - -/* - * This function is invoked to enable/disable a slot - */ -/* ARGSUSED */ -#ifndef lint -static int -hsc_slot_enable(hsc_slot_t *hsp, boolean_t enabled) -{ - scsb_uinfo_t sunit; - int res; - - DEBUG1("hsc_slot_enable: slot %d", hsp->hs_slot_number); - - sunit.unit_type = SLOT; - sunit.unit_number = hsp->hs_slot_number; - if (enabled) - sunit.unit_state = ON; - else - sunit.unit_state = OFF; - - res = scsb_reset_unit(hsp->hs_hpchandle, &sunit); - if (res == 0) - return (HPC_SUCCESS); - else if (res == EINVAL) - return (HPC_ERR_INVALID); - else - return (HPC_ERR_FAILED); -} -#endif - - -/*ARGSUSED*/ -static int -hsc_control(caddr_t ops_arg, hpc_slot_t slot_hdl, int request, caddr_t arg) -{ - hsc_slot_t *hsp = (hsc_slot_t *)ops_arg; - int rc = HPC_SUCCESS; - - DEBUG2("hsc_control: slot %d, op=%x\n", hsp->hs_slot_number, request); - - switch (request) { - case HPC_CTRL_GET_LED_STATE: - return (hsc_led_state(hsp, - HPC_CTRL_GET_LED_STATE, (hpc_led_info_t *)arg)); - - case HPC_CTRL_SET_LED_STATE: - return (hsc_led_state(hsp, - HPC_CTRL_SET_LED_STATE, (hpc_led_info_t *)arg)); - - case HPC_CTRL_GET_SLOT_STATE: - return (hsc_get_slot_state(hsp, (hpc_slot_state_t *)arg)); - - case HPC_CTRL_DEV_CONFIGURED: - return (hsc_set_config_state(hsp, HPC_CTRL_DEV_CONFIGURED)); - - case HPC_CTRL_DEV_UNCONFIGURED: - return (hsc_set_config_state(hsp, HPC_CTRL_DEV_UNCONFIGURED)); - - case HPC_CTRL_DEV_CONFIG_FAILURE: - return (hsc_set_config_state(hsp, HPC_CTRL_DEV_CONFIG_FAILURE)); - - case HPC_CTRL_DEV_UNCONFIG_FAILURE: - return (hsc_set_config_state(hsp, - HPC_CTRL_DEV_UNCONFIG_FAILURE)); - - case HPC_CTRL_DEV_CONFIG_START: - case HPC_CTRL_DEV_UNCONFIG_START: - return (hsc_set_config_state(hsp, request)); - - case HPC_CTRL_GET_BOARD_TYPE: - return (hsc_get_board_type(hsp, (hpc_board_type_t *)arg)); - - case HPC_CTRL_DISABLE_AUTOCFG: - return (hsc_autoconfig(hsp, HPC_CTRL_DISABLE_AUTOCFG)); - - case HPC_CTRL_ENABLE_AUTOCFG: - return (hsc_autoconfig(hsp, HPC_CTRL_ENABLE_AUTOCFG)); - - case HPC_CTRL_DISABLE_SLOT: - /* - * No hardware support for disabling the slot. - * Just imitate a disable_autoconfig operation for now - */ - if (hsp->hs_board_configured == B_TRUE) - return (HPC_ERR_FAILED); - if (scsb_hsc_disable_slot(hsp) != DDI_SUCCESS) - rc = HPC_ERR_FAILED; - return (rc); - - case HPC_CTRL_ENABLE_SLOT: - if (scsb_hsc_enable_slot(hsp) != DDI_SUCCESS) - rc = HPC_ERR_FAILED; - return (rc); - - case HPC_CTRL_ENABLE_ENUM: - return (scsb_enable_enum(hsp->hsc)); - - case HPC_CTRL_DISABLE_ENUM: - return (scsb_disable_enum(hsp->hsc, 0)); - - default: - return (HPC_ERR_INVALID); - } -} - -static int -scsb_hsc_disable_slot(hsc_slot_t *hsp) -{ - int rc; - char slot_disable_prop[18]; - - DEBUG1("hsc_disable_slot: slot %d", hsp->hs_slot_number); - (void) sprintf(slot_disable_prop, "slot%d-status", hsp->hs_slot_number); - - rc = scsb_reset_slot(hsp->hs_hpchandle, hsp->hs_slot_number, - SCSB_RESET_SLOT); - if (rc == DDI_SUCCESS) { - (void) hsc_autoconfig(hsp, HPC_CTRL_DISABLE_AUTOCFG); - hsp->hs_flags &= ~HSC_SLOT_ENABLED; - (void) ddi_prop_update_string(DDI_DEV_T_NONE, hsp->hsc->dip, - slot_disable_prop, "disabled"); - } else - rc = DDI_FAILURE; - return (rc); -} - -static int -scsb_hsc_enable_slot(hsc_slot_t *hsp) -{ - int rc; - char slot_disable_prop[18]; - - DEBUG1("hsc_disable_slot: slot %d", hsp->hs_slot_number); - (void) sprintf(slot_disable_prop, "slot%d-status", hsp->hs_slot_number); - - rc = scsb_reset_slot(hsp->hs_hpchandle, hsp->hs_slot_number, - SCSB_UNRESET_SLOT); - if (rc == DDI_SUCCESS) { - (void) hsc_autoconfig(hsp, HPC_CTRL_ENABLE_AUTOCFG); - hsp->hs_flags |= HSC_SLOT_ENABLED; - (void) ddi_prop_remove(DDI_DEV_T_NONE, hsp->hsc->dip, - slot_disable_prop); - } else - rc = HPC_ERR_FAILED; - return (rc); -} - -#define NEW(type) (type *) kmem_zalloc(sizeof (type), KM_SLEEP) - -static hsc_slot_t * -hsc_alloc_slot( - uint16_t device_number, - int slot_number, - boolean_t board_in_slot) -{ - hpc_slot_info_t *hsip; - hsc_slot_t *hsp = NEW(hsc_slot_t); - - DEBUG2("hsc_alloc_slot: slot %d %s", slot_number, - board_in_slot ? "occupied" : "empty"); - - if (hsp == NULL) { - cmn_err(CE_NOTE, - "hsc_alloc_slot: allocation failed for slot %d", - slot_number); - return (NULL); - } - - hsip = &hsp->hs_info; - - hsip->version = HPC_SLOT_INFO_VERSION; - hsip->slot_type = HPC_SLOT_TYPE_CPCI; - hsip->pci_dev_num = device_number; - hsip->pci_slot_capabilities = 0; - hsip->slot_flags = HPC_SLOT_CREATE_DEVLINK; - /* - * Note: the name *must* be 'pci' so that the correct cfgadm plug-in - * library is selected - */ - (void) sprintf(hsip->pci_slot_name, "cpci_slot%d", slot_number); - - /* - * We assume that the following LED settings reflect - * the hardware state. - * After we register the slot, we will be invoked by the nexus - * if the slot is occupied, and we will turn on the LED then. - */ - hsp->hs_active_led_state = HPC_LED_OFF; - hsp->hs_fault_led_state = HPC_LED_OFF; - - hsp->hs_board_configured = B_FALSE; - hsp->hs_board_healthy = B_FALSE; - hsp->hs_board_type = HPC_BOARD_UNKNOWN; - - hsp->hs_flags = HSC_ENABLED | HSC_SLOT_ENABLED; - hsp->hs_slot_number = slot_number; - - /* - * we should just set this to connected, - * as MC slots are always connected. - */ - if (board_in_slot) - hsp->hs_slot_state = HPC_SLOT_CONNECTED; - else - hsp->hs_slot_state = HPC_SLOT_EMPTY; - - return (hsp); -} - - -static void -hsc_free_slot(hsc_slot_t *hsp) -{ - DEBUG0("hsc_free_slot"); - - kmem_free(hsp, sizeof (*hsp)); -} - - -/* - * This function is invoked to register a slot - */ -static int -hsc_slot_register( - hsc_state_t *hsc, - char *bus_path, /* PCI nexus pathname */ - uint16_t device_number, /* PCI device number */ - uint_t slot_number, /* physical slot number */ - boolean_t board_in_slot) /* receptacle status */ -{ - int rc = HPC_SUCCESS; - hsc_slot_t *hsp; - - DEBUG2("hsc_slot_register: slot number %d, device number %d", - slot_number, device_number); - - hsp = hsc_alloc_slot(device_number, slot_number, - board_in_slot); - - if (hsp == NULL) { -#ifdef DEBUG - cmn_err(CE_NOTE, "hsc_slot_register: hsc_alloc_slot failed"); -#endif - return (HPC_ERR_FAILED); - } - - hsp->hs_hpchandle = hsc->scsb_handle; /* handle for call backs */ - hsp->hsc = hsc; - - rc = scsb_hsc_init_slot_state(hsc, hsp); - if (rc != DDI_SUCCESS) - return (HPC_ERR_FAILED); - - /* slot autoconfiguration by default. */ - if (hsc->hotswap_mode == HSC_HOTSWAP_MODE_FULL) - (void) hsc_autoconfig(hsp, HPC_CTRL_ENABLE_AUTOCFG); - else - (void) hsc_autoconfig(hsp, HPC_CTRL_DISABLE_AUTOCFG); - - /* - * Append to our list - */ - mutex_enter(&hsc_mutex); - hsp->hs_next = hsc_slot_list; - hsc_slot_list = hsp; - mutex_exit(&hsc_mutex); - - rc = hpc_slot_register(hsc->dip, - bus_path, - &hsp->hs_info, - &hsp->hs_slot_handle, /* return value */ - hsc_slotops, - (caddr_t)hsp, - 0); - - if (rc != HPC_SUCCESS) { - cmn_err(CE_WARN, "%s#%d: failed to register slot %s:%d", - ddi_driver_name(hsc->dip), ddi_get_instance(hsc->dip), - bus_path, device_number); - hsc_free_slot(hsp); - return (rc); - } - - DEBUG0("hsc_slot_register: hpc_slot_register successful"); - - return (rc); -} - - -static int -hsc_slot_unregister(int slot_number) -{ - hsc_slot_t *hsp, *prev; - - DEBUG1("hsc_slot_unregister: slot number %d", slot_number); - - mutex_enter(&hsc_mutex); - hsp = prev = NULL; - for (hsp = hsc_slot_list; hsp != NULL; hsp = hsp->hs_next) { - if (hsp->hs_slot_number == slot_number) { - if (prev == NULL) /* first entry */ - hsc_slot_list = hsc_slot_list->hs_next; - else - prev->hs_next = hsp->hs_next; - hsp->hs_next = NULL; - break; - } - prev = hsp; - } - mutex_exit(&hsc_mutex); - - if (hsp != NULL) { - (void) hpc_slot_unregister(&hsp->hs_slot_handle); - if ((hsp->hsc->state & HSC_ATTACHED) != HSC_ATTACHED && - hsp->hs_slot_state != HPC_SLOT_EMPTY) { - hsp->hsc->n_registered_occupants--; - } - hsc_free_slot(hsp); - return (0); - } - return (1); -} - -static int -scsb_hsc_init_slot_state(hsc_state_t *hsc, hsc_slot_t *hsp) -{ - int rc, rstate; - int slot_number = hsp->hs_slot_number; - scsb_state_t *scsb = (scsb_state_t *)hsc->scsb_handle; - - rc = scsb_get_slot_state(hsc->scsb_handle, slot_number, &rstate); - if (rc != DDI_SUCCESS) - return (DDI_FAILURE); - - /* - * Set the healthy status for this slot - */ - hsp->hs_board_healthy = scsb_read_slot_health(scsb, slot_number); - hsp->hs_slot_state = rstate; - switch (rstate) { - case HPC_SLOT_EMPTY: - /* - * this will clear any state differences between - * SCB Freeze operations. - */ - hsp->hs_slot_state = HPC_SLOT_EMPTY; - /* slot empty. */ - (void) scsb_reset_slot(hsc->scsb_handle, slot_number, - SCSB_RESET_SLOT); - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, HPC_ACTIVE_LED, - HPC_LED_OFF); - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, HPC_FAULT_LED, - HPC_LED_OFF); - break; - case HPC_SLOT_DISCONNECTED: - /* - * this will clear any state differences between - * SCB Freeze operations. - */ - hsp->hs_slot_state = HPC_SLOT_DISCONNECTED; - /* check recovery from SCB freeze */ - if (hsp->hs_board_configured != B_TRUE) { - /* - * Force a disconnect just in case there are - * differences between healthy and reset states. - */ - (void) scsb_reset_slot(hsc->scsb_handle, - slot_number, SCSB_RESET_SLOT); - /* - * Slot in reset. OBP has not probed this - * device. Hence it is ok to remove this board. - */ - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, - HPC_ACTIVE_LED, HPC_LED_BLINK); - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, - HPC_FAULT_LED, HPC_LED_ON); - break; - } - /*FALLTHROUGH*/ - case HPC_SLOT_CONNECTED: - /* - * this will clear any state differences between - * SCB Freeze operations. - */ - hsp->hs_slot_state = HPC_SLOT_CONNECTED; - /* - * OBP should have probed this device, unless - * it was plugged in during the boot operation - * before the driver was loaded. In any case, - * no assumption is made and hence we take - * the conservative approach by keeping fault - * led off so board removal is not allowed. - */ - if (hsp->hs_board_configured == B_TRUE) - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, - HPC_ACTIVE_LED, HPC_LED_ON); - else - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, - HPC_ACTIVE_LED, HPC_LED_BLINK); - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, HPC_FAULT_LED, - HPC_LED_OFF); - /* - * Netra ct alarm card hotswap support - */ - if (slot_number == scsb->ac_slotnum && - scsb->scsb_hsc_state & SCSB_ALARM_CARD_PRES) { - hsp->hs_flags |= HSC_ALARM_CARD_PRES; - DEBUG0("Xscsb_hsc_init_slot_state: " - "set HSC_ALARM_CARD_PRES"); - } - break; - default: - break; - } - return (rc); -} - -static hsc_slot_t * -hsc_get_slot_info(hsc_state_t *hsc, int pci_devno) -{ - int i; - - for (i = 0; i < hsc->slot_table_size; i++) { - - if (hsc->slot_table_prop[i].pci_devno == pci_devno) - return ((hsc_slot_t *)hsc_find_slot( - hsc->slot_table_prop[i].pslotnum)); - } - return (NULL); -} - -static hsc_slot_t * -hsc_find_slot(int slot_number) -{ - hsc_slot_t *hsp; - - mutex_enter(&hsc_mutex); - for (hsp = hsc_slot_list; hsp != NULL; hsp = hsp->hs_next) { - if (hsp->hs_slot_number == slot_number) - break; - } - mutex_exit(&hsc_mutex); - return (hsp); -} - - -/* - * This function is invoked by the SCSB when an interrupt - * happens to indicate that a board has been inserted-in/removed-from - * the specified slot. - */ -int -hsc_slot_occupancy(int slot_number, boolean_t occupied, int flags, int healthy) -{ - static const char func[] = "hsc_slot_occupancy"; - hsc_slot_t *hsp; - int rc = DDI_SUCCESS; - - DEBUG4("hsc_slot_occupancy: slot %d %s, ac=%d, healthy=%d", - slot_number, occupied ? "occupied" : "not occupied", - (flags == ALARM_CARD_ON_SLOT) ? 1:0, healthy); - - hsp = hsc_find_slot(slot_number); - - if (hsp == NULL) { - cmn_err(CE_NOTE, - "%s: cannot map slot number %d to a hsc_slot_t", - func, slot_number); - return (DDI_FAILURE); - } - - hsp->hs_board_healthy = healthy; - if (occupied) { - /* - * A board was just inserted. We are disconnected at this point. - */ - if (hsp->hs_slot_state == HPC_SLOT_EMPTY) - hsp->hs_board_type = HPC_BOARD_CPCI_HS; - hsp->hs_slot_state = HPC_SLOT_DISCONNECTED; - if (flags == ALARM_CARD_ON_SLOT) { - hsp->hs_flags |= HSC_ALARM_CARD_PRES; - DEBUG0("Xhsc_slot_occupancy: set HSC_ALARM_CARD_PRES"); - } - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, HPC_FAULT_LED, - HPC_LED_ON); - /* - * if previous occupant stayed configured, do not allow another - * occupant to be connected. - * So as soon as the board is plugged in, we turn both LEDs On. - * This behaviour is an indication that the slot state - * is not clean. - */ - if (hsp->hs_flags & HSC_SLOT_BAD_STATE) { - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, HPC_ACTIVE_LED, - HPC_LED_ON); - return (DDI_SUCCESS); - } - - /* Do not allow connect if slot is disabled */ - if ((hsp->hs_flags & HSC_SLOT_ENABLED) != HSC_SLOT_ENABLED) - return (DDI_SUCCESS); - /* if no healthy, we stay disconnected. */ - if (healthy == B_FALSE) { - return (DDI_SUCCESS); - } - rc = hsc_slot_autoconnect(hsp); - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, HPC_ACTIVE_LED, - HPC_LED_BLINK); - } else { - /* - * A board was just removed - */ - hsp->hs_slot_state = HPC_SLOT_EMPTY; - hsp->hs_board_type = HPC_BOARD_UNKNOWN; - hsp->hs_flags &= ~HSC_ENUM_FAILED; - if (hsp->hs_flags & HSC_ALARM_CARD_PRES) { - hsp->hs_flags &= ~HSC_ALARM_CARD_PRES; - DEBUG0("Xhsc_slot_occupancy:clear HSC_ALARM_CARD_PRES"); - } - if (hsp->hs_board_configured == B_TRUE) { - (void) hpc_slot_event_notify(hsp->hs_slot_handle, - HPC_EVENT_SLOT_NOT_HEALTHY, 0); - cmn_err(CE_WARN, "%s#%d: ALERT! Surprise Removal " - " on Slot %d, Occupant Online!!", - ddi_driver_name(hsp->hsc->dip), - ddi_get_instance(hsp->hsc->dip), - slot_number); - cmn_err(CE_WARN, "%s#%d: ALERT! System now in " - " Inconsistent State! Slot disabled. Halt!", - ddi_driver_name(hsp->hsc->dip), - ddi_get_instance(hsp->hsc->dip)); - /* Slot in reset and disabled */ - (void) scsb_hsc_disable_slot(hsp); - hsp->hs_flags |= HSC_SLOT_BAD_STATE; - /* the following works for P1.0 only. */ - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, HPC_FAULT_LED, - HPC_LED_ON); - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, HPC_ACTIVE_LED, - HPC_LED_ON); - } else { - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, HPC_FAULT_LED, - HPC_LED_OFF); - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, HPC_ACTIVE_LED, - HPC_LED_OFF); - } - } - return (rc); -} - - -/* - * This function is invoked by the SCSB when the health status of - * a board changes. - */ -/*ARGSUSED*/ -int -scsb_hsc_board_healthy(int slot_number, boolean_t healthy) -{ - hsc_slot_t *hsp; - hsc_state_t *hsc; - - DEBUG2("hsc_board_healthy: slot %d = %d\n", slot_number, healthy); - - hsp = hsc_find_slot(slot_number); - if (hsp == NULL) { - cmn_err(CE_NOTE, "hsc_board_healthy: No Slot Info."); - return (DDI_FAILURE); - } - - hsc = hsp->hsc; - if (hsp->hs_slot_state == HPC_SLOT_EMPTY) { -#ifdef DEBUG - cmn_err(CE_NOTE, "%s#%d: Healthy# %s on " - "empty slot %d", ddi_driver_name(hsc->dip), - ddi_get_instance(hsc->dip), - healthy == B_TRUE ? "On" : "Off", slot_number); -#endif - return (DDI_FAILURE); - } - if (hsp->hs_slot_state == HPC_SLOT_DISCONNECTED) { - DEBUG2("healthy %s on disconnected slot %d\n", - healthy == B_TRUE ? "On":"Off", slot_number); - /* - * Connect the slot if board healthy and in autoconfig mode. - */ - hsp->hs_board_healthy = healthy; - if (healthy == B_TRUE) - return (hsc_slot_autoconnect(hsp)); - } - - /* - * the board is connected. The result could be seviour depending - * on the occupant state. - */ - if (healthy == B_TRUE) { - if (hsp->hs_board_healthy != B_TRUE) { - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, HPC_FAULT_LED, - HPC_LED_OFF); - /* Regained HEALTHY# at Run Time...!!! */ - cmn_err(CE_NOTE, "%s#%d: slot %d Occupant " - "%s, Regained HEALTHY#!", - ddi_driver_name(hsc->dip), - ddi_get_instance(hsc->dip), slot_number, - hsp->hs_board_configured == B_TRUE ? - "configured" : "Unconfigured"); - (void) hpc_slot_event_notify(hsp->hs_slot_handle, - HPC_EVENT_SLOT_HEALTHY_OK, 0); - } - } else { - if (hsp->hs_board_configured == B_TRUE) { - /* Lost HEALTHY# at Run Time...Serious Condition. */ - cmn_err(CE_WARN, "%s#%d: ALERT! Lost HEALTHY#" - " on Slot %d, Occupant %s", - ddi_driver_name(hsc->dip), - ddi_get_instance(hsc->dip), slot_number, - hsp->hs_board_configured == B_TRUE ? - "Online!!!" : "Offline"); - (void) hpc_slot_event_notify(hsp->hs_slot_handle, - HPC_EVENT_SLOT_NOT_HEALTHY, 0); - } - if ((hsp->hs_board_configured != B_TRUE) || - scsb_hsc_healthy_reset) { - if (scsb_reset_slot(hsp->hs_hpchandle, - slot_number, SCSB_RESET_SLOT) == 0) { - /* signal Ok to remove board. */ - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, - HPC_FAULT_LED, HPC_LED_ON); - cmn_err(CE_WARN, "%s#%d: Slot %d " - "successfully taken offline", - ddi_driver_name(hsc->dip), - ddi_get_instance(hsc->dip), - slot_number); - } - } - } - hsp->hs_board_healthy = healthy; - return (DDI_SUCCESS); -} - -static int -hsc_slot_autoconnect(hsc_slot_t *hsp) -{ - hsc_state_t *hsc = hsp->hsc; - int rc = DDI_SUCCESS; - /* - * Keep slot in reset unless autoconfiguration is enabled - * Ie. for Basic Hotswap mode, we stay disconnected at - * insertion. For full hotswap mode, we automatically - * go into connected state at insertion, so that occupant - * autoconfiguration is possible. - */ - if (((hsc->state & HSC_ENUM_ENABLED) == HSC_ENUM_ENABLED) && - (hsp->hs_flags & HSC_AUTOCFG)) { - /* this statement must be here before unreset. */ - hsc->hsp_last = hsp; - if ((rc = scsb_reset_slot(hsp->hs_hpchandle, - hsp->hs_slot_number, SCSB_UNRESET_SLOT)) == 0) { - - hsp->hs_slot_state = HPC_SLOT_CONNECTED; - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, - HPC_FAULT_LED, HPC_LED_OFF); - } else { - hsc->hsp_last = NULL; - rc = DDI_FAILURE; - } - } - return (rc); -} - -/* - * The SCSB code should invoke this function from its _init() function. - */ -int -hsc_init() -{ - int rc; - - rc = ddi_soft_state_init(&hsc_state, sizeof (hsc_state_t), 1); - if (rc != 0) - return (rc); - - hsc_slotops = hpc_alloc_slot_ops(KM_SLEEP); - - hsc_slotops->hpc_version = HPC_SLOT_OPS_VERSION; - hsc_slotops->hpc_op_connect = hsc_connect; - hsc_slotops->hpc_op_disconnect = hsc_disconnect; - hsc_slotops->hpc_op_insert = hsc_insert; - hsc_slotops->hpc_op_remove = hsc_remove; - hsc_slotops->hpc_op_control = hsc_control; - - return (DDI_SUCCESS); -} - - -/* - * The SCSB code should invoke this function from its _fini() function. - */ -int -hsc_fini() -{ - if (hsc_slotops != NULL) { - hpc_free_slot_ops(hsc_slotops); - hsc_slotops = NULL; - } - ddi_soft_state_fini(&hsc_state); - return (DDI_SUCCESS); -} - -static int -scsb_enable_enum(hsc_state_t *hsc) -{ - DEBUG0("hsc: Enable ENUM#\n"); - - if ((hsc->state & HSC_ENUM_ENABLED) == HSC_ENUM_ENABLED) - return (DDI_SUCCESS); - if ((hsc->state & HSC_ATTACHED) != HSC_ATTACHED) - return (DDI_FAILURE); - - if (ddi_add_intr(hsc->dip, 1, NULL, NULL, - hsc_enum_intr, (caddr_t)hsc) != DDI_SUCCESS) { - cmn_err(CE_WARN, "%s#%d: failed ENUM# interrupt registration", - ddi_driver_name(hsc->dip), ddi_get_instance(hsc->dip)); - return (DDI_FAILURE); - } - cmn_err(CE_CONT, "?%s%d: Successfully Upgraded to " - "Full Hotswap Mode\n", ddi_driver_name(hsc->dip), - ddi_get_instance(hsc->dip)); - hsc->state |= HSC_ENUM_ENABLED; - (void) ddi_prop_update_string(DDI_DEV_T_NONE, hsc->dip, - HOTSWAP_MODE_PROP, "full"); - return (DDI_SUCCESS); - -} - -/*ARGSUSED*/ -static int -scsb_disable_enum(hsc_state_t *hsc, int op) -{ - - DEBUG0("hsc: Disable ENUM#\n"); - if (op == SCSB_HSC_FORCE_REMOVE) { - /* - * Clear all pending interrupts before unregistering - * the interrupt. Otherwise the system will hang. - * - * Due to the hang problem, we'll not turn off or disable - * interrupts because if there's a non-friendly full hotswap - * device out there, the ENUM# will be kept asserted and - * hence hsc_clear_all_enum() can never deassert ENUM#. - * So the system will hang. - */ - if ((hsc->state & HSC_ENUM_ENABLED) == HSC_ENUM_ENABLED) { - /* hsc_clear_all_enum(hsc); */ - ddi_remove_intr(hsc->dip, 1, NULL); - hsc->state &= ~HSC_ENUM_ENABLED; - cmn_err(CE_CONT, "?%s%d: Successfully Downgraded to " - "Basic Hotswap Mode\n", - ddi_driver_name(hsc->dip), - ddi_get_instance(hsc->dip)); - } - (void) ddi_prop_update_string(DDI_DEV_T_NONE, hsc->dip, - HOTSWAP_MODE_PROP, "basic"); - return (DDI_SUCCESS); - } else - /* No programming interface for disabling ENUM# on MC/Tonga */ - return (HPC_ERR_NOTSUPPORTED); -} - -#ifndef lint -static int -hsc_clear_all_enum(hsc_state_t *hsc) -{ - int i, rc; - hsc_slot_t *hsp; - - for (i = 0; i < hsc->slot_table_size; i++) { - - hsp = hsc_find_slot(hsc->slot_table_prop[i].pslotnum); - if (hsp == NULL) - continue; - rc = hpc_slot_event_notify(hsp->hs_slot_handle, - HPC_EVENT_CLEAR_ENUM, - HPC_EVENT_SYNCHRONOUS); - if (rc == HPC_EVENT_UNCLAIMED) - break; /* no pending interrupts across the bus */ - DEBUG1("Pending Intr on slot %d\n", - hsc->slot_table_prop[i].pslotnum); - } - return (0); -} -#endif - -int -scsb_hsc_attach(dev_info_t *dip, void *scsb_handle, int instance) -{ - int i, n, prop_len; - int prom_prop = 0; /* default: OS property gives slot-table */ - int rc; - char *hotswap_model; - hsc_state_t *hsc; - scsb_state_t *scsb = (scsb_state_t *)scsb_handle; - caddr_t hpc_slot_table_data, s; - int hpc_slot_table_size; - hsc_prom_slot_table_t *hpstp; - int rstate; - - DEBUG0("hsc_attach: enter\n"); - /* - * To get the slot information, - * The OBP defines the 'slot-table' property. But the OS - * can override it with 'hsc-slot-map' property - * through the .conf file. - * Since the formats are different, 2 different property names - * are chosen. - * The OBP property format is - * <phandle>,<pci-devno>,<phys-slotno>,<ga-bits> - * The OS property format is (ga-bits is not used however) - * <busnexus-path>,<pci-devno>,<phys-slotno>,<ga-bits> - */ - rc = ddi_getlongprop(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, - "hsc-slot-map", (caddr_t)&hpc_slot_table_data, - &hpc_slot_table_size); - if (rc != DDI_PROP_SUCCESS) { - prom_prop = 1; - rc = ddi_getlongprop(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, - "slot-table", (caddr_t)&hpc_slot_table_data, - &hpc_slot_table_size); - if (rc != DDI_PROP_SUCCESS) { - cmn_err(CE_WARN, "%s#%d: 'slot-table' property " - "missing!", ddi_driver_name(dip), - ddi_get_instance(dip)); - return (DDI_FAILURE); - } - } - rc = ddi_soft_state_zalloc(hsc_state, instance); - if (rc != DDI_SUCCESS) - return (DDI_FAILURE); - - hsc = (hsc_state_t *)ddi_get_soft_state(hsc_state, instance); - hsc->scsb_handle = scsb_handle; - hsc->dip = dip; - hsc->instance = instance; - hsc->n_registered_occupants = 0; - hsc->regDone = B_FALSE; - /* hsc->slot_info = hsc_slot_list; */ - - /* - * Check whether the system should be in basic or full - * hotswap mode. The PROM property always says full, so - * look at the .conf file property whether this is "full" - */ - if (scsb_hsc_enable_fhs) { - hsc->hotswap_mode = HSC_HOTSWAP_MODE_FULL; - } else { - hsc->hotswap_mode = HSC_HOTSWAP_MODE_BASIC; - } - - rc = ddi_getlongprop(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, - "default-hotswap-mode", (caddr_t)&hotswap_model, &prop_len); - - if (rc == DDI_PROP_SUCCESS) { - if (strcmp(hotswap_model, "full") == 0) { - hsc->hotswap_mode = HSC_HOTSWAP_MODE_FULL; - } else if (strcmp(hotswap_model, "basic") == 0) { - hsc->hotswap_mode = HSC_HOTSWAP_MODE_BASIC; - } - - kmem_free(hotswap_model, prop_len); - } - - /* - * Determine the size of the slot table from the property and - * allocate the slot table arrary..Decoding is different for - * OS and PROM property. - */ - if (!prom_prop) { /* OS .conf property */ - for (i = 0, n = 0; i < hpc_slot_table_size; i++) { - if (hpc_slot_table_data[i] == 0) { - n++; - } - } - - /* There should be four elements per entry */ - if (n % 4) { - cmn_err(CE_WARN, "%s#%d: bad format for " - "slot-table(%d)", ddi_driver_name(dip), - ddi_get_instance(dip), n); - kmem_free(hpc_slot_table_data, hpc_slot_table_size); - ddi_soft_state_free(hsc_state, instance); - return (DDI_FAILURE); - } - - hsc->slot_table_size = n / 4; - } else { - hsc->slot_table_size = hpc_slot_table_size / - sizeof (hsc_prom_slot_table_t); - n = hpc_slot_table_size % sizeof (hsc_prom_slot_table_t); - if (n) { - cmn_err(CE_WARN, "%s#%d: bad format for " - "slot-table(%d)", ddi_driver_name(dip), - ddi_get_instance(dip), hpc_slot_table_size); - kmem_free(hpc_slot_table_data, hpc_slot_table_size); - ddi_soft_state_free(hsc_state, instance); - return (DDI_FAILURE); - } - } - - /* - * Netract800 FTC (formerly known as CFTM) workaround. - * Leave Slot 2 out of the HS table if FTC is present in Slot 2 - */ - if (scsb->scsb_hsc_state & SCSB_HSC_CTC_PRES) { - hsc->slot_table_size -= 1; - } - DEBUG1("hsc_attach: %d hotplug slots on bus\n", hsc->slot_table_size); - /* - * Create enough space for each slot table entry - * based on how many entries in the property - */ - hsc->slot_table_prop = (hsc_slot_table_t *) - kmem_zalloc(hsc->slot_table_size * - sizeof (hsc_slot_table_t), KM_SLEEP); - - if (!prom_prop) { - s = hpc_slot_table_data; - for (i = 0; i < hsc->slot_table_size; i++) { - - char *nexus, *pcidev, *phys_slotname, *ga; - - /* Pick off pointer to nexus path or PROM handle */ - nexus = s; - while (*s != NULL) - s++; - s++; - - /* Pick off pointer to the pci device number */ - pcidev = s; - while (*s != NULL) - s++; - s++; - - /* Pick off physical slot no */ - phys_slotname = s; - while (*s != NULL) - s++; - s++; - - /* Pick off GA bits which we dont use for now. */ - ga = s; - while (*s != NULL) - s++; - s++; - - if (scsb->scsb_hsc_state & SCSB_HSC_CTC_PRES && - atoi(phys_slotname) == SC_MC_CTC_SLOT) { - --i; - continue; - } - hsc->slot_table_prop[i].pslotnum = atoi(phys_slotname); - hsc->slot_table_prop[i].ga = atoi(ga); - hsc->slot_table_prop[i].pci_devno = atoi(pcidev); - (void) strcpy(hsc->slot_table_prop[i].nexus, nexus); - } - } else { - hpstp = (hsc_prom_slot_table_t *)hpc_slot_table_data; - for (i = 0; i < hsc->slot_table_size; i++, hpstp++) { - if (scsb->scsb_hsc_state & SCSB_HSC_CTC_PRES && - hpstp->pslotnum == SC_MC_CTC_SLOT) { - --i; - continue; - } - hsc->slot_table_prop[i].pslotnum = hpstp->pslotnum; - hsc->slot_table_prop[i].ga = hpstp->ga; - hsc->slot_table_prop[i].pci_devno = hpstp->pci_devno; - - if (prom_phandle_to_path((uint_t)hpstp->phandle, - hsc->slot_table_prop[i].nexus, - sizeof (hsc->slot_table_prop[i].nexus)) - == -1) { - cmn_err(CE_WARN, "%s#%d: Cannot get phandle " - "to nexus path", ddi_driver_name(dip), - ddi_get_instance(dip)); - kmem_free(hsc->slot_table_prop, - (hsc->slot_table_size * - sizeof (hsc_slot_table_t))); - kmem_free(hpc_slot_table_data, - hpc_slot_table_size); - ddi_soft_state_free(hsc_state, instance); - return (DDI_FAILURE); - } - } - } - - /* keep healthy register cache uptodate before reading slot state */ - if (scsb_read_bhealthy(scsb_handle) != 0) { - cmn_err(CE_WARN, "%s#%d: hsc_attach: Cannot read " - "Healthy Registers", ddi_driver_name(dip), - ddi_get_instance(dip)); - kmem_free(hsc->slot_table_prop, - (hsc->slot_table_size * - sizeof (hsc_slot_table_t))); - kmem_free(hpc_slot_table_data, - hpc_slot_table_size); - ddi_soft_state_free(hsc_state, instance); - return (DDI_FAILURE); - } - - /* - * Before we start registering the slots, calculate how many - * slots are occupied. - */ - - for (i = 0; i < hsc->slot_table_size; i++) { - if (scsb_get_slot_state(scsb_handle, - hsc->slot_table_prop[i].pslotnum, &rstate) != - DDI_SUCCESS) - return (rc); - if (rstate != HPC_SLOT_EMPTY) - hsc->n_registered_occupants++; - } - - mutex_init(&hsc->hsc_mutex, NULL, MUTEX_DRIVER, NULL); - for (i = 0; i < hsc->slot_table_size; i++) { - - DEBUG2("Registering on nexus [%s] cPCI device [%d]\n", - hsc->slot_table_prop[i].nexus, - hsc->slot_table_prop[i].pci_devno); - - if (hsc_slot_register(hsc, hsc->slot_table_prop[i].nexus, - hsc->slot_table_prop[i].pci_devno, - hsc->slot_table_prop[i].pslotnum, B_FALSE) != - HPC_SUCCESS) { - - cmn_err(CE_WARN, "%s#%d: Slot Registration Failure", - ddi_driver_name(dip), ddi_get_instance(dip)); - while (i) { - i--; - n = hsc->slot_table_prop[i].pslotnum; - if (hsc_slot_unregister(n) != 0) { - cmn_err(CE_WARN, - "%s#%d: failed to unregister" - " slot %d", - ddi_driver_name(dip), - ddi_get_instance(dip), n); - - } - } - mutex_destroy(&hsc->hsc_mutex); - kmem_free(hsc->slot_table_prop, (hsc->slot_table_size * - sizeof (hsc_slot_table_t))); - kmem_free(hpc_slot_table_data, hpc_slot_table_size); - ddi_soft_state_free(hsc_state, instance); - return (DDI_FAILURE); - } - } - - hsc->hsp_last = NULL; - hsc->hsc_intr_counter = 0; - kmem_free(hpc_slot_table_data, hpc_slot_table_size); - (void) ddi_prop_update_string(DDI_DEV_T_NONE, hsc->dip, - HOTSWAP_MODE_PROP, "basic"); - hsc->state |= (HSC_ATTACHED|HSC_SCB_CONNECTED); - - /* - * We enable full hotswap right here if all the slots are empty. - */ - if ((hsc->regDone == B_FALSE && hsc->n_registered_occupants == 0) || - scsb_hsc_numReg == hsc->n_registered_occupants) { - hsc->regDone = B_TRUE; - if (hsc->hotswap_mode == HSC_HOTSWAP_MODE_FULL) { - if (scsb_enable_enum(hsc) != DDI_SUCCESS) { - cmn_err(CE_WARN, "%s#%d: Cannot enable " - "Full Hotswap", ddi_driver_name(dip), - ddi_get_instance(dip)); - } - } - } - return (DDI_SUCCESS); -} - -/*ARGSUSED*/ -int -scsb_hsc_detach(dev_info_t *dip, void *scsb_handle, int instance) -{ - int i = 0; - hsc_state_t *hsc; - char slotautocfg_prop[18]; - - DEBUG0("hsc_detach: enter\n"); - hsc = (hsc_state_t *)ddi_get_soft_state(hsc_state, instance); - if (hsc == NULL) { - DEBUG2("%s#%d: hsc_detach: Soft state NULL", - ddi_driver_name(dip), ddi_get_instance(dip)); - return (DDI_FAILURE); - } - - if ((hsc->state & HSC_ATTACHED) != HSC_ATTACHED) - return (DDI_FAILURE); - /* - * let's unregister the hotpluggable slots with hotplug service. - */ - for (i = 0; i < hsc->slot_table_size; i++) { - - hsc_slot_t *hsp; - - hsp = hsc_find_slot(hsc->slot_table_prop[i].pslotnum); - if (hsp == NULL) { - cmn_err(CE_WARN, "%s#%d: hsc_detach: No Slot Info", - ddi_driver_name(dip), ddi_get_instance(dip)); - } else { - hpc_led_info_t aledinfo; /* active led info. */ - hpc_led_info_t fledinfo; /* fault led info. */ - - aledinfo.led = HPC_ACTIVE_LED; - aledinfo.state = HPC_LED_BLINK; - fledinfo.led = HPC_FAULT_LED; - fledinfo.state = HPC_LED_OFF; - (void) hsc_led_state(hsp, HPC_CTRL_SET_LED_STATE, - &aledinfo); - (void) hsc_led_state(hsp, HPC_CTRL_SET_LED_STATE, - &fledinfo); - } - (void) sprintf(slotautocfg_prop, "slot%d-autoconfig", - hsp->hs_slot_number); - (void) ddi_prop_remove(DDI_DEV_T_NONE, hsc->dip, - slotautocfg_prop); - if (hsc_slot_unregister(hsc->slot_table_prop[i].pslotnum) - != 0) { - cmn_err(CE_NOTE, "%s#%d: failed to unregister" - " slot %d\n", ddi_driver_name(dip), - ddi_get_instance(dip), - hsc->slot_table_prop[i].pslotnum); - return (DDI_FAILURE); - } - } - kmem_free(hsc->slot_table_prop, (hsc->slot_table_size * - sizeof (hsc_slot_table_t))); - if ((hsc->state & HSC_ENUM_ENABLED) == HSC_ENUM_ENABLED) { - ddi_remove_intr(hsc->dip, 1, hsc->enum_iblock); - hsc->state &= ~HSC_ENUM_ENABLED; - } - mutex_destroy(&hsc->hsc_mutex); - (void) ddi_prop_remove(DDI_DEV_T_NONE, hsc->dip, HOTSWAP_MODE_PROP); - hsc->state &= ~(HSC_ATTACHED|HSC_SCB_CONNECTED); - ddi_soft_state_free(hsc_state, instance); - return (DDI_SUCCESS); -} - -/* - * The following function is called when the SCSB is hot extracted from - * the system. - */ -int -scsb_hsc_freeze(dev_info_t *dip) -{ - hsc_state_t *hsc; - int instance = ddi_get_instance(dip); - int i; - hsc_slot_t *hsp; - - hsc = (hsc_state_t *)ddi_get_soft_state(hsc_state, instance); - if (hsc == NULL) { - DEBUG2("%s#%d: Soft state NULL", - ddi_driver_name(dip), ddi_get_instance(dip)); - return (DDI_SUCCESS); - } - if ((hsc->state & HSC_ATTACHED) != HSC_ATTACHED) - return (DDI_SUCCESS); - hsc->state &= ~HSC_SCB_CONNECTED; - - for (i = 0; i < hsc->slot_table_size; i++) { - hsp = hsc_find_slot(hsc->slot_table_prop[i].pslotnum); - - if (hsp == NULL) { - cmn_err(CE_NOTE, "hsc_freeze: " - " Cannot map slot number %d to a hsc_slot_t", - hsc->slot_table_prop[i].pslotnum); - continue; - } - /* - * Since reset lines are pulled low, lets mark these - * slots and not allow a connect operation. - * Note that we still keep the slot as slot disconnected, - * although it is connected from the hardware standpoint. - * As soon as the SCB is plugged back in, we check these - * states and put the hardware state back to its original - * state. - */ - if (hsp->hs_slot_state == HPC_SLOT_DISCONNECTED) { - cmn_err(CE_WARN, "%s#%d: Slot %d Now out of Reset!", - ddi_driver_name(hsc->dip), - ddi_get_instance(hsc->dip), - hsp->hs_slot_number); - } - hsp->hs_flags |= HSC_SCB_HOTSWAPPED; - } - - return (DDI_SUCCESS); -} - -/* - * The following function is called when the SCSB is hot inserted from - * the system. We must update the LED status and set the RST# registers - * again. - */ -int -scsb_hsc_restore(dev_info_t *dip) -{ - int i; - hsc_state_t *hsc; - hsc_slot_t *hsp; - int instance = ddi_get_instance(dip); - - hsc = (hsc_state_t *)ddi_get_soft_state(hsc_state, instance); - if (hsc == NULL) { - DEBUG2("%s#%d: Soft state NULL", - ddi_driver_name(dip), ddi_get_instance(dip)); - return (DDI_SUCCESS); - } - - if ((hsc->state & HSC_ATTACHED) != HSC_ATTACHED) - return (DDI_SUCCESS); - hsc->state |= HSC_SCB_CONNECTED; - for (i = 0; i < hsc->slot_table_size; i++) { - hsp = hsc_find_slot(hsc->slot_table_prop[i].pslotnum); - - if (hsp == NULL) { - cmn_err(CE_NOTE, "%s#%d: hsc_restore: " - " Cannot map slot number %d to a hsc_slot_t", - ddi_driver_name(hsc->dip), - ddi_get_instance(hsc->dip), - hsc->slot_table_prop[i].pslotnum); - continue; - } - if ((hsp->hs_slot_state == HPC_SLOT_DISCONNECTED) && - (hsp->hs_board_configured == B_FALSE)) { - if (scsb_reset_slot(hsp->hs_hpchandle, - hsp->hs_slot_number, - SCSB_RESET_SLOT) != 0) { - cmn_err(CE_WARN, "%s#%d: hsc_restore: " - " Cannot reset disconnected slot %d", - ddi_driver_name(hsc->dip), - ddi_get_instance(hsc->dip), - hsp->hs_slot_number); - } - } - - if (scsb_hsc_init_slot_state(hsc, hsp) != DDI_SUCCESS) { - - cmn_err(CE_WARN, "%s#%d: hsc_freeze: Cannot init" - " slot%d state", - ddi_driver_name(hsc->dip), - ddi_get_instance(hsc->dip), - hsp->hs_slot_number); - } - hsp->hs_flags &= ~HSC_SCB_HOTSWAPPED; - } - return (DDI_SUCCESS); -} - -#ifndef lint -int -scsb_hsc_freeze_check(dev_info_t *dip) -{ - hsc_state_t *hsc; - int instance = ddi_get_instance(dip); - - hsc = (hsc_state_t *)ddi_get_soft_state(hsc_state, instance); - if (hsc == NULL) { - DEBUG2("%s#%d: Soft state NULL", - ddi_driver_name(dip), ddi_get_instance(dip)); - return (DDI_SUCCESS); - } - if ((hsc->state & HSC_ATTACHED) != HSC_ATTACHED) - return (DDI_SUCCESS); - return (DDI_SUCCESS); -} -#endif - -/* - * update info about Alarm Card insert/remove mechanism. - */ -void -hsc_ac_op(int instance, int pslotnum, int op, void *arg) -{ - hsc_slot_t *hsp; - hsc_state_t *hsc; - - hsc = (hsc_state_t *)ddi_get_soft_state(hsc_state, instance); - if (hsc == NULL) { - cmn_err(CE_WARN, "%s#%d: hsc_ac_op: No Soft State Info", - ddi_driver_name(hsc->dip), ddi_get_instance(hsc->dip)); - return; - } - - hsp = hsc_find_slot(pslotnum); - if (hsp == NULL) { - cmn_err(CE_WARN, "%s#%d: hsc_ac_op: No Slot Info", - ddi_driver_name(hsc->dip), ddi_get_instance(hsc->dip)); - return; - } - - switch (op) { - case SCSB_HSC_AC_UNCONFIGURE : - /* - * If ENUM# is enabled, then action is pending on - * this slot, just send a event. - */ - if (hsc->state & HSC_ENUM_ENABLED) - (void) hpc_slot_event_notify( - hsp->hs_slot_handle, - HPC_EVENT_PROCESS_ENUM, 0); - break; - case SCSB_HSC_AC_GET_SLOT_INFO : - *(hsc_slot_t **)arg = hsp; - break; - default : - break; - } -} - -static uint_t -hsc_enum_intr(caddr_t iarg) -{ - int rc; - hsc_state_t *hsc = (hsc_state_t *)iarg; - hsc_slot_t *hsp; - - DEBUG0("!E!"); - if ((hsc->state & HSC_ATTACHED) == 0) - return (DDI_INTR_UNCLAIMED); - - hsp = hsc_find_slot(hsc->slot_table_prop[0].pslotnum); - if (hsp == NULL) /* No slots registered */ - return (DDI_INTR_UNCLAIMED); - - /* - * The following must be done to clear interrupt (synchronous event). - * To process the interrupt, we send an asynchronous event. - */ - rc = hpc_slot_event_notify(hsp->hs_slot_handle, - HPC_EVENT_CLEAR_ENUM, - HPC_EVENT_SYNCHRONOUS); - if (rc == HPC_EVENT_UNCLAIMED) { - /* - * possible support for handling insertion of non friendly - * full hotswap boards, otherwise the system hangs due - * to uncleared interrupt bursts. - */ - DEBUG2("!E>counter %d, last op@slot %lx\n", - hsc->hsc_intr_counter, hsc->hsp_last); - hsc->hsc_intr_counter ++; - if (hsc->hsc_intr_counter == scsb_hsc_max_intr_count) { - if (!hsc->hsp_last) { - cmn_err(CE_WARN, "%s#%d: hsc_enum_intr: " - " No Last Board Insertion Info.", - ddi_driver_name(hsc->dip), - ddi_get_instance(hsc->dip)); - hsc->hsc_intr_counter = 0; - return (DDI_INTR_UNCLAIMED); - } - hsp = hsc->hsp_last; - cmn_err(CE_WARN, "%s#%d: Bad (non friendly ?) Board " - "in Slot %d ? Taking it Offline.", - ddi_driver_name(hsc->dip), - ddi_get_instance(hsc->dip), - hsp->hs_slot_number); - /* - * this should put just inserted board back in - * reset, thus deasserting the ENUM# and the - * system hang. - */ - if (scsb_reset_slot(hsp->hs_hpchandle, - hsp->hs_slot_number, - SCSB_RESET_SLOT) == 0) { - /* Enumeration failed on this board */ - hsp->hs_flags |= HSC_ENUM_FAILED; - if (hsp->hs_board_configured == B_TRUE) - cmn_err(CE_WARN, "%s#%d: ALERT! System" - " now in Inconsistent State." - " Halt!", - ddi_driver_name(hsc->dip), - ddi_get_instance(hsc->dip)); - hsc_led_op(hsp, HPC_CTRL_SET_LED_STATE, - HPC_FAULT_LED, HPC_LED_ON); - } - hsc->hsc_intr_counter = 0; - } - return (DDI_INTR_UNCLAIMED); - } - hsc->hsc_intr_counter = 0; - /* - * if interrupt success, rc denotes the PCI device number which - * generated the ENUM# interrupt. - */ - hsp = hsc_get_slot_info(hsc, rc); - if (hsp == NULL) { - cmn_err(CE_WARN, "%s#%d: hsc_enum_intr: no slot info for " - "dev %x", ddi_driver_name(hsc->dip), - ddi_get_instance(hsc->dip), rc); - return (DDI_INTR_CLAIMED); /* interrupt already cleared */ - } - /* if this is Alarm Card and if it is busy, dont process event */ - if (hsp->hs_flags & HSC_ALARM_CARD_PRES) { - if (scsb_hsc_ac_op(hsp->hs_hpchandle, hsp->hs_slot_number, - SCSB_HSC_AC_BUSY) == B_TRUE) { - /* - * Busy means we need to inform (envmond)alarmcard.so - * that it should save the AC configuration, stop the - * heartbeat, and shutdown the RSC link. - */ - (void) scsb_hsc_ac_op(hsp->hs_hpchandle, - hsp->hs_slot_number, - SCSB_HSC_AC_REMOVAL_ALERT); - return (DDI_INTR_CLAIMED); - } - } - /* - * If SCB was swapped out, dont process ENUM#. We put this slot - * back in reset after SCB is inserted. - */ - if ((hsp->hs_flags & HSC_SCB_HOTSWAPPED) && - (hsp->hs_slot_state == HPC_SLOT_DISCONNECTED)) - return (DDI_INTR_CLAIMED); - - (void) hpc_slot_event_notify(hsp->hs_slot_handle, - HPC_EVENT_PROCESS_ENUM, 0); - return (DDI_INTR_CLAIMED); -} -/* - * A routine to convert a number (represented as a string) to - * the integer value it represents. - */ - -static int -isdigit(int ch) -{ - return (ch >= '0' && ch <= '9'); -} - -#define isspace(c) ((c) == ' ' || (c) == '\t' || (c) == '\n') -#define bad(val) (val == NULL || !isdigit(*val)) - -static int -atoi(const char *p) -{ - int n; - int c, neg = 0; - - if (!isdigit(c = *p)) { - while (isspace(c)) - c = *++p; - switch (c) { - case '-': - neg++; - /* FALLTHROUGH */ - case '+': - c = *++p; - } - if (!isdigit(c)) - return (0); - } - for (n = '0' - c; isdigit(c = *++p); ) { - n *= 10; /* two steps to avoid unnecessary overflow */ - n += '0' - c; /* accum neg to avoid surprises at MAX */ - } - return (neg ? n : -n); -} diff --git a/usr/src/uts/sun4u/montecarlo/io/pcf8574_nct.c b/usr/src/uts/sun4u/montecarlo/io/pcf8574_nct.c deleted file mode 100644 index 409d50a8d8..0000000000 --- a/usr/src/uts/sun4u/montecarlo/io/pcf8574_nct.c +++ /dev/null @@ -1,1881 +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 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - * Copyright (c) 2011 Bayard G. Bell. All rights reserved. - */ - -#include <sys/param.h> -#include <sys/types.h> -#include <sys/signal.h> -#include <sys/errno.h> -#include <sys/file.h> -#include <sys/termio.h> -#include <sys/termios.h> -#include <sys/cmn_err.h> -#include <sys/stream.h> -#include <sys/strsun.h> -#include <sys/stropts.h> -#include <sys/strtty.h> -#include <sys/debug.h> -#include <sys/eucioctl.h> -#include <sys/cred.h> -#include <sys/uio.h> -#include <sys/stat.h> -#include <sys/kmem.h> - -#include <sys/ddi.h> -#include <sys/sunddi.h> -#include <sys/obpdefs.h> -#include <sys/conf.h> /* req. by dev_ops flags MTSAFE etc. */ -#include <sys/modctl.h> /* for modldrv */ -#include <sys/stat.h> /* ddi_create_minor_node S_IFCHR */ -#include <sys/open.h> /* for open params. */ -#include <sys/uio.h> /* for read/write */ - -#include <sys/i2c/misc/i2c_svc.h> -#include <sys/mct_topology.h> -#include <sys/envctrl_gen.h> /* must be before netract_gen.h */ -#include <sys/netract_gen.h> -#include <sys/pcf8574_nct.h> -#include <sys/scsb_cbi.h> - -#ifdef DEBUG -#define dbg_print(level, str) cmn_err(level, str); - static int pcf8574_debug = 0x00000102; -#else -#define dbg_print(level, str) {; } -#endif - -#define CV_LOCK(retval) \ -{ \ - mutex_enter(&unitp->umutex); \ - while (unitp->pcf8574_flags == PCF8574_BUSY) { \ - if (cv_wait_sig(&unitp->pcf8574_cv, \ - &unitp->umutex) <= 0) { \ - mutex_exit(&unitp->umutex); \ - return (retval); \ - } \ - } \ - unitp->pcf8574_flags = PCF8574_BUSY; \ - mutex_exit(&unitp->umutex); \ -} - -#define CV_UNLOCK \ -{ \ - mutex_enter(&unitp->umutex); \ - unitp->pcf8574_flags = 0; \ - cv_signal(&unitp->pcf8574_cv); \ - mutex_exit(&unitp->umutex); \ -} - -static int nct_p10fan_patch = 0; /* Fan patch for P1.0 */ -static void *pcf8574_soft_statep; - -/* - * cb ops (only need open,close,read,write,ioctl) - */ -static int pcf8574_open(dev_t *, int, int, cred_t *); -static int pcf8574_close(dev_t, int, int, cred_t *); -static int pcf8574_ioctl(dev_t, int, intptr_t, int, cred_t *, int *); -static int pcf8574_read(dev_t dev, struct uio *uiop, cred_t *cred_p); -static int pcf8574_chpoll(dev_t, short, int, short *, struct pollhead **); -static uint_t pcf8574_intr(caddr_t arg); -static int pcf8574_io(dev_t, struct uio *, int); - -static struct cb_ops pcf8574_cbops = { - pcf8574_open, /* open */ - pcf8574_close, /* close */ - nodev, /* strategy */ - nodev, /* print */ - nodev, /* dump */ - pcf8574_read, /* read */ - nodev, /* write */ - pcf8574_ioctl, /* ioctl */ - nodev, /* devmap */ - nodev, /* mmap */ - nodev, /* segmap */ - pcf8574_chpoll, /* poll */ - ddi_prop_op, /* cb_prop_op */ - NULL, /* streamtab */ - D_NEW | D_MP | D_HOTPLUG, /* Driver compatibility flag */ - CB_REV, /* rev */ - nodev, /* int (*cb_aread)() */ - nodev /* int (*cb_awrite)() */ -}; - -/* - * dev ops - */ -static int pcf8574_attach(dev_info_t *dip, ddi_attach_cmd_t cmd); -static int pcf8574_detach(dev_info_t *dip, ddi_detach_cmd_t cmd); - -/* kstat routines */ -static int pcf8574_add_kstat(struct pcf8574_unit *, scsb_fru_status_t); -static void pcf8574_delete_kstat(struct pcf8574_unit *); -static int pcf8574_kstat_update(kstat_t *, int); -static int pcf8574_read_chip(struct pcf8574_unit *unitp, - uint16_t size); -static int pcf8574_write_chip(struct pcf8574_unit *unitp, - uint16_t size, uint8_t bitpattern); -static int pcf8574_read_props(struct pcf8574_unit *unitp); -static int pcf8574_init_chip(struct pcf8574_unit *unitp, int); -/* - * SCSB callback function - */ -static void pcf8574_callback(void *, scsb_fru_event_t, scsb_fru_status_t); -extern int scsb_intr_register(uint_t (*intr_handler)(caddr_t), caddr_t, - fru_id_t); -extern int scsb_intr_unregister(fru_id_t); - -extern int nct_i2c_transfer(i2c_client_hdl_t i2c_hdl, i2c_transfer_t *i2c_tran); - -static struct dev_ops pcf8574_ops = { - DEVO_REV, - 0, - ddi_getinfo_1to1, - nulldev, - nulldev, - pcf8574_attach, - pcf8574_detach, - nodev, - &pcf8574_cbops, - NULL, /* bus_ops */ - NULL, /* power */ - ddi_quiesce_not_supported, /* devo_quiesce */ -}; - -extern struct mod_ops mod_driverops; - -static struct modldrv pcf8574_modldrv = { - &mod_driverops, /* type of module - driver */ - "Netract pcf8574 (gpio)", - &pcf8574_ops, -}; - -static struct modlinkage pcf8574_modlinkage = { - MODREV_1, - &pcf8574_modldrv, - 0 -}; - -int -_init(void) -{ - register int error; - - error = mod_install(&pcf8574_modlinkage); - if (!error) { - (void) ddi_soft_state_init(&pcf8574_soft_statep, - sizeof (struct pcf8574_unit), PCF8574_MAX_DEVS); - } - - return (error); -} - -int -_fini(void) -{ - register int error; - - error = mod_remove(&pcf8574_modlinkage); - if (!error) - ddi_soft_state_fini(&pcf8574_soft_statep); - - return (error); -} - -int -_info(struct modinfo *modinfop) -{ - return (mod_info(&pcf8574_modlinkage, modinfop)); -} - -/*ARGSUSED*/ -static int -pcf8574_open(dev_t *devp, int flags, int otyp, cred_t *credp) -{ - struct pcf8574_unit *unitp; - register int instance; - int err = DDI_SUCCESS; - - instance = getminor(*devp); - if (instance < 0) { - return (ENXIO); - } - - unitp = (struct pcf8574_unit *) - ddi_get_soft_state(pcf8574_soft_statep, instance); - - if (unitp == NULL) { - return (ENXIO); - } - - if (otyp != OTYP_CHR) { - return (EINVAL); - } - - mutex_enter(&unitp->umutex); - - if (flags & FEXCL) { - if (unitp->pcf8574_oflag != 0) { - err = EBUSY; - } else { - unitp->pcf8574_oflag = FEXCL; - } - } else { - if (unitp->pcf8574_oflag == FEXCL) { - err = EBUSY; - } else { - unitp->pcf8574_oflag = FOPEN; - } - } - - mutex_exit(&unitp->umutex); - - return (err); -} - -/*ARGSUSED*/ -static int -pcf8574_close(dev_t dev, int flags, int otyp, cred_t *credp) -{ - struct pcf8574_unit *unitp; - register int instance; - -#ifdef lint - flags = flags; - otyp = otyp; -#endif - - instance = getminor(dev); - - if (instance < 0) { - return (ENXIO); - } - - unitp = (struct pcf8574_unit *) - ddi_get_soft_state(pcf8574_soft_statep, instance); - - if (unitp == NULL) { - return (ENXIO); - } - - mutex_enter(&unitp->umutex); - - unitp->pcf8574_oflag = 0; - - mutex_exit(&unitp->umutex); - - return (DDI_SUCCESS); -} - - -/*ARGSUSED*/ -static int -pcf8574_read(dev_t dev, struct uio *uiop, cred_t *cred_p) -{ - return (pcf8574_io(dev, uiop, B_READ)); -} - -static int -pcf8574_io(dev_t dev, struct uio *uiop, int rw) -{ - struct pcf8574_unit *unitp; - register int instance; - uint16_t bytes_to_rw; - int err = DDI_SUCCESS; - - err = 0; - instance = getminor(dev); - - if (instance < 0) { - return (ENXIO); - } - - unitp = (struct pcf8574_unit *) - ddi_get_soft_state(pcf8574_soft_statep, instance); - if (unitp == NULL) { - return (ENXIO); - } - if ((bytes_to_rw = uiop->uio_resid) > PCF8574_TRAN_SIZE) { - return (EINVAL); - } - - CV_LOCK(EINTR) - - if (rw == B_WRITE) { - err = uiomove(unitp->i2c_tran->i2c_wbuf, - bytes_to_rw, UIO_WRITE, uiop); - - if (!err) { - err = pcf8574_write_chip(unitp, bytes_to_rw, - unitp->writemask); - } - - } else { - err = pcf8574_read_chip(unitp, bytes_to_rw); - if (!err) { - err = uiomove(unitp->i2c_tran->i2c_rbuf, - bytes_to_rw, UIO_READ, uiop); - } - } - - CV_UNLOCK - if (err) - err = EIO; - - return (err); -} - -static int -pcf8574_do_resume(dev_info_t *dip) -{ - int instance = ddi_get_instance(dip); - struct pcf8574_unit *unitp = - ddi_get_soft_state(pcf8574_soft_statep, instance); - - if (unitp == NULL) { - return (ENXIO); - } - - CV_UNLOCK - - return (DDI_SUCCESS); -} - -static int -pcf8574_do_detach(dev_info_t *dip) -{ - struct pcf8574_unit *unitp; - int instance; - uint_t attach_flag; - - instance = ddi_get_instance(dip); - unitp = ddi_get_soft_state(pcf8574_soft_statep, instance); - - attach_flag = unitp->attach_flag; - - if (attach_flag & PCF8574_INTR_ADDED) { - (void) scsb_intr_unregister( - (fru_id_t)unitp->props.slave_address); - } - - if (attach_flag & PCF8574_KSTAT_INIT) { - pcf8574_delete_kstat(unitp); - } - - if (attach_flag & PCF8574_LOCK_INIT) { - mutex_destroy(&unitp->umutex); - cv_destroy(&unitp->pcf8574_cv); - } - - scsb_fru_unregister((void *)unitp, - (fru_id_t)unitp->props.slave_address); - - if (attach_flag & PCF8574_ALLOC_TRANSFER) { - /* - * restore the lengths to allocated lengths - * before freeing. - */ - unitp->i2c_tran->i2c_wlen = MAX_WLEN; - unitp->i2c_tran->i2c_rlen = MAX_RLEN; - i2c_transfer_free(unitp->pcf8574_hdl, unitp->i2c_tran); - } - - if (attach_flag & PCF8574_REGISTER_CLIENT) { - i2c_client_unregister(unitp->pcf8574_hdl); - } - - if (attach_flag & PCF8574_MINORS_CREATED) { - ddi_remove_minor_node(dip, NULL); - } - - if (attach_flag & PCF8574_PROPS_READ) { - if (unitp->pcf8574_type == PCF8574_ADR_CPUVOLTAGE && - unitp->props.num_chans_used != 0) { - ddi_prop_free(unitp->props.channels_in_use); - } else { - (void) ddi_prop_remove(DDI_DEV_T_NONE, dip, - "interrupt-priorities"); - } - } - - if (attach_flag & PCF8574_SOFT_STATE_ALLOC) { - ddi_soft_state_free(pcf8574_soft_statep, instance); - } - - return (DDI_SUCCESS); -} - -/* - * NOTE**** - * The OBP will create device tree node for all I2C devices which - * may be present in a system. This means, even if the device is - * not physically present, the device tree node exists. We also - * will succeed the attach routine, since currently there is no - * hotplug support in the I2C bus, and the FRUs need to be hot - * swappable. Only during an I2C transaction we figure out whether - * the particular I2C device is actually present in the system - * by looking at the system controller board register. The fantray - * and power-supply devices may be swapped any time after system - * reboot, and the way we can make sure that the device is attached - * to the driver, is by always keeping the driver loaded, and report - * an error during the actual transaction. - */ -static int -pcf8574_do_attach(dev_info_t *dip) -{ - register struct pcf8574_unit *unitp; - int instance; - char name[MAXNAMELEN]; - int i; - pcf8574_channel_t *chp; - scsb_fru_status_t dev_presence; - - instance = ddi_get_instance(dip); -#ifdef DEBUG - if (pcf8574_debug & 0x04) - cmn_err(CE_NOTE, "pcf8574_attach: instance=%d\n", - instance); -#endif /* DEBUG */ - - if (ddi_soft_state_zalloc(pcf8574_soft_statep, instance) != - DDI_SUCCESS) { - return (DDI_FAILURE); - } - unitp = ddi_get_soft_state(pcf8574_soft_statep, instance); - - if (unitp == NULL) { - ddi_soft_state_free(pcf8574_soft_statep, instance); - return (DDI_FAILURE); - } - - unitp->dip = dip; - - unitp->attach_flag = PCF8574_SOFT_STATE_ALLOC; - - if (pcf8574_read_props(unitp) != DDI_PROP_SUCCESS) { - ddi_soft_state_free(pcf8574_soft_statep, instance); - return (DDI_FAILURE); - } - - unitp->attach_flag |= PCF8574_PROPS_READ; - - /* - * Set the current operating mode to NORMAL_MODE. - */ - unitp->current_mode = ENVCTRL_NORMAL_MODE; - - (void) snprintf(unitp->pcf8574_name, PCF8574_NAMELEN, - "%s%d", ddi_driver_name(dip), instance); - - if (unitp->pcf8574_type == PCF8574_TYPE_PWRSUPP) { - (void) sprintf(name, "pwrsuppply"); - if (ddi_create_minor_node(dip, name, S_IFCHR, instance, - PCF8574_NODE_TYPE, NULL) == DDI_FAILURE) { - ddi_remove_minor_node(dip, NULL); - (void) pcf8574_do_detach(dip); - - return (DDI_FAILURE); - } - } - else - if (unitp->pcf8574_type == PCF8574_TYPE_FANTRAY) { - (void) sprintf(name, "fantray"); - if (ddi_create_minor_node(dip, name, S_IFCHR, instance, - PCF8574_NODE_TYPE, NULL) == DDI_FAILURE) { - ddi_remove_minor_node(dip, NULL); - (void) pcf8574_do_detach(dip); - - return (DDI_FAILURE); - } - } - else - if (unitp->pcf8574_type == PCF8574_TYPE_CPUVOLTAGE) { - (void) sprintf(name, "cpuvoltage"); - if (ddi_create_minor_node(dip, name, S_IFCHR, instance, - PCF8574_NODE_TYPE, NULL) == DDI_FAILURE) { - ddi_remove_minor_node(dip, NULL); - (void) pcf8574_do_detach(dip); - - return (DDI_FAILURE); - } - } else { - return (DDI_FAILURE); - } - - unitp->attach_flag |= PCF8574_MINORS_CREATED; - - /* - * Now we need read/write masks since all the 8574 bits can be either - * read/written, but some ports are intended to be RD/WR only, or RW - * If no channels-in-use propoerty, set default values. - */ - if (unitp->pcf8574_type == PCF8574_TYPE_FANTRAY) { - unitp->readmask = PCF8574_FAN_READMASK; - unitp->writemask = PCF8574_FAN_WRITEMASK; - } - if (unitp->pcf8574_type == PCF8574_TYPE_PWRSUPP) { - unitp->readmask = PCF8574_PS_READMASK; - unitp->writemask = PCF8574_PS_WRITEMASK; - } - - for (i = unitp->props.num_chans_used, - chp = unitp->props.channels_in_use; i; --i, ++chp) { - unitp->readmask |= (uint8_t)( - (chp->io_dir == I2C_PROP_IODIR_IN || - chp->io_dir == I2C_PROP_IODIR_INOUT) << chp->port); - unitp->writemask |= (uint8_t)( - (chp->io_dir == I2C_PROP_IODIR_OUT || - chp->io_dir == I2C_PROP_IODIR_INOUT) << chp->port); - } - -#ifdef DEBUG - cmn_err(CE_NOTE, "pcf8574_do_attach: readmask = 0x%x \ - writemask = 0x%x\n", unitp->readmask, unitp->writemask); -#endif /* DEBUG */ - - if (i2c_client_register(dip, &unitp->pcf8574_hdl) - != I2C_SUCCESS) { - (void) pcf8574_do_detach(dip); - return (DDI_FAILURE); - } - unitp->attach_flag |= PCF8574_REGISTER_CLIENT; - - /* - * Allocate the I2C_transfer structure. The same structure - * is used throughout the driver. - */ - if (i2c_transfer_alloc(unitp->pcf8574_hdl, &unitp->i2c_tran, - MAX_WLEN, MAX_RLEN, KM_SLEEP) != I2C_SUCCESS) { - (void) pcf8574_do_detach(dip); - return (DDI_FAILURE); - } - unitp->attach_flag |= PCF8574_ALLOC_TRANSFER; - - /* - * To begin with we set the mode to I2C_RD. - */ - unitp->i2c_tran->i2c_flags = I2C_RD; - unitp->i2c_tran->i2c_version = I2C_XFER_REV; - - /* - * Set the busy flag and open flag to 0. - */ - unitp->pcf8574_flags = 0; - unitp->pcf8574_oflag = 0; - - mutex_init(&unitp->umutex, NULL, MUTEX_DRIVER, NULL); - cv_init(&unitp->pcf8574_cv, NULL, CV_DRIVER, NULL); - - unitp->attach_flag |= PCF8574_LOCK_INIT; - - /* - * Register out callback function with the SCSB driver, and save - * the returned value to check that the device instance exists. - */ - dev_presence = scsb_fru_register(pcf8574_callback, (void *)unitp, - (fru_id_t)unitp->props.slave_address); - if (dev_presence == FRU_NOT_AVAILABLE) { - scsb_fru_unregister((void *)unitp, - (fru_id_t)unitp->props.slave_address); - } - - /* - * Add the kstats. First we need to get the property values - * depending on the device type. For example, for the fan - * tray there will be a different set of properties, and there - * will be another for the powersupplies, and another one for - * the CPU voltage monitor. Initialize the kstat structures with - * these values. - */ - - if (pcf8574_add_kstat(unitp, dev_presence) != DDI_SUCCESS) { - (void) pcf8574_do_detach(dip); - return (DDI_FAILURE); - } - - unitp->attach_flag |= PCF8574_KSTAT_INIT; - - /* - * Due to observed behavior on Solaris 8, the handler must be - * registered before any interrupts are enabled, - * in spite of what the ddi_get_iblock_cookie() manual says. - * As per the HW/SW spec, by default interrupts are disabled. - */ - - if (dev_presence == FRU_PRESENT) { /* program the chip */ - (void) pcf8574_init_chip(unitp, 0); /* Disable intr first */ - } - - if (unitp->pcf8574_canintr == PCF8574_INTR_ON) { -#ifdef DEBUG - if (pcf8574_debug & 0x0004) - cmn_err(CE_NOTE, "registering pcf9574 interrupt " - "handler"); -#endif /* DEBUG */ - if (scsb_intr_register(pcf8574_intr, (void *)unitp, - (fru_id_t)unitp->props.slave_address) == DDI_SUCCESS) { - unitp->pcf8574_canintr |= PCF8574_INTR_ENABLED; - unitp->attach_flag |= PCF8574_INTR_ADDED; - } else { - (void) pcf8574_do_detach(dip); - return (DDI_FAILURE); - } - } - - ddi_report_dev(dip); - - return (DDI_SUCCESS); -} - -static int -pcf8574_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) -{ - switch (cmd) { - case DDI_ATTACH: - return (pcf8574_do_attach(dip)); - case DDI_RESUME: - return (pcf8574_do_resume(dip)); - default: - return (DDI_FAILURE); - } -} - -static int -pcf8574_do_suspend(dev_info_t *dip) -{ - int instance = ddi_get_instance(dip); - struct pcf8574_unit *unitp = - ddi_get_soft_state(pcf8574_soft_statep, instance); - - if (unitp == NULL) { - return (ENXIO); - } - - /* - * Set the busy flag so that future transactions block - * until resume. - */ - CV_LOCK(ENXIO) - - return (DDI_SUCCESS); -} - -static int -pcf8574_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) -{ - switch (cmd) { - case DDI_DETACH: - return (pcf8574_do_detach(dip)); - case DDI_SUSPEND: - return (pcf8574_do_suspend(dip)); - default: - return (DDI_FAILURE); - } -} - -static int -pcf8574_chpoll(dev_t dev, short events, int anyyet, short *reventsp, - struct pollhead **phpp) -{ - struct pcf8574_unit *unitp; - int instance; - - instance = getminor(dev); - if ((unitp = (struct pcf8574_unit *)ddi_get_soft_state( - pcf8574_soft_statep, instance)) == NULL) { - return (ENXIO); - } - *reventsp = 0; - mutex_enter(&unitp->umutex); - if (unitp->poll_event) { - *reventsp = unitp->poll_event; - unitp->poll_event = 0; - } else if ((events & POLLIN) && !anyyet) - *phpp = &unitp->poll; - mutex_exit(&unitp->umutex); - return (0); -} - -/* - * In normal scenarios, this function should never get called. - * But, we will still come back and call this function if scsb - * interrupt sources does not indicate an scsb interrupt. We may - * come to this situation when SunVTS env4test is independently - * changing the device registers. - */ -uint_t -pcf8574_intr(caddr_t arg) -{ - int ic; - uint8_t value; - struct pcf8574_unit *unitp = (struct pcf8574_unit *)(void *)arg; - scsb_fru_status_t dev_presence; - i2c_transfer_t *tp = unitp->i2c_tran; - - ic = DDI_INTR_CLAIMED; -#ifdef DEBUG - cmn_err(CE_NOTE, " In the interrupt service routine, %x", - unitp->props.slave_address); -#endif - - /* - * Initiate an I2C transaction to find out - * whether this is the device which interrupted. - */ - mutex_enter(&unitp->umutex); - while (unitp->pcf8574_flags == PCF8574_BUSY) { - if (cv_wait_sig(&unitp->pcf8574_cv, &unitp->umutex) <= 0) { - mutex_exit(&unitp->umutex); - return (DDI_INTR_UNCLAIMED); - } - } - - unitp->pcf8574_flags = PCF8574_BUSY; - mutex_exit(&unitp->umutex); - - switch (unitp->pcf8574_type) { - case PCF8574_TYPE_CPUVOLTAGE: { - dev_presence = FRU_PRESENT; - break; - } - case PCF8574_TYPE_PWRSUPP: { - envctrl_pwrsupp_t *envp = - (envctrl_pwrsupp_t *)unitp->envctrl_kstat; - dev_presence = envp->ps_present; - break; - } - case PCF8574_TYPE_FANTRAY: { - envctrl_fantray_t *envp = - (envctrl_fantray_t *)unitp->envctrl_kstat; - dev_presence = envp->fan_present; - break; - } - } - if (dev_presence != FRU_PRESENT) { - ic = DDI_INTR_UNCLAIMED; - goto intr_exit; - } - if (pcf8574_read_chip(unitp, 1) != I2C_SUCCESS) { - ic = DDI_INTR_UNCLAIMED; - goto intr_exit; - } - value = unitp->i2c_tran->i2c_rbuf[0]; - /* - * If interrupt is already masked, return - */ - if (value & PCF8574_INTRMASK_BIT) { - ic = DDI_INTR_UNCLAIMED; - goto intr_exit; - } - - /* - * In case a fault bit is set, claim the interrupt. - */ - switch (unitp->pcf8574_type) { - case PCF8574_TYPE_PWRSUPP: - { - envctrl_pwrsupp_t *envp = - (envctrl_pwrsupp_t *)unitp->envctrl_kstat; - - if (PCF8574_PS_FAULT(value) || - PCF8574_PS_TEMPOK(value) || - PCF8574_PS_ONOFF(value) || - PCF8574_PS_FANOK(value)) { - - envp->ps_ok = PCF8574_PS_FAULT(value); - envp->temp_ok = PCF8574_PS_TEMPOK(value); - envp->psfan_ok = PCF8574_PS_FANOK(value); - envp->on_state = PCF8574_PS_ONOFF(value); - envp->ps_ver = PCF8574_PS_TYPE(value); - - tp->i2c_wbuf[0] = - PCF8574_PS_DEFAULT | PCF8574_PS_MASKINTR; - tp->i2c_wlen = 1; - tp->i2c_rlen = 0; - tp->i2c_flags = I2C_WR; - - unitp->i2c_status = - nct_i2c_transfer(unitp->pcf8574_hdl, tp); - - unitp->poll_event = POLLIN; - pollwakeup(&unitp->poll, POLLIN); - } else { - ic = DDI_INTR_UNCLAIMED; - } - } - break; - - case PCF8574_TYPE_FANTRAY: - { - envctrl_fantray_t *envp = - (envctrl_fantray_t *)unitp->envctrl_kstat; - - if (!PCF8574_FAN_FAULT(value)) { - - envp->fan_ver = PCF8574_FAN_TYPE(value); - envp->fan_ok = PCF8574_FAN_FAULT(value); - envp->fanspeed = PCF8574_FAN_FANSPD(value); - - tp->i2c_wbuf[0] = - PCF8574_FAN_DEFAULT | PCF8574_FAN_MASKINTR; - tp->i2c_wlen = 1; - tp->i2c_rlen = 0; - tp->i2c_flags = I2C_WR; - - unitp->i2c_status = - nct_i2c_transfer(unitp->pcf8574_hdl, tp); - - unitp->poll_event = POLLIN; - pollwakeup(&unitp->poll, POLLIN); - - } else { - ic = DDI_INTR_UNCLAIMED; - } - } - break; - - default: - ic = DDI_INTR_UNCLAIMED; - } /* switch */ - -intr_exit: - mutex_enter(&unitp->umutex); - unitp->pcf8574_flags = 0; - cv_signal(&unitp->pcf8574_cv); - mutex_exit(&unitp->umutex); - - return (ic); -} - -static int -call_copyin(caddr_t arg, struct pcf8574_unit *unitp, int mode) -{ - uchar_t *wbuf; - uchar_t *rbuf; - i2c_transfer_t i2ct; - i2c_transfer_t *i2ctp = unitp->i2c_tran; - - - if (ddi_copyin((void *)arg, (caddr_t)&i2ct, - sizeof (i2c_transfer_t), mode) != DDI_SUCCESS) { - return (I2C_FAILURE); - } - - /* - * Save the read and write buffer pointers in the transfer - * structure, otherwise these will get overwritten when we - * do a bcopy. Restore once done. - */ - - wbuf = i2ctp->i2c_wbuf; - rbuf = i2ctp->i2c_rbuf; - - bcopy(&i2ct, i2ctp, sizeof (i2c_transfer_t)); - - i2ctp->i2c_wbuf = wbuf; - i2ctp->i2c_rbuf = rbuf; - - /* - * copyin the read and write buffers to the saved buffers. - */ - - if (i2ct.i2c_wlen != 0) { - if (ddi_copyin(i2ct.i2c_wbuf, (caddr_t)i2ctp->i2c_wbuf, - i2ct.i2c_wlen, mode) != DDI_SUCCESS) { - return (I2C_FAILURE); - } - } - - return (I2C_SUCCESS); -} - -static int -call_copyout(caddr_t arg, struct pcf8574_unit *unitp, int mode) -{ - i2c_transfer_t i2ct; - i2c_transfer_t *i2ctp = unitp->i2c_tran; - - /* - * We will copyout the last three fields only, skipping - * the remaining ones, before copying the rbuf to the - * user buffer. - */ - - int uskip = sizeof (i2c_transfer_t) - 3*sizeof (int16_t), - kskip = sizeof (i2c_transfer_t) - 3*sizeof (int16_t); - - /* - * First copyin the user structure to the temporary i2ct, - * so that we have the wbuf and rbuf addresses in it. - */ - - uskip = sizeof (i2c_transfer_t) - 3 * (sizeof (uint16_t)); - - /* - * copyout the last three out fields now. - */ - - if (ddi_copyout((void *)((intptr_t)i2ctp+kskip), (void *) - ((intptr_t)arg + uskip), 3*sizeof (uint16_t), mode) - != DDI_SUCCESS) { - return (I2C_FAILURE); - } - - /* - * In case we have something to write, get the address of the read - * buffer. - */ - - if (i2ctp->i2c_rlen > i2ctp->i2c_r_resid) { - - if (ddi_copyin((void *)arg, &i2ct, - sizeof (i2c_transfer_t), mode) != DDI_SUCCESS) { - return (I2C_FAILURE); - } - - /* - * copyout the read buffer to the saved user buffer in i2ct. - */ - - if (ddi_copyout(i2ctp->i2c_rbuf, i2ct.i2c_rbuf, - i2ctp->i2c_rlen - i2ctp->i2c_r_resid, mode) - != DDI_SUCCESS) { - return (I2C_FAILURE); - } - } - - return (I2C_SUCCESS); -} - -/*ARGSUSED*/ -static int -pcf8574_ioctl(dev_t dev, int cmd, intptr_t arg, - int mode, cred_t *credp, int *rvalp) -{ - struct pcf8574_unit *unitp; - register int instance; - int err = 0; - uint8_t value, inval, outval; - scsb_fru_status_t dev_presence; - - instance = getminor(dev); - - if (instance < 0) { - return (ENXIO); - } - unitp = (struct pcf8574_unit *) - ddi_get_soft_state(pcf8574_soft_statep, instance); - - if (unitp == NULL) { - return (ENXIO); - } - - dev_presence = - scsb_fru_status((uchar_t)unitp->props.slave_address); - - CV_LOCK(EINTR) - - switch (cmd) { - case ENVC_IOC_INTRMASK: - if (dev_presence == FRU_NOT_PRESENT) { - break; - } - - if (ddi_copyin((caddr_t)arg, (caddr_t)&inval, - sizeof (uint8_t), mode) != DDI_SUCCESS) { - err = EFAULT; - break; - } - - if (inval != 0 && inval != 1) { - err = EINVAL; - } else { - unitp->i2c_tran->i2c_wbuf[0] = - PCF8574_INT_MASK(inval); - if (pcf8574_write_chip(unitp, 1, PCF8574_INTRMASK_BIT) - != I2C_SUCCESS) { - err = EFAULT; - } - } - break; - - case ENVC_IOC_SETFAN: - if (unitp->pcf8574_type != PCF8574_TYPE_FANTRAY) { - err = EINVAL; - break; - } - if (dev_presence == FRU_NOT_PRESENT) { - err = EINVAL; - break; - } - if (ddi_copyin((caddr_t)arg, (caddr_t)&inval, sizeof (uint8_t), - mode) != DDI_SUCCESS) { - err = EFAULT; - break; - } - if (inval != PCF8574_FAN_SPEED_LOW && - inval != PCF8574_FAN_SPEED_HIGH) { - err = EINVAL; - break; - } - - unitp->i2c_tran->i2c_wbuf[0] = PCF8574_FAN_SPEED(inval); - - if (pcf8574_write_chip(unitp, 1, PCF8574_FANSPEED_BIT) - != I2C_SUCCESS) { - err = EFAULT; - } - break; - - case ENVC_IOC_SETSTATUS: - /* - * Allow this ioctl only in DIAG mode. - */ - if (unitp->current_mode != ENVCTRL_DIAG_MODE) { - err = EINVAL; - } else { - if (dev_presence == FRU_NOT_PRESENT) { - err = EINVAL; - break; - } - if (ddi_copyin((caddr_t)arg, (caddr_t)&inval, - sizeof (uint8_t), mode) != DDI_SUCCESS) { - err = EFAULT; - } else { - unitp->i2c_tran->i2c_wbuf[0] = inval & 0xff; - if (pcf8574_write_chip(unitp, 1, 0xff) - != I2C_SUCCESS) { - err = EFAULT; - } - } - } - break; - - case ENVC_IOC_GETFAN: - case ENVC_IOC_GETSTATUS: - case ENVC_IOC_GETTYPE: - case ENVC_IOC_GETFAULT: - case ENVC_IOC_PSTEMPOK: - case ENVC_IOC_PSFANOK: - case ENVC_IOC_PSONOFF: { - if (dev_presence == FRU_NOT_PRESENT) { - err = EINVAL; - break; - } - if (pcf8574_read_chip(unitp, 1) - != I2C_SUCCESS) { - err = EFAULT; - break; - } - value = unitp->i2c_tran->i2c_rbuf[0]; - if (cmd == ENVC_IOC_GETFAN) { - if (unitp->pcf8574_type != PCF8574_TYPE_FANTRAY) { - err = EINVAL; - break; - } else { - outval = PCF8574_FAN_FANSPD(value); - } - } - else - if (cmd == ENVC_IOC_GETSTATUS) { - outval = value; - } - else - if (cmd == ENVC_IOC_GETTYPE) { - if (unitp->pcf8574_type == PCF8574_TYPE_PWRSUPP) - outval = PCF8574_PS_TYPE(value); - if (unitp->pcf8574_type == PCF8574_TYPE_FANTRAY) - outval = PCF8574_FAN_TYPE(value); - } - else - if (cmd == ENVC_IOC_GETFAULT) { - if (unitp->pcf8574_type == PCF8574_TYPE_PWRSUPP) - outval = PCF8574_PS_FAULT(value); - if (unitp->pcf8574_type == PCF8574_TYPE_FANTRAY) - outval = PCF8574_PS_FAULT(value); - } - else - if (cmd == ENVC_IOC_PSTEMPOK) { - outval = PCF8574_PS_TEMPOK(value); - } - else - if (cmd == ENVC_IOC_PSFANOK) { - outval = PCF8574_PS_FANOK(value); - } - else - if (cmd == ENVC_IOC_PSONOFF) { - outval = PCF8574_PS_ONOFF(value); - } else { - outval = 0; - } - - if (ddi_copyout((caddr_t)&outval, (caddr_t)arg, - sizeof (uint8_t), mode) != DDI_SUCCESS) { - err = EFAULT; - } - } - break; - - case ENVC_IOC_GETMODE: { - uint8_t curr_mode = unitp->current_mode; - - if (ddi_copyout((caddr_t)&curr_mode, (caddr_t)arg, - sizeof (uint8_t), mode) != DDI_SUCCESS) { - err = EFAULT; - } - break; - } - - case ENVC_IOC_SETMODE: { - uint8_t curr_mode; - if (ddi_copyin((caddr_t)arg, (caddr_t)&curr_mode, - sizeof (uint8_t), mode) != DDI_SUCCESS) { - err = EFAULT; - break; - } - if (curr_mode == ENVCTRL_DIAG_MODE || - curr_mode == ENVCTRL_NORMAL_MODE) { - unitp->current_mode = curr_mode; /* Don't do anything */ - } - break; - } - - - case I2CDEV_TRAN: - if (call_copyin((caddr_t)arg, unitp, mode) != DDI_SUCCESS) { - err = EFAULT; - break; - } - unitp->i2c_status = err = - nct_i2c_transfer(unitp->pcf8574_hdl, unitp->i2c_tran); - - if (err != I2C_SUCCESS) { - err = EIO; - } else { - if (call_copyout((caddr_t)arg, unitp, mode) - != DDI_SUCCESS) { - err = EFAULT; - break; - } - } - break; - - default: - err = EINVAL; - } - - CV_UNLOCK - - return (err); -} - -static int -pcf8574_add_kstat(struct pcf8574_unit *unitp, scsb_fru_status_t dev_presence) -{ - char ksname[50]; - int id; - uint8_t i2c_address = unitp->props.slave_address; - - /* - * We create the kstat depending on the device function, - * allocate the kstat placeholder and initialize the - * values. - */ - unitp->envctrl_kstat = NULL; - switch (unitp->pcf8574_type) { - case PCF8574_TYPE_CPUVOLTAGE: - { - if ((unitp->kstatp = kstat_create(I2C_PCF8574_NAME, - unitp->instance, I2C_KSTAT_CPUVOLTAGE, "misc", - KSTAT_TYPE_RAW, sizeof (envctrl_cpuvoltage_t), - KSTAT_FLAG_PERSISTENT)) != NULL) { - - if ((unitp->envctrl_kstat = kmem_zalloc( - sizeof (envctrl_cpuvoltage_t), KM_NOSLEEP)) == - NULL) { - kstat_delete(unitp->kstatp); - return (DDI_FAILURE); - } - } else { - return (DDI_FAILURE); - } - - break; - } - case PCF8574_TYPE_PWRSUPP: - { - envctrl_pwrsupp_t *envp; - if (i2c_address == PCF8574_ADR_PWRSUPPLY1) { - id = 1; - } else if (i2c_address == PCF8574_ADR_PWRSUPPLY2) { - id = 2; - } else { - id = i2c_address - PCF8574_ADR_PWRSUPPLY1; - } - (void) sprintf(ksname, "%s%d", I2C_KSTAT_PWRSUPPLY, id); - if ((unitp->kstatp = kstat_create(I2C_PCF8574_NAME, - unitp->instance, ksname, "misc", - KSTAT_TYPE_RAW, sizeof (envctrl_pwrsupp_t), - KSTAT_FLAG_PERSISTENT)) != NULL) { - - if ((unitp->envctrl_kstat = kmem_zalloc( - sizeof (envctrl_pwrsupp_t), KM_NOSLEEP)) == - NULL) { - kstat_delete(unitp->kstatp); - return (DDI_FAILURE); - } - /* - * Initialize the kstat fields. Need to initialize - * the present field from SCSB info (dev_presence) - */ - envp = (envctrl_pwrsupp_t *)unitp->envctrl_kstat; - - envp->ps_present = dev_presence; - envp->ps_ok = 0; - envp->temp_ok = 0; - envp->psfan_ok = 0; - envp->on_state = 0; - envp->ps_ver = 0; - } else { - return (DDI_FAILURE); - } - - break; - } - case PCF8574_TYPE_FANTRAY: - { - envctrl_fantray_t *envp; - if (i2c_address == PCF8574_ADR_FANTRAY1) { - id = 1; - } else if (i2c_address == PCF8574_ADR_FANTRAY2) { - id = 2; - } else { - id = i2c_address - PCF8574_ADR_FANTRAY1; - } - (void) sprintf(ksname, "%s%d", I2C_KSTAT_FANTRAY, id); - if ((unitp->kstatp = kstat_create(I2C_PCF8574_NAME, - unitp->instance, ksname, "misc", - KSTAT_TYPE_RAW, sizeof (envctrl_fantray_t), - KSTAT_FLAG_PERSISTENT | KSTAT_FLAG_WRITABLE)) != NULL) { - - if ((unitp->envctrl_kstat = kmem_zalloc( - sizeof (envctrl_fantray_t), KM_NOSLEEP)) == - NULL) { - kstat_delete(unitp->kstatp); - return (DDI_FAILURE); - } - - /* - * Initialize the kstat fields. Need to initialize - * the present field from SCSB info (dev_presence) - */ - envp = (envctrl_fantray_t *)unitp->envctrl_kstat; - - envp->fan_present = dev_presence; - envp->fan_ok = 0; - envp->fanspeed = PCF8574_FAN_SPEED60; - envp->fan_ver = 0; - } else { - return (DDI_FAILURE); - } - - break; - } - default: - return (DDI_FAILURE); - } - - unitp->kstatp->ks_private = (void *)unitp; - unitp->kstatp->ks_update = pcf8574_kstat_update; - - kstat_install(unitp->kstatp); - - return (DDI_SUCCESS); -} - -/* - * This function reads a single byte from the pcf8574 chip, for use by the - * kstat routines. The protocol for read will depend on the function. - */ - -static int -pcf8574_read_chip(struct pcf8574_unit *unitp, uint16_t size) -{ - int retval, i; - i2c_transfer_t *tp = unitp->i2c_tran; - - - tp->i2c_flags = I2C_RD; - tp->i2c_rlen = size; - tp->i2c_wlen = 0; - - /* - * Read the bytes from the pcf8574, mask off the - * non-read bits and return the value. Block with - * the driverwide lock. - */ - unitp->i2c_status = retval = - nct_i2c_transfer(unitp->pcf8574_hdl, unitp->i2c_tran); - - if (retval != I2C_SUCCESS) { - return (retval); - } - - for (i = 0; i < size; i++) { - tp->i2c_rbuf[i] &= unitp->readmask; - } - - return (I2C_SUCCESS); -} - -/* - * This function writes a single byte to the pcf8574 chip, for use by the - * ioctl routines. The protocol for write will depend on the function. - * The bitpattern tells which bits are being modified, by setting these - * bits in bitpattern to 1, e.g for fanspeed, bitpattern = 0x08, fanspeed - * and intr 0x0c, only intr 0x04. - */ - -static int -pcf8574_write_chip(struct pcf8574_unit *unitp, - uint16_t size, uint8_t bitpattern) -{ - i2c_transfer_t *tp = unitp->i2c_tran; - int i; - - /* - * pcf8574_write - * - * First read the byte, modify only the writable - * ports, then write back the modified data. - */ - tp->i2c_wlen = 0; - tp->i2c_rlen = size; - tp->i2c_flags = I2C_RD; - - unitp->i2c_status = nct_i2c_transfer(unitp->pcf8574_hdl, tp); - - if (unitp->i2c_status != I2C_SUCCESS) { - return (I2C_FAILURE); - } - - /* - * Our concern is when we have to write only a few bits. - * We need to make sure we write the same value to those - * bit positions which does not appear in bitpattern. - */ - - /* - * 1) Ignore all bits than the one we are writing - * 2) Now 0 the bits we intend to modify in the value - * read from the chip, preserving all others. - * 3) Now turn all non-writable ( read only/reserved ) - * bits to 1. The value now should contain: - * 1 in all non-writable bits. - * 0 in the bis(s) we intend to modify. - * no change in the writable bits we don't modify. - * 4) Now OR it with the bits we got before, i.e. after - * ignoring all bits other than one we are writing. - */ - - for (i = 0; i < size; i++) { - tp->i2c_rbuf[i] &= ~(bitpattern); - - tp->i2c_rbuf[i] |= ~(unitp->writemask); - - tp->i2c_wbuf[i] = tp->i2c_rbuf[i] | - (tp->i2c_wbuf[i] & bitpattern); - } - - tp->i2c_rlen = 0; - tp->i2c_wlen = size; - tp->i2c_flags = I2C_WR; - - unitp->i2c_status = nct_i2c_transfer(unitp->pcf8574_hdl, tp); - - return (unitp->i2c_status); -} - -static int -pcf8574_kstat_update(kstat_t *ksp, int rw) -{ - struct pcf8574_unit *unitp; - char *kstatp; - uint8_t value; - int err = DDI_SUCCESS; - scsb_fru_status_t dev_presence; - - unitp = (struct pcf8574_unit *)ksp->ks_private; - if (unitp->envctrl_kstat == NULL) { /* May be detaching */ - return (err); - } - - CV_LOCK(EINTR) - - /* - * Need to call scsb to find whether device is present. - * For I2C devices, the I2C address is used as a FRU ID. - */ - if (unitp->pcf8574_type == PCF8574_TYPE_CPUVOLTAGE) { - dev_presence = FRU_PRESENT; - } else { - dev_presence = - scsb_fru_status((uchar_t)unitp->props.slave_address); - } - - kstatp = (char *)ksp->ks_data; - - /* - * We could have write on the power supply and the fantray - * pcf8574 chips. For masking the interrupt on both, or - * controlling the fan speed on the fantray. But write - * will not be allowed through the kstat interface. For - * the present field, call SCSB. - */ - - if (rw == KSTAT_WRITE) { - if (unitp->pcf8574_type != PCF8574_TYPE_FANTRAY) { - err = EACCES; - goto kstat_exit; - } - value = ((envctrl_fantray_t *)kstatp)->fanspeed; - if (value != PCF8574_FAN_SPEED_LOW && - value != PCF8574_FAN_SPEED_HIGH) { - err = EINVAL; - goto kstat_exit; - } - - unitp->i2c_tran->i2c_wbuf[0] = PCF8574_FAN_SPEED(value); - - if (dev_presence == FRU_PRESENT && - pcf8574_write_chip(unitp, 1, PCF8574_FANSPEED_BIT) - != I2C_SUCCESS) { - err = EFAULT; - goto kstat_exit; - } - - } else { - /* - * First make sure that the FRU exists by checking the SCSB - * dev_presence info. If not present, set the change field, - * clear the kstat fields and make sure the kstat *_present - * field is set to dev_presence from the SCSB driver. - */ - if (dev_presence == FRU_PRESENT && - pcf8574_read_chip(unitp, 1) != I2C_SUCCESS) { - /* - * Looks like a real IO error. - */ - err = EIO; - CV_UNLOCK - - return (err); - } - if (dev_presence == FRU_PRESENT) - value = unitp->i2c_tran->i2c_rbuf[0]; - else - value = 0; - - switch (unitp->pcf8574_type) { - case PCF8574_TYPE_CPUVOLTAGE: { - envctrl_cpuvoltage_t *envp = - (envctrl_cpuvoltage_t *)unitp->envctrl_kstat; - envp->value = value; - bcopy((caddr_t)envp, kstatp, - sizeof (envctrl_cpuvoltage_t)); - - break; - } - case PCF8574_TYPE_PWRSUPP: { - envctrl_pwrsupp_t *envp = - (envctrl_pwrsupp_t *)unitp->envctrl_kstat; - - envp->ps_present = dev_presence; - envp->ps_ok = PCF8574_PS_FAULT(value); - envp->temp_ok = PCF8574_PS_TEMPOK(value); - envp->psfan_ok = PCF8574_PS_FANOK(value); - envp->on_state = PCF8574_PS_ONOFF(value); - envp->ps_ver = PCF8574_PS_TYPE(value); - - bcopy((caddr_t)envp, kstatp, - sizeof (envctrl_pwrsupp_t)); - - break; - } - case PCF8574_TYPE_FANTRAY: { - envctrl_fantray_t *envp = - (envctrl_fantray_t *)unitp->envctrl_kstat; - - envp->fan_present = dev_presence; - envp->fan_ver = PCF8574_FAN_TYPE(value); - envp->fan_ok = PCF8574_FAN_FAULT(value); - envp->fanspeed = PCF8574_FAN_FANSPD(value); - - bcopy((caddr_t)unitp->envctrl_kstat, kstatp, - sizeof (envctrl_fantray_t)); - - break; - } - - default: - break; - } - } - -kstat_exit: - - CV_UNLOCK - - return (err); -} - -static void -pcf8574_delete_kstat(struct pcf8574_unit *unitp) -{ - /* - * Depending on the function, deallocate the correct - * kernel allocated memory. - */ - if (unitp->kstatp != NULL) { - kstat_delete(unitp->kstatp); - } - - switch (unitp->pcf8574_type) { - case PCF8574_TYPE_CPUVOLTAGE: { - if (unitp->envctrl_kstat != NULL) { - kmem_free(unitp->envctrl_kstat, - sizeof (envctrl_cpuvoltage_t)); - } - break; - } - case PCF8574_TYPE_PWRSUPP: { - if (unitp->envctrl_kstat != NULL) { - kmem_free(unitp->envctrl_kstat, - sizeof (envctrl_pwrsupp_t)); - } - - break; - } - case PCF8574_TYPE_FANTRAY: { - if (unitp->envctrl_kstat != NULL) { - kmem_free(unitp->envctrl_kstat, - sizeof (envctrl_fantray_t)); - } - break; - } - default: - break; - } - - unitp->envctrl_kstat = NULL; -} - -static int -pcf8574_read_props(struct pcf8574_unit *unitp) -{ - dev_info_t *dip = unitp->dip; - int retval = 0, prop_len; - uint32_t *prop_value = NULL; - uint8_t i2c_address; - char *function; - - /* - * read the pcf8574_function property. If this property is not - * found, return ERROR. Else, make sure it's either powersupply - * or fantray. - */ - - if (ddi_prop_lookup_string(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, - "pcf8574_function", &function) != DDI_SUCCESS) { - dbg_print(CE_WARN, "Couldn't find pcf8574_function property"); - - return (DDI_FAILURE); - } - - if (strcmp(function, "fantray") == 0) { - unitp->pcf8574_type = PCF8574_TYPE_FANTRAY; - /* - * Will fail the fantray attach if patch - 1. - */ - if (nct_p10fan_patch) { -#ifdef DEBUG - cmn_err(CE_WARN, "nct_p10fan_patch set: will not load " - "fantary:address %x,%x", unitp->props.i2c_bus, - unitp->props.slave_address); -#endif - ddi_prop_free(function); - return (DDI_FAILURE); - } - } else - if (strcmp(function, "powersupply") == 0) { - unitp->pcf8574_type = PCF8574_TYPE_PWRSUPP; - } else { - dbg_print(CE_WARN, "Neither powersupply nor fantray"); - ddi_prop_free(function); - - return (DDI_FAILURE); - } - - ddi_prop_free(function); - - retval = ddi_getlongprop(DDI_DEV_T_ANY, dip, - DDI_PROP_DONTPASS | DDI_PROP_CANSLEEP, - "reg", (caddr_t)&prop_value, &prop_len); - if (retval == DDI_PROP_SUCCESS) { - unitp->props.i2c_bus = (uint16_t)prop_value[0]; - unitp->props.slave_address = i2c_address = - (uint8_t)prop_value[1]; - kmem_free(prop_value, prop_len); - - if (i2c_address>>4 == 7) - unitp->sensor_type = PCF8574A; - else if (i2c_address>>4 == 4) - unitp->sensor_type = PCF8574; - else { - unitp->sensor_type = PCF8574A; - dbg_print(CE_WARN, "Not a pcf8574/a device"); - } - - } else { - unitp->props.i2c_bus = (uint16_t)-1; - unitp->props.slave_address = (uint16_t)-1; - } - - /* - * Get the Property information that the driver will be using - * see typedef struct pcf8574_properties_t; - */ - - unitp->pcf8574_canintr = 0; - retval = ddi_prop_get_int(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, - "interrupts", -1); - if (retval >= 0) { - int prop_len, intr_pri = 4; - unitp->pcf8574_canintr |= PCF8574_INTR_ON; - if (ddi_getproplen(DDI_DEV_T_ANY, dip, - DDI_PROP_DONTPASS, "interrupt-priorities", - &prop_len) == DDI_PROP_NOT_FOUND) { - retval = ddi_prop_create(DDI_DEV_T_NONE, dip, - DDI_PROP_CANSLEEP, "interrupt-priorities", - (caddr_t)&intr_pri, sizeof (int)); -#ifdef DEBUG - if (retval != DDI_PROP_SUCCESS) { - cmn_err(CE_WARN, "Failed to create interrupt- \ - priorities property, retval %d", retval); - } -#endif /* DEBUG */ - } - } - - /* - * No channels-in-use property for the fan and powersupplies. - */ - unitp->props.num_chans_used = 0; - if (i2c_address == PCF8574_ADR_CPUVOLTAGE) { - if (ddi_getproplen(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, - "channels-in-use", &prop_len) == DDI_PROP_SUCCESS) { - retval = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, - dip, DDI_PROP_DONTPASS, - "channels-in-use", - (uchar_t **)&unitp->props.channels_in_use, - &unitp->props.num_chans_used); - if (retval != DDI_PROP_SUCCESS) { - unitp->props.num_chans_used = 0; - } else { - unitp->props.num_chans_used /= - sizeof (pcf8574_channel_t); - } - } - } - - return (DDI_PROP_SUCCESS); -} - -/* - * callback function to register with the SCSB driver in order to be - * informed about changes in device instance presence. - */ -/*ARGSUSED*/ -void -pcf8574_callback(void *softstate, scsb_fru_event_t cb_event, - scsb_fru_status_t dev_presence) -{ - struct pcf8574_unit *unitp = (struct pcf8574_unit *)softstate; -#ifdef DEBUG - if (pcf8574_debug & 0x00800001) - cmn_err(CE_NOTE, "pcf8574_callback(unitp,%d,%d)", - (int)cb_event, (int)dev_presence); -#endif /* DEBUG */ - - switch (unitp->pcf8574_type) { - case PCF8574_TYPE_CPUVOLTAGE: { - /* - * This Unit is not Field Replacable and will not - * generate any events at the SCB. - */ - break; - } - case PCF8574_TYPE_PWRSUPP: { - envctrl_pwrsupp_t *envp; - - envp = (envctrl_pwrsupp_t *)unitp->envctrl_kstat; - if (dev_presence == FRU_NOT_PRESENT) { - envp->ps_ok = 0; - envp->temp_ok = 0; - envp->psfan_ok = 0; - envp->on_state = 0; - envp->ps_ver = 0; - } else - if (dev_presence == FRU_PRESENT && - envp->ps_present == FRU_NOT_PRESENT) { - (void) pcf8574_init_chip(unitp, 0); - } - envp->ps_present = dev_presence; - unitp->poll_event = POLLIN; - pollwakeup(&unitp->poll, POLLIN); - break; - } - case PCF8574_TYPE_FANTRAY: { - envctrl_fantray_t *envp; - - envp = (envctrl_fantray_t *)unitp->envctrl_kstat; - - if (dev_presence == FRU_NOT_PRESENT) { - envp->fan_ok = 0; - envp->fanspeed = PCF8574_FAN_SPEED60; - envp->fan_ver = 0; - } else - if (dev_presence == FRU_PRESENT && - envp->fan_present == FRU_NOT_PRESENT) { - (void) pcf8574_init_chip(unitp, 0); - } - envp->fan_present = dev_presence; - unitp->poll_event = POLLIN; - pollwakeup(&unitp->poll, POLLIN); - break; - } - } -} - -/* - * Initializes the chip after attach or after being inserted. - * intron = 0 => disable interrupt. - * intron = 1 => read register, enable interrupt if no fault. - */ - -static int -pcf8574_init_chip(struct pcf8574_unit *unitp, int intron) -{ - int ret = I2C_SUCCESS; - i2c_transfer_t *tp = unitp->i2c_tran; - uint8_t value = 0; - boolean_t device_faulty = B_FALSE; /* true is faulty */ - - if (unitp->pcf8574_type != PCF8574_TYPE_PWRSUPP && - unitp->pcf8574_type != PCF8574_TYPE_FANTRAY) { - return (ret); - } - switch (unitp->pcf8574_type) { - case PCF8574_TYPE_PWRSUPP: - tp->i2c_wbuf[0] = PCF8574_PS_DEFAULT; - - break; - case PCF8574_TYPE_FANTRAY: - tp->i2c_wbuf[0] = PCF8574_FAN_DEFAULT; - - break; - default: - break; - } - - /* - * First, read the device. If the device is faulty, it does - * not make sense to enable the interrupt, so in this case - * keep interrupt maskked inspite of what "intron" says. - */ - - tp->i2c_wlen = 0; - tp->i2c_rlen = 1; - tp->i2c_flags = I2C_RD; - - unitp->i2c_status = ret = nct_i2c_transfer(unitp->pcf8574_hdl, tp); - - if (ret != I2C_SUCCESS) { - return (ret); - } - - value = tp->i2c_rbuf[0]; - - switch (unitp->pcf8574_type) { - case PCF8574_TYPE_PWRSUPP: - { - envctrl_pwrsupp_t *envp = - (envctrl_pwrsupp_t *)unitp->envctrl_kstat; - - envp->ps_ok = PCF8574_PS_FAULT(value); - envp->temp_ok = PCF8574_PS_TEMPOK(value); - envp->psfan_ok = PCF8574_PS_FANOK(value); - envp->on_state = PCF8574_PS_ONOFF(value); - envp->ps_ver = PCF8574_PS_TYPE(value); - - if (envp->ps_ok || envp->temp_ok || - envp->psfan_ok || envp->on_state) - device_faulty = B_TRUE; - - break; - } - case PCF8574_TYPE_FANTRAY: - { - envctrl_fantray_t *envp = - (envctrl_fantray_t *)unitp->envctrl_kstat; - - envp->fan_ver = PCF8574_FAN_TYPE(value); - envp->fan_ok = PCF8574_FAN_FAULT(value); - envp->fanspeed = PCF8574_FAN_FANSPD(value); - - if (!envp->fan_ok) - device_faulty = B_TRUE; /* remember, 0 is faulty */ - - break; - } - default: - break; - } - /* - * Mask interrupt, if intron = 0. - */ - if (!intron || device_faulty == B_TRUE) { - tp->i2c_wbuf[0] |= PCF8574_INTRMASK_BIT; - } - - tp->i2c_wlen = 1; - tp->i2c_rlen = 0; - tp->i2c_flags = I2C_WR; - - unitp->i2c_status = nct_i2c_transfer(unitp->pcf8574_hdl, tp); - - return (unitp->i2c_status); -} diff --git a/usr/src/uts/sun4u/montecarlo/io/pcf8591_nct.c b/usr/src/uts/sun4u/montecarlo/io/pcf8591_nct.c deleted file mode 100644 index 2ec1b326ab..0000000000 --- a/usr/src/uts/sun4u/montecarlo/io/pcf8591_nct.c +++ /dev/null @@ -1,1239 +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 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - * Copyright (c) 2011 Bayard G. Bell. All rights reserved. - */ - -/* - * I2C leaf driver for the PCF8591 - */ - -#include <sys/param.h> -#include <sys/types.h> -#include <sys/signal.h> -#include <sys/errno.h> -#include <sys/file.h> -#include <sys/termio.h> -#include <sys/termios.h> -#include <sys/cmn_err.h> -#include <sys/stream.h> -#include <sys/strsun.h> -#include <sys/stropts.h> -#include <sys/strtty.h> -#include <sys/debug.h> -#include <sys/eucioctl.h> -#include <sys/cred.h> -#include <sys/uio.h> -#include <sys/stat.h> -#include <sys/kmem.h> - -#include <sys/ddi.h> -#include <sys/sunddi.h> -#include <sys/obpdefs.h> -#include <sys/conf.h> -#include <sys/modctl.h> -#include <sys/stat.h> -#include <sys/open.h> -#include <sys/uio.h> - -#include <sys/i2c/misc/i2c_svc.h> -#include <sys/envctrl_gen.h> -#include <sys/netract_gen.h> -#include <sys/pcf8591_nct.h> - - -/* - * CONTROL OF CHIP - * PCF8591 Temp sensing control register definitions - * - * --------------------------------------------- - * | 0 | AOE | X | X | 0 | AIF | X | X | - * --------------------------------------------- - * AOE = Analog out enable.. not used on out implementation - * 5 & 4 = Analog Input Programming.. see data sheet for bits.. - * - * AIF = Auto increment flag - * bits 1 & 0 are for the Chennel number. - */ - - -#define I2CTRANS_DATA 0 -#define I2CRAW_DATA 1 -#define TEMP_TABLE_SIZE 256 - -#define SHUTDOWN_TEMP_MIN 55 -#define SHUTDOWN_TEMP_MAX 85 - -#ifdef DEBUG -#define dbg_print(level, str) cmn_err(level, str); -#else -#define dbg_print(level, str) {; } -#endif - - -extern int nct_i2c_transfer(i2c_client_hdl_t i2c_hdl, i2c_transfer_t *i2c_tran); -static uchar_t _cpu_temps[TEMP_TABLE_SIZE + 4]; /* see attach */ - -static void *pcf8591_soft_statep; - -/* - * cb ops (only need ioctl) - */ -static int pcf8591_open(dev_t *, int, int, cred_t *); -static int pcf8591_close(dev_t, int, int, cred_t *); -static int pcf8591_read(dev_t dev, struct uio *uiop, cred_t *cred_p); -static int pcf8591_ioctl(dev_t, int, intptr_t, int, cred_t *, int *); - -static struct cb_ops pcf8591_cbops = { - pcf8591_open, /* open */ - pcf8591_close, /* close */ - nodev, /* strategy */ - nodev, /* print */ - nodev, /* dump */ - pcf8591_read, /* read */ - nodev, /* write */ - pcf8591_ioctl, /* ioctl */ - nodev, /* devmap */ - nodev, /* mmap */ - nodev, /* segmap */ - nochpoll, /* poll */ - ddi_prop_op, /* cb_prop_op */ - NULL, /* streamtab */ - D_NEW | D_MP | D_HOTPLUG, /* Driver compatibility flag */ - CB_REV, /* rev */ - nodev, /* int (*cb_aread)() */ - nodev /* int (*cb_awrite)() */ -}; - -/* - * dev ops - */ -static int pcf8591_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, - void **result); -static int pcf8591_attach(dev_info_t *dip, ddi_attach_cmd_t cmd); -static int pcf8591_detach(dev_info_t *dip, ddi_detach_cmd_t cmd); - -/* kstat routines */ -static int pcf8591_add_kstats(struct pcf8591_unit *); -static void pcf8591_delete_kstats(struct pcf8591_unit *); -static int pcf8591_temp_kstat_update(kstat_t *, int); -static int pcf8591_read_chip(struct pcf8591_unit *, uint8_t, int); -static int pcf8591_read_props(struct pcf8591_unit *unitp); - -static struct dev_ops pcf8591_ops = { - DEVO_REV, - 0, - pcf8591_info, - nulldev, - nulldev, - pcf8591_attach, - pcf8591_detach, - nodev, - &pcf8591_cbops, - NULL, - NULL, - ddi_quiesce_not_supported, /* devo_quiesce */ -}; - -extern struct mod_ops mod_driverops; - -static struct modldrv pcf8591_modldrv = { - &mod_driverops, /* type of module - driver */ - "Netract pcf8591 (adio)", - &pcf8591_ops, -}; - -static struct modlinkage pcf8591_modlinkage = { - MODREV_1, - &pcf8591_modldrv, - 0 -}; - -int pcf8591_debug = 0x02; -static uint8_t translate_cputemp(uint8_t value); - -int -_init(void) -{ - register int error; - - error = mod_install(&pcf8591_modlinkage); - if (error == 0) { - (void) ddi_soft_state_init(&pcf8591_soft_statep, - sizeof (struct pcf8591_unit), PCF8591_MAX_DEVS); - } - - return (error); -} - -int -_fini(void) -{ - register int error; - - error = mod_remove(&pcf8591_modlinkage); - if (error == 0) { - ddi_soft_state_fini(&pcf8591_soft_statep); - } - - return (error); -} - -int -_info(struct modinfo *modinfop) -{ - return (mod_info(&pcf8591_modlinkage, modinfop)); -} - -/*ARGSUSED*/ -static int -pcf8591_open(dev_t *devp, int flags, int otyp, cred_t *credp) -{ - int err = 0; - struct pcf8591_unit *unitp; - minor_t minor = getminor(*devp); - - int instance = PCF8591_MINOR_TO_DEVINST(minor); - int channel = PCF8591_MINOR_TO_CHANNEL(minor); - - if (instance < 0) { - return (ENXIO); - } - - unitp = (struct pcf8591_unit *) - ddi_get_soft_state(pcf8591_soft_statep, instance); - - if (unitp == NULL) { - return (ENXIO); - } - - if (otyp != OTYP_CHR) { - return (EINVAL); - } - - mutex_enter(&unitp->umutex); - - if (flags & FEXCL) { - if (unitp->pcf8591_oflag[channel] != 0) { - err = EBUSY; - } else { - unitp->pcf8591_oflag[channel] = FEXCL; - } - } else { - if (unitp->pcf8591_oflag[channel] == FEXCL) { - err = EBUSY; - } else { - unitp->pcf8591_oflag[channel] = FOPEN; - } - } - - mutex_exit(&unitp->umutex); - - return (err); -} - -/*ARGSUSED*/ -static int -pcf8591_close(dev_t devp, int flags, int otyp, cred_t *credp) -{ - struct pcf8591_unit *unitp; - minor_t minor = getminor(devp); - - int instance = PCF8591_MINOR_TO_DEVINST(minor); - int channel = PCF8591_MINOR_TO_CHANNEL(minor); - -#ifdef lint - flags = flags; - otyp = otyp; -#endif - - if (instance < 0) { - return (ENXIO); - } - - unitp = (struct pcf8591_unit *) - ddi_get_soft_state(pcf8591_soft_statep, instance); - - if (unitp == NULL) { - return (ENXIO); - } - - mutex_enter(&unitp->umutex); - - unitp->pcf8591_oflag[channel] = 0; - - mutex_exit(&unitp->umutex); - - return (DDI_SUCCESS); -} - -static int -pcf8591_io(dev_t dev, struct uio *uiop, int rw) -{ - int err = 0; - struct pcf8591_unit *unitp; - minor_t minor = getminor(dev); - - int instance = PCF8591_MINOR_TO_DEVINST(minor); - int channel = PCF8591_MINOR_TO_CHANNEL(minor); - - int bytes_to_rw; - int translate = 0; - - /* - * At this point we don't have a write operation to pcf8591. - */ - if (rw == B_WRITE) { - return (EACCES); - } - - if (instance < 0) { - return (ENXIO); - } - - unitp = (struct pcf8591_unit *) - ddi_get_soft_state(pcf8591_soft_statep, instance); - if (unitp == NULL) { - return (ENXIO); - } - - if ((bytes_to_rw = uiop->uio_resid) > PCF8591_TRAN_SIZE) { - return (EINVAL); - } - - /* - * Need to serialize all read operations, since there is a single - * i2c_transfer_t structure allocated for all read and write ops. - * We can't share the i2c bus among multiple transactions anyway, - * so this does not affect performance. - */ - mutex_enter(&unitp->umutex); - while (unitp->pcf8591_flags == PCF8591_BUSY) { - if (cv_wait_sig(&unitp->pcf8591_cv, &unitp->umutex) <= 0) { - mutex_exit(&unitp->umutex); - - return (EINTR); - } - } - unitp->pcf8591_flags = PCF8591_BUSY; - mutex_exit(&unitp->umutex); - - if (bytes_to_rw == 1) - translate = 1; - /* - * Event sequence: - * 1. set up the control register write, for now we'll always read - * channel 0, which is the only active 8591 port on the Nordica - * TODO: We'll need a minor node for each port that is used. - * 2. increment read count to read the throw-away byte - * 3. start the write/read of control/data registers - * 4. throw the first byte away - * 5. then return the data - */ - - unitp->i2c_tran->i2c_flags = I2C_WR_RD; - unitp->i2c_tran->i2c_wlen = 1; - unitp->i2c_tran->i2c_wbuf[0] = (unitp->pcf8591_inprog | - channel); - /* - * read extra byte to throw away the first, (PCF8591 datasheet) - */ - unitp->i2c_tran->i2c_rlen = bytes_to_rw + 1; - - if (nct_i2c_transfer(unitp->pcf8591_hdl, - unitp->i2c_tran) != I2C_SUCCESS) { - err = EIO; - } else { - /* - * Throw away the first byte according to PCF8591 datasheet - * If translating, use the second byte. - */ - if (translate) { - unitp->i2c_tran->i2c_rbuf[0] = - translate_cputemp(unitp->i2c_tran->i2c_rbuf[1]); - } else { - unitp->i2c_tran->i2c_rbuf[0] = - unitp->i2c_tran->i2c_rbuf[1]; - unitp->i2c_tran->i2c_rbuf[1] = 0; - } - - err = uiomove(unitp->i2c_tran->i2c_rbuf, - bytes_to_rw, - UIO_READ, - uiop); - } - mutex_enter(&unitp->umutex); - unitp->pcf8591_flags = 0; - cv_signal(&unitp->pcf8591_cv); - mutex_exit(&unitp->umutex); - - return (err); -} - -/*ARGSUSED*/ -static int -pcf8591_read(dev_t dev, struct uio *uiop, cred_t *cred_p) -{ - return (pcf8591_io(dev, uiop, B_READ)); -} - -static int -call_copyin(caddr_t arg, struct pcf8591_unit *unitp, int mode) -{ - uchar_t *wbuf; - uchar_t *rbuf; - i2c_transfer_t i2ct; - i2c_transfer_t *i2ctp = unitp->i2c_tran; - - - if (ddi_copyin((void *)arg, (caddr_t)&i2ct, - sizeof (i2c_transfer_t), mode) != DDI_SUCCESS) { - return (I2C_FAILURE); - } - - /* - * Save the read and write buffer pointers in the transfer - * structure, otherwise these will get overwritten when we - * do a bcopy. Restore once done. - */ - - wbuf = i2ctp->i2c_wbuf; - rbuf = i2ctp->i2c_rbuf; - - bcopy(&i2ct, i2ctp, sizeof (i2c_transfer_t)); - - i2ctp->i2c_wbuf = wbuf; - i2ctp->i2c_rbuf = rbuf; - - /* - * copyin the read and write buffers to the saved buffers. - */ - - if (i2ct.i2c_wlen != 0) { - if (ddi_copyin(i2ct.i2c_wbuf, (caddr_t)i2ctp->i2c_wbuf, - i2ct.i2c_wlen, mode) != DDI_SUCCESS) { - return (I2C_FAILURE); - } - } - - return (I2C_SUCCESS); -} - -static int -call_copyout(caddr_t arg, struct pcf8591_unit *unitp, int mode) -{ - i2c_transfer_t i2ct; - i2c_transfer_t *i2ctp = unitp->i2c_tran; - uint16_t i2c_actlen; - - /* - * We will copyout the last three fields only, skipping - * the remaining ones, before copying the rbuf to the - * user buffer. - */ - - int uskip = sizeof (i2c_transfer_t) - 3*sizeof (int16_t), - kskip = sizeof (i2c_transfer_t) - 3*sizeof (int16_t); - - /* - * First copyin the user structure to the temporary i2ct, - * so that we have the wbuf and rbuf addresses in it. - */ - - uskip = sizeof (i2c_transfer_t) - 3 * (sizeof (uint16_t)); - - /* - * copyout the last three out fields now. - */ - - if (ddi_copyout((void *)((intptr_t)i2ctp+kskip), (void *) - ((intptr_t)arg + uskip), 3*sizeof (uint16_t), mode) - != DDI_SUCCESS) { - return (I2C_FAILURE); - } - - /* - * In case we have something to write, get the address of the read - * buffer. - */ - - if (i2ctp->i2c_rlen - i2ctp->i2c_r_resid > 0) { - - if (ddi_copyin((void *)arg, &i2ct, - sizeof (i2c_transfer_t), mode) != DDI_SUCCESS) { - return (I2C_FAILURE); - } - - /* - * copyout the read buffer to the saved user buffer in i2ct. - */ - - i2c_actlen = i2ctp->i2c_rlen - i2ctp->i2c_r_resid; - if (ddi_copyout(i2ctp->i2c_rbuf, i2ct.i2c_rbuf, - i2c_actlen, mode) != DDI_SUCCESS) { - return (I2C_FAILURE); - } - } - - return (I2C_SUCCESS); -} - -/* - * The ioctls will use the same name as the Javelin ioctls. We - * will have a very restricted set for MC, and unlike Javelin - * will not have a envctrl_chip structure to return values - * from the driver. All we will have is a uint8_t value to - * get or set values from the driver. Also, unlike the Javelin, - * where 'index' is used to specify the input port from where - * temperature is collected, here different minor nodes will be - * created by the driver for each port, eliminating the need for - * 'index' - leaving us with only the value to pass. - */ - -/*ARGSUSED*/ -static int -pcf8591_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, - cred_t *credp, int *rvalp) -{ - int err = 0; - struct pcf8591_unit *unitp; - minor_t minor = getminor(dev); - - int instance = PCF8591_MINOR_TO_DEVINST(minor); - int channel = PCF8591_MINOR_TO_CHANNEL(minor); - - unitp = (struct pcf8591_unit *) - ddi_get_soft_state(pcf8591_soft_statep, instance); - - mutex_enter(&unitp->umutex); - while (unitp->pcf8591_flags == PCF8591_BUSY) { - if (cv_wait_sig(&unitp->pcf8591_cv, &unitp->umutex) <= 0) { - mutex_exit(&unitp->umutex); - - return (EINTR); - } - } - unitp->pcf8591_flags = PCF8591_BUSY; - mutex_exit(&unitp->umutex); - - switch (cmd) { - - case ENVC_IOC_GETTEMP: { - /* - * Read the status byte from pcf8591 chip. The value will - * be already converted to Celcius by translate_cputemp. - */ - (void) pcf8591_read_chip(unitp, channel, 1); - if (ddi_copyout(unitp->i2c_tran->i2c_rbuf, - (caddr_t)arg, sizeof (uint8_t), mode) != DDI_SUCCESS) { - err = EFAULT; - } - break; - } - - case ENVC_IOC_GETMODE: { - uint8_t curr_mode = unitp->current_mode; - - if (ddi_copyout((caddr_t)&curr_mode, (caddr_t)arg, - sizeof (uint8_t), mode) != DDI_SUCCESS) { - err = EFAULT; - } - break; - } - - case ENVC_IOC_SETMODE: { - uint8_t curr_mode; - if (ddi_copyin((caddr_t)arg, (caddr_t)&curr_mode, - sizeof (uint8_t), mode) != DDI_SUCCESS) { - err = EFAULT; - break; - } - if (curr_mode == ENVCTRL_DIAG_MODE || - curr_mode == ENVCTRL_NORMAL_MODE) { - unitp->current_mode = curr_mode; /* Don't do anything */ - } - break; - } - - /* Testing, may be removed */ - case I2CDEV_TRAN: - if (call_copyin((caddr_t)arg, unitp, mode) != I2C_SUCCESS) { - err = EFAULT; - break; - } - if (nct_i2c_transfer(unitp->pcf8591_hdl, unitp->i2c_tran) - != I2C_SUCCESS) { - err = EFAULT; - break; - } - if (call_copyout((caddr_t)arg, unitp, mode) != I2C_SUCCESS) { - err = EFAULT; - break; - } - break; - - /* - * TESTING TRANSLATION from "adc" "table" property - * translate thermistor index into temp Celcius - */ - case I2CDEV_GETTEMP: { - struct i2c_transfer *tp; - if (call_copyin((caddr_t)arg, unitp, mode) != I2C_SUCCESS) { - err = EFAULT; - break; - } - tp = unitp->i2c_tran; - if (tp->i2c_rlen != 1) { - err = EINVAL; - break; - } - /* - * Throw away the first byte according to PCF8591 datasheet, - * so read two bytes - */ - tp->i2c_rlen = 2; - if (nct_i2c_transfer(unitp->pcf8591_hdl, unitp->i2c_tran) - != I2C_SUCCESS) { - err = EFAULT; - break; - } -#ifdef DEBUG - if (pcf8591_debug & 0x0010) - cmn_err(CE_NOTE, - "pcf8591_ioctl: i2c_rlen=%d; " - "i2c_rbuf[0,1]=0x%x,0x%x\n", - tp->i2c_rlen, tp->i2c_rbuf[0], tp->i2c_rbuf[1]); -#endif /* DEBUG */ - /* - * Throw away the first byte according to PCF8591 datasheet - */ - if ((tp->i2c_rbuf[0] = translate_cputemp(tp->i2c_rbuf[1])) - == 0) { - err = EINVAL; - break; - } - tp->i2c_rbuf[1] = 0; - - if (call_copyout((caddr_t)arg, unitp, mode) != I2C_SUCCESS) { - err = EFAULT; - break; - } - break; - } - - case I2CDEV_GETTABLES: { - break; - } - default: - err = EINVAL; - } - - mutex_enter(&unitp->umutex); - unitp->pcf8591_flags = 0; - cv_signal(&unitp->pcf8591_cv); - mutex_exit(&unitp->umutex); - - return (err); -} - -static int -pcf8591_do_detach(dev_info_t *dip) -{ - register struct pcf8591_unit *unitp; - int instance; - uint_t attach_flag; - - instance = ddi_get_instance(dip); - unitp = ddi_get_soft_state(pcf8591_soft_statep, instance); - attach_flag = unitp->attach_flag; - - if (attach_flag & PCF8591_KSTAT_INIT) { - pcf8591_delete_kstats(unitp); - } - - if (attach_flag & PCF8591_LOCK_INIT) { - mutex_destroy(&unitp->umutex); - cv_destroy(&unitp->pcf8591_cv); - } - - /* - * Restore the lengths of the rbuf and wbuf, which was originally - * allocated so that the appropriate amount of rbuf and wbuf are - * freed. - */ - if (attach_flag & PCF8591_ALLOC_TRANSFER) { - unitp->i2c_tran->i2c_wlen = MAX_WLEN; - unitp->i2c_tran->i2c_rlen = MAX_RLEN; - i2c_transfer_free(unitp->pcf8591_hdl, unitp->i2c_tran); - } - - if (attach_flag & PCF8591_REGISTER_CLIENT) { - i2c_client_unregister(unitp->pcf8591_hdl); - } - - if (attach_flag & PCF8591_MINORS_CREATED) { - ddi_remove_minor_node(dip, NULL); - } - - /* - * Free the memory allocated for the properties. - */ - if (attach_flag & PCF8591_PROPS_READ) { - ddi_prop_free(unitp->props.name); - if (unitp->props.num_chans_used) { - ddi_prop_free(unitp->props.channels_in_use); - } - - if (unitp->props.channels_description) { - ddi_prop_free(unitp->props.channels_description); - } - } - - if (attach_flag & PCF8591_SOFT_STATE_ALLOC) { - ddi_soft_state_free(pcf8591_soft_statep, instance); - } - - return (DDI_SUCCESS); -} - -static int -pcf8591_do_suspend(dev_info_t *dip) -{ - int instance = ddi_get_instance(dip); - struct pcf8591_unit *unitp = (struct pcf8591_unit *) - ddi_get_soft_state(pcf8591_soft_statep, instance); - - if (unitp == NULL) { - return (ENXIO); - } - - /* - * Set the busy flag so that future transactions block - * until resume. - */ - mutex_enter(&unitp->umutex); - while (unitp->pcf8591_flags == PCF8591_BUSY) { - if (cv_wait_sig(&unitp->pcf8591_cv, - &unitp->umutex) <= 0) { - mutex_exit(&unitp->umutex); - - return (DDI_FAILURE); - } - } - unitp->pcf8591_flags = PCF8591_BUSY; - mutex_exit(&unitp->umutex); - - return (DDI_SUCCESS); -} - -static int -pcf8591_do_resume(dev_info_t *dip) -{ - int instance = ddi_get_instance(dip); - struct pcf8591_unit *unitp = (struct pcf8591_unit *) - ddi_get_soft_state(pcf8591_soft_statep, instance); - if (unitp == NULL) { - return (ENXIO); - } - - mutex_enter(&unitp->umutex); - unitp->pcf8591_flags = 0; - cv_signal(&unitp->pcf8591_cv); - mutex_exit(&unitp->umutex); - - return (DDI_SUCCESS); -} - -static int -pcf8591_do_attach(dev_info_t *dip) -{ - register struct pcf8591_unit *unitp; - int i, instance; - char name[MAXNAMELEN]; - minor_t minor; - - instance = ddi_get_instance(dip); - - if (ddi_soft_state_zalloc(pcf8591_soft_statep, instance) != 0) { - return (DDI_FAILURE); - } - - unitp = ddi_get_soft_state(pcf8591_soft_statep, instance); - - if (unitp == NULL) { - return (DDI_FAILURE); - } - - unitp->dip = dip; - - unitp->attach_flag = PCF8591_SOFT_STATE_ALLOC; - - if (pcf8591_read_props(unitp) != DDI_PROP_SUCCESS) { - (void) pcf8591_do_detach(dip); - return (DDI_FAILURE); - } - - unitp->attach_flag |= PCF8591_PROPS_READ; - - /* - * Set the current operating mode to NORMAL_MODE. - */ - unitp->current_mode = ENVCTRL_NORMAL_MODE; /* normal mode */ - - (void) snprintf(unitp->pcf8591_name, PCF8591_NAMELEN, - "%s%d", ddi_driver_name(dip), instance); - - /* - * Create a minor node corresponding to channel 0 to 3 - */ - for (i = 0; i < PCF8591_MAX_CHANS; i++) { - if (i == 0) { - (void) sprintf(name, "cputemp"); - } else { - (void) sprintf(name, "%d", i); - } - minor = PCF8591_MINOR_NUM(instance, i); - if (ddi_create_minor_node(dip, name, S_IFCHR, minor, - PCF8591_NODE_TYPE, NULL) == DDI_FAILURE) { - ddi_remove_minor_node(dip, NULL); - (void) pcf8591_do_detach(dip); - return (DDI_FAILURE); - } - } - - unitp->attach_flag |= PCF8591_MINORS_CREATED; - - if (i2c_client_register(dip, &unitp->pcf8591_hdl) - != I2C_SUCCESS) { - (void) pcf8591_do_detach(dip); - return (DDI_FAILURE); - } - - unitp->attach_flag |= PCF8591_REGISTER_CLIENT; - - /* - * We allocate a single i2c_transfer_t structure for all - * i2c transactions. - */ - if (i2c_transfer_alloc(unitp->pcf8591_hdl, &unitp->i2c_tran, - MAX_WLEN, MAX_RLEN, KM_SLEEP) != I2C_SUCCESS) { - (void) pcf8591_do_detach(dip); - return (DDI_FAILURE); - } - - unitp->attach_flag |= PCF8591_ALLOC_TRANSFER; - - /* - * The flags will be set to I2C_WR because for all reads from - * the 8591 we need to also write the control byte. - */ - unitp->i2c_tran->i2c_flags = I2C_WR; - unitp->i2c_tran->i2c_version = I2C_XFER_REV; - - - /* - * Set the analog programming mode to default. Upper nibble - * in control byte. Four single ended inputs, output not enabled. - */ - unitp->pcf8591_inprog = PCF8591_4SINGLE | PCF8591_ANALOG_INPUT_EN; - - /* - * Set the open flag for each channel to 0. - */ - for (i = 0; i < PCF8591_MAX_CHANS; i++) { - unitp->pcf8591_oflag[i] = 0; - } - - /* - * Set the busy flag to 0. - */ - unitp->pcf8591_flags = 0; - - mutex_init(&unitp->umutex, NULL, MUTEX_DRIVER, NULL); - cv_init(&unitp->pcf8591_cv, NULL, CV_DRIVER, NULL); - - unitp->attach_flag |= PCF8591_LOCK_INIT; - - if (pcf8591_add_kstats(unitp) != DDI_SUCCESS) { - (void) pcf8591_do_detach(dip); - return (DDI_FAILURE); - } - - unitp->attach_flag |= PCF8591_KSTAT_INIT; - - ddi_report_dev(dip); - - return (DDI_SUCCESS); -} - -/* ARGSUSED */ -static int -pcf8591_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result) -{ - dev_t dev; - int instance; - - if (infocmd == DDI_INFO_DEVT2INSTANCE) { - dev = (dev_t)arg; - instance = PCF8591_MINOR_TO_DEVINST(getminor(dev)); - *result = (void *)(uintptr_t)instance; - return (DDI_SUCCESS); - } - return (DDI_FAILURE); -} - -static int -pcf8591_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) -{ - switch (cmd) { - case DDI_ATTACH: - return (pcf8591_do_attach(dip)); - case DDI_RESUME: - return (pcf8591_do_resume(dip)); - default: - return (DDI_FAILURE); - } -} - -static int -pcf8591_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) -{ - switch (cmd) { - case DDI_DETACH: - return (pcf8591_do_detach(dip)); - case DDI_SUSPEND: - return (pcf8591_do_suspend(dip)); - default: - return (DDI_FAILURE); - } -} - -static uint8_t -translate_cputemp(uint8_t value) -{ - return (_cpu_temps[value]); -} - -static int -pcf8591_add_kstats(struct pcf8591_unit *unitp) -{ - if ((unitp->tempksp = kstat_create(I2C_PCF8591_NAME, - unitp->instance, I2C_KSTAT_CPUTEMP, "misc", - KSTAT_TYPE_RAW, sizeof (unitp->temp_kstats), - KSTAT_FLAG_PERSISTENT | KSTAT_FLAG_WRITABLE)) == NULL) { - - return (DDI_FAILURE); - } - - /* - * The kstat fields are already initialized in the attach routine.. - */ - - unitp->tempksp->ks_update = pcf8591_temp_kstat_update; - unitp->tempksp->ks_private = (void *)unitp; - - (void) strcpy(unitp->temp_kstats.label, - unitp->props.channels_description[0]); - unitp->temp_kstats.type = ENVC_NETRACT_CPU_SENSOR; - - kstat_install(unitp->tempksp); - - return (DDI_SUCCESS); -} - -static void -pcf8591_delete_kstats(struct pcf8591_unit *unitp) -{ - kstat_delete(unitp->tempksp); -} - -static int -pcf8591_temp_kstat_update(kstat_t *ksp, int rw) -{ - struct pcf8591_unit *unitp; - char *kstatp; - int err = 0; - int channel = 0; - int warn_temp = 0; - int shutdown_temp = 0; - - unitp = (struct pcf8591_unit *)ksp->ks_private; - - mutex_enter(&unitp->umutex); - while (unitp->pcf8591_flags == PCF8591_BUSY) { - if (cv_wait_sig(&unitp->pcf8591_cv, - &unitp->umutex) <= 0) { - mutex_exit(&unitp->umutex); - - return (EINTR); - } - } - - unitp->pcf8591_flags = PCF8591_BUSY; - mutex_exit(&unitp->umutex); - - kstatp = (char *)ksp->ks_data; - - if (rw == KSTAT_WRITE) { - - /* check for the size of buffer */ - if (ksp->ks_data_size != sizeof (unitp->temp_kstats)) { - err = EIO; - goto bail; - } - - warn_temp = ((envctrl_temp_t *)kstatp)->warning_threshold; - shutdown_temp = ((envctrl_temp_t *)kstatp)->shutdown_threshold; - - if (shutdown_temp < SHUTDOWN_TEMP_MIN || shutdown_temp > - SHUTDOWN_TEMP_MAX) { - err = EIO; - goto bail; - } - - if (warn_temp < 0 || shutdown_temp <= warn_temp) { - err = EIO; - goto bail; - } - - /* write into kstat fields */ - unitp->temp_kstats.warning_threshold = warn_temp; - unitp->temp_kstats.shutdown_threshold = shutdown_temp; - - } else { - (void) pcf8591_read_chip(unitp, channel, 1); - unitp->temp_kstats.value = - unitp->i2c_tran->i2c_rbuf[0]; - bcopy((caddr_t)&unitp->temp_kstats, kstatp, - sizeof (unitp->temp_kstats)); - } - -bail: - - mutex_enter(&unitp->umutex); - unitp->pcf8591_flags = 0; - cv_signal(&unitp->pcf8591_cv); - mutex_exit(&unitp->umutex); - - return (err); -} - -static int -pcf8591_read_chip(struct pcf8591_unit *unitp, uint8_t channel, -int size) -{ - int retval = I2C_SUCCESS; - - /* - * We need to read an extra byte, since as per specification - * the first byte read should be discarded. - */ - i2c_transfer_t *tp = unitp->i2c_tran; - tp->i2c_flags = I2C_WR_RD; - tp->i2c_rlen = size+1; - tp->i2c_wlen = 1; - tp->i2c_wbuf[0] = (unitp->pcf8591_inprog | - channel); - - retval = nct_i2c_transfer(unitp->pcf8591_hdl, tp); - if (retval == I2C_SUCCESS) { - tp->i2c_rbuf[0] = translate_cputemp(tp->i2c_rbuf[1]); - } - - if (tp->i2c_rbuf[0] == 0) { - retval = I2C_FAILURE; - } - - return (retval); -} - -/* - * Reads the properties of the pcf8591 device. - */ -static int -pcf8591_read_props(struct pcf8591_unit *unitp) -{ - dev_info_t *dip = unitp->dip; - int i, retval = 0, prop_len; - int instance = ddi_get_instance(dip); - int warning_temp, shutdown_temp; - uint32_t *prop_value = NULL; - uchar_t *creg_prop; - char *function; - uint_t tblsz; - -#ifdef lint - instance = instance; -#endif - /* - * Check for the pcf8591_function property, and make sure it's - * cputemp. - */ - if (ddi_prop_lookup_string(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, - "pcf8591_function", &function) != DDI_SUCCESS) { - dbg_print(CE_WARN, "Couldn't find pcf8591_function property"); - - return (DDI_FAILURE); - } - - if (strcmp(function, "cputemp") != 0) { - dbg_print(CE_WARN, "pcf8591_function is not cputemp"); - ddi_prop_free(function); - - return (DDI_FAILURE); - } - - ddi_prop_free(function); - - retval = ddi_prop_lookup_string(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, - "name", &unitp->props.name); - if (retval != DDI_PROP_SUCCESS) { - - return (retval); - } -#ifdef DEBUG - else if (pcf8591_debug & 0x02) - cmn_err(CE_NOTE, - "pcf8591_read_props:ddi_prop_lookup_string(%s): \ - found %s ", "name", unitp->props.name); -#endif /* DEBUG */ - - retval = ddi_getlongprop(DDI_DEV_T_ANY, dip, - DDI_PROP_DONTPASS | DDI_PROP_CANSLEEP, - "reg", (caddr_t)&prop_value, &prop_len); - if (retval == DDI_PROP_SUCCESS) { - unitp->props.i2c_bus = (uint16_t)prop_value[0]; - unitp->props.slave_address = (uint16_t)prop_value[1]; - kmem_free(prop_value, prop_len); -#ifdef DEBUG - if (pcf8591_debug & 0x02) - cmn_err(CE_NOTE, - "pcf8591:ddi_getlongprop(%s) returns %d," - " i2c_bus,slave=0x%x,0x%x", - "reg", retval, unitp->props.i2c_bus, - unitp->props.slave_address); -#endif /* DEBUG */ - } else { - unitp->props.i2c_bus = (uint16_t)-1; - unitp->props.slave_address = (uint16_t)-1; -#ifdef DEBUG - cmn_err(CE_WARN, - "pcf8591_read_props:ddi_getlongprop(%s) returns %d," - " default it to 0x%x:0x%X", - "reg", retval, unitp->props.i2c_bus, - unitp->props.slave_address); -#endif /* DEBUG */ - } - (void) ddi_getproplen(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, - "channels-in-use", &prop_len); - retval = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, - dip, DDI_PROP_DONTPASS, - "channels-in-use", - (uchar_t **)&unitp->props.channels_in_use, - &unitp->props.num_chans_used); - if (retval == DDI_PROP_SUCCESS) { - unitp->props.num_chans_used /= sizeof (pcf8591_channel_t); - } else { - unitp->props.num_chans_used = 0; - } - -#ifdef DEBUG - if (pcf8591_debug & 0x0002) - cmn_err(CE_NOTE, - "pcf8591_read_props:ddi_prop_lookup_byte_array(%s)" - "returns %d\n" - "\t\tlength=%d, #elements=%d", - "channels-in-use", retval, - prop_len, unitp->props.num_chans_used); -#endif /* DEBUG */ - - retval = ddi_prop_lookup_string_array(DDI_DEV_T_ANY, dip, - DDI_PROP_DONTPASS, "channels-description", - (char ***)&unitp->props.channels_description, - (uint_t *)&prop_len); - - if (retval != DDI_PROP_SUCCESS) { - prop_len = 0; - unitp->props.channels_description = NULL; - } - -#ifdef DEBUG - if (pcf8591_debug & 0x0002) { - cmn_err(CE_NOTE, - "pcf8591_read_props:ddi_prop_lookup_string_array(%s)" - "returns %d, length=%d", - "channels-description", retval, prop_len); - for (i = 0; i < prop_len; ++i) { - cmn_err(CE_NOTE, "channels-description[%d]=<%s>", - i, unitp->props.channels_description[i]); - } - } -#endif /* DEBUG */ - - /* - * The following code was borrowed from envctrltwo.c - * I haven't yet investigated why the copy target is index + 2 - */ - retval = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, dip, - DDI_PROP_DONTPASS, "tables", &creg_prop, (uint_t *)&prop_len); - - if (retval != DDI_PROP_SUCCESS) { -#ifdef DEBUG - cmn_err(CE_WARN, "%s%d: Unable to read pcf8591 tables property", - ddi_get_name(dip), instance); -#endif /* DEBUG */ - - return (DDI_NOT_WELL_FORMED); - } - - tblsz = (sizeof (_cpu_temps) / sizeof (uchar_t)); - if (prop_len <= tblsz) { - for (i = 0; i < prop_len; i++) { - _cpu_temps[i] = creg_prop[i]; - } - } -#ifdef DEBUG - if (pcf8591_debug & 0x0002) - cmn_err(CE_NOTE, "pcf8591_read_props: _cpu_temps size=%d; " - "tables prop_len=%d\n", tblsz, prop_len); -#endif /* DEBUG */ - - ddi_prop_free(creg_prop); - - /* - * Read shutdown temp and warning temp properties. - */ - warning_temp = (int)ddi_getprop(DDI_DEV_T_ANY, dip, - DDI_PROP_DONTPASS, "warning-temp", PCF8591_WARNING_TEMP); - - shutdown_temp = (int)ddi_getprop(DDI_DEV_T_ANY, dip, - DDI_PROP_DONTPASS, "shutdown-temp", PCF8591_SHUTDOWN_TEMP); - - /* - * Fill up the warning and shutdown temp values in kstat structure. - */ - unitp->temp_kstats.warning_threshold = warning_temp; - unitp->temp_kstats.shutdown_threshold = shutdown_temp; - - return (DDI_PROP_SUCCESS); -} diff --git a/usr/src/uts/sun4u/montecarlo/io/scsb.c b/usr/src/uts/sun4u/montecarlo/io/scsb.c deleted file mode 100644 index 75fd61d128..0000000000 --- a/usr/src/uts/sun4u/montecarlo/io/scsb.c +++ /dev/null @@ -1,7444 +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 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - * Copyright (c) 2019 Peter Tribble. - */ - -/* - * Netra ct800 and Netra ct400 (MonteCarlo/Tonga) - * System Controller and Status Boards STREAMS driver. - * - * This driver handles all communications with the Netra ct400 and ct800 - * System Controller Boards. - * I/O to the SCB is through the PCF8584 I2C controller. - * The SCB I2C interface and driver interface are provided by the - * Xilinx XCS40XL. - * - * N.B.: The design choice of using STREAMS was dictated because - * the original system monitor card had to multiplex 2 pcf8574's - * as one device. - */ - -#include <sys/types.h> -#include <sys/param.h> -#include <sys/cred.h> -#include <sys/log.h> -#include <sys/uio.h> -#include <sys/stat.h> -#include <sys/vnode.h> -#include <sys/file.h> -#include <sys/open.h> -#include <sys/kmem.h> -#include <sys/kstat.h> -#include <sys/signal.h> - -#include <sys/stream.h> -#include <sys/strsubr.h> -#include <sys/strsun.h> -#include <sys/poll.h> - -#include <sys/debug.h> - -#include <sys/conf.h> -#include <sys/ddi.h> -#include <sys/sunddi.h> -#include <sys/modctl.h> - -#include <sys/i2c/misc/i2c_svc.h> - -#include <sys/mct_topology.h> -#include <sys/netract_gen.h> -#include <sys/scsbioctl.h> -#include <sys/scsb.h> -#include <sys/scsb_cbi.h> - -#include <sys/hotplug/hpctrl.h> -#include <sys/hsc.h> -#include <sys/hscimpl.h> - -#define CPCI_HOTSWAP_SUPPORT - -#define ALARM_CARD_ON_SLOT 1 -#define SCSB_FRU_OP_GET_REG 1 -#define SCSB_FRU_OP_SET_REGBIT 2 -#define SCSB_FRU_OP_GET_BITVAL 3 -#define SCSB_FRU_OP_GET_REGDATA 4 - -/* - * (internal only) - * scsb build version format is "CCYYMMDD" - * for integer compares. - */ -#define SCSB_BUILD_VERSION "20001206" - -#define MUTEX_UNINIT 0 -#define MUTEX_INIT 2 - -static int scsb_err_threshold = 0; /* max allowed i2c errors */ -static int scsb_freeze_count = 3; /* #I2C errors to indicate SCB removal */ -static int scsb_shutdown_count = 5; /* #polls before passing shutdown evt */ -static int scsb_in_postintr = 0; /* 1 if scsb is processing intr */ -static kmutex_t *scb_intr_mutex; /* SCSB interrupt mutex */ -static int nct_mutex_init = MUTEX_UNINIT; - -extern int scsb_hsc_board_healthy(); - -static char *scsb_name = SCSB_DEVICE_NAME; -static char *scsb_clone_name = SCSB_DEVICE_NAME "clone"; -static char *scsb_build_version = SCSB_BUILD_VERSION; -/* - * cb_ops section of scsb driver. - */ -static int sm_open(queue_t *, dev_t *, int, int, cred_t *); -static int sm_close(queue_t *, int, cred_t *); - -static int sm_rput(queue_t *, mblk_t *); /* from i2c below */ -static int sm_wput(queue_t *, mblk_t *); /* from above */ - -uint_t scsb_intr_preprocess(caddr_t arg); -void scsb_intr(caddr_t arg); -static void smf_ioctl(queue_t *, mblk_t *); -static void sm_ioc_rdwr(queue_t *, mblk_t *, int); - -static int scsb_info(dev_info_t *, ddi_info_cmd_t, void *, void **); -static int scsb_attach(dev_info_t *, ddi_attach_cmd_t); -static int scsb_detach(dev_info_t *, ddi_detach_cmd_t); -static int initialize_scb(scsb_state_t *); - -static dev_info_t *scsb_dip; /* private copy of devinfo pointer */ - -static struct module_info info = { - 0, SCSB_DEVICE_NAME, 0, INFPSZ, 512, 128 -}; - -static struct qinit sm_rinit = { - sm_rput, NULL, sm_open, sm_close, NULL, &info -}; - -static struct qinit sm_winit = { - sm_wput, NULL, sm_open, sm_close, NULL, &info -}; - -struct streamtab sm_st = { - &sm_rinit, &sm_winit, NULL, NULL -}; - -static struct cb_ops scsb_cb_ops = { - - nulldev, /* open */ - nulldev, /* close */ - nodev, /* strategy */ - nodev, /* print */ - nodev, /* dump */ - nodev, /* read */ - nodev, /* write */ - nodev, /* ioctl */ - nodev, /* devmap */ - nodev, /* mmap */ - nodev, /* segmap */ - nochpoll, /* poll */ - ddi_prop_op, /* cb_prop_op */ - &sm_st, /* streamtab */ - D_MP, /* Driver compatibility flag */ - CB_REV, /* rev */ - nodev, /* int (*cb_aread)() */ - nodev /* int (*cb_awrite)() */ -}; - -static struct dev_ops scsb_ops = { - - DEVO_REV, /* devo_rev, */ - 0, /* refcnt */ - scsb_info, /* info */ - nulldev, /* identify */ - nulldev, /* probe */ - scsb_attach, /* attach */ - scsb_detach, /* detach */ - nodev, /* reset */ - &scsb_cb_ops, /* driver operations */ - (struct bus_ops *)0, /* bus operations */ - NULL, /* power */ - ddi_quiesce_not_supported, /* devo_quiesce */ -}; - -/* - * Module linkage information for the kernel. - */ - -static struct modldrv modldrv = { - &mod_driverops, /* Type of module. This one is a pseudo driver */ -#ifdef DEBUG - "SCB/SSB driver DBG" SCSB_BUILD_VERSION, -#else - "v1.33 Netra ct System Control/Status Board driver", -#endif - &scsb_ops, /* driver ops */ -}; - -static struct modlinkage modlinkage = { - MODREV_1, - (void *)&modldrv, - NULL -}; - -/* - * local declarations and definitions - */ -#if defined(DEBUG) - uint32_t scsb_debug = 0x00000000; -#else -static uint32_t scsb_debug = 0; -#endif - -static hrtime_t scb_pre_s, scb_pre_e, scb_post_s, scb_post_e; - -static int scsb_pil = SCSB_INTR_PIL; -static int hsc_pil = SCSB_INTR_PIL; -static void *scsb_state; -static uint32_t scsb_global_state; -static uint32_t scsb_event_code; /* for event polling */ -static struct system_info mct_system_info; -static int scsb_healthy_poll_count = 16; - -static fru_id_t fru_id_table[MCT_MAX_FRUS]; -static uchar_t scb_intr_regs[SCTRL_MAX_GROUP_NUMREGS]; - -static uint32_t evc_fifo[EVC_FIFO_SIZE]; -static uint32_t evc_fifo_count = 0; -static uint32_t *evc_rptr = evc_fifo; -static uint32_t *evc_wptr = evc_fifo; -static void *evc_procs[EVC_PROCS_MAX]; -static int evc_proc_count = 0; -static timeout_id_t scsb_intr_tid; - -int nct_i2c_transfer(i2c_client_hdl_t i2c_hdl, i2c_transfer_t *i2c_tran); - -/* - * kstat functions - */ -static int scsb_alloc_kstats(scsb_state_t *); -static void scsb_free_kstats(scsb_state_t *); -static int update_ks_leddata(kstat_t *, int); -static int update_ks_state(kstat_t *, int); -static int update_ks_topology(kstat_t *, int); -static int update_ks_evcreg(kstat_t *, int); - -/* - * local functions - */ -static void free_resources(dev_info_t *, scsb_state_t *, int); -static i2c_transfer_t *scsb_alloc_i2ctx(i2c_client_hdl_t, uint_t); -static fru_info_t *find_fru_info(fru_id_t fru_id); -static int scsb_fake_intr(scsb_state_t *, uint32_t); -static int scsb_get_status(scsb_state_t *, scsb_status_t *); -static int scsb_leds_switch(scsb_state_t *, scsb_ustate_t); -static void scsb_freeze(scsb_state_t *scsb); -static void scsb_freeze_check(scsb_state_t *scsb); -static void scsb_restore(scsb_state_t *scsb); -static int scsb_polled_int(scsb_state_t *, int, uint32_t *); -static int scsb_check_config_status(scsb_state_t *scsb); -static int scsb_set_scfg_pres_leds(scsb_state_t *, fru_info_t *); -static void scsb_set_topology(scsb_state_t *); -static void scsb_free_topology(scsb_state_t *); -int scsb_read_bhealthy(scsb_state_t *scsb); -int scsb_read_slot_health(scsb_state_t *, int); -static void tonga_slotnum_check(scsb_state_t *scsb, scsb_uinfo_t *suip); -static int tonga_psl_to_ssl(scsb_state_t *scsb, int slotnum); -static uchar_t tonga_slotnum_led_shift(scsb_state_t *scsb, uchar_t data); -static int scsb_clear_intptrs(scsb_state_t *scsb); -static int scsb_clear_intmasks(scsb_state_t *scsb); -static int scsb_setall_intmasks(scsb_state_t *scsb); -static int scsb_write_mask(scsb_state_t *, uchar_t, uchar_t, uchar_t, - uchar_t); -static int scsb_rdwr_register(scsb_state_t *, int, uchar_t, int, - uchar_t *, int); -static int scsb_readall_regs(scsb_state_t *); -static int scsb_get_led_regnum(scsb_state_t *, scsb_uinfo_t *, uchar_t *, - int *, scsb_led_t); -static void scsb_free_i2ctx(i2c_client_hdl_t, i2c_transfer_t *); -static void check_fru_info(scsb_state_t *, int); -static void update_fru_info(scsb_state_t *, fru_info_t *); -static int event_to_index(uint32_t); -static void add_event_code(scsb_state_t *, uint32_t); -static uint32_t del_event_code(); -static uint32_t get_event_code(); -static int add_event_proc(scsb_state_t *, pid_t); -static int del_event_proc(scsb_state_t *, pid_t); -static void rew_event_proc(scsb_state_t *); -static int event_proc_count(scsb_state_t *); -static int find_evc_proc(pid_t pid); -static void signal_evc_procs(scsb_state_t *); -static int check_event_procs(); -static int scsb_is_alarm_card_slot(scsb_state_t *, int); - int scsb_get_slot_state(scsb_state_t *, int, int *); -static int scsb_fru_op(scsb_state_t *, scsb_utype_t, int, int, int); -static int scsb_queue_put(queue_t *, int, uint32_t *, char *); -static int scsb_queue_ops(scsb_state_t *, int, int, void *, char *); -static int scsb_blind_read(scsb_state_t *, int, uchar_t, int, uchar_t *, int); -static int scsb_toggle_psmint(scsb_state_t *, int); -static int scsb_quiesce_psmint(scsb_state_t *); -static int scsb_invoke_intr_chain(); -int scsb_intr_register(int (*)(void *), void *, fru_id_t); -void scsb_intr_unregister(fru_id_t); - -#ifdef DEBUG -static void mct_topology_dump(scsb_state_t *, int); -static void scsb_failing_event(scsb_state_t *scsb); -#endif - -int -_init(void) -{ - int i, status; - - if (scsb_debug & 0x0005) - cmn_err(CE_NOTE, "scsb: _init()"); - (void) ddi_soft_state_init(&scsb_state, sizeof (scsb_state_t), - SCSB_NO_OF_BOARDS); - (void) hsc_init(); - if ((status = mod_install(&modlinkage)) != 0) { - if (scsb_debug & 0x0006) - cmn_err(CE_NOTE, "scsb: _init(): mod_install failed"); - ddi_soft_state_fini(&scsb_state); - (void) hsc_fini(); - return (status); - } - /* - * initialize the FRU ID Table, using real FRU IDs where available - * such as I2C Addresses for FRUs with I2C support - */ - for (i = 0; i < MCT_MAX_FRUS; ++i) - fru_id_table[i] = i + 1; - fru_id_table[event_to_index(SCTRL_EVENT_PS1)] = (fru_id_t)MCT_I2C_PS1; - fru_id_table[event_to_index(SCTRL_EVENT_PS2)] = (fru_id_t)MCT_I2C_PS2; - fru_id_table[event_to_index(SCTRL_EVENT_FAN1)] = (fru_id_t)MCT_I2C_FAN1; - fru_id_table[event_to_index(SCTRL_EVENT_FAN2)] = (fru_id_t)MCT_I2C_FAN2; - fru_id_table[event_to_index(SCTRL_EVENT_FAN3)] = (fru_id_t)MCT_I2C_FAN3; - fru_id_table[event_to_index(SCTRL_EVENT_SCB)] = (fru_id_t)MCT_I2C_SCB; - return (status); -} - -int -_fini(void) -{ - int status; - - if (scsb_debug & 0x0005) - cmn_err(CE_NOTE, "scsb: _fini()"); - - if ((status = mod_remove(&modlinkage)) == 0) { - ddi_soft_state_fini(&scsb_state); - (void) hsc_fini(); - } - if (scsb_debug & 0x0006) - cmn_err(CE_NOTE, "scsb: _fini, error %x\n", status); - - return (status); -} - -int -_info(struct modinfo *modinfop) -{ - if (scsb_debug & 0x0005) - cmn_err(CE_NOTE, "scsb: _info()"); - - return (mod_info(&modlinkage, modinfop)); -} - -static int -scsb_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) -{ - int instance; - scsb_state_t *scsb; - register int i; - int *regs; - uint_t len; - uchar_t reg, wdata, rmask; - - instance = ddi_get_instance(dip); - - if (scsb_debug & 0x0005) - cmn_err(CE_NOTE, "scsb_attach[%d]", instance); - - if (cmd != DDI_ATTACH) { - if (scsb_debug & 0x0006) - cmn_err(CE_NOTE, - "scsb_attach[%d]: cmd 0x%x != DDI_ATTACH", - instance, cmd); - return (DDI_FAILURE); - } - - if (ddi_soft_state_zalloc(scsb_state, instance) != DDI_SUCCESS) { - cmn_err(CE_WARN, "scsb%d: cannot allocate soft state", - instance); - return (DDI_FAILURE); - } - - scsb = (scsb_state_t *)ddi_get_soft_state(scsb_state, instance); - if (scsb == NULL) { - cmn_err(CE_WARN, "scsb%d: cannot get soft state", instance); - ddi_soft_state_free(scsb_state, instance); - return (DDI_FAILURE); - } - scsb->scsb_instance = instance; - scsb->scsb_state = 0; /* just checking strange mutex behavior */ - - /* - * make sure this is the SCB's known address - */ - if (ddi_prop_lookup_int_array(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, - "reg", ®s, &len) != DDI_PROP_SUCCESS) { - cmn_err(CE_WARN, - "scsb%d: Failed to get \"reg\" property", instance); - ddi_soft_state_free(scsb_state, instance); - return (DDI_FAILURE); - } - scsb->scsb_i2c_addr = regs[1] & SCSB_I2C_ADDR_MASK; - if (scsb->scsb_i2c_addr != SCSB_I2C_ADDR) { - cmn_err(CE_WARN, "scsb%d: I2C Addr reg %x %x must be %x", - instance, regs[0], regs[1], SCSB_I2C_ADDR); - ddi_soft_state_free(scsb_state, instance); - ddi_prop_free(regs); - return (DDI_FAILURE); - } - /* done with array lookup, free resource */ - ddi_prop_free(regs); - /* - * initialize synchronization mutex and condition var. - * for this instance. - */ - mutex_init(&scsb->scsb_mutex, NULL, MUTEX_DRIVER, NULL); - scsb->scsb_state |= SCSB_UMUTEX; - cv_init(&scsb->scsb_cv, NULL, CV_DRIVER, NULL); - scsb->scsb_state |= SCSB_CONDVAR; - - /* - * 1. Read interrupt property of the board and register its handler. - * 2. Get scsb private handle for communication via I2C Services. - * 3. Allocate and save an i2c_transfer_t for I2C transfers. - */ - /* 1 */ - if (ddi_prop_exists(DDI_DEV_T_ANY, dip, - DDI_PROP_NOTPROM | DDI_PROP_DONTPASS, - "interrupt-priorities") != 1) { - int tmp[2]; - tmp[0] = scsb_pil; - tmp[1] = hsc_pil; - (void) ddi_prop_update_int_array(DDI_DEV_T_NONE, dip, - "interrupt-priorities", tmp, 2); - scsb->scsb_state |= SCSB_PROP_CREATE; - } - if ((i = ddi_prop_get_int(DDI_DEV_T_ANY, dip, - DDI_PROP_DONTPASS, "interrupts", -1)) >= 0) - scsb->scsb_state |= SCSB_P06_INTR_ON; - else - scsb->scsb_state |= SCSB_P06_NOINT_KLUGE; - - /* - * Look for the device-err-threshold property which specifies - * on how many errors will scsb send a warning event about it's - * health. The scsb_err_threshold is 10 by default. - */ - if ((i = ddi_prop_get_int(DDI_DEV_T_ANY, dip, - DDI_PROP_DONTPASS, "device-err-threshold", -1)) >= 0) { - scsb_err_threshold = i; -#ifdef DEBUG - cmn_err(CE_NOTE, "?scsb_attach: Found device-err-threshold" - " property, value %d", scsb_err_threshold); -#endif - } - scsb->scsb_i2c_errcnt = 0; - scsb->scsb_err_flag = B_FALSE; - scsb->scsb_kstat_flag = B_FALSE; - - /* - * If all went well, create the minor node for user level access. - */ - if (ddi_create_minor_node(dip, scsb_name, S_IFCHR, instance, - "ddi_ctl:pcihpc", NULL) == DDI_FAILURE) { - cmn_err(CE_WARN, "scsb_attach: Failed to create minor node"); - free_resources(dip, scsb, instance); - return (DDI_FAILURE); - } - scsb->scsb_state |= SCSB_MINOR_NODE; - scsb->scsb_dev = dip; - if (ddi_create_minor_node(dip, scsb_clone_name, S_IFCHR, - instance|SCSB_CLONE, "ddi_ctl:pcihpc", NULL) - == DDI_FAILURE) { - cmn_err(CE_WARN, "scsb_attach: Failed to create clone node"); - free_resources(dip, scsb, instance); - return (DDI_FAILURE); - } - /* CLONE */ - bzero(scsb->clone_devs, sizeof (clone_dev_t) * SCSB_CLONES_MAX); - /* 2 */ - if (i2c_client_register(dip, &scsb->scsb_phandle) != I2C_SUCCESS) { - cmn_err(CE_WARN, - "scsb_attach: Failed I2C Services registration"); - free_resources(dip, scsb, instance); - return (DDI_FAILURE); - } - scsb->scsb_state |= SCSB_I2C_PHANDLE; - /* 3 */ - if ((scsb->scsb_i2ctp = scsb_alloc_i2ctx(scsb->scsb_phandle, - I2C_SLEEP)) == NULL) { - cmn_err(CE_WARN, - "scsb%d: i2c_transfer allocation failed", instance); - free_resources(dip, scsb, instance); - return (DDI_FAILURE); - } - scsb->scsb_state |= SCSB_I2C_TRANSFER; - /* - * Now it's time to INITIALIZE the boards. - * - * 1. make sure we can do I2C bus transfers to/from the SCB. - * Read the SCB PROM version for a check. - * 2. set SCB_INITIALIZED bit in SysCommand registers (SYS_CMD_BASE) - * 3. clear all LED Data registers (8) by writing 0's to turn off - * all LEDs on the SSB. - * 4. read System Configuration Status registers (SCTRL_CFG) - * to find present FRUs and set corresponding FRU bits at - * LED_DATA_BASE. - * Also enable devices in Topology map for the current MP_ID - * and set the OK LEDs on the SSB. - * 5. read Brd_Hlthy registers (2 @ BRD_HLTHY_BASE) - * 6. Disable PSM Interrupts during initialization, mask all - * interrupts, and clear Interrupt Pointer registers - * by writing 0xFF to each register. - * 7. set SCB EEPROM address bits SPA2-SPA0 at SYS_CMD_BASE + 1 - * 8. Install the interrupt handler if appropriate. - * 9. clear appropriate bits in Interrupt Mask register for those - * devices that can be present for this MP_ID Topology. - * 10. enable PSM Interrupt by writing '1' to PSM_INT_EN bit at - * SYS_CMD_BASE + 1 - * Also update all shadow registers for test utility - * if scsb_debug is set. - * 11. Check if Alarm Card present at boot and set flags - * 12. Call hsc_attach() for slot registration. - * 13. Allocate, initialze, and install the kstat structures. - * 14. Set scsb_state_t flags to indicate SCB is ready - * and announce the driver is loaded. - */ - - /* 1. through 7. */ - if (initialize_scb(scsb) != DDI_SUCCESS) { - if (!(scsb_debug)) { - free_resources(dip, scsb, instance); - return (DDI_FAILURE); - } - } - /* 8. */ - /* - * P0.6 No Interrupt Support - * Instead of installing the handler, it will be called from a user - * program via smf_ioctl(). This flag provides knowledge of the - * necessary workarounds to several scsb routines. - */ - /* - * Now Install interrupt handler - */ - if (scsb->scsb_state & SCSB_P06_INTR_ON) { - if (ddi_get_iblock_cookie(dip, instance, - &scsb->scsb_iblock) == DDI_SUCCESS) { - mutex_init(&scsb->scsb_imutex, NULL, MUTEX_DRIVER, - (void *)scsb->scsb_iblock); - scsb->scsb_state |= SCSB_IMUTEX; - if (ddi_add_intr(dip, instance, &scsb->scsb_iblock, - NULL, scsb_intr_preprocess, - (caddr_t)scsb) != DDI_SUCCESS) { - cmn_err(CE_WARN, - "scsb_attach: failed interrupt " - "handler registration"); - free_resources(dip, scsb, instance); - return (DDI_FAILURE); - } - scb_intr_mutex = &scsb->scsb_imutex; - nct_mutex_init |= MUTEX_INIT; - } else { - cmn_err(CE_WARN, "scsb_attach: failed interrupt " - "mutex initialization"); - if (scsb_debug) { - scsb->scsb_state |= SCSB_P06_NOINT_KLUGE; - scsb->scsb_state &= ~SCSB_P06_INTR_ON; - } else { - free_resources(dip, scsb, instance); - return (DDI_FAILURE); - } - } - } - /* 9. */ - if (i = scsb_clear_intmasks(scsb)) { - cmn_err(CE_WARN, - "scsb%d: I2C TRANSFER Failed", instance); - if (!scsb_debug) { - free_resources(dip, scsb, instance); - return (DDI_FAILURE); - } - } - - /* 10. */ - /* - * For P0.6 No Interrupt Support, don't enable PSM Interrupt - */ - if (!(scsb->scsb_state & SCSB_P06_NOINT_KLUGE)) { - rmask = 0x00; - wdata = 1 << SYS_OFFSET(SCTRL_SYS_PSM_INT_ENABLE); - i = SYS_REG_INDEX(SCTRL_SYS_PSM_INT_ENABLE, - SCTRL_SYS_CMD_BASE); - reg = SCSB_REG_ADDR(i); - if (i = scsb_write_mask(scsb, reg, rmask, wdata, (uchar_t)0)) { - cmn_err(CE_WARN, - "scsb%d: I2C TRANSFER Failed", instance); - if (!scsb_debug) { - free_resources(dip, scsb, instance); - return (DDI_FAILURE); - } - } else - scsb->scsb_state |= SCSB_PSM_INT_ENABLED; - } - if (scsb_debug) { - /* - * For smctrl test utility, - * so all data is available in shadow registers - * - * DEBUG_MODE enables private testing interfaces - * DIAGS_MODE permits limited testing interfaces - */ - scsb->scsb_state |= SCSB_DEBUG_MODE; - mutex_enter(&scsb->scsb_mutex); - if (scsb_readall_regs(scsb)) - cmn_err(CE_WARN, - "scsb_attach: scsb_readall FAILED"); - mutex_exit(&scsb->scsb_mutex); - } - /* 11. */ - /* Check if Alarm Card present at boot and set flags */ - if (scsb_fru_op(scsb, ALARM, 1, SCTRL_SYSCFG_BASE, - SCSB_FRU_OP_GET_BITVAL)) - scsb->scsb_hsc_state |= SCSB_ALARM_CARD_PRES; - - /* 12. */ - if (scsb_debug & 0x0004) - cmn_err(CE_NOTE, - "scsb_attach: registering cPCI slots"); - if (scsb_hsc_attach(dip, scsb, instance) != DDI_SUCCESS) { - if (scsb_debug & 0x00008000) { - cmn_err(CE_WARN, - "scsb: Hotswap controller initialisation" - " failed\n"); - } - } else - scsb->scsb_hsc_state |= SCSB_HSC_INIT; - /* 13. */ - /* - * allocate and install the kstat data structures - */ - if (scsb_alloc_kstats(scsb) != DDI_SUCCESS) { - if (scsb_debug & 0x0006) - cmn_err(CE_WARN, "scsb_attach: ERROR adding kstats"); - } - /* 14. */ - scsb->scsb_state |= SCSB_UP; - scsb_global_state |= SCSB_UP; - ddi_report_dev(scsb->scsb_dev); - cmn_err(CE_CONT, "?%s%d: " - "Prom Version %s, Midplane Id %x\n", - ddi_driver_name(scsb->scsb_dev), - scsb->scsb_instance, - (scsb->scsb_state & SCSB_P06_PROM) ? "0.6" : - (scsb->scsb_state & SCSB_P10_PROM) ? "1.0" : - (scsb->scsb_state & SCSB_P15_PROM) ? "1.5" : - (scsb->scsb_state & SCSB_P20_PROM) ? "2.0" : "Unknown", - mct_system_info.mid_plane.fru_id); - return (DDI_SUCCESS); -} - -/* - * This funciton is called from scsb_attach(), and from scsb_intr() as part - * of Hot Insertion support, to check the SCB PROM ID register and set - * scsb_state bits and register table pointers as necessary. - */ -static int -scb_check_version(scsb_state_t *scsb) -{ - int hotswap = 0; - uchar_t data; - if (scsb->scsb_state & SCSB_UP) { - /* - * If driver is UP, then this call is from scsb_intr() - * as part of Hot Insertion support. - */ - hotswap = 1; - } - /* Read the SCB PROM ID */ - if (scsb_rdwr_register(scsb, I2C_WR_RD, (uchar_t)SCTRL_PROM_VERSION, 1, - &data, 1)) { - if (!(hotswap && scsb->scsb_state & SCSB_FROZEN)) - cmn_err(CE_WARN, "scsb%d: I2C TRANSFER Failed", - scsb->scsb_instance); - if (scsb_debug & 0x0006) { - cmn_err(CE_WARN, - "scsb_attach(%d): failed read of PROM ID", - scsb->scsb_instance); - } - return (DDI_FAILURE); - } - /* - * compare with stored version number, and if different, - * report a warning and keep the driver FROZEN - */ - if (hotswap) { - if (((mct_system_info.fru_info_list[SCB])[0].fru_version & 0xf) - == (data & 0xf)) { - return (DDI_SUCCESS); - } - if (scsb_debug & 0x00020000) { - cmn_err(CE_NOTE, - "scb_check_version: SCB version %d " - "replacing version %d", data, - (mct_system_info.fru_info_list[SCB])[0]. - fru_version & 0xf); - } - } - if ((data & 0xf) == SCTRL_PROM_P06) { - scsb->scsb_state |= SCSB_P06_PROM; - } else if ((data & 0xf) == SCTRL_PROM_P10) { - scsb->scsb_state |= SCSB_P10_PROM; - } else if ((data & 0xf) == SCTRL_PROM_P15) { - scsb->scsb_state |= SCSB_P15_PROM; - } else if ((data & 0xf) == SCTRL_PROM_P20) { - scsb->scsb_state |= SCSB_P20_PROM; - } - if (!(scsb->scsb_state & SCSB_SCB_PRESENT)) - scsb->scsb_state |= SCSB_SCB_PRESENT; - if (IS_SCB_P10) { - scb_reg_index = scb_10_reg_index; - scb_numregs = scb_10_numregs; - scb_fru_offset = scb_10_fru_offset; - scb_sys_offset = scb_10_sys_offset; - } else { /* if (IS_SCB_P15) */ - scb_reg_index = scb_15_reg_index; - scb_numregs = scb_15_numregs; - scb_fru_offset = scb_15_fru_offset; - scb_sys_offset = scb_15_sys_offset; - } - if (!(IS_SCB_P15) && !(IS_SCB_P10)) { - cmn_err(CE_WARN, "scsb%d: SCB Version %d not recognized", - scsb->scsb_instance, data); - if (hotswap) - scsb->scsb_state |= SCSB_FROZEN; - if (!(scsb_debug)) { - return (DDI_FAILURE); - } - /* - * DEBUG: Assume SCB15 - */ - scsb->scsb_state |= SCSB_P15_PROM; - } - return (DDI_SUCCESS); -} - -/* - * SCB initialization steps to be called from scsb_attach() - * or from scsb_intr() calling scsb_restore() on Hot Insertion. - */ -static int -initialize_scb(scsb_state_t *scsb) -{ - register int i; - uchar_t reg, wdata, rmask; - /* - * If called from scsb_intr(), we've already done this - */ - if (!(scsb->scsb_state & SCSB_IN_INTR)) - if (scb_check_version(scsb) != DDI_SUCCESS) - return (DDI_FAILURE); - /* - * 2. Set the SCB_INIT bit in the System Command register - */ - rmask = 0x00; /* P1.0: 0x60; */ - wdata = 1 << SYS_OFFSET(SCTRL_SYS_SCB_INIT); - i = SYS_REG_INDEX(SCTRL_SYS_SCB_INIT, SCTRL_SYS_CMD_BASE); - reg = SCSB_REG_ADDR(i); - if (i = scsb_write_mask(scsb, reg, rmask, wdata, 0)) { - cmn_err(CE_WARN, - "scsb%d: I2C TRANSFER Failed", scsb->scsb_instance); - if (scsb_debug & 0x0006) { - cmn_err(CE_NOTE, - "scsb_attach: failed to set SCB_INIT"); - } - return (DDI_FAILURE); - } - /* 3. For P1.0 and previous system, turn off all LEDs */ - if (IS_SCB_P10) { - if (scsb_debug & 0x0004) { - cmn_err(CE_NOTE, "scsb_attach(%d): turning LEDs off", - scsb->scsb_instance); - } - if (i = scsb_leds_switch(scsb, OFF)) { - cmn_err(CE_WARN, "scsb%d: I2C TRANSFER Failed", - scsb->scsb_instance); - return (DDI_FAILURE); - } - } - /* 4. Read the SYSCFG registers, update FRU info and SSB LEDs */ - if (scsb_debug & 0x0004) - cmn_err(CE_NOTE, "scsb_attach(%d): reading config registers", - scsb->scsb_instance); - if ((i = scsb_check_config_status(scsb)) == 0) { - if (!(scsb->scsb_state & SCSB_TOPOLOGY)) { - scsb_set_topology(scsb); - if (scsb_debug & 0x0004) - cmn_err(CE_NOTE, "scsb_attach(%d): mpid = 0x%x", - scsb->scsb_instance, - mct_system_info.mid_plane.fru_id); - } else { - fru_info_t *fru_ptr; - /* - * walk through FRUs and update FRU info - */ - for (i = 0; i < SCSB_UNIT_TYPES; ++i) { - fru_ptr = mct_system_info.fru_info_list[i]; - while (fru_ptr != NULL) { - update_fru_info(scsb, fru_ptr); - fru_ptr = fru_ptr->next; - } - } - } - i = scsb_set_scfg_pres_leds(scsb, NULL); - } - if (i) { - cmn_err(CE_WARN, "scsb%d: I2C TRANSFER Failed", - scsb->scsb_instance); - return (DDI_FAILURE); - } - /* 5. read the Board Healthy registers */ - if (scsb_debug & 0x0004) - cmn_err(CE_NOTE, "scsb_attach(%d): reading Brd_Hlthy registers", - scsb->scsb_instance); - i = scsb_read_bhealthy(scsb); - if (i) { - cmn_err(CE_WARN, "scsb%d: I2C TRANSFER Failed", - scsb->scsb_instance); - return (DDI_FAILURE); - } - /* 6. Clear Interrupt Source registers */ - /* - * Due to some registration problems, we must first disable - * global interrupts which may be the default reset value - * itself. However, this is a safe step to do in case of - * implementation changes. - * - * Disable Global SCB Interrupts now - */ - rmask = 0x00; /* P1.0: 0x60; */ - wdata = 1 << SYS_OFFSET(SCTRL_SYS_PSM_INT_ENABLE); - i = SYS_REG_INDEX(SCTRL_SYS_PSM_INT_ENABLE, SCTRL_SYS_CMD_BASE); - reg = SCSB_REG_ADDR(i); - if (i = scsb_write_mask(scsb, reg, rmask, (uchar_t)0, wdata)) { - cmn_err(CE_WARN, "scsb%d: Cannot turn off PSM_INT", - scsb->scsb_instance); - return (DDI_FAILURE); - } - /* Mask all interrupt sources */ - if (i = scsb_setall_intmasks(scsb)) { - cmn_err(CE_WARN, "scsb%d: I2C TRANSFER Failed", - scsb->scsb_instance); - return (DDI_FAILURE); - } - /* Clear any latched interrupts */ - if (i = scsb_clear_intptrs(scsb)) { - cmn_err(CE_WARN, "scsb%d: I2C TRANSFER Failed", - scsb->scsb_instance); - return (DDI_FAILURE); - } - /* 7. set SCB EEPROM address: NOT USED */ - return (DDI_SUCCESS); -} - -/* - * Based on MC conditions, scsb_detach should eventually be made to always - * return FAILURE, as the driver should not be allowed to detach after some - * hs slots have been used. - */ -static int -scsb_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) -{ - int instance; - scsb_state_t *scsb; - uchar_t reg, wdata; - - /* - * TBD: make sure there are no outstanding operations on the system - * monitor card before detaching. - */ - instance = ddi_get_instance(dip); - if (scsb_debug & 0x0005) - cmn_err(CE_NOTE, "scsb_detach[%d]", instance); - if (cmd != DDI_DETACH) { - if (scsb_debug & 0x0006) - cmn_err(CE_NOTE, - "scsb_detach(%d): command %x is not DDI_DETACH\n", - instance, cmd); - return (DDI_FAILURE); - } - scsb = (scsb_state_t *)ddi_get_soft_state(scsb_state, instance); - scsb->scsb_state &= ~SCSB_UP; - scsb_global_state &= ~SCSB_UP; - if (scsb->scsb_hsc_state & SCSB_HSC_INIT) { - (void) scsb_hsc_detach(dip, scsb, instance); - scsb->scsb_hsc_state &= ~SCSB_HSC_INIT; - } - if (scsb->scsb_state & SCSB_PSM_INT_ENABLED) { - /* - * Disable Global SCB Interrupts now - */ - wdata = 1 << SYS_OFFSET(SCTRL_SYS_PSM_INT_ENABLE); - reg = SYS_REG_INDEX(SCTRL_SYS_PSM_INT_ENABLE, - SCTRL_SYS_CMD_BASE); - if (scsb_write_mask(scsb, reg, (uchar_t)0, (uchar_t)0, wdata)) { - cmn_err(CE_WARN, - "scsb%d: Cannot turn off PSM_INT", instance); - if (!scsb_debug) { - (void) free_resources(dip, scsb, instance); - return (DDI_FAILURE); - } - } - /* Mask all interrupts */ - if (scsb_setall_intmasks(scsb)) { - cmn_err(CE_WARN, - "scsb%d: I2C TRANSFER Failed", instance); - if (!scsb_debug) { - (void) free_resources(dip, scsb, instance); - return (DDI_FAILURE); - } - } - /* Clear all latched interrupts */ - if (scsb_clear_intptrs(scsb)) { - cmn_err(CE_WARN, - "scsb%d: I2C TRANSFER Failed", instance); - if (!scsb_debug) { - (void) free_resources(dip, scsb, instance); - return (DDI_FAILURE); - } - } - } - if (scsb->scsb_opens && scsb->scsb_rq != NULL) - qprocsoff(scsb->scsb_rq); - /* CLONE */ - (void) scsb_queue_ops(scsb, QPROCSOFF, 0, NULL, NULL); - /* - * free the allocated resources - */ - free_resources(dip, scsb, instance); - return (DDI_SUCCESS); -} - -static void -free_resources(dev_info_t *dip, scsb_state_t *scsb, int instance) -{ - if (scsb_debug & 0x0005) { - cmn_err(CE_NOTE, "free_resources[%d], scsb_state=0x%x", - instance, scsb->scsb_state); - drv_usecwait(500000); - } - if (scsb->scsb_state & SCSB_P06_INTR_ON && - scsb->scsb_state & SCSB_IMUTEX) { - scsb->scsb_state &= ~SCSB_P06_INTR_ON; - ddi_remove_intr(dip, 0, scsb->scsb_iblock); - } - if (scsb->scsb_state & SCSB_KSTATS) { - scsb_free_kstats(scsb); - scsb->scsb_state &= ~SCSB_KSTATS; - } - if (scsb->scsb_state & SCSB_TOPOLOGY) { - scsb_free_topology(scsb); - scsb->scsb_state &= ~SCSB_TOPOLOGY; - } - - nct_mutex_init = MUTEX_UNINIT; - if (scsb->scsb_state & SCSB_IMUTEX) { - scsb->scsb_state &= ~SCSB_IMUTEX; - mutex_destroy(&scsb->scsb_imutex); - } - if (scsb->scsb_state & SCSB_I2C_TRANSFER) { - scsb->scsb_state &= ~SCSB_I2C_TRANSFER; - i2c_transfer_free(scsb->scsb_phandle, scsb->scsb_i2ctp); - } - if (scsb->scsb_state & SCSB_I2C_PHANDLE) { - scsb->scsb_state &= ~SCSB_I2C_PHANDLE; - i2c_client_unregister(scsb->scsb_phandle); - } - if (scsb->scsb_state & SCSB_MINOR_NODE) { - scsb->scsb_state &= ~SCSB_MINOR_NODE; - ddi_remove_minor_node(dip, NULL); - } - if (scsb->scsb_state & SCSB_PROP_CREATE) { - scsb->scsb_state &= ~SCSB_PROP_CREATE; - (void) ddi_prop_remove(DDI_DEV_T_NONE, dip, - "interrupt-priorities"); - } - /* ddi_prop_remove_all(dip); */ - if (scsb->scsb_state & SCSB_CONDVAR) { - scsb->scsb_state &= ~SCSB_CONDVAR; - cv_destroy(&scsb->scsb_cv); - } - if (scsb->scsb_state & SCSB_UMUTEX) { - scsb->scsb_state &= ~SCSB_UMUTEX; - mutex_destroy(&scsb->scsb_mutex); - } - ddi_soft_state_free(scsb_state, instance); -} - -/* - * Just for testing scsb's poll function - */ -static int -scsb_fake_intr(scsb_state_t *scsb, uint32_t evcode) -{ - if (evcode == 0) - evcode = scsb_event_code; - else - scsb_event_code = evcode; - if (scsb_debug & 0x4001) { - cmn_err(CE_NOTE, "scsb_fake_intr: event = 0x%x, scsb_rq=0x%p", - scsb_event_code, (void *)scsb->scsb_rq); - } - /* - * Allow access to shadow registers even though SCB is removed - * - * if (scsb->scsb_state & SCSB_FROZEN) { - * return (EAGAIN); - * } - */ - if (scsb_debug & 0x00040000) { - check_fru_info(scsb, evcode); - add_event_code(scsb, evcode); - } - /* just inform user-level via poll about this event */ - if (scsb_queue_ops(scsb, QPUT_INT32, 1, &evcode, "scsb_fake_intr") - == QOP_FAILED) - return (ENOMEM); - return (0); -} - -/* ARGSUSED */ -static int -scsb_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result) -{ - int retval = DDI_FAILURE; - - if (scsb_debug & 0x0001) - cmn_err(CE_NOTE, "scsb_info()"); - - switch (infocmd) { - case DDI_INFO_DEVT2DEVINFO: - if (getminor((dev_t)arg) == 0 && scsb_dip != NULL) { - *result = (void *) scsb_dip; - retval = DDI_SUCCESS; - } - break; - - case DDI_INFO_DEVT2INSTANCE: - if (getminor((dev_t)arg) == 0) { - *result = (void *)0; - retval = DDI_SUCCESS; - } - break; - - default: - break; - } - - return (retval); -} - - -/* - * SCSB STREAMS routines - */ -/*ARGSUSED*/ -static int -sm_open(queue_t *q, dev_t *devp, int flag, int sflag, cred_t *credp) -{ - int instance, clone; - minor_t minor_dev; - clone_dev_t *clptr; - scsb_state_t *scsb; - - minor_dev = getminor(*devp); - instance = SCSB_GET_INSTANCE(minor_dev); - scsb = ddi_get_soft_state(scsb_state, instance); - if (scsb == NULL) - return (ENXIO); - - if (scsb_debug & 0x0009) { - cmn_err(CE_NOTE, "sm_open(%d) q=0x%p", instance, (void *)q); - } - if (!(scsb->scsb_state & SCSB_UP)) { - return (ENODEV); - } - /* - * Don't fail the open if SCB removed since we still want to satisfy - * read requests from the shadow registers, the last know register - * contents. On new SCB insertion, all will be re-initialized, - * including envmond and it's policies. - * - * if (scsb->scsb_state & SCSB_FROZEN) { - * return (EAGAIN); - * } - */ - ASSERT(credp != NULL); - /* - * XXX check for root access here, return EPERM if not root open - */ - if (sflag == MODOPEN) { - /* scsb module is being pushed */ - if (scsb_debug & 0x0008) - cmn_err(CE_NOTE, "sm_open(%d): MODOPEN", instance); - /* - * this is no longer supported - */ - return (ENXIO); - } else if (sflag == CLONEOPEN) { - /* scsb is being opened as a clonable driver */ - if (scsb_debug & 0x0008) - cmn_err(CE_NOTE, "sm_open(%d): CLONEOPEN", instance); - /* - * The cloned stream is not handled via the clone driver. - * See the minor device code below. - */ - return (ENXIO); - } else if (minor_dev & SCSB_CLONE) { - /* - * First check for the SCSB_CLONE device. - * Find an available clone_devs[] entry, or return ENXIO. - * Make new dev_t and store in *devp. - */ - if (scsb_debug & 0x0008) - cmn_err(CE_NOTE, - "sm_open(%d): SCSB_CLONE OPEN", instance); - mutex_enter(&scsb->scsb_mutex); - if ((clone = scsb_queue_ops(scsb, QFIRST_AVAILABLE, 0, NULL, - "scsb_open")) == QOP_FAILED) { - mutex_exit(&scsb->scsb_mutex); - return (ENXIO); - } - clptr = &scsb->clone_devs[clone]; - clptr->cl_flags = SCSB_OPEN; - clptr->cl_rq = RD(q); - clptr->cl_minor = SCSB_MAKE_MINOR(instance, clone); - *devp = makedevice(getmajor(*devp), clptr->cl_minor); - scsb->scsb_clopens++; - if (scsb_debug & 0x0008) - cmn_err(CE_NOTE, - "sm_open(%d): new clone device minor: 0x%x" - " stream queue is 0x%p", - instance, clptr->cl_minor, (void *)q); - } else { - /* scsb is being opened as a regular driver */ - if (scsb_debug & 0x0008) - cmn_err(CE_NOTE, "sm_open(%d): DEVOPEN", instance); - mutex_enter(&scsb->scsb_mutex); - if (scsb->scsb_state & SCSB_EXCL) { - if (scsb_debug & 0x0008) - cmn_err(CE_NOTE, - "sm_open(%d): can't open, state is EXCL", - instance); - mutex_exit(&scsb->scsb_mutex); - return (EBUSY); - } - if (flag & FEXCL) { - if (scsb_debug & 0x0008) - cmn_err(CE_NOTE, "sm_open(%d): is EXCL", - instance); - if (scsb->scsb_state & SCSB_OPEN) { - if (scsb_debug & 0x0008) - cmn_err(CE_NOTE, - "sm_open(%d): cannot open EXCL", - instance); - mutex_exit(&scsb->scsb_mutex); - return (EBUSY); - } - scsb->scsb_state |= SCSB_EXCL; - } - if (scsb->scsb_opens && scsb->scsb_rq != NULL && - scsb->scsb_rq != RD(q)) { - if (scsb_debug & 0x000a) - cmn_err(CE_WARN, "sm_open[%d]: q (0x%p) != " - "scsb_rq (0x%p)", - instance, (void *)RD(q), - (void *)scsb->scsb_rq); - } - scsb->scsb_rq = RD(q); - scsb->scsb_opens++; - } - scsb->scsb_state |= SCSB_OPEN; - mutex_exit(&scsb->scsb_mutex); - RD(q)->q_ptr = WR(q)->q_ptr = scsb; - qprocson(q); - return (0); -} - -/*ARGSUSED*/ -static int -sm_close(queue_t *q, int flag, cred_t *credp) -{ - scsb_state_t *scsb; - int clone; - clone_dev_t *clptr = NULL; - - scsb = (scsb_state_t *)q->q_ptr; - if (scsb_debug & 0x0009) - cmn_err(CE_NOTE, "sm_close[%d](0x%p)", scsb->scsb_instance, - (void *)q); - if (scsb->scsb_clopens) { - mutex_enter(&scsb->scsb_mutex); - if ((clone = scsb_queue_ops(scsb, QFIND_QUEUE, 0, - (void *) RD(q), "scsb_close")) != QOP_FAILED) { - clptr = &scsb->clone_devs[clone]; - clptr->cl_flags = 0; - clptr->cl_rq = NULL; - scsb->scsb_clopens--; - } - mutex_exit(&scsb->scsb_mutex); - if (scsb_debug & 0x0008 && clone < SCSB_CLONES_MAX && - clone >= SCSB_CLONES_FIRST) - cmn_err(CE_NOTE, "sm_close(%d): SCSB_CLONE 0x%x", - scsb->scsb_instance, clptr->cl_minor); - } - if (clptr == NULL && scsb->scsb_opens) { - if (scsb_debug & 0x0008) - cmn_err(CE_NOTE, "sm_close(%d): DEVOPEN, opens=%d", - scsb->scsb_instance, scsb->scsb_opens); - if (RD(q) != scsb->scsb_rq) { - if (scsb_debug & 0x0008) - cmn_err(CE_WARN, - "sm_close(%d): DEVOPEN, q != scsb_rq", - scsb->scsb_instance); - } - mutex_enter(&scsb->scsb_mutex); - scsb->scsb_opens = 0; - if (scsb->scsb_state & SCSB_EXCL) { - scsb->scsb_state &= ~SCSB_EXCL; - } - scsb->scsb_rq = (queue_t *)NULL; - mutex_exit(&scsb->scsb_mutex); - } - if (scsb->scsb_opens == 0 && scsb->scsb_clopens == 0) { - scsb->scsb_state &= ~SCSB_OPEN; - } - RD(q)->q_ptr = WR(q)->q_ptr = NULL; - qprocsoff(q); - return (0); -} - -/*ARGSUSED*/ -static int -sm_rput(queue_t *q, mblk_t *mp) -{ - if (scsb_debug & 0x0010) - cmn_err(CE_NOTE, "sm_rput"); - return (0); -} - -static int -sm_wput(queue_t *q, mblk_t *mp) -{ - scsb_state_t *scsb = (scsb_state_t *)WR(q)->q_ptr; - - if (scsb_debug & 0x0010) - cmn_err(CE_NOTE, "sm_wput(%d): mp %p", scsb->scsb_instance, - (void *)mp); - - switch (mp->b_datap->db_type) { - default: - freemsg(mp); - break; - - case M_FLUSH: /* canonical flush handling */ - if (*mp->b_rptr & FLUSHW) { - flushq(q, FLUSHDATA); - /* free any messages tied to scsb */ - } - - if (*mp->b_rptr & FLUSHR) { - *mp->b_rptr &= ~FLUSHW; - qreply(q, mp); - } else - freemsg(mp); - break; - - case M_IOCTL: - if (scsb_debug & 0x0010) - cmn_err(CE_NOTE, "sm_wput(%d): M_IOCTL", - scsb->scsb_instance); - /* do ioctl */ - smf_ioctl(q, mp); - break; - - case M_DATA: - if (scsb_debug & 0x0010) - cmn_err(CE_NOTE, "sm_wput(%d): M_DATA", - scsb->scsb_instance); - if (!(scsb->scsb_state & SCSB_UP)) { - freemsg(mp); - return (0); - } - freemsg(mp); - break; - - case M_CTL: - if (scsb_debug & 0x0010) - cmn_err(CE_NOTE, "sm_wput(%d): M_CTL", - scsb->scsb_instance); - freemsg(mp); - break; - } - - return (0); -} - - -/* - * These are the system monitor upper ioctl functions. - */ -static void -smf_ioctl(queue_t *q, mblk_t *mp) -{ - scsb_state_t *scsb = (scsb_state_t *)q->q_ptr; - struct iocblk *iocp = (struct iocblk *)mp->b_rptr; - - if (scsb_debug & 0x0020) - cmn_err(CE_NOTE, "smf_ioctl(%d): (%p)->cmd=%x", - scsb->scsb_instance, (void *)mp, iocp->ioc_cmd); - - if (!(scsb->scsb_state & SCSB_UP)) { - miocnak(q, mp, 0, ENXIO); - return; - } - /* - * Don't fail ALL commands if the SCB removed, since we still want to - * satisfy some requests from the shadow registers, the last known - * register contents. - * - * if (scsb->scsb_state & SCSB_FROZEN) { - * iocp->ioc_error = EAGAIN; - * mp->b_datap->db_type = M_IOCNAK; - * qreply(q, mp); - * return; - * } - */ - - iocp->ioc_error = 0; - switch (iocp->ioc_cmd) { - default: - /* if we don't understand the ioctl */ - if (scsb_debug & 0x0022) - cmn_err(CE_NOTE, "smf_ioctl(%d):unkown ioctl %x", - scsb->scsb_instance, iocp->ioc_cmd); - iocp->ioc_error = EINVAL; - break; - - case ENVC_IOC_GETMODE: - { - uint8_t *curr_mode; - - iocp->ioc_error = miocpullup(mp, sizeof (uint8_t)); - if (iocp->ioc_error != 0) - break; - - curr_mode = (uint8_t *)mp->b_cont->b_rptr; - if (scsb->scsb_state & SCSB_DEBUG_MODE) - *curr_mode = (uint8_t)ENVC_DEBUG_MODE; - else if (scsb->scsb_state & SCSB_DIAGS_MODE) - *curr_mode = (uint8_t)ENVCTRL_DIAG_MODE; - else - *curr_mode = (uint8_t)ENVCTRL_NORMAL_MODE; - - if (scsb_debug & 0x20) { - cmn_err(CE_NOTE, "IOC_GETMODE: returning mode 0x%x", - *curr_mode); - } - break; - } - - case ENVC_IOC_SETMODE: - { - uint8_t *curr_mode; - - iocp->ioc_error = miocpullup(mp, sizeof (uint8_t)); - if (iocp->ioc_error != 0) - break; - - curr_mode = (uint8_t *)mp->b_cont->b_rptr; - switch (*curr_mode) { - case ENVCTRL_NORMAL_MODE: - scsb->scsb_state &= - ~(SCSB_DEBUG_MODE | SCSB_DIAGS_MODE); - break; - case ENVCTRL_DIAG_MODE: - scsb->scsb_state |= SCSB_DIAGS_MODE; - scsb->scsb_state &= ~SCSB_DEBUG_MODE; - break; - case ENVC_DEBUG_MODE: - if (scsb->scsb_state & - (SCSB_DIAGS_MODE | SCSB_DEBUG_MODE)) { - scsb->scsb_state &= ~SCSB_DIAGS_MODE; - scsb->scsb_state |= SCSB_DEBUG_MODE; - } else { - iocp->ioc_error = EACCES; - } - break; - default: - if (scsb_debug & 0x22) { - cmn_err(CE_WARN, - "IOC_SETMODE: Invalid mode 0x%x", - *curr_mode); - } - iocp->ioc_error = EINVAL; - break; - } - break; - } - - case ENVC_IOC_ACQUIRE_SLOT_LED_CTRL: - if (scsb->scsb_state & SCSB_APP_SLOTLED_CTRL) - iocp->ioc_error = EAGAIN; - else { - scsb->scsb_state |= SCSB_APP_SLOTLED_CTRL; - iocp->ioc_error = 0; - } - break; - - case ENVC_IOC_RELEASE_SLOT_LED_CTRL: - scsb->scsb_state &= ~SCSB_APP_SLOTLED_CTRL; - iocp->ioc_error = 0; - break; - - /* - * Not an exposed interface, only used by development utilities. - */ - case SCSBIOC_GET_VERSIONS: - { - uint8_t *ppromid, promid; - scsb_ids_t *sids; - - if (iocp->ioc_count == sizeof (uint8_t)) { - iocp->ioc_error = miocpullup(mp, sizeof (uint8_t)); - if (iocp->ioc_error != 0) - break; - - ppromid = (uint8_t *)mp->b_cont->b_rptr; - *ppromid = (uint8_t)(mct_system_info. - fru_info_list[SCB])->fru_version; - promid = *ppromid; - } else { - iocp->ioc_error = miocpullup(mp, sizeof (scsb_ids_t)); - if (iocp->ioc_error != 0) - break; - - sids = (scsb_ids_t *)mp->b_cont->b_rptr; - bcopy(modldrv.drv_linkinfo, sids->modldrv_string, - SCSB_MODSTR_LEN); - bcopy(scsb_build_version, sids->scsb_version, - SCSB_VERSTR_LEN); - sids->promid = (uint8_t)(mct_system_info. - fru_info_list[SCB])->fru_version; - - promid = sids->promid; - if (scsb_debug & 0x20) { - cmn_err(CE_NOTE, - "IOC_GET_VERSIONS: sizeof(scsb_ids_t) " - "= %lu", sizeof (scsb_ids_t)); - } - } - if (scsb_debug & 0x20) { - cmn_err(CE_NOTE, - "IOC_GET_VERSIONS: SCB PROMID = 0x%x", promid); - } - break; - } - -#ifdef DEBUG - case ENVC_IOC_REGISTER_PID: - iocp->ioc_error = miocpullup(mp, sizeof (pid_t)); - if (iocp->ioc_error == 0) { - if (add_event_proc(scsb, *(pid_t *)mp->b_cont->b_rptr)) - iocp->ioc_error = ENOMEM; - } - break; - - case ENVC_IOC_UNREGISTER_PID: - iocp->ioc_error = miocpullup(mp, sizeof (pid_t)); - if (iocp->ioc_error == 0) { - if (del_event_proc(scsb, *(pid_t *)mp->b_cont->b_rptr)) - iocp->ioc_error = EINVAL; - } - break; - - case SCSBIOC_VALUE_MODE: - { - uint32_t *mode_vals; - int three_vals = 0; - - if (!(scsb->scsb_state & SCSB_DEBUG_MODE)) { - iocp->ioc_error = EINVAL; - break; - } - - if (iocp->ioc_count == sizeof (uint32_t) * 3) - three_vals = 1; - else if (iocp->ioc_count != sizeof (uint32_t) * 2) { - iocp->ioc_error = EINVAL; - break; - } - - iocp->ioc_error = miocpullup(mp, iocp->ioc_count); - if (iocp->ioc_error != 0) - break; - - /* - * check mode_vals[0] for get/set option. setting - * scsb_state is not valid for now. 0 == GET, 1 == SET - */ - mode_vals = (uint32_t *)mp->b_cont->b_rptr; - if (mode_vals[0]) { - scsb_debug = mode_vals[1]; - } else { - mode_vals[0] = scsb->scsb_state; - if (three_vals) { - mode_vals[1] = scsb->scsb_hsc_state; - mode_vals[2] = scsb_debug; - } else - mode_vals[1] = scsb_debug; - } - if ((scsb_debug & 0x20) && three_vals) { - cmn_err(CE_NOTE, "IOC_VALUE_MODE: mode_vals: " - "0x%x/0x%x/0x%x; ioc_count = 0x%lx", - mode_vals[0], mode_vals[1], mode_vals[2], - iocp->ioc_count); - } - break; - } - -#ifdef DEBUG - case SCSBIOC_GET_SLOT_INFO: - { - hsc_slot_t *slot_info = NULL; - uint32_t *slot_vals; - int pslotnum; - - if (!(scsb->scsb_state & SCSB_DEBUG_MODE)) { - iocp->ioc_error = EINVAL; - break; - } - - iocp->ioc_error = miocpullup(mp, sizeof (uint32_t) * 2); - if (iocp->ioc_error != 0) - break; - - slot_vals = (uint32_t *)mp->b_cont->b_rptr; - pslotnum = (int)*slot_vals; - hsc_ac_op((int)scsb->scsb_instance, pslotnum, - SCSB_HSC_AC_GET_SLOT_INFO, &slot_info); - if (slot_info == NULL) { - iocp->ioc_error = ENODEV; - break; - } - *slot_vals = (uint32_t)slot_info->hs_flags; - *(++slot_vals) = (uint32_t)slot_info->hs_slot_state; - if (scsb_debug & 0x20) { - cmn_err(CE_NOTE, "IOC_GET_SLOT_STATE: slot_vals: " - "0x%x/0x%x; ioc_count = 0x%lx", - slot_vals[0], slot_vals[1], iocp->ioc_count); - } - break; - } -#endif /* DEBUG */ - - case SCSBIOC_GET_FAN_STATUS: - case SCSBIOC_GET_INTR_ARRAY: - /* for now we don't understand these ioctls */ - if (scsb_debug & 0x0022) - cmn_err(CE_NOTE, "smf_ioctl(%d):unknown ioctl %x", - scsb->scsb_instance, iocp->ioc_cmd); - iocp->ioc_error = EINVAL; - break; -#endif /* DEBUG */ - - case SCSBIOC_LED_OK_GET: - case SCSBIOC_LED_NOK_GET: - case SCSBIOC_LED_OK_SET: - case SCSBIOC_LED_NOK_SET: - case SCSBIOC_BHEALTHY_GET: - case SCSBIOC_SLOT_OCCUPANCY: - case SCSBIOC_RESET_UNIT: - if (!(scsb->scsb_state & (SCSB_DIAGS_MODE | SCSB_DEBUG_MODE))) { - iocp->ioc_error = EACCES; - break; - } - /*FALLTHROUGH*/ - - case ENVC_IOC_GETDSKLED: - case ENVC_IOC_SETDSKLED: - case ENVC_IOC_SETFSP: - { - scsb_uinfo_t *suip; - - iocp->ioc_error = miocpullup(mp, sizeof (scsb_uinfo_t)); - if (iocp->ioc_error != 0) - break; - - suip = (scsb_uinfo_t *)mp->b_cont->b_rptr; - switch (iocp->ioc_cmd) { - case SCSBIOC_LED_OK_GET: - iocp->ioc_error = scsb_led_get(scsb, suip, OK); - break; - case SCSBIOC_LED_NOK_GET: - iocp->ioc_error = scsb_led_get(scsb, suip, NOK); - break; - case SCSBIOC_LED_OK_SET: - iocp->ioc_error = scsb_led_set(scsb, suip, OK); - break; - case SCSBIOC_LED_NOK_SET: - iocp->ioc_error = scsb_led_set(scsb, suip, NOK); - break; - case SCSBIOC_BHEALTHY_GET: - iocp->ioc_error = scsb_bhealthy_slot(scsb, suip); - break; - case SCSBIOC_SLOT_OCCUPANCY: - iocp->ioc_error = scsb_slot_occupancy(scsb, suip); - break; - case SCSBIOC_RESET_UNIT: - iocp->ioc_error = scsb_reset_unit(scsb, suip); - break; - case ENVC_IOC_GETDSKLED: - if (suip->unit_type != DISK) { - iocp->ioc_error = EINVAL; - break; - } - iocp->ioc_error = scsb_led_get(scsb, suip, NOUSE); - break; - case ENVC_IOC_SETDSKLED: - if (suip->unit_type != DISK) { - iocp->ioc_error = EINVAL; - break; - } - iocp->ioc_error = scsb_led_set(scsb, suip, NOUSE); - break; - case ENVC_IOC_SETFSP: - if (scsb->scsb_state & SCSB_FROZEN) { - iocp->ioc_error = EAGAIN; - break; - } - iocp->ioc_error = scsb_led_set(scsb, suip, NOUSE); - break; - } - break; - } - - case SCSBIOC_FAKE_INTR: { - uint32_t ui; - - if (!(scsb->scsb_state & SCSB_DEBUG_MODE)) { - iocp->ioc_error = EINVAL; - break; - } - if (mp->b_cont == NULL) - ui = 0; - else { - iocp->ioc_error = miocpullup(mp, sizeof (uint32_t)); - if (iocp->ioc_error != 0) - break; - ui = *(uint32_t *)mp->b_cont->b_rptr; - } - iocp->ioc_error = scsb_fake_intr(scsb, ui); - break; - } - - case SCSBIOC_GET_STATUS : - if (!(scsb->scsb_state & SCSB_DEBUG_MODE)) { - iocp->ioc_error = EINVAL; - break; - } - iocp->ioc_error = miocpullup(mp, sizeof (scsb_status_t)); - if (iocp->ioc_error == 0) - iocp->ioc_error = scsb_get_status(scsb, - (scsb_status_t *)mp->b_cont->b_rptr); - break; - - case SCSBIOC_ALL_LEDS_ON : - if (!(scsb->scsb_state & (SCSB_DIAGS_MODE | SCSB_DEBUG_MODE))) - iocp->ioc_error = EACCES; - else - iocp->ioc_error = scsb_leds_switch(scsb, ON); - break; - - case SCSBIOC_ALL_LEDS_OFF : - if (!(scsb->scsb_state & (SCSB_DIAGS_MODE | SCSB_DEBUG_MODE))) - iocp->ioc_error = EACCES; - else - iocp->ioc_error = scsb_leds_switch(scsb, OFF); - break; - - case SCSBIOC_REG_READ: - case SCSBIOC_REG_WRITE: - if (!(scsb->scsb_state & (SCSB_DIAGS_MODE | SCSB_DEBUG_MODE))) { - iocp->ioc_error = EACCES; - } else { - scsb_ioc_rdwr_t *iocrdwrp; - - if (scsb->scsb_state & SCSB_FROZEN && - !(scsb->scsb_state & SCSB_DEBUG_MODE)) { - iocp->ioc_error = EAGAIN; - break; - } - - iocp->ioc_error = miocpullup(mp, sizeof (*iocrdwrp)); - if (iocp->ioc_error == 0) { - iocrdwrp = - (scsb_ioc_rdwr_t *)mp->b_cont->b_rptr; - - if (iocp->ioc_cmd == SCSBIOC_REG_READ) { - if (iocrdwrp->ioc_rlen > 0) { - sm_ioc_rdwr(q, mp, I2C_WR_RD); - return; - } - } else { - if (iocrdwrp->ioc_wlen > 0) { - sm_ioc_rdwr(q, mp, I2C_WR); - return; - } - } - iocp->ioc_error = EINVAL; - break; - } - } - break; - - case SCSBIOC_SHUTDOWN_POLL: - case SCSBIOC_INTEVENT_POLL: - if (!(scsb->scsb_state & SCSB_DEBUG_MODE)) { - iocp->ioc_error = EINVAL; - break; - } - iocp->ioc_error = miocpullup(mp, sizeof (uint32_t)); - if (iocp->ioc_error == 0) - iocp->ioc_error = scsb_polled_int(scsb, iocp->ioc_cmd, - (uint32_t *)mp->b_cont->b_rptr); - break; - - case SCSBIOC_RESTORE : - if (!(scsb->scsb_state & (SCSB_DIAGS_MODE | SCSB_DEBUG_MODE))) - iocp->ioc_error = EACCES; - else { - scsb_restore(scsb); - (void) scsb_toggle_psmint(scsb, 1); - iocp->ioc_error = 0; - } - break; - - case SCSBIOC_FREEZE : - if (!(scsb->scsb_state & (SCSB_DIAGS_MODE | SCSB_DEBUG_MODE))) - iocp->ioc_error = EACCES; - else { - scsb_freeze_check(scsb); - scsb_freeze(scsb); - iocp->ioc_error = 0; - } - break; - - /* - * envmond:alarmcard.so response to SCTRL_EVENT_ALARM_INSERTION - */ - case ENVC_IOC_ACCONF_RESTORED: - (void) scsb_hsc_ac_op(scsb, scsb->ac_slotnum, - SCSB_HSC_AC_SET_BUSY); - break; - - /* - * envmond:alarmcard.so response to SCTRL_EVENT_ALARM_REMOVAL - */ - case ENVC_IOC_ACCONF_STORED: - if (scsb->scsb_state & SCSB_FROZEN) { - iocp->ioc_error = EAGAIN; - break; - } - (void) scsb_hsc_ac_op(scsb, scsb->ac_slotnum, - SCSB_HSC_AC_UNCONFIGURE); - break; - -#ifdef DEBUG - case SCSBIOC_TOPOLOGY_DUMP: - if (!(scsb->scsb_state & SCSB_DEBUG_MODE)) - iocp->ioc_error = EINVAL; - else { - mct_topology_dump(scsb, 1); - iocp->ioc_error = 0; - } - break; -#endif - } - if (iocp->ioc_error) - mp->b_datap->db_type = M_IOCNAK; - else - mp->b_datap->db_type = M_IOCACK; - qreply(q, mp); -} - -static fru_info_t * -find_fru_info(fru_id_t fru_id) -{ - int i; - fru_info_t *fru_ptr; - - if (scsb_debug & 0x00100001) - cmn_err(CE_NOTE, "find_fru_info(0x%x)", fru_id); - if (fru_id == (fru_id_t)0) - return ((fru_info_t *)NULL); - for (i = 0; i < SCSB_UNIT_TYPES; ++i) { - fru_ptr = mct_system_info.fru_info_list[i]; - while (fru_ptr != NULL) { - if (fru_ptr->fru_id == fru_id) - return (fru_ptr); - fru_ptr = fru_ptr->next; - } - } - return ((fru_info_t *)NULL); -} - - -struct scsb_cb_entry { - void *cb_softstate_ptr; - fru_id_t cb_fru_id; - scsb_fru_event_t cb_event; - void (*cb_func) - (void *, scsb_fru_event_t, scsb_fru_status_t); - fru_info_t *cb_fru_ptr; - struct scsb_cb_entry *cb_next; -}; - -#ifdef DEBUG -int scsb_cb_count = 0; -#else -static -#endif -struct scsb_cb_entry *scsb_cb_table; - -/* - * global function for interested FRU drivers to register a callback function, - * to be called when FRU presence status changes. - */ -scsb_fru_status_t -scsb_fru_register(void (*cb_func)(void *, scsb_fru_event_t, scsb_fru_status_t), - void *soft_ptr, fru_id_t fru_id) -{ - struct scsb_cb_entry *cbe_ptr; - - if (scsb_debug & 0x00800001) { - cmn_err(CE_NOTE, - "scsb_fru_register: FRU_ID 0x%x", (int)fru_id); - } - if (!(scsb_global_state & SCSB_UP)) { - return (FRU_NOT_AVAILABLE); - } - if (cb_func == NULL || fru_id == (fru_id_t)0) - return (FRU_NOT_AVAILABLE); - if (scsb_cb_table == NULL) - scsb_cb_table = (struct scsb_cb_entry *) - kmem_zalloc(sizeof (struct scsb_cb_entry), KM_SLEEP); - cbe_ptr = scsb_cb_table; - while (cbe_ptr->cb_softstate_ptr != NULL) { - if (cbe_ptr->cb_next == (struct scsb_cb_entry *)NULL) { - cbe_ptr->cb_next = (struct scsb_cb_entry *) - kmem_zalloc(sizeof (struct scsb_cb_entry), - KM_SLEEP); - cbe_ptr = cbe_ptr->cb_next; - break; - } - cbe_ptr = cbe_ptr->cb_next; - } - cbe_ptr->cb_softstate_ptr = soft_ptr; - cbe_ptr->cb_fru_id = fru_id; - cbe_ptr->cb_func = cb_func; - cbe_ptr->cb_next = (struct scsb_cb_entry *)NULL; - cbe_ptr->cb_fru_ptr = find_fru_info(fru_id); -#ifdef DEBUG - scsb_cb_count++; -#endif - if (scsb_debug & 0x00800000) { - cmn_err(CE_NOTE, - "scsb_fru_register: FRU_ID 0x%x, status=%d", - (int)fru_id, - (cbe_ptr->cb_fru_ptr == (fru_info_t *)NULL) ? - 0xff : cbe_ptr->cb_fru_ptr->fru_status); - } - if (cbe_ptr->cb_fru_ptr == (fru_info_t *)NULL) - return (FRU_NOT_AVAILABLE); - if (cbe_ptr->cb_fru_ptr->fru_status & FRU_PRESENT) - return (FRU_PRESENT); - return (FRU_NOT_PRESENT); -} - -void -scsb_fru_unregister(void *soft_ptr, fru_id_t fru_id) -{ - struct scsb_cb_entry *prev_ptr, *cbe_ptr; - - if (scsb_debug & 0x00800001) { - cmn_err(CE_NOTE, "scsb_fru_unregister(0x%p, 0x%x)", - soft_ptr, (int)fru_id); - } - if ((cbe_ptr = scsb_cb_table) == NULL || fru_id == (fru_id_t)0) - return; - prev_ptr = cbe_ptr; - do { - if (cbe_ptr->cb_softstate_ptr == soft_ptr && - cbe_ptr->cb_fru_id == fru_id) { - if (cbe_ptr == scsb_cb_table) - scsb_cb_table = cbe_ptr->cb_next; - else - prev_ptr->cb_next = cbe_ptr->cb_next; - kmem_free(cbe_ptr, sizeof (struct scsb_cb_entry)); -#ifdef DEBUG - scsb_cb_count--; -#endif - return; - } - prev_ptr = cbe_ptr; - } while ((cbe_ptr = cbe_ptr->cb_next) != NULL); -} - -/* - * global function for interested FRU drivers to call to check - * FRU presence status. - */ -scsb_fru_status_t -scsb_fru_status(uchar_t fru_id) -{ - fru_info_t *fru_ptr; - - fru_ptr = find_fru_info(fru_id); - if (scsb_debug & 0x00800001) { - cmn_err(CE_NOTE, "scsb_fru_status(0x%x): status=0x%x", - fru_id, (fru_ptr == (fru_info_t *)NULL) ? 0xff : - (int)fru_ptr->fru_status); - } - if (fru_ptr == (fru_info_t *)NULL) - return (FRU_NOT_AVAILABLE); - return (fru_ptr->fru_status); -} - -/* - * Global function for the other interruptible FRU device sharing the - * same interrupt line to register the interrupt handler with scsb. - * This enables all the handlers to be called whenever the interrupt - * line is asserted by anyone shaing the interrupt line. - */ - -/* - * The interrupt handler table is currently a linked list. probably a - * hash table will be more efficient. Usage of these facilities can - * happen even before scsb is attached, so do not depend on scsb - * structure being present. - */ -struct fru_intr_entry { - void *softstate_ptr; - int (*fru_intr_handler)(void *); - fru_id_t fru_id; - struct fru_intr_entry *fru_intr_next; -} *fru_intr_table = NULL; - -int -scsb_intr_register(int (*intr_handler)(void *), void * soft_ptr, - fru_id_t fru_id) -{ - struct fru_intr_entry *intr_table_entry; - intr_table_entry = (struct fru_intr_entry *) - kmem_zalloc(sizeof (struct fru_intr_entry), KM_SLEEP); - - if (intr_table_entry == NULL) { - return (DDI_FAILURE); - } - - if (intr_handler == NULL || soft_ptr == NULL || fru_id == 0) { - kmem_free(intr_table_entry, sizeof (struct fru_intr_entry)); - return (DDI_FAILURE); - } - - intr_table_entry->softstate_ptr = soft_ptr; - intr_table_entry->fru_intr_handler = intr_handler; - intr_table_entry->fru_id = fru_id; - intr_table_entry->fru_intr_next = fru_intr_table; - fru_intr_table = intr_table_entry; - - return (DDI_SUCCESS); -} - -/* - * Removed interrupt_handler of fru from interrupt call chain - */ -void -scsb_intr_unregister(fru_id_t fru_id) -{ - struct fru_intr_entry *intr_entry = fru_intr_table, - *prev_entry = intr_entry; - - if (fru_id == 0) { - return; - } - - do { - if (intr_entry->fru_id == fru_id) { - /* found a match, remove entry */ - if (intr_entry == fru_intr_table) - fru_intr_table = intr_entry->fru_intr_next; - else - prev_entry->fru_intr_next = - intr_entry->fru_intr_next; - - kmem_free(intr_entry, - sizeof (struct fru_intr_entry)); - return; - } - prev_entry = intr_entry; - - } while ((intr_entry = intr_entry->fru_intr_next) != NULL); -} - -/* - * Invoke all the registered interrupt handlers, whenever scsb_intr - * is called. This function will go through the list of entries - * in the fru interrupt table and invoke each function. Returns - * whether interrupt is claimed or unclaimed. - */ -static int -scsb_invoke_intr_chain() -{ - int retval = DDI_INTR_UNCLAIMED; - struct fru_intr_entry *intr_entry = fru_intr_table; - - while (intr_entry != NULL) { - retval = (*intr_entry-> - fru_intr_handler)(intr_entry->softstate_ptr); - if (retval == DDI_INTR_CLAIMED) { - return (retval); - } - - intr_entry = intr_entry->fru_intr_next; - } - - return (retval); -} - - -/* - * The scsb_ioc_rdwr_t is similar enough to an i2c_transfer_t that we can - * translate the structures and use the i2c_transfer() service. - */ -static void -sm_ioc_rdwr(queue_t *q, mblk_t *mp, int op) -{ - scsb_state_t *scsb = (scsb_state_t *)q->q_ptr; - struct iocblk *iocp = (struct iocblk *)mp->b_rptr; - scsb_ioc_rdwr_t *iocrdwrp; - int len, error; - uchar_t *uc, reg; - - if (scsb_debug & 0x0040) - cmn_err(CE_CONT, "sm_ioc_rdwr[%d]:", scsb->scsb_instance); - iocrdwrp = (scsb_ioc_rdwr_t *)mp->b_cont->b_rptr; - if (op == I2C_WR) { - len = iocrdwrp->ioc_wlen; - uc = iocrdwrp->ioc_wbuf; - } else { - len = iocrdwrp->ioc_rlen; - uc = iocrdwrp->ioc_rbuf; - } - /* - * Check SCB register index boundries and requested len of read/write - */ - reg = iocrdwrp->ioc_regindex; - if (reg < SCSB_REG_ADDR_START || (reg + len) > - (SCSB_REG_ADDR_START + SCTRL_TOTAL_NUMREGS)) - error = EINVAL; - else - error = scsb_rdwr_register(scsb, op, reg, len, uc, 1); - if (error) { - if (scsb_debug & 0x0042) - cmn_err(CE_WARN, - "sm_ioc_rdwr: rdwr_register failure: %d", error); - mp->b_datap->db_type = M_IOCNAK; - } else - mp->b_datap->db_type = M_IOCACK; - iocp->ioc_error = error; - qreply(q, mp); -} - -/* - * names for (scsb_utype_t) FRU types - */ -static char *led_name[SCSB_LED_TYPES] = { "NOK", "OK" }; -static char *unit_type_name[SCSB_UNIT_TYPES] = { - "SLOT", "PDU", "POWER SUPPLY", "DISK", "FAN", "ALARM", - "SCB", "SSB", "CFTM", "CRTM", "PRTM" -}; - -/* - * Discover the register and bit-offset for LEDs and Reset registers, - * according to unit_type, unit_number, and led_type. - */ -static int -scsb_get_led_regnum(scsb_state_t *scsb, - scsb_uinfo_t *suip, - uchar_t *regptr, - int *unitptr, - scsb_led_t led_type) -{ - int code, base, error; - - /* OK here means presence (OK) LEDs */ - if (led_type == OK) - base = (SCTRL_LED_OK_BASE); - else - base = (SCTRL_LED_NOK_BASE); - error = 0; - if (scsb_debug & 0x0100) { - cmn_err(CE_NOTE, "get_led_regnum: suip <%x, %x, %x, %x>\n", - suip->unit_type, suip->unit_number, - led_type, suip->unit_state); - } - /* - * It was requested that the scsb driver allow accesses to SCB device - * registers for FRUs that cannot be present. - * So except for SLOTs, if the unit_number check fails, we now - * just log a message, but ONLY if scsb_debug error messages are - * enabled. - */ - switch (suip->unit_type) { - case SLOT: - if (suip->unit_number < 1 || suip->unit_number > - ((scsb->scsb_state & SCSB_IS_TONGA) ? - TG_MAX_SLOTS : MC_MAX_SLOTS)) { - error = EINVAL; - break; - } - code = FRU_UNIT_TO_EVCODE(SLOT, suip->unit_number); - break; - - case PDU: - if (suip->unit_number < 1 || suip->unit_number > - ((scsb->scsb_state & SCSB_IS_TONGA) ? - TG_MAX_PDU : MC_MAX_PDU)) { - if (scsb_debug & 0x0002) { - cmn_err(CE_WARN, - "get_led_regnum: unit number %d " - "is out of range", suip->unit_number); - } - error = EINVAL; - break; - } - code = FRU_UNIT_TO_EVCODE(PDU, suip->unit_number); - break; - - case PS: - if ((suip->unit_number < 1 || suip->unit_number > - ((scsb->scsb_state & SCSB_IS_TONGA) ? - TG_MAX_PS : MC_MAX_PS))) { - if (scsb_debug & 0x0002) { - cmn_err(CE_WARN, - "get_led_regnum: unit number %d " - "is out of range", suip->unit_number); - } - error = EINVAL; - break; - } - code = FRU_UNIT_TO_EVCODE(PS, suip->unit_number); - break; - - case DISK: - if ((suip->unit_number < 1 || suip->unit_number > - ((scsb->scsb_state & SCSB_IS_TONGA) ? - TG_MAX_DISK : MC_MAX_DISK))) { - if (scsb_debug & 0x0002) { - cmn_err(CE_WARN, - "get_led_regnum: unit number %d " - "is out of range", suip->unit_number); - } - if (!(scsb_debug & 0x20000000)) { - error = EINVAL; - break; - } - } - code = FRU_UNIT_TO_EVCODE(DISK, suip->unit_number); - break; - - case FAN: - if (suip->unit_number < 1 || suip->unit_number > - ((scsb->scsb_state & SCSB_IS_TONGA) ? - TG_MAX_FAN : MC_MAX_FAN)) { - if (scsb_debug & 0x0002) { - cmn_err(CE_WARN, - "get_led_regnum: unit number %d " - "is out of range", suip->unit_number); - } - error = EINVAL; - break; - } - code = FRU_UNIT_TO_EVCODE(FAN, suip->unit_number); - break; - - case CFTM: - if (suip->unit_number < 1 || suip->unit_number > - ((scsb->scsb_state & SCSB_IS_TONGA) ? - TG_MAX_CFTM : MC_MAX_CFTM)) { - if (scsb_debug & 0x0002) { - cmn_err(CE_WARN, - "get_led_regnum: unit number %d " - "is out of range", suip->unit_number); - } - error = EINVAL; - break; - } - code = FRU_UNIT_TO_EVCODE(CFTM, suip->unit_number); - break; - - case SCB: - if (suip->unit_number < 1 || suip->unit_number > - ((scsb->scsb_state & SCSB_IS_TONGA) ? - TG_MAX_SCB : MC_MAX_SCB)) { - if (scsb_debug & 0x0002) { - cmn_err(CE_WARN, - "get_led_regnum: unit number %d " - "is out of range", suip->unit_number); - } - error = EINVAL; - break; - } - code = FRU_UNIT_TO_EVCODE(SCB, suip->unit_number); - break; - - case ALARM: - error = EINVAL; - break; - - default: - if (scsb_debug & 0x0102) { - cmn_err(CE_WARN, - "scsb_get_led_regnum(): unknown unit type %d", - suip->unit_type); - } - error = EINVAL; - break; - } - if (!error) { - *unitptr = FRU_OFFSET(code, base); - *regptr = FRU_REG_ADDR(code, base); - if (scsb_debug & 0x0100) { - cmn_err(CE_NOTE, "get_led_regnum: unitptr=%x, " - "regptr=%x, code = %x\n", - *unitptr, *regptr, code); - } - } - return (error); -} - -/* - * P1.0 and P1.5 - * Map 1.0 Tonga Slot Numbers: SCB to user interface and back. - * User interface means positional slot numbers, as on P1.0 SSB, - * which are used by hpcsvc/hsc and kstat/ioctl interfaces. - */ - -/* HSC slotnum (Positional SLotnum) to SCB CFG bit-offset */ -static int psl2sco[TG_MAX_SLOTS + 1] = { -1 }; - -/* - * MAP Positional (HSC) slot number to SCB CFG register bit-offset - */ -static int -tonga_pslotnum_to_cfgbit(scsb_state_t *scsb, int sln) -{ - int base = SCTRL_SYSCFG_BASE; - if (!(scsb->scsb_state & SCSB_IS_TONGA)) { - return (sln); - } - if (sln < 1 || sln > TG_MAX_SLOTS) { - return (sln); - } - /* - * Should move this to _init(), but for now, - * check for initialized table - */ - if (psl2sco[0]) { - psl2sco[0] = 0; - psl2sco[1] = FRU_OFFSET(SCTRL_EVENT_SLOT5, base); - psl2sco[2] = FRU_OFFSET(SCTRL_EVENT_SLOT2, base); - psl2sco[3] = FRU_OFFSET(SCTRL_EVENT_SLOT1, base); - psl2sco[4] = FRU_OFFSET(SCTRL_EVENT_SLOT3, base); - psl2sco[5] = FRU_OFFSET(SCTRL_EVENT_SLOT4, base); - } -#ifdef DEBUG - if (scsb_debug & 0x10000000) { - cmn_err(CE_NOTE, "tonga_pslotnum_to_cfgbit: old/new: %d/%d", - sln, psl2sco[sln]); - } -#endif - return (psl2sco[sln]); -} - -/* positional slotnum to SCB slotnum */ -static int psl2ssl[6] = { - 0, 5, 2, 1, 3, 4 -}; - -/* SCB slotnum to positional slotnum */ -static int ssl2psl[6] = { - 0, 3, 2, 4, 5, 1 -}; - -/* - * P1.0 and P1.5 - * HSC Slot numbers (physical positions or positional slotnum) - * to - * SCB slot numbers (reset,present,healthy) - * - * These requests come mainly from application interface and - * HSC using the scsb_uinfo_t structure. - */ -static void -tonga_slotnum_check(scsb_state_t *scsb, scsb_uinfo_t *suip) -{ - if (!(scsb->scsb_state & SCSB_IS_TONGA && scsb->scsb_state & - (SCSB_P10_PROM | SCSB_P15_PROM | SCSB_P20_PROM))) { - return; - } - if (suip->unit_number < 1 || suip->unit_number > TG_MAX_SLOTS) { - return; - } -#ifdef DEBUG - if (scsb_debug & 0x10000000) { - cmn_err(CE_NOTE, "tonga_slotnum_check: old/new: %d/%d", - suip->unit_number, psl2ssl[suip->unit_number]); - } -#endif - suip->unit_number = psl2ssl[suip->unit_number]; -} - -/* - * P1.0 and P1.5 - */ -static int -tonga_psl_to_ssl(scsb_state_t *scsb, int slotnum) -{ - if (!(scsb->scsb_state & SCSB_IS_TONGA && scsb->scsb_state & - (SCSB_P10_PROM | SCSB_P15_PROM | SCSB_P20_PROM))) { - return (slotnum); - } - if (slotnum < 1 || slotnum > TG_MAX_SLOTS) { - return (slotnum); - } -#ifdef DEBUG - if (scsb_debug & 0x10000000) { - cmn_err(CE_NOTE, "tonga_psl_to_ssl: old/new: %d/%d", - slotnum, psl2ssl[slotnum]); - } -#endif - return (psl2ssl[slotnum]); -} - -/* - * P1.0 and P1.5 - */ -static int -tonga_ssl_to_psl(scsb_state_t *scsb, int slotnum) -{ - if (!(scsb->scsb_state & SCSB_IS_TONGA && scsb->scsb_state & - (SCSB_P10_PROM | SCSB_P15_PROM | SCSB_P20_PROM))) { - return (slotnum); - } - if (slotnum < 1 || slotnum > TG_MAX_SLOTS) { - return (slotnum); - } -#ifdef DEBUG - if (scsb_debug & 0x10000000) { - cmn_err(CE_NOTE, "tonga_ssl_to_psl: old/new: %d/%d", - slotnum, ssl2psl[slotnum]); - } -#endif - return (ssl2psl[slotnum]); -} -/* - * tonga_slotnum_led_shift: this function remaps slot bits ONLY for Slots 1-5 - * and ONLY for the register sets in bit-offset groups 1,2: - * LEDs, Confg/Status, Reset, BrdHlthy - * - * IN bits: SCB slot numbers (led,reset,present,healthy) - * to - * OUT bits: HSC Slot numbers (positional slot numbers as marked on the SSB) - */ -static uchar_t -tonga_slotnum_led_shift(scsb_state_t *scsb, uchar_t data) -{ - int i; - uchar_t mask, new_data = 0; -#ifdef DEBUG - uchar_t old_data = data; -#endif - if (!(scsb->scsb_state & SCSB_IS_TONGA)) { - return (data); - } - /* - * P1.0 and P1.5 slot 1-5 offsets are the same - */ - for (i = 1; i <= TG_MAX_SLOTS; ++i) { - mask = 1 << (i - 1); - switch (i) { - case 1: /* map to slot 3 */ - new_data |= (data & mask) << 2; - data &= ~(mask); - break; - case 2: /* map to slot 2 */ - new_data |= (data & mask); - data &= ~(mask); - break; - case 3: /* map to slot 4 */ - case 4: /* map to slot 5 */ - new_data |= (data & mask) << 1; - data &= ~(mask); - break; - case 5: /* map to slot 1 */ - new_data |= (data & mask) >> 4; - data &= ~(mask); - break; - } - } - new_data |= data; /* set any remaining bits */ -#ifdef DEBUG - if (scsb_debug & 0x10000000) { - cmn_err(CE_NOTE, "tonga_slotnum_led_shift: old/new: 0x%x/0x%x", - old_data, new_data); - } -#endif - return (new_data); -} - -/* - * P1.0 and P1.5 - */ -int -scsb_led_get(scsb_state_t *scsb, scsb_uinfo_t *suip, scsb_led_t led_type) -{ - int error; - int unit_number; - uchar_t reg; - int index; - - /* - * Allow access to shadow registers even though SCB is removed - * - * if (scsb->scsb_state & SCSB_FROZEN) { - * return (EAGAIN); - * } - */ - if (suip == NULL) { - return (EFAULT); - } - if (led_type == NOUSE) { - led_type = suip->led_type; - } - if (led_type != OK && led_type != NOK) { - cmn_err(CE_NOTE, "scsb_led_get(%d): unknown led type %x", - scsb->scsb_instance, led_type); - return (EINVAL); - } - error = 0; - if (scsb_debug & 0x0100) { - cmn_err(CE_NOTE, "scsb_led_get: %s %s %d", - led_name[led_type], unit_type_name[suip->unit_type], - suip->unit_number); - } - /* - * Map to Tonga Slot Number, if NOT P1.0 SCB - * P1.0 SSB workaround - */ - if (suip->unit_type == SLOT && !(scsb->scsb_state & SCSB_P10_PROM)) { - tonga_slotnum_check(scsb, suip); - } - /* discover the register and index we need to operate on */ - if ((error = scsb_get_led_regnum(scsb, suip, ®, &unit_number, - led_type)) == 0) { - index = SCSB_REG_INDEX(reg); - mutex_enter(&scsb->scsb_mutex); - if (scsb->scsb_data_reg[index] & (1 << unit_number)) { - suip->unit_state = ON; - if (led_type == OK) { - int code = FRU_UNIT_TO_EVCODE(suip->unit_type, - suip->unit_number); - reg = FRU_REG_ADDR(code, SCTRL_BLINK_OK_BASE); - index = SCSB_REG_INDEX(reg); - if (scsb->scsb_data_reg[index] & - (1 << unit_number)) - suip->unit_state = BLINK; - } - } else { - suip->unit_state = OFF; - } - mutex_exit(&scsb->scsb_mutex); - } - return (error); -} - -int -scsb_led_set(scsb_state_t *scsb, scsb_uinfo_t *suip, scsb_led_t led_type) -{ - int error; - int unit_number; - uchar_t reg; - int code, index; - - /* we should really allow led state changes while frozen... */ - if (scsb->scsb_state & SCSB_FROZEN) - return (EAGAIN); - - if (suip == NULL) { - return (EFAULT); - } - - /* - * Sanity check, make sure we got plausible values for set command. - * Also check for application only control of slot leds using NOUSE - * interface - */ - if (led_type == NOUSE) { - led_type = suip->led_type; - } else if (suip->unit_type == SLOT && - scsb->scsb_state & SCSB_APP_SLOTLED_CTRL && - !(scsb->scsb_state & - (SCSB_DIAGS_MODE | SCSB_DEBUG_MODE))) { - /* - * kernel modules using this interface need to think they are - * succeeding, so we won't return an error for this - * application configuration - */ - return (0); - } - if (led_type != OK && led_type != NOK) { - return (EINVAL); - } - if (suip->unit_state != OFF && suip->unit_state != ON && - suip->unit_state != BLINK) { - return (EINVAL); - } - if (suip->unit_state == BLINK) { - if (led_type != OK) - return (EINVAL); - if (suip->unit_type != SLOT && scsb->scsb_state & - (SCSB_P06_PROM | SCSB_P10_PROM)) - return (EINVAL); - } - if (scsb_debug & 0x0100) { - cmn_err(CE_NOTE, - "scsb_led_set: led %s, type %s, unit %d, state %s", - led_name[led_type], - unit_type_name[suip->unit_type], suip->unit_number, - suip->unit_state == ON ? "ON": - suip->unit_state == OFF ? "OFF": "BLINK"); - } - /* - * Map to Tonga Slot Number, if NOT P1.0 SCB - * P1.0 SSB workaround - */ - if (suip->unit_type == SLOT && !(scsb->scsb_state & SCSB_P10_PROM)) { - tonga_slotnum_check(scsb, suip); - } - /* - * discover the register and index we need to access - */ - if ((error = scsb_get_led_regnum(scsb, suip, ®, &unit_number, - led_type)) == 0) { - index = SCSB_REG_INDEX(reg); - mutex_enter(&scsb->scsb_mutex); - if (suip->unit_state == ON || suip->unit_state == BLINK) - scsb->scsb_data_reg[index] |= (1 << unit_number); - else - scsb->scsb_data_reg[index] &= ~(1 << unit_number); - - if (scsb_debug & 0x0100) { - cmn_err(CE_NOTE, "Writing %x to Reg %x", - scsb->scsb_data_reg[index], reg); - } - error = scsb_rdwr_register(scsb, I2C_WR, reg, 1, - &scsb->scsb_data_reg[index], 1); - if (error) { - cmn_err(CE_WARN, "%s#%d: Could not Update %s LEDs.", - ddi_driver_name(scsb->scsb_dev), - ddi_get_instance(scsb->scsb_dev), - led_name[led_type]); - goto ledset_done; - } - if (led_type != OK || - (IS_SCB_P10 && suip->unit_type != SLOT) || - suip->unit_type == ALARM || - suip->unit_type == SSB || - suip->unit_type == CRTM || - suip->unit_type == PRTM) { - goto ledset_done; - } - code = FRU_UNIT_TO_EVCODE(suip->unit_type, suip->unit_number); - reg = FRU_REG_ADDR(code, SCTRL_BLINK_OK_BASE); - index = SCSB_REG_INDEX(reg); - if (suip->unit_state == BLINK) - scsb->scsb_data_reg[index] |= (1 << unit_number); - else - scsb->scsb_data_reg[index] &= ~(1 << unit_number); - if (scsb_debug & 0x0100) { - cmn_err(CE_NOTE, "Writing %x to Reg %x", - scsb->scsb_data_reg[index], reg); - } - error = scsb_rdwr_register(scsb, I2C_WR, reg, 1, - &scsb->scsb_data_reg[index], 1); - if (error) { - cmn_err(CE_WARN, "%s#%d: Could not Blink %s LEDs.", - ddi_driver_name(scsb->scsb_dev), - ddi_get_instance(scsb->scsb_dev), - led_name[led_type]); - } -ledset_done: - mutex_exit(&scsb->scsb_mutex); - } - return (error); -} - -struct ps_auto_on { - scsb_state_t *scsb; - scsb_utype_t utype; - scsb_unum_t unit; -}; - -static struct ps_auto_on pao; - -static void -scsb_ps_auto_on(void *arg) -{ - struct ps_auto_on *ppao = (struct ps_auto_on *)arg; - uchar_t rmask = 0; - uchar_t ondata, sysreg; - int tmp, bit_index; - /* - * Turn on the PSU. - * Notice: not checking Power Supply unit number - */ - bit_index = SCTRL_SYS_PS_ON_BASE + (ppao->unit - 1); - ondata = 1 << SYS_OFFSET(bit_index); - tmp = SYS_REG_INDEX(bit_index, SCTRL_SYS_CMD_BASE); - sysreg = SCSB_REG_ADDR(tmp); - if (scsb_write_mask(ppao->scsb, sysreg, rmask, ondata, (uchar_t)0)) { - cmn_err(CE_WARN, "scsb%d: " "I2C TRANSFER Failed", - ppao->scsb->scsb_instance); - } - ppao->scsb->scsb_btid = 0; -} - -/* - * called with mutex held from - * scsb_attach() with int_fru_ptr == NULL - * scsb_intr() with int_fru_ptr == info for FRU that caused interrupt - */ -static int -scsb_set_scfg_pres_leds(scsb_state_t *scsb, fru_info_t *int_fru_ptr) -{ - int i, error = 0; - int cfg_idx, led_idx, blink_idx, lid, bid; - int cfg_bit, led_bit; - uchar_t *puc, reg, led_reg, led_data[SCSB_LEDDATA_REGISTERS]; - uchar_t blink_bit, blink_reg, blink[SCSB_LEDDATA_REGISTERS]; - uchar_t update_reg = 0; - scsb_utype_t fru_type; - fru_info_t *fru_ptr; - - if (scsb->scsb_state & SCSB_FROZEN && - !(scsb->scsb_state & SCSB_IN_INTR)) { - return (EAGAIN); - } - for (i = 0; i < SCTRL_LED_OK_NUMREGS; ++i) { - led_data[i] = 0; - blink[i] = 0; - } - led_reg = SCSB_REG_ADDR(SCTRL_LED_OK_BASE); - reg = SCSB_REG_ADDR(SCTRL_BLINK_OK_BASE); - lid = SCSB_REG_INDEX(led_reg); /* the LED Index Delta */ - bid = SCSB_REG_INDEX(reg); /* the Blink Index Delta */ - blink_reg = 0; - if (int_fru_ptr != NULL) { - update_reg = int_fru_ptr->i2c_info->ledata_reg; - } - for (fru_type = 0; fru_type < SCSB_UNIT_TYPES; ++fru_type) { - int is_present; - fru_ptr = mct_system_info.fru_info_list[fru_type]; - for (; fru_ptr != NULL; fru_ptr = fru_ptr->next) { - is_present = 0; - if (fru_type == SLOT && (scsb->scsb_state & - SCSB_APP_SLOTLED_CTRL)) - break; - if (fru_ptr->i2c_info == NULL) - continue; - if ((led_reg = fru_ptr->i2c_info->ledata_reg) == 0) { - /* - * No LED exceptions: SSB,CRTM,PRTM - */ - continue; - } - if (update_reg && update_reg != led_reg) - continue; - led_idx = SCSB_REG_INDEX(led_reg) - lid; - led_bit = fru_ptr->i2c_info->ledata_bit; - if ((reg = fru_ptr->i2c_info->syscfg_reg) == 0) { - if (fru_type != SCB) - continue; - /* - * exception: SCB - */ - if (scsb->scsb_state & SCSB_SCB_PRESENT) { - led_data[led_idx] |= 1 << led_bit; - is_present = 1; - } else { - led_data[led_idx] &= ~(1 << led_bit); - } - if (IS_SCB_P10) - continue; - } else { - cfg_idx = SCSB_REG_INDEX(reg); - cfg_bit = fru_ptr->i2c_info->syscfg_bit; - if (scsb->scsb_data_reg[cfg_idx] & - (1 << cfg_bit)) { - is_present = 1; - } - } - if (is_present) { - /* - * If the FRU is a Power Supply, AND - * the call is from scsb_attach() OR - * from scsb_intr() and FRUs match, - * turn it on. - */ - if (fru_type == PS && (int_fru_ptr == NULL || - (int_fru_ptr == fru_ptr))) { - pao.scsb = scsb; - pao.utype = fru_type; - pao.unit = fru_ptr->fru_unit; -#ifdef PS_ON_DELAY - /* - * HW recommended not implementing - * this delay for now. - * The code is tested on PSUs: - * -06 - * -07 rev 2 - * -08 plus - */ - if (int_fru_ptr) { - /* - * Hot insertion, so give it - * the 3 seconds it needs to - * become stable - */ - if (!scsb->scsb_btid) - scsb->scsb_btid = - timeout( - scsb_ps_auto_on, - &pao, (4 * - drv_usectohz( - 1000000))); - } else -#endif /* PS_ON_DELAY */ - scsb_ps_auto_on((void *)&pao); - } - /* - * Special SLOT handling. - * Make sure the OK LED is on for the CPU Slot - * and for the FTC (CFTM) Slot for MonteCarlo. - * Both will report as FRU_PRESENT. - */ - if (fru_type != SLOT || (fru_type == SLOT && - (fru_ptr->fru_type == - (scsb_utype_t)OC_CPU || - fru_ptr->fru_type == - (scsb_utype_t)OC_CTC))) { - /* - * Set OK (green) LED register bit - */ - led_data[led_idx] |= 1 << led_bit; - } - if (IS_SCB_P10) - continue; - /* - * Turn off BLINK register bit. - * If single register update, then save the - * corresponding blink register in blink_reg. - */ - reg = fru_ptr->i2c_info->blink_reg; - if (!reg) - continue; - blink_bit = fru_ptr->i2c_info->blink_bit; - blink_idx = SCSB_REG_INDEX(reg) - bid; - blink[blink_idx] |= 1 << blink_bit; - if (update_reg && update_reg == led_reg) - blink_reg = reg; - } - } - } - if (update_reg) { - reg = update_reg; - i = SCSB_REG_INDEX(reg); - puc = &led_data[i - lid]; - i = 1; - } else { - reg = SCSB_REG_ADDR(SCTRL_LED_OK_BASE); - puc = led_data; - i = SCTRL_LED_OK_NUMREGS; - } - if (scsb_debug & 0x0100) { - cmn_err(CE_NOTE, "scsb_set_scfg_pres(): writing %d bytes " - "to 0x%x", i, reg); - } - if ((error = scsb_rdwr_register(scsb, I2C_WR, reg, i, puc, 1)) != 0) { - if (scsb_debug & 0x0102) - cmn_err(CE_NOTE, "scsb_set_scfg_pres(): " - "I2C write to 0x%x failed", reg); - error = EIO; - } else { - /* - * Now see which BLINK bits need to be turned off for the - * corresponding OK LED bits. - */ - reg = SCSB_REG_ADDR(SCTRL_BLINK_OK_BASE); - for (i = 0; i < SCTRL_BLINK_NUMREGS; ++i, ++reg) { - if (blink_reg && blink_reg != reg) - continue; - if (!blink[i]) { - continue; - } - if (scsb_debug & 0x0100) { - cmn_err(CE_NOTE, "scsb_set_scfg_pres(): turn " - "OFF Blink bits 0x%x in 0x%x", - blink[i], reg); - } - if (scsb_write_mask(scsb, reg, 0, 0, blink[i])) { - if (scsb_debug & 0x0102) - cmn_err(CE_NOTE, - "scsb_set_scfg_pres(): " - "Write to 0x%x failed", reg); - error = EIO; - break; - } - } - } - return (error); -} - -static int -scsb_check_config_status(scsb_state_t *scsb) -{ - int error; - uchar_t reg; - int index, p06; - - if (scsb_debug & 0x0201) { - cmn_err(CE_NOTE, "scsb_check_config_status:"); - } - /* - * Base of register set - */ - reg = SCSB_REG_ADDR(SCTRL_SYSCFG_BASE); - index = SCSB_REG_INDEX(reg); - /* - * SCB P0.6 workaround: read registers twice, use 2nd value set - */ - mutex_enter(&scsb->scsb_mutex); - p06 = 2; - do { - if (error = scsb_rdwr_register(scsb, I2C_WR_RD, reg, - SCTRL_CFG_NUMREGS, &scsb->scsb_data_reg[index], 1)) { - break; - } - if (p06 == 1) { - if (scsb_debug & 0x0200) - cmn_err(CE_NOTE, - "scsb_check_config_status: P0.6 workaround"); - } - /* - * If not P0.6 PROM, just break here - */ - if (!(scsb->scsb_state & SCSB_P06_PROM)) - break; - } while (--p06); - mutex_exit(&scsb->scsb_mutex); - - if (error == 0) { - if (!(scsb->scsb_state & SCSB_SCB_PRESENT)) - scsb->scsb_state |= SCSB_SCB_PRESENT; - if (scsb_fru_op(scsb, SSB, 1, SCTRL_SYSCFG_BASE, - SCSB_FRU_OP_GET_BITVAL)) - scsb->scsb_state |= SCSB_SSB_PRESENT; - else - scsb->scsb_state &= ~SCSB_SSB_PRESENT; - } - return (error); -} - -static void -scsb_set_topology(scsb_state_t *scsb) -{ - int i, t, index, unit, is_tonga = 0; - int alarm_slot_num, cpu_slot_num, ctc_slot_num; - fru_info_t *fru_ptr, *last_ptr, *acslot_ptr, *ctcslot_ptr; - uchar_t syscfg, led_reg, blink_reg, t_uchar; - uchar_t bit_num, led_bit, blink_bit; - int pad = 0; - - /* - * Get the presence status from the SysConfigStatus shadow registers - * in scsb->scsb_data_reg[] - */ - /* Mid Plane */ - i = SYS_REG_INDEX(SCTRL_CFG_MPID0, SCTRL_SYSCFG_BASE); - t_uchar = SCSB_REG_ADDR(i); - index = SCSB_REG_INDEX(t_uchar); - mct_system_info.mid_plane.fru_type = MIDPLANE; - mct_system_info.mid_plane.fru_version = (fru_version_t)0; - t = SYS_OFFSET(SCTRL_CFG_MPID0); - mct_system_info.mid_plane.fru_id = (int)((scsb->scsb_data_reg[index] & - (SCTRL_MPID_MASK << t)) >> t); - switch (mct_system_info.mid_plane.fru_id) { - case SCTRL_MPID_HALF: /* Monte Carlo */ - if (scsb_debug & 0x00100005) - cmn_err(CE_NOTE, "scsb_set_topology: Monte Carlo"); - cpu_slot_num = SC_MC_CPU_SLOT; - ctc_slot_num = SC_MC_CTC_SLOT; - alarm_slot_num = scsb->ac_slotnum = SC_MC_AC_SLOT; - mct_system_info.max_units[SLOT] = MC_MAX_SLOTS; - mct_system_info.max_units[ALARM] = MC_MAX_AC; - mct_system_info.max_units[DISK] = MC_MAX_DISK; - mct_system_info.max_units[FAN] = MC_MAX_FAN; - mct_system_info.max_units[PS] = MC_MAX_PS; - mct_system_info.max_units[PDU] = MC_MAX_PDU; - mct_system_info.max_units[SCB] = MC_MAX_SCB; - mct_system_info.max_units[SSB] = MC_MAX_SCB; - mct_system_info.max_units[CFTM] = MC_MAX_CFTM; - mct_system_info.max_units[CRTM] = MC_MAX_CRTM; - mct_system_info.max_units[PRTM] = MC_MAX_PRTM; - break; - case SCTRL_MPID_QUARTER_NODSK: /* Tonga w/o disk */ - case SCTRL_MPID_QUARTER: /* Tonga w/ disk */ - scsb->scsb_state |= SCSB_IS_TONGA; - is_tonga = 1; - ctc_slot_num = -1; - ctcslot_ptr = NULL; - if (scsb_debug & 0x00100005) - cmn_err(CE_NOTE, "scsb_set_topology: Tonga%s", - mct_system_info.mid_plane.fru_id == - SCTRL_MPID_QUARTER_NODSK ? - ", no disk" : " with disk"); - cpu_slot_num = SC_TG_CPU_SLOT; - alarm_slot_num = scsb->ac_slotnum = SC_TG_AC_SLOT; - mct_system_info.max_units[SLOT] = TG_MAX_SLOTS; - mct_system_info.max_units[ALARM] = TG_MAX_AC; - mct_system_info.max_units[DISK] = TG_MAX_DISK; - mct_system_info.max_units[FAN] = TG_MAX_FAN; - mct_system_info.max_units[PS] = TG_MAX_PS; - mct_system_info.max_units[PDU] = TG_MAX_PDU; - mct_system_info.max_units[SCB] = TG_MAX_SCB; - mct_system_info.max_units[SSB] = TG_MAX_SCB; - mct_system_info.max_units[CFTM] = TG_MAX_CFTM; - mct_system_info.max_units[CRTM] = TG_MAX_CRTM; - mct_system_info.max_units[PRTM] = TG_MAX_PRTM; - break; - default: - cmn_err(CE_WARN, "%s#%d: Unknown MidPlane Id %x", - ddi_driver_name(scsb->scsb_dev), - ddi_get_instance(scsb->scsb_dev), - mct_system_info.mid_plane.fru_id); - if (scsb_debug & 0x00100005) - cmn_err(CE_NOTE, "scsb_set_topology: 0x%x: unknown!", - mct_system_info.mid_plane.fru_id); - return; - } - /* - * cPCI Slots - * - * NOTE: The Tonga slot fru_unit needs to get mapped to the logical - * slot number in slot_table[]. The field is not in the slot_table - * at least until we know the format of the OBP slot table for the FCS - * release. - */ - mct_system_info.fru_info_list[SLOT] = (fru_info_t *) - kmem_zalloc(sizeof (fru_info_t) * - (mct_system_info.max_units[SLOT] + pad), KM_SLEEP); - fru_ptr = mct_system_info.fru_info_list[SLOT]; - for (unit = 1; unit <= mct_system_info.max_units[SLOT]; ++unit) { - int iunit; - if (unit == cpu_slot_num) { - fru_ptr->fru_type = (scsb_utype_t)OC_CPU; - } else if (unit == ctc_slot_num) { - /* fru_ptr saved for Transition Card Presence check */ - ctcslot_ptr = fru_ptr; - fru_ptr->fru_type = (scsb_utype_t)OC_UNKN; - } else if (unit == alarm_slot_num) { - /* fru_ptr saved for Alarm Card Presence check below */ - acslot_ptr = fru_ptr; - fru_ptr->fru_type = (scsb_utype_t)OC_UNKN; - } else { - fru_ptr->fru_type = (scsb_utype_t)OC_UNKN; - } - /* - * Get the slot event code (t), then use it to get the - * slot bit-offsets for LED, BLINK, and SYSCFG registers. - * On a P1.5 Tonga, the internal slot number must be used to - * find the event code. - * The P1.0 Tonga does not get mapped due to a SSB difference. - */ - if (IS_SCB_P15) { - iunit = tonga_psl_to_ssl(scsb, unit); - t = FRU_UNIT_TO_EVCODE(SLOT, iunit); - } else { - t = FRU_UNIT_TO_EVCODE(SLOT, unit); - } - led_bit = FRU_OFFSET(t, SCTRL_LED_OK_BASE); - blink_bit = FRU_OFFSET(t, SCTRL_BLINK_OK_BASE); - blink_reg = FRU_REG_ADDR(t, SCTRL_BLINK_OK_BASE); - if (is_tonga && unit <= TG_MAX_SLOTS) { - bit_num = tonga_pslotnum_to_cfgbit(scsb, unit); - } else { - bit_num = FRU_OFFSET(t, SCTRL_SYSCFG_BASE); - } - /* - * get the registers addresses and shadow register index for - * the SYSCFG register - */ - syscfg = FRU_REG_ADDR(t, SCTRL_SYSCFG_BASE); - index = SCSB_REG_INDEX(syscfg); - led_reg = FRU_REG_ADDR(t, SCTRL_LED_OK_BASE); - /* - * check and set presence status - */ - if (scsb->scsb_state & SCSB_P06_PROM) { - fru_ptr->fru_status = FRU_NOT_PRESENT; - } else if (scsb->scsb_data_reg[index] & (1 << bit_num)) { - fru_ptr->fru_status = FRU_PRESENT; - } else { - fru_ptr->fru_status = FRU_NOT_PRESENT; - } - fru_ptr->fru_unit = (scsb_unum_t)unit; - fru_ptr->fru_id = fru_id_table[event_to_index( - FRU_UNIT_TO_EVCODE(SLOT, unit))]; - fru_ptr->fru_version = (fru_version_t)0; - fru_ptr->type_list = (fru_options_t *)NULL; - fru_ptr->i2c_info = (fru_i2c_info_t *) - kmem_zalloc(sizeof (fru_i2c_info_t), KM_SLEEP); - fru_ptr->i2c_info->syscfg_reg = syscfg; - fru_ptr->i2c_info->syscfg_bit = bit_num; - fru_ptr->i2c_info->ledata_reg = led_reg; - fru_ptr->i2c_info->ledata_bit = led_bit; - fru_ptr->i2c_info->blink_reg = blink_reg; - fru_ptr->i2c_info->blink_bit = blink_bit; - last_ptr = fru_ptr; - fru_ptr++; - last_ptr->next = fru_ptr; - } - last_ptr->next = (fru_info_t *)NULL; - /* - * PDU - */ - mct_system_info.fru_info_list[PDU] = (fru_info_t *) - kmem_zalloc(sizeof (fru_info_t) * - (mct_system_info.max_units[PDU] + pad), KM_SLEEP); - fru_ptr = mct_system_info.fru_info_list[PDU]; - for (unit = 1; unit <= mct_system_info.max_units[PDU]; ++unit) { - fru_ptr->fru_type = PDU; - /* SCB15 */ - /* - * get the FRU event code (t), then use it to get the - * FRU bit-offsets for LED and SYSCFG registers - */ - t = FRU_UNIT_TO_EVCODE(PDU, unit); - led_bit = FRU_OFFSET(t, SCTRL_LED_OK_BASE); - bit_num = FRU_OFFSET(t, SCTRL_SYSCFG_BASE); - if (IS_SCB_P15) { - blink_bit = FRU_OFFSET(t, SCTRL_BLINK_OK_BASE); - i = FRU_REG_INDEX(t, SCTRL_BLINK_OK_BASE); - blink_reg = SCSB_REG_ADDR(i); - } else { - blink_bit = 0; - blink_reg = 0; - } - /* - * get the registers addresses and shadow register index for - * the SYSCFG register - */ - i = FRU_REG_INDEX(t, SCTRL_SYSCFG_BASE); - syscfg = SCSB_REG_ADDR(i); - index = SCSB_REG_INDEX(syscfg); - i = FRU_REG_INDEX(t, SCTRL_LED_OK_BASE); - led_reg = SCSB_REG_ADDR(i); - /* - * check and set presence status - */ - if (scsb->scsb_data_reg[index] & (1 << bit_num)) { - fru_ptr->fru_status = FRU_PRESENT; - fru_ptr->fru_version = (fru_version_t)0; - } else { - fru_ptr->fru_status = FRU_NOT_PRESENT; - fru_ptr->fru_version = (fru_version_t)0; - } - fru_ptr->fru_unit = (scsb_unum_t)unit; - fru_ptr->fru_id = fru_id_table[event_to_index(t)]; - fru_ptr->type_list = (fru_options_t *)NULL; - fru_ptr->i2c_info = (fru_i2c_info_t *) - kmem_zalloc(sizeof (fru_i2c_info_t), KM_SLEEP); - fru_ptr->i2c_info->syscfg_reg = syscfg; - fru_ptr->i2c_info->syscfg_bit = bit_num; - fru_ptr->i2c_info->ledata_reg = led_reg; - fru_ptr->i2c_info->ledata_bit = led_bit; - fru_ptr->i2c_info->blink_reg = blink_reg; - fru_ptr->i2c_info->blink_bit = blink_bit; - last_ptr = fru_ptr; - fru_ptr++; - last_ptr->next = fru_ptr; - } - last_ptr->next = (fru_info_t *)NULL; - /* - * Power Supplies - */ - mct_system_info.fru_info_list[PS] = (fru_info_t *) - kmem_zalloc(sizeof (fru_info_t) * - (mct_system_info.max_units[PS] + pad), KM_SLEEP); - fru_ptr = mct_system_info.fru_info_list[PS]; - for (unit = 1; unit <= mct_system_info.max_units[PS]; ++unit) { - /* - * get the FRU event code (t), then use it to get the - * FRU bit-offsets for LED and SYSCFG registers - */ - t = FRU_UNIT_TO_EVCODE(PS, unit); - led_bit = FRU_OFFSET(t, SCTRL_LED_OK_BASE); - bit_num = FRU_OFFSET(t, SCTRL_SYSCFG_BASE); - if (IS_SCB_P15) { - blink_bit = FRU_OFFSET(t, SCTRL_BLINK_OK_BASE); - i = FRU_REG_INDEX(t, SCTRL_BLINK_OK_BASE); - blink_reg = SCSB_REG_ADDR(i); - } else { - blink_bit = 0; - blink_reg = 0; - } - /* - * get the registers addresses and shadow register index for - * the SYSCFG register - */ - i = FRU_REG_INDEX(t, SCTRL_SYSCFG_BASE); - syscfg = SCSB_REG_ADDR(i); - index = SCSB_REG_INDEX(syscfg); - i = FRU_REG_INDEX(t, SCTRL_LED_OK_BASE); - led_reg = SCSB_REG_ADDR(i); - /* - * check and set presence status - */ - if (scsb->scsb_data_reg[index] & (1 << bit_num)) { - fru_ptr->fru_status = FRU_PRESENT; - } else { - fru_ptr->fru_status = FRU_NOT_PRESENT; - } - fru_ptr->fru_type = PS; - fru_ptr->fru_unit = (scsb_unum_t)unit; - fru_ptr->fru_id = fru_id_table[event_to_index(t)]; - fru_ptr->fru_version = (fru_version_t)0; - fru_ptr->type_list = (fru_options_t *)NULL; - fru_ptr->i2c_info = (fru_i2c_info_t *) - kmem_zalloc(sizeof (fru_i2c_info_t), KM_SLEEP); - fru_ptr->i2c_info->syscfg_reg = syscfg; - fru_ptr->i2c_info->syscfg_bit = bit_num; - fru_ptr->i2c_info->ledata_reg = led_reg; - fru_ptr->i2c_info->ledata_bit = led_bit; - fru_ptr->i2c_info->blink_reg = blink_reg; - fru_ptr->i2c_info->blink_bit = blink_bit; - last_ptr = fru_ptr; - fru_ptr++; - last_ptr->next = fru_ptr; - } - last_ptr->next = (fru_info_t *)NULL; - /* - * SCSI Disks and removable media - */ - mct_system_info.fru_info_list[DISK] = (fru_info_t *) - kmem_zalloc(sizeof (fru_info_t) * - (mct_system_info.max_units[DISK] + pad), KM_SLEEP); - fru_ptr = mct_system_info.fru_info_list[DISK]; - for (unit = 1; unit <= mct_system_info.max_units[DISK]; ++unit) { - /* SCB15 */ - /* - * get the FRU event code (t), then use it to get the - * FRU bit-offsets for LED and SYSCFG registers - */ - t = FRU_UNIT_TO_EVCODE(DISK, unit); - led_bit = FRU_OFFSET(t, SCTRL_LED_OK_BASE); - bit_num = FRU_OFFSET(t, SCTRL_SYSCFG_BASE); - if (IS_SCB_P15) { - blink_bit = FRU_OFFSET(t, SCTRL_BLINK_OK_BASE); - i = FRU_REG_INDEX(t, SCTRL_BLINK_OK_BASE); - blink_reg = SCSB_REG_ADDR(i); - } else { - blink_bit = 0; - blink_reg = 0; - } - /* - * get the registers addresses and shadow register index for - * the SYSCFG register - */ - i = FRU_REG_INDEX(t, SCTRL_SYSCFG_BASE); - syscfg = SCSB_REG_ADDR(i); - index = SCSB_REG_INDEX(syscfg); - i = FRU_REG_INDEX(t, SCTRL_LED_OK_BASE); - led_reg = SCSB_REG_ADDR(i); - /* - * check and set presence status - */ - if (scsb->scsb_data_reg[index] & (1 << bit_num)) { - fru_ptr->fru_status = FRU_PRESENT; - fru_ptr->fru_version = (fru_version_t)0; - } else - fru_ptr->fru_status = FRU_NOT_PRESENT; - fru_ptr->fru_type = DISK; - fru_ptr->fru_unit = (scsb_unum_t)unit; - fru_ptr->fru_id = fru_id_table[event_to_index(t)]; - fru_ptr->type_list = (fru_options_t *)NULL; - fru_ptr->i2c_info = (fru_i2c_info_t *) - kmem_zalloc(sizeof (fru_i2c_info_t), KM_SLEEP); - fru_ptr->i2c_info->syscfg_reg = syscfg; - fru_ptr->i2c_info->syscfg_bit = bit_num; - fru_ptr->i2c_info->ledata_reg = led_reg; - fru_ptr->i2c_info->ledata_bit = led_bit; - fru_ptr->i2c_info->blink_reg = blink_reg; - fru_ptr->i2c_info->blink_bit = blink_bit; - last_ptr = fru_ptr; - fru_ptr++; - last_ptr->next = fru_ptr; - } - last_ptr->next = (fru_info_t *)NULL; - /* - * Fan Trays - */ - mct_system_info.fru_info_list[FAN] = (fru_info_t *) - kmem_zalloc(sizeof (fru_info_t) * - (mct_system_info.max_units[FAN] + pad), KM_SLEEP); - fru_ptr = mct_system_info.fru_info_list[FAN]; - for (unit = 1; unit <= mct_system_info.max_units[FAN]; ++unit) { - int bit_num; - /* SCB15 */ - /* - * get the FRU event code (t), then use it to get the - * FRU bit-offsets for LED and SYSCFG registers - */ - t = FRU_UNIT_TO_EVCODE(FAN, unit); - led_bit = FRU_OFFSET(t, SCTRL_LED_OK_BASE); - bit_num = FRU_OFFSET(t, SCTRL_SYSCFG_BASE); - if (IS_SCB_P15) { - blink_bit = FRU_OFFSET(t, SCTRL_BLINK_OK_BASE); - i = FRU_REG_INDEX(t, SCTRL_BLINK_OK_BASE); - blink_reg = SCSB_REG_ADDR(i); - } else { - blink_bit = 0; - blink_reg = 0; - } - /* - * get the registers addresses and shadow register index for - * the SYSCFG register - */ - i = FRU_REG_INDEX(t, SCTRL_SYSCFG_BASE); - syscfg = SCSB_REG_ADDR(i); - index = SCSB_REG_INDEX(syscfg); - i = FRU_REG_INDEX(t, SCTRL_LED_OK_BASE); - led_reg = SCSB_REG_ADDR(i); - /* - * check and set presence status - */ - if (scsb->scsb_data_reg[index] & (1 << bit_num)) { - fru_ptr->fru_status = FRU_PRESENT; - } else { - fru_ptr->fru_status = FRU_NOT_PRESENT; - } - fru_ptr->fru_type = FAN; - fru_ptr->fru_unit = (scsb_unum_t)unit; - fru_ptr->fru_id = fru_id_table[event_to_index(t)]; - fru_ptr->fru_version = (fru_version_t)0; - fru_ptr->type_list = (fru_options_t *)NULL; - fru_ptr->i2c_info = (fru_i2c_info_t *) - kmem_zalloc(sizeof (fru_i2c_info_t), KM_SLEEP); - fru_ptr->i2c_info->syscfg_reg = syscfg; - fru_ptr->i2c_info->syscfg_bit = bit_num; - fru_ptr->i2c_info->ledata_reg = led_reg; - fru_ptr->i2c_info->ledata_bit = led_bit; - fru_ptr->i2c_info->blink_reg = blink_reg; - fru_ptr->i2c_info->blink_bit = blink_bit; - last_ptr = fru_ptr; - fru_ptr++; - last_ptr->next = fru_ptr; - } - last_ptr->next = (fru_info_t *)NULL; - /* - * Alarm Cards - */ - mct_system_info.fru_info_list[ALARM] = (fru_info_t *) - kmem_zalloc(sizeof (fru_info_t) * - (mct_system_info.max_units[ALARM] + pad), KM_SLEEP); - fru_ptr = mct_system_info.fru_info_list[ALARM]; - for (unit = 1; unit <= mct_system_info.max_units[ALARM]; ++unit) { - int bit_num; - - /* - * get the FRU event code (t), then use it to get the - * FRU bit-offsets for SYSCFG register - */ - t = FRU_UNIT_TO_EVCODE(ALARM, unit); - bit_num = FRU_OFFSET(t, SCTRL_SYSCFG_BASE); - /* - * get the registers addresses and shadow register index for - * the SYSCFG register - */ - i = FRU_REG_INDEX(t, SCTRL_SYSCFG_BASE); - syscfg = SCSB_REG_ADDR(i); - index = SCSB_REG_INDEX(syscfg); - /* - * check and set presence status - */ - if (scsb->scsb_data_reg[index] & (1 << bit_num)) { - fru_ptr->fru_status = FRU_PRESENT; - if (acslot_ptr != NULL && acslot_ptr->fru_status == - FRU_PRESENT) { - acslot_ptr->fru_type = (scsb_utype_t)OC_AC; - /* - * acslot_ptr->fru_id = - * fru_id_table[event_to_index(t)]; - */ - } - } else { - fru_ptr->fru_status = FRU_NOT_PRESENT; - } - - fru_ptr->fru_type = ALARM; - fru_ptr->fru_unit = (scsb_unum_t)unit; - fru_ptr->fru_id = fru_id_table[event_to_index(t)]; - fru_ptr->fru_version = (fru_version_t)0; - fru_ptr->type_list = (fru_options_t *)NULL; - fru_ptr->i2c_info = (fru_i2c_info_t *) - kmem_zalloc(sizeof (fru_i2c_info_t), KM_SLEEP); - fru_ptr->i2c_info->syscfg_reg = syscfg; - fru_ptr->i2c_info->syscfg_bit = bit_num; - fru_ptr->i2c_info->ledata_reg = 0; - fru_ptr->i2c_info->ledata_bit = 0; - fru_ptr->i2c_info->blink_reg = 0; - fru_ptr->i2c_info->blink_bit = 0; - last_ptr = fru_ptr; - fru_ptr++; - last_ptr->next = fru_ptr; - } - last_ptr->next = (fru_info_t *)NULL; - /* - * SCB - */ - mct_system_info.fru_info_list[SCB] = (fru_info_t *) - kmem_zalloc(sizeof (fru_info_t) * - (mct_system_info.max_units[SCB] + pad), KM_SLEEP); - fru_ptr = mct_system_info.fru_info_list[SCB]; - unit = 1; - /* SCB15 */ - /* - * get the FRU event code (t), then use it to get the - * FRU bit-offset for LED register - */ - t = FRU_UNIT_TO_EVCODE(SCB, unit); - led_bit = FRU_OFFSET(t, SCTRL_LED_OK_BASE); - i = FRU_REG_INDEX(t, SCTRL_LED_OK_BASE); - led_reg = SCSB_REG_ADDR(i); - if (IS_SCB_P15) { - blink_bit = FRU_OFFSET(t, SCTRL_BLINK_OK_BASE); - i = FRU_REG_INDEX(t, SCTRL_BLINK_OK_BASE); - blink_reg = SCSB_REG_ADDR(i); - } else { - blink_bit = 0; - blink_reg = 0; - } - i = SYS_REG_INDEX(SCTRL_SCBID0, SCTRL_SCBID_BASE); - index = SCSB_REG_ADDR(i); - /* - * check and set presence status - */ - if (scsb->scsb_state & SCSB_SCB_PRESENT) { - fru_ptr->fru_status = FRU_PRESENT; - } else { - fru_ptr->fru_status = FRU_NOT_PRESENT; - } - fru_ptr->fru_type = SCB; - fru_ptr->fru_unit = (scsb_unum_t)unit; - fru_ptr->fru_id = fru_id_table[event_to_index(t)]; - /* get PROM_VERSION from shadow registers */ - if (scsb_rdwr_register(scsb, I2C_WR_RD, index, 1, &t_uchar, 1)) - fru_ptr->fru_version = (fru_version_t)0; - else - fru_ptr->fru_version = (fru_version_t)t_uchar; - fru_ptr->type_list = (fru_options_t *)NULL; - fru_ptr->i2c_info = (fru_i2c_info_t *) - kmem_zalloc(sizeof (fru_i2c_info_t), KM_SLEEP); - fru_ptr->i2c_info->syscfg_reg = 0; - fru_ptr->i2c_info->syscfg_bit = 0; - fru_ptr->i2c_info->ledata_reg = led_reg; - fru_ptr->i2c_info->ledata_bit = led_bit; - fru_ptr->i2c_info->blink_reg = blink_reg; - fru_ptr->i2c_info->blink_bit = blink_bit; - fru_ptr->next = (fru_info_t *)NULL; - /* - * SSB - */ - mct_system_info.fru_info_list[SSB] = (fru_info_t *) - kmem_zalloc(sizeof (fru_info_t) * - (mct_system_info.max_units[SSB] + pad), KM_SLEEP); - fru_ptr = mct_system_info.fru_info_list[SSB]; - unit = 1; - /* SCB15 */ - /* - * get the FRU event code (t), then use it to get the - * FRU bit-offset for SYSCFG register - */ - t = FRU_UNIT_TO_EVCODE(SSB, unit); - bit_num = FRU_OFFSET(t, SCTRL_SYSCFG_BASE); - /* - * get the registers addresses and shadow register index for - * the SYSCFG register - */ - i = FRU_REG_INDEX(t, SCTRL_SYSCFG_BASE); - syscfg = SCSB_REG_ADDR(i); - index = SCSB_REG_INDEX(syscfg); - /* - * check and set presence status - */ - if (scsb->scsb_data_reg[index] & (1 << bit_num)) { - fru_ptr->fru_status = FRU_PRESENT; - } else { - fru_ptr->fru_status = FRU_NOT_PRESENT; - } - fru_ptr->fru_type = SSB; - fru_ptr->fru_unit = (scsb_unum_t)unit; - fru_ptr->fru_id = fru_id_table[event_to_index(t)]; - fru_ptr->fru_version = (fru_version_t)0; - fru_ptr->type_list = (fru_options_t *)NULL; - fru_ptr->i2c_info = (fru_i2c_info_t *) - kmem_zalloc(sizeof (fru_i2c_info_t), KM_SLEEP); - fru_ptr->i2c_info->syscfg_reg = syscfg; - fru_ptr->i2c_info->syscfg_bit = bit_num; - fru_ptr->i2c_info->ledata_reg = 0; - fru_ptr->i2c_info->ledata_bit = 0; - fru_ptr->i2c_info->blink_reg = 0; - fru_ptr->i2c_info->blink_bit = 0; - fru_ptr->next = (fru_info_t *)NULL; - /* - * CFTM - */ - mct_system_info.fru_info_list[CFTM] = (fru_info_t *) - kmem_zalloc(sizeof (fru_info_t) * - (mct_system_info.max_units[CFTM] + pad), KM_SLEEP); - fru_ptr = mct_system_info.fru_info_list[CFTM]; - unit = 1; - /* SCB15 */ - /* - * get the FRU event code (t), then use it to get the - * FRU bit-offsets for LED and SYSCFG registers - */ - t = FRU_UNIT_TO_EVCODE(CFTM, unit); - led_bit = FRU_OFFSET(t, SCTRL_LED_OK_BASE); - bit_num = FRU_OFFSET(t, SCTRL_SYSCFG_BASE); - if (IS_SCB_P15) { - blink_bit = FRU_OFFSET(t, SCTRL_BLINK_OK_BASE); - i = FRU_REG_INDEX(t, SCTRL_BLINK_OK_BASE); - blink_reg = SCSB_REG_ADDR(i); - } else { - blink_bit = 0; - blink_reg = 0; - } - /* - * get the registers addresses and shadow register index for - * the SYSCFG register - */ - i = FRU_REG_INDEX(t, SCTRL_SYSCFG_BASE); - syscfg = SCSB_REG_ADDR(i); - index = SCSB_REG_INDEX(syscfg); - i = FRU_REG_INDEX(t, SCTRL_LED_OK_BASE); - led_reg = SCSB_REG_ADDR(i); - /* - * check and set presence status - */ - if (scsb->scsb_data_reg[index] & (1 << bit_num)) { - fru_ptr->fru_status = FRU_PRESENT; - if (ctcslot_ptr != NULL && ctcslot_ptr->fru_status == - FRU_PRESENT) { - ctcslot_ptr->fru_type = (scsb_utype_t)OC_CTC; - scsb->scsb_hsc_state |= SCSB_HSC_CTC_PRES; - } - } else { - fru_ptr->fru_status = FRU_NOT_PRESENT; - } - fru_ptr->fru_type = CFTM; - fru_ptr->fru_unit = (scsb_unum_t)1; - fru_ptr->fru_id = fru_id_table[event_to_index(t)]; - fru_ptr->fru_version = (fru_version_t)0; - fru_ptr->type_list = (fru_options_t *)NULL; - fru_ptr->i2c_info = (fru_i2c_info_t *) - kmem_zalloc(sizeof (fru_i2c_info_t), KM_SLEEP); - fru_ptr->i2c_info->syscfg_reg = syscfg; - fru_ptr->i2c_info->syscfg_bit = bit_num; - fru_ptr->i2c_info->ledata_reg = led_reg; - fru_ptr->i2c_info->ledata_bit = led_bit; - fru_ptr->i2c_info->blink_reg = blink_reg; - fru_ptr->i2c_info->blink_bit = blink_bit; - fru_ptr->next = (fru_info_t *)NULL; - /* - * CRTM - */ - mct_system_info.fru_info_list[CRTM] = (fru_info_t *) - kmem_zalloc(sizeof (fru_info_t) * - (mct_system_info.max_units[CRTM] + pad), - KM_SLEEP); - fru_ptr = mct_system_info.fru_info_list[CRTM]; - unit = 1; - /* SCB15 */ - /* - * get the FRU event code (t), then use it to get the - * FRU bit-offsets for LED and SYSCFG registers - */ - t = FRU_UNIT_TO_EVCODE(CRTM, unit); - bit_num = FRU_OFFSET(t, SCTRL_SYSCFG_BASE); - /* - * get the registers addresses and shadow register index for - * the SYSCFG register - */ - i = FRU_REG_INDEX(t, SCTRL_SYSCFG_BASE); - syscfg = SCSB_REG_ADDR(i); - index = SCSB_REG_INDEX(syscfg); - /* - * check and set presence status - */ - if (scsb->scsb_data_reg[index] & (1 << bit_num)) { - fru_ptr->fru_status = FRU_PRESENT; - } else { - fru_ptr->fru_status = FRU_NOT_PRESENT; - } - fru_ptr->fru_type = CRTM; - fru_ptr->fru_unit = (scsb_unum_t)unit; - fru_ptr->fru_id = fru_id_table[event_to_index(t)]; - fru_ptr->fru_version = (fru_version_t)0; - fru_ptr->type_list = (fru_options_t *)NULL; - fru_ptr->i2c_info = (fru_i2c_info_t *) - kmem_zalloc(sizeof (fru_i2c_info_t), KM_SLEEP); - fru_ptr->i2c_info->syscfg_reg = syscfg; - fru_ptr->i2c_info->syscfg_bit = bit_num; - fru_ptr->i2c_info->ledata_reg = 0; - fru_ptr->i2c_info->ledata_bit = 0; - fru_ptr->i2c_info->blink_reg = 0; - fru_ptr->i2c_info->blink_bit = 0; - fru_ptr->next = (fru_info_t *)NULL; - /* - * PRTM - */ - mct_system_info.fru_info_list[PRTM] = (fru_info_t *) - kmem_zalloc(sizeof (fru_info_t) * - (mct_system_info.max_units[PRTM] + pad), KM_SLEEP); - fru_ptr = mct_system_info.fru_info_list[PRTM]; - unit = 1; - /* - * SCB15 - * get the FRU event code (t), then use it to get the - * FRU bit-offsets for LED and SYSCFG registers - */ - t = FRU_UNIT_TO_EVCODE(PRTM, unit); - bit_num = FRU_OFFSET(t, SCTRL_SYSCFG_BASE); - /* - * get the registers addresses and shadow register index for - * the SYSCFG register - */ - i = FRU_REG_INDEX(t, SCTRL_SYSCFG_BASE); - syscfg = SCSB_REG_ADDR(i); - index = SCSB_REG_INDEX(syscfg); - /* - * check and set presence status - */ - if (scsb->scsb_data_reg[index] & (1 << bit_num)) { - fru_ptr->fru_status = FRU_PRESENT; - } else { - fru_ptr->fru_status = FRU_NOT_PRESENT; - } - fru_ptr->fru_type = PRTM; - fru_ptr->fru_unit = (scsb_unum_t)unit; - fru_ptr->fru_id = fru_id_table[event_to_index(t)]; - fru_ptr->fru_version = (fru_version_t)0; - fru_ptr->type_list = (fru_options_t *)NULL; - fru_ptr->i2c_info = (fru_i2c_info_t *) - kmem_zalloc(sizeof (fru_i2c_info_t), KM_SLEEP); - fru_ptr->i2c_info->syscfg_reg = syscfg; - fru_ptr->i2c_info->syscfg_bit = bit_num; - fru_ptr->i2c_info->ledata_reg = 0; - fru_ptr->i2c_info->ledata_bit = 0; - fru_ptr->i2c_info->blink_reg = 0; - fru_ptr->i2c_info->blink_bit = 0; - fru_ptr->next = (fru_info_t *)NULL; - - scsb->scsb_state |= SCSB_TOPOLOGY; -#ifdef DEBUG - mct_topology_dump(scsb, 0); -#endif -} - -/*ARGSUSED*/ -static void -scsb_free_topology(scsb_state_t *scsb) -{ - int i; - fru_info_t *fru_ptr; - - if (scsb_debug & 0x00100005) - cmn_err(CE_NOTE, "scsb_free_topology:"); - for (i = 0; i < SCSB_UNIT_TYPES; ++i) { - fru_ptr = mct_system_info.fru_info_list[i]; - while (fru_ptr != NULL) { - if (fru_ptr->i2c_info != (fru_i2c_info_t *)NULL) - kmem_free(fru_ptr->i2c_info, - sizeof (fru_i2c_info_t)); - fru_ptr = fru_ptr->next; - } - if ((fru_ptr = mct_system_info.fru_info_list[i]) != - (fru_info_t *)NULL) { - kmem_free(fru_ptr, sizeof (fru_info_t) * - mct_system_info.max_units[i]); - mct_system_info.fru_info_list[i] = (fru_info_t *)NULL; - } - } -} - -#ifdef DEBUG -static void -mct_topology_dump(scsb_state_t *scsb, int force) -{ - int i; - fru_info_t *fru_ptr; - - if (!force && !(scsb_debug & 0x00200000)) - return; - if (force && !(scsb->scsb_state & (SCSB_DIAGS_MODE | SCSB_DEBUG_MODE))) - return; - if (!(scsb->scsb_state & SCSB_TOPOLOGY)) { - cmn_err(CE_NOTE, "mct_topology_dump: Topology not set!"); - return; - } - for (i = 0; i < SCSB_UNIT_TYPES; ++i) { - fru_ptr = mct_system_info.fru_info_list[i]; - switch ((scsb_utype_t)i) { - case SLOT: - cmn_err(CE_NOTE, "MCT: Number of Slots: %d", - mct_system_info.max_units[SLOT]); - break; - case ALARM: - cmn_err(CE_NOTE, "MCT: MAX Number of Alarm Cards: %d", - mct_system_info.max_units[ALARM]); - break; - case DISK: - cmn_err(CE_NOTE, "MCT: MAX Number of SCSI Devices: %d", - mct_system_info.max_units[DISK]); - break; - case FAN: - cmn_err(CE_NOTE, "MCT: MAX Number of Fan Trays: %d", - mct_system_info.max_units[FAN]); - break; - case PDU: - cmn_err(CE_NOTE, "MCT: MAX Number of PDUs: %d", - mct_system_info.max_units[PDU]); - break; - case PS: - cmn_err(CE_NOTE, - "MCT: MAX Number of Power Supplies: %d", - mct_system_info.max_units[PS]); - break; - case SCB: - cmn_err(CE_NOTE, "MCT: MAX Number of SCBs: %d", - mct_system_info.max_units[SCB]); - break; - case SSB: - cmn_err(CE_NOTE, "MCT: MAX Number of SSBs: %d", - mct_system_info.max_units[SSB]); - break; - } - while (fru_ptr != NULL) { - if (fru_ptr->fru_status & FRU_PRESENT) { - cmn_err(CE_NOTE, - "MCT: type=%d, unit=%d, id=0x%x, " - "version=0x%x", - fru_ptr->fru_type, - fru_ptr->fru_unit, - fru_ptr->fru_id, - fru_ptr->fru_version); - } - fru_ptr = fru_ptr->next; - } - } -} - -/* - * Sends an event when the system controller board I2C errors - * exceed the threshold. - */ -static void -scsb_failing_event(scsb_state_t *scsb) -{ - uint32_t scsb_event_code = SCTRL_EVENT_SCB; - - add_event_code(scsb, scsb_event_code); - (void) scsb_queue_ops(scsb, QPUT_INT32, 1, &scsb_event_code, - "scsb_intr"); -} -#endif - -int -scsb_read_bhealthy(scsb_state_t *scsb) -{ - int error; - uchar_t reg; - int index; - - if (scsb_debug & 0x8001) { - cmn_err(CE_NOTE, "scsb_read_bhealthy()"); - } - reg = SCSB_REG_ADDR(SCTRL_BHLTHY_BASE); - index = SCSB_REG_INDEX(reg); - error = scsb_rdwr_register(scsb, I2C_WR_RD, reg, - SCTRL_BHLTHY_NUMREGS, &scsb->scsb_data_reg[index], 1); - return (error); -} - -/* - * Returns the health status of a slot - */ -int -scsb_read_slot_health(scsb_state_t *scsb, int pslotnum) -{ - int slotnum = tonga_psl_to_ssl(scsb, pslotnum); - return (scsb_fru_op(scsb, SLOT, slotnum, - SCTRL_BHLTHY_BASE, SCSB_FRU_OP_GET_BITVAL)); -} - -/* - * DIAGNOSTIC and DEBUG only. - * Called from ioctl command (SCSBIOC_BHEALTHY_GET) - */ -int -scsb_bhealthy_slot(scsb_state_t *scsb, scsb_uinfo_t *suip) -{ - int error = 0; - int base, code, unit_number; - uchar_t reg; - int index; - - if (scsb->scsb_state & SCSB_FROZEN) - return (EAGAIN); - - /* operation valid for slots only */ - if (suip == NULL || suip->unit_type != SLOT) { - return (EINVAL); - } - - if (scsb_debug & 0x8001) - cmn_err(CE_NOTE, "scsb_bhealthy_slot: slot %d", - suip->unit_number); - if (suip->unit_number > mct_system_info.max_units[SLOT]) { - return (EINVAL); - } - /* - * Map 1.0 Tonga Slot Number, if necessary - */ - tonga_slotnum_check(scsb, suip); - base = SCTRL_BHLTHY_BASE; - code = FRU_UNIT_TO_EVCODE(suip->unit_type, suip->unit_number); - unit_number = FRU_OFFSET(code, base); - index = FRU_REG_INDEX(code, base); - reg = SCSB_REG_ADDR(index); - index = SCSB_REG_INDEX(reg); /* shadow index */ - - if (scsb->scsb_state & SCSB_P10_PROM) { - error = scsb_read_bhealthy(scsb); - } - /* else shadow regs are updated by interrupt handler */ - if (error == 0) { - if (scsb->scsb_data_reg[index] & (1 << unit_number)) - suip->unit_state = ON; - else - suip->unit_state = OFF; - } - return (error); -} - -/* - * Called from HSC and ioctl command (SCSBIOC_RESET_UNIT) - * to reset one specified slot - */ -int -scsb_reset_unit(scsb_state_t *scsb, scsb_uinfo_t *suip) -{ - int error; - int unit_number; - uchar_t reg; - int index, slotnum, reset_state; - - if (scsb->scsb_state & SCSB_FROZEN) - return (EAGAIN); - if (scsb_debug & 0x8001) { - cmn_err(CE_NOTE, "scsb_reset_slot(%d): slot %d, state %d\n", - scsb->scsb_instance, suip->unit_number, - suip->unit_state); - } - if (suip->unit_type != ALARM && !(scsb->scsb_state & - (SCSB_DIAGS_MODE | SCSB_DEBUG_MODE))) { - return (EINVAL); - } - if (suip->unit_state != ON && suip->unit_state != OFF) { - return (EINVAL); - } - error = 0; - switch (suip->unit_type) { - case ALARM: - { - int i, code; - if (suip->unit_number != 1) - return (EINVAL); - code = FRU_UNIT_TO_EVCODE(suip->unit_type, suip->unit_number); - unit_number = FRU_OFFSET(code, SCTRL_RESET_BASE); - i = ALARM_RESET_REG_INDEX(code, SCTRL_RESET_BASE); - reg = SCSB_REG_ADDR(i); - break; - } - case SLOT: - slotnum = suip->unit_number; - reset_state = (suip->unit_state == ON) ? SCSB_RESET_SLOT : - SCSB_UNRESET_SLOT; - if (scsb->scsb_state & SCSB_IS_TONGA) { - if (slotnum > TG_MAX_SLOTS || - slotnum == SC_TG_CPU_SLOT) { - return (EINVAL); - } - } else { - if (slotnum > MC_MAX_SLOTS || - slotnum == SC_MC_CPU_SLOT || - (scsb->scsb_hsc_state & SCSB_HSC_CTC_PRES && - slotnum == SC_MC_CTC_SLOT)) { - return (EINVAL); - } - } - return (scsb_reset_slot(scsb, slotnum, reset_state)); - default: - return (EINVAL); - } - index = SCSB_REG_INDEX(reg); - mutex_enter(&scsb->scsb_mutex); - if (suip->unit_state == ON) - scsb->scsb_data_reg[index] |= (1 << unit_number); - else /* OFF */ - scsb->scsb_data_reg[index] &= ~(1 << unit_number); - if ((error = scsb_rdwr_register(scsb, I2C_WR, reg, 1, - &scsb->scsb_data_reg[index], 0)) != 0) { - if (scsb_debug & 0x8002) - cmn_err(CE_WARN, - "scsb_leds: write failure to 0x%x", reg); - return (error); - } - mutex_exit(&scsb->scsb_mutex); - return (error); -} - -/* - * Diagnostic and DEBUG - * This is a helper function for the helper ioctl to pretend that - * scsb h/w is doing its job!!! - */ -int -scsb_slot_occupancy(scsb_state_t *scsb, scsb_uinfo_t *suip) -{ - int error; - int saved_unit_number; - - if (!(scsb->scsb_state & (SCSB_DEBUG_MODE | SCSB_DIAGS_MODE))) - return (EACCES); - if (scsb->scsb_state & SCSB_FROZEN) { - return (EAGAIN); - } - error = 0; - switch (suip->unit_type) { - case ALARM: - if (suip->unit_number != - (mct_system_info.fru_info_list[ALARM])->fru_unit) { - return (EINVAL); - } - break; - - case SLOT: - /* - * All slots are acceptable, except slots 11 & 12. - */ - if (suip->unit_number < 1 || suip->unit_number > - mct_system_info.max_units[ALARM]) { - error = EINVAL; - break; - } - /* Map 1.0 Tonga Slot Numbers if necessary */ - saved_unit_number = suip->unit_number; - tonga_slotnum_check(scsb, suip); - break; - - default: - error = EINVAL; - break; - } - - if (error) - return (error); - if (suip->unit_state == ON) { - if (hsc_slot_occupancy(saved_unit_number, B_TRUE, 0, B_TRUE) - != 0) - error = EFAULT; - } else { - if (hsc_slot_occupancy(saved_unit_number, B_FALSE, 0, B_FALSE) - != 0) - error = EFAULT; - } - - return (error); -} - -static int -scsb_clear_intptrs(scsb_state_t *scsb) -{ - int i, error; - uchar_t wbuf[SCTRL_MAX_GROUP_NUMREGS]; - error = 0; - for (i = 1; i <= SCTRL_INTR_NUMREGS; ++i) { - wbuf[i] = 0xff; - } - if (error = scsb_rdwr_register(scsb, I2C_WR, - SCSB_REG_ADDR(SCTRL_INTSRC_BASE), - SCTRL_INTR_NUMREGS, wbuf, 1)) { - if (scsb_debug & 0x0402) - cmn_err(CE_NOTE, "scsb_clear_intptrs(): " - "write to 0x%x failed", - SCSB_REG_ADDR(SCTRL_INTSRC_BASE)); - } - return (error); -} - -static int -scsb_setall_intmasks(scsb_state_t *scsb) -{ - int error; - uchar_t reg, wdata, rmask; - int i; - - /* - * write loop for Interrupt Mask registers - */ - if (scsb_debug & 0x0401) - cmn_err(CE_NOTE, "setall_intmasks()"); - error = 0; - rmask = 0; - wdata = 0xff; - reg = SCSB_REG_ADDR(SCTRL_INTMASK_BASE); - for (i = 0; i < SCTRL_MASK_NUMREGS; ++i, ++reg) { - if (error = scsb_write_mask(scsb, reg, rmask, wdata, 0)) { - if (scsb_debug & 0x0402) - cmn_err(CE_NOTE, "scsb_setall_intmasks: " - "write to 0x%x failed: %d", reg, error); - error = EIO; - break; - } - } - return (error); -} - - -/* - * Clear Interrupt masks based on the FRUs that could be installed - * for this particular topology, determined by the MidPlane ID - * from SCTRL_SYSCFG registers - * case SCTRL_MPID_HALF: - * 1 CPU, 1 AlarmCard, 1 SCB/SSB, 2 PS, 3 FAN, 3 SCSI, 8 Slots - * case SCTRL_MPID_QUARTER: - * 1 CPU, 1 AlarmCard, 1 SCB/SSB, 1 PS, 2 FAN, 1 SCSI, 4 Slots - * case SCTRL_MPID_QUARTER_NODSK: - * 1 CPU, 1 AlarmCard, 1 SCB/SSB, 1 PS, 2 FAN, 0 SCSI, 4 Slots - */ -static int -scsb_clear_intmasks(scsb_state_t *scsb) -{ - int error; - uchar_t msk_reg, reg, wdata, rmask; - uchar_t mask_data[SCTRL_MAX_GROUP_NUMREGS]; - int tmp, idx, code, unit, offset, mbid; - scsb_utype_t fru_type; - fru_info_t *fru_ptr; - - if (scsb->scsb_state & SCSB_FROZEN && - !(scsb->scsb_state & SCSB_IN_INTR)) { - return (EAGAIN); - } - error = 0; - for (tmp = 0; tmp < SCTRL_MASK_NUMREGS; ++tmp) - mask_data[tmp] = 0; - msk_reg = SCSB_REG_ADDR(SCTRL_INTMASK_BASE); - mbid = SCSB_REG_INDEX(msk_reg); /* the Mask Base Index Delta */ - if (scsb_debug & 0x0400) { - cmn_err(CE_NOTE, "clear_intmasks: msk_reg=0x%x; mbid=%d", - msk_reg, mbid); - } - for (fru_type = 0; fru_type < SCSB_UNIT_TYPES; ++fru_type) { - if (fru_type == SCB) - continue; /* handle below, 2 reg offsets */ - fru_ptr = mct_system_info.fru_info_list[fru_type]; - for (; fru_ptr != NULL; fru_ptr = fru_ptr->next) { - unit = fru_ptr->fru_unit; - code = FRU_UNIT_TO_EVCODE(fru_type, unit); - offset = FRU_OFFSET(code, SCTRL_INTMSK_BASE); - reg = FRU_REG_ADDR(code, SCTRL_INTMSK_BASE); - idx = SCSB_REG_INDEX(reg); - tmp = idx - mbid; - mask_data[tmp] |= (1 << offset); - if (scsb_debug & 0x0400) - cmn_err(CE_NOTE, - "clear_intmasks:%d:%d: PRES mask[%d]:0x%x", - fru_type, unit, tmp, mask_data[tmp]); - if ((fru_type == SLOT) && (IS_SCB_P15)) { - /* - * Unmask the corresponding Slot HLTHY mask - * Use Slot bit and register offsets, - * but with SCTRL_INTMASK_HLTHY_BASE - */ - reg = FRU_REG_ADDR(code, - SCTRL_INTMASK_HLTHY_BASE); - idx = SCSB_REG_INDEX(reg); - tmp = idx - mbid; - mask_data[tmp] |= (1 << offset); - if (scsb_debug & 0x0400) { - cmn_err(CE_NOTE, - "clear_intmasks:Slot:%d: HLTHY mask[%d]:0x%x" - "; reg=0x%x, idx=%d, mbid=%d", - unit, tmp, mask_data[tmp], - reg, idx, mbid); - } - } - } - } - /* - * Now unmask these non-fru interrupt events - * SCTRL_EVENT_PWRDWN (almost normal) - * SCTRL_EVENT_REPLACE (not used) - * SCTRL_EVENT_ALARM_INT (not working in P0.6/P1.0) - * SCTRL_EVENT_SCB (SCB 1.5 ONLY; plus SCB_INT_OFFSET) - */ - code = SCTRL_EVENT_PWRDWN; - offset = FRU_OFFSET(code, SCTRL_INTMSK_BASE); - reg = FRU_REG_ADDR(code, SCTRL_INTMSK_BASE); - idx = SCSB_REG_INDEX(reg); - tmp = idx - mbid; - mask_data[tmp] |= (1 << offset); - if (IS_SCB_P15) { - code = SCTRL_EVENT_SCB; - offset = FRU_OFFSET(code, SCTRL_INTMSK_BASE); - reg = FRU_REG_ADDR(code, SCTRL_INTMSK_BASE) + SCB_INT_OFFSET; - idx = SCSB_REG_INDEX(reg); - tmp = idx - mbid; - mask_data[tmp] |= (1 << offset); - code = SCTRL_EVENT_ALARM_INT; - offset = FRU_OFFSET(code, SCTRL_INTMSK_BASE); - reg = FRU_REG_ADDR(code, SCTRL_INTMSK_BASE); - idx = SCSB_REG_INDEX(reg); - tmp = idx - mbid; - mask_data[tmp] |= (1 << offset); - } - for (tmp = 0; tmp < SCTRL_MASK_NUMREGS; ++tmp) { - rmask = 0; - wdata = mask_data[tmp]; - if (scsb_debug & 0x0400) - cmn_err(CE_NOTE, "clear_intmasks:0x%x: ~(0x%x),0x%x", - msk_reg, (~wdata) & 0xff, wdata); - mutex_enter(&scsb->scsb_mutex); - if (error = scsb_write_mask(scsb, msk_reg, rmask, - (~wdata) & 0xff, wdata)) { - mutex_exit(&scsb->scsb_mutex); - if (scsb_debug & 0x0402) - cmn_err(CE_NOTE, "scsb_clear_intmasks: " - "write to 0x%x failed: %d", - msk_reg, error); - error = EIO; - break; - } - mutex_exit(&scsb->scsb_mutex); - ++msk_reg; - } - return (error); -} - -static int -scsb_get_status(scsb_state_t *scsb, scsb_status_t *smp) -{ - register int i; - - if (smp == NULL) { - return (EFAULT); - } - if (scsb_debug & 0x40000000 && - (scsb->scsb_state & SCSB_DEBUG_MODE || - scsb->scsb_state & SCSB_DIAGS_MODE)) { - if (scsb->scsb_state & SCSB_FROZEN) { - return (EAGAIN); - } - mutex_enter(&scsb->scsb_mutex); - if (scsb_debug & 0x80000000) { - if ((i = scsb_readall_regs(scsb)) != 0 && - scsb->scsb_state & SCSB_DEBUG_MODE) - cmn_err(CE_WARN, "scsb_get_status: " - "scsb_readall_regs() FAILED"); - } else { - if ((i = scsb_check_config_status(scsb)) == 0) { - i = scsb_set_scfg_pres_leds(scsb, NULL); - } - } - mutex_exit(&scsb->scsb_mutex); - if (i) { - cmn_err(CE_WARN, - "scsb_get_status: FAILED Presence LEDs update"); - return (EIO); - } - } - for (i = 0; i < SCSB_DATA_REGISTERS; ++i) - smp->scsb_reg[i] = scsb->scsb_data_reg[i]; - return (0); -} - -/* - * scsb_freeze_check: - * Turn all the leds off on the system monitor card, without changing - * the state of what we have for scsb. This routine is called only when - * replacing system monitor card, so the state of the card leds could be - * restored, using scsb_restore(). - * Also, set state to SCSB_FROZEN which denies access to scsb while in - * freeze mode. - */ -static char *BAD_BOARD_MSG = - "SCSB: Should NOT remove SCB(%d) while cPCI Slot %d is " - "in RESET with a possible bad board."; -static int slots_in_reset[SCTRL_MAX_GROUP_NUMREGS]; - -static void -scsb_freeze_check(scsb_state_t *scsb) -{ - register int i; - int offset; - int unit, slotnum; - int index; - fru_info_t *fru_ptr; - uint32_t code; - uchar_t reg; - - if (scsb_debug & 0x20001) - cmn_err(CE_NOTE, "scsb_freeze_check(%d):", scsb->scsb_instance); - - if (scsb->scsb_state & SCSB_FROZEN) { - return; - } - mutex_enter(&scsb->scsb_mutex); - for (i = 0; i < SCTRL_MAX_GROUP_NUMREGS; ++i) - slots_in_reset[i] = 0; - /* - * We allow the SCB to be removed only if none of - * the cPCI resets are asserted for occupied slots. - * There shouldn't be a bad board plugged in the system - * while swapping the SCB. - */ - fru_ptr = mct_system_info.fru_info_list[SLOT]; - for (unit = 1; unit <= mct_system_info.max_units[SLOT]; ++unit) { - if (IS_SCB_P15) { - slotnum = tonga_psl_to_ssl(scsb, unit); - } else { - slotnum = unit; - } - code = FRU_UNIT_TO_EVCODE(SLOT, slotnum); - offset = FRU_OFFSET(code, SCTRL_RESET_BASE); - reg = FRU_REG_ADDR(code, SCTRL_RESET_BASE); - index = SCSB_REG_INDEX(reg); - if (scsb->scsb_data_reg[index] & (1 << offset)) { - if (fru_ptr[unit - 1].fru_status == FRU_PRESENT) { - slots_in_reset[unit - 1] = unit; - cmn_err(CE_NOTE, BAD_BOARD_MSG, - scsb->scsb_instance, unit); - } - } - } - mutex_exit(&scsb->scsb_mutex); -} - -static void -scsb_freeze(scsb_state_t *scsb) -{ - uint32_t code; - if (scsb_debug & 0x00020002) { - cmn_err(CE_WARN, "scsb_freeze: SCB%d possibly removed", - scsb->scsb_instance); - } - if (scsb->scsb_state & SCSB_FROZEN) - return; - scsb->scsb_state |= SCSB_FROZEN; - scsb->scsb_state &= ~SCSB_SCB_PRESENT; - (void) scsb_hsc_freeze(scsb->scsb_dev); - /* - * Send the EVENT_SCB since there is evidence that the - * System Controller Board has been removed. - */ - code = SCTRL_EVENT_SCB; - if (!(scsb->scsb_state & SCSB_IN_INTR)) - scsb_event_code = code; - check_fru_info(scsb, code); - add_event_code(scsb, code); - (void) scsb_queue_ops(scsb, QPUT_INT32, 1, &code, "scsb_freeze"); -} - -/* - * scsb_restore will only be called from the interrupt handler context on - * INIT_SCB interrupt for newly inserted SCB. - * Called with mutex held. - */ -static void -scsb_restore(scsb_state_t *scsb) -{ - if (scsb_debug & 0x20001) - cmn_err(CE_NOTE, "scsb_restore(%d):", scsb->scsb_instance); - - if (initialize_scb(scsb) != DDI_SUCCESS) { - if (scsb_debug & 0x00020002) { - cmn_err(CE_WARN, "scsb_restore: INIT Failed"); - return; - } - } - /* 9. Clear all Interrupts */ - if (scsb_clear_intmasks(scsb)) { - cmn_err(CE_WARN, - "scsb%d: I2C TRANSFER Failed", scsb->scsb_instance); - if (scsb_debug & 0x00020002) { - cmn_err(CE_WARN, "scsb_restore: clear_intmasks Failed"); - } - return; - } - - /* 10. */ - /* Check if Alarm Card present at boot and set flags */ - if (scsb_fru_op(scsb, ALARM, 1, SCTRL_SYSCFG_BASE, - SCSB_FRU_OP_GET_BITVAL)) - scsb->scsb_hsc_state |= SCSB_ALARM_CARD_PRES; - else - scsb->scsb_hsc_state &= ~SCSB_ALARM_CARD_PRES; - - scsb->scsb_state &= ~SCSB_FROZEN; - (void) scsb_hsc_restore(scsb->scsb_dev); -} - -/* - * Given an Event Code, - * Return: - * FRU type in LSByte - * unit number in MSByte - */ -uint16_t -event_to_type(uint32_t evcode) -{ - int i, li, unit; - uint32_t ec; - uint16_t ret; - for (i = li = 0; i < SCSB_UNIT_TYPES; ++i) { - if (evcode == type_to_code1[i]) { - ret = (uint16_t)(0x0100 | i); - return (ret); - } - if (evcode < type_to_code1[i]) { - unit = 1; - ec = type_to_code1[li]; - while (ec < evcode) - ec = ec << 1, ++unit; - ret = (unit << 8) | li; - return (ret); - } - li = i; - } - return ((uint16_t)0xffff); -} - -/* - * scsb interrupt handler for (MC) PSM_INT vector - * P0.6: HW shipped to beta customers - * 1. did not have Slot Occupant Presense support - * 2. I2C interrupt-map properties not yet tested, using polling daemon - * 3. Polling detects each event reliably twice. - * clr_bits# are used to keep track of events to be ignored 2nd time - * - * retval flags allow all events to be checked, and still returning the - * correct DDI value. - * - */ -#define SCSB_INTR_CLAIMED 1 -#define SCSB_INTR_UNCLAIMED 2 -#define SCSB_INTR_EVENT 4 - -/* - * Does preprocessing of the interrupt. The only thing this - * needs to do is to ask scsb to release the interrupt line. - * and then schedule delayed actual processing using timeout() - */ -uint_t -scsb_intr_preprocess(caddr_t arg) -{ - scsb_state_t *scsb = (scsb_state_t *)arg; - - scb_pre_s = gethrtime(); - - /* - * If SCSB_IN_INTR is already set in scsb_state, - * it means we are being interrupted by someone else. This can - * happen only if the interrupt does not belong to scsb, and some - * other device, e.g. a FAN or PS is interrupting. So, we - * cancel the previous timeout(). - */ - - if (scsb->scsb_state & SCSB_IN_INTR) { - (void) untimeout(scsb_intr_tid); - (void) scsb_invoke_intr_chain(); - (void) scsb_toggle_psmint(scsb, 1); - scsb->scsb_state &= ~SCSB_IN_INTR; - goto intr_end; - } - scsb->scsb_state |= SCSB_IN_INTR; - - /* - * Stop scsb from interrupting first. - */ - if (scsb_quiesce_psmint(scsb) != DDI_SUCCESS) { - goto intr_end; - } - - /* - * Schedule a timeout to actually process the - * interrupt. - */ - scsb_intr_tid = timeout((void (*)(void *))scsb_intr, arg, - drv_usectohz(1000)); - -intr_end: - - scb_pre_e = gethrtime(); - return (DDI_INTR_CLAIMED); -} - -static void scsb_healthy_intr(scsb_state_t *scsb, int pslotnum); -void -scsb_intr(caddr_t arg) -{ - scsb_state_t *scsb = (scsb_state_t *)arg; - int i, idx, offset, unit, numregs, error; - int intr_idx, index, offset_base, retval, slotnum, val; - uint32_t code; - uchar_t intr_reg, tmp_reg, intr_addr, clr_bits = 0; - uchar_t ac_slot = B_FALSE; - uchar_t *int_masks; - uchar_t cstatus_regs[SCTRL_MAX_GROUP_NUMREGS]; - scsb_utype_t fru_type; - fru_info_t *fru_ptr; - int ac_present; - - /* - * Avoid mayhem, make sure we have only one timeout thread running. - */ - mutex_enter(&scsb->scsb_mutex); - while (scsb_in_postintr) - cv_wait(&scsb->scsb_cv, &scsb->scsb_mutex); - scsb_in_postintr = 1; - mutex_exit(&scsb->scsb_mutex); - - scb_post_s = gethrtime(); - if (scsb_debug & 0x00002000) - cmn_err(CE_NOTE, "scsb_intr(%d)", scsb->scsb_instance); - retval = 0; - tmp_reg = 0; - /* - * XXX: Problem, when we want to support swapping between SCB - * versions, then we need to check the SCB PROM ID (CF) register here - * before assuming the same SCB version was re-inserted. - * We will have to duplicate some of the scb_initialization() - * code to set the scsb_state PROM ID bits and to set up the - * register table pointers. - * - * Only if NOT SSB_PRESENT, check the SCB PROM ID - */ - if (!(scsb->scsb_state & SCSB_SSB_PRESENT)) { - if (scb_check_version(scsb) != DDI_SUCCESS) { -#ifdef DEBUG - if (scsb->scsb_state & SCSB_SSB_PRESENT && - scsb->scsb_i2c_errcnt > scsb_err_threshold) - scsb_failing_event(scsb); -#endif - goto intr_error; - } - } - if (IS_SCB_P15) { - int_masks = scb_15_int_masks; - } else { - int_masks = scb_10_int_masks; - } - /* - * Now check the INTSRC registers for set bits. - * Do a quick check by OR'ing INTSRC registers together as we copy - * them from the transfer buffer. For P1.0 or earlier we had already - * read the interrupt source registers and wrote them back to stop - * interrupt. So we need to do this step only for P1.5 or later. - * We already read INTSRC6 to take care of SCB insertion case, so - * do not read INTSRC6 again. - */ - - if (IS_SCB_P15) { - intr_addr = SCSB_REG_ADDR(SCTRL_INTSRC_BASE); - /* read the interrupt register from scsb */ - if (scsb_rdwr_register(scsb, I2C_WR_RD, intr_addr, - SCTRL_INTR_NUMREGS - 1, scb_intr_regs, 1)) { - cmn_err(CE_WARN, "scsb_intr: " - " Failed read of interrupt registers."); -#ifdef DEBUG - if (scsb->scsb_state & SCSB_SSB_PRESENT && - scsb->scsb_i2c_errcnt > scsb_err_threshold) - scsb_failing_event(scsb); -#endif - goto intr_error; - } - } - - /* - * We have seen that an interrupt source bit can be set - * even though the corresponding interrupt mask bit - * has been set to mask the interrupt. So we must - * clear all bits set in the interrupt source register. - */ - for (i = 0; i < SCTRL_INTR_NUMREGS; ++i) { - retval |= scb_intr_regs[i]; /* Quick INTSRC check */ -#ifdef DEBUG - if (scsb_debug & 0x08000000) { - if (tmp_reg || scb_intr_regs[i]) { - cmn_err(CE_NOTE, "scsb_intr: INTSRC%d=0x%x", - i + 1, scb_intr_regs[i]); - ++tmp_reg; - } - } -#endif - } - /* - * Any bits from quick check? If this is not our interrupt, - * something is wrong. FAN/PS interrupts are supposed to be - * blocked, but we can not be sure. So, go ahead and call the - * emergency interrupt handlers for FAN/PS devices and mask - * their interrupts, if they aren't already masked. - */ - if (retval == 0) { - goto intr_error; - } - - retval = 0; - - /* - * If SCB 1.5 or 2.0, check for the INIT_SCB Interrupt - * to support Hot SCB Insertion. - * The check was moved here during debugging of the SCB hot insertion. - * Theoretically, this code could be moved back to the check for - * SCTRL_EVENT_SCB in the processing loop below. - */ - if (IS_SCB_P15) { - int iid; - iid = SCSB_REG_INDEX(intr_addr); - offset = FRU_OFFSET(SCTRL_EVENT_SCB, SCTRL_INTPTR_BASE); - tmp_reg = SCSB_REG_ADDR(SCTRL_INTSRC_SCB_P15); - intr_idx = SCSB_REG_INDEX(tmp_reg) - iid; - clr_bits = 1 << offset; - if (scb_intr_regs[intr_idx] & clr_bits) { - /* - * Must be newly inserted SCB - * Time to re-initialize. - */ - if (scsb_debug & 0x00023000) { - cmn_err(CE_NOTE, - "scsb_intr(%d): INIT_SCB INT", - scsb->scsb_instance); - } - scsb_restore(scsb); - retval |= (SCSB_INTR_CLAIMED | SCSB_INTR_EVENT); - /* - * The INTSRC bit will be cleared by the - * scsb_restore() function. - * Also, leave the bit set in scb_intr_regs[] so we can - * report the event code as we check for other - * interrupt source bits. - * - * scsb_write_mask(scsb, tmp_reg, 0, clr_bits, 0); - * scb_intr_regs[intr_idx] &= ~clr_bits; - */ - } - /* - * In case this is a power down interrupt, check the validity - * of the request to make sure it's not an I2C noise - */ - offset = FRU_OFFSET(SCTRL_EVENT_PWRDWN, - SCTRL_INTPTR_BASE); - clr_bits = 1 << offset; - intr_reg = scb_intr_regs[intr_idx]; - if (intr_reg & clr_bits) { - /* - * A shutdown request has been detected. Poll - * the corresponding register ? more times to - * make sure it's a genuine shutdown request. - */ - for (i = 0; i < scsb_shutdown_count; i++) { - drv_usecwait(1000); - if (scsb_rdwr_register(scsb, I2C_WR_RD, tmp_reg, - 1, &intr_reg, 1)) { - cmn_err(CE_WARN, "Failed to read " - " interrupt register"); - goto intr_error; - } - if (scsb_debug & 0x08000000) { - cmn_err(CE_NOTE, "scsb_intr: " - " INTSRC6[%d]=0x%x", i, - intr_reg); - } - if (!(intr_reg & clr_bits)) { - scb_intr_regs[intr_idx] &= ~clr_bits; - break; - } - } - } - } - /* - * if retval == 0, then we didn't call scsb_restore, - * so we update the shadow copy of SYSCFG registers - * We *MUST* read the syscfg registers before any attempt - * to clear the interrupt source registers is made. - */ - if (retval == 0 && scsb_check_config_status(scsb)) { - cmn_err(CE_WARN, - "scsb_intr: Failed read of config/status registers"); - if (scsb->scsb_state & SCSB_P06_NOINT_KLUGE) { - if (!scsb_debug) { - goto intr_error; - } - } -#ifdef DEBUG - if (scsb->scsb_state & SCSB_SSB_PRESENT && - scsb->scsb_i2c_errcnt > scsb_err_threshold) { - scsb_failing_event(scsb); - } -#endif - /* - * Allow to go on so we clear the INTSRC bits - */ - } - - /* - * Read the board healthy registers here, if any of the healthy - * interrupts are set. - */ - if (IS_SCB_P15) { - intr_idx = intr_reg = 0; - intr_addr = SCSB_REG_ADDR(SCTRL_INTSRC_BASE); - index = SCSB_REG_INDEX(intr_addr); - for (i = 0; i < SCTRL_BHLTHY_NUMREGS; ++i, ++intr_idx) { - scsb->scsb_data_reg[index++] = - scb_intr_regs[intr_idx] & int_masks[intr_idx]; - intr_reg |= scb_intr_regs[i]; - } - - if (intr_reg && scsb_read_bhealthy(scsb) != 0) { - cmn_err(CE_WARN, "%s#%d: Error Reading Healthy# " - " Registers", ddi_driver_name(scsb->scsb_dev), - ddi_get_instance(scsb->scsb_dev)); -#ifdef DEBUG - if (scsb->scsb_state & SCSB_SSB_PRESENT && - scsb->scsb_i2c_errcnt > scsb_err_threshold) { - scsb_failing_event(scsb); - } -#endif - goto intr_error; - } - } - - /* - * We clear the interrupt source registers now itself so that - * future interrupts can be latched quickly, instead of after - * finishing processing of all interrupt conditions. The global - * interrupt mask however remain disabled. - */ - if (IS_SCB_P15) { - if (scsb_rdwr_register(scsb, I2C_WR, intr_addr, - SCTRL_INTR_NUMREGS, scb_intr_regs, 1)) { - cmn_err(CE_WARN, "scsb_intr: Failed write to interrupt" - " registers."); -#ifdef DEBUG - if (scsb->scsb_state & SCSB_SSB_PRESENT && - scsb->scsb_i2c_errcnt > scsb_err_threshold) { - scsb_failing_event(scsb); - } -#endif - goto intr_error; - } - } - - /* - * At this point, all interrupt source registers are read. - * We only handle interrups which are not masked - */ - for (i = 0; i < SCTRL_INTR_NUMREGS; ++i) { - scb_intr_regs[i] &= int_masks[i]; - } - - /* - * We are here means that there was some bit set in the interrupt - * source register. So we must claim the interrupt no matter - * whatever error we may encounter in the course of processing. - */ - retval |= SCSB_INTR_CLAIMED; - - /* store config status data */ - tmp_reg = SCSB_REG_ADDR(SCTRL_SYSCFG_BASE); - index = SCSB_REG_INDEX(tmp_reg); - for (i = 0; i < SCTRL_CFG_NUMREGS; ++i) - cstatus_regs[i] = scsb->scsb_data_reg[index + i]; - /* - * Clear the event code, - * then check to see what kind(s) of events we were interrupted for. - * Check all SCTRL_INTSRC registers - */ - scsb_event_code = 0; - clr_bits = 0; - intr_idx = 0; - numregs = SCTRL_INTR_NUMREGS; - index = SCSB_REG_INDEX(intr_addr); - /* - * If SCB 1.5, adjust some variables to skip the SCTRL_BHLTHY_REGS - * which will be handled last in this function. - */ - if (IS_SCB_P15) { - i = SCTRL_BHLTHY_NUMREGS; - intr_idx += i; - intr_addr += i; - index += i; - } - /* - * For the rest of the INTSRC registers, we walk through the - * scb_fru_offset[] table, matching register offsets with our offset - * counter. Then we check for the scb_fru_offset[] bit in intr_reg. - * The scb_fru_offset[] index is now the SCTRL_EVENT code. - * The code is then compared to type_to_code1[] entries to find the - * fru_type. The fru_type will help us recognize when to do - * SLOT Hot Swap processing. - * - * offset_base: the appropriate scb_fru_offset[] base index - * for the INTPTR_BASE register group - * offset: bit offset found in INTSRC register - * intr_idx: index to temporary INTSRC register copies - * intr: modified copy of current INTR register - * intr_addr: SCB register address of current INTR register - * index: index to current INTR shadow register - * idx: bit-number of current INTR event bit - * uc: uchar_t from scb_fru_offset[] table, - * containing register and FRU offsets. - * j: used to walk fru_offset[] table, which is also - * the bit-number of the current event code - * code: manufactured event code for current INT event - */ - offset_base = FRU_OFFSET_BASE(SCTRL_INTPTR_BASE); - for (offset = 0; intr_idx < numregs; - ++offset, ++intr_idx, ++intr_addr, ++index) { - scsb->scsb_data_reg[index] = scb_intr_regs[intr_idx]; - intr_reg = scb_intr_regs[intr_idx]; - while (intr_reg) { /* for each INTSRC bit that's set */ - int j; - uint16_t ui; - uchar_t uc; - idx = event_to_index((uint32_t)intr_reg); /* offset */ - code = (1 << idx); /* back to bit mask */ - clr_bits |= code; - intr_reg = intr_reg & ~code; /* clear this one */ - for (j = 0; j < MCT_MAX_FRUS; ++j) { - /* - * Get register offset from table and check - * for a match with our loop offset counter. - * Then check for intr_reg bit-offset match - * with bit-offset from table entry. - */ - uc = scb_fru_offset[offset_base + j]; - if (offset != ((uc >> 4) & 0xf)) { - if (IS_SCB_P10) - continue; - if (j != FRU_INDEX(SCTRL_EVENT_SCB)) - continue; - if (offset != ((uc >> 4) & 0xf) - + SCB_INT_OFFSET) - continue; - } - if (idx == (uc & 0xf)) - break; - } - if (uc == 0xff) { - /* - * bit idx not recognized, check another. - */ - continue; - } - /* - * We found the fru_offset[] entry, now use the index - * to get the event code. - */ - code = (uint32_t)(1 << j); - if (scsb_debug & 0x00002000) { - cmn_err(CE_NOTE, "scsb_intr: code=0x%x", code); - } - /* - * Now check for the NON-FRU type events. - */ - if (code == SCTRL_EVENT_PWRDWN) { - if (scsb_debug & 0x1002) { - cmn_err(CE_NOTE, - "scsb_intr(%d): power down req." - " INT.", scsb->scsb_instance); - } - scsb_event_code |= code; - if (scsb->scsb_state & SCSB_OPEN && - scsb->scsb_rq != (queue_t *)NULL) { - /* - * inform applications using poll(2) - * about this event, and provide the - * event code to EnvMon scsb policy - */ - if (!(scsb_debug & 0x00040000)) - (void) scsb_queue_put(scsb->scsb_rq, 1, - &scsb_event_code, "scsb_intr"); - goto intr_error; - } - continue; - } else if (code == SCTRL_EVENT_REPLACE) { - if (scsb_debug & 0x1002) { - cmn_err(CE_NOTE, - "scsb_intr(%d): replacement " - "req. INT.", - scsb->scsb_instance); - } - scsb_freeze_check(scsb); - scsb_freeze(scsb); - scsb_event_code |= code; - retval |= (SCSB_INTR_CLAIMED | SCSB_INTR_EVENT); - continue; - } else if (code == SCTRL_EVENT_SCB) { - int tmp; - /* - * Must be newly inserted SCB - * Time to re-initialize. - */ - if (scsb_debug & 0x1002) { - cmn_err(CE_NOTE, - "scsb_intr(%d): INIT SCB INTR", - scsb->scsb_instance); - } - /* - * SCB initialization already handled, but we - * set the event code bit here in order to - * report the event to interested utilities. - * - * scsb_restore(scsb); - * The INTSRC bit is already cleared, - * so we won't do it again. - */ - tmp = FRU_OFFSET(SCTRL_EVENT_SCB, - SCTRL_INTPTR_BASE); - clr_bits &= ~(1 << tmp); - scsb_event_code |= code; - retval |= (SCSB_INTR_CLAIMED | SCSB_INTR_EVENT); - continue; - } else if (code == SCTRL_EVENT_ALARM_INT) { - /* - * P0.6/P1.0: SCTRL_INTR_ALARM_INT is always - * set and cannot be cleared, so ignore it. - */ - if (!IS_SCB_P15) { - continue; - } - if (scsb_debug & 0x1002) { - cmn_err(CE_NOTE, - "scsb_intr(%d): Alarm INT.", - scsb->scsb_instance); - } - scsb_event_code |= code; - retval |= (SCSB_INTR_CLAIMED | SCSB_INTR_EVENT); - /* - * XXX: - * Must service the Alarm INT by clearing INT - * condition on Alarm Card, - * then clear the SCTRL_INTR_ALARM_INT bit here. - * Waiting for specs and test environment. - */ - continue; - } else if ((ui = event_to_type(code)) == 0xffff) { - /* - * FRU type not found - */ - break; - } - /* - * Check for special processing - * now that we found the FRU type. - */ - fru_type = (scsb_utype_t)(ui & 0xff); - unit = (ui >> 8) & 0xff; - if (scsb_debug & 0x00002000) { - cmn_err(CE_NOTE, "scsb_intr: " - "FRU type/unit/code %d/%d/0x%x", - fru_type, unit, code); - } - switch (fru_type) { - case PDU: - break; - case PS: - break; - case DISK: - break; - case FAN: - break; - case SSB: - /* - * in check_fru_info() below, we see if the - * SSB has been removed, then check for - * occupied slots in reset to see if we should - * WARN agains SCB removal - */ - break; - case CFTM: - break; - case CRTM: - break; - case PRTM: - break; - case SLOT: - slotnum = tonga_ssl_to_psl(scsb, unit); - if (scsb_debug & 0x00002000) { - cmn_err(CE_NOTE, "scsb_intr: " - "unit/slot %d/%d", - unit, slotnum); - } - - /* - * If the slot number is not valid, continue. - */ - if (scsb->scsb_state & SCSB_IS_TONGA) { - if (slotnum > TG_MAX_SLOTS || - slotnum == SC_TG_CPU_SLOT) { - continue; - } - /* - * For a tonga, we need to return - * the code corresponding to the - * actual physical slot - */ - code = FRU_UNIT_TO_EVCODE(SLOT, - slotnum); - } else { - if (slotnum > MC_MAX_SLOTS || - slotnum == SC_MC_CPU_SLOT || - (scsb->scsb_hsc_state & - SCSB_HSC_CTC_PRES && - slotnum == SC_MC_CTC_SLOT)) { - continue; - } - } - /* FALLTHROUGH */ - case ALARM: - /* - * INDENT CHEATING, 2 indentations - */ - ac_present = 0; - /* - * If it is an Alarm Card Interrupt, we just do some sanity - * checks and then wait for the slot interrupt to take - * connect or disconnect action. - * XXX - Is there a gaurantee that ALARM int will occur first ? - */ - if (fru_type == ALARM) { - DEBUG2("AC Intr %d(%d)\n", scsb->ac_slotnum, idx+1); - val = scsb_fru_op(scsb, SLOT, - tonga_ssl_to_psl(scsb, scsb->ac_slotnum), - SCTRL_SYSCFG_BASE, SCSB_FRU_OP_GET_BITVAL); - ac_present = scsb_fru_op(scsb, ALARM, 1, - SCTRL_SYSCFG_BASE, - SCSB_FRU_OP_GET_BITVAL); - /* - * It is observed that slot presence and Alarm - * presence bits do not go ON at the same time. - * Hence we wait till both events happen. - */ -#ifdef DEBUG - if ((((val) && (!ac_present)) || - ((!val) && (ac_present))) && - (scsb->scsb_hsc_state & - SCSB_AC_SLOT_INTR_DONE)) - - cmn_err(CE_WARN, "?Alarm and Slot presence " - "state bits do not match! (%x,%x)", - val, ac_present); -#endif - if (scsb->scsb_hsc_state & SCSB_AC_SLOT_INTR_DONE) - scsb->scsb_hsc_state &= ~SCSB_AC_SLOT_INTR_DONE; - else - scsb->scsb_hsc_state |= SCSB_AC_SLOT_INTR_DONE; - break; /* we break and wait for slot interrupt. */ - } - - /* - * cPCI slot interrupt event - */ - if (scsb->scsb_state & SCSB_IS_TONGA) { - if (slotnum > TG_MAX_SLOTS || - slotnum == SC_TG_CPU_SLOT) { - continue; - } - } else { - if (slotnum > MC_MAX_SLOTS || - slotnum == SC_MC_CPU_SLOT || - (scsb->scsb_hsc_state & SCSB_HSC_CTC_PRES && - slotnum == SC_MC_CTC_SLOT)) { - continue; - } - } - if (scsb_is_alarm_card_slot(scsb, slotnum) == B_TRUE) { - DEBUG2("AC slot Intr %d(%d)\n", slotnum, idx+1); - ac_slot = B_TRUE; - } - val = scsb_fru_op(scsb, SLOT, unit, SCTRL_SYSCFG_BASE, - SCSB_FRU_OP_GET_BITVAL); - if (ac_slot == B_TRUE) { - ac_present = scsb_fru_op(scsb, ALARM, 1, - SCTRL_SYSCFG_BASE, - SCSB_FRU_OP_GET_BITVAL); -#ifdef DEBUG - if ((((val) && (!ac_present)) || - ((!val) && (ac_present))) && - (scsb->scsb_hsc_state & - SCSB_AC_SLOT_INTR_DONE)) { - - cmn_err(CE_WARN, "?Alarm and Slot presence " - "state bits do not match! (%x,%x)", - val, ac_present); - } -#endif - if (scsb->scsb_hsc_state & SCSB_AC_SLOT_INTR_DONE) - scsb->scsb_hsc_state &= ~SCSB_AC_SLOT_INTR_DONE; - else - scsb->scsb_hsc_state |= SCSB_AC_SLOT_INTR_DONE; - } - if (val) { - if (ac_present) { - DEBUG1("AC insertion on slot %d!\n", slotnum); - if (scsb_debug & 0x00010000) { - cmn_err(CE_NOTE, "scsb_intr: " - "AC_PRES slot %d", slotnum); - } - scsb->scsb_hsc_state |= SCSB_ALARM_CARD_PRES; - } -#ifndef lint - else - DEBUG1("IO Insertion on slot %d!\n", slotnum); -#endif - /* - * Special case : check MPID type. - * If MC midplane type, - * check to make sure the Alarm Card present - * bit is ON. If not, this is a regular IO card. - */ - (void) scsb_connect_slot(scsb, slotnum, B_FALSE); - } else { - if ((ac_slot == B_TRUE) && - (scsb->scsb_hsc_state & SCSB_ALARM_CARD_PRES)) { - - DEBUG1("AC Removal on slot %d!\n", slotnum); -#ifdef DEBUG - if (scsb_debug & 0x00010000) { - cmn_err(CE_NOTE, "scsb_intr: " - "!AC_PRES slot %d", - slotnum); - } -#endif /* DEBUG */ - scsb->scsb_hsc_state &= ~SCSB_ALARM_CARD_PRES; - } -#ifndef lint - else - DEBUG1("IO Removal on slot %d!\n", slotnum); -#endif - (void) scsb_disconnect_slot(scsb, B_FALSE, slotnum); - } - /* - * END INDENT CHEATING, 2 indentations - */ - - break; - default: - /* - * ERROR: Did not find cause of INTSRC bit - */ - if (scsb_debug & 0x00000002) { - cmn_err(CE_WARN, - "scsb_intr: FRU type %d" - " not recognized", fru_type); - } - continue; - } - scsb_event_code |= code; - retval |= (SCSB_INTR_CLAIMED | SCSB_INTR_EVENT); - if (fru_type == SLOT) - continue; - error = 0; - fru_ptr = mct_system_info.fru_info_list[fru_type]; - for (; fru_ptr != NULL; fru_ptr = fru_ptr->next) { - if (unit != fru_ptr->fru_unit) - continue; - if (fru_ptr->i2c_info == NULL || - (tmp_reg = fru_ptr->i2c_info-> - ledata_reg) == 0) - continue; - error = scsb_set_scfg_pres_leds(scsb, fru_ptr); - if (error) { - cmn_err(CE_WARN, "scsb_intr(): " - "I2C write error to 0x%x", - tmp_reg); - if (!(scsb->scsb_state & - SCSB_DEBUG_MODE)) { - goto intr_error; - } - } - break; - } - } - if (clr_bits) { - clr_bits = 0; - } - } - /* - * Check for SCB 1.5 interrupt for SLOT HEALTHY changes - */ - clr_bits = 0; - intr_idx = 0; - numregs = SCTRL_INTR_NUMREGS; - intr_addr = SCSB_REG_ADDR(SCTRL_INTSRC_BASE); - index = SCSB_REG_INDEX(intr_addr); - if (IS_SCB_P15) { - for (i = 0; i < SCTRL_BHLTHY_NUMREGS; - ++i, ++intr_idx, ++intr_addr) { - scsb->scsb_data_reg[index++] = scb_intr_regs[intr_idx]; - intr_reg = scb_intr_regs[i]; - while (intr_reg) { - idx = event_to_index((uint32_t)intr_reg); - code = (1 << idx); - clr_bits |= code; - intr_reg = intr_reg & ~code; - /* idx + 1 because bit 0 is for Slot 1 */ - slotnum = tonga_ssl_to_psl(scsb, idx + 1); - if (scsb->scsb_state & SCSB_IS_TONGA) { - if (slotnum > TG_MAX_SLOTS || - slotnum == SC_TG_CPU_SLOT) { - continue; - } - } else { - if (slotnum > MC_MAX_SLOTS || - slotnum == SC_MC_CPU_SLOT || - (scsb->scsb_hsc_state & - SCSB_HSC_CTC_PRES && - slotnum == SC_MC_CTC_SLOT)) { - continue; - } - } - scsb_healthy_intr(scsb, slotnum); - } - if (clr_bits) { - clr_bits = 0; - } - } - } - code = scsb_event_code; - if (retval & SCSB_INTR_EVENT && - !(scsb->scsb_state & SCSB_P06_NOINT_KLUGE)) { - check_fru_info(scsb, code); - add_event_code(scsb, code); - (void) scsb_queue_ops(scsb, QPUT_INT32, 1, &scsb_event_code, - "scsb_intr"); - } -intr_error: - scb_post_e = gethrtime(); - - if (scsb_debug & 0x8000000) - cmn_err(CE_NOTE, "Summary of times in nsec: pre_time %llu, \ - post_time %llu", scb_pre_e - scb_pre_s, - scb_post_e - scb_post_s); - - - mutex_enter(&scsb->scsb_mutex); - scsb_in_postintr = 0; - cv_broadcast(&scsb->scsb_cv); - mutex_exit(&scsb->scsb_mutex); - - /* - * Re-enable interrupt now. - */ - (void) scsb_toggle_psmint(scsb, 1); - scsb->scsb_state &= ~SCSB_IN_INTR; -} - -static int -scsb_polled_int(scsb_state_t *scsb, int cmd, uint32_t *set) -{ - if (scsb_debug & 0x4000) - cmn_err(CE_NOTE, "scsb_polled_int(scsb,0x%x)", cmd); - *set = 0; - if (cmd == SCSBIOC_SHUTDOWN_POLL) { - return (EINVAL); - } - if (cmd != SCSBIOC_INTEVENT_POLL) { - return (EINVAL); - } - if (scsb->scsb_state & SCSB_P06_NOINT_KLUGE) { - /* - * scsb_intr() may modify scsb_event_code - */ - scsb_event_code = SCTRL_EVENT_NONE; - (void) scsb_intr((caddr_t)scsb); - *set = scsb_event_code; - scsb_event_code = 0; - } else { - /* - * SCSB_P06_INTR_ON, we know there was an event - * and we're retrieving the event code from the event FIFO. - */ - *set = get_event_code(); - } - if (scsb_debug & 0x01004000) { - cmn_err(CE_NOTE, "scsb_polled_int: event_code = 0x%x", *set); - } - return (0); -} - -static int -scsb_leds_switch(scsb_state_t *scsb, scsb_ustate_t op) -{ - register int i; - int index; - uchar_t reg, idata, rwbuf[SCTRL_MAX_GROUP_NUMREGS]; - - if (scsb->scsb_state & SCSB_FROZEN && - !(scsb->scsb_state & SCSB_IN_INTR)) { - return (EAGAIN); - } - if (scsb_debug & 0x0101) { - cmn_err(CE_NOTE, "scsb_leds_switch(%s):", - op == ON ? "ON" : "OFF"); - } - /* Step 1: turn ON/OFF all NOK LEDs. */ - if (scsb_debug & 0x0100) { - cmn_err(CE_NOTE, "scsb%d: turning all NOK LEDs %s", - scsb->scsb_instance, - op == ON ? "ON" : "OFF"); - } - if (op == ON) - idata = 0xff; - else /* off */ - idata = 0x00; - reg = SCSB_REG_ADDR(SCTRL_LED_NOK_BASE); - index = SCSB_REG_INDEX(reg); - for (i = 0; i < SCTRL_LED_NOK_NUMREGS; ++i) { - rwbuf[i] = idata; - scsb->scsb_data_reg[index + i] = idata; - } - mutex_enter(&scsb->scsb_mutex); - i = scsb_rdwr_register(scsb, I2C_WR, reg, SCTRL_LED_NOK_NUMREGS, - rwbuf, 1); - mutex_exit(&scsb->scsb_mutex); - if (i) { - if (scsb_debug & 0x0102) - cmn_err(CE_WARN, "scsb_leds_switch(): " - "Failed to turn %s NOK LEDs", - op == ON ? "ON" : "OFF"); - } - /* Step 2: turn ON/OFF all OK LEDs. */ - if (scsb_debug & 0x0100) { - cmn_err(CE_NOTE, "scsb%d: turning all OK LEDs %s", - scsb->scsb_instance, - op == ON ? "ON" : "OFF"); - } - reg = SCSB_REG_ADDR(SCTRL_LED_OK_BASE); - index = SCSB_REG_INDEX(reg); - for (i = 0; i < SCTRL_LED_OK_NUMREGS; ++i) { - rwbuf[i] = idata; - scsb->scsb_data_reg[index + i] = idata; - } - mutex_enter(&scsb->scsb_mutex); - i = scsb_rdwr_register(scsb, I2C_WR, reg, SCTRL_LED_OK_NUMREGS, - rwbuf, 1); - mutex_exit(&scsb->scsb_mutex); - if (i) { - if (scsb_debug & 0x0102) - cmn_err(CE_WARN, "scsb_leds_switch(): " - "Failed to turn %s NOK LEDs", - op == ON ? "ON" : "OFF"); - } - /* Step 3: turn OFF all BLINK LEDs. */ - if (op == OFF) { - reg = SCSB_REG_ADDR(SCTRL_BLINK_OK_BASE); - index = SCSB_REG_INDEX(reg); - for (i = 0; i < SCTRL_BLINK_NUMREGS; ++i) { - rwbuf[i] = idata; - scsb->scsb_data_reg[index + i] = idata; - } - mutex_enter(&scsb->scsb_mutex); - i = scsb_rdwr_register(scsb, I2C_WR, reg, SCTRL_BLINK_NUMREGS, - rwbuf, 1); - mutex_exit(&scsb->scsb_mutex); - if (i) { - if (scsb_debug & 0x0102) - cmn_err(CE_WARN, "scsb_leds_switch(): " - "Failed to turn %s BLINK BITs", - op == ON ? "ON" : "OFF"); - } - } - return (0); -} - -static int -scsb_readall_regs(scsb_state_t *scsb) -{ - int error; - int index; - uchar_t reg; - - if (!(scsb_debug & 0x40000000)) - return (0); - if (scsb_debug & 0x0005) { - cmn_err(CE_NOTE, "scsb_readall_regs:"); - } - if (scsb->scsb_state & SCSB_FROZEN) { - return (EAGAIN); - } - reg = SCSB_REG_ADDR_START; /* 1st register in set */ - index = SCSB_REG_INDEX(reg); - error = scsb_rdwr_register(scsb, I2C_WR_RD, reg, SCSB_DATA_REGISTERS, - &scsb->scsb_data_reg[index], 1); - return (error); -} - - -/* - * read 1-byte register, mask with read bits (rmask), - * turn ON bits in on_mask, turn OFF bits in off_mask - * write the byte back to register - * NOTE: MUST be called with mutex held - */ -static int -scsb_write_mask(scsb_state_t *scsb, - uchar_t reg, - uchar_t rmask, - uchar_t on_mask, - uchar_t off_mask) -{ - i2c_transfer_t *i2cxferp; - int index, error = 0; - uchar_t reg_data; - - if (scsb_debug & 0x0800) { - cmn_err(CE_NOTE, "scsb_write_mask(,%x,,%x,%x):", - reg, on_mask, off_mask); - } - if (scsb->scsb_state & SCSB_FROZEN && - !(scsb->scsb_state & SCSB_IN_INTR)) { - return (EAGAIN); - } - /* select the register address and read the register */ - i2cxferp = (i2c_transfer_t *)scsb->scsb_i2ctp; - i2cxferp->i2c_flags = I2C_WR_RD; - i2cxferp->i2c_wlen = 1; - i2cxferp->i2c_rlen = 1; - i2cxferp->i2c_wbuf[0] = reg; - i2cxferp->i2c_rbuf[0] = 0; - scsb->scsb_kstat_flag = B_TRUE; /* we did a i2c transaction */ - if (error = nct_i2c_transfer(scsb->scsb_phandle, i2cxferp)) { - error = EIO; - goto wm_error; - } - scsb->scsb_i2c_errcnt = 0; - if (scsb_debug & 0x0800) - cmn_err(CE_NOTE, "scsb_write_mask() read 0x%x", - i2cxferp->i2c_rbuf[0]); - reg_data = i2cxferp->i2c_rbuf[0]; - if (rmask) - reg_data &= rmask; - if (off_mask) - reg_data &= ~off_mask; - if (on_mask) - reg_data |= on_mask; - i2cxferp->i2c_flags = I2C_WR; - i2cxferp->i2c_wlen = 2; - i2cxferp->i2c_wbuf[0] = reg; - i2cxferp->i2c_wbuf[1] = reg_data; - if (error = nct_i2c_transfer(scsb->scsb_phandle, i2cxferp)) { - error = EIO; - goto wm_error; - } - /* keep shadow registers updated */ - index = SCSB_REG_INDEX(reg); - scsb->scsb_data_reg[index] = reg_data; - if (scsb_debug & 0x0800) - cmn_err(CE_NOTE, "scsb_write_mask() wrote 0x%x", reg_data); - scsb->scsb_i2c_errcnt = 0; - return (error); -wm_error: - scsb->scsb_i2c_errcnt++; - if (scsb->scsb_i2c_errcnt > scsb_err_threshold) - scsb->scsb_err_flag = B_TRUE; /* latch error */ - if (scsb->scsb_state & SCSB_SSB_PRESENT) { - if (scsb_debug & 0x0802) - cmn_err(CE_WARN, - "scsb_write_mask(): reg %x %s error, data=%x", - reg, - i2cxferp->i2c_flags & I2C_WR ? "write" : "read", - i2cxferp->i2c_flags & I2C_WR ? - i2cxferp->i2c_wbuf[1] : i2cxferp->i2c_rbuf[0]); - } else { - if (scsb->scsb_i2c_errcnt >= scsb_freeze_count) - scsb_freeze(scsb); - return (EAGAIN); - } - return (error); -} - -/* - * read/write len consecutive single byte registers to/from rbuf - * NOTE: should be called with mutex held - */ -static int -scsb_rdwr_register(scsb_state_t *scsb, int op, uchar_t reg, int len, - uchar_t *rwbuf, int i2c_alloc) -{ - i2c_transfer_t *i2cxferp; - int i, rlen, wlen, index, error = 0; - - if (scsb_debug & 0x0800) { - cmn_err(CE_NOTE, "scsb_rdwr_register(scsb,%s,%x,%x,buf):", - (op == I2C_WR) ? "write" : "read", reg, len); - } - if (scsb->scsb_state & SCSB_FROZEN && - !(scsb->scsb_state & SCSB_IN_INTR)) { - return (EAGAIN); - } - if (i2c_alloc) { - i2cxferp = scsb_alloc_i2ctx(scsb->scsb_phandle, I2C_NOSLEEP); - if (i2cxferp == NULL) { - if (scsb_debug & 0x0042) - cmn_err(CE_WARN, "scsb_rdwr_register: " - "i2ctx allocation failure"); - return (ENOMEM); - } - } else { - i2cxferp = scsb->scsb_i2ctp; - } - index = SCSB_REG_INDEX(reg); - switch (op) { - case I2C_WR: - wlen = len + 1; /* add the address */ - rlen = 0; - i2cxferp->i2c_wbuf[0] = reg; - for (i = 0; i < len; ++i) { - scsb->scsb_data_reg[index + i] = - i2cxferp->i2c_wbuf[1 + i] = rwbuf[i]; - if (scsb_debug & 0x0080) - cmn_err(CE_NOTE, - "scsb_rdwr_register: writing rwbuf[%d]=0x%x", - i, rwbuf[i]); - } - break; - case I2C_WR_RD: - wlen = 1; /* for the address */ - rlen = len; - i2cxferp->i2c_wbuf[0] = reg; - break; - default: - if (i2c_alloc) - scsb_free_i2ctx(scsb->scsb_phandle, i2cxferp); - return (EINVAL); - } - /* select the register address */ - i2cxferp->i2c_flags = op; - i2cxferp->i2c_rlen = rlen; - i2cxferp->i2c_wlen = wlen; - i2cxferp->i2c_wbuf[0] = reg; - scsb->scsb_kstat_flag = B_TRUE; /* we did a i2c transaction */ - if (error = nct_i2c_transfer(scsb->scsb_phandle, i2cxferp)) { - error = EIO; - } else if (rlen) { - /* copy to rwbuf[] and keep shadow registers updated */ - for (i = 0; i < len; ++i) { - scsb->scsb_data_reg[index + i] = rwbuf[i] = - i2cxferp->i2c_rbuf[i]; - if (scsb_debug & 0x0080) - cmn_err(CE_NOTE, - "scsb_rdwr_register: read rwbuf[%d]=0x%x", - i, rwbuf[i]); - } - } - if (i2c_alloc) - scsb_free_i2ctx(scsb->scsb_phandle, i2cxferp); - if (error) { - scsb->scsb_i2c_errcnt++; - if (scsb->scsb_i2c_errcnt > scsb_err_threshold) - scsb->scsb_err_flag = B_TRUE; /* latch error */ - if (!(scsb->scsb_state & SCSB_SSB_PRESENT)) { - if (scsb->scsb_i2c_errcnt >= scsb_freeze_count) - scsb_freeze(scsb); - return (EAGAIN); - } else { - cmn_err(CE_WARN, - "scsb_rdwr_register(): I2C read error from %x", - reg); - } - } else { - scsb->scsb_i2c_errcnt = 0; - } - - return (error); -} - -/* - * Called from scsb_intr() - * First find the fru_info for this fru_id, and set fru_status for callback. - * Then check for a registered call_back entry for this fru_id, - * and if found, call it. - * Recursize call until no EVENTS left in evcode. - */ -static void -check_fru_info(scsb_state_t *scsb, int evcode) -{ - struct scsb_cb_entry *cbe_ptr; - fru_info_t *fru_ptr; - fru_id_t fru_id; - scsb_fru_status_t fru_status; - int i, new_evcode; - - if (scsb_debug & 0x00100001) - cmn_err(CE_NOTE, "check_fru_info(scsb,0x%x)", evcode); - if (evcode == 0) - return; - i = event_to_index((uint32_t)evcode); - new_evcode = evcode & ~(1 << i); - if (i > MCT_MAX_FRUS) { - if (scsb_debug & 0x00100000) - cmn_err(CE_NOTE, - "check_fru_info: index %d out of range", i); - check_fru_info(scsb, new_evcode); - return; - } - fru_id = fru_id_table[i]; - fru_ptr = find_fru_info(fru_id); - if (fru_ptr == (fru_info_t *)NULL) { - check_fru_info(scsb, new_evcode); - return; - } - update_fru_info(scsb, fru_ptr); - if (fru_ptr->fru_status & FRU_PRESENT) { - fru_status = FRU_PRESENT; - } else { - fru_status = FRU_NOT_PRESENT; - if (fru_ptr->fru_type == SSB) { - /* - * WARN against SCB removal if any - * occupied slots are in reset - */ - scsb_freeze_check(scsb); - } - } - /* - * check for an entry in the CallBack table - */ - for (cbe_ptr = scsb_cb_table; cbe_ptr != NULL; - cbe_ptr = cbe_ptr->cb_next) { - if (cbe_ptr->cb_fru_id == fru_id && - cbe_ptr->cb_fru_ptr == fru_ptr) { - if (scsb_debug & 0x00800000) - cmn_err(CE_NOTE, - "check_fru_info: callback for FRU_ID " - "0x%x; device is %spresent", - (int)fru_id, - fru_status == FRU_PRESENT ? - "" : "not "); - (*cbe_ptr->cb_func)( - cbe_ptr->cb_softstate_ptr, - cbe_ptr->cb_event, - fru_status); - break; - } - } - check_fru_info(scsb, new_evcode); -} - -/* - * ----------------------------- - * scsb kstat support functions. - * ----------------------------- - */ -/* - * Create and initialize the kstat data structures - */ -static int -scsb_alloc_kstats(scsb_state_t *scsb) -{ - kstat_named_t *kn; - /* - * scsb_ks_leddata_t for "scsb_leddata" - */ - if (scsb_debug & 0x00080001) - cmn_err(CE_NOTE, - "scsb_alloc_kstats: create scsb_leddata: %lu bytes", - sizeof (scsb_ks_leddata_t)); - if ((scsb->ks_leddata = kstat_create(scsb_name, scsb->scsb_instance, - SCSB_KS_LEDDATA, "misc", KSTAT_TYPE_RAW, - sizeof (scsb_ks_leddata_t), KSTAT_FLAG_PERSISTENT)) - == NULL) { - scsb->scsb_state |= SCSB_KSTATS; - scsb_free_kstats(scsb); - return (DDI_FAILURE); - } - scsb->ks_leddata->ks_update = update_ks_leddata; - scsb->ks_leddata->ks_private = (void *)scsb; - if (update_ks_leddata(scsb->ks_leddata, KSTAT_READ) != DDI_SUCCESS) { - scsb->scsb_state |= SCSB_KSTATS; - scsb_free_kstats(scsb); - return (DDI_FAILURE); - } - kstat_install(scsb->ks_leddata); - /* - * scsb_ks_state_t for "scsb_state" - */ - if (scsb_debug & 0x00080000) - cmn_err(CE_NOTE, - "scsb_alloc_kstats: create scsb_state: %lu bytes", - sizeof (scsb_ks_state_t)); - if ((scsb->ks_state = kstat_create(scsb_name, scsb->scsb_instance, - SCSB_KS_STATE, "misc", KSTAT_TYPE_RAW, - sizeof (scsb_ks_state_t), KSTAT_FLAG_PERSISTENT)) - == NULL) { - scsb->scsb_state |= SCSB_KSTATS; - scsb_free_kstats(scsb); - return (DDI_FAILURE); - } - scsb->ks_state->ks_update = update_ks_state; - scsb->ks_state->ks_private = (void *)scsb; - if (update_ks_state(scsb->ks_state, KSTAT_READ) != DDI_SUCCESS) { - scsb->scsb_state |= SCSB_KSTATS; - scsb_free_kstats(scsb); - return (DDI_FAILURE); - } - kstat_install(scsb->ks_state); - /* - * mct_topology_t for "env_topology" - */ - if (scsb_debug & 0x00080000) - cmn_err(CE_NOTE, - "scsb_alloc_kstats: create env_toploogy: %lu bytes", - sizeof (mct_topology_t)); - if ((scsb->ks_topology = kstat_create(scsb_name, scsb->scsb_instance, - SCSB_KS_TOPOLOGY, "misc", KSTAT_TYPE_RAW, - sizeof (mct_topology_t), KSTAT_FLAG_PERSISTENT)) - == NULL) { - scsb->scsb_state |= SCSB_KSTATS; - scsb_free_kstats(scsb); - return (DDI_FAILURE); - } - scsb->ks_topology->ks_update = update_ks_topology; - scsb->ks_topology->ks_private = (void *)scsb; - if (update_ks_topology(scsb->ks_topology, KSTAT_READ) != DDI_SUCCESS) { - scsb->scsb_state |= SCSB_KSTATS; - scsb_free_kstats(scsb); - return (DDI_FAILURE); - } - kstat_install(scsb->ks_topology); - /* - * kstat_named_t * 2 for "scsb_evc_register" - */ - if (scsb_debug & 0x00080001) - cmn_err(CE_NOTE, - "scsb_alloc_kstats: create scsb_evc_register: %lu bytes", - sizeof (kstat_named_t) * 2); - if ((scsb->ks_evcreg = kstat_create(scsb_name, scsb->scsb_instance, - SCSB_KS_EVC_REGISTER, "misc", KSTAT_TYPE_NAMED, 2, - KSTAT_FLAG_PERSISTENT|KSTAT_FLAG_WRITABLE)) == NULL) { - scsb->scsb_state |= SCSB_KSTATS; - scsb_free_kstats(scsb); - return (DDI_FAILURE); - } - scsb->ks_evcreg->ks_update = update_ks_evcreg; - scsb->ks_evcreg->ks_private = (void *)scsb; - kn = KSTAT_NAMED_PTR(scsb->ks_evcreg); - kstat_named_init(&kn[0], "pid_register", KSTAT_DATA_INT64); - kstat_named_init(&kn[1], "pid_unregister", KSTAT_DATA_INT64); - kstat_install(scsb->ks_evcreg); - /* - * Done, set the flag for scsb_detach() and other checks - */ - scsb->scsb_state |= SCSB_KSTATS; - return (DDI_SUCCESS); -} - -static int -update_ks_leddata(kstat_t *ksp, int rw) -{ - scsb_state_t *scsb; - scsb_ks_leddata_t *pks_leddata; - int i, numregs, index, error = DDI_SUCCESS; - uchar_t reg; - - scsb = (scsb_state_t *)ksp->ks_private; - if (scsb_debug & 0x00080001) - cmn_err(CE_NOTE, "update_ks_leddata: KS_UPDATE%sset", - scsb->scsb_state & SCSB_KS_UPDATE ? " " : " not "); - /* - * Since this is satisfied from the shadow registers, let it succeed - * even if the SCB is not present. It would be nice to return the - * shadow values with a warning. - * - * if (scsb->scsb_state & SCSB_FROZEN) { - * return (DDI_FAILURE); - * } - */ - if (rw == KSTAT_WRITE) { - return (EACCES); - } - mutex_enter(&scsb->scsb_mutex); - while (scsb->scsb_state & SCSB_KS_UPDATE) { - if (cv_wait_sig(&scsb->scsb_cv, &scsb->scsb_mutex) <= 0) { - mutex_exit(&scsb->scsb_mutex); - return (EINTR); - } - } - scsb->scsb_state |= SCSB_KS_UPDATE; - mutex_exit(&scsb->scsb_mutex); - if (scsb_debug & 0x00080001) - cmn_err(CE_NOTE, "update_ks_leddata: updating data"); - pks_leddata = (scsb_ks_leddata_t *)ksp->ks_data; - /* - * Call tonga_slotnum_led_shift() for each register that - * contains Slot 1-5 information, the first register at each base: - * NOK_BASE, OK_BASE, BLINK_OK_BASE - * XXX: breaking register table access rules by not using macros. - */ - /* NOK */ - reg = SCSB_REG_ADDR(SCTRL_LED_NOK_BASE); - index = SCSB_REG_INDEX(reg); - numregs = SCTRL_LED_NOK_NUMREGS; - i = 0; - if (IS_SCB_P15) - reg = tonga_slotnum_led_shift(scsb, scsb->scsb_data_reg[index]); - else - reg = scsb->scsb_data_reg[index]; - pks_leddata->scb_led_regs[i] = reg; - for (++i, ++index; i < numregs; ++i, ++index) - pks_leddata->scb_led_regs[i] = scsb->scsb_data_reg[index]; - /* OK */ - reg = SCSB_REG_ADDR(SCTRL_LED_OK_BASE); - index = SCSB_REG_INDEX(reg); - numregs += SCTRL_LED_OK_NUMREGS; - if (IS_SCB_P15) - reg = tonga_slotnum_led_shift(scsb, scsb->scsb_data_reg[index]); - else - reg = scsb->scsb_data_reg[index]; - pks_leddata->scb_led_regs[i] = reg; - for (++i, ++index; i < numregs; ++i, ++index) - pks_leddata->scb_led_regs[i] = scsb->scsb_data_reg[index]; - /* BLINK */ - reg = SCSB_REG_ADDR(SCTRL_BLINK_OK_BASE); - index = SCSB_REG_INDEX(reg); - numregs += SCTRL_BLINK_NUMREGS; - if (IS_SCB_P15) - reg = tonga_slotnum_led_shift(scsb, scsb->scsb_data_reg[index]); - else - reg = scsb->scsb_data_reg[index]; - pks_leddata->scb_led_regs[i] = reg; - for (++i, ++index; i < numregs; ++i, ++index) - pks_leddata->scb_led_regs[i] = scsb->scsb_data_reg[index]; - mutex_enter(&scsb->scsb_mutex); - scsb->scsb_state &= ~SCSB_KS_UPDATE; - cv_signal(&scsb->scsb_cv); - mutex_exit(&scsb->scsb_mutex); - if (scsb_debug & 0x00080001) - cmn_err(CE_NOTE, "update_ks_leddata: returning"); - return (error); -} - -static int -update_ks_evcreg(kstat_t *ksp, int rw) -{ - scsb_state_t *scsb; - int error = 0; - kstat_named_t *kn = KSTAT_NAMED_PTR(ksp); - pid_t pid; - - scsb = (scsb_state_t *)ksp->ks_private; - if (scsb_debug & 0x00080001) - cmn_err(CE_NOTE, "update_ks_evcreg: %s(%d), KS_UPDATE%sset", - rw == KSTAT_READ ? "read" : "write", rw, - scsb->scsb_state & SCSB_KS_UPDATE ? " " : " not "); - /* - * Let this registration succeed - * - * if (scsb->scsb_state & SCSB_FROZEN) { - * return (DDI_FAILURE); - * } - */ - mutex_enter(&scsb->scsb_mutex); - while (scsb->scsb_state & SCSB_KS_UPDATE) { - if (cv_wait_sig(&scsb->scsb_cv, &scsb->scsb_mutex) <= 0) { - mutex_exit(&scsb->scsb_mutex); - return (EINTR); - } - } - scsb->scsb_state |= SCSB_KS_UPDATE; - mutex_exit(&scsb->scsb_mutex); - if (rw == KSTAT_READ) { - kn[0].value.i64 = (int64_t)0; - kn[1].value.i64 = (int64_t)0; - } else if (rw == KSTAT_WRITE) { - /* - * kn[0] is "pid_register", kn[1] is "pid_unregister" - */ - if (kn[0].value.i64 != 0 && kn[1].value.i64 == 0) { - pid = (pid_t)kn[0].value.i64; - if (add_event_proc(scsb, pid)) { - if (scsb_debug & 0x02000002) { - cmn_err(CE_WARN, - "update_ks_evcreg: " - "process add failed for %d", - pid); - } - error = EOVERFLOW; - } - } else if (kn[0].value.i64 == 0 && kn[1].value.i64 != 0) { - pid = (pid_t)kn[1].value.i64; - if (del_event_proc(scsb, pid)) { - if (scsb_debug & 0x02000000) { - cmn_err(CE_NOTE, - "update_ks_evcreg: " - "process delete failed for %d", - pid); - } - error = EOVERFLOW; - } - } else if (kn[0].value.i64 == 0 && kn[1].value.i64 == 0) { - /* - * rewind the pointers and counts, zero the table. - */ - rew_event_proc(scsb); - } else { - error = EINVAL; - } - } else { - error = EINVAL; - } - mutex_enter(&scsb->scsb_mutex); - scsb->scsb_state &= ~SCSB_KS_UPDATE; - cv_signal(&scsb->scsb_cv); - mutex_exit(&scsb->scsb_mutex); - return (error); -} - -static int -update_ks_state(kstat_t *ksp, int rw) -{ - scsb_state_t *scsb; - scsb_ks_state_t *pks_state; - int error = DDI_SUCCESS; - uint32_t current_evc; - - scsb = (scsb_state_t *)ksp->ks_private; - if (scsb_debug & 0x00080001) - cmn_err(CE_NOTE, "update_ks_state: KS_UPDATE%sset", - scsb->scsb_state & SCSB_KS_UPDATE ? " " : " not "); - /* - * Let this succeed based on last known data - * - * if (scsb->scsb_state & SCSB_FROZEN) { - * return (DDI_FAILURE); - * } - */ - if (rw == KSTAT_WRITE) { - return (EACCES); - } - mutex_enter(&scsb->scsb_mutex); - while (scsb->scsb_state & SCSB_KS_UPDATE) { - if (cv_wait_sig(&scsb->scsb_cv, &scsb->scsb_mutex) <= 0) { - mutex_exit(&scsb->scsb_mutex); - return (EINTR); - } - } - scsb->scsb_state |= SCSB_KS_UPDATE; - /* - * If SSB not present and scsb not SCSB_FROZEN, check for SCB presence - * by initiating an I2C read from the SCB. If an error occurs, - * scsb_freeze() will be called to update SCB info and scsb state. - */ - if (!(scsb->scsb_state & SCSB_SSB_PRESENT) && - !(scsb->scsb_state & SCSB_FROZEN)) { - uchar_t data; - /* Read the SCB PROM ID */ - if (data = scsb_rdwr_register(scsb, I2C_WR_RD, - (uchar_t)SCTRL_PROM_VERSION, 1, &data, 1)) - if (scsb_debug & 0x00080002) - cmn_err(CE_NOTE, "update_ks_state: SCB/I2C " - "failure %d", data); - } - mutex_exit(&scsb->scsb_mutex); - pks_state = (scsb_ks_state_t *)ksp->ks_data; - pks_state->scb_present = (scsb->scsb_state & SCSB_SCB_PRESENT) ? 1 : 0; - pks_state->ssb_present = (scsb->scsb_state & SCSB_SSB_PRESENT) ? 1 : 0; - pks_state->scsb_frozen = (scsb->scsb_state & SCSB_FROZEN) ? 1 : 0; - if (scsb->scsb_state & SCSB_DEBUG_MODE) - pks_state->scsb_mode = (uint8_t)ENVC_DEBUG_MODE; - else if (scsb->scsb_state & SCSB_DIAGS_MODE) - pks_state->scsb_mode = (uint8_t)ENVCTRL_DIAG_MODE; - else - pks_state->scsb_mode = (uint8_t)ENVCTRL_NORMAL_MODE; - /* - * If scsb_attach() has not completed the kstat installs, - * then there are no event processes to check for. - */ - if (scsb->scsb_state & SCSB_KSTATS) { - switch (check_event_procs(¤t_evc)) { - case EVC_NO_EVENT_CODE: - pks_state->event_code = 0; - break; - case EVC_NEW_EVENT_CODE: - /* FALLTHROUGH */ - case EVC_NO_CURR_PROC: - pks_state->event_code = current_evc; - break; - case EVC_OR_EVENT_CODE: - pks_state->event_code |= current_evc; - break; - case EVC_FAILURE: - pks_state->event_code = 0; - error = DDI_FAILURE; - break; - } - } else { - pks_state->event_code = 0; - } - mutex_enter(&scsb->scsb_mutex); - scsb->scsb_state &= ~SCSB_KS_UPDATE; - cv_signal(&scsb->scsb_cv); - mutex_exit(&scsb->scsb_mutex); - return (error); -} - -static int -update_ks_topology(kstat_t *ksp, int rw) -{ - scsb_state_t *scsb; - mct_topology_t *pks_topo; - fru_info_t *fru_ptr; - int i, val, error = DDI_SUCCESS, slotnum; - - scsb = (scsb_state_t *)ksp->ks_private; - if (scsb_debug & 0x00080001) - cmn_err(CE_NOTE, "update_ks_topology: KS_UPDATE%sset", - scsb->scsb_state & SCSB_KS_UPDATE ? " " : " not "); - /* - * Let this succeed based on last known data - * - * if (scsb->scsb_state & SCSB_FROZEN) { - * return (DDI_FAILURE); - * } - */ - if (rw == KSTAT_WRITE) { - return (EACCES); - } - mutex_enter(&scsb->scsb_mutex); - while (scsb->scsb_state & SCSB_KS_UPDATE) { - if (cv_wait_sig(&scsb->scsb_cv, &scsb->scsb_mutex) <= 0) { - mutex_exit(&scsb->scsb_mutex); - return (EINTR); - } - } - scsb->scsb_state |= SCSB_KS_UPDATE; - /* - * If SSB not present and scsb not SCSB_FROZEN, check for SCB presence - * by initiating an I2C read from the SCB. If an error occurs, - * scsb_freeze() will be called to update SCB info and scsb state. - */ - if (!(scsb->scsb_state & SCSB_SSB_PRESENT) && - !(scsb->scsb_state & SCSB_FROZEN)) { - uchar_t data; - /* Read the SCB PROM ID */ - if (data = scsb_rdwr_register(scsb, I2C_WR_RD, - (uchar_t)SCTRL_PROM_VERSION, 1, &data, 1)) - if (scsb_debug & 0x00080002) - cmn_err(CE_NOTE, "update_ks_topology: SCB/I2C " - "failure %d", data); - } - mutex_exit(&scsb->scsb_mutex); - pks_topo = (mct_topology_t *)ksp->ks_data; - for (i = SLOT; i < SCSB_UNIT_TYPES; ++i) { - pks_topo->max_units[i] = mct_system_info.max_units[i]; - } - - pks_topo->mid_plane.fru_status = FRU_PRESENT; - pks_topo->mid_plane.fru_unit = (scsb_unum_t)1; - pks_topo->mid_plane.fru_type = mct_system_info.mid_plane.fru_type; - pks_topo->mid_plane.fru_id = mct_system_info.mid_plane.fru_id; - pks_topo->mid_plane.fru_version = mct_system_info.mid_plane.fru_version; - pks_topo->mid_plane.fru_health = MCT_HEALTH_OK; - fru_ptr = mct_system_info.fru_info_list[SLOT]; - for (i = 0; i < pks_topo->max_units[SLOT]; ++i, ++fru_ptr) { - pks_topo->mct_slots[i].fru_status = fru_ptr->fru_status; - pks_topo->mct_slots[i].fru_type = fru_ptr->fru_type; - pks_topo->mct_slots[i].fru_unit = fru_ptr->fru_unit; - pks_topo->mct_slots[i].fru_id = fru_ptr->fru_id; - pks_topo->mct_slots[i].fru_version = fru_ptr->fru_version; - /* - * XXX: need to check healthy regs to set fru_health - */ - slotnum = tonga_psl_to_ssl(scsb, i+1); - val = scsb_fru_op(scsb, SLOT, slotnum, SCTRL_BHLTHY_BASE, - SCSB_FRU_OP_GET_BITVAL); - pks_topo->mct_slots[i].fru_health = (val) ? - MCT_HEALTH_OK : MCT_HEALTH_NOK; - } - fru_ptr = mct_system_info.fru_info_list[PDU]; - for (i = 0; i < pks_topo->max_units[PDU]; ++i, ++fru_ptr) { - pks_topo->mct_pdu[i].fru_status = fru_ptr->fru_status; - pks_topo->mct_pdu[i].fru_type = fru_ptr->fru_type; - pks_topo->mct_pdu[i].fru_unit = fru_ptr->fru_unit; - pks_topo->mct_pdu[i].fru_id = fru_ptr->fru_id; - pks_topo->mct_pdu[i].fru_version = fru_ptr->fru_version; - pks_topo->mct_pdu[i].fru_health = MCT_HEALTH_NA; - } - fru_ptr = mct_system_info.fru_info_list[PS]; - for (i = 0; i < pks_topo->max_units[PS]; ++i, ++fru_ptr) { - pks_topo->mct_ps[i].fru_status = fru_ptr->fru_status; - pks_topo->mct_ps[i].fru_type = fru_ptr->fru_type; - pks_topo->mct_ps[i].fru_unit = fru_ptr->fru_unit; - pks_topo->mct_ps[i].fru_id = fru_ptr->fru_id; - pks_topo->mct_ps[i].fru_version = fru_ptr->fru_version; - pks_topo->mct_ps[i].fru_health = MCT_HEALTH_NA; - } - fru_ptr = mct_system_info.fru_info_list[DISK]; - for (i = 0; i < pks_topo->max_units[DISK]; ++i, ++fru_ptr) { - pks_topo->mct_disk[i].fru_status = fru_ptr->fru_status; - pks_topo->mct_disk[i].fru_type = fru_ptr->fru_type; - pks_topo->mct_disk[i].fru_unit = fru_ptr->fru_unit; - pks_topo->mct_disk[i].fru_id = fru_ptr->fru_id; - pks_topo->mct_disk[i].fru_version = fru_ptr->fru_version; - pks_topo->mct_disk[i].fru_health = MCT_HEALTH_NA; - } - fru_ptr = mct_system_info.fru_info_list[FAN]; - for (i = 0; i < pks_topo->max_units[FAN]; ++i, ++fru_ptr) { - pks_topo->mct_fan[i].fru_status = fru_ptr->fru_status; - pks_topo->mct_fan[i].fru_type = fru_ptr->fru_type; - pks_topo->mct_fan[i].fru_unit = fru_ptr->fru_unit; - pks_topo->mct_fan[i].fru_id = fru_ptr->fru_id; - pks_topo->mct_fan[i].fru_version = fru_ptr->fru_version; - pks_topo->mct_fan[i].fru_health = MCT_HEALTH_NA; - } - fru_ptr = mct_system_info.fru_info_list[SCB]; - for (i = 0; i < pks_topo->max_units[SCB]; ++i, ++fru_ptr) { - pks_topo->mct_scb[i].fru_status = fru_ptr->fru_status; - pks_topo->mct_scb[i].fru_type = fru_ptr->fru_type; - pks_topo->mct_scb[i].fru_unit = fru_ptr->fru_unit; - pks_topo->mct_scb[i].fru_id = fru_ptr->fru_id; - pks_topo->mct_scb[i].fru_version = fru_ptr->fru_version; - /* - * To get the scsb health, if there was no i2c transaction - * until this read, generate an i2c transaction. - */ - if (scsb->scsb_kstat_flag == B_FALSE) { - uchar_t data; - (void) scsb_blind_read(scsb, I2C_WR_RD, - (uchar_t)SCTRL_PROM_VERSION, 1, &data, 1); - } - pks_topo->mct_scb[i].fru_health = ((scsb->scsb_err_flag == - B_TRUE || scsb->scsb_i2c_errcnt > scsb_err_threshold) - ? MCT_HEALTH_NOK : MCT_HEALTH_OK); -#ifdef DEBUG - if (pks_topo->mct_scb[i].fru_health == MCT_HEALTH_NOK) - cmn_err(CE_WARN, "SCSB kstat health:%d", pks_topo-> - mct_scb[i].fru_health); -#endif - scsb->scsb_err_flag = B_FALSE; /* clear error flag once read */ - scsb->scsb_kstat_flag = B_FALSE; /* false? read from i2c */ - } - fru_ptr = mct_system_info.fru_info_list[SSB]; - for (i = 0; i < pks_topo->max_units[SSB]; ++i, ++fru_ptr) { - pks_topo->mct_ssb[i].fru_status = fru_ptr->fru_status; - pks_topo->mct_ssb[i].fru_type = fru_ptr->fru_type; - pks_topo->mct_ssb[i].fru_unit = fru_ptr->fru_unit; - pks_topo->mct_ssb[i].fru_id = fru_ptr->fru_id; - pks_topo->mct_ssb[i].fru_version = fru_ptr->fru_version; - pks_topo->mct_ssb[i].fru_health = MCT_HEALTH_NA; - } - fru_ptr = mct_system_info.fru_info_list[ALARM]; - for (i = 0; i < pks_topo->max_units[ALARM]; ++i, ++fru_ptr) { - pks_topo->mct_alarm[i].fru_status = fru_ptr->fru_status; - pks_topo->mct_alarm[i].fru_type = fru_ptr->fru_type; - pks_topo->mct_alarm[i].fru_unit = fru_ptr->fru_unit; - pks_topo->mct_alarm[i].fru_id = fru_ptr->fru_id; - pks_topo->mct_alarm[i].fru_version = fru_ptr->fru_version; - pks_topo->mct_alarm[i].fru_health = MCT_HEALTH_NA; - } - fru_ptr = mct_system_info.fru_info_list[CFTM]; - for (i = 0; i < pks_topo->max_units[CFTM]; ++i, ++fru_ptr) { - pks_topo->mct_cftm[i].fru_status = fru_ptr->fru_status; - pks_topo->mct_cftm[i].fru_type = fru_ptr->fru_type; - pks_topo->mct_cftm[i].fru_unit = fru_ptr->fru_unit; - pks_topo->mct_cftm[i].fru_id = fru_ptr->fru_id; - pks_topo->mct_cftm[i].fru_version = fru_ptr->fru_version; - pks_topo->mct_cftm[i].fru_health = MCT_HEALTH_NA; - } - fru_ptr = mct_system_info.fru_info_list[CRTM]; - for (i = 0; i < pks_topo->max_units[CRTM]; ++i, ++fru_ptr) { - pks_topo->mct_crtm[i].fru_status = fru_ptr->fru_status; - pks_topo->mct_crtm[i].fru_type = fru_ptr->fru_type; - pks_topo->mct_crtm[i].fru_unit = fru_ptr->fru_unit; - pks_topo->mct_crtm[i].fru_id = fru_ptr->fru_id; - pks_topo->mct_crtm[i].fru_version = fru_ptr->fru_version; - pks_topo->mct_crtm[i].fru_health = MCT_HEALTH_NA; - } - fru_ptr = mct_system_info.fru_info_list[PRTM]; - for (i = 0; i < pks_topo->max_units[PRTM]; ++i, ++fru_ptr) { - pks_topo->mct_prtm[i].fru_status = fru_ptr->fru_status; - pks_topo->mct_prtm[i].fru_type = fru_ptr->fru_type; - pks_topo->mct_prtm[i].fru_unit = fru_ptr->fru_unit; - pks_topo->mct_prtm[i].fru_id = fru_ptr->fru_id; - pks_topo->mct_prtm[i].fru_version = fru_ptr->fru_version; - pks_topo->mct_prtm[i].fru_health = MCT_HEALTH_NA; - } - mutex_enter(&scsb->scsb_mutex); - scsb->scsb_state &= ~SCSB_KS_UPDATE; - cv_signal(&scsb->scsb_cv); - mutex_exit(&scsb->scsb_mutex); - return (error); -} - -static void -scsb_free_kstats(scsb_state_t *scsb) -{ - if (!(scsb->scsb_state & SCSB_KSTATS)) - return; - /* - * free the allocated kstat data - */ - if (scsb->ks_evcreg != NULL) { - kstat_delete(scsb->ks_evcreg); - } - if (scsb->ks_topology != NULL) { - kstat_delete(scsb->ks_topology); - } - if (scsb->ks_state != NULL) { - kstat_delete(scsb->ks_state); - } - if (scsb->ks_leddata != NULL) { - kstat_delete(scsb->ks_leddata); - } - scsb->ks_leddata = NULL; - scsb->ks_state = NULL; - scsb->ks_topology = NULL; - scsb->ks_evcreg = NULL; - scsb->scsb_state &= ~SCSB_KSTATS; -} - - -/* - * -------------------------------------- - * Miscellaneous scsb internal functions. - * -------------------------------------- - * - * allocate I2C transfer structure - */ -static i2c_transfer_t * -scsb_alloc_i2ctx(i2c_client_hdl_t phandle, uint_t sleep) -{ - i2c_transfer_t *tp; - - if (i2c_transfer_alloc(phandle, &tp, SCSB_DATA_REGISTERS + 2, - SCSB_DATA_REGISTERS + 2, sleep) == I2C_FAILURE) { - return (NULL); - } - return (tp); -} - -/* - * free I2C transfer structure - */ -static void -scsb_free_i2ctx(i2c_client_hdl_t phandle, i2c_transfer_t *tp) -{ - i2c_transfer_free(phandle, tp); -} - -static void -update_fru_info(scsb_state_t *scsb, fru_info_t *fru_ptr) -{ - int index; - uchar_t reg, bit; - fru_info_t *acslot_ptr = NULL; - fru_id_t acslot_id = 0; - if (scsb_debug & 0x00100001) - cmn_err(CE_NOTE, "update_fru_info(scsb,0x%p)", (void *)fru_ptr); - if (fru_ptr == (fru_info_t *)NULL || - fru_ptr->i2c_info == (fru_i2c_info_t *)NULL) - return; - /* - * If this is an Alarm Card update, then we also need to get - * Alarm Card Slot fru_ptr to update it's fru_type, and maybe fru_id - */ - if (fru_ptr->fru_id == fru_id_table[FRU_INDEX(SCTRL_EVENT_ALARM)]) { - /* - * SCTRL_EVENT_SLOT1 == 0x01 so - * fru_id_table[] index for Slot 1 == 0 - */ - acslot_id = fru_id_table[(scsb->ac_slotnum - 1)]; - acslot_ptr = find_fru_info(acslot_id); - } - reg = fru_ptr->i2c_info->syscfg_reg; - bit = fru_ptr->i2c_info->syscfg_bit; - if (reg == 0 && fru_ptr->fru_type == SCB) { - if (scsb->scsb_state & SCSB_SCB_PRESENT) - fru_ptr->fru_status = FRU_PRESENT; - else - fru_ptr->fru_status = FRU_NOT_PRESENT; - } else if (reg) { - index = SCSB_REG_INDEX(reg); - if (scsb->scsb_data_reg[index] & (1 << bit)) { - fru_ptr->fru_status = FRU_PRESENT; - /* - * XXX: need to add version register, and maybe a - * method, to the fru_ptr->i2c_info structure. - * - * fru_ptr->fru_version = (fru_version_t)0; - */ - /* - * Because scsb_intr() sometimes gets the AC present - * INT before the ACSLOT present INT, - * do not check the ACSLOT fru_status - * - * if (acslot_ptr != NULL && acslot_ptr->fru_status == - * FRU_PRESENT) - */ - if (acslot_ptr != NULL) - acslot_ptr->fru_type = (scsb_utype_t)OC_AC; - } else { - fru_ptr->fru_status = FRU_NOT_PRESENT; - /* - * fru_ptr->fru_version = (fru_version_t)0; - */ - if (acslot_ptr != NULL) { - /* AC just removed, but AC Slot is occupied? */ - if (acslot_ptr->fru_status == FRU_PRESENT) - /* for now it's unknown */ - acslot_ptr->fru_type = - (scsb_utype_t)OC_UNKN; - else - acslot_ptr->fru_type = - (scsb_utype_t)OC_UNKN; - } - } - } - if (scsb_debug & 0x00100000) - cmn_err(CE_NOTE, - "update_fru_info: type %d unit %d is %spresent", - fru_ptr->fru_type, fru_ptr->fru_unit, - fru_ptr->fru_status == FRU_PRESENT - ? "" : "not "); -} - -/* - * Convert EVENT code to FRU index - * by finding the highest bit number in 32 bit word - */ -static int -event_to_index(uint32_t evcode) -{ - int i = 0; - if (evcode == 0) - return (MCT_MAX_FRUS - 1); - for (; (evcode >>= 1); i++) - ; - return (i); -} - -#ifdef DEBUG -void -scsb_debug_prnt(char *fmt, uintptr_t a1, uintptr_t a2, uintptr_t a3, - uintptr_t a4, uintptr_t a5) -{ - if (scsb_debug & 0x8000 || - (*fmt == 'X' && scsb_debug & 0x00010000)) { - if (*fmt == 'X') - ++fmt; - prom_printf("scsb: "); - prom_printf(fmt, a1, a2, a3, a4, a5); - prom_printf("\n"); - } -} -#endif - -/* - * event code functions to deliver event codes - * and to manage: - * the event code fifo - * the process handle table for registered processes interested in - * event codes - */ -/* - * Send signal to processes registered for event code delivery - */ -static void -signal_evc_procs(scsb_state_t *scsb) -{ - int i = 0, c = 0; - if (evc_proc_count == 0) - return; - for (; i < EVC_PROCS_MAX; ++i) { - if (evc_procs[i] != NULL) { - if (proc_signal(evc_procs[i], SIGPOLL)) { - if (scsb_debug & 0x02000002) - cmn_err(CE_WARN, - "scsb:signal_evc_procs: " - "signal to %d failed", - ((struct pid *) - evc_procs[i])->pid_id); - (void) del_event_proc(scsb, - ((struct pid *)evc_procs[i])->pid_id); - } - if (++c >= evc_proc_count) { - if (scsb_debug & 0x02000000) { - cmn_err(CE_NOTE, - "signal_evc_procs: signaled " - "%d/%d processes", c, - evc_proc_count); - } - break; - } - } - } -} - -/* - * bump FIFO ptr, taking care of wrap around - */ -static uint32_t * -inc_fifo_ptr(uint32_t *ptr) -{ - if (++ptr >= evc_fifo + EVC_FIFO_SIZE) - ptr = evc_fifo; - return (ptr); -} - -/* ARGSUSED */ -static void -reset_evc_fifo(scsb_state_t *scsb) -{ - evc_wptr = evc_fifo; - evc_rptr = evc_fifo; - evc_fifo_count = 0; -} - -/* - * Called from scsb_intr() when a new event occurs, to put new code in FIFO, - * and signal any interested processes in evc_procs[]. - * Always succeeds. - */ -static void -add_event_code(scsb_state_t *scsb, uint32_t event_code) -{ - if (event_proc_count(scsb) == 0) { - return; - } - *evc_wptr = event_code; - evc_wptr = inc_fifo_ptr(evc_wptr); - if (++evc_fifo_count > EVC_FIFO_SIZE) { - --evc_fifo_count; /* lose the oldest event */ - evc_rptr = inc_fifo_ptr(evc_rptr); - } - if (scsb_debug & 0x01000000) { - cmn_err(CE_NOTE, "add_event_code: 0x%x, FIFO size = %d", - event_code, evc_fifo_count); - } - signal_evc_procs(scsb); -} - -/* - * called from check_event_procs() when the last registered process - * retrieved the oldest event - */ -static uint32_t -del_event_code() -{ - uint32_t evc = 0; - if (!evc_fifo_count) - return (scsb_event_code); - evc = *evc_rptr; - evc_rptr = inc_fifo_ptr(evc_rptr); - --evc_fifo_count; - if (scsb_debug & 0x01000000) { - cmn_err(CE_NOTE, "del_event_code: 0x%x, FIFO size = %d", - evc, evc_fifo_count); - } - return (evc); -} - -/* - * called from check_event_procs() to retrieve the current event code - */ -static uint32_t -get_event_code() -{ - if (!evc_fifo_count) - return (0); - return (*evc_rptr); -} - -/* - * called from an application interface (ie: an ioctl command) - * to register a process id interested in SCB events. - * NOTE: proc_ref() must be called from USER context, so since this is a - * streams driver, a kstat interface is used for process registration. - * return: - * 0 = event_proc was added - * 1 = out of space - */ -/* ARGSUSED */ -static int -add_event_proc(scsb_state_t *scsb, pid_t pid) -{ - int i = 0; - void *curr_proc; - pid_t curr_pid; - if (evc_proc_count >= EVC_PROCS_MAX) - return (1); - curr_proc = proc_ref(); - curr_pid = (pid_t)(((struct pid *)curr_proc)->pid_id); - if (curr_pid != pid) { - if (scsb_debug & 0x02000000) { - cmn_err(CE_WARN, - "add_event_proc: current %d != requestor %d", - curr_pid, pid); - } else { - proc_unref(curr_proc); - return (1); - } - } - for (; i < EVC_PROCS_MAX; ++i) { - if (evc_procs[i] == NULL) { - evc_procs[i] = curr_proc; - evc_proc_count++; - if (scsb_debug & 0x02000000) { - cmn_err(CE_NOTE, - "add_event_proc: %d; evc_proc_count=%d", - pid, evc_proc_count); - } - return (0); - } - } - proc_unref(curr_proc); - return (1); -} - -/* - * called from an application interface (ie: an ioctl command) - * to unregister a process id interested in SCB events. - * return: - * 0 = event_proc was deleted - * 1 = event_proc was not found, or table was empty - */ -/* ARGSUSED */ -static int -del_event_proc(scsb_state_t *scsb, pid_t pid) -{ - int i = 0; - int cnt = 0; - void *this_proc; - if (evc_proc_count == 0) - return (1); - for (; i < EVC_PROCS_MAX; ++i) { - if (evc_procs[i] == NULL) - continue; - this_proc = evc_procs[i]; - if (pid == ((struct pid *)this_proc)->pid_id) { - evc_procs[i] = NULL; - if (--evc_proc_count == 0) { - /* - * reset evc fifo cound and pointers - */ - reset_evc_fifo(scsb); - } - if (scsb_debug & 0x02000000) { - cmn_err(CE_NOTE, - "del_event_proc: %d; evc_proc_count=%d", - pid, evc_proc_count); - } - proc_unref(this_proc); - return (0); - } - if (++cnt >= evc_proc_count) - break; - } - return (1); -} - -/* - * Can be called from an application interface - * to rewind the pointers and counters, and zero the table - * return: - */ -/* ARGSUSED */ -static void -rew_event_proc(scsb_state_t *scsb) -{ - int i = 0; - if (scsb_debug & 0x02000001) { - cmn_err(CE_NOTE, "rew_event_proc: evc_proc_count=%d", - evc_proc_count); - } - for (; i < EVC_PROCS_MAX; ++i) { - if (evc_procs[i] != NULL) { - proc_unref(evc_procs[i]); - evc_procs[i] = NULL; - } - } - evc_proc_count = 0; -} - -/* ARGSUSED */ -static int -event_proc_count(scsb_state_t *scsb) -{ - return (evc_proc_count); -} - -/* - * return: - * 1 = pid was found - * 0 = pid was not found, or table was empty - */ -static int -find_evc_proc(pid_t pid) -{ - int i = 0; - int cnt = 0; - if (evc_proc_count == 0) - return (0); - for (; i < EVC_PROCS_MAX; ++i) { - if (evc_procs[i] == NULL) - continue; - if (pid == ((struct pid *)evc_procs[i])->pid_id) - return (1); - if (++cnt >= evc_proc_count) - break; - } - return (0); -} - -/* - * called from update_ks_state() to compare evc_proc_count with - * evc_requests, also mainted by this same function - * This function could check the current process id, since this will be a user - * context call, and only bump evc_requests if the calling process is - * registered for event code delivery. - * return: - * EVC_NO_EVENT_CODE : no event_code on fifo - * EVC_NO_CURR_PROC : current process not in table, - * but have an event_code - * EVC_NEW_EVENT_CODE : return_evc is new ks_state->event_code - * EVC_OR_EVENT_CODE : OR return_evc with ks_state->event_code - * EVC_FAILURE : unrecoverable error condition. - */ -static int -check_event_procs(uint32_t *return_evc) -{ - void *curr_proc; - pid_t curr_pid = 0; - int return_val = 0; - static int evc_requests = 0; - /* - * get current process handle, and check the event_procs table - */ - if (evc_proc_count == 0) { - *return_evc = del_event_code(); - return_val = EVC_NO_CURR_PROC; - } else { - curr_proc = proc_ref(); - curr_pid = ((struct pid *)curr_proc)->pid_id; - proc_unref(curr_proc); - if (!find_evc_proc(curr_pid)) { - *return_evc = get_event_code(); - return_val = EVC_NO_CURR_PROC; - } else if (++evc_requests >= evc_proc_count) { - evc_requests = 0; - *return_evc = del_event_code(); - return_val = EVC_NEW_EVENT_CODE; - } else { - *return_evc = get_event_code(); - } - if (!return_val) - return_val = EVC_OR_EVENT_CODE; - } - if (scsb_debug & 0x02000000) { - cmn_err(CE_NOTE, "check_event_procs: pid=%d, evc=0x%x, " - "requests=%d, returning 0x%x", curr_pid, - *return_evc, evc_requests, return_val); - } - return (return_val); -} - -static int -scsb_queue_put(queue_t *rq, int count, uint32_t *data, char *caller) -{ - mblk_t *mp; - if (scsb_debug & 0x4001) { - cmn_err(CE_NOTE, "scsb_queue_put(0x%p, %d, 0x%x, %s)", - (void *)rq, count, *data, caller); - } - mp = allocb(sizeof (uint32_t) * count, BPRI_HI); - if (mp == NULL) { - cmn_err(CE_WARN, "%s: allocb failed", - caller); - return (B_FALSE); - } - while (count--) { - *((uint32_t *)mp->b_wptr) = *data; - mp->b_wptr += sizeof (*data); - ++data; - } - putnext(rq, mp); - return (B_TRUE); -} - -/* CLONE */ -static int -scsb_queue_ops(scsb_state_t *scsb, - int op, - int oparg, - void *opdata, - char *caller) -{ - clone_dev_t *clptr; - int clone, find_open, find_available, retval = QOP_FAILED; - - switch (op) { - case QPUT_INT32: - if (scsb->scsb_opens && scsb->scsb_rq != NULL && - scsb_queue_put(scsb->scsb_rq, oparg, - (uint32_t *)opdata, caller) == B_FALSE) { - return (QOP_FAILED); - } - /*FALLTHROUGH*/ /* to look for opened clones */ - case QPROCSOFF: - retval = QOP_OK; - /*FALLTHROUGH*/ - case QFIRST_OPEN: - case QFIND_QUEUE: - find_open = 1; - find_available = 0; - break; - case QFIRST_AVAILABLE: - find_available = 1; - find_open = 0; - break; - } - for (clone = SCSB_CLONES_FIRST; clone < SCSB_CLONES_MAX; clone++) { - clptr = &scsb->clone_devs[clone]; - if (find_open && clptr->cl_flags & SCSB_OPEN) { - if (clptr->cl_rq == NULL) { - cmn_err(CE_WARN, "%s: Clone %d has no queue", - caller, clptr->cl_minor); - return (QOP_FAILED); - } - switch (op) { - case QPROCSOFF: - qprocsoff(clptr->cl_rq); - break; - case QPUT_INT32: - if (scsb_queue_put(clptr->cl_rq, oparg, - (uint32_t *)opdata, caller) - == B_FALSE) { - retval = QOP_FAILED; - } - break; - case QFIRST_OPEN: - return (clone); - case QFIND_QUEUE: - if (clptr->cl_rq == (queue_t *)opdata) { - return (clone); - } - break; - } - } else if (find_available && clptr->cl_flags == 0) { - switch (op) { - case QFIRST_AVAILABLE: - return (clone); - } - } - } - return (retval); -} - -/* - * Find out if a bit is set for the FRU type and unit number in the register - * set defined by the register base table index, base. - * Returns TRUE if bit is set, or FALSE. - */ -static int -scsb_fru_op(scsb_state_t *scsb, scsb_utype_t fru_type, int unit, int base, - int op) -{ - int rc; - uchar_t reg; - int tmp, idx, code, offset; - -#if 0 - reg = SCSB_REG_ADDR(i); - ac_mask = 1 << FRU_OFFSET(SCTRL_EVENT_ALARM, SCTRL_RESET_BASE); - ac_val = scsb->scsb_data_reg[index+1] & ac_mask; -#endif - /* get the event code based on which we get the reg and bit offsets */ - code = FRU_UNIT_TO_EVCODE(fru_type, unit); - /* get the bit offset in the 8bit register corresponding to the event */ - offset = FRU_OFFSET(code, base); - /* register offset from the base register, based on the event code */ - if ((fru_type == ALARM) && (base == SCTRL_RESET_BASE)) - tmp = ALARM_RESET_REG_INDEX(code, base); - else - tmp = FRU_REG_INDEX(code, base); - /* get the global offset of the register in the parent address space */ - reg = SCSB_REG_ADDR(tmp); - /* get the global index of the register in this SCSB's address space */ - idx = SCSB_REG_INDEX(reg); - DEBUG4("scsb_fru_op(start): code=%x, offset=%x, tmp=%x, reg=%x\n", - code, offset, tmp, reg); - switch (op) { - case SCSB_FRU_OP_GET_REG: - rc = reg; - break; - case SCSB_FRU_OP_GET_BITVAL: - rc = (scsb->scsb_data_reg[idx] & (1 << offset)) - >> offset; - break; - case SCSB_FRU_OP_GET_REGDATA: - rc = scsb->scsb_data_reg[idx]; - break; - case SCSB_FRU_OP_SET_REGBIT: - rc = (1 << offset) & 0xff; - break; - default: - break; - } - DEBUG4("scsb_fru_op: unit=%x, base=%x, op=%d, rc=%x\n", unit, base, - op, rc); - return (rc); -} - -/* - * All HSC related functions can fail, but an attempt is made to atleast - * return the right shadow state on get-state function when SCB is removed. - */ -int -scsb_get_slot_state(scsb_state_t *scsb, int pslotnum, int *rstate) -{ - int slotnum, val = 0, rc; - - /* - * When SCB is removed, we could be called with the lock held. - * We call check_config_status anyway since it is a read-only operation - * and HSC could be invoking this function at interrupt context. - * If scsb is already in the doing interrupt postprocess, wait.. - */ - - rc = scsb_check_config_status(scsb); - - /* check if error is because SCB is removed */ - if ((rc != EAGAIN) && (rc != DDI_SUCCESS)) - return (DDI_FAILURE); - slotnum = tonga_psl_to_ssl(scsb, pslotnum); - val = scsb_fru_op(scsb, SLOT, slotnum, SCTRL_SYSCFG_BASE, - SCSB_FRU_OP_GET_BITVAL); - if (! val) { - *rstate = HPC_SLOT_EMPTY; - return (0); - } - /* - * now, lets determine if it is connected or disconnected. - * If reset is asserted, then the slot is disconnected. - */ - rc = scsb_reset_slot(scsb, pslotnum, SCSB_GET_SLOT_RESET_STATUS); - /* check if error is because SCB is removed */ - if ((rc != EAGAIN) && (rc != DDI_SUCCESS)) - return (DDI_FAILURE); - val = scsb_fru_op(scsb, SLOT, slotnum, SCTRL_RESET_BASE, - SCSB_FRU_OP_GET_BITVAL); - if (val) - *rstate = HPC_SLOT_DISCONNECTED; - else { - if (scsb_fru_op(scsb, SLOT, slotnum, SCTRL_BHLTHY_BASE, - SCSB_FRU_OP_GET_BITVAL)) { - *rstate = HPC_SLOT_CONNECTED; - } else { - cmn_err(CE_WARN, "%s#%d: Reset Not Asserted on " - "Healthy# Failed slot %d!", - ddi_driver_name(scsb->scsb_dev), - ddi_get_instance(scsb->scsb_dev), slotnum); - *rstate = HPC_SLOT_DISCONNECTED; - } - } - return (0); -} - -int -scsb_reset_slot(scsb_state_t *scsb, int pslotnum, int reset_flag) -{ - int slotnum, error, val, alarm_card = 0; - i2c_transfer_t *i2cxferp; - uchar_t reg; - int index, condition_exists = 0, ac_val; - - if (scsb_debug & 0x8001) - cmn_err(CE_NOTE, "scsb_reset_slot(%d), flag %x", pslotnum, - reset_flag); - if (scsb->scsb_state & SCSB_FROZEN) - return (EAGAIN); - if ((i2cxferp = scsb_alloc_i2ctx(scsb->scsb_phandle, - I2C_NOSLEEP)) == NULL) { - return (ENOMEM); - } - slotnum = tonga_psl_to_ssl(scsb, pslotnum); - - if (scsb_is_alarm_card_slot(scsb, pslotnum) == B_TRUE) { - DEBUG0("alarm card reset/unreset op:\n"); - alarm_card = 1; - } - reg = SCSB_REG_ADDR(SCTRL_RESET_BASE); - index = SCSB_REG_INDEX(reg); - - mutex_enter(&scsb->scsb_mutex); - i2cxferp->i2c_flags = I2C_WR_RD; - i2cxferp->i2c_rlen = SCTRL_RESET_NUMREGS; - i2cxferp->i2c_wbuf[0] = reg; - i2cxferp->i2c_wlen = 1; - scsb->scsb_kstat_flag = B_TRUE; /* we did an i2c transaction */ - if ((error = nct_i2c_transfer(scsb->scsb_phandle, i2cxferp)) == 0) { - scsb->scsb_i2c_errcnt = 0; - /* - * XXX: following statements assume 2 reset registers, - * which is the case for our current SCB revisions. - */ - scsb->scsb_data_reg[index] = i2cxferp->i2c_rbuf[0]; - scsb->scsb_data_reg[index+1] = i2cxferp->i2c_rbuf[1]; - } else { - scsb->scsb_i2c_errcnt++; - if (scsb->scsb_i2c_errcnt > scsb_err_threshold) - scsb->scsb_err_flag = B_TRUE; /* latch until kstat */ - if (!(scsb->scsb_state & SCSB_SSB_PRESENT)) { - if (scsb->scsb_i2c_errcnt >= scsb_freeze_count) - mutex_exit(&scsb->scsb_mutex); - scsb_freeze(scsb); - mutex_enter(&scsb->scsb_mutex); - } - cmn_err(CE_WARN, "%s#%d: scsb_reset_slot: error" - " reading Reset regs\n", - ddi_driver_name(scsb->scsb_dev), - ddi_get_instance(scsb->scsb_dev)); - error = DDI_FAILURE; - } - - DEBUG2("pre-reset regs = %x,%x\n", scsb->scsb_data_reg[index], - scsb->scsb_data_reg[index+1]); - if ((reset_flag == SCSB_GET_SLOT_RESET_STATUS) || (error)) { - mutex_exit(&scsb->scsb_mutex); - scsb_free_i2ctx(scsb->scsb_phandle, i2cxferp); - return (error); - } - - val = scsb_fru_op(scsb, SLOT, slotnum, SCTRL_RESET_BASE, - SCSB_FRU_OP_GET_BITVAL); - if (alarm_card) { - ac_val = scsb_fru_op(scsb, ALARM, 1, SCTRL_RESET_BASE, - SCSB_FRU_OP_GET_BITVAL); - } - if (val && (reset_flag == SCSB_RESET_SLOT)) { - if (alarm_card) { - if (ac_val) { - condition_exists = 1; - DEBUG0("Alarm_RST# already active.\n"); - } -#ifndef lint - else - DEBUG1("Alarm_RST# not active! " - "Slot%d_RST# active!\n", pslotnum); -#endif - } else { - condition_exists = 1; - DEBUG1("Slot%d_RST# already active!\n", pslotnum); - } - } - else - if ((val == 0) && (reset_flag == SCSB_UNRESET_SLOT)) { - if (alarm_card) { - if (!ac_val) { - DEBUG0("Alarm_RST# not active.\n"); - condition_exists = 1; - } -#ifndef lint - else - DEBUG1("Alarm_RST# active" - " Slot%d_RST# not active!\n", - pslotnum); -#endif - } else { - condition_exists = 1; - DEBUG1("Slot%d_RST# already not active!\n", - pslotnum); - } - } - - if (! condition_exists) { - i2cxferp->i2c_flags = I2C_WR; - i2cxferp->i2c_wlen = 2; - i2cxferp->i2c_wbuf[0] = scsb_fru_op(scsb, SLOT, slotnum, - SCTRL_RESET_BASE, SCSB_FRU_OP_GET_REG); - if (reset_flag == SCSB_RESET_SLOT) { - i2cxferp->i2c_wbuf[1] = - scsb_fru_op(scsb, SLOT, slotnum, - SCTRL_RESET_BASE, - SCSB_FRU_OP_GET_REGDATA) | - scsb_fru_op(scsb, SLOT, slotnum, - SCTRL_RESET_BASE, - SCSB_FRU_OP_SET_REGBIT); -#ifdef DEBUG /* dont reset Alarm Card line unless in debug mode */ - if (alarm_card) - i2cxferp->i2c_wbuf[1] |= - scsb_fru_op(scsb, ALARM, 1, - SCTRL_RESET_BASE, - SCSB_FRU_OP_SET_REGBIT); -#endif - } else { - i2cxferp->i2c_wbuf[1] = - scsb_fru_op(scsb, SLOT, slotnum, - SCTRL_RESET_BASE, - SCSB_FRU_OP_GET_REGDATA) & - ~(scsb_fru_op(scsb, SLOT, slotnum, - SCTRL_RESET_BASE, - SCSB_FRU_OP_SET_REGBIT)); -#ifdef DEBUG /* dont Unreset Alarm Card line unless in debug mode */ - if (alarm_card) - i2cxferp->i2c_wbuf[1] &= - scsb_fru_op(scsb, ALARM, 1, - SCTRL_RESET_BASE, - SCSB_FRU_OP_SET_REGBIT); -#endif - } - - if (error = nct_i2c_transfer(scsb->scsb_phandle, i2cxferp)) { - scsb->scsb_i2c_errcnt++; - if (scsb->scsb_i2c_errcnt > scsb_err_threshold) - scsb->scsb_err_flag = B_TRUE; /* latch error */ - mutex_exit(&scsb->scsb_mutex); - if (!(scsb->scsb_state & SCSB_SSB_PRESENT)) { - if (scsb->scsb_i2c_errcnt >= scsb_freeze_count) - scsb_freeze(scsb); - } - cmn_err(CE_WARN, "%s#%d: reset_slot: error writing to" - " Reset regs (op=%d, data=%x)\n", - ddi_driver_name(scsb->scsb_dev), - ddi_get_instance(scsb->scsb_dev), - reset_flag, i2cxferp->i2c_wbuf[1]); - scsb_free_i2ctx(scsb->scsb_phandle, i2cxferp); - return (DDI_FAILURE); - } - - scsb->scsb_i2c_errcnt = 0; - /* now read back and update our scsb structure */ - i2cxferp->i2c_flags = I2C_WR_RD; - i2cxferp->i2c_rlen = SCTRL_RESET_NUMREGS; - i2cxferp->i2c_wbuf[0] = reg; - i2cxferp->i2c_wlen = 1; - if ((error = nct_i2c_transfer(scsb->scsb_phandle, - i2cxferp)) == 0) { - scsb->scsb_i2c_errcnt = 0; - scsb->scsb_data_reg[index] = i2cxferp->i2c_rbuf[0]; - scsb->scsb_data_reg[index+1] = i2cxferp->i2c_rbuf[1]; - } else { - scsb->scsb_i2c_errcnt++; - if (scsb->scsb_i2c_errcnt > scsb_err_threshold) - scsb->scsb_err_flag = B_TRUE; /* latch error */ - mutex_exit(&scsb->scsb_mutex); - if (!(scsb->scsb_state & SCSB_SSB_PRESENT)) { - if (scsb->scsb_i2c_errcnt >= scsb_freeze_count) - scsb_freeze(scsb); - } - cmn_err(CE_WARN, "%s#%d: scsb_reset_slot: error" - " reading Reset regs (post reset)\n", - ddi_driver_name(scsb->scsb_dev), - ddi_get_instance(scsb->scsb_dev)); - scsb_free_i2ctx(scsb->scsb_phandle, i2cxferp); - return (DDI_FAILURE); - } - /* XXX: P1.5 */ - DEBUG2("post-reset regs = %x,%x\n", scsb->scsb_data_reg[index], - scsb->scsb_data_reg[index+1]); - val = scsb_fru_op(scsb, SLOT, slotnum, SCTRL_RESET_BASE, - SCSB_FRU_OP_GET_BITVAL); -#ifdef DEBUG - if (alarm_card) - ac_val = scsb_fru_op(scsb, ALARM, 1, SCTRL_RESET_BASE, - SCSB_FRU_OP_GET_BITVAL); -#endif - if (val && (reset_flag == SCSB_UNRESET_SLOT)) { - cmn_err(CE_WARN, "Cannot UnReset Slot %d (reg=%x)\n", - pslotnum, - scsb_fru_op(scsb, SLOT, slotnum, - SCTRL_RESET_BASE, - SCSB_FRU_OP_GET_REGDATA)); -#ifdef DEBUG - if (alarm_card) { - if (ac_val) - cmn_err(CE_WARN, "Cannot Unreset " - "Alarm_RST#.\n"); - } -#endif - } - else - if ((val == 0) && (reset_flag == SCSB_RESET_SLOT)) { - cmn_err(CE_WARN, "Cannot Reset Slot %d, " - "reg=%x\n", pslotnum, - scsb_fru_op(scsb, SLOT, slotnum, - SCTRL_RESET_BASE, - SCSB_FRU_OP_GET_REGDATA)); -#ifdef DEBUG - if (alarm_card) { - if (!ac_val) - cmn_err(CE_WARN, "Cannot reset " - "Alarm_RST#.\n"); - } -#endif - } - } - - mutex_exit(&scsb->scsb_mutex); - scsb_free_i2ctx(scsb->scsb_phandle, i2cxferp); - - return (error); -} - -int -scsb_connect_slot(scsb_state_t *scsb, int pslotnum, int healthy) -{ - int slotnum, count = 0, val; - int slot_flag = 0; - - /* - * If Power needs to be handled, it should be done here. - * Since there is no power handling for now, lets disable - * reset, wait for healthy to come on and then call it - * connected. - * If HLTHY# does not come on (in how long is the question) - * then we stay disconnected. - */ - slotnum = tonga_psl_to_ssl(scsb, pslotnum); - - /* - * P1.5 doesnt require polling healthy as we get an - * interrupt. So we could just update our state as disconnected - * and return waiting for the healthy# interrupt. To make it - * more efficient, lets poll for healthy# a short while since we are - * in the interrupt context anyway. If we dont get a healthy# we - * return, and then wait for the interrupt. Probably the warning - * message needs to be removed then. Need a PROM check flag here. - */ - while ((healthy == B_FALSE) && (count < scsb_healthy_poll_count)) { - if (scsb_read_bhealthy(scsb) != 0) - return (DDI_FAILURE); - val = scsb_fru_op(scsb, SLOT, slotnum, SCTRL_BHLTHY_BASE, - SCSB_FRU_OP_GET_BITVAL); - if (val) { - healthy = B_TRUE; - break; - } - count++; - drv_usecwait(100); /* cant delay(9f) in intr context */ - } - - if (healthy == B_FALSE && count == scsb_healthy_poll_count) { - if (scsb_debug & 0x00004000) - cmn_err(CE_WARN, "%s#%d: no HEALTHY# signal on" - " slot %d", ddi_driver_name(scsb->scsb_dev), - ddi_get_instance(scsb->scsb_dev), pslotnum); - } - - if ((scsb_is_alarm_card_slot(scsb, pslotnum) == B_TRUE) && - (scsb->scsb_hsc_state & SCSB_ALARM_CARD_PRES)) - slot_flag = ALARM_CARD_ON_SLOT; - return (hsc_slot_occupancy(pslotnum, 1, slot_flag, healthy)); -} - -int -scsb_disconnect_slot(scsb_state_t *scsb, int occupied, int slotnum) -{ - int slot_flag = 0; - - /* Reset is must at extraction. Move on even if failure. */ - if (scsb_reset_slot(scsb, slotnum, SCSB_RESET_SLOT) != 0) { - /* - * If board is still in slot, which means there is a manual - * disconnection in progress, return failure. - * Otherwise, a board was removed anyway; so we need to - * update the status and move on. - */ - if (occupied == B_TRUE) - return (DDI_FAILURE); - } - /* - * the following bug needs to be fixed. - * When this function is called from scsb_intr, scsb_state already - * clears the 'AC card present' bit. - * However, hsc module doesn't depend on slot_flag during removal. - */ - if ((scsb_is_alarm_card_slot(scsb, slotnum) == B_TRUE) && - (scsb->scsb_hsc_state & SCSB_ALARM_CARD_PRES)) - slot_flag = ALARM_CARD_ON_SLOT; - return (hsc_slot_occupancy(slotnum, occupied, slot_flag, B_FALSE)); -} - -static int -scsb_is_alarm_card_slot(scsb_state_t *scsb, int slotnum) -{ - return ((scsb->ac_slotnum == slotnum)? B_TRUE:B_FALSE); -} - -/* - * Invoked both by the hsc and the scsb module to exchanges necessary - * information regarding the alarm card. - * scsb calls this function to unconfigure the alarm card while the - * hsc calls this function at different times to check busy status, - * and during post hotswap insert operation so that the user process - * if one waiting can configure the alarm card. - */ -int -scsb_hsc_ac_op(scsb_state_t *scsb, int pslotnum, int op) -{ - int rc = B_FALSE; - uint32_t event_code; - - if (!(scsb->scsb_hsc_state & SCSB_HSC_INIT && - scsb->scsb_hsc_state & SCSB_ALARM_CARD_PRES)) { - cmn_err(CE_WARN, - "scsb: HSC not initialized or AC not present!"); - return (rc); - } - switch (op) { - /* hsc -> scsb */ - case SCSB_HSC_AC_BUSY: - if (scsb->scsb_hsc_state & SCSB_ALARM_CARD_IN_USE) - rc = B_TRUE; - break; - - /* API -> scsb */ - /* - * NOTE: this could be called multiple times from envmond if - * the daemon is reinitialized with SIGHUP, or stopped and - * restarted. - */ - case SCSB_HSC_AC_SET_BUSY: - DEBUG0("AC SET BUSY\n"); - if (scsb_debug & 0x00010000) { - cmn_err(CE_NOTE, - "scsb_hsc_ac_op(SCSB_HSC_AC_SET_BUSY)"); - } - scsb->scsb_hsc_state |= SCSB_ALARM_CARD_IN_USE; - rc = B_TRUE; - break; - - /* hsc -> scsb */ - case SCSB_HSC_AC_CONFIGURED: - DEBUG0("AC configured\n"); - if (scsb_debug & 0x00010000) { - cmn_err(CE_NOTE, - "scsb_hsc_ac_op(SCSB_HSC_AC_CONFIGURED)"); - } - /* - * wakeup anyone waiting on AC to be configured - * Send the ALARM_CARD_CONFIGURE Event to all scsb - * open streams. - */ - event_code = SCTRL_EVENT_ALARM_INSERTION; - (void) scsb_queue_ops(scsb, QPUT_INT32, 1, - &event_code, "scsb_hsc_ac_op"); - rc = B_TRUE; - break; - - /* hsc -> scsb */ - case SCSB_HSC_AC_REMOVAL_ALERT: - DEBUG0("AC removal alert\n"); - if (scsb_debug & 0x00010000) { - cmn_err(CE_NOTE, - "scsb_hsc_ac_op(SCSB_HSC_AC_REMOVAL_ALERT)"); - } - /* - * Inform (envmond)alarmcard.so that it should save - * the AC configuration, stop the - * heartbeat, and shutdown the RSC link. - */ - event_code = SCTRL_EVENT_ALARM_REMOVAL; - (void) scsb_queue_ops(scsb, QPUT_INT32, 1, - &event_code, "scsb_hsc_ac_op"); - rc = B_TRUE; - break; - - /* API -> scsb -> hsc */ - case SCSB_HSC_AC_UNCONFIGURE: - DEBUG0("AC unconfigure\n"); - if (scsb_debug & 0x00010000) { - cmn_err(CE_NOTE, - "scsb_hsc_ac_op(SCSB_HSC_AC_UNCONFIG" - "URE), AC NOT BUSY"); - } - /* - * send notification back to HSC to - * unconfigure the AC, now that the env monitor - * has given permission to do so. - */ - scsb->scsb_hsc_state &= ~SCSB_ALARM_CARD_IN_USE; - hsc_ac_op((int)scsb->scsb_instance, pslotnum, - SCSB_HSC_AC_UNCONFIGURE, NULL); - rc = B_TRUE; - break; - default: - break; - } - - return (rc); -} - -static void -scsb_healthy_intr(scsb_state_t *scsb, int pslotnum) -{ - int val, slotnum; - int healthy = B_FALSE; - - DEBUG1("Healthy Intr on slot %d\n", pslotnum); - /* - * The interrupt source register can have the healthy - * bit set for non-existing slot, e.g slot 7 on Tonga. - * It can also be seen on the Tonga CPU slot. So we make - * sure we have a valid slot before proceeding. - */ - if (scsb->scsb_state & SCSB_IS_TONGA) { - if (pslotnum > TG_MAX_SLOTS || pslotnum == SC_TG_CPU_SLOT) { - if (scsb_debug & 0x08000000) - cmn_err(CE_NOTE, "Healthy interrupt bit set for" - " slot %d", pslotnum); - return; - } - } else { - if (pslotnum > MC_MAX_SLOTS || pslotnum == SC_MC_CPU_SLOT || - (scsb->scsb_hsc_state & SCSB_HSC_CTC_PRES && - pslotnum == SC_MC_CTC_SLOT)) { - if (scsb_debug & 0x08000000) - cmn_err(CE_NOTE, "Healthy interrupt bit set for" - " slot %d", pslotnum); - return; - } - } - - /* - * The board healthy registers are already read before entering - * this routine - */ - slotnum = tonga_psl_to_ssl(scsb, pslotnum); - - /* - * P1.5. Following works since slots 1 through 8 are in the same reg - */ - val = scsb_fru_op(scsb, SLOT, slotnum, SCTRL_BHLTHY_BASE, - SCSB_FRU_OP_GET_BITVAL); - if (val) - healthy = B_TRUE; - (void) scsb_hsc_board_healthy(pslotnum, healthy); -} - -/* - * This function will try to read from scsb irrespective of whether - * SSB is present or SCB is frozen, to get the health kstat information. - */ -static int -scsb_blind_read(scsb_state_t *scsb, int op, uchar_t reg, int len, - uchar_t *rwbuf, int i2c_alloc) -{ - i2c_transfer_t *i2cxferp; - int i, rlen, wlen, error = 0; - - if (scsb_debug & 0x0800) { - cmn_err(CE_NOTE, "scsb_rdwr_register(scsb,%s,%x,%x,buf):", - (op == I2C_WR) ? "write" : "read", reg, len); - } - - if (i2c_alloc) { - i2cxferp = scsb_alloc_i2ctx(scsb->scsb_phandle, I2C_NOSLEEP); - if (i2cxferp == NULL) { - if (scsb_debug & 0x0042) - cmn_err(CE_WARN, "scsb_rdwr_register: " - "i2ctx allocation failure"); - return (ENOMEM); - } - } else { - i2cxferp = scsb->scsb_i2ctp; - } - switch (op) { - case I2C_WR: - wlen = len + 1; /* add the address */ - rlen = 0; - i2cxferp->i2c_wbuf[0] = reg; - for (i = 0; i < len; ++i) { - i2cxferp->i2c_wbuf[1 + i] = rwbuf[i]; - if (scsb_debug & 0x0080) - cmn_err(CE_NOTE, - "scsb_rdwr_register: writing rwbuf[%d]=0x%x", - i, rwbuf[i]); - } - break; - case I2C_WR_RD: - wlen = 1; /* for the address */ - rlen = len; - i2cxferp->i2c_wbuf[0] = reg; - break; - default: - if (i2c_alloc) - scsb_free_i2ctx(scsb->scsb_phandle, i2cxferp); - return (EINVAL); - } - /* select the register address */ - i2cxferp->i2c_flags = op; - i2cxferp->i2c_rlen = rlen; - i2cxferp->i2c_wlen = wlen; - i2cxferp->i2c_wbuf[0] = reg; - scsb->scsb_kstat_flag = B_TRUE; /* we did a i2c transaction */ - if (error = nct_i2c_transfer(scsb->scsb_phandle, i2cxferp)) { - error = EIO; - } else if (rlen) { - /* copy to rwbuf[] */ - for (i = 0; i < len; ++i) { - rwbuf[i] = i2cxferp->i2c_rbuf[i]; - if (scsb_debug & 0x0080) - cmn_err(CE_NOTE, - "scsb_rdwr_register: read rwbuf[%d]=0x%x", - i, rwbuf[i]); - } - } - if (i2c_alloc) - scsb_free_i2ctx(scsb->scsb_phandle, i2cxferp); - if (error) { - scsb->scsb_i2c_errcnt++; - if (scsb->scsb_i2c_errcnt > scsb_err_threshold) - scsb->scsb_err_flag = B_TRUE; /* latch error */ - } else { - scsb->scsb_i2c_errcnt = 0; - } - - return (error); -} - -/* - * This function will quiesce the PSM_INT line by masking the - * global PSM_INT and writing 1 to SCB_INIT ( for P1.5 and later ) - * This effectively translates to writing 0x20 to 0xE1 register. - */ -static int -scsb_quiesce_psmint(scsb_state_t *scsb) -{ - register int i; - uchar_t reg, wdata = 0; - uchar_t tmp_reg, intr_addr, clr_bits = 0; - int error, iid, intr_idx, offset; - - /* - * For P1.5, set the SCB_INIT bit in the System Command register, - * and disable global PSM_INT. Before this we need to read the - * interrupt source register corresponding to INIT_SCB and - * clear if set. - */ - if (IS_SCB_P15) { - /* - * Read INTSRC6 and write back 0x20 in case INIT_SCB is set - */ - intr_addr = SCSB_REG_ADDR(SCTRL_INTSRC_BASE); - tmp_reg = SCSB_REG_ADDR(SCTRL_INTSRC_SCB_P15); - iid = SCSB_REG_INDEX(intr_addr); - intr_idx = SCSB_REG_INDEX(tmp_reg) - iid; - offset = FRU_OFFSET(SCTRL_EVENT_SCB, SCTRL_INTPTR_BASE); - clr_bits = 1 << offset; - - error = scsb_rdwr_register(scsb, I2C_WR_RD, tmp_reg, - 1, &scb_intr_regs[intr_idx], 0); - /* - * Now mask the global PSM_INT and write INIT_SCB in case - * this is an INIT_SCB interrupt - */ - wdata = 1 << SYS_OFFSET(SCTRL_SYS_SCB_INIT); - i = SYS_REG_INDEX(SCTRL_SYS_SCB_INIT, SCTRL_SYS_CMD_BASE); - reg = SCSB_REG_ADDR(i); - error = scsb_rdwr_register(scsb, I2C_WR, reg, 1, - &wdata, 0); - - if (scb_intr_regs[intr_idx] & clr_bits) { - /* - * There is an SCB_INIT interrupt, which we must clear - * first to keep SCB_INIT from keeping PSM_INT asserted. - */ - error = scsb_rdwr_register(scsb, I2C_WR, tmp_reg, - 1, &clr_bits, 0); - } - - if (error) { - cmn_err(CE_WARN, "scsb%d:scsb_quiesce_psmint: " - " I2C TRANSFER Failed", scsb->scsb_instance); - if (scsb_debug & 0x0006) { - cmn_err(CE_NOTE, "scsb_attach: " - " failed to set SCB_INIT"); - } - } - scsb->scsb_state &= ~SCSB_PSM_INT_ENABLED; - } else { /* P1.0 or earlier */ - /* - * read the interrupt source registers, and then - * write them back. - */ - /* read the interrupt register from scsb */ - if (error = scsb_rdwr_register(scsb, I2C_WR_RD, intr_addr, - SCTRL_INTR_NUMREGS, scb_intr_regs, 0)) { - cmn_err(CE_WARN, "scsb_intr: " - " Failed read of interrupt registers."); - scsb->scsb_state &= ~SCSB_IN_INTR; - } - - /* - * Write to the interrupt source registers to stop scsb - * from interrupting. - */ - if (error = scsb_rdwr_register(scsb, I2C_WR, intr_addr, - SCTRL_INTR_NUMREGS, scb_intr_regs, 0)) { - cmn_err(CE_WARN, "scsb_intr: Failed write to interrupt" - " registers."); - scsb->scsb_state &= ~SCSB_IN_INTR; - } - - } - - if (error) - return (DDI_FAILURE); - else - return (DDI_SUCCESS); -} - -/* - * Enables or disables the global PSM_INT interrupt for P1.5, depending - * on the flag, flag = 0 => disable, else enable. - */ -static int -scsb_toggle_psmint(scsb_state_t *scsb, int enable) -{ - int i; - uchar_t reg, on = 0, rmask = 0x0, off = 0; - - if (enable == B_TRUE) { - on = 1 << SYS_OFFSET(SCTRL_SYS_PSM_INT_ENABLE); - } else { - off = 1 << SYS_OFFSET(SCTRL_SYS_PSM_INT_ENABLE); - } - - i = SYS_REG_INDEX(SCTRL_SYS_PSM_INT_ENABLE, SCTRL_SYS_CMD_BASE); - reg = SCSB_REG_ADDR(i); - if (scsb_write_mask(scsb, reg, rmask, on, off)) { - cmn_err(CE_WARN, "scsb_toggle_psmint: Cannot turn %s PSM_INT", - enable == 1 ? "on" : "off"); - return (DDI_FAILURE); - } - if (enable == 0) { - scsb->scsb_state &= ~SCSB_PSM_INT_ENABLED; - } else { - scsb->scsb_state |= SCSB_PSM_INT_ENABLED; - } - - return (DDI_SUCCESS); -} - -/* - * This routine is to be used by all the drivers using this i2c bus - * to synchronize their transfer operations. - */ -int -nct_i2c_transfer(i2c_client_hdl_t i2c_hdl, i2c_transfer_t *i2c_tran) -{ - int retval, initmux = nct_mutex_init; - - /* - * If scsb interrupt mutex is initialized, also hold the - * interrupt mutex to let the i2c_transfer() to complete - */ - - if (initmux & MUTEX_INIT) { - mutex_enter(scb_intr_mutex); - } - - retval = i2c_transfer(i2c_hdl, i2c_tran); - - if (initmux & MUTEX_INIT) { - mutex_exit(scb_intr_mutex); - } - - return (retval); -} diff --git a/usr/src/uts/sun4u/montecarlo/io/scsb.conf b/usr/src/uts/sun4u/montecarlo/io/scsb.conf deleted file mode 100644 index fb856c4325..0000000000 --- a/usr/src/uts/sun4u/montecarlo/io/scsb.conf +++ /dev/null @@ -1,30 +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 2001 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" -# -# force attach driver to support hotplug activity -# -ddi-forceattach=1; diff --git a/usr/src/uts/sun4u/montecarlo/io/se.conf b/usr/src/uts/sun4u/montecarlo/io/se.conf deleted file mode 100644 index 3011f6cfcb..0000000000 --- a/usr/src/uts/sun4u/montecarlo/io/se.conf +++ /dev/null @@ -1,39 +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-2000 by Sun Microsystems, Inc. -# All rights reserved. -# -#ident "%Z%%M% %I% %E% SMI" -# -# Configuration file for Alarm Card Serial Port driver only. -# All these properties are laid atop OBP created properties at cold swap -# or by Solaris during hotswap. -# -interrupts=1 -reg=0x14,0x400000,0x80 -ssp-console-modes="115200,8,n,1,-" -ssp-control-modes="115200,8,n,1,-" -interrupt-priorities=8 -ssp-control=1 -ssp-console=0 -device_type="serial"; diff --git a/usr/src/uts/sun4u/montecarlo/io/ttymux.conf b/usr/src/uts/sun4u/montecarlo/io/ttymux.conf deleted file mode 100644 index eb73d455dd..0000000000 --- a/usr/src/uts/sun4u/montecarlo/io/ttymux.conf +++ /dev/null @@ -1,38 +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) 2001 by Sun Microsystems, Inc. -# All rights reserved. -# -#pragma ident "%Z%%M% %I% %E% SMI" -# - -# Global properties - -upa-portid = 0x0; -sm-trlv = 0x0; # debug trace. -sm-max-units = 6; # max no. of linked lower streams. -sm-minor-cnt = 0; # number of extra device minors. -sm-refuse-opens = 0; # unless associated -sm-ctrla-abort-on = 1; # software break sequence enabled -sm-break-abort-on = 0; # hardware break disabled -abort-str = "^m~^b"; # the software break sequence diff --git a/usr/src/uts/sun4u/montecarlo/io/ttymux_dacf/ttymux_dacf.c b/usr/src/uts/sun4u/montecarlo/io/ttymux_dacf/ttymux_dacf.c deleted file mode 100644 index 0a090a050c..0000000000 --- a/usr/src/uts/sun4u/montecarlo/io/ttymux_dacf/ttymux_dacf.c +++ /dev/null @@ -1,930 +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 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * This is a dacf module based upon the Extensions to Device Autoconfiguration - * project. See PSARC/1998/212 for more details. - * - * This module provides the dacf functions - * to be called after a driver has attached and before it detaches. - * The post attach functionality is used to autoconfigure a serial console - * multiplexer if the OBP console is a multiplexer. - */ - -#include <sys/types.h> -#include <sys/param.h> -#include <sys/cmn_err.h> -#include <sys/user.h> -#include <sys/vfs.h> -#include <sys/vnode.h> -#include <sys/systm.h> -#include <sys/file.h> -#include <sys/klwp.h> -#include <sys/stropts.h> -#include <sys/stream.h> -#include <sys/strsubr.h> - -#include <sys/consdev.h> -#include <sys/kbio.h> -#include <sys/debug.h> -#include <sys/reboot.h> -#include <sys/termios.h> -#include <sys/clock.h> - -#include <sys/kstr.h> -#include <sys/ddi.h> -#include <sys/sunddi.h> -#include <sys/sunndi.h> -#include <sys/modctl.h> -#include <sys/ddi_impldefs.h> -#include <sys/ndi_impldefs.h> - -#include <sys/errno.h> -#include <sys/devops.h> -#include <sys/note.h> -#include <sys/open.h> -#include <sys/kmem.h> -#include <sys/dacf.h> -#include <sys/promif.h> - -#include "ttymux_dacf.h" - -#pragma weak find_platform_consoles -extern char *find_platform_consoles(sm_mux_state_t *_m, dev_info_t *_di, - dev_t _d, uint_t _f); - -#define platform_consoles(_m, _di, _d, _f) \ - (find_platform_consoles != NULL \ - ? find_platform_consoles(_m, _di, _d, _f) \ - : (nulldev(_m, _di, _d, _f), (char *)0)) - -/* - * External functions - */ -extern uintptr_t space_fetch(char *key); -extern int space_store(char *key, uintptr_t ptr); -extern void ttymux_dprintf(int l, const char *fmt, ...); -extern int prom_ihandle_to_path(ihandle_t, char *, uint_t); -extern void prom_interpret(char *, uintptr_t, uintptr_t, uintptr_t, - uintptr_t, uintptr_t); -extern ihandle_t prom_stdin_ihandle(); -extern ihandle_t prom_stdout_ihandle(); - -extern vnode_t *rconsvp; /* redirection device */ - -/* - * Dacf entry points - */ -static int ttymux_config(dacf_infohdl_t, dacf_arghdl_t, int); - -/* - * Internal functions - */ -static dacf_op_t ttymuxconfig_op[] = { - { DACF_OPID_POSTATTACH, ttymux_config }, - { DACF_OPID_END, NULL }, -}; - -static dacf_opset_t opsets[] = { - { "ttymux_config", ttymuxconfig_op }, - { NULL, NULL } -}; - -struct dacfsw dacfsw = { - DACF_MODREV_1, - opsets, -}; - -struct modldacf modldacf = { - &mod_dacfops, /* Type of module */ - "ttymux DACF", - &dacfsw -}; - -struct modlinkage modlinkage = { - MODREV_1, (void *)&modldacf, NULL -}; - -/*LINTLIBRARY*/ - -/* - * The following minor nodes can be linked underneath the serial - * console multiplexer. - * These are the only ones currently tested. - * (NOTE: Devices of device_type serial are also allowed to be used as - * additional consoles). - * Disallow plumbing of untested node types. - */ -static const char * const supported_types[] = { - DDI_NT_SERIAL, (char *const)NULL -}; - -#define OFLAGS FREAD|FWRITE|FNOCTTY|FNONBLOCK - -#define INPUT_ALIAS "multiplexer-input-devices" -#define OUTPUT_ALIAS "multiplexer-output-devices" -#define OBPDEV 0x100 -#define FORTH_STRINGLEN 1024 -#define MUXDEVTYPE "SUNW,serial-multiplexer" - -static char fth_fmt[] = -"\" get-device-list\" " /* ( method-str method-len ) */ -"h# %p " /* ( method-str method-len ihandle ) */ -"$call-method " /* ( ihandle_n-1 ... ihandle n ) */ -"dup " /* ( ihandle_n-1 ... ihandle n n ) */ -"h# %p " /* ( ihandle_n-1 ... ihandle n n numfound ) */ -"l! " /* ( ihandle_n-1 ... ihandle n ) */ -"0 " /* ( ihandle_n-1 ... ihandle n 0 ) */ -"do " /* ( ihandle_n-1 ... ihandle_i+1 ihandle_i ) */ -" i " /* ( ihandle_n-1 ... ihandle_i+1 ihandle_i index ) */ -" h# %x " /* ( ihandle_n-1 ... ihandle_i+1 ihandle_i index max) */ -" < if " /* ( ihandle_n-1 ... ihandle_i+1 ihandle_i ) */ -" h# %p " /* ( ihandle_n-1 ... ihandle_i+1 ihandle_i buf ) */ -" i " /* ( ihandle_n-1 ... ihandle_i+1 ihandle_i buf index) */ -" 4 * + " /* ( ihandle_n-1 ... ihandle_i+1 ihandle_i buf' ) */ -" l! " /* ( ihandle_n-1 ... ihandle_i+1 ) */ -" else " /* */ -" drop " /* ( ihandle_n-1 ... ihandle_i+1 ) */ -" then " /* */ -"loop "; /* ( ihandle_n-1 ... ihandle_i+1 ) */ - -int -_init(void) -{ - return (mod_install(&modlinkage)); -} - -int -_fini() -{ - return (mod_remove(&modlinkage)); -} - -int -_info(struct modinfo *modinfop) -{ - return (mod_info(&modlinkage, modinfop)); -} - -static int -ioctl_cmd(vnode_t *avp, int cmd, void *data, int datasize, int *bytecnt) -{ - struct strioctl ios; - int rval; - - ios.ic_timout = 0; - ios.ic_cmd = cmd; - ios.ic_dp = (char *)data; - ios.ic_len = datasize; - - rval = kstr_ioctl(avp, I_STR, (intptr_t)&ios); - if (bytecnt) - *bytecnt = ios.ic_len; - return (rval); -} - -/* - * How many consoles are actually linked underneath the Solaris console - * multiplexer. - */ -static int -usable_consoles(sm_mux_state_t *sp, uint_t *iconsoles, uint_t *oconsoles) -{ - uint_t j, cnt, icnt = 0u, ocnt = 0u; - - mutex_enter(&sp->sm_cons_mutex); - for (j = 0, cnt = 0; j < sp->sm_cons_cnt; j++) - if (sp->sm_cons_links[j].sm_muxid != 0) { - sm_console_t *cn = &sp->sm_cons_links[j]; - if (cn->sm_mode & FORINPUT) - icnt += 1; - if (cn->sm_mode & FOROUTPUT) - ocnt += 1; - if (cn->sm_mode == FORIO) - cnt += 1; - } - mutex_exit(&sp->sm_cons_mutex); - *iconsoles = icnt; - *oconsoles = ocnt; - return (cnt); -} - -/* - * Before linking a device underneath a serial multiplexer check that - * its minor node type is supported. - */ -static boolean_t -compatible_console(dev_t dev) -{ - int circ; - boolean_t compatible; - char *const *nodetype; - struct ddi_minor_data *dmdp; - dev_info_t *dip; - char devtype[32]; - int len; - - /* - * Find the node nodetype to verify that the current version of - * the code supports its use as a console - * Supported types are listed in the array supported_types - */ - if ((dip = e_ddi_hold_devi_by_dev(dev, 0)) == NULL) { - ttymux_dprintf(DPRINT_L2, "No dip for %d:%d\n", - getmajor(dev), getminor(dev)); - return (B_FALSE); - } - - compatible = B_FALSE; - len = sizeof (devtype); - - ndi_devi_enter(dip, &circ); - for (dmdp = DEVI(dip)->devi_minor; dmdp != NULL; dmdp = dmdp->next) { - struct ddi_minor_data *mdp = dmdp; - - if (mdp->ddm_dev == dev) { - - ttymux_dprintf(DPRINT_L0, "compat: matched dev\n"); - /* - * check the OBP device_type property first - * its a good bet that it will be compatible - * if it has the value serial. - */ - if (ddi_prop_op(DDI_DEV_T_ANY, dip, - PROP_LEN_AND_VAL_BUF, 0, "device_type", - (caddr_t)devtype, &len) == DDI_PROP_SUCCESS && - strcmp(devtype, "serial") == 0) { - compatible = B_TRUE; - } else { - for (nodetype = - (char *const *)&supported_types[0]; - *nodetype != (char *const)NULL; - nodetype++) { - if (strcmp(*nodetype, - mdp->ddm_node_type) == 0) { - compatible = B_TRUE; - break; - } - } - } - break; - } - } - ndi_devi_exit(dip, circ); - ddi_release_devi(dip); - - /* - * The current version of the implementation has only been tested - * with a serial multiplexer. - */ - - ttymux_dprintf(DPRINT_L0, "%d:%d is %s\n", getmajor(dev), - getminor(dev), (compatible) ? "compatible" : "incompatible"); - - return (compatible); -} - -/* - * get-device-list ( -- [ihandle n-1, ... ihandle], n ) - * Call the "get-device-list" method of an OBP device. - * ihdl - ihandle of the OBP device whose method is to be called - * ihdls - array of ihandles returned to the caller - * maxi - length of the ihdls array - */ -static int -get_device_list(ihandle_t ihdl, ihandle_t *ihdls, size_t maxi) -{ - int numfound = -1; - char fstr[FORTH_STRINGLEN]; - - if (snprintf(fstr, FORTH_STRINGLEN, fth_fmt, (caddr32_t)ihdl, - &numfound, maxi, ihdls) > FORTH_STRINGLEN) { - ttymux_dprintf(DPRINT_L3, - "WARNING: forth buffer size is too small.\n"); - return (0); - } - - prom_interpret(fstr, 0, 0, 0, 0, 0); - - ttymux_dprintf(DPRINT_L0, "ihdl 0x%p cnt %d\n", - (caddr32_t)ihdl, numfound); - - return (numfound); -} - -/* - * Read an OBP property and return the result in propval. - * The caller is responsible for freeing the memory. - */ -static int -read_prop(pnode_t node, char *propname, char **propval) -{ - int proplen = -1; - - if (node == OBP_BADNODE || - (proplen = prom_getproplen(node, propname)) <= 0) - return (proplen); - - *propval = kmem_zalloc(proplen + 1, KM_SLEEP); - (void) prom_getprop(node, propname, *propval); - - return (proplen); -} - -/* - * Parse a white space separated list of tokens and call - * the input action with each parsed token. - */ -static void -parse(sm_mux_state_t *ms, char *p, - void (*action)(sm_mux_state_t *, char *, void *), void *arg) -{ - char *e, *tok = NULL; - - if (p == 0 || *p == 0) - return; - - e = p + strlen(p); - - do { - switch (*p) { - case ' ': - case '\t': - if (tok != NULL) { - *p = 0; - action(ms, tok, arg); - tok = NULL; - *p = ' '; - } - break; - default: - if (tok == NULL) { - tok = p; - } - break; - } - } while (++p < e); - - if (tok != NULL) - action(ms, tok, arg); -} - -/* - * Search for a console structure matching a device path. - * Return a new initialized structure if one does not exist. - */ -sm_console_t * -get_aconsole(sm_mux_state_t *ms, char *path) -{ - sm_console_t *cn; - int j; - - for (cn = ms->sm_cons_links, j = 0; - j < ms->sm_cons_cnt; cn++, j++) { - if (cn->sm_path && strcmp(cn->sm_path, path) == 0) - break; - } - if (j == ms->sm_cons_cnt) { - if (j + 1 == TTYMUX_MAX_LINKS) { - cn = NULL; - } else { - bzero((caddr_t)cn, sizeof (*cn)); - ms->sm_cons_cnt += 1; - } - } - return (cn); -} - -/* - * Create a new console structure representing the device - * identified by path. The void * argument indicates which I/O - * mode the device will support. - */ -static void -add_aconsole(sm_mux_state_t *ms, char *path, void *arg) -{ - sm_console_t *cn; - char *cpath; - - if (*path == '/') { - cpath = kmem_alloc(strlen(path) + 1, KM_SLEEP); - (void) strcpy(cpath, path); - } else if (read_prop(prom_alias_node(), path, &cpath) <= 0) { - return; - } - - /* - * Device paths should have a minor name - if its missing assume - * it should be :a! - */ - if (strrchr(cpath, ':') == NULL) { - char *p; - size_t len = strlen(cpath) + 1; - - p = kmem_zalloc(len + 2, KM_SLEEP); - (void) strcpy(p, cpath); - (void) strcat(p, ":a"); /* assume :a ! */ - kmem_free(cpath, len); - cpath = p; - } - if ((cn = get_aconsole(ms, cpath)) != NULL) { - cn->sm_obp_con = ((uint_t)(uintptr_t)arg & OBPDEV) ? - B_TRUE : B_FALSE; - cn->sm_mode |= (io_mode_t)((uint_t)(uintptr_t)arg & FORIO); - if (cn->sm_path != NULL) - kmem_free(cn->sm_path, strlen(cn->sm_path) + 1); - cn->sm_path = cpath; - } else { - ttymux_dprintf(DPRINT_L3, "Too many " - " consoles - ignoring %s\n", cpath); - kmem_free(cpath, strlen(cpath) + 1); - } -} - -/* - * Discover which consoles OBP is using. - */ -static int -find_obp_consoles(sm_mux_state_t *ms, io_mode_t mode) -{ - sm_console_t *cn; - int i, cnt; - char *devpath; - ihandle_t ihdls[TTYMUX_MAX_LINKS]; - ihandle_t stdihdl; - - if (mode == FORINPUT) - stdihdl = ms->sm_cons_stdin.sm_i_ihdl; - else if (mode == FOROUTPUT) - stdihdl = ms->sm_cons_stdout.sm_o_ihdl; - else - return (EINVAL); - devpath = kmem_alloc(MAXPATHLEN+2, KM_SLEEP); - - cnt = get_device_list(stdihdl, ihdls, TTYMUX_MAX_LINKS); - - for (i = 0; i < cnt; i++) { - - if (prom_ihandle_to_path(ihdls[i], devpath, MAXPATHLEN) == 0) - continue; - /* - * If the minor name is not part of the path and there is - * more than one minor node then ddi_pathname_to_dev_t - * can fail to resolve the path correctly (it's an OBP - * problem)!!! If there's no minor name then assume the default - * minor name (:a). - */ - if (strrchr(devpath, ':') == NULL) - (void) strcat(devpath, ":a"); /* assume :a ! */ - - if ((cn = get_aconsole(ms, devpath)) == 0) { - ttymux_dprintf(DPRINT_L3, "Too many " - " consoles - ignoring %s\n", devpath); - continue; - } - - cn->sm_mode |= mode; - cn->sm_obp_con = B_TRUE; - if (mode == FORINPUT) - cn->sm_i_ihdl = ihdls[i]; - else - cn->sm_o_ihdl = ihdls[i]; - if (cn->sm_path == NULL) { - cn->sm_path = kmem_alloc(strlen(devpath) + 1, KM_SLEEP); - (void) strcpy(cn->sm_path, devpath); - } - - } - kmem_free(devpath, MAXPATHLEN + 2); - - return (0); -} - -/* - * Convert a file system path into a dev_t - */ -static dev_t -fs_devtype(char *fspath) -{ - vnode_t *vp = NULL; - dev_t dev; - - if (fspath == 0 || - vn_open(fspath, UIO_SYSSPACE, FREAD, 0, &vp, 0, 0) != 0) { - return (NODEV); - } else { - dev = vp->v_rdev; - VOP_CLOSE(vp, FREAD, 1, (offset_t)0, CRED(), NULL); - VN_RELE(vp); - return (dev); - } -} - -/* - * Convert a device tree path into a dev_t - */ -static dev_t -di_devtype(char *path) -{ - dev_t dev; - - if (path == 0 || *path == 0) - return (NODEV); - - ttymux_dprintf(DPRINT_L0, "loading device %s\n", path); - dev = ddi_pathname_to_dev_t(path); - - return (dev); -} - - -static int -open_stream(vnode_t **vp, int *fd, dev_t dev) -{ - file_t *fp; - int rv; - - /* create a vnode for the device and open it */ - *vp = makespecvp(dev, VCHR); - if ((rv = VOP_OPEN(vp, FREAD+FWRITE+FNOCTTY, CRED(), NULL)) != 0) { - goto out2; - } - /* Associate a file pointer with the vnode */ - if ((rv = falloc(*vp, FREAD+FWRITE+FNOCTTY, &fp, NULL)) != 0) { - goto out1; - } - mutex_exit(&fp->f_tlock); /* must be called single threaded */ - /* Allocate a file descriptor (any non-negative integer will suffice) */ - if ((*fd = ufalloc(0)) == -1) { - rv = EMFILE; - goto out1; - } - /* associate the file pointer with the fd */ - setf(*fd, fp); - return (0); - -out1: - VOP_CLOSE(*vp, FREAD+FWRITE+FNOCTTY, 1, (offset_t)0, CRED(), NULL); -out2: - VN_RELE(*vp); - return (rv); -} - -/* - * Plumb a device specified by the sm_console_t argument underneath the - * serial multiplexer indicated by the vnode_t argument. - */ -static int -link_aconsole(vnode_t *mux_avp, sm_console_t *cn) -{ - vnode_t *lvp; - int lfd; - int rv, rval; - ttymux_assoc_t assoc; - struct termios tc; - - ASSERT(cn->sm_path); - - /* get an open vnode for the device */ - if ((rv = open_stream(&lvp, &lfd, cn->sm_dev)) != 0) - return (rv); - - /* - * Enable the receiver on the lower device since it will - * be used by OBP. - */ - if ((rv = ioctl_cmd(lvp, TCGETS, &tc, sizeof (tc), 0)) == 0) { - tc.c_cflag |= CREAD; - rv = ioctl_cmd(lvp, TCSETS, &tc, sizeof (tc), 0); - } - if (rv != 0) - ttymux_dprintf(DPRINT_L3, - "DACF: Failed to enable console receiver [error %d]\n", rv); - - /* - * Pop all the modules off the stream prior to linking it. - */ - do { - rv = strioctl(lvp, I_POP, 0, 0, K_TO_K, CRED(), &rval); - } while (rv == 0); - - if (rv != EINVAL) { - ttymux_dprintf(DPRINT_L3, - "Failed to pop all modules: error %d", rv); - goto out; - } - - if ((rv = strioctl(mux_avp, I_PLINK, (intptr_t)lfd, - FREAD+FWRITE+FNOCTTY, K_TO_K, CRED(), &(cn->sm_muxid))) != 0) { - - ttymux_dprintf(DPRINT_L3, - "Failed to link device: error %d", rv); - goto out; - } - /* close the linked device */ - (void) closeandsetf(lfd, NULL); - /* - * Now tell the mux to associate the new stream - */ - assoc.ttymux_udev = mux_avp->v_rdev; - assoc.ttymux_ldev = cn->sm_dev; - assoc.ttymux_linkid = cn->sm_muxid; - assoc.ttymux_tag = 0; - assoc.ttymux_ioflag = cn->sm_mode; - if ((rv = ioctl_cmd(mux_avp, TTYMUX_ASSOC, - (void *)&assoc, sizeof (assoc), 0)) != 0) { - ttymux_dprintf(DPRINT_L3, - "Failed to associate %d:%d with the console\n", - getmajor(cn->sm_dev), getminor(cn->sm_dev)); - - if (strioctl(mux_avp, I_PUNLINK, (intptr_t)cn->sm_muxid, 0, - K_TO_K, CRED(), &rval) != 0) - ttymux_dprintf(DPRINT_L3, - "Can't unlink %d:%d - Closing vnode\n", - getmajor(cn->sm_dev), getminor(cn->sm_dev)); - - } - return (rv); - -out: - VOP_CLOSE(lvp, FREAD+FWRITE+FNOCTTY, 1, (offset_t)0, CRED(), NULL); - VN_RELE(lvp); - return (rv); -} - -static int -enable_aconsole(sm_mux_state_t *ms, sm_console_t *cn, vnode_t *muxvp) -{ - ttymux_assoc_t assoc; - - ASSERT(cn && cn->sm_dev != NODEV); - - assoc.ttymux_ldev = cn->sm_dev; - - cn->sm_muxid = (ioctl_cmd(muxvp, TTYMUX_GETLINK, - (void *)&assoc, sizeof (assoc), 0) == 0) ? assoc.ttymux_linkid : 0; - - if (cn->sm_muxid != 0) - return (0); /* already linked */ - else - return (link_aconsole(muxvp, cn)); -} - -/* - * Enable all discovered consoles such that they can provide real I/O. - * The discovered list is stored in the sm_mux_state_t pointer. - */ -static int -enable_all_consoles(sm_mux_state_t *ms, vnode_t *muxvp) -{ - sm_console_t *cn; - uint_t j; - - ttymux_dprintf(DPRINT_L0, "Enable %d devices\n", ms->sm_cons_cnt); - for (cn = ms->sm_cons_links, j = 0; - j < ms->sm_cons_cnt; cn++, j++) { - - if (cn->sm_path == NULL) - continue; - - if ((strstr(cn->sm_path, "/dev") == cn->sm_path && - (cn->sm_dev = fs_devtype(cn->sm_path)) == NODEV) || - (cn->sm_dev = di_devtype(cn->sm_path)) == NODEV) { - - ttymux_dprintf(DPRINT_L0, - "Cannot find a driver for device: %s\n", - cn->sm_path ? cn->sm_path : ""); - continue; - } - ttymux_dprintf(DPRINT_L0, "Enabling %d:%d\n", - getmajor(cn->sm_dev), getminor(cn->sm_dev)); - - /* - * Refuse requests to use devices as consoles which have an - * unsupported minor node type. - */ - if (compatible_console(cn->sm_dev) == B_FALSE) - continue; - - /* - * Enable a console device by linking the target console - * underneath the ttymux minor node that has been specified - * in a DACF reservation (see /etc/dacf.conf). - */ - (void) enable_aconsole(ms, cn, muxvp); - } - return (0); -} - -static int -find_consoles(sm_mux_state_t *ms, dev_info_t *dip, dev_t dev) -{ - int len; - char *propval; - char devtype[32]; - pnode_t node; - uint_t flags; - - /* - * Look for target consoles based on options node properties - */ - node = prom_optionsnode(); - if ((len = read_prop(node, INPUT_ALIAS, &propval)) > 0) { - parse(ms, propval, add_aconsole, (void *)FORINPUT); - kmem_free(propval, len + 1); - } - if ((len = read_prop(node, OUTPUT_ALIAS, &propval)) > 0) { - parse(ms, propval, add_aconsole, (void *)FOROUTPUT); - kmem_free(propval, len + 1); - } - - /* - * Look for platform specific target consoles. - * Assume that they are OBP consoles and used for both input and output. - */ - flags = (uint_t)FORIO | OBPDEV; - if ((propval = platform_consoles(ms, dip, dev, flags)) != NULL) { - parse(ms, propval, add_aconsole, (void *)(uintptr_t)flags); - kmem_free(propval, strlen(propval) + 1); - } - - /* - * Discover which consoles OBP is actually using according to - * interfaces proposed by case number FWARC/262. - */ - len = sizeof (devtype); - if (ddi_prop_op(DDI_DEV_T_ANY, dip, PROP_LEN_AND_VAL_BUF, 0, - "device_type", (caddr_t)devtype, &len) == DDI_PROP_SUCCESS && - strcmp(devtype, "serial") == 0 && - ddi_prop_exists(DDI_DEV_T_ANY, dip, 0, MUXDEVTYPE) == 1) { - - (void) find_obp_consoles(ms, FORINPUT); - (void) find_obp_consoles(ms, FOROUTPUT); - - } - ttymux_dprintf(DPRINT_L0, "%d consoles configured\n", - ms->sm_cons_cnt); - return (ms->sm_cons_cnt); -} - -static int -validate_reservation(dacf_infohdl_t di, dev_info_t **dip, dev_t *dev, - io_mode_t *mode) -{ - char *dname, *nname, *ipath, *opath; - - if ((dname = (char *)dacf_driver_name(di)) == NULL) - return (EINVAL); - - if ((*dip = dacf_devinfo_node(di)) == NULL) - return (EINVAL); - - *dev = makedevice(ddi_driver_major(*dip), dacf_minor_number(di)); - - if (*dev == NODEV || *dip == NULL || strcmp(dname, TTYMUX_DRVNAME) != 0) - return (EINVAL); - else if (getminor(*dev) != (minor_t)0) - return (EINVAL); /* minor 0 is special */ - else if (rconsvp != NULL || space_fetch(TTYMUXPTR) != NULL) - return (EAGAIN); /* already configured */ - - opath = prom_stdoutpath(); - ipath = prom_stdinpath(); - nname = ddi_node_name(*dip); - *mode = 0; - - if (ipath != NULL && strstr(ipath, nname) != 0) - *mode = FORINPUT; - if (opath != NULL && strstr(opath, nname) != 0) - *mode |= FOROUTPUT; - if ((*mode & FORIO) == 0) - return (EINVAL); - if ((*mode & FOROUTPUT) == 0) { - ttymux_dprintf(DPRINT_L3, - "Warning: multiplexer is not the output device\n"); - } - if ((*mode & FORINPUT) == 0) { - ttymux_dprintf(DPRINT_L3, - "Warning: multiplexer is not the input device\n"); - } - return (0); -} - -/* - * This operation set is for configuring the ttymux driver for use as - * the system console. - * It must run before consconfig configures the Solaris console. - */ -/*ARGSUSED*/ -static int -ttymux_config(dacf_infohdl_t info_hdl, dacf_arghdl_t arg_hdl, int flags) -{ - sm_mux_state_t *ms; - io_mode_t mode; - dev_t dev; - dev_info_t *dip; - uint_t i, icnt = 0, ocnt = 0; - int rv; - vnode_t *muxvp; - - ttymux_dprintf(DPRINT_L0, "\n"); - - if ((rv = validate_reservation(info_hdl, &dip, &dev, &mode)) != 0) { - ttymux_dprintf(DPRINT_L0, "reservation ignored (%d)\n", rv); - return (DACF_SUCCESS); - } - - ms = kmem_zalloc(sizeof (*ms), KM_SLEEP); - - mutex_init(&ms->sm_cons_mutex, NULL, MUTEX_DRIVER, NULL); - - for (i = 0; i < TTYMUX_MAX_LINKS; i++) - ms->sm_cons_links[i].sm_dev = NODEV; - - ms->sm_cons_stdin.sm_dev = ms->sm_cons_stdout.sm_dev = NODEV; - if (mode & FORINPUT) - ms->sm_cons_stdin.sm_dev = dev; - if (mode & FOROUTPUT) - ms->sm_cons_stdout.sm_dev = dev; - ms->sm_cons_stdin.sm_i_ihdl = prom_stdin_ihandle(); - ms->sm_cons_stdout.sm_o_ihdl = prom_stdout_ihandle(); - - if (prom_is_openprom()) { - pnode_t node = prom_optionsnode(); - - if (prom_getproplen(node, INPUT_ALIAS) > 0) { - ms->sm_ialias = kmem_alloc( - strlen(INPUT_ALIAS) + 1, KM_SLEEP); - (void) strcpy(ms->sm_ialias, INPUT_ALIAS); - } - if (prom_getproplen(node, OUTPUT_ALIAS) > 0) { - ms->sm_oalias = kmem_alloc( - strlen(OUTPUT_ALIAS) + 1, KM_SLEEP); - (void) strcpy(ms->sm_oalias, OUTPUT_ALIAS); - } - } - - (void) find_consoles(ms, dip, dev); - /* Store the console list for use by the ttymux driver */ - if (space_store(TTYMUXPTR, (uintptr_t)ms) != 0) { - ttymux_dprintf(DPRINT_L3, "Named pointer error\n"); - if (ms->sm_ialias) - kmem_free(ms->sm_ialias, strlen(ms->sm_ialias) + 1); - if (ms->sm_oalias) - kmem_free(ms->sm_oalias, strlen(ms->sm_oalias) + 1); - for (i = 0; i < ms->sm_cons_cnt; i++) { - sm_console_t *cn = &ms->sm_cons_links[i]; - if (cn->sm_path) - kmem_free(cn->sm_path, strlen(cn->sm_path) + 1); - } - kmem_free(ms, sizeof (*ms)); - return (DACF_FAILURE); - } - - muxvp = dacf_makevp(info_hdl); - - if ((rv = VOP_OPEN(&muxvp, OFLAGS, CRED(), NULL)) == 0) { - - (void) enable_all_consoles(ms, muxvp); - (void) usable_consoles(ms, &icnt, &ocnt); - - VOP_CLOSE(muxvp, OFLAGS, 1, (offset_t)0, CRED(), NULL); - VN_RELE(muxvp); - } else { - ttymux_dprintf(DPRINT_L3, - "Error %d opening the console device\n", rv); - VN_RELE(muxvp); - return (DACF_FAILURE); - } - - if (icnt == 0 && (mode & FORINPUT)) - ttymux_dprintf(DPRINT_L3, "No input consoles configured.\n"); - if (ocnt == 0 && (mode & FOROUTPUT)) - ttymux_dprintf(DPRINT_L3, "No output consoles configured.\n"); - - ttymux_dprintf(DPRINT_L0, "mux config complete\n"); - - return (DACF_SUCCESS); -} diff --git a/usr/src/uts/sun4u/montecarlo/io/ttymux_dacf/ttymux_dacf.h b/usr/src/uts/sun4u/montecarlo/io/ttymux_dacf/ttymux_dacf.h deleted file mode 100644 index ba0941bded..0000000000 --- a/usr/src/uts/sun4u/montecarlo/io/ttymux_dacf/ttymux_dacf.h +++ /dev/null @@ -1,54 +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) 2001 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ifndef _SYS_MUXCONFIG_H -#define _SYS_MUXCONFIG_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/ttymux.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Debug information - */ -/* - * Severity levels for printing - */ -#define DPRINT_L0 0 /* print every message */ -#define DPRINT_L1 1 /* debug */ -#define DPRINT_L2 2 /* minor errors */ -#define DPRINT_L3 3 /* major errors */ -#define DPRINT_L4 4 /* catastophic errors */ - -#ifdef __cplusplus -} -#endif - -#endif /* _SYS_MUXCONFIG_H */ diff --git a/usr/src/uts/sun4u/montecarlo/io/ttymux_dacf/ttymux_dacf_util.c b/usr/src/uts/sun4u/montecarlo/io/ttymux_dacf/ttymux_dacf_util.c deleted file mode 100644 index 943897dc81..0000000000 --- a/usr/src/uts/sun4u/montecarlo/io/ttymux_dacf/ttymux_dacf_util.c +++ /dev/null @@ -1,59 +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) 2001 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/systm.h> -#include <sys/cmn_err.h> - -#include "ttymux_dacf.h" - -int ttymux_errlevel = DPRINT_L3; - -/* - * ttymux_dprintf - * Print string to the console. - */ -void -ttymux_dprintf(int l, const char *fmt, ...) -{ - va_list ap; - -#ifndef DEBUG - if (!l) { - return; - } -#endif - if ((l) < ttymux_errlevel) { - - return; - } - - va_start(ap, fmt); - (void) vprintf(fmt, ap); - va_end(ap); -} diff --git a/usr/src/uts/sun4u/montecarlo/pcf8574_nct/Makefile b/usr/src/uts/sun4u/montecarlo/pcf8574_nct/Makefile deleted file mode 100644 index 7d0d5667c8..0000000000 --- a/usr/src/uts/sun4u/montecarlo/pcf8574_nct/Makefile +++ /dev/null @@ -1,99 +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 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -# -# This makefile drives the production of the pcf8574 driver kernel module -# -# sun4u implementation architecture dependent -# - -# -# Path to the base of the uts directory tree (usually /usr/src/uts). -# -UTSBASE = ../../.. - -# -# Define the module and object file sets. -# -MODULE = pcf8574 -OBJECTS = $(PCF8574_NCT_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(PCF8574_NCT_OBJS:%.o=$(LINTS_DIR)/%.ln) -ROOTMODULE = $(ROOT_MONTECARLO_DRV_DIR)/$(MODULE) - -# -# Include common rules. -# -include $(UTSBASE)/sun4u/montecarlo/Makefile.montecarlo - -# -# Define targets -# -ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint -INSTALL_TARGET = $(BINARY) $(ROOTMODULE) - -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) -DNORDICA_CP1500 -CERRWARN += -_gcc=-Wno-uninitialized - -# -# Turn on doubleword alignment for 64 bit registers -# -CFLAGS += -dalign - -# -# Add our depedencies to LDFLAGS -# -LDFLAGS += -dy -Nmisc/i2c_svc -Ndrv/scsb - - -# -# Default build targets. -# -.KEEP_STATE: - -def: $(DEF_DEPS) - -all: $(ALL_DEPS) - -clean: $(CLEAN_DEPS) - -clobber: $(CLOBBER_DEPS) - -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - -install: $(INSTALL_DEPS) - -LINT_LIB_DIR = $(MONTECARLO_LINT_LIB_DIR) -# -# Include common targets. -# -include $(UTSBASE)/sun4u/montecarlo/Makefile.targ diff --git a/usr/src/uts/sun4u/montecarlo/pcf8591_nct/Makefile b/usr/src/uts/sun4u/montecarlo/pcf8591_nct/Makefile deleted file mode 100644 index c962843f96..0000000000 --- a/usr/src/uts/sun4u/montecarlo/pcf8591_nct/Makefile +++ /dev/null @@ -1,97 +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 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" -# -# This makefile drives the production of the pcf8591 driver kernel module -# -# sun4u implementation architecture dependent -# - -# -# Path to the base of the uts directory tree (usually /usr/src/uts). -# -UTSBASE = ../../.. - -# -# Define the module and object file sets. -# -MODULE = pcf8591 -OBJECTS = $(PCF8591_NCT_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(PCF8591_NCT_OBJS:%.o=$(LINTS_DIR)/%.ln) -ROOTMODULE = $(ROOT_MONTECARLO_DRV_DIR)/$(MODULE) - -# -# Include common rules. -# -include $(UTSBASE)/sun4u/montecarlo/Makefile.montecarlo - -# -# Define targets -# -ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint -INSTALL_TARGET = $(BINARY) $(ROOTMODULE) - -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) - -# -# Turn on doubleword alignment for 64 bit registers -# -CFLAGS += -dalign - -# -# Add our depedencies to LDFLAGS -# -LDFLAGS += -dy -Nmisc/i2c_svc -Ndrv/scsb - -# -# Default build targets. -# -.KEEP_STATE: - -def: $(DEF_DEPS) - -all: $(ALL_DEPS) - -clean: $(CLEAN_DEPS) - -clobber: $(CLOBBER_DEPS) - -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - -install: $(INSTALL_DEPS) - -LINT_LIB_DIR = $(MONTECARLO_LINT_LIB_DIR) -# -# Include common targets. -# -include $(UTSBASE)/sun4u/montecarlo/Makefile.targ diff --git a/usr/src/uts/sun4u/montecarlo/scsb/Makefile b/usr/src/uts/sun4u/montecarlo/scsb/Makefile deleted file mode 100644 index e20ca311ff..0000000000 --- a/usr/src/uts/sun4u/montecarlo/scsb/Makefile +++ /dev/null @@ -1,103 +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 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -# -# This makefile drives the production of the scsb driver kernel module -# -# sun4u implementation architecture dependent -# - -# -# Path to the base of the uts directory tree (usually /usr/src/uts). -# -UTSBASE = ../../.. - -# -# Define the module and object file sets. -# -MODULE = scsb -OBJECTS = $(SCSB_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(SCSB_OBJS:%.o=$(LINTS_DIR)/%.ln) -ROOTMODULE = $(ROOT_MONTECARLO_DRV_DIR)/$(MODULE) -CONF_SRCDIR = $(UTSBASE)/sun4u/montecarlo/io - -# -# Include common rules. -# -include $(UTSBASE)/sun4u/montecarlo/Makefile.montecarlo - -# -# Define targets -# -ALL_TARGET = $(BINARY) $(SRC_CONFFILE) -LINT_TARGET = $(MODULE).lint -INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) - -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) -DNORDICA_CP1500 -CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-unused-variable -CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized - -# -# Turn on doubleword alignment for 64 bit registers -# -CFLAGS += -dalign - -# Add our depedencies to LDFLAGS -# -LDFLAGS += -dy -Nmisc/hpcsvc -Nmisc/i2c_svc - -# -# Default build targets. -# -.KEEP_STATE: - -def: $(DEF_DEPS) - -all: $(ALL_DEPS) - -clean: $(CLEAN_DEPS) - -clobber: $(CLOBBER_DEPS) - -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - -install: $(INSTALL_DEPS) - -LINT_LIB_DIR = $(MONTECARLO_LINT_LIB_DIR) -# -# Include common targets. -# -include $(UTSBASE)/sun4u/montecarlo/Makefile.targ diff --git a/usr/src/uts/sun4u/montecarlo/sys/Makefile b/usr/src/uts/sun4u/montecarlo/sys/Makefile deleted file mode 100644 index fbbb5168e7..0000000000 --- a/usr/src/uts/sun4u/montecarlo/sys/Makefile +++ /dev/null @@ -1,65 +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 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -UTSBASE = ../../.. - -# -# include global definitions -# -include ../Makefile.montecarlo - -# -# Override defaults. -# -FILEMODE = 644 - -HDRS= scsb_led.h - -ROOTHDRS= $(HDRS:%=$(USR_PSM_ISYS_DIR)/%) - -ROOTDIR= $(ROOT)/usr/share/src -ROOTDIRS= $(ROOTDIR)/uts $(ROOTDIR)/uts/$(PLATFORM) - -CHECKHDRS= $(HDRS:%.h=%.check) - -.KEEP_STATE: - -.PARALLEL: $(CHECKHDRS) $(ROOTHDRS) - -install_h: $(ROOTDIRS) .WAIT $(ROOTHDRS) $(ROOTLINK) - -check: $(CHECKHDRS) - -# -# install rules -# -$(USR_PSM_ISYS_DIR)/%: % $(USR_PSM_ISYS_DIR) - $(INS.file) - -$(ROOTDIRS): - $(INS.dir) - -FRC: - -include ../Makefile.targ diff --git a/usr/src/uts/sun4u/montecarlo/sys/acebus.h b/usr/src/uts/sun4u/montecarlo/sys/acebus.h deleted file mode 100644 index d5821afb4c..0000000000 --- a/usr/src/uts/sun4u/montecarlo/sys/acebus.h +++ /dev/null @@ -1,217 +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 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_ACEBUS_H -#define _SYS_ACEBUS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * driver state type: - */ -typedef enum { NEW = 0, ATTACHED, RESUMED, DETACHED, - SUSPENDED, PM_SUSPENDED } driver_state_t; - -/* - * The i86pc specific code fragments are to support the debug of "honeynut" - * and "multigrain" prototypes on i86pc platform. Most of the fragments - * deal with differences in the interrupt dispatching between the prototypes - * and the cheerio ebus. On the prototype boards, all interrupt lines are - * tied together. For this case, the nexus driver uses a common interrupt - * handler to poll all of its children. - */ -#if defined(i86pc) -#define MAX_EBUS_DEVS 6 - -/* - * ebus device interrupt info; - */ -typedef struct { - char *name; - uint_t inuse; - uint_t (*handler)(); - caddr_t arg; -} ebus_intr_slot_t; -#endif - -struct ebus_intr_map { - uint32_t ebus_phys_hi; - uint32_t ebus_phys_low; - uint32_t ebus_intr; - uint32_t intr_ctlr_nodeid; - uint32_t ino; -}; - -struct ebus_intr_map_mask { - uint32_t ebus_phys_hi; - uint32_t ebus_phys_low; - uint32_t ebus_intr; -}; - -/* - * driver soft state structure: - */ -typedef struct { - dev_info_t *dip; - driver_state_t state; - pci_regspec_t *reg; - int nreg; - struct ebus_pci_rangespec *rangep; - int range_cnt; - -#if defined(i86pc) - ddi_iblock_cookie_t iblock; - ddi_idevice_cookie_t idevice; - ebus_intr_slot_t intr_slot[MAX_EBUS_DEVS]; -#endif -#if defined(__sparc) - /* Interrupt support */ - int intr_map_size; - struct ebus_intr_map *intr_map; - struct ebus_intr_map_mask *intr_map_mask; -#endif -} ebus_devstate_t; - -/* - * definition of ebus reg spec entry: - */ -typedef struct { - uint32_t addr_hi; - uint32_t addr_low; - uint32_t size; -} ebus_regspec_t; - -/* EBUS range entry */ -struct ebus_pci_rangespec { - uint32_t ebus_phys_hi; /* Child hi range address */ - uint32_t ebus_phys_low; /* Child low range address */ - uint32_t pci_phys_hi; /* Parent hi rng addr */ - uint32_t pci_phys_mid; /* Parent mid rng addr */ - uint32_t pci_phys_low; /* Parent low rng addr */ - uint32_t rng_size; /* Range size */ -}; - -/* - * use macros for soft state and driver properties: - */ -#define get_acebus_soft_state(i) \ - ((ebus_devstate_t *)ddi_get_soft_state(per_acebus_state, (i))) - -#define alloc_acebus_soft_state(i) \ - ddi_soft_state_zalloc(per_acebus_state, (i)) - -#define free_acebus_soft_state(i) \ - ddi_soft_state_free(per_acebus_state, (i)) - - -#define getprop(dip, name, addr, intp) \ - ddi_getlongprop(DDI_DEV_T_ANY, (dip), DDI_PROP_DONTPASS, \ - (name), (caddr_t)(addr), (intp)) - -/* - * register offsets and lengths: - */ -#define TCR_OFFSET 0x710000 -#define TCR_LENGTH 12 - -#define CSR_IO_RINDEX 2 -#define CSR_SIZE 0x00800000 -#define TCR1_OFF 0x00710000 -#define TCR2_OFF 0x00710004 -#define TCR3_OFF 0x00710008 -#define PMD_AUX_OFF 0x00728000 -#define FREQ_AUX_OFF 0x0072a000 -#define DCSR1_OFF 0x00700000 -#define DACR1_OFF 0x00700004 -#define DBCR1_OFF 0x00700008 -#define DCSR2_OFF 0x00702000 -#define DACR2_OFF 0x00702004 -#define DBCR2_OFF 0x00702008 -#define DCSR3_OFF 0x00704000 -#define DACR3_OFF 0x00704004 -#define DBCR3_OFF 0x00704008 -#define DCSR4_OFF 0x00706000 -#define DACR4_OFF 0x00706004 -#define DBCR4_OFF 0x00706008 - -/* - * timing control register settings: - */ -#define TCR1 0x08101008 -#define TCR2 0x08100020 -#define TCR3 0x00000020 -#define TCR1_REGVAL 0xe3080808 -#define TCR2_REGVAL 0x0808ff20 -#define TCR3_REGVAL 0x91f3c420 - - - -#if defined(DEBUG) -#define D_IDENTIFY 0x00000001 -#define D_ATTACH 0x00000002 -#define D_DETACH 0x00000004 -#define D_MAP 0x00000008 -#define D_CTLOPS 0x00000010 -#define D_INTR 0x00000100 - -#define DBG(flag, psp, fmt) \ - acebus_debug(flag, psp, fmt, 0, 0, 0, 0, 0); -#define DBG1(flag, psp, fmt, a1) \ - acebus_debug(flag, psp, fmt, (uintptr_t)(a1), 0, 0, 0, 0); -#define DBG2(flag, psp, fmt, a1, a2) \ - acebus_debug(flag, psp, fmt, (uintptr_t)(a1), (uintptr_t)(a2), 0, 0, 0); -#define DBG3(flag, psp, fmt, a1, a2, a3) \ - acebus_debug(flag, psp, fmt, (uintptr_t)(a1), (uintptr_t)(a2), \ - (uintptr_t)(a3), 0, 0); -#define DBG4(flag, psp, fmt, a1, a2, a3, a4) \ - acebus_debug(flag, psp, fmt, (uintptr_t)(a1), (uintptr_t)(a2), \ - (uintptr_t)(a3), \ - (uintptr_t)(a4), 0); -#define DBG5(flag, psp, fmt, a1, a2, a3, a4, a5) \ - acebus_debug(flag, psp, fmt, (uintptr_t)(a1), (uintptr_t)(a2), \ - (uintptr_t)(a3), \ - (uintptr_t)(a4), (uintptr_t)(a5)); -static void -acebus_debug(uint_t, ebus_devstate_t *, char *, uintptr_t, uintptr_t, uintptr_t, - uintptr_t, uintptr_t); -#else -#define DBG(flag, psp, fmt) -#define DBG1(flag, psp, fmt, a1) -#define DBG2(flag, psp, fmt, a1, a2) -#define DBG3(flag, psp, fmt, a1, a2, a3) -#define DBG4(flag, psp, fmt, a1, a2, a3, a4) -#define DBG5(flag, psp, fmt, a1, a2, a3, a4, a5) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _SYS_ACEBUS_H */ diff --git a/usr/src/uts/sun4u/montecarlo/sys/hsc.h b/usr/src/uts/sun4u/montecarlo/sys/hsc.h deleted file mode 100644 index 87e9f20f4d..0000000000 --- a/usr/src/uts/sun4u/montecarlo/sys/hsc.h +++ /dev/null @@ -1,60 +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-2000 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ifndef _MONTECARLO_SYS_HSC_H -#define _MONTECARLO_SYS_HSC_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * These functions serve as the interface between the SCSB and the HSC - */ -int hsc_slot_occupancy(int, boolean_t, int, int); -int hsc_board_healthy(int slot_number, boolean_t healthy); -int hsc_init(); -int hsc_fini(); -void hsc_ac_op(); -int scsb_hsc_attach(dev_info_t *, void *, int); -int scsb_hsc_detach(dev_info_t *, void *, int); -int scsb_get_slot_state(); -int scsb_reset_slot(); -int scsb_connect_slot(); -int scsb_disconnect_slot(); -int scsb_hsc_ac_op(); -int scsb_hsc_freeze(dev_info_t *); -int scsb_hsc_restore(dev_info_t *); -int scsb_hsc_freeze_check(dev_info_t *); - - -#ifdef __cplusplus -} -#endif - -#endif /* _MONTECARLO_SYS_HSC_H */ diff --git a/usr/src/uts/sun4u/montecarlo/sys/hscimpl.h b/usr/src/uts/sun4u/montecarlo/sys/hscimpl.h deleted file mode 100644 index c5599fa893..0000000000 --- a/usr/src/uts/sun4u/montecarlo/sys/hscimpl.h +++ /dev/null @@ -1,148 +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-2000 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ifndef _MONTECARLO_SYS_HSCIMPL_H -#define _MONTECARLO_SYS_HSCIMPL_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/types.h> -#include <sys/hotplug/hpctrl.h> - -/* - * Flag values - */ -#define HSC_ENABLED 0x1 /* if not enabled, slot unmanaged */ -#define HSC_AUTOCFG 0x2 /* if set, ENUM# events will be sent */ -#define HSC_REGISTERED HSC_ENABLED -#define HSC_ALARM_CARD_PRES 0x4 /* Alarm Card on this slot */ -#define HSC_BOARD_TYPE_HS 0x8 -#define HSC_BOARD_TYPE_UNKNOWN 0x10 -#define HSC_SLOT_ENABLED 0x20 -#define HSC_SLOT_BAD_STATE 0x40 /* Surprise Removal on this slot */ -#define HSC_ENUM_FAILED 0x80 /* Could not Enumerate this slot */ -#define HSC_SCB_HOTSWAPPED 0x100 /* slot status change due to SCB swap */ -#define HSC_HOTSWAP_MODE_BASIC 0 -#define HSC_HOTSWAP_MODE_FULL 1 - - -typedef struct hsc_slot_state { - int pslotnum; - int state; -} hsc_slot_state_t; - -typedef struct hsc_slot_table { - char nexus[128]; - int pci_devno; - int pslotnum; - int ga; -} hsc_slot_table_t; - -typedef struct hsc_prom_slot_table { - int phandle; - int pci_devno; - int pslotnum; - int ga; -} hsc_prom_slot_table_t; - -typedef struct hsc_state { - int instance; - int state; - dev_info_t *dip; - void *scsb_handle; - struct hsc_slot *hsp_last; /* last board plugged in. */ - hsc_slot_table_t *slot_table_prop; - int slot_table_size; - int hsc_intr_counter; - kmutex_t hsc_mutex; - ddi_iblock_cookie_t enum_iblock; - boolean_t regDone; - int n_registered_occupants; - int hotswap_mode; -} hsc_state_t; - -/* - * This struct describes a HS slot known to us. It maintains - * all the state associated with the slot. - * Slots are placed on a linked list. - */ -typedef struct hsc_slot { - struct hsc_slot *hs_next; - - void *hs_hpchandle; /* HPC (scsb) handle */ - - /* - * The hs_slot_number identifies the plysical slot. - * It should match with the documentation. - */ - int hs_slot_number; - - hpc_slot_info_t hs_info; - - hpc_board_type_t hs_board_type; - /* - * We only have 2 LEDs/slot on MonteCarlo, so we map them - * to the ACTIVE and FAULT ones. - * ACTIVE will be set when a board is in the slot, and has - * been configured. - */ - hpc_led_state_t hs_active_led_state; - hpc_led_state_t hs_fault_led_state; - - /* - * hs_slot_handle is useful for supporting ENUM# - * (when we need to inform the nexus of the event). - */ - hpc_slot_t hs_slot_handle; - - uint_t hs_flags; - - boolean_t hs_board_configured; - boolean_t hs_board_configuring; - boolean_t hs_board_unconfiguring; - boolean_t hs_board_healthy; - - /* - * The hs_slot_state is useful for HW-connection control - */ - hpc_slot_state_t hs_slot_state; - hsc_state_t *hsc; /* pointer to our controller device */ -} hsc_slot_t; - -/* state values in our control structure */ -#define HSC_ENUM_ENABLED 1 -#define HSC_ATTACHED 2 -#define HSC_SCB_CONNECTED 4 - -#ifdef __cplusplus -} -#endif - -#endif /* _MONTECARLO_SYS_HSCIMPL_H */ diff --git a/usr/src/uts/sun4u/montecarlo/sys/mct_topology.h b/usr/src/uts/sun4u/montecarlo/sys/mct_topology.h deleted file mode 100644 index 205e2e608f..0000000000 --- a/usr/src/uts/sun4u/montecarlo/sys/mct_topology.h +++ /dev/null @@ -1,303 +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, 2000 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ifndef _MONTECARLO_SYS_MCT_TOPOLOGY_H -#define _MONTECARLO_SYS_MCT_TOPOLOGY_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * mct_topology.h - * MonteCarlo / Tonga topology structures and types for the scsb driver - * and its kstat structure "env_topology", to be available to applications - * like envmond and snmp agents. - */ -/* - * SCB information also defined in scsb.h, which file is not available to - * applications. - */ -#define SCB_P10_NOK_LED_REGS 4 -#define SCB_P10_OK_LED_REGS 4 -#define SCB_P10_BLINK_LED_REGS 2 -#define SCB_P10_LED_REGS 10 -#define SCB_P15_NOK_LED_REGS 3 -#define SCB_P15_OK_LED_REGS 3 -#define SCB_P15_BLINK_LED_REGS 3 -#define SCB_P15_LED_REGS 9 - -/* Save this existing definition, but use it as the MAX */ -#define SCSB_LEDDATA_REGISTERS SCB_P10_LED_REGS - -#define MC_MAX_SLOTS 8 /* CPU, ALRM, cPCI Slots */ -#define MC_MAX_FAN 2 -#define MC_MAX_PDU 2 -#define MC_MAX_PS 2 -#define MC_MAX_DISK 3 -#define MC_MAX_SCB 1 -#define MC_MAX_AC 1 -#define MC_MAX_CFTM 1 -#define MC_MAX_CRTM 1 -#define MC_MAX_PRTM 1 - -#define TG_MAX_SLOTS 5 /* CPU, ALRM, cPCI Slots */ -#define TG_MAX_FAN 2 -#define TG_MAX_PS 1 -#define TG_MAX_PDU 1 -#define TG_MAX_DISK 1 -#define TG_MAX_SCB 1 -#define TG_MAX_AC 1 -#define TG_MAX_CFTM 1 -#define TG_MAX_CRTM 1 -#define TG_MAX_PRTM 1 - -/* - * Maximum number of FRUs in MCT systems, - * used for sizeof fru_id_table[] and index check - */ -#define MCT_MAX_FRUS 32 - -/* - * The I2C addresses of System I2C devices - * from "MonteCarlo: Programming Interface Specifications" Version 0.9 - */ -#define MCT_I2C_CPUPWR 0x72 -#define MCT_I2C_FAN1 0x74 -#define MCT_I2C_FAN2 0x76 -#define MCT_I2C_FAN3 0x78 -#define MCT_I2C_PS1 0x7c -#define MCT_I2C_PS2 0x7e -#define MCT_I2C_SCB 0x80 -#define MCT_I2C_CPUTEMP 0x9e - -/* - * CFG1_MPID masks - */ -#define SCTRL_MPID_MASK 0xf -#define SCTRL_MPID_HALF 0x0 -#define SCTRL_MPID_QUARTER 0x1 -#define SCTRL_MPID_QUARTER_NODSK 0x3 - -/* - * Interrupt Event Codes - * Also used by "scsb" to locate fruid_table index, - * so the order is very important. - */ -#define SCTRL_EVENT_NONE 0x0000 -#define SCTRL_EVENT_SLOT1 0x00000001 -#define SCTRL_EVENT_SLOT2 0x00000002 -#define SCTRL_EVENT_SLOT3 0x00000004 -#define SCTRL_EVENT_SLOT4 0x00000008 -#define SCTRL_EVENT_SLOT5 0x00000010 -#define SCTRL_EVENT_SLOT6 0x00000020 -#define SCTRL_EVENT_SLOT7 0x00000040 -#define SCTRL_EVENT_SLOT8 0x00000080 -#define SCTRL_EVENT_SLOT9 0x00000100 -#define SCTRL_EVENT_SLOT10 0x00000200 -#define SCTRL_EVENT_PDU1 0x00000400 -#define SCTRL_EVENT_PDU2 0x00000800 -#define SCTRL_EVENT_PS1 0x00001000 -#define SCTRL_EVENT_PS2 0x00002000 -#define SCTRL_EVENT_DISK1 0x00004000 -#define SCTRL_EVENT_DISK2 0x00008000 -#define SCTRL_EVENT_DISK3 0x00010000 -#define SCTRL_EVENT_FAN1 0x00020000 -#define SCTRL_EVENT_FAN2 0x00040000 -#define SCTRL_EVENT_FAN3 0x00080000 -#define SCTRL_EVENT_ALARM 0x00100000 -#define SCTRL_EVENT_SCB 0x00200000 -#define SCTRL_EVENT_SSB 0x00400000 -#define SCTRL_EVENT_CRTM 0x00800000 -#define SCTRL_EVENT_CFTM 0x01000000 -#define SCTRL_EVENT_PRTM 0x02000000 -#define SCTRL_EVENT_PWRDWN 0x04000000 -#define SCTRL_EVENT_REPLACE 0x08000000 -#define SCTRL_EVENT_ALARM_INT 0x10000000 -#define SCTRL_EVENT_ALARM_INSERTION 0x20000000 -#define SCTRL_EVENT_ALARM_REMOVAL 0x40000000 -#define SCTRL_EVENT_OTHER 0x80000000 - - - -typedef uchar_t topo_id_t; -typedef uchar_t fru_id_t; -typedef uint16_t fru_version_t; -typedef uint16_t fru_max_t; -typedef uint16_t scsb_unum_t; - -typedef enum { - MCT_HEALTH_NA = 0, - MCT_HEALTH_OK = 1, - MCT_HEALTH_NOK = 2 -} fru_health_t; - -/* - * Known MC/Tg Slot occupants, and UNKN for unknown - * NOTE: the CTC occupant is the CFTM FRU type on MonteCarlo - */ -typedef enum { - OC_UNKN = 0, - OC_CPU = 1, - OC_AC = 2, - OC_BHS = 3, - OC_FHS = 4, - OC_HAHS = 5, - OC_QFE = 6, - OC_FRCH = 7, - OC_COMBO = 8, - OC_PMC = 9, - OC_ATM = 10, - OC_CTC = 11 -} mct_slot_occupant_t; - -typedef enum { - SLOT = 0, - PDU = 1, - PS = 2, - DISK = 3, - FAN = 4, - ALARM = 5, - SCB = 6, - SSB = 7, - CFTM = 8, - CRTM = 9, - PRTM = 10, - MIDPLANE = 11 -} scsb_utype_t; - -#define SCSB_UNIT_TYPES 11 /* w/o MIDPLANE */ - -typedef enum scsb_fru_status { - FRU_NOT_PRESENT, - FRU_PRESENT, - FRU_NOT_AVAILABLE -} scsb_fru_status_t; - -typedef enum { - SWAP_NOT, SWAP_BASIC, SWAP_FULL, SWAP_HA -} cpci_swap_type_t; - -typedef struct fru_options { - char *board_name; - cpci_swap_type_t swap_type; - struct fru_options *next; -} fru_options_t; - -typedef struct fru_i2c_info { - uchar_t syscfg_reg; - uchar_t syscfg_bit; - uchar_t ledata_reg; - uchar_t ledata_bit; - uchar_t blink_reg; - uchar_t blink_bit; -} fru_i2c_info_t; - -typedef struct fru_info { - scsb_fru_status_t fru_status; /* FRU present status */ - scsb_unum_t fru_unit; /* FRU external unit number */ - scsb_utype_t fru_type; /* also an index to FRU lists */ - fru_id_t fru_id; /* I2C address, SCSIID, Slot Num */ - fru_version_t fru_version; /* version number where possible */ - fru_options_t *type_list; /* list of possible boards for slots */ - fru_i2c_info_t *i2c_info; /* for I2C devices */ - struct fru_info *next; -} fru_info_t; - -struct system_info { - fru_info_t mid_plane; /* one always present */ - fru_max_t max_units[SCSB_UNIT_TYPES]; - fru_info_t *fru_info_list[SCSB_UNIT_TYPES]; -}; - -/* - * scsb kstat types - */ -#define SCSB_KS_LEDDATA "scsb_leddata" -#define SCSB_KS_STATE "scsb_state" -#define SCSB_KS_EVC_REGISTER "scsb_evc_register" -#define SCSB_KS_TOPOLOGY "env_topology" - -typedef struct ks_fru_info { - scsb_fru_status_t fru_status; /* FRU presence/availability status */ - scsb_unum_t fru_unit; /* FRU external unit number */ - scsb_utype_t fru_type; /* and occupant type for solts */ - fru_id_t fru_id; /* I2C address, SCSIID, Slot Num */ - fru_version_t fru_version; /* version number where possible */ - fru_health_t fru_health; /* From NOK LED, if available */ -} ks_fru_info_t; - -typedef union scsb_leddata { - uchar_t scb_led_regs[SCSB_LEDDATA_REGISTERS]; - union { - struct { - uchar_t nok_leds[SCB_P10_NOK_LED_REGS]; - uchar_t ok_leds[SCB_P10_OK_LED_REGS]; - uchar_t blink_leds[SCB_P10_BLINK_LED_REGS]; - } p10; - struct { - uchar_t nok_leds[SCB_P15_NOK_LED_REGS]; - uchar_t ok_leds[SCB_P15_OK_LED_REGS]; - uchar_t blink_leds[SCB_P15_BLINK_LED_REGS]; - } p15; - } leds; -} scsb_ks_leddata_t; - -typedef struct { - uint8_t scb_present; /* SCB is present */ - uint8_t ssb_present; /* SSB is present */ - uint8_t scsb_frozen; /* SCB swap state */ - uint8_t scsb_mode; /* driver access mode */ - uint8_t unused_1; - uint8_t unused_2; - uint8_t unused_3; - uint8_t unused_4; - uint32_t event_code; /* event code bit map */ -} scsb_ks_state_t; - -typedef struct { - ks_fru_info_t mid_plane; - fru_max_t max_units[SCSB_UNIT_TYPES]; - ks_fru_info_t mct_slots[MC_MAX_SLOTS]; - ks_fru_info_t mct_pdu[MC_MAX_PDU]; - ks_fru_info_t mct_ps[MC_MAX_PS]; - ks_fru_info_t mct_disk[MC_MAX_DISK]; - ks_fru_info_t mct_fan[MC_MAX_FAN]; - ks_fru_info_t mct_scb[MC_MAX_SCB]; - ks_fru_info_t mct_ssb[MC_MAX_SCB]; - ks_fru_info_t mct_alarm[MC_MAX_AC]; - ks_fru_info_t mct_cftm[MC_MAX_CFTM]; - ks_fru_info_t mct_crtm[MC_MAX_CRTM]; - ks_fru_info_t mct_prtm[MC_MAX_PRTM]; -} mct_topology_t; - -#ifdef __cplusplus -} -#endif - -#endif /* _MONTECARLO_SYS_MCT_TOPOLOGY_H */ diff --git a/usr/src/uts/sun4u/montecarlo/sys/netract_gen.h b/usr/src/uts/sun4u/montecarlo/sys/netract_gen.h deleted file mode 100644 index 501ed20fd7..0000000000 --- a/usr/src/uts/sun4u/montecarlo/sys/netract_gen.h +++ /dev/null @@ -1,80 +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, 2000 by Sun Microsystems, Inc. - * All rights reserved. - */ - -/* - * MonteCarlo's Common I2C Driver Definitions - * - * These definitions are derived from, or the same as, - * some of the definitions from sun4u/sys/envctrl_gen.h, - * which are common definitions for workgroup server platforms. - */ - -#ifndef _SYS_NETRACT_GEN_H -#define _SYS_NETRACT_GEN_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifndef _SYS_ENVCTRL_GEN_H -#define _SYS_ENVCTRL_GEN_H - -#define ENVCTRL_NORMAL_MODE 0x01 -#define ENVCTRL_DIAG_MODE 0x02 -#define ENVC_DEBUG_MODE 0x03 - -/* - * Max number of a particular - * device on one bus. - */ -#define ENVCTRL_MAX_DEVS 0x10 -#define ENVCTRL_I2C_NODEV 0xFF -#define ENVCTRL_INSTANCE_0 0x00 - -/* - * Kstat structure definitions (PSARC 1996/159) - */ -typedef struct envctrl_fan { - int instance; /* instance of this type */ - int type; /* CPU, PS or AMBIENT fan */ - boolean_t fans_ok; /* are the fans okay */ - int fanflt_num; /* if not okay, which fan faulted */ - uint_t fanspeed; /* chip to set speed of fans */ -} envctrl_fan_t; - -#endif /* _SYS_ENVCTRL_GEN_H */ - -#define ENVC_IOC_SETMODE (int)(_IOW('p', 77, uchar_t)) -#define ENVC_IOC_GETMODE (int)(_IOR('p', 87, uchar_t)) - -#ifdef __cplusplus -} -#endif - -#endif /* _SYS_NETRACT_GEN_H */ diff --git a/usr/src/uts/sun4u/montecarlo/sys/pcf8574_nct.h b/usr/src/uts/sun4u/montecarlo/sys/pcf8574_nct.h deleted file mode 100644 index c915b47d57..0000000000 --- a/usr/src/uts/sun4u/montecarlo/sys/pcf8574_nct.h +++ /dev/null @@ -1,328 +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-2001 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ifndef _PCF8574_H -#define _PCF8574_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#define PCF8574_NODE_TYPE "adc_i2c:gpio" -#define I2C_PCF8574_NAME "gpio" - -#define I2C_KSTAT_CPUVOLTAGE "gpio_cpuvoltage" -#define I2C_KSTAT_PWRSUPPLY "gpio_pwrsupply" -#define I2C_KSTAT_FANTRAY "gpio_fantray" - -/* - * PCF8574 ioctls for fantray and powersupplies. - */ - -#define ENVC_IOC_GETTEMP 0x10 -#define ENVC_IOC_SETFAN 0x11 -#define ENVC_IOC_GETFAN 0x12 -#define ENVC_IOC_GETSTATUS 0x15 -#define ENVC_IOC_GETTYPE 0x16 -#define ENVC_IOC_GETFAULT 0x17 -#define ENVC_IOC_PSTEMPOK 0x18 -#define ENVC_IOC_PSFANOK 0x1A -#define ENVC_IOC_PSONOFF 0x1B -#define ENVC_IOC_SETSTATUS 0x1C - -#define ENVC_IOC_INTRMASK 0x1D - -#define ENVCTRL_INTRMASK_SET 1 -#define ENVCTRL_INTRMASK_CLEAR 0 - -#define ENVCTRL_FANSPEED_LOW 0 -#define ENVCTRL_FANSPEED_HIGH 1 - -/* - * Could not find a definition for CPU voltage monitoring in Javelin - * Code. So writing a structure here. - */ - -typedef struct envctrl_cpuvoltage { - int value; -} envctrl_cpuvoltage_t; - -/* - * ps_present and fan_present fields modified for FRU callback and status - * See sys/scsb_cbi.h and definitions in scsb.c - */ -typedef struct envctrl_pwrsupply { - scsb_fru_status_t ps_present; /* Is powersupply present */ - boolean_t ps_ok; /* Is powersupply ok */ - boolean_t temp_ok; /* Is temperature ok */ - boolean_t psfan_ok; /* Is fan ok */ - boolean_t on_state; /* Powersupply on/off */ - int ps_ver; /* Pwr supply version and type */ -} envctrl_pwrsupp_t; - -typedef struct envctrl_fantray { - scsb_fru_status_t fan_present; /* fan1 present */ - boolean_t fan_ok; /* fan1 ok */ - boolean_t fanspeed; /* to set speed, input */ - int fan_ver; /* Fan version and type */ -} envctrl_fantray_t; - -#ifdef _KERNEL - -#ifndef I2CDEV_TRAN -#define I2CDEV_TRAN 1 -#endif - -#define PCF8574_MAX_DEVS 0x08 -#define PCF8574_MAX_CHANS 0x01 -#define PCF8574_BUSY 0x01 -#define PCF8574_NAMELEN 12 -#define PCF8574_INTR_ON 0x1 -#define PCF8574_INTR_ENABLED 0x2 - -#define PCF8574_MINOR_TO_DEVINST(x) (((x) & 0x700) >> 8) -#define PCF8574_MINOR_TO_CHANNEL(x) ((x) & 0x3) - -#define PCF8574_CHANNEL_TO_MINOR(x) ((x) & 0x3) -#define PCF8574_DEVINST_TO_MINOR(x) ((x) << 8) - - -#define PCF8574_TRAN_SIZE 1 -#ifndef PCF8574 -#define PCF8574 0 -#endif - -#ifndef PCF8574A -#define PCF8574A 1 -#endif - -#define PCF8574_SET ('A' << 8) -#define PCF8574_GET ('B' << 8) - -#define NUM_OF_PCF8574_DEVICES 8 -#define PCF8574_MAXPORTS 8 - -#define PCF8574_TYPE_CPUVOLTAGE 0 -#define PCF8574_TYPE_FANTRAY 1 -#define PCF8574_TYPE_PWRSUPP 2 - -#define PCF8574_ADR_CPUVOLTAGE 0x70 -#define PCF8574_ADR_PWRSUPPLY1 0x7C -#define PCF8574_ADR_PWRSUPPLY2 0x7E -#define PCF8574_ADR_FANTRAY1 0x74 -#define PCF8574_ADR_FANTRAY2 0x76 - -/* - * PCF8574 Fan Fail, Power Supply Fail Detector - * This device is driven by interrupts. Each time it interrupts - * you must look at the CSR to see which ports caused the interrupt - * they are indicated by a 1. - * - * Address map of this chip - * - * ------------------------------------------- - * | 0 | 1 | 1 | 1 | A2 | A1 | A0 | 0 | - * ------------------------------------------- - * - */ -#define I2C_PCF8574_PORT0 0x01 -#define I2C_PCF8574_PORT1 0x02 -#define I2C_PCF8574_PORT2 0x04 -#define I2C_PCF8574_PORT3 0x08 -#define I2C_PCF8574_PORT4 0x10 -#define I2C_PCF8574_PORT5 0x20 -#define I2C_PCF8574_PORT6 0x40 -#define I2C_PCF8574_PORT7 0x80 - -#define MAX_WLEN 64 -#define MAX_RLEN 64 - -/* - * Following property information taken from the - * "SPARCengine ASM Reference Manual" - * Property pointers are to DDI allocated space - * which must be freed in the detach() routine. - */ -/* - * for pcf8574_properties_t.channels_in_use->io_dir - */ -#define I2C_PROP_IODIR_IN 0 -#define I2C_PROP_IODIR_OUT 1 -#define I2C_PROP_IODIR_INOUT 2 - -/* - * for pcf8574_properties_t.channels_in_use->type - */ -#define I2C_PROP_TYPE_NOCARE 0 -#define I2C_PROP_TYPE_TEMP 1 -#define I2C_PROP_TYPE_VOLT 2 -#define I2C_PROP_TYPE_FANSTATS 3 -#define I2C_PROP_TYPE_FANSPEED 4 - -/* - * These are now defined in sys/netract_gen.h - * - * #define ENVC_IOC_GETMODE 0x1C - * #define ENVC_IOC_SETMODE 0x1D - */ - - -/* - * Bit positions for the pcf8574 registers. - */ - -#define PCF8574_PS_TYPE(X) ((X) & 0x3) -#define PCF8574_PS_INTMASK(X) (((X) >> 2) & 0x1) -#define PCF8574_PS_ONOFF(X) (((X) >> 3)& 0x1) -#define PCF8574_PS_FANOK(X) (((X) >> 4) & 0x1) -#define PCF8574_PS_TEMPOK(X) (((X) >> 6) & 0x1) -#define PCF8574_PS_FAULT(X) (((X) >> 7) & 0x1) - -#define PCF8574_FAN_TYPE(X) ((X) & 0x3) -#define PCF8574_FAN_INTMASK(X) (((X) >> 2) & 0x1) -#define PCF8574_FAN_FANSPD(X) (((X) >> 3) & 0x1) -#define PCF8574_FAN_FAULT(X) (((X) >> 7) & 0x1) - -/* Constructs the reg byte from bit value */ -#define PCF8574_FAN_SPEED(bit) ((bit) << 3) -#define PCF8574_INT_MASK(bit) ((bit) << 2) - -/* - * To tell the write_chip routine which bits to modify, a - * 1 in the corresponding position selects that bit for - * writing, a 0 ignores it. - */ -#define PCF8574_FANSPEED_BIT 0x08 -#define PCF8574_INTRMASK_BIT 0x04 - -/* - * Read and write masks for the fan and power supply. - * These masks indicate which ports attached to the - * PCF8574/A are input/output. We should construct the - * read and writemasks from the channels-in-use property - * for each pcf8574 device. In case the property is - * absent, we can assign them with these default values. - * While writing to the chip, we must or with the readmask, - * else that port will be disabled. - */ - -#define PCF8574_FAN_WRITEMASK 0x0c -#define PCF8574_FAN_READMASK 0xff -#define PCF8574_PS_WRITEMASK 0x04 -#define PCF8574_PS_READMASK 0xff -#define PCF8584_CPUVOLTAGE_WRITEMASK 0x88 -#define PCF8584_CPUVOLTAGE_READMASK 0x41 - -/* - * Default values of the Fan and PS registers. - * interrupt enabled. - */ -#define PCF8574_FAN_DEFAULT 0xfb -#define PCF8574_PS_DEFAULT 0xfb - -#define PCF8574_FAN_MASKINTR 0x04 - -#define PCF8574_PS_MASKINTR 0x04 - -#define PCF8574_FAN_SPEED60 0x00 -#define PCF8574_FAN_SPEED100 0x80 - -#define PCF8574_NUM_FANTRAY 2 -#define PCF8574_NUM_PWRSUPP 2 - -#define PCF8574_FAN_SPEED_LOW 0 -#define PCF8574_FAN_SPEED_HIGH 1 - -/* - * Stage of attachment. - */ -#define PCF8574_SOFT_STATE_ALLOC 0x0001 -#define PCF8574_PROPS_READ 0x0002 -#define PCF8574_MINORS_CREATED 0x0004 -#define PCF8574_ALLOC_TRANSFER 0x0008 -#define PCF8574_REGISTER_CLIENT 0x0010 -#define PCF8574_LOCK_INIT 0x0020 -#define PCF8574_INTR_MUTEX 0x0040 -#define PCF8574_INTR_ADDED 0x0080 -#define PCF8574_KSTAT_INIT 0x0100 - -/* - * PCF8574 ioctls for CPU Voltage (Nordica). - */ - - -typedef struct { - uint8_t port; - uint8_t io_dir; - uint8_t type; - uint8_t last_data; /* N/A */ -} pcf8574_channel_t; - -typedef struct { - char *name; - uint16_t i2c_bus; - uint16_t slave_address; - uint_t num_chans_used; - char **channels_description; - pcf8574_channel_t *channels_in_use; -} pcf8574_properties_t; - -struct pcf8574_unit { - kmutex_t umutex; - int instance; - dev_info_t *dip; - kcondvar_t pcf8574_cv; - i2c_transfer_t *i2c_tran; - i2c_client_hdl_t pcf8574_hdl; - char pcf8574_name[PCF8574_NAMELEN]; - pcf8574_properties_t props; - uint8_t pcf8574_flags; - int pcf8574_oflag; - uint8_t readmask; - uint8_t writemask; - ddi_iblock_cookie_t iblock; - kmutex_t intr_mutex; - uint8_t pcf8574_canintr; - void *envctrl_kstat; - uint8_t current_mode; - int sensor_type; - int pcf8574_type; - struct pollhead poll; - int poll_event; - uint_t attach_flag; - kstat_t *kstatp; - int i2c_status; -}; - -#endif /* _KERNEL */ - -#ifdef __cplusplus -} -#endif - -#endif /* _PCF8574_H */ diff --git a/usr/src/uts/sun4u/montecarlo/sys/pcf8591_nct.h b/usr/src/uts/sun4u/montecarlo/sys/pcf8591_nct.h deleted file mode 100644 index da67a5368d..0000000000 --- a/usr/src/uts/sun4u/montecarlo/sys/pcf8591_nct.h +++ /dev/null @@ -1,220 +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-2000 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ifndef _PCF8591_H -#define _PCF8591_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * PCF8591 Chip Used for temperature sensors - * - * Addressing Register definition. - * A0-A2 valid range is 0-7 - * - * ------------------------------------------------ - * | 1 | 0 | 0 | 1 | A2 | A1 | A0 | R/W | - * ------------------------------------------------ - */ - -#define PCF8591_MAX_DEVS 0x08 -#define PCF8591_MAX_CHANS 0x04 -#define PCF8591_BUSY 0x01 -#define PCF8591_NAMELEN 12 - -#define PCF8591_MINOR_TO_DEVINST(x) (((x) & 0x700) >> 8) -#define PCF8591_MINOR_TO_CHANNEL(x) ((x) & 0x3) - -#define PCF8591_CHANNEL_TO_MINOR(x) ((x) & 0x3) -#define PCF8591_DEVINST_TO_MINOR(x) ((x) << 8) -#define PCF8591_MINOR_NUM(i, c) (((i) << 8)|((c) & 0x3)) - -#define PCF8591_NODE_TYPE "ddi_i2c:adc" - -#define PCF8591_TRAN_SIZE 1 -#define I2C_PCF8591_NAME "adc-dac" -#define I2C_KSTAT_CPUTEMP "adc_temp" -#define I2C_TYPE_PCF8591 0 - -#define ENVC_NETRACT_CPU_SENSOR 0 - -#define I2C_DEV0 0x00 -#define I2C_DEV1 0x02 -#define I2C_DEV2 0x04 -#define I2C_DEV3 0x06 -#define I2C_DEV4 0x08 -#define I2C_DEV5 0x0A -#define I2C_DEV6 0x0C -#define I2C_DEV7 0x0E - -#define MAX_WLEN 64 -#define MAX_RLEN 64 - -#ifndef I2CDEV_TRAN -#define I2CDEV_TRAN 1 -#endif -#define I2CDEV_GETTEMP 82 -#define I2CDEV_GETTABLES 256 - -#define ENVC_IOC_GETTEMP 0x10 -/* - * These are now defined in sys/netract_gen.h - * - * #define ENVC_IOC_GETMODE 0x1C - * #define ENVC_IOC_SETMODE 0x1D - */ - -/* - * CONTROL OF CHIP - * PCF8591 Temp sensing control register definitions - * - * --------------------------------------------- - * | 0 | AOE | X | X | 0 | AIF | X | X | - * --------------------------------------------- - * AOE = Analog out enable.. not used on out implementation - * 5 & 4 = Analog Input Programming.. see data sheet for bits.. - * - * AIF = Auto increment flag - * bits 1 & 0 are for the Channel number. - */ - -/* - * We should be able to select the alalog input - * programming of our choice. By default, the - * alanog input programming is set to Single - * ended. The programmer can issue an ioctl to - * set the input programming mode. We will set - * the auto increment flag set to off, so the lower - * nibble in the control byte will be set to the - * channel number. - */ - -#define PCF8591_4SINGLE 0x00 /* 4 single ended inputs */ -#define PCF8591_3DIFF 0x10 /* 3 differential inputs */ -#define PCF8591_MIXED 0x20 /* single ended and diff mixed */ -#define PCF8591_2DIFF 0x30 /* 2 differential inputs */ - -#define PCF8591_WARNING_TEMP 0x0 -#define PCF8591_SHUTDOWN_TEMP 0x3 - -#define PCF8591_ANALOG_OUTPUT_EN 0x40 -#define PCF8591_ANALOG_INPUT_EN 0x00 -#define PCF8591_READ_BIT 0x01 - - -#define PCF8591_AUTO_INCR 0x04 -#define PCF8591_OSCILATOR 0x40 - -#define PCF8591_CH_0 0x00 -#define PCF8591_CH_1 0x01 -#define PCF8591_CH_2 0x02 -#define PCF8591_CH_3 0x03 - -/* - * Stage of attachment. - */ -#define PCF8591_SOFT_STATE_ALLOC 0x0001 -#define PCF8591_PROPS_READ 0x0002 -#define PCF8591_MINORS_CREATED 0x0004 -#define PCF8591_ALLOC_TRANSFER 0x0008 -#define PCF8591_REGISTER_CLIENT 0x0010 -#define PCF8591_LOCK_INIT 0x0020 -#define PCF8591_KSTAT_INIT 0x0040 - -#define MAX_REGS_8591 2 - -struct pcf8591 { - unsigned int reg_num; - unsigned int reg_value; -}; - -/* - * Following property information taken from the - * "SPARCengine ASM Reference Manual" - * Property pointers are to DDI allocated space - * which must be freed in the detach() routine. - */ - -/* - * for pcf8591_properties_t.channels_in_use->io_dir - */ -#define I2C_PROP_IODIR_IN 0 -#define I2C_PROP_IODIR_OUT 1 -#define I2C_PROP_IODIR_INOUT 2 - -/* - * for pcf8591_properties_t.channels_in_use->type - */ -#define I2C_PROP_TYPE_NOCARE 0 -#define I2C_PROP_TYPE_TEMP 1 -#define I2C_PROP_TYPE_VOLT 2 -#define I2C_PROP_TYPE_FANSTATS 3 -#define I2C_PROP_TYPE_FANSPEED 4 - -typedef struct { - uint8_t port; - uint8_t io_dir; - uint8_t type; - uint8_t last_data; -} pcf8591_channel_t; - -typedef struct { - char *name; - uint16_t i2c_bus; - uint16_t slave_address; - uint_t num_chans_used; - char **channels_description; - pcf8591_channel_t *channels_in_use; -} pcf8591_properties_t; - -struct pcf8591_unit { - int instance; - kmutex_t umutex; - dev_info_t *dip; - kcondvar_t pcf8591_cv; - uint8_t pcf8591_flags; - uint8_t pcf8591_inprog; - struct envctrl_temp temp_kstats; - kstat_t *tempksp; - uint_t attach_flag; - int pcf8591_oflag[PCF8591_MAX_CHANS]; - i2c_transfer_t *i2c_tran; - i2c_client_hdl_t pcf8591_hdl; - char pcf8591_name[PCF8591_NAMELEN]; - uint8_t current_mode; - uint8_t readmask; - pcf8591_properties_t props; /* device properties */ -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _PCF8591_H */ diff --git a/usr/src/uts/sun4u/montecarlo/sys/scsb.h b/usr/src/uts/sun4u/montecarlo/sys/scsb.h deleted file mode 100644 index 0a5efaaa51..0000000000 --- a/usr/src/uts/sun4u/montecarlo/sys/scsb.h +++ /dev/null @@ -1,711 +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 2001 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _MONTECARLO_SYS_SCSB_H -#define _MONTECARLO_SYS_SCSB_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef _KERNEL -#include <sys/inttypes.h> -#include <sys/i2c/misc/i2c_svc.h> -#include <sys/ksynch.h> -#endif /* _KERNEL */ - -/* - * CPU and AlarmCard slots - * MonteCarlo: CPU = SLOT1, AC = SLOT8 - * Tonga: CPU = SLOT3, AC = SLOT1 - */ -#define SC_MC_CPU_SLOT 1 -#define SC_TG_CPU_SLOT 3 -#define SC_MC_AC_SLOT 8 -#define SC_TG_AC_SLOT 1 -#define SC_MC_CTC_SLOT 2 - -#define SCSB_MC_ALARM_SLOT SC_MC_AC_SLOT -#define SCSB_TONGA_ALARM_SLOT SC_TG_AC_SLOT - -#define SCTRL_PROM_P06 0x00 -#define SCTRL_PROM_P10 0x01 -#define SCTRL_PROM_P15 0x02 -#define SCTRL_PROM_P20 0x03 - -#define SCSB_RESET_SLOT 1 -#define SCSB_UNRESET_SLOT 2 -#define SCSB_GET_SLOT_RESET_STATUS 3 - -#define SCTRL_CFG_SLOT16 SCTRL_SYSCFG_5_READ-SCTRL_SYSCFG_BASE -#define SCTRL_CFG_SLOT710 SCTRL_SYSCFG_6_READ-SCTRL_SYSCFG_BASE -#define SCTRL_CFG_SLOTAC SCTRL_SYSCFG_4_READ-SCTRL_SYSCFG_BASE - -/* - * SCSB operations between scsb and the hotswap controller module - */ -#define SCSB_HSC_AC_BUSY 1 -#define SCSB_HSC_AC_CONFIGURED 2 -#define SCSB_HSC_AC_UNCONFIGURED 3 -#define SCSB_HSC_AC_UNCONFIGURE 4 -#define SCSB_HSC_AC_CONFIGURE 5 -#define SCSB_HSC_AC_SET_BUSY 6 -#define SCSB_HSC_AC_REMOVAL_ALERT 7 -/* - * SCSB_HSC_AC_GET_SLOT_INFO for hsc_ac_op() - * to return hsc_slot_t pointer (for debugging) - */ -#define SCSB_HSC_AC_GET_SLOT_INFO 11 - -/* - * The register set starting address, and macro for translating - * the index to 0 base. - */ -#define SCSB_REG_ADDR_START 0xC0 -#define SCSB_REG_INDEX(raddr) ((raddr) % SCSB_REG_ADDR_START) - -/* - * ---------------------- - * P1.0 - * ---------------------- - * The following three register offset groups are defined for P1.0 where - * FRUs might have three different bit offset values, - * Group 1: LEDs, Slot Reset, and BrdHlthy, - * Group 2: Config/Status registers - * Group 3: Interrupt Pointer/Mask registers - */ -#define REG_GROUP1 0 -#define REG_GROUP2 1 -#define REG_GROUP3 2 -#define REG_GROUPS_NUM 3 -#define IS_GROUP1(rx) (rx < SCTRL_SYSCFG_5) -#define IS_GROUP3(rx) (rx > SCTRL_SYSCFG_4) -#define IS_GROUP2(rx) (rx > (SCTRL_SYSCFG_5 - 1) && \ - (rx < (SCTRL_SYSCFG_4 + 1))) -#define IS_SCB_P10 (scsb->scsb_state & \ - (SCSB_P06_PROM | SCSB_P10_PROM)) -/* - * ---------------------- - * P1.5 - * ---------------------- - * The table access macros use BASE register plus register offset to get the - * correct register index or address. - * The SCB FRU type has two register offsets, LED reg and INT reg offsets. - * The one in fru_offsets[] is for the NOK, OK, and BLINK LED data. - * To get the register offset for the INTSRC and INTMASK registers, the - * following constant must be added to the table value returned by - * FRU_REG_INDEX(SCTRL_EVENT_SCB, SCTRL_INTMSK_BASE), NOT SCTRL_INTMASK_BASE. - * Given enough time, this too should be handled via macro access to tables. - */ -#define SCB_INT_OFFSET 2 - -/* - * ---------------------------------- - * P0.6, P1.0, P1.5, P2.0 DEFINITIONS - * ---------------------------------- - */ - -#define SCTRL_PROM_VERSION 0xCF /* same Addr for P06 thru P20 */ -#define IS_SCB_P15 (scsb->scsb_state & \ - (SCSB_P15_PROM | SCSB_P20_PROM)) - -/* - * SCB Register Indicies to scb_reg_index[] table - */ -#define SCTRL_SYS_CMD_BASE 0 -#define SCTRL_SYS_CMD1 SCTRL_SYS_CMD_BASE -#define SCTRL_SYS_CMD2 1 -#define SCTRL_LED_NOK_BASE 2 -#define SCTRL_LED_SLOT_16_NOK SCTRL_LED_NOK_BASE -#define SCTRL_LED_SLOT_712_NOK 3 -#define SCTRL_LED_DPP_NOK 4 -#define SCTRL_LED_FAN_NOK 5 -#define SCTRL_LED_OK_BASE 6 -#define SCTRL_LED_SLOT_16_OK SCTRL_LED_OK_BASE -#define SCTRL_LED_SLOT_712_OK 7 -#define SCTRL_LED_DPP_OK 8 -#define SCTRL_LED_FAN_OK 9 -#define SCTRL_RESET_BASE 10 -#define SCTRL_RESET_SLOT_16 SCTRL_RESET_BASE -#define SCTRL_RESET_SLOT_710A 11 -#define SCTRL_RESET_ALARM 11 -#define SCTRL_BLINK_OK_BASE 12 -#define SCTRL_BLINK_OK_1 SCTRL_BLINK_OK_BASE -#define SCTRL_BLINK_OK_2 13 -#define SCTRL_BLINK_GR_3 14 /* 0xCE */ -#define SCTRL_SCBID_BASE 15 -#define SCTRL_BHLTHY_BASE 16 -#define SCTRL_BHLTHY_SLOT_16 SCTRL_BHLTHY_BASE -#define SCTRL_BHLTHY_SLOT_710 17 -#define SCTRL_SYSCFG_BASE 18 -#define SCTRL_SYSCFG_5 SCTRL_SYSCFG_BASE -#define SCTRL_SYSCFG_6 19 -#define SCTRL_SYSCFG_1 20 -#define SCTRL_SYSCFG_2 21 -#define SCTRL_SYSCFG_3 22 -#define SCTRL_SYSCFG_4 23 -#define SCTRL_INTSRC_BASE 24 -#define SCTRL_INTSRC_HLTHY_BASE SCTRL_INTSRC_BASE -#define SCTRL_INTSRC_1 SCTRL_INTSRC_BASE -#define SCTRL_INTSRC_2 25 -#define SCTRL_INTSRC_3 26 -#define SCTRL_INTSRC_4 27 -#define SCTRL_INTSRC_5 28 -#define SCTRL_INTSRC_6 29 -#define SCTRL_INTSRC_SCB_P15 SCTRL_INTSRC_6 -#define SCTRL_INTMASK_BASE 30 -#define SCTRL_INTMASK_HLTHY_BASE SCTRL_INTMASK_BASE -#define SCTRL_INTMASK_1 SCTRL_INTMASK_BASE -#define SCTRL_INTMASK_2 31 -#define SCTRL_INTMASK_3 32 -#define SCTRL_INTMASK_4 33 -#define SCTRL_INTMASK_5 34 -#define SCTRL_INTMASK_6 35 - -#define SCTRL_INTPTR_BASE SCTRL_INTSRC_3 -#define SCTRL_INTMSK_BASE SCTRL_INTMASK_3 -/* - * The last two definitions are for register offset compatibility. - * These will be used with FRU_REG_INDEX macros, for P1.0 and P1.5, so 1.5 - * register offsets in upper nibble of fru_offset[] tables will be consistent. - * This happens because the HLTHY INTs and INT masks come before the slots and - * FRUs. That's what changes the register offsets. - * The only EXCEPTION is the ALARM RESET register, which for P1.5 is not - * BASE + 3 as in all other cases, but BASE + 1. FRU_REG_INDEX(code,base) does - * NOT work for ALARM RESET. Use ALARM_RESET_REG_INDEX() instead. - * FRU_REG_INDEX() works differently for P1.0, using offset groups to calculate - * the index to the fru_offset[] table. - */ - -/* - * REGISTER BIT OFFSETS - * For the bit definitions, the SCB register sets are divided into two tables, - * 1. scb_1x_fru_offset[] bit-offsets for all FRUs and - * Interrupt events - * 2. scb_1x_sys_offset[] for system command/control registers - * and any remaining bits, like MPID. - * - * This is a bit historic from P0.6,P1.0 days. - * The fru_offset table is indexed using the SCTRL_EVENT_ codes defined in - * mct_topology.h. Almost all of these describe interrupt generated events. - * Ths sys_offset table contains anything else, mostly the System Control - * registers and some bit definitions form the config/status registers. - */ - -/* - * scb_1x_sys_offset[] table indicies - * - * SCB System Command/Control Registers from 1.0 and 1.5 - */ -#define SCTRL_SYS_PS1_OFF 0 -#define SCTRL_SYS_PS2_OFF 1 -#define SCTRL_SYS_PS_OFF_BASE SCTRL_SYS_PS1_OFF -#define SCTRL_SYS_PS1_ON 2 -#define SCTRL_SYS_PS2_ON 3 -#define SCTRL_SYS_PS_ON_BASE SCTRL_SYS_PS1_ON -#define SCTRL_SYS_SCB_CTL0 4 -#define SCTRL_SYS_SCB_CTL1 5 -#define SCTRL_SYS_SCB_CTL2 6 -#define SCTRL_SYS_SCB_CTL3 7 -#define SCTRL_SYS_PSM_INT_ENABLE 8 -#define SCTRL_SYS_SCB_INIT 9 -#define SCTRL_SYS_TEST_MODE 10 -#define SCTRL_SYS_SCBLED 11 -#define SCTRL_SYS_SPA0 12 -#define SCTRL_SYS_SPA1 13 -#define SCTRL_SYS_SPA2 14 -#define SCTRL_SYS_RSVD 15 -/* - * SCB Config/Status register leftovers - */ -#define SCTRL_CFG_MPID0 16 -#define SCTRL_CFG_MPID1 17 -#define SCTRL_CFG_MPID2 18 -#define SCTRL_CFG_MPID3 19 -#define SCTRL_CFG_SCB_STAT0 20 -#define SCTRL_CFG_SCB_STAT2 21 -/* - * SCB Identity register offsets - */ -#define SCTRL_SCBID0 22 -#define SCTRL_SCBID_SIZE 4 -#define SCTRL_SCB_TEST 23 - -/* numregs table order and indicies */ -#define SCTRL_SYS_CMD_NUM 0 -#define SCTRL_LED_NOK_NUM 1 -#define SCTRL_LED_OK_NUM 2 -#define SCTRL_LED_NUM 3 -#define SCTRL_RESET_NUM 4 -#define SCTRL_BLINK_NUM 5 -#define SCTRL_SCBID_NUM 6 -#define SCTRL_BHLTHY_NUM 7 -#define SCTRL_SYSCFG_NUM 8 -#define SCTRL_INTSRC_NUM 9 -#define SCTRL_INTMSK_NUM 10 -#define SCTRL_TOTAL_NUM 11 - - -/* - * Macro Definitions for register and bit offset values - */ -/* macros names for scb_numregs[] access */ -#define SCTRL_SYSCMD_NUMREGS (scb_numregs[SCTRL_SYS_CMD_NUM]) -#define SCTRL_LED_NOK_NUMREGS (scb_numregs[SCTRL_LED_NOK_NUM]) -#define SCTRL_LED_OK_NUMREGS (scb_numregs[SCTRL_LED_OK_NUM]) -#define SCTRL_LED_NUMREGS (scb_numregs[SCTRL_LED_NUM]) -#define SCTRL_RESET_NUMREGS (scb_numregs[SCTRL_RESET_NUM]) -#define SCTRL_BLINK_NUMREGS (scb_numregs[SCTRL_BLINK_NUM]) -#define SCTRL_SCBID_NUMREGS (scb_numregs[SCTRL_SCBID_NUM]) -#define SCTRL_BHLTHY_NUMREGS (scb_numregs[SCTRL_BHLTHY_NUM]) -#define SCTRL_CFG_NUMREGS (scb_numregs[SCTRL_SYSCFG_NUM]) -#define SCTRL_INTR_NUMREGS (scb_numregs[SCTRL_INTSRC_NUM]) -#define SCTRL_MASK_NUMREGS (scb_numregs[SCTRL_INTMSK_NUM]) -#define SCTRL_TOTAL_NUMREGS (scb_numregs[SCTRL_TOTAL_NUM]) - -/* - * Maximum number of registers in a register group - * Needed for above register groups array sizing - */ -#define SCTRL_MAX_GROUP_NUMREGS 16 - -#define SCSB_REG_ADDR(rx) (scb_reg_index[rx]) -#define FRU_INDEX(code) (event_to_index(code)) -#define FRU_OFFSET_BASE(rx) (MCT_MAX_FRUS * (IS_SCB_P15 ? 0 : \ - (IS_GROUP1(rx) ? REG_GROUP1 : \ - (IS_GROUP3(rx) ? REG_GROUP3 : \ - REG_GROUP2)))) -#define FRU_OFFSET_VAL(code, rx) (scb_fru_offset[FRU_OFFSET_BASE(rx) + \ - FRU_INDEX(code)]) - -#define FRU_OFFSET(code, rx) (FRU_OFFSET_VAL(code, rx) & 0xf) -#define FRU_REG_INDEX(code, rx) (((FRU_OFFSET_VAL(code, rx) >> 4) \ - & 0xf) + rx) -#define FRU_REG_ADDR(code, rx) (SCSB_REG_ADDR(FRU_REG_INDEX(code, rx))) -#define SYS_OFFSET_VAL(idx) (scb_sys_offset[idx]) -#define SYS_OFFSET(idx) (SYS_OFFSET_VAL(idx) & 0xf) -#define SYS_REG_INDEX(idx, rx) (((SYS_OFFSET_VAL(idx) >> 4) \ - & 0xf) + rx) - -#define ALARM_RESET_REG_INDEX(code, rx) ((IS_SCB_P15 ? 1 : \ - ((FRU_OFFSET_VAL(code, rx) >> 4) \ - & 0xf)) + rx) -#define FRU_UNIT_TO_EVCODE(type, unit) (type_to_code1[type] << (unit - 1)) - -/*LINTED table used in scsb.o and system utilities*/ -static uchar_t *scb_reg_index; -/*LINTED table used in scsb.o and system utilities*/ -static uchar_t *scb_numregs; -/*LINTED table used in scsb.o and system utilities*/ -static uchar_t *scb_fru_offset; -/*LINTED table used in scsb.o and system utilities*/ -static uchar_t *scb_sys_offset; - -/* - * -------------------- - * Common TABLES - * -------------------- - */ - -/* - * FRU type to unit 1 event_code, see FRU_UNIT_TO_EVCODE() macro above. - * Table order is dependent on scsb_utype_t definition in mct_topology.h - */ -/*LINTED table used in scsb.o and system utilities*/ -static uint32_t type_to_code1[] = { - SCTRL_EVENT_SLOT1, - SCTRL_EVENT_PDU1, - SCTRL_EVENT_PS1, - SCTRL_EVENT_DISK1, - SCTRL_EVENT_FAN1, - SCTRL_EVENT_ALARM, - SCTRL_EVENT_SCB, - SCTRL_EVENT_SSB, - SCTRL_EVENT_CFTM, - SCTRL_EVENT_CRTM, - SCTRL_EVENT_PRTM -}; - -/* - * -------------------- - * P0.6 and P1.0 TABLES - * -------------------- - */ - -/* - * MonteCarlo: Programming Inteface Specifications Version 0.9 - * 10/27/99 - * NOTE: P0.6 FANs and PDUs were different - */ -/*LINTED table used in scsb.o and system utilities*/ -static uchar_t scb_10_reg_index[] = { - 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, /* 00 - 07 */ - 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, /* 08 - 15 */ - 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, /* 16 - 23 */ - 0xD8, 0xD9, 0xDA, 0xDB, 0x00, 0x00, 0xDC, 0x00, /* 24 - 31 */ - 0xDC, 0xDD, 0xDE, 0xDF, 0xD8, 0xDC, 0x00, 0x00, /* 32 - 39 */ -}; - -/*LINTED table used in scsb.o and system utilities*/ -static uchar_t scb_10_numregs[] = { - 2, 4, 4, 8, 2, 2, 1, 2, 6, 4, 4, 32 -}; - - -/* - * MCT_MAX_FRUS * REG_GROUPS_NUM - * - * FRU order: - * 0 - 9: Slots 1 - 10 - * 10 - 11: PDU 1 - 2 - * 12 - 13: PS 1 - 2 - * 14 - 16: Disk 1 - 3 - * 17 - 19: Fan 1 - 3 - * 20: Alarm Card - * 21: SCB - * 22: SSB - * 23: CRTM - * 24: CFTM - * 25: PRTM - * 26: PWRDWN - * 27: REPLACE - * 28: ALARM_INT - * 29 - 31: Unused - * - * A register base group offset is added to the register base value to - * find the index into the reg_index table. - * Example: LED_NOK_BASE + '1' = register for slots 7-10 NOK LEDs - * This offset is encoded in the upper nibble in the following table - * of register offsets per FRU/EVENT. - * The register base group definitions are: - * base group offset group - * ---------------------- ------------ - * SCTRL_LED_NOK_BASE G1 - * SCTRL_LED_OK_BASE G1 - * SCTRL_RESET_BASE G1 - * SCTRL_BLINK_OK_BASE G1 - * SCTRL_BHLTHY_BASE G1 - * SCTRL_SYSCFG_BASE G2 - * SCTRL_INTSRC_BASE G3 - * SCTRL_INTMASK_BASE G3 - * SCTRL_SYS_CMD_BASE G4 - * - * See FRU_OFFSET() macro - */ -/*LINTED table used in scsb.o and system utilities*/ -static uchar_t scb_10_fru_offset[] = { - /* Register Group 1 */ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* SLOT 1-6 */ - 0x10, 0x11, 0x12, 0x13, /* SLOT 7-10 */ - 0x35, 0x15, 0x21, 0x22, /* PDU/PS 1-2 */ - 0x23, 0x24, 0x25, /* Disks 1-3 */ - 0x33, 0x34, 0x35, /* Fans 1-3 */ - 0xFF, 0x20, 0xFF, /* Alarm Card, SCB, SSB */ - 0xFF, 0xFF, 0xFF, /* CRTM, CFTM, PRTM */ - 0xFF, 0xFF, 0xFF, /* PWRDWN, SCBRR, ACINT */ - 0xFF, 0xFF, 0xFF, /* Unused */ - /* Register Group 2 */ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* SLOT 1-6 */ - 0x10, 0x11, 0x12, 0x13, /* SLOT 7-10 */ - 0x25, 0x27, 0x30, 0x31, /* PDU/PS 1-2 */ - 0x40, 0x41, 0x42, /* Disks 1-3 */ - 0x32, 0x33, 0x34, /* Fans 1-3 */ - 0x50, 0xFF, 0x35, /* Alarm Card, SCB, SSB */ - 0x43, 0x44, 0x45, /* CRTM, CFTM, PRTM */ - 0xFF, 0xFF, 0xFF, /* PWRDWN, SCBRR, ACINT */ - 0x24, 0x26, 0x20, /* STAT0, STAT1, MPID0 */ - /* Register Group 3 */ - 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, /* SLOT 1-6 */ - 0x37, 0x26, 0x27, 0x16, /* SLOT 7-10 */ - 0xFF, 0xFF, 0x10, 0x11, /* PDU/PS 1-2 */ - 0x20, 0x21, 0x22, /* Disks 1-3 */ - 0x12, 0x13, 0x14, /* Fans 1-3 */ - 0x30, 0x04, 0x15, /* Alarm Card, SCB, SSB */ - 0x23, 0x24, 0x25, /* CRTM, CFTM, PRTM */ - 0x00, 0x02, 0x03, /* PWRDWN, SCBRR, ACINT */ - 0xFF, 0xFF, 0xFF, /* Unused */ -}; - -/*LINTED table used in scsb.o and system utilities*/ -static uchar_t scb_10_sys_offset[] = { - 0x00, 0x01, 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, - 0x15, 0x16, 0xFF, 0x02, 0x03, 0x04, 0x05, 0x14, - 0x20, 0x21, 0x22, 0x23, 0x24, 0x26, 0x00, 0x07, -}; - -/*LINTED table used in scsb.o and system utilities*/ -static uchar_t scb_10_int_masks[] = { - 0x11, 0x2F, 0x3F, 0xFF, 0x00, 0x00, -}; - - -/* - * -------------------- - * P1.5 and P2.0 TABLES - * -------------------- - */ - -/* - * MonteCarlo: Programming Inteface Specifications - * Chapter 12 from the MonteCarlo System Specification - * 02/08/00: Chapter update from Carl Meert - */ -/*LINTED table used in scsb.o and system utilities*/ -static uchar_t scb_15_reg_index[] = { - 0xE0, 0xE1, 0xC0, 0xC1, 0xC2, 0xC2, 0xC3, 0xC4, /* 00 - 07 */ - 0xC5, 0xC5, 0xE2, 0xE3, 0xC6, 0xC7, 0xC8, 0xCF, /* 08 - 15 */ - 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0x00, 0x00, /* 16 - 23 */ - 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, /* 24 - 31 */ - 0xD8, 0xD9, 0xDA, 0xDB, 0xD2, 0xD8, 0x00, 0x00, /* 32 - 39 */ -}; - -/*LINTED table used in scsb.o and system utilities*/ -static uchar_t scb_15_numregs[] = { - 2, 3, 3, 6, 2, 3, 1, 2, 4, 6, 6, 48 -}; - -/*LINTED table used in scsb.o and system utilities*/ -static uchar_t scb_15_fru_offset[] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* SLOT 1-6 */ - 0x06, 0x07, 0x16, 0x17, /* SLOT 7-10 */ - 0x11, 0x13, 0x26, 0x27, /* PDU/PS 1-2 */ - 0x23, 0x24, 0x25, /* Disks 1-3 */ - 0x20, 0x21, 0xFF, /* Fans 1-3 */ - 0x30, 0x15, 0x33, /* Alarm Card, SCB, SSB */ - 0x31, 0x14, 0x32, /* CRTM, CFTM, PRTM */ - 0x34, 0xFF, 0x36, /* PWRDWN, SCBRR, ACINT */ - 0xFF, 0xFF, 0xFF, /* Unused */ -}; - -/*LINTED table used in scsb.o and system utilities*/ -static uchar_t scb_15_sys_offset[] = { - 0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, - 0x14, 0x15, 0x16, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x34, 0x35, 0x36, 0x37, 0x10, 0x12, 0x00, 0x07 -}; - -/*LINTED table used in scsb.o and system utilities*/ -static uchar_t scb_15_int_masks[] = { - 0xFF, 0x00, 0xFF, 0x1A, 0xFB, 0x7F, -}; - -#define SCSB_NO_OF_BOARDS 1 - -/* - * scsb_state values - * outside _KERNEL for smctrl test utility - */ -#define SCSB_DOWN 0x0000 /* never really used */ -#define SCSB_UP 0x0001 -#define SCSB_OPEN 0x0002 -#define SCSB_EXCL 0x0004 -#define SCSB_APP_SLOTLED_CTRL 0x0008 -#define SCSB_KS_UPDATE 0x0010 -#define SCSB_FROZEN 0x0020 -#define SCSB_DEBUG_MODE 0x0040 -#define SCSB_DIAGS_MODE 0x0080 -#define SCSB_UNUSED_08 0x0100 -#define SCSB_PSM_INT_ENABLED 0x0200 -#define SCSB_UMUTEX 0x0400 -#define SCSB_CONDVAR 0x0800 -#define SCSB_SCB_PRESENT 0x1000 -#define SCSB_SSB_PRESENT 0x2000 -#define SCSB_UNUSED_14 0x4000 -#define SCSB_UNUSED_15 0x8000 -#define SCSB_MINOR_NODE 0x00010000 -#define SCSB_PROP_CREATE 0x00020000 -#define SCSB_IMUTEX 0x00040000 -#define SCSB_I2C_PHANDLE 0x00080000 -#define SCSB_I2C_TRANSFER 0x00100000 -#define SCSB_TOPOLOGY 0x00200000 -#define SCSB_KSTATS 0x00400000 -#define SCSB_IS_TONGA 0x00800000 -#define SCSB_P10_PROM 0x01000000 -#define SCSB_P15_PROM 0x02000000 -#define SCSB_P20_PROM 0x04000000 -#define SCSB_P2X_PROM 0x08000000 -#define SCSB_P06_PROM 0x10000000 -#define SCSB_P06_INTR_ON 0x20000000 -#define SCSB_P06_NOINT_KLUGE 0x40000000 -#define SCSB_IN_INTR 0x80000000 -#define SCSB_HSC_INIT 0x0001 -#define SCSB_ENUM_ENABLED 0x0002 -#define SCSB_ALARM_CARD_PRES 0x0004 -#define SCSB_ALARM_CARD_IN_USE 0x0008 -#define SCSB_AC_SLOT_INTR_DONE 0x0010 -#define SCSB_HSC_CTC_PRES 0x0020 -#define SCSB_HSC_UNUSED_06 0x0040 -#define SCSB_HSC_UNUSED_07 0x0080 -#define SCSB_HSC_UNUSED_08 0x0100 -#define SCSB_HSC_UNUSED_09 0x0200 -#define SCSB_HSC_UNUSED_10 0x0400 -#define SCSB_HSC_UNUSED_11 0x0800 -#define SCSB_HSC_UNUSED_12 0x1000 -#define SCSB_HSC_UNUSED_13 0x2000 -#define SCSB_HSC_UNUSED_14 0x4000 -#define SCSB_HSC_UNUSED_15 0x8000 - -#ifdef _KERNEL - -/* - * The System Controller Board uses the Xilinx to control the I2C bus. - * The address should really go to scsb.conf file. - * The I2C address of the System Controller Board - */ -#define SCSB_I2C_ADDR 0x80 -#define SCSB_I2C_ADDR_MASK 0xFF - -#define SCSB_DEVICE_NAME "scsb" -#define SCSB_INTR_PIL 4 - -/* - * definitions for Interrupt Event Code handling - */ -#define EVC_FIFO_SIZE 8 -#define EVC_PROCS_MAX 16 -/* - * return values for check_event_procs() - */ -#define EVC_NO_EVENT_CODE 1 -#define EVC_NO_CURR_PROC 2 -#define EVC_NEW_EVENT_CODE 3 -#define EVC_OR_EVENT_CODE 4 -#define EVC_FAILURE 5 -/* - * scsb_queue_ops() definitions - * Operations: - */ -#define QPROCSOFF 1 -#define QPUT_INT32 2 -#define QFIRST_AVAILABLE 3 -#define QFIRST_OPEN 4 -#define QFIND_QUEUE 5 -/* - * Return values: - * 0 - 15 are valid clone numbers used as index to clone_devs[] - * and returned for some operations instead of QOP_OK. - */ -#define QOP_OK 16 -#define QOP_FAILED -1 - -/* - * minor_t definitions - * bits 2-0 SCB instance 0-7 - * bit 3 Clone device for sm_open() - * bits 7-4 Cloned device numbers for a total of 15: 0x1# - 0xf# - * Must start with '1' to avoid conflict with: - * 0x00 non-clone device node for instance 0 - * 0x08 the clone device node for instance 0 - * the new minor_t for the clone is all of the above. - */ -#define SCSB_INSTANCE_MASK 0x07 -#define SCSB_CLONE 0x08 -#define SCSB_CLONES_MASK 0xf0 -#define SCSB_CLONES_SHIFT 4 -#define SCSB_CLONES_FIRST 1 -#define SCSB_CLONES_MAX 16 -#define SCSB_GET_CLONE(minor) ((minor&SCSB_CLONES_MASK)>>SCSB_CLONES_SHIFT) -#define SCSB_GET_INSTANCE(minor) \ - (minor&SCSB_INSTANCE_MASK) -#define SCSB_MAKE_MINOR(inst, clnum) \ - (inst|(clnum<<SCSB_CLONES_SHIFT)|SCSB_CLONE) - -typedef struct clone_dev { - queue_t *cl_rq; - minor_t cl_minor; - uint32_t cl_flags; -} clone_dev_t; - -typedef struct { - uint32_t scsb_instance; - uint32_t scsb_state; - uint32_t scsb_hsc_state; - int ac_slotnum; /* Alarm Card Slot Number */ - kmutex_t scsb_mutex; - kcondvar_t scsb_cv; - uint32_t scsb_opens; - dev_info_t *scsb_dev; - i2c_client_hdl_t scsb_phandle; /* i2c private handle from i2c nexus */ - mblk_t *scsb_mp; /* reserved for interrupt processing */ - i2c_transfer_t *scsb_i2ctp; /* pointer to read/write structure */ - uchar_t scsb_data_reg[SCSB_DATA_REGISTERS]; - int scsb_i2c_addr; /* i2c addr. */ - queue_t *scsb_rq; /* read q for scsb_instance */ - timeout_id_t scsb_btid; /* qbufcall, or qtimeout id */ - kmutex_t scsb_imutex; - ddi_iblock_cookie_t scsb_iblock; - kstat_t *ks_leddata; - kstat_t *ks_state; - kstat_t *ks_topology; - kstat_t *ks_evcreg; - uint32_t scsb_i2c_errcnt; - boolean_t scsb_err_flag; /* latch err until kstat read */ - boolean_t scsb_kstat_flag; /* do i2c trans for kstat */ - uint32_t scsb_clopens; - clone_dev_t clone_devs[SCSB_CLONES_MAX]; -} scsb_state_t; - -int scsb_led_get(scsb_state_t *, scsb_uinfo_t *, scsb_led_t led_type); -int scsb_led_set(scsb_state_t *, scsb_uinfo_t *, scsb_led_t led_type); -int scsb_reset_unit(scsb_state_t *, scsb_uinfo_t *); -int scsb_bhealthy_slot(scsb_state_t *, scsb_uinfo_t *); -int scsb_slot_occupancy(scsb_state_t *, scsb_uinfo_t *); - -#if defined(DEBUG) -extern void prom_printf(const char *, ...); -void scsb_debug_prnt(char *, uintptr_t, uintptr_t, - uintptr_t, uintptr_t, uintptr_t); - -#define DEBUG0(fmt)\ - scsb_debug_prnt(fmt, 0, 0, 0, 0, 0); -#define DEBUG1(fmt, a1)\ - scsb_debug_prnt(fmt, (uintptr_t)(a1), 0, 0, 0, 0); -#define DEBUG2(fmt, a1, a2)\ - scsb_debug_prnt(fmt, (uintptr_t)(a1), (uintptr_t)(a2), 0, 0, 0); -#define DEBUG3(fmt, a1, a2, a3)\ - scsb_debug_prnt(fmt, (uintptr_t)(a1), (uintptr_t)(a2),\ - (uintptr_t)(a3), 0, 0); -#define DEBUG4(fmt, a1, a2, a3, a4)\ - scsb_debug_prnt(fmt, (uintptr_t)(a1), (uintptr_t)(a2),\ - (uintptr_t)(a3), (uintptr_t)(a4), 0); -#else -#define DEBUG0(fmt) -#define DEBUG1(fmt, a1) -#define DEBUG2(fmt, a1, a2) -#define DEBUG3(fmt, a1, a2, a3) -#define DEBUG4(fmt, a1, a2, a3, a4) -#endif - - -#endif /* _KERNEL */ - -#ifdef __cplusplus -} -#endif - -#endif /* _MONTECARLO_SYS_SCSB_H */ diff --git a/usr/src/uts/sun4u/montecarlo/sys/scsb_cbi.h b/usr/src/uts/sun4u/montecarlo/sys/scsb_cbi.h deleted file mode 100644 index a9d4cb4727..0000000000 --- a/usr/src/uts/sun4u/montecarlo/sys/scsb_cbi.h +++ /dev/null @@ -1,61 +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 2000 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _MONTECARLO_SYS_SCSB_CBI_H -#define _MONTECARLO_SYS_SCSB_CBI_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef _KERNEL - -/* - * scsb_cbi.h - * scsb callback interface for some the MonteCarlo/Tonga I2C FRU drivers - */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum scsb_fru_event { - FRU_INTR_EVENT, - FRU_CMD_EVENT -} scsb_fru_event_t; - -scsb_fru_status_t scsb_fru_register(void (*cb_func)(void *, - scsb_fru_event_t, - scsb_fru_status_t), - void *softstate_ptr, - fru_id_t fru_id); -void scsb_fru_unregister(void *soft_ptr, fru_id_t fru_id); -scsb_fru_status_t scsb_fru_status(fru_id_t fru_id); - -#ifdef __cplusplus -} -#endif -#endif /* _KERNEL */ - -#endif /* _MONTECARLO_SYS_SCSB_CBI_H */ diff --git a/usr/src/uts/sun4u/montecarlo/sys/scsb_led.h b/usr/src/uts/sun4u/montecarlo/sys/scsb_led.h deleted file mode 100644 index ba55e77e5f..0000000000 --- a/usr/src/uts/sun4u/montecarlo/sys/scsb_led.h +++ /dev/null @@ -1,80 +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 2000 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Netra ct SCB/SSB driver (scsb) support for controlling the - * LEDs on the System Status Board that represent the cPCI Slots. - * Each slot has a pair of LEDs, one green (OK) and one amber (NOK). - * The OK (green) LED can also be made to blink. - */ - -#ifndef _SYS_SCSB_LED_H -#define _SYS_SCSB_LED_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#define _SCSBIOC ('s' << 8) - -/* The ioctl command */ -#define ENVC_IOC_SETFSP (_SCSBIOC | 23) - -/* Netra ct 400 has 5 slots, Netra ct 800 has 8 slots. Including CPU */ -#define NCT800_MAX_SLOTS 8 -#define NCT400_MAX_SLOTS 5 - -typedef uint16_t scsb_unum_t; - -typedef enum { - SLOT = 0 -} scsb_utype_t; - -typedef enum { - NOK = 0, - OK = 1, -} scsb_led_t; - -typedef enum { - OFF = 0, - ON = 1, - BLINK = 2 -} scsb_ustate_t; - -typedef struct { - scsb_unum_t unit_number; - scsb_utype_t unit_type; - scsb_ustate_t unit_state; - scsb_led_t led_type; -} scsb_uinfo_t; - -#ifdef __cplusplus -} -#endif - -#endif /* _SYS_SCSB_LED_H */ diff --git a/usr/src/uts/sun4u/montecarlo/sys/scsbioctl.h b/usr/src/uts/sun4u/montecarlo/sys/scsbioctl.h deleted file mode 100644 index f796aac40b..0000000000 --- a/usr/src/uts/sun4u/montecarlo/sys/scsbioctl.h +++ /dev/null @@ -1,153 +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 2000 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _MONTERCARLO_SYS_SCSBIOCTL_H -#define _MONTERCARLO_SYS_SCSBIOCTL_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * SCB HW information, which is needed in scsb.h for scsb.c. - * there are 32 data registers on the system controller board - * most are used in P1.0, all are used in P1.5 - */ -#define SCSB_DATA_REGISTERS 48 - - -#define _SCSBIOC ('s' << 8) - -#define SCSBIOC_GET_STATUS (_SCSBIOC | 1) /* Internal */ -#define SCSBIOC_I2C_XFER (_SCSBIOC | 2) /* Internal */ - -#define SCSBIOC_ALL_LEDS_ON (_SCSBIOC | 3) /* Diagnostics */ -#define SCSBIOC_ALL_LEDS_OFF (_SCSBIOC | 4) /* Diagnostics */ - -#define SCSBIOC_FREEZE (_SCSBIOC | 5) /* Internal */ -#define SCSBIOC_RESTORE (_SCSBIOC | 6) /* Internal */ - -#define SCSBIOC_LED_NOK_SET (_SCSBIOC | 7) /* Diagnostics */ -#define SCSBIOC_LED_NOK_GET (_SCSBIOC | 8) /* Diagnostics */ -#define SCSBIOC_LED_OK_SET (_SCSBIOC | 9) /* Diagnostics */ -#define SCSBIOC_LED_OK_GET (_SCSBIOC | 10) /* Diagnostics */ -#define SCSBIOC_GET_FAN_STATUS (_SCSBIOC | 11) /* Internal */ -#define SCSBIOC_RESET_UNIT (_SCSBIOC | 12) /* Diagnostics */ -#define SCSBIOC_FAKE_INTR (_SCSBIOC | 13) /* Internal */ -#define SCSBIOC_BSELECT_SET (_SCSBIOC | 14) /* Internal */ -#define SCSBIOC_BSELECT_GET (_SCSBIOC | 15) /* Internal */ -#define SCSBIOC_BHEALTHY_SET (_SCSBIOC | 16) /* Internal */ -#define SCSBIOC_BHEALTHY_GET (_SCSBIOC | 17) /* Internal */ -#define SCSBIOC_GET_INTR_ARRAY (_SCSBIOC | 18) /* Internal */ - -#define ENVC_IOC_ACQUIRE_SLOT_LED_CTRL (_SCSBIOC | 21) /* EnvMon */ -#define ENVC_IOC_RELEASE_SLOT_LED_CTRL (_SCSBIOC | 22) /* EnvMon */ -#define ENVC_IOC_SETFSP (_SCSBIOC | 23) /* EnvMon */ -#define ENVC_IOC_GETDSKLED (_SCSBIOC | 24) /* EnvMon */ -#define ENVC_IOC_SETDSKLED (_SCSBIOC | 25) /* EnvMon */ -#define ENVC_IOC_REGISTER_PID (_SCSBIOC | 26) /* EnvMon */ -#define ENVC_IOC_UNREGISTER_PID (_SCSBIOC | 27) /* EnvMon */ -#define ENVC_IOC_ACCONF_RESTORED (_SCSBIOC | 28) /* EnvMon */ -#define ENVC_IOC_ACCONF_STORED (_SCSBIOC | 29) /* EnvMon */ - -#define SCSBIOC_REG_READ (_SCSBIOC | 31) /* Diagnostic */ -#define SCSBIOC_REG_WRITE (_SCSBIOC | 32) /* Diagnostic */ -#define SCSBIOC_GET_VERSIONS (_SCSBIOC | 33) /* Diagnostic */ - -/* these are for debug/testing and may be temporary */ -#define SCSBIOC_SHUTDOWN_POLL (_SCSBIOC | 41) /* Internal */ -#define SCSBIOC_SLOT_OCCUPANCY (_SCSBIOC | 42) /* Internal */ -#define SCSBIOC_INTEVENT_POLL (_SCSBIOC | 43) /* Internal */ -#define SCSBIOC_TOPOLOGY_DUMP (_SCSBIOC | 44) /* Internal */ -#define SCSBIOC_VALUE_MODE (_SCSBIOC | 45) /* Internal */ -#define SCSBIOC_GET_SLOT_INFO (_SCSBIOC | 46) /* Internal */ -#define SCSBIOC_DEBUG_MODE (_SCSBIOC | 52) /* Internal */ - -/* - * SCSBIOC_GET_VERSIONS structure - */ -#define SCSB_MODSTR_LEN 64 -#define SCSB_VERSTR_LEN 12 -typedef struct scsb_ids { - char modldrv_string[SCSB_MODSTR_LEN]; - char scsb_version[SCSB_VERSTR_LEN]; - uint8_t promid; - uint8_t pad[3]; -} scsb_ids_t; - - -typedef enum { - GET = 0, - SET = 1 -} scsb_op_t; - -typedef enum { - NOK = 0, - OK = 1, - NOUSE = 2 -} scsb_led_t; - -#define SCSB_LED_TYPES 2 - -typedef enum { - OFF = 0, - ON = 1, - BLINK = 2 -} scsb_ustate_t; - -typedef struct { - scsb_unum_t unit_number; - scsb_utype_t unit_type; - scsb_ustate_t unit_state; - scsb_led_t led_type; -} scsb_uinfo_t; - - -/* SCSBIOC_GET_STATUS data */ -typedef struct { - uchar_t scsb_reg[SCSB_DATA_REGISTERS]; -} scsb_status_t; - - -/* SCSBIOC_REG_READ / SCSBIOC_REG_WRITE data */ -typedef struct { - int16_t ioc_result; /* O: return value */ - uint16_t ioc_resio; /* O: bytes not transfered */ - uint16_t ioc_wlen; /* I: length of write buffer */ - uint16_t ioc_rlen; /* I: length of read buffer */ - uchar_t ioc_rbuf[64]; - uchar_t ioc_wbuf[64]; - uchar_t ioc_regindex; -} scsb_ioc_rdwr_t; - - -#ifdef __cplusplus -} -#endif - -#endif /* _MONTERCARLO_SYS_SCSBIOCTL_H */ diff --git a/usr/src/uts/sun4u/montecarlo/ttymux_dacf/Makefile b/usr/src/uts/sun4u/montecarlo/ttymux_dacf/Makefile deleted file mode 100644 index 5a584c25a9..0000000000 --- a/usr/src/uts/sun4u/montecarlo/ttymux_dacf/Makefile +++ /dev/null @@ -1,102 +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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# This makefile drives the production of the montecarlo ttymux_dacf -# kernel module. -# -# montecarlo implementation architecture dependent -# - -# -# Path to the base of the uts directory tree (usually /usr/src/uts). -# -UTSBASE = ../../.. - -# -# Define the module and object file sets. -# -MODULE = ttymux_dacf -OBJECTS = $(TTYMUX_DACF_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(TTYMUX_DACF_OBJS:%.o=$(LINTS_DIR)/%.ln) -ROOTMODULE = $(ROOT_MONTECARLO_DACF_DIR)/$(MODULE) - -# -# Include common rules. -# -include $(UTSBASE)/sun4u/montecarlo/Makefile.montecarlo - -# -# Override defaults. -# -ALL_BUILDS = $(ALL_BUILDSONLY64) -DEF_BUILDS = $(DEF_BUILDSONLY64) -CLEANLINTFILES = $(LINT32_FILES) - -FILEMODE = 644 - -# -# Define targets -# -ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint -INSTALL_TARGET = $(BINARY) $(ROOTMODULE) - -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) - -# -# Turn on doubleword alignment for 64 bit registers -# -CFLAGS += -dalign - -# -# Default build targets. -# -.KEEP_STATE: - -def: $(DEF_DEPS) - -all: $(ALL_DEPS) - -clean: $(CLEAN_DEPS) - -clobber: $(CLOBBER_DEPS) - -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - -install: $(INSTALL_DEPS) - -# -# Include common targets. -# -include $(UTSBASE)/sun4u/montecarlo/Makefile.targ diff --git a/usr/src/uts/sun4u/nxge/Makefile b/usr/src/uts/sun4u/nxge/Makefile index b6ff905531..e4178caa04 100644 --- a/usr/src/uts/sun4u/nxge/Makefile +++ b/usr/src/uts/sun4u/nxge/Makefile @@ -91,7 +91,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits # diff --git a/usr/src/uts/sun4u/opl/dr/Makefile b/usr/src/uts/sun4u/opl/dr/Makefile index 81edee1e96..7589e53b9d 100644 --- a/usr/src/uts/sun4u/opl/dr/Makefile +++ b/usr/src/uts/sun4u/opl/dr/Makefile @@ -59,7 +59,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # lint pass one enforcement # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # diff --git a/usr/src/uts/sun4u/opl/drmach/Makefile b/usr/src/uts/sun4u/opl/drmach/Makefile index e96c6defc4..a65edcc6f3 100644 --- a/usr/src/uts/sun4u/opl/drmach/Makefile +++ b/usr/src/uts/sun4u/opl/drmach/Makefile @@ -65,7 +65,7 @@ CLEANFILES += $(DRMACH_OFFSETS_H) $(DRMACH_OFFSETS_OUT) CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # module dependencies diff --git a/usr/src/uts/sun4u/opl/mc-opl/Makefile b/usr/src/uts/sun4u/opl/mc-opl/Makefile index 7fd191f904..bafe22c32e 100644 --- a/usr/src/uts/sun4u/opl/mc-opl/Makefile +++ b/usr/src/uts/sun4u/opl/mc-opl/Makefile @@ -62,7 +62,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # CFLAGS += $(CCVERBOSE) -I../sys CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits # diff --git a/usr/src/uts/sun4u/opl/olympus_c/Makefile b/usr/src/uts/sun4u/opl/olympus_c/Makefile index b79f790cee..ac3b4e8f21 100644 --- a/usr/src/uts/sun4u/opl/olympus_c/Makefile +++ b/usr/src/uts/sun4u/opl/olympus_c/Makefile @@ -75,7 +75,7 @@ CLEANLINTFILES += $(LINT32_FILES) # OLYMPUS_C_DEFS += -DOLYMPUS_C CFLAGS += $(CCVERBOSE) $(OLYMPUS_C_DEFS) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CPPFLAGS += -DCPU_MODULE -DOLYMPUS_C AS_CPPFLAGS += -DCPU_MODULE -DOLYMPUS_C diff --git a/usr/src/uts/sun4u/opl/oplmsu/Makefile b/usr/src/uts/sun4u/opl/oplmsu/Makefile index 8506680c14..e496ccdd7d 100644 --- a/usr/src/uts/sun4u/opl/oplmsu/Makefile +++ b/usr/src/uts/sun4u/opl/oplmsu/Makefile @@ -62,7 +62,7 @@ CFLAGS += $(CCVERBOSE) -I../sys LDFLAGS += -dy -Ndrv/su CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/opl/pcicmu/Makefile b/usr/src/uts/sun4u/opl/pcicmu/Makefile index 00b9a4213f..fbddd90ea2 100644 --- a/usr/src/uts/sun4u/opl/pcicmu/Makefile +++ b/usr/src/uts/sun4u/opl/pcicmu/Makefile @@ -61,7 +61,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # CFLAGS += $(CCVERBOSE) -I../sys CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-label diff --git a/usr/src/uts/sun4u/opl/unix/Makefile b/usr/src/uts/sun4u/opl/unix/Makefile index 609ec5ebcc..e1540448c5 100644 --- a/usr/src/uts/sun4u/opl/unix/Makefile +++ b/usr/src/uts/sun4u/opl/unix/Makefile @@ -116,7 +116,7 @@ CLEANLINTFILES += $(LINT_LIB) CFLAGS += $(CCVERBOSE) -dalign CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-char-subscripts CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function diff --git a/usr/src/uts/sun4u/opl_cfg/Makefile b/usr/src/uts/sun4u/opl_cfg/Makefile index ae72d82246..1dcec6314f 100644 --- a/usr/src/uts/sun4u/opl_cfg/Makefile +++ b/usr/src/uts/sun4u/opl_cfg/Makefile @@ -83,7 +83,7 @@ CFLAGS += -dalign # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/pca9556/Makefile b/usr/src/uts/sun4u/pca9556/Makefile index 89fe7e08ba..182a32f4e1 100644 --- a/usr/src/uts/sun4u/pca9556/Makefile +++ b/usr/src/uts/sun4u/pca9556/Makefile @@ -56,7 +56,7 @@ LDFLAGS += -dy -N misc/i2c_svc # LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Define targets diff --git a/usr/src/uts/sun4u/pcie/Makefile b/usr/src/uts/sun4u/pcie/Makefile index d10cf86c92..b1ad4eb65f 100644 --- a/usr/src/uts/sun4u/pcie/Makefile +++ b/usr/src/uts/sun4u/pcie/Makefile @@ -63,7 +63,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # LDFLAGS += -dy -Nmisc/busra -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits diff --git a/usr/src/uts/sun4u/pcipsy/Makefile b/usr/src/uts/sun4u/pcipsy/Makefile index 0db91a93d1..1857d38f95 100644 --- a/usr/src/uts/sun4u/pcipsy/Makefile +++ b/usr/src/uts/sun4u/pcipsy/Makefile @@ -77,7 +77,7 @@ LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-function # diff --git a/usr/src/uts/sun4u/pcisch/Makefile b/usr/src/uts/sun4u/pcisch/Makefile index d246548ee9..dbfb75fb27 100644 --- a/usr/src/uts/sun4u/pcisch/Makefile +++ b/usr/src/uts/sun4u/pcisch/Makefile @@ -77,7 +77,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-value diff --git a/usr/src/uts/sun4u/pmubus/Makefile b/usr/src/uts/sun4u/pmubus/Makefile index 89c6d07fe3..7f6ef65190 100644 --- a/usr/src/uts/sun4u/pmubus/Makefile +++ b/usr/src/uts/sun4u/pmubus/Makefile @@ -77,7 +77,7 @@ CPPFLAGS += -I$(UTSBASE)/sun4u LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/ppm/Makefile b/usr/src/uts/sun4u/ppm/Makefile index e13a4da1a8..dc15c0e88a 100644 --- a/usr/src/uts/sun4u/ppm/Makefile +++ b/usr/src/uts/sun4u/ppm/Makefile @@ -76,7 +76,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Turn on doubleword alignment for 64 bit registers diff --git a/usr/src/uts/sun4u/px/Makefile b/usr/src/uts/sun4u/px/Makefile index 0e4a0ad309..79ef780ea3 100644 --- a/usr/src/uts/sun4u/px/Makefile +++ b/usr/src/uts/sun4u/px/Makefile @@ -84,7 +84,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-label diff --git a/usr/src/uts/sun4u/rootnex/Makefile b/usr/src/uts/sun4u/rootnex/Makefile index 3c31ff2e8f..e1f3d0657b 100644 --- a/usr/src/uts/sun4u/rootnex/Makefile +++ b/usr/src/uts/sun4u/rootnex/Makefile @@ -80,7 +80,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/sbd/Makefile b/usr/src/uts/sun4u/sbd/Makefile index bab52e56bb..9e6df9ad35 100644 --- a/usr/src/uts/sun4u/sbd/Makefile +++ b/usr/src/uts/sun4u/sbd/Makefile @@ -61,7 +61,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-label # diff --git a/usr/src/uts/sun4u/sbus/Makefile b/usr/src/uts/sun4u/sbus/Makefile index 8fee184761..0d222c5c3c 100644 --- a/usr/src/uts/sun4u/sbus/Makefile +++ b/usr/src/uts/sun4u/sbus/Makefile @@ -79,7 +79,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON CERRWARN += -_gcc=-Wno-type-limits -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/seeprom/Makefile b/usr/src/uts/sun4u/seeprom/Makefile index a1c1fd4712..92b51e0417 100644 --- a/usr/src/uts/sun4u/seeprom/Makefile +++ b/usr/src/uts/sun4u/seeprom/Makefile @@ -57,7 +57,7 @@ LDFLAGS += -dy -N misc/i2c_svc # LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Define targets diff --git a/usr/src/uts/sun4u/serengeti/cheetah/Makefile b/usr/src/uts/sun4u/serengeti/cheetah/Makefile index e28743a9f7..301cc62306 100644 --- a/usr/src/uts/sun4u/serengeti/cheetah/Makefile +++ b/usr/src/uts/sun4u/serengeti/cheetah/Makefile @@ -78,7 +78,7 @@ CFLAGS += $(CCVERBOSE) -DCHEETAH ASFLAGS += -DCHEETAH CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-clobbered diff --git a/usr/src/uts/sun4u/serengeti/cheetahplus/Makefile b/usr/src/uts/sun4u/serengeti/cheetahplus/Makefile index e95048de85..f81ea26dda 100644 --- a/usr/src/uts/sun4u/serengeti/cheetahplus/Makefile +++ b/usr/src/uts/sun4u/serengeti/cheetahplus/Makefile @@ -81,7 +81,7 @@ ASFLAGS += -DCHEETAH -DCHEETAH_PLUS -DCPU_IMP_L1_CACHE_PARITY \ -DCPU_IMP_ECACHE_ASSOC -DCPU_IMP_DUAL_PAGESIZE -DCPU_IMP_AFSR_EXT CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-clobbered diff --git a/usr/src/uts/sun4u/serengeti/platmod/Makefile b/usr/src/uts/sun4u/serengeti/platmod/Makefile index eeb965a2a8..ed362ec056 100644 --- a/usr/src/uts/sun4u/serengeti/platmod/Makefile +++ b/usr/src/uts/sun4u/serengeti/platmod/Makefile @@ -76,7 +76,7 @@ CLEANLINTFILES += $(LINT32_FILES) # CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-unused-variable -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/serengeti/sbdp/Makefile b/usr/src/uts/sun4u/serengeti/sbdp/Makefile index c1a49ef2ef..2a45b38f06 100644 --- a/usr/src/uts/sun4u/serengeti/sbdp/Makefile +++ b/usr/src/uts/sun4u/serengeti/sbdp/Makefile @@ -70,7 +70,7 @@ CFLAGS += $(CCVERBOSE) LDFLAGS += -dy -Ndrv/sgsbbc CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/sun4u/serengeti/sgcn/Makefile b/usr/src/uts/sun4u/serengeti/sgcn/Makefile index ae115fae1f..94a28a5a96 100644 --- a/usr/src/uts/sun4u/serengeti/sgcn/Makefile +++ b/usr/src/uts/sun4u/serengeti/sgcn/Makefile @@ -69,7 +69,7 @@ CFLAGS += $(CCVERBOSE) LDFLAGS += -dy -Ndrv/sgsbbc CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/serengeti/sghsc/Makefile b/usr/src/uts/sun4u/serengeti/sghsc/Makefile index 684a7ec7ec..6899e46e48 100644 --- a/usr/src/uts/sun4u/serengeti/sghsc/Makefile +++ b/usr/src/uts/sun4u/serengeti/sghsc/Makefile @@ -69,7 +69,7 @@ CLEANLINTFILES += $(LINT32_FILES) # CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-type-limits -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Turn on doubleword alignment for 64 bit registers diff --git a/usr/src/uts/sun4u/serengeti/sgsbbc/Makefile b/usr/src/uts/sun4u/serengeti/sgsbbc/Makefile index 70abd98d29..14f851e299 100644 --- a/usr/src/uts/sun4u/serengeti/sgsbbc/Makefile +++ b/usr/src/uts/sun4u/serengeti/sgsbbc/Makefile @@ -73,7 +73,7 @@ CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/serengeti/unix/Makefile b/usr/src/uts/sun4u/serengeti/unix/Makefile index 970cdc845a..0fb8a3eeae 100644 --- a/usr/src/uts/sun4u/serengeti/unix/Makefile +++ b/usr/src/uts/sun4u/serengeti/unix/Makefile @@ -115,7 +115,7 @@ CLEANLINTFILES += $(LINT_LIB) CFLAGS += $(CCVERBOSE) -dalign CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-char-subscripts CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function diff --git a/usr/src/uts/sun4u/serrano/Makefile b/usr/src/uts/sun4u/serrano/Makefile index e5327b5a74..28dfb143f6 100644 --- a/usr/src/uts/sun4u/serrano/Makefile +++ b/usr/src/uts/sun4u/serrano/Makefile @@ -129,6 +129,6 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-clobbered diff --git a/usr/src/uts/sun4u/sf/Makefile b/usr/src/uts/sun4u/sf/Makefile index 23c34d8bb9..5ab7f68103 100644 --- a/usr/src/uts/sun4u/sf/Makefile +++ b/usr/src/uts/sun4u/sf/Makefile @@ -78,7 +78,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/sha1/Makefile b/usr/src/uts/sun4u/sha1/Makefile index 4c78018602..d62f696e5b 100644 --- a/usr/src/uts/sun4u/sha1/Makefile +++ b/usr/src/uts/sun4u/sha1/Makefile @@ -67,7 +67,7 @@ CFLAGS += $(CCVERBOSE) -I$(COM_DIR) CFLAGS += -DVIS_SHA1 LINTFLAGS += -I$(COM_DIR) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/snowbird/Makefile b/usr/src/uts/sun4u/snowbird/Makefile deleted file mode 100644 index ffc40d8267..0000000000 --- a/usr/src/uts/sun4u/snowbird/Makefile +++ /dev/null @@ -1,110 +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 (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. -# Copyright 2018 Gary mills -# -# This makefile drives the production of the sun4u snowbird platform -# module. -# -# sun4u snowbird implementation architecture dependent -# - -# -# Path to the base of the uts directory tree (usually /usr/src/uts). -# -UTSBASE = ../.. - -include $(UTSBASE)/sun4u/snowbird/Makefile.snowbird - -# -# -# - -def := TARGET= def -all := TARGET= all -install := TARGET= install -install_h := TARGET= install_h -clean := TARGET= clean -clobber := TARGET= clobber -lint := TARGET= lint -lintlib := TARGET= lintlib -modlintlib := TARGET= modlintlib -modlist := TARGET= modlist -modlist := NO_STATE= -K $$MODSTATE$$$$ -clean.lint := TARGET= clean.lint -check := TARGET= check - -IMPLEMENTED_PLATFORM = SUNW,Netra-CP2300 - -# -# Default build targets. -# -.KEEP_STATE: - -.PARALLEL: $(SNOWBIRD_KMODS) - -def all clean clobber clean.lint modlist: $(SNOWBIRD_KMODS) - -install: $(ROOT_SNOWBIRD_DIR) $(USR_SNOWBIRD_DIR) \ - $(USR_SNOWBIRD_INC_DIR) \ - $(USR_SNOWBIRD_SBIN_DIR) \ - $(USR_SNOWBIRD_SBIN_PRTDIAG) \ - $(USR_SNOWBIRD_SBIN_FRUADM) \ - $(USR_SNOWBIRD_LIB_DIR) \ - .WAIT $(SNOWBIRD_KMODS) \ - ttymux_dacf ttymux.conf - -modlintlib: $(SNOWBIRD_KMODS) - -$(SNOWBIRD_KMODS): FRC - @cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET) - -ttymux_dacf: $(ROOT_SNOWBIRD_DACF_DIR_64) - -@$(RM) $(ROOT_SNOWBIRD_DACF_DIR_64)/$@ - $(SYMLINK) $(ROOT_SNOWBIRD_DACF_LINK_64)/$@ \ - $(ROOT_SNOWBIRD_DACF_DIR_64)/$@ - - -ttymux.conf: $(ROOT_SNOWBIRD_DRV_DIR_32) - -@$(RM) $(ROOT_SNOWBIRD_DRV_DIR_32)/$@ - $(SYMLINK) $(ROOT_SNOWBIRD_DRV_LINK_32)/$@ \ - $(ROOT_SNOWBIRD_DRV_DIR_32)/$@ - -install_h check: FRC - @cd sys; pwd; $(MAKE) $(TARGET) - -lint: modlintlib - -LINT_LIBS = $(LINT_LIB) \ - -L$(SNOWBIRD_LINT_LIB_DIR) \ - -L$(LINT_LIB_DIR) $(LINT_KMODS:%=-l%) \ - $(CLOSED_LINT_KMODS:%=-l%) \ - -L$(SPARC_LIB_DIR) $(SPARC_LINTS:%=-l%) - -lint.platmod: modlintlib - @-$(ECHO) "\nSnowbird Platform-dependent module: global crosschecks:" - @-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.2) - -# -# Include common targets. -# -include $(UTSBASE)/sun4u/snowbird/Makefile.targ diff --git a/usr/src/uts/sun4u/snowbird/Makefile.files b/usr/src/uts/sun4u/snowbird/Makefile.files deleted file mode 100644 index 1623055eda..0000000000 --- a/usr/src/uts/sun4u/snowbird/Makefile.files +++ /dev/null @@ -1,43 +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 -# -# -# uts/sun4u/snowbird/Makefile -# Copyright 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" -# -# This Makefile defines all file modules for the directory -# uts/sun4u/snowbird and its children. These are the source files -# which are snowbird "implementation architecture" dependent. -# - -# -# Object lists -# - -TODDS1307_OBJS = todds1307.o - -# -# Miscellaneous -# -INC_PATH += -I$(UTSBASE)/sun4u/snowbird diff --git a/usr/src/uts/sun4u/snowbird/Makefile.rules b/usr/src/uts/sun4u/snowbird/Makefile.rules deleted file mode 100644 index 4b0475b3c8..0000000000 --- a/usr/src/uts/sun4u/snowbird/Makefile.rules +++ /dev/null @@ -1,62 +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 -# -# -# uts/sun4u/snowbird/Makefile -# Copyright 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" -# -# This Makefile defines the build rules for the directory -# uts/sun4u/snowbird and its children. -# - -# -# C object build rules -# - -# -# snowbird specific drivers -# - - -$(OBJS_DIR)/%.o: $(UTSBASE)/sun4u/snowbird/io/todds1307/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -$(OBJS_DIR)/%.o: $(UTSBASE)/sun4u/snowbird/os/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -# -# Lint object build rules -# - -# -# snowbird specific drivers -# - -$(LINTS_DIR)/%.ln: $(UTSBASE)/sun4u/snowbird/io/todds1307/%.c - @($(LHEAD) $(LINT.c) $< $(LTAIL)) - -$(LINTS_DIR)/%.ln: $(UTSBASE)/sun4u/snowbird/os/%.c - @($(LHEAD) $(LINT.c) $< $(LTAIL)) diff --git a/usr/src/uts/sun4u/snowbird/Makefile.snowbird b/usr/src/uts/sun4u/snowbird/Makefile.snowbird deleted file mode 100644 index 961962c57f..0000000000 --- a/usr/src/uts/sun4u/snowbird/Makefile.snowbird +++ /dev/null @@ -1,115 +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 (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. -# -# -# Global definitions for sun4u snowbird implementation specific modules. -# uts/sun4u/snowbird/Makefile.snowbird -# - -# -# Define directories. -# -MONTECARLO = SUNW,UltraSPARC-IIi-Netract -SNOWBIRD = SUNW,Netra-CP2300 -ROOT_MONTECARLO_DIR = $(ROOT_PLAT_DIR)/$(MONTECARLO) -ROOT_SNOWBIRD_DIR = $(ROOT_PLAT_DIR)/SUNW,Netra-CP2300 -ROOT_SNOWBIRD_MOD_DIR = $(ROOT_SNOWBIRD_DIR)/kernel -ROOT_SNOWBIRD_MISC_DIR_32 = $(ROOT_SNOWBIRD_DIR)/kernel/misc -ROOT_SNOWBIRD_MISC_DIR_64 = $(ROOT_SNOWBIRD_MISC_DIR_32)/$(SUBDIR64) -ROOT_SNOWBIRD_KERN_DIR_32 = $(ROOT_SNOWBIRD_MOD_DIR) -ROOT_SNOWBIRD_KERN_DIR_64 = $(ROOT_SNOWBIRD_MOD_DIR)/$(SUBDIR64) -ROOT_SNOWBIRD_DRV_DIR_32 = $(ROOT_SNOWBIRD_MOD_DIR)/drv -ROOT_SNOWBIRD_DRV_DIR_64 = $(ROOT_SNOWBIRD_MOD_DIR)/drv/$(SUBDIR64) -ROOT_SNOWBIRD_DRV_LINK_32 = $(ROOT_SNOWBIRD_DRV_DIR_32:$(ROOT_SNOWBIRD_DIR)%=../../../$(MONTECARLO)%) -ROOT_SNOWBIRD_TOD_DIR_32 = $(ROOT_SNOWBIRD_MOD_DIR)/tod -ROOT_SNOWBIRD_TOD_DIR_64 = $(ROOT_SNOWBIRD_MOD_DIR)/tod/$(SUBDIR64) -ROOT_SNOWBIRD_DACF_DIR_32 = $(ROOT_SNOWBIRD_MOD_DIR)/dacf -ROOT_SNOWBIRD_DACF_DIR_64 = $(ROOT_SNOWBIRD_MOD_DIR)/dacf/$(SUBDIR64) -ROOT_SNOWBIRD_DACF_LINK_64 = $(ROOT_SNOWBIRD_DACF_DIR_64:$(ROOT_SNOWBIRD_DIR)%=../../../../$(MONTECARLO)%) - -ROOT_SNOWBIRD_KERN_DIR = $(ROOT_SNOWBIRD_KERN_DIR_$(CLASS)) -ROOT_SNOWBIRD_DRV_DIR = $(ROOT_SNOWBIRD_DRV_DIR_$(CLASS)) -ROOT_SNOWBIRD_TOD_DIR = $(ROOT_SNOWBIRD_TOD_DIR_$(CLASS)) -ROOT_SNOWBIRD_MISC_DIR = $(ROOT_SNOWBIRD_MISC_DIR_$(CLASS)) -ROOT_SNOWBIRD_DACF_DIR = $(ROOT_SNOWBIRD_DACF_DIR_$(CLASS)) - -ROOT_PLAT_MOD_DIRS += $(ROOT_SNOWBIRD_MOD_DIR) -ROOT_PLAT_MISC_DIRS += $(ROOT_SNOWBIRD_MISC_DIR) -ROOT_PLAT_DRV_DIRS += $(ROOT_SNOWBIRD_DRV_DIR) -ROOT_PLAT_DACF_DIRS += $(ROOT_SNOWBIRD_DACF_DIR) - -ROOT_SNOWBIRD_DACF_LINK = $(ROOT_SNOWBIRD_DACF_LINK_$(CLASS)) -ROOT_SNOWBIRD_DRV_LINK = $(ROOT_SNOWBIRD_DRV_LINK_$(CLASS)) - -USR_SNOWBIRD_DIR = $(USR_PLAT_DIR)/SUNW,Netra-CP2300 -USR_SNOWBIRD_INC_DIR = $(USR_SNOWBIRD_DIR)/include -USR_SNOWBIRD_SBIN_DIR = $(USR_SNOWBIRD_DIR)/sbin -USR_SNOWBIRD_SBIN_PRTDIAG = $(USR_SNOWBIRD_SBIN_DIR)/prtdiag -USR_SNOWBIRD_SBIN_FRUADM = $(USR_SNOWBIRD_SBIN_DIR)/fruadm -USR_SNOWBIRD_LIB_DIR = $(USR_SNOWBIRD_DIR)/lib -USR_SNOWBIRD_ISYS_DIR = $(USR_SNOWBIRD_INC_DIR)/sys - - -SNOWBIRD_LINT_LIB_DIR= $(UTSBASE)/$(PLATFORM)/snowbird/lint-libs/$(OBJS_DIR) - - -# Define Objects -# -SNOWBIRD_OBJS = snowbird.o - -# -# Define modules. -# -SNOWBIRD_KMODS = todds1307 platmod - -# -# Include the makefiles which define build rule templates, the -# collection of files per module, and a few specific flags. Note -# that order is significant, just as with an include path. The -# first build rule template which matches the files name will be -# used. By including these in order from most machine dependent -# to most machine independent, we allow a machine dependent file -# to be used in preference over a machine independent version -# (Such as a machine specific optimization, which preserves the -# interfaces.) -# - -include $(UTSBASE)/sun4u/snowbird/Makefile.files -# -# Include common rules. -# -include $(UTSBASE)/sun4u/Makefile.sun4u - -# -# Define the actual specific platforms -# -MACHINE_DEFS += -D$(PLATFORM) -D_MACHDEP -DSFMMU -MACHINE_DEFS += -D_SNOWBIRD - -# -# For now, disable these lint checks; maintainers should endeavor -# to investigate and remove these for maximum lint coverage. -# Please do not carry these forward to new Makefiles. -# -LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV - diff --git a/usr/src/uts/sun4u/snowbird/Makefile.targ b/usr/src/uts/sun4u/snowbird/Makefile.targ deleted file mode 100644 index 3eff14b011..0000000000 --- a/usr/src/uts/sun4u/snowbird/Makefile.targ +++ /dev/null @@ -1,104 +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 (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. -# -# uts/sun4u/snowbird/Makefile.targ -# Common targets for sun4u snowbird implementation specific modules. -# -# - -.KEEP_STATE: - -# -# Rules for implementation subdirectories. -# -$(ROOT_SNOWBIRD_DIR): $(ROOT_PLAT_DIR) - -$(INS.dir) - -$(ROOT_SNOWBIRD_MOD_DIR): $(ROOT_SNOWBIRD_DIR) - -$(INS.dir) - -$(ROOT_SNOWBIRD_DRV_DIR_32): $(ROOT_SNOWBIRD_MOD_DIR) - -$(INS.dir) - -$(ROOT_SNOWBIRD_DRV_DIR_64): $(ROOT_SNOWBIRD_DRV_DIR_32) - -$(INS.dir) - -$(ROOT_SNOWBIRD_TOD_DIR_32): $(ROOT_SNOWBIRD_MOD_DIR) - -$(INS.dir) - -$(ROOT_SNOWBIRD_TOD_DIR_64): $(ROOT_SNOWBIRD_TOD_DIR_32) - -$(INS.dir) - -$(ROOT_SNOWBIRD_MISC_DIR_32): $(ROOT_SNOWBIRD_MOD_DIR) - -$(INS.dir) - -$(ROOT_SNOWBIRD_MISC_DIR_64): $(ROOT_SNOWBIRD_MISC_DIR_32) - -$(INS.dir) - -$(ROOT_SNOWBIRD_DACF_DIR_32): $(ROOT_SNOWBIRD_MOD_DIR) - -$(INS.dir) - -$(ROOT_SNOWBIRD_DACF_DIR_64): $(ROOT_SNOWBIRD_DACF_DIR_32) - -$(INS.dir) - -$(ROOT_SNOWBIRD_MOD_DIR)/%: $(OBJS_DIR)/% $(ROOT_SNOWBIRD_MOD_DIR) FRC - $(INS.file) - -$(ROOT_SNOWBIRD_DACF_DIR)/%: $(OBJS_DIR)/% $(ROOT_SNOWBIRD_DACF_DIR) FRC - $(INS.file) - -$(ROOT_SNOWBIRD_MISC_DIR)/%: $(OBJS_DIR)/% $(ROOT_SNOWBIRD_MISC_DIR) FRC - $(INS.file) - -$(ROOT_SNOWBIRD_DRV_DIR)/%: $(OBJS_DIR)/% $(ROOT_SNOWBIRD_DRV_DIR) FRC - $(INS.file) - -$(ROOT_SNOWBIRD_TOD_DIR)/%: $(OBJS_DIR)/% $(ROOT_SNOWBIRD_TOD_DIR) FRC - $(INS.file) - -$(USR_SNOWBIRD_DIR): $(USR_PLAT_DIR) - $(INS.dir) - -$(USR_SNOWBIRD_INC_DIR): $(USR_SNOWBIRD_DIR) - -$(INS.dir) - -$(USR_SNOWBIRD_SBIN_DIR): $(USR_SNOWBIRD_DIR) - -$(INS.dir) - -$(USR_SNOWBIRD_SBIN_PRTDIAG): $(USR_SNOWBIRD_SBIN_DIR) - $(RM) -r $@; $(SYMLINK) ../../$(PLATFORM)/sbin/prtdiag $@ - -$(USR_SNOWBIRD_SBIN_FRUADM): $(USR_SNOWBIRD_SBIN_DIR) - $(RM) -r $@; $(SYMLINK) ../../$(PLATFORM)/sbin/fruadm $@ - -$(USR_SNOWBIRD_LIB_DIR): $(USR_SNOWBIRD_DIR) - -$(INS.dir) - -$(USR_SNOWBIRD_ISYS_DIR): $(USR_SNOWBIRD_INC_DIR) - -$(INS.dir) - -# -# Include common targets. -# -include $(UTSBASE)/sun4u/snowbird/Makefile.rules -include $(UTSBASE)/sun4u/Makefile.targ diff --git a/usr/src/uts/sun4u/snowbird/io/todds1307/todds1307.c b/usr/src/uts/sun4u/snowbird/io/todds1307/todds1307.c deleted file mode 100644 index e0fd37ee04..0000000000 --- a/usr/src/uts/sun4u/snowbird/io/todds1307/todds1307.c +++ /dev/null @@ -1,785 +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 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - -#include <sys/types.h> -#include <sys/conf.h> -#include <sys/devops.h> -#include <sys/kmem.h> -#include <sys/open.h> -#include <sys/file.h> -#include <sys/note.h> -#include <sys/ddi.h> -#include <sys/sunddi.h> - -#include <sys/modctl.h> -#include <sys/stat.h> -#include <sys/clock.h> -#include <sys/reboot.h> -#include <sys/machsystm.h> -#include <sys/poll.h> -#include <sys/pbio.h> -#include <sys/sysmacros.h> - -/* Added for prom interface */ -#include <sys/promif.h> -#include <sys/promimpl.h> - -#include <sys/i2c/misc/i2c_svc.h> -#include <sys/todds1307.h> - -#define I2C_DELAY 20000 -#define DS1307_DEVICE_TYPE "rtc" - -/* - * Driver enrty routines - */ -static int todds1307_attach(dev_info_t *, ddi_attach_cmd_t); -static int todds1307_detach(dev_info_t *, ddi_detach_cmd_t); -static int todds1307_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **); - -/* - * tod_ops entry routines - */ -static timestruc_t todds1307_get(void); -static void todds1307_set(timestruc_t); -static uint_t todds1307_set_watchdog_timer(uint_t); -static uint_t todds1307_clear_watchdog_timer(void); -static void todds1307_set_power_alarm(timestruc_t); -static void todds1307_clear_power_alarm(void); -static int todds1307_setup_prom(); -static void todds1307_rele_prom(); -static int todds1307_prom_getdate(struct rtc_t *rtc); -static int todds1307_prom_setdate(struct rtc_t *rtc); - -/* - * Local functions - */ -static int todds1307_read_rtc(struct rtc_t *); -static int todds1307_write_rtc(struct rtc_t *); - -/* Anchor for soft state structure */ -static void *ds1307_statep; -static int instance = -1; -static int todds1307_attach_done = 0; -static kmutex_t todds1307_rd_lock; -static ihandle_t todds1307_ihandle = 0; - -/* one second time out */ -#define I2c_CYCLIC_TIMEOUT 1000000000 -uint_t i2c_cyclic_timeout = I2c_CYCLIC_TIMEOUT; -static int sync_clock_once = 1; -static struct rtc_t soft_rtc; - -/* - * For debugging only - */ -static unsigned char int2bcd(int num); -static int bcd2int(unsigned char num); - -/* - * cp_ops structure - */ -static struct cb_ops ds1307_cbops = { - nodev, /* open */ - nodev, /* close */ - nodev, /* strategy */ - nodev, /* print */ - nodev, /* dump */ - nodev, /* read */ - nodev, /* write */ - nodev, /* ioctl */ - nodev, /* devmap */ - nodev, /* mmap */ - nodev, /* segmap */ - NULL, /* poll */ - ddi_prop_op, /* cb_prop_op */ - NULL, /* streamtab */ - D_NEW | D_MP, /* Driver compatibility flag */ - CB_REV, /* rev */ - nodev, /* int (*cb_aread)() */ - nodev /* int (*cb_awrite)() */ -}; - -/* - * dev_ops structure - */ -static struct dev_ops ds1307_ops = { - DEVO_REV, /* devo_rev */ - 0, /* refcnt - reference cnt always set to 0 */ - todds1307_getinfo, /* getinfo - Maybe requred */ - nulldev, /* identify */ - nulldev, /* probe */ - todds1307_attach, /* attach */ - todds1307_detach, /* detach */ - nodev, /* reset */ - &ds1307_cbops, /* cb_ops - ds1307 does not need this(?) */ - NULL, /* bus_ops */ - NULL, /* power */ - ddi_quiesce_not_needed, /* quiesce */ -}; - -static struct modldrv todds1307_modldrv = { - &mod_driverops, /* Type of module. This one is a driver */ - "tod driver for DS1307 v1.12", /* Name of the module */ - &ds1307_ops, /* Pointer to dev_ops */ -}; - -/* - * Module linkage structure - */ -static struct modlinkage todds1307_modlinkage = { - MODREV_1, - &todds1307_modldrv, - 0 -}; - -int -_init(void) -{ - int error; - - if (strcmp(tod_module_name, "todds1307") == 0) { - if ((error = ddi_soft_state_init(&ds1307_statep, - sizeof (ds1307_state_t), 0)) != DDI_SUCCESS) { - return (error); - } - - tod_ops.tod_get = todds1307_get; - tod_ops.tod_set = todds1307_set; - tod_ops.tod_set_watchdog_timer = todds1307_set_watchdog_timer; - tod_ops.tod_clear_watchdog_timer = - todds1307_clear_watchdog_timer; - tod_ops.tod_set_power_alarm = todds1307_set_power_alarm; - tod_ops.tod_clear_power_alarm = todds1307_clear_power_alarm; - } - - (void) todds1307_setup_prom(); - - /* - * Install the module - */ - if ((error = mod_install(&todds1307_modlinkage)) != 0) { - ddi_soft_state_fini(&ds1307_statep); - return (error); - } - mutex_init(&todds1307_rd_lock, NULL, MUTEX_DEFAULT, NULL); - - return (0); -} - -int -_fini(void) -{ - int error = 0; - - if (strcmp(tod_module_name, "todds1307") == 0) { - error = EBUSY; - } else { - if ((error = mod_remove(&todds1307_modlinkage)) == 0) { - ddi_soft_state_fini(&ds1307_statep); - mutex_destroy(&todds1307_rd_lock); - todds1307_rele_prom(); - } - } - - return (error); -} - -int -_info(struct modinfo *modinfop) -{ - return (mod_info(&todds1307_modlinkage, modinfop)); -} - -/* - * cyclical call to get tod. - */ -static void -todds1307_cyclic(void *arg) -{ - - (void) todds1307_read_rtc((struct rtc_t *)arg); - -} - -/* - * register ds1307 client device with i2c services, and - * allocate & initialize soft state structure. - */ -static int -todds1307_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) -{ - static ds1307_state_t *statep = NULL; - i2c_transfer_t *i2c_tp = NULL; - uint8_t tempVal = (uint8_t)0; - switch (cmd) { - - case DDI_ATTACH: - break; - case DDI_RESUME: - return (DDI_SUCCESS); - default: - return (DDI_FAILURE); - } - - if (instance != -1) { - return (DDI_FAILURE); - } - - instance = ddi_get_instance(dip); - - /* - * Allocate soft state structure - */ - if (ddi_soft_state_zalloc(ds1307_statep, instance) != DDI_SUCCESS) { - return (DDI_FAILURE); - } - - statep = ddi_get_soft_state(ds1307_statep, instance); - if (statep == NULL) { - return (DDI_FAILURE); - } - - statep->dip = dip; - - if (i2c_client_register(dip, &statep->ds1307_i2c_hdl) != I2C_SUCCESS) { - ddi_soft_state_free(ds1307_statep, instance); - delay(drv_usectohz(I2C_DELAY)); - return (DDI_FAILURE); - } - - /* check and initialize the oscillator */ - - (void) i2c_transfer_alloc(statep->ds1307_i2c_hdl, - &i2c_tp, 1, 1, I2C_SLEEP); - i2c_tp->i2c_version = I2C_XFER_REV; - i2c_tp->i2c_flags = I2C_WR_RD; - i2c_tp->i2c_wbuf[0] = (uchar_t)0x00; /* Read 00h */ - i2c_tp->i2c_wlen = 1; - i2c_tp->i2c_rlen = 1; - - if ((i2c_transfer(statep->ds1307_i2c_hdl, i2c_tp)) != I2C_SUCCESS) { - (void) i2c_transfer_free(statep->ds1307_i2c_hdl, i2c_tp); - ddi_soft_state_free(ds1307_statep, instance); - delay(drv_usectohz(I2C_DELAY)); - return (DDI_FAILURE); - } - - tempVal = i2c_tp->i2c_rbuf[0]; - - (void) i2c_transfer_free(statep->ds1307_i2c_hdl, i2c_tp); - - if (tempVal & 0x80) { /* check Oscillator */ - (void) i2c_transfer_alloc(statep->ds1307_i2c_hdl, &i2c_tp, - 2, 1, I2C_SLEEP); - i2c_tp->i2c_version = I2C_XFER_REV; - i2c_tp->i2c_flags = I2C_WR; - i2c_tp->i2c_wbuf[0] = 0x00; - i2c_tp->i2c_wbuf[1] = - (uchar_t)(i2c_tp->i2c_rbuf[0]& 0x7f); - i2c_tp->i2c_wlen = 2; - /* Enable oscillator */ - if ((i2c_transfer(statep->ds1307_i2c_hdl, i2c_tp)) - != I2C_SUCCESS) { - (void) i2c_transfer_free(statep->ds1307_i2c_hdl, - i2c_tp); - ddi_soft_state_free(ds1307_statep, instance); - return (DDI_FAILURE); - } - (void) i2c_transfer_free(statep->ds1307_i2c_hdl, i2c_tp); - } - - /* - * Create a periodical handler to read TOD. - */ - ASSERT(statep->cycid == NULL); - statep->cycid = ddi_periodic_add(todds1307_cyclic, &soft_rtc, - i2c_cyclic_timeout, DDI_IPL_1); - - statep->state = TOD_ATTACHED; - todds1307_attach_done = 1; - ddi_report_dev(dip); - - return (DDI_SUCCESS); -} - -/* - * Unregister ds1307 client device with i2c services and free - * soft state structure. - */ -/*ARGSUSED*/ -static int -todds1307_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) -{ - switch (cmd) { - - /* - * Once attached, do not allow detach because the system constantly - * calling todds1307_get() to get the time. If the driver is detached - * and the system try to get the time, the system will have memory - * problem. - * - * ds1307_state_t *statep = NULL; - * case DDI_DETACH: - * if ((statep = ddi_get_soft_state(ds1307_statep, - * instance)) == NULL) { - * return (ENOMEM); - * } - * i2c_client_unregister(statep->ds1307_i2c_hdl); - * ddi_soft_state_free(ds1307_statep, instance); - * return (DDI_SUCCESS); - */ - case DDI_SUSPEND: - return (DDI_SUCCESS); - - default: - return (DDI_FAILURE); - } -} - -/* *********************** tod_ops entry points ******************** */ - -/* - * Read the current time from the DS1307 chip and convert to UNIX form. - * Should be called with tod_clock held. - */ - -static timestruc_t -todds1307_get(void) -{ - timestruc_t ts; - todinfo_t tod; - struct rtc_t rtc; - - ASSERT(MUTEX_HELD(&tod_lock)); - - if (sync_clock_once) { - (void) todds1307_read_rtc(&soft_rtc); - sync_clock_once = 0; - } else { - tod_status_set(TOD_GET_FAILED); - return (hrestime); - } - - bcopy(&soft_rtc, &rtc, sizeof (rtc)); - - /* - * 00 - 68 = 2000 thru 2068 - * 69-99 = 1969 thru 1999 - */ - tod.tod_year = rtc.rtc_year; - if (rtc.rtc_year <= 68) - tod.tod_year += 100; - tod.tod_month = rtc.rtc_mon; - tod.tod_day = rtc.rtc_dom; - tod.tod_dow = rtc.rtc_dow; - tod.tod_hour = rtc.rtc_hrs; - tod.tod_min = rtc.rtc_min; - tod.tod_sec = rtc.rtc_sec; - - /* read was successful so ensure failure flag is clear */ - tod_status_clear(TOD_GET_FAILED); - - ts.tv_sec = tod_to_utc(tod); - ts.tv_nsec = 0; - return (ts); -} - -/* - * Program DS1307 with the specified time. - * Must be called with tod_lock held. The TOD - * chip supports date from 1969-2068 only. We must - * reject requests to set date below 2000. - */ -static void -todds1307_set(timestruc_t ts) -{ - struct rtc_t rtc; - todinfo_t tod = utc_to_tod(ts.tv_sec); - int year; - - - ASSERT(MUTEX_HELD(&tod_lock)); - - /* - * Year is base 1900, valid year range 1969-2068 - */ - if ((tod.tod_year < 69) || (tod.tod_year > 168)) - return; - - year = tod.tod_year; - if (year >= 100) - year -= 100; - - rtc.rtc_year = int2bcd(year); - rtc.rtc_mon = int2bcd(tod.tod_month); - rtc.rtc_dom = int2bcd(tod.tod_day); - rtc.rtc_dow = int2bcd(tod.tod_dow); - rtc.rtc_hrs = int2bcd(tod.tod_hour); - rtc.rtc_min = int2bcd(tod.tod_min); - rtc.rtc_sec = int2bcd(tod.tod_sec); - - (void) todds1307_write_rtc(&rtc); -} - -/* ARGSUSED */ -static void -todds1307_set_power_alarm(timestruc_t ts) -{ - ASSERT(MUTEX_HELD(&tod_lock)); -} - -/* ARGSUSED */ -static void -todds1307_clear_power_alarm(void) -{ - ASSERT(MUTEX_HELD(&tod_lock)); -} - -/* ARGSUSED */ -static uint_t -todds1307_set_watchdog_timer(uint_t timeoutval) -{ - ASSERT(MUTEX_HELD(&tod_lock)); - return (0); -} - -/* ARGSUSED */ -static uint_t -todds1307_clear_watchdog_timer(void) -{ - ASSERT(MUTEX_HELD(&tod_lock)); - return (0); -} - -/* ********************** Local functions ***************************** */ - -static char tod_read[7] = {-1, -1, -1, -1, -1, -1, -1}; -static int -todds1307_read_rtc(struct rtc_t *rtc) -{ - static ds1307_state_t *statep = NULL; - i2c_transfer_t *i2c_tp = NULL; - int i2c_cmd_status = I2C_FAILURE; - int counter = 4; - - if (!todds1307_attach_done) { - return (todds1307_prom_getdate(rtc)); - } - - statep = ddi_get_soft_state(ds1307_statep, instance); - if (statep == NULL) { - cmn_err(CE_WARN, "todds1307: ddi_get_soft_state failed"); - return (DDI_FAILURE); - } - - mutex_enter(&todds1307_rd_lock); - - /* - * Allocate 1 byte for write buffer and 7 bytes for read buffer to - * to accomodate sec, min, hrs, dayOfWeek, dayOfMonth, year - */ - if ((i2c_transfer_alloc(statep->ds1307_i2c_hdl, &i2c_tp, 1, - 7, I2C_SLEEP)) != I2C_SUCCESS) { - mutex_exit(&todds1307_rd_lock); - return (DDI_FAILURE); - } - - do { - i2c_tp->i2c_version = I2C_XFER_REV; - i2c_tp->i2c_flags = I2C_WR_RD; - i2c_tp->i2c_wbuf[0] = (uchar_t)0x00; /* Start from reg 0x00 */ - i2c_tp->i2c_wlen = 1; /* Write one byte address */ - i2c_tp->i2c_rlen = 7; /* Read 7 regs */ - - if ((i2c_cmd_status = i2c_transfer(statep->ds1307_i2c_hdl, - i2c_tp)) != I2C_SUCCESS) { - drv_usecwait(I2C_DELAY); - goto done; - } - /* for first read, need to get valid data */ - while (tod_read[0] == -1 && counter > 0) { - /* move data to static buffer */ - bcopy(i2c_tp->i2c_rbuf, tod_read, 7); - - /* now read again */ - /* Start reading reg from 0x00 */ - i2c_tp->i2c_wbuf[0] = (uchar_t)0x00; - i2c_tp->i2c_wlen = 1; /* Write one byte address */ - i2c_tp->i2c_rlen = 7; /* Read 7 regs */ - if ((i2c_cmd_status = i2c_transfer(statep->ds1307_i2c_hdl, - i2c_tp)) != I2C_SUCCESS) { - drv_usecwait(I2C_DELAY); - goto done; - } - /* if they are not the same, then read again */ - if (bcmp(tod_read, i2c_tp->i2c_rbuf, 7) != 0) { - tod_read[0] = -1; - counter--; - } - } - - } while (i2c_tp->i2c_rbuf[0] == 0x59 && - /* if seconds register is 0x59 (BCD), add data should match */ - bcmp(&tod_read[1], &i2c_tp->i2c_rbuf[1], 6) != 0 && - counter-- > 0); - - if (counter < 0) - cmn_err(CE_WARN, "i2ctod: TOD Chip failed ??"); - - /* move data to static buffer */ - bcopy(i2c_tp->i2c_rbuf, tod_read, 7); - - - rtc->rtc_year = bcd2int(i2c_tp->i2c_rbuf[6]); - rtc->rtc_mon = bcd2int(i2c_tp->i2c_rbuf[5]); - rtc->rtc_dom = bcd2int(i2c_tp->i2c_rbuf[4]); - rtc->rtc_dow = bcd2int(i2c_tp->i2c_rbuf[3]); - rtc->rtc_hrs = bcd2int(i2c_tp->i2c_rbuf[2]); - rtc->rtc_min = bcd2int(i2c_tp->i2c_rbuf[1]); - rtc->rtc_sec = bcd2int(i2c_tp->i2c_rbuf[0]); - -done: - (void) i2c_transfer_free(statep->ds1307_i2c_hdl, i2c_tp); - - mutex_exit(&todds1307_rd_lock); - return (i2c_cmd_status); -} - - -static int -todds1307_write_rtc(struct rtc_t *rtc) -{ - ds1307_state_t *statep = NULL; - i2c_transfer_t *i2c_tp = NULL; - int i2c_cmd_status = I2C_SUCCESS; - - - if (!todds1307_attach_done) { - return (todds1307_prom_setdate(rtc)); - } - - statep = ddi_get_soft_state(ds1307_statep, instance); - if (statep == NULL) { - return (DDI_FAILURE); - } - - if ((i2c_cmd_status = i2c_transfer_alloc(statep->ds1307_i2c_hdl, - &i2c_tp, 8, 0, I2C_SLEEP)) != I2C_SUCCESS) { - return (i2c_cmd_status); - } - - i2c_tp->i2c_version = I2C_XFER_REV; - i2c_tp->i2c_flags = I2C_WR; - i2c_tp->i2c_wbuf[0] = (uchar_t)0x00; - i2c_tp->i2c_wbuf[1] = rtc->rtc_sec; - i2c_tp->i2c_wbuf[2] = rtc->rtc_min; - i2c_tp->i2c_wbuf[3] = rtc->rtc_hrs; - i2c_tp->i2c_wbuf[4] = rtc->rtc_dow; - i2c_tp->i2c_wbuf[5] = rtc->rtc_dom; - i2c_tp->i2c_wbuf[6] = rtc->rtc_mon; - i2c_tp->i2c_wbuf[7] = rtc->rtc_year; - i2c_tp->i2c_wlen = 8; - - if ((i2c_cmd_status = i2c_transfer(statep->ds1307_i2c_hdl, - i2c_tp)) != I2C_SUCCESS) { - (void) i2c_transfer_free(statep->ds1307_i2c_hdl, i2c_tp); - /* delay(drv_usectohz(I2C_DELAY)); */ - drv_usecwait(I2C_DELAY); - return (i2c_cmd_status); - } - - tod_read[0] = -1; /* invalidate saved data from read routine */ - - (void) i2c_transfer_free(statep->ds1307_i2c_hdl, i2c_tp); - - return (i2c_cmd_status); -} - - -/*ARGSUSED*/ -static int -todds1307_getinfo(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, - void **result) -{ - ds1307_state_t *softsp; - - if (instance == -1) { - return (DDI_FAILURE); - } - - switch (infocmd) { - case DDI_INFO_DEVT2DEVINFO: - if ((softsp = ddi_get_soft_state(ds1307_statep, instance)) - == NULL) - return (DDI_FAILURE); - *result = (void *)softsp->dip; - return (DDI_SUCCESS); - - case DDI_INFO_DEVT2INSTANCE: - *result = (void *)(uintptr_t)instance; - return (DDI_SUCCESS); - - default: - return (DDI_FAILURE); - } -} - -/* - * Conversion functions - */ -static unsigned char -int2bcd(int num) { - return (((num / 10) << 4) /* tens BCD digit in high four bits */ - + (num % 10)); /* units digit goes in low four bits */ -} - -static int -bcd2int(unsigned char num) { - return (((num >> 4) * 10) /* 10 times high-order four bits */ - + (num & 0x0f)); /* plus low-order four bits */ -} - -/* - * Finds the device node with device_type "rtc" and opens it to - * execute the get-time method - */ -static int -todds1307_setup_prom() -{ - pnode_t todnode; - char tod1307_devpath[MAXNAMELEN]; - - if ((todnode = prom_findnode_bydevtype(prom_rootnode(), - DS1307_DEVICE_TYPE)) == OBP_NONODE) - return (DDI_FAILURE); - - /* - * We now have the phandle of the rtc node, we need to open the - * node and get the ihandle - */ - if (prom_phandle_to_path(todnode, tod1307_devpath, - sizeof (tod1307_devpath)) < 0) { - cmn_err(CE_WARN, "prom_phandle_to_path failed"); - return (DDI_FAILURE); - } - - /* - * Now open the node and store it's ihandle - */ - if ((todds1307_ihandle = prom_open(tod1307_devpath)) == NULL) { - cmn_err(CE_WARN, "prom_open failed"); - return (DDI_FAILURE); - } - - return (DDI_SUCCESS); -} - -/* - * Closes the prom interface - */ -static void -todds1307_rele_prom() -{ - (void) prom_close(todds1307_ihandle); -} - -/* - * Read the date using "get-time" method in rtc node - * PROM returns 1969-1999 when reading 69-99 and - * 2000-2068 when reading 00-68 - */ -static int -todds1307_prom_getdate(struct rtc_t *rtc) -{ - int year; - cell_t ci[12]; - - ci[0] = p1275_ptr2cell("call-method"); /* Service name */ - ci[1] = 2; /* # of arguments */ - ci[2] = 7; /* # of result cells */ - ci[3] = p1275_ptr2cell("get-time"); - ci[4] = p1275_ihandle2cell(todds1307_ihandle); - - promif_preprom(); - (void) p1275_cif_handler(&ci); - promif_postprom(); - - year = p1275_cell2int(ci[6]); - rtc->rtc_mon = p1275_cell2int(ci[7]); - rtc->rtc_dom = p1275_cell2int(ci[8]); - rtc->rtc_dow = 0; - rtc->rtc_hrs = p1275_cell2int(ci[9]); - rtc->rtc_min = p1275_cell2int(ci[10]); - rtc->rtc_sec = p1275_cell2int(ci[11]); - if (year >= 2000) - year -= 2000; - else - year -= 1900; - rtc->rtc_year = year; - - return (DDI_SUCCESS); -} - -/* - * Read the date using "set-time" method in rtc node - * For values 00 - 68, write 2000-2068, and for 69-99, - * write 1969-1999 - */ -static int -todds1307_prom_setdate(struct rtc_t *rtc) -{ - int year; - cell_t ci[12]; - - year = rtc->rtc_year; - - if ((year < 0) || (year > 99)) - return (DDI_FAILURE); - - if (year <= 68) - year = rtc->rtc_year + 2000; - else - year = rtc->rtc_year + 1900; - - ci[0] = p1275_ptr2cell("call-method"); /* Service name */ - ci[1] = 8; /* # of arguments */ - ci[2] = 0; /* # of result cells */ - ci[3] = p1275_ptr2cell("set-time"); - ci[4] = p1275_ihandle2cell(todds1307_ihandle); - ci[5] = p1275_int2cell(year); - ci[6] = p1275_int2cell(rtc->rtc_mon); - ci[7] = p1275_int2cell(rtc->rtc_dom); - ci[8] = p1275_int2cell(rtc->rtc_hrs); - ci[9] = p1275_int2cell(rtc->rtc_min); - ci[10] = p1275_int2cell(rtc->rtc_sec); - - promif_preprom(); - (void) p1275_cif_handler(&ci); - promif_postprom(); - - return (DDI_SUCCESS); -} diff --git a/usr/src/uts/sun4u/snowbird/os/snowbird.c b/usr/src/uts/sun4u/snowbird/os/snowbird.c deleted file mode 100644 index 27af12bf4c..0000000000 --- a/usr/src/uts/sun4u/snowbird/os/snowbird.c +++ /dev/null @@ -1,264 +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 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/sysmacros.h> -#include <sys/sunddi.h> -#include <sys/esunddi.h> -#include <sys/sunndi.h> - -#include <sys/platform_module.h> -#include <sys/errno.h> - -#define SHARED_SMBUS_PATH "/pci@1f,0/pci@1,1/pmu@3/i2c@0,0/i2c-nvram@0,8e" -static dev_info_t *shared_smbus_dip; -static kmutex_t snowbird_smbus_mutex; - -void -startup_platform(void) -{ - mutex_init(&snowbird_smbus_mutex, NULL, NULL, NULL); -} - -int -set_platform_tsb_spares() -{ - return (0); -} - -void -set_platform_defaults(void) -{ - extern char *tod_module_name; - tod_module_name = "todds1307"; -} - -/* - * Definitions for accessing the pci config space of the isa node - * of Southbridge. - */ -#define PLATFORM_ISA_PATHNAME "/pci@1f,0/isa@7" -#define PLATFORM_ISA_PATHNAME_WITH_SIMBA "/pci@1f,0/pci@1,1/isa@7" -ddi_acc_handle_t platform_isa_handle; /* handle for isa pci space */ - -void -load_platform_drivers(void) -{ - dev_info_t *dip; /* dip of the isa driver */ - - if (ddi_install_driver("power") != DDI_SUCCESS) - cmn_err(CE_WARN, "Failed to install \"power\" driver."); - - /* - * It is OK to return error because 'us' driver is not available - * in all clusters (e.g. missing in Core cluster). - */ - (void) ddi_install_driver("us"); - - /* - * Install Isa driver. This is required for the southbridge IDE - * workaround - to reset the IDE channel during IDE bus reset. - * Panic the system in case ISA driver could not be loaded or - * any problem in accessing its pci config space. Since the register - * to reset the channel for IDE is in ISA config space!. - */ - dip = e_ddi_hold_devi_by_path(PLATFORM_ISA_PATHNAME_WITH_SIMBA, 0); - - if (dip == NULL) - dip = e_ddi_hold_devi_by_path(PLATFORM_ISA_PATHNAME, 0); - - if (dip == NULL) { - cmn_err(CE_PANIC, "Could not install the isa driver\n"); - return; - } - - if (pci_config_setup(dip, &platform_isa_handle) != DDI_SUCCESS) { - cmn_err(CE_PANIC, "Could not get the config space of isa\n"); - return; - } - - /* - * Figure out which smbus_dip is shared with OBP for the nvram - * device, so the lock can be acquired. - * - * This should really be done elsewhere, like startup_platform, but - * that runs before the devinfo tree is setup with configure(). - * So it is here until there is a better place. - */ - dip = e_ddi_hold_devi_by_path(SHARED_SMBUS_PATH, 0); - - if (dip != NULL) { - ASSERT(dip != NULL); - shared_smbus_dip = ddi_get_parent(dip); - - ndi_hold_devi(shared_smbus_dip); - ndi_rele_devi(dip); - } else { - shared_smbus_dip = NULL; - } - - /* - * Install the TOD driver - */ - if (ddi_install_driver("todds1307") != DDI_SUCCESS) - cmn_err(CE_WARN, "Failed to install \"todds1307\" driver."); -} - -/* - * This routine provides a workaround for a bug in the SB chip which - * can cause data corruption. Will be invoked from the IDE HBA driver for - * Acer SouthBridge at the time of IDE bus reset. - */ -/*ARGSUSED*/ -int -plat_ide_chipreset(dev_info_t *dip, int chno) -{ - uint8_t val; - int ret = DDI_SUCCESS; - - val = pci_config_get8(platform_isa_handle, 0x58); - /* - * The dip passed as the argument is not used for snowbird. - * This will be needed for platforms which have multiple on-board SB, - * The dip passed will be used to match the corresponding ISA node. - */ - switch (chno) { - case 0: - /* - * First disable the primary channel then re-enable it. - * As per ALI no wait should be required in between have - * given 1ms delay in between to be on safer side. - * bit 2 of register 0x58 when 0 disable the channel 0. - * bit 2 of register 0x58 when 1 enables the channel 0. - */ - pci_config_put8(platform_isa_handle, 0x58, val & 0xFB); - drv_usecwait(1000); - pci_config_put8(platform_isa_handle, 0x58, val); - break; - case 1: - /* - * bit 3 of register 0x58 when 0 disable the channel 1. - * bit 3 of register 0x58 when 1 enables the channel 1. - */ - pci_config_put8(platform_isa_handle, 0x58, val & 0xF7); - drv_usecwait(1000); - pci_config_put8(platform_isa_handle, 0x58, val); - break; - default: - /* - * Unknown channel number passed. Return failure. - */ - ret = DDI_FAILURE; - } - - return (ret); -} - - - -/*ARGSUSED*/ -int -plat_cpu_poweron(struct cpu *cp) -{ - return (ENOTSUP); /* not supported on this platform */ -} - -/*ARGSUSED*/ -int -plat_cpu_poweroff(struct cpu *cp) -{ - return (ENOTSUP); /* not supported on this platform */ -} - -/*ARGSUSED*/ -void -plat_freelist_process(int mnode) -{ -} - -char *platform_module_list[] = { - (char *)0 -}; - -/*ARGSUSED*/ -void -plat_tod_fault(enum tod_fault_type tod_bad) -{ -} - -/* - * Unfortunately, snowbird's smbus controller is used by both OBP - * and the OS's i2c drivers. The 'eeprom' command executes - * OBP code to handle property requests. If eeprom didn't do this, or if the - * controllers were partitioned so that all devices on a given controller were - * driven by either OBP or the OS, this wouldn't be necessary. - * - * Note that getprop doesn't have the same issue as it reads from cached - * memory in OBP. - */ - -/* - * Common locking enter code - */ -void -plat_setprop_enter(void) -{ - mutex_enter(&snowbird_smbus_mutex); -} - -/* - * Common locking exit code - */ -void -plat_setprop_exit(void) -{ - mutex_exit(&snowbird_smbus_mutex); -} - -/* - * Called by smbus driver - */ -void -plat_shared_i2c_enter(dev_info_t *dip) -{ - if (dip == shared_smbus_dip) { - plat_setprop_enter(); - } -} - -/* - * Called by smbus driver - */ -void -plat_shared_i2c_exit(dev_info_t *dip) -{ - if (dip == shared_smbus_dip) { - plat_setprop_exit(); - } -} diff --git a/usr/src/uts/sun4u/snowbird/platmod/Makefile b/usr/src/uts/sun4u/snowbird/platmod/Makefile deleted file mode 100644 index 60340b2180..0000000000 --- a/usr/src/uts/sun4u/snowbird/platmod/Makefile +++ /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 (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. -# - -# -# This makefile drives the production of the sun4u snowbird platform -# module. -# -# sun4u implementation architecture dependent -# - -# -# Path to the base of the uts directory tree (usually /usr/src/uts). -# -UTSBASE = ../../.. - -# -# Define the module and object file sets. -# -MODULE = platmod -OBJECTS = $(SNOWBIRD_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(SNOWBIRD_OBJS:%.o=$(LINTS_DIR)/%.ln) -ROOTMODULE = $(ROOT_SNOWBIRD_MISC_DIR)/$(MODULE) - -PLAT_DIR = . -HERE = ../snowbird/platmod - -# -# Include common rules. -# -include $(UTSBASE)/sun4u/snowbird/Makefile.snowbird - -# -# Override defaults -# -CLEANFILES += $(PLATLIB) $(SYM_MOD) - -# -# Define targets -# -ALL_TARGET = $(SYM_MOD) -LINT_TARGET = $(MODULE).lint -INSTALL_TARGET = $(BINARY) $(ROOTMODULE) - -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) - -# -# Default build targets. -# -.KEEP_STATE: - -def: $(DEF_DEPS) - -all: $(ALL_DEPS) - -clean: $(CLEAN_DEPS) - -clobber: $(CLOBBER_DEPS) - -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - -install: $(INSTALL_DEPS) - -check: - -LINT_LIB_DIR = $(SNOWBIRD_LINT_LIB_DIR) - -$(PLATLIB): $(OBJECTS) - $(BUILD.SO) $(OBJECTS) - -$(SYM_MOD): $(UNIX_O) $(PLATLIB) - @echo "resolving symbols against unix.o" - @(cd $(UNIX_DIR); pwd; \ - PLAT_DIR=$(HERE) SYM_MOD=$(HERE)/$(SYM_MOD) $(MAKE) symcheck) - -# -# Include common targets. -# -include $(UTSBASE)/sun4u/snowbird/Makefile.targ diff --git a/usr/src/uts/sun4u/snowbird/sys/Makefile b/usr/src/uts/sun4u/snowbird/sys/Makefile deleted file mode 100644 index 76da598e4a..0000000000 --- a/usr/src/uts/sun4u/snowbird/sys/Makefile +++ /dev/null @@ -1,65 +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 -# -# -# uts/sun4u/snowbird/sys/Makefile -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -UTSBASE = ../../.. - -# -# include global definitions -# -include ../Makefile.snowbird - -# -# Override defaults. -# -FILEMODE = 644 - -HDRS= todds1307.h - -ROOTDIR= $(ROOT)/usr/include/sys - -ROOTHDRS= $(HDRS:%=$(ROOTDIR)/%) - -CHECKHDRS= $(HDRS:%.h=%.check) - -.KEEP_STATE: - -.PARALLEL: $(CHECKHDRS) $(ROOTHDRS) - -install_h: - -check: $(CHECKHDRS) - -# -# install rules -# -$(ROOTDIR)/%: % $(ROOTDIR) - $(INS.file) - -$(ROOTDIR): - $(INS.dir) - -FRC: - -include ../Makefile.targ diff --git a/usr/src/uts/sun4u/snowbird/sys/todds1307.h b/usr/src/uts/sun4u/snowbird/sys/todds1307.h deleted file mode 100644 index dd006c174b..0000000000 --- a/usr/src/uts/sun4u/snowbird/sys/todds1307.h +++ /dev/null @@ -1,97 +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 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _TODDS1307_H -#define _TODDS1307_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/i2c/clients/i2c_client.h> - -extern char *v_rtc_addr_reg; -extern volatile uint8_t *v_rtc_data_reg; - -#define DS1307_ADDR_REG *(volatile uint8_t *)v_rtc_addr_reg -#define DS1307_DATA_REG *(volatile uint8_t *)v_rtc_data_reg -#define DS1307_NODE_TYPE "ddi_i2c:tod" - -struct rtc_t { - uint8_t rtc_sec; /* Seconds[0-60] */ - uint8_t rtc_min; /* Minutes[0-60] */ - uint8_t rtc_hrs; /* Hours[(1-12)/(0-23)] */ - uint8_t rtc_dow; /* Day of week[1-7] */ - uint8_t rtc_dom; /* Day of month[(1-28/29/30/31)] */ - uint8_t rtc_mon; /* Month[1-12] */ - uint8_t rtc_year; /* Year[00-99] */ - uint8_t rtc_ctl; /* DS1307 Control register */ -}; - - -/* - * Register definitions for RTC driver (DS1307 chip) - */ - -#define RTC_SEC 0x00 /* 00h Second */ -#define RTC_MIN 0x01 /* 01h Minutes */ -#define RTC_HRS 0x02 /* 02h Hours */ -#define RTC_DOW 0x03 /* 03h Day-of-week */ -#define RTC_DOM 0x04 /* 04h Day-of-month */ -#define RTC_MON 0x05 /* 05h Month */ -#define RTC_YEAR 0x06 /* 06h Year */ -#define RTC_CTL 0x07 /* 07h Control reg. */ - -/* Oscillator */ - -#define OSCILLATOR_REG 0x00 /* Oscillator Reg Addr */ -#define OSCILLATOR_DISABLE 0x80 - -/* per instance based */ - -#define TOD_DETACHED 0x00 /* TOD detached */ -#define TOD_ATTACHED 0x01 /* TOD attached */ - -typedef struct ds1307_state { - i2c_client_hdl_t ds1307_i2c_hdl; - char i2ctod_name[MAXNAMELEN]; /* node name */ - kmutex_t i2ctod_mutex; /* protects soft state */ - int instance; - dev_info_t *dip; - uint32_t state; - ddi_periodic_t cycid; /* periodical callback */ - struct rtc_t rtc; - i2c_transfer_t *i2c_tp; - ddi_softintr_t soft_intr_id; - uint32_t progress; -}ds1307_state_t; - -#ifdef __cplusplus -} -#endif - -#endif /* _TODDS1307_H */ diff --git a/usr/src/uts/sun4u/snowbird/todds1307/Makefile b/usr/src/uts/sun4u/snowbird/todds1307/Makefile deleted file mode 100644 index a5dc08e8fb..0000000000 --- a/usr/src/uts/sun4u/snowbird/todds1307/Makefile +++ /dev/null @@ -1,87 +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 -# -# -# uts/sun4u/snowbird/todds1307/Makefile -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" - -# This makefile drives the production of the snowbird_fans driver. -# -# Path to the base of the uts directory tree (usually /usr/src/uts). - -UTSBASE = ../../.. - -# -# Define the module and object file sets. -# -MODULE = todds1307 -OBJECTS = $(TODDS1307_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(TODDS1307_OBJS:%.o=$(LINTS_DIR)/%.ln) -ROOTMODULE = $(ROOT_SNOWBIRD_TOD_DIR)/$(MODULE) - -# -# Include common rules. -# -include $(UTSBASE)/sun4u/snowbird/Makefile.snowbird - -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) -I../../../sun4u - -LDFLAGS += -dy -N misc/i2c_svc - -CPPFLAGS += -I$(UTSBASE)/sun4u/snowbird - -# -# Define targets -# -ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint -INSTALL_TARGET = $(BINARY) $(ROOTMODULE) - -.KEEP_STATE: - -def: $(DEF_DEPS) - -all: $(ALL_DEPS) - -clean: $(CLEAN_DEPS) - -clobber: $(CLOBBER_DEPS) - -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - -install: $(INSTALL_DEPS) - -LINT_LIB_DIR = $(SNOWBIRD_LINT_LIB_DIR) - -# -# Include common targets -# -include $(UTSBASE)/sun4u/snowbird/Makefile.targ diff --git a/usr/src/uts/sun4u/spitfire/Makefile b/usr/src/uts/sun4u/spitfire/Makefile index 0b2df11653..d6b1481448 100644 --- a/usr/src/uts/sun4u/spitfire/Makefile +++ b/usr/src/uts/sun4u/spitfire/Makefile @@ -86,7 +86,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_BAD_FORMAT_STR2 -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/su/Makefile b/usr/src/uts/sun4u/su/Makefile index 25dc6f0f8f..533f0614ce 100644 --- a/usr/src/uts/sun4u/su/Makefile +++ b/usr/src/uts/sun4u/su/Makefile @@ -70,7 +70,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/sunfire/ac/Makefile b/usr/src/uts/sun4u/sunfire/ac/Makefile index f73e528bab..966a97147e 100644 --- a/usr/src/uts/sun4u/sunfire/ac/Makefile +++ b/usr/src/uts/sun4u/sunfire/ac/Makefile @@ -58,7 +58,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # lint pass one enforcement # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Turn on doubleword alignment for 64 bit registers diff --git a/usr/src/uts/sun4u/sunfire/sysctrl/Makefile b/usr/src/uts/sun4u/sunfire/sysctrl/Makefile index c17f77d6a2..21411d8b9d 100644 --- a/usr/src/uts/sun4u/sunfire/sysctrl/Makefile +++ b/usr/src/uts/sun4u/sunfire/sysctrl/Makefile @@ -60,7 +60,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Turn on doubleword alignment for 64 bit registers diff --git a/usr/src/uts/sun4u/sys/smc_commands.h b/usr/src/uts/sun4u/sys/smc_commands.h deleted file mode 100644 index 1b6aea9cf9..0000000000 --- a/usr/src/uts/sun4u/sys/smc_commands.h +++ /dev/null @@ -1,265 +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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_SMC_COMMANDS_H -#define _SYS_SMC_COMMANDS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Address of BMC on IPMB */ -#define BMC_IPMB_ADDR 0x20 -#define SMC_CPCI_SLOT0_ADDR 0xB0 -#define SMC_CPCI_SLOT_ADDR(X) (SMC_CPCI_SLOT0_ADDR + \ - 2 * ((X) - 1)) - -typedef struct ctsmc_code_ent { - uint8_t code; - char *name; -} ctsmc_code_ent_t; - -/* - * Definition of Network Function Codes - */ -typedef enum { - SMC_NETFN_CHASSIS_REQ = 0x0, - SMC_NETFN_CHASSIS_RSP = 0x1, - SMC_NETFN_BRIDGE_REQ = 0x2, - SMC_NETFN_BRIDGE_RSP = 0x3, - SMC_NETFN_SENSOR_REQ = 0x4, - SMC_NETFN_SENSOR_RSP = 0x5, - SMC_NETFN_APP_REQ = 0x6, - SMC_NETFN_APP_RSP = 0x7, - SMC_NETFN_FIRMWARE_REQ = 0x8, - SMC_NETFN_FIRMWARE_RSP = 0x9, - SMC_NETFN_STORAGE_REQ = 0xA, - SMC_NETFN_STORAGE_RSP = 0xB -} smc_netfn_t; - -/* - * Definition of Completion codes - */ -typedef enum { - SMC_CC_SUCCESS = 0x00, - SMC_CC_NODE_BUSY = 0xC0, - SMC_CC_INVALID_COMMAND = 0xC1, - SMC_CC_INVALID_COMMAND_ON_LUN = 0xC2, - SMC_CC_TIMEOUT = 0xC3, - SMC_CC_RESOURCE_NOTAVAIL = 0xC4, - SMC_CC_RESERVATION = 0xC5, - SMC_CC_REQ_TRUNC = 0xC6, - SMC_CC_REQLEN_NOTVALID = 0xC7, - SMC_CC_REQLEN_EXCEED = 0xC8, - SMC_CC_PARAM_OUT_OF_RANGE = 0xC9, - SMC_CC_REQUEST_BYTES_FAILED = 0xCA, - SMC_CC_NOT_PRESENT = 0xCB, - SMC_CC_INVALID_FIELD = 0xCC, - SMC_CC_ILLEGAL_COMMAND = 0xCD, - SMC_CC_RESPONSE_FAILED = 0xCE, - SMC_CC_DUPLICATE_REQUEST = 0xCF, - SMC_CC_SDR_UPDATE_MODE = 0xD0, - SMC_CC_FIRMWARE_UPDATE_MODE = 0xD1, - SMC_CC_INIT_IN_PROGRESS = 0xD2, - SMC_CC_UNSPECIFIED_ERROR = 0xFF -} smc_cc_t; - -typedef enum { - SMC_BMC_LUN, - SMC_OEM1_LUN, - SMC_SMS_LUN, - SMC_OEM2_LUN -} smc_lun_t; - -/* - * App command codes for commands/event notifications etc. - */ -typedef enum { - SMC_GET_DEVICE_ID = 0x01, - SMC_COLD_RESET = 0x02, - SMC_WARM_RESET = 0x03, - SMC_GET_SELFTEST_RESULTS = 0x04, - SMC_MANUFACTURING_TEST_ON = 0x05, - SMC_SET_ACPI_POWER_STATE = 0x06, - SMC_GET_ACPI_POWER_STATE = 0x07, - SMC_GET_DEVICE_GUID = 0x08, - SMC_RESET_WATCHDOG_TIMER = 0x22, - SMC_EXPIRED_WATCHDOG_NOTIF = 0x23, /* Sent by driver */ - SMC_SET_WATCHDOG_TIMER = 0x24, - SMC_GET_WATCHDOG_TIMER = 0x25, - SMC_SET_GLOBAL_ENABLES = 0x2E, - SMC_GET_GLOBAL_ENABLES = 0x2F, - SMC_CLEAR_MESSAGE_FLAGS = 0x30, - SMC_GET_MESSAGE_FLAGS = 0x31, - SMC_ENABLE_MESSAGE_CHANNEL_RECEIVE = 0x32, - SMC_GET_MESSAGE = 0x33, - SMC_SEND_MESSAGE = 0x34, - SMC_READ_EVENT_MSG_BUFFER = 0x35, - SMC_SEND_TO_EVENT_MSG_BUFFER = 0x36, /* Changed from IPMI */ - SMC_MASTER_WR_RD_I2C = 0x52, - SMC_GET_GEOGRAPHICAL_ADDRESS = 0x55, - SMC_GET_BACKPLANE_TYPE = 0x57, - SMC_SELECT_MEMORY_DEVICE = 0x60, - SMC_READ_SELECTED_MEMORY_DEVICE = 0x61, - SMC_READ_MEMORY_DEVICE = 0x62, - SMC_WRITE_SELECTED_MEMORY_DEVICE = 0x63, - SMC_WRITE_MEMORY_DEVICE = 0x64, - SMC_ERASE_SELECTED_MEMORY_DEVICE = 0x65, - SMC_LOCK_UNLOCK_SELECTED_MEMORY = 0x66, - SMC_COMPUTE_CRC16_OF_SELECTED_MEMORY_DEVICE = 0x67, - SMC_COMPUTE_CRC16_OF_MEMORY_DEVICE = 0x68, - SMC_FILL_MEMORY_DEVICE = 0x6a, - SMC_QUERY_FIRMWARE_VERSION = 0x6f, - SMC_RESET_DEVICE = 0x70, - SMC_GET_ROLE_INFO = 0x71, - SMC_GET_FLASH_AND_BOOT_VERSION = 0x72, - SMC_GET_LOCAL_HA_SIGNAL_STATUS = 0x73, - SMC_SELECT_HA_HOTSWAP_MODE = 0x80, - SMC_GET_HA_HOTSWAP_SIGNAL_STATE = 0x81, - SMC_SET_HA_HOTSWAP_SIGNAL_STATE = 0x82, - SMC_NOTIFY_SMC_OF_HOST_HEALTH = 0x83, - SMC_TURN_ON_OFF_BLUE_LED = 0x84, - SMC_GET_EXECUTION_STATE = 0x85, - SMC_GET_SMC_UPTIME = 0x86, - SMC_ENUM_NOTIF = 0x87, - SMC_IPMI_RESPONSE_NOTIF = 0x88, - SMC_SET_INTERFACE_TIMEOUT = 0x89, - SMC_GET_INTERFACE_TIMEOUT = 0x8A, - SMC_SMC_LOCAL_EVENT_NOTIF = 0x8B, - SMC_GET_DEVICE_TABLE_DATA = 0x8C, - SMC_IPMI_MASTER_WR_RD_I2C = 0x90, - SMC_GET_SMC_SELF_TEST_RESULT = 0xA0, - SMC_READ_SMC_PLD_REGISTER = 0xA1, - SMC_WRITE_SMC_PLD_REGISTER = 0xA2, - SMC_SET_ROLE = 0xC0, - SMC_SET_CPCI_INTMASK = 0xC1, - SMC_GET_CPCI_INTMASK = 0xC2, - SMC_EEPROM_WRITE = 0xC3, - SMC_EEPROM_READ = 0xC4, - SMC_SET_STATE = 0xDE, - SMC_GET_STATE = 0xDF, - SMC_SET_DHCP_CLIENT_ID = 0xE1, - SMC_GET_DHCP_CLIENT_ID = 0xE2, - SMC_DEV_SDR_REPOSITORY_RESERVE = 0xE3, - SMC_FRU_INVENTORY_AREA_INFO_GET = 0xE4, - SMC_SET_BANNER = 0xE5, - SMC_GET_BANNER = 0xE6, - SMC_SEND_ASYNC_SEL_CMD_TO_HOST = 0xE7, - SMC_MASTER_WR_RD_I2C_2 = 0xE9, - SMC_GET_BUFFER_BLOCK_ALLOC_TABLE = 0xEA, - SMC_GET_BUFFER_ALLOC_TABLE = 0xEB, - SMC_GET_SFRS = 0xEC, - SMC_GET_PORT_VALUE = 0xED, - SMC_GET_BUFFER_DATA = 0xEE, - SMC_GET_PCB_DATA = 0xEF, - SMC_GET_PCB_BLOCK_ALLOC_TABLE = 0xF0, - SMC_GET_PCB_TABLE = 0xF1, - SMC_DEVICE_SDR_INFO_GET = 0xF2, - SMC_DEVICE_SDR_GET = 0xF3, - SMC_SENSOR_EVENT_ENABLE_GET = 0xF4, - SMC_SENSOR_EVENT_ENABLE_SET = 0xF5, - SMC_GET_CONFIG_BLOCK = 0xF8, - SMC_SET_CONFIG_BLOCK = 0xF9, - SMC_SET_VOLTAGE = 0xFB, - SMC_SENSOR_READING_GET = 0xFC, - SMC_SENSOR_THRESHOLD_GET = 0xFD, - SMC_SENSOR_THRESHOLD_SET = 0xFE, - SMC_CND_OF_CMD_MARKER = 0xFF -} smc_app_command_t; - -typedef enum { - SMC_GET_CHASSIS_STATUS = 0x01, - SMC_CHASSIS_CONTROL = 0x02, - SMC_GET_POH_COUNTER = 0x0F -} smc_chassis_command_t; - -typedef enum { - SMC_SET_EVENT_RECEIVER = 0x00, - SMC_GET_EVENT_RECEIVER = 0x01, - SMC_PLATFORM_EVENT_MESSAGE = 0x02 -} smc_event_command_t; - -typedef enum { - SMC_GET_SEL_INFO = 0x40, - SMC_GET_SEL_ALLOCATION_INFO = 0x41, - SMC_RESERVE_SEL = 0x42, - SMC_GET_SEL_ENTRY = 0x43, - SMC_ADD_SEL_ENTRY = 0x44, - SMC_PARTIAL_ADD_SEL_ENTRY = 0x45, - SMC_DELETE_SEL_ENTRY = 0x46, - SMC_CLEAR_SEL = 0x47, - SMC_GET_SEL_TIME = 0x48, - SMC_SET_SEL_TIME = 0x49 -} smc_sel_command_t; - -typedef enum { - SMC_GET_SDR_REPOSITORY_INFO = 0x20, - SMC_GET_SDR_REPOSITORY_ALLOCATION_INFO = 0x21, - SMC_RESERVE_SDR_REPOSITORY = 0x22, - SMC_GET_SDR = 0x23, - SMC_ADD_SDR = 0x24, - SMC_PARTIAL_ADD_SDR = 0x25, - SMC_DELETE_SDR = 0x26, - SMC_CLEAR_SDR_REPOSITORY = 0x27, - SMC_GET_SDR_REPOSITORY_TIME = 0x28, - SMC_SET_SDR_REPOSITORY_TIME = 0x29, - SMC_ENTER_SDR_REPOSITORY_UPDATE_MODE = 0x2A, - SMC_EXIT_SDR_REPOSITORY_UPDATE_MODE = 0x2B, - SMC_RUN_INITIALIZATION_AGENT = 0x2C -} smc_sdr_repository_command_t; - -typedef enum { - SMC_GET_FRU_INVENTORY_AREA_INFO = 0x10, - SMC_READ_FRU_INVENTORY_DATA = 0x11, - SMC_WRITE_FRU_INVENTORY_DATA = 0x12 -} smc_fru_inventory_device_command_t; - -typedef enum { - SMC_GET_DEVICE_SDR_INFO = 0x20, - SMC_GET_DEVICE_SDR = 0x21, - SMC_RESERVE_DEVICE_SDR_REPOSITORY = 0x22, - SMC_GET_SENSOR_READING_FACTORS = 0x23, - SMC_SET_SENSOR_HYSTERESIS = 0x24, - SMC_GET_SENSOR_HYSTERESIS = 0x25, - SMC_SET_SENSOR_THRESHOLD = 0x26, - SMC_GET_SENSOR_THRESHOLD = 0x27, - SMC_SET_SENSOR_EVENT_ENABLE = 0x28, - SMC_GET_SENSOR_EVENT_ENABLE = 0x29, - SMC_REARM_SENSOR_EVENTS = 0x2A, - SMC_GET_SENSOR_EVENT_STATUS = 0x2B, - /* RESERVED */ - SMC_GET_SENSOR_READING = 0x2D, - SMC_SET_SENSOR_TYPE = 0x2E, - SMC_GET_SENSOR_TYPE = 0x2F -} smc_sensor_device_command_t; - -#ifdef __cplusplus -} -#endif - -#endif /* _SYS_SMC_COMMANDS_H */ diff --git a/usr/src/uts/sun4u/sys/smc_if.h b/usr/src/uts/sun4u/sys/smc_if.h deleted file mode 100644 index 8c35afe05a..0000000000 --- a/usr/src/uts/sun4u/sys/smc_if.h +++ /dev/null @@ -1,151 +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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_SMC_IF_H -#define _SYS_SMC_IF_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#define _SCIOC ('s' << 8) - -/* - * SMC Driver IOCTL - */ -#define SCIOC_MSG_SPEC (_SCIOC | 0x04) -#define SCIOC_RESERVE_SEQN (_SCIOC | 0x05) -#define SCIOC_FREE_SEQN (_SCIOC | 0x06) -#define SCIOC_SEND_SYNC_CMD (_SCIOC | 0x07) - -/* - * IOCTLs to facilitate debugging - */ -#define SCIOC_ECHO_ON_REQ (_SCIOC | 0x08) -#define SCIOC_ECHO_OFF_REQ (_SCIOC | 0x09) - -/* - * A response message can be sent from any application - * to simulate a condition of watchdog expiry or receiving - * async messages - */ -#define SCIOC_ASYNC_SIM (_SCIOC | 0x0A) - -#define SC_SUCCESS 0 -#define SC_FAILURE 1 - -/* - * structure definitions - */ -typedef struct { - uint8_t msg_id; - uint8_t cmd; - uint8_t len; -} sc_reqhdr_t; - -typedef struct { - uint8_t msg_id; - uint8_t cmd; /* Will be 0 is non-SMC response, e.g. wdog */ - uint8_t len; /* Length of message, including header */ - uint8_t cc; /* if non-SMC, contains MSG type */ -} sc_rsphdr_t; - -#define SC_SEND_HEADER (sizeof (sc_reqhdr_t)) -#define SC_RECV_HEADER (sizeof (sc_rsphdr_t)) - -#define SC_MSG_MAX_SIZE 0x3E -#define SC_SEND_DSIZE (SC_MSG_MAX_SIZE - SC_SEND_HEADER) -#define SC_RECV_DSIZE (SC_MSG_MAX_SIZE - SC_RECV_HEADER) - -#define SMC_CMD_FAILED -1 - -typedef enum { - SC_ATTR_SHARED, - SC_ATTR_EXCLUSIVE, - SC_ATTR_CLEAR, - SC_ATTR_CLEARALL -} sc_cmd_attr_t; - -#define MAX_CMDS 16 - -typedef struct { - uint8_t attribute; - uint8_t args[MAX_CMDS]; -} sc_cmdspec_t; - -#define SC_CMDSPEC_ATTR(CMDSPEC) ((CMDSPEC).attribute) -#define SC_CMDSPEC_ARGS(CMDSPEC) ((CMDSPEC).args) - -/* - * Entire SMC Request Message sent down-stream - */ -typedef struct { - sc_reqhdr_t hdr; - uchar_t data[SC_SEND_DSIZE]; -} sc_reqmsg_t; - -/* - * Entire SMC Response Message forwarded up-stream - */ -typedef struct { - sc_rsphdr_t hdr; - uchar_t data[SC_RECV_DSIZE]; -} sc_rspmsg_t; - -#define SC_MSG_HDR(msg) ((msg)->hdr) - -#define SC_SEND_DLENGTH(msg) (SC_MSG_HDR(msg).len) -#define SC_RECV_DLENGTH(msg) (SC_MSG_HDR(msg).len) - -#define SC_MSG_ID(msg) (SC_MSG_HDR(msg).msg_id) -#define SC_MSG_CMD(msg) (SC_MSG_HDR(msg).cmd) -#define SC_MSG_LEN(msg) (SC_MSG_HDR(msg).len) -#define SC_MSG_CC(msg) (SC_MSG_HDR(msg).cc) -#define SC_MSG_DATA(msg) ((msg)->data) - -/* - * IPMB sequence number request structure. Application can - * reserve a block of sequence numbers for communicating - * with each destination - */ -#define SC_SEQ_SZ 16 -typedef struct { - uint8_t d_addr; /* Destination micro-controller addr */ - int8_t n_seqn; /* Number of seq# requested, max 16, -1 => free all */ - uint8_t seq_numbers[SC_SEQ_SZ]; /* Placeholder for seq# */ -} sc_seqdesc_t; - -#define SC_SEQN_DADDR(SEQDESC) ((SEQDESC).d_addr) -#define SC_SEQN_COUNT(SEQDESC) ((SEQDESC).n_seqn) -#define SC_SEQN_NUMBERS(SEQDESC) ((SEQDESC).seq_numbers) - -#ifdef __cplusplus -} -#endif - -#endif /* _SYS_SMC_IF_H */ diff --git a/usr/src/uts/sun4u/tazmo/envctrl/Makefile b/usr/src/uts/sun4u/tazmo/envctrl/Makefile index 3562da1dca..7877ead054 100644 --- a/usr/src/uts/sun4u/tazmo/envctrl/Makefile +++ b/usr/src/uts/sun4u/tazmo/envctrl/Makefile @@ -61,7 +61,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits # diff --git a/usr/src/uts/sun4u/todds1287/Makefile b/usr/src/uts/sun4u/todds1287/Makefile index 9ffd0c2526..ee0d883bc9 100644 --- a/usr/src/uts/sun4u/todds1287/Makefile +++ b/usr/src/uts/sun4u/todds1287/Makefile @@ -67,7 +67,7 @@ CFLAGS += $(CCVERBOSE) # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/unix/Makefile b/usr/src/uts/sun4u/unix/Makefile index 8ba80978eb..73c5a41f02 100644 --- a/usr/src/uts/sun4u/unix/Makefile +++ b/usr/src/uts/sun4u/unix/Makefile @@ -122,7 +122,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-char-subscripts CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function diff --git a/usr/src/uts/sun4u/upa64s/Makefile b/usr/src/uts/sun4u/upa64s/Makefile index 48c7021920..1d2e17ed0a 100644 --- a/usr/src/uts/sun4u/upa64s/Makefile +++ b/usr/src/uts/sun4u/upa64s/Makefile @@ -68,7 +68,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/us/Makefile b/usr/src/uts/sun4u/us/Makefile index 5b28ca8b2a..110f57f0f7 100644 --- a/usr/src/uts/sun4u/us/Makefile +++ b/usr/src/uts/sun4u/us/Makefile @@ -76,7 +76,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4u/vis/Makefile b/usr/src/uts/sun4u/vis/Makefile index 530f21d1d9..7ce1877331 100644 --- a/usr/src/uts/sun4u/vis/Makefile +++ b/usr/src/uts/sun4u/vis/Makefile @@ -60,7 +60,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # lint pass one enforcement # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) .KEEP_STATE: diff --git a/usr/src/uts/sun4u/zs/Makefile b/usr/src/uts/sun4u/zs/Makefile index 927f12d442..198362da01 100644 --- a/usr/src/uts/sun4u/zs/Makefile +++ b/usr/src/uts/sun4u/zs/Makefile @@ -78,7 +78,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4v/bge/Makefile b/usr/src/uts/sun4v/bge/Makefile index a062204337..6a99f9e374 100644 --- a/usr/src/uts/sun4v/bge/Makefile +++ b/usr/src/uts/sun4v/bge/Makefile @@ -76,7 +76,7 @@ LDFLAGS += -dy -N misc/mac -N drv/ip # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-variable diff --git a/usr/src/uts/sun4v/bootdev/Makefile b/usr/src/uts/sun4v/bootdev/Makefile index 684f732418..4b393be29b 100644 --- a/usr/src/uts/sun4v/bootdev/Makefile +++ b/usr/src/uts/sun4v/bootdev/Makefile @@ -66,7 +66,7 @@ CFLAGS += $(CCVERBOSE) # LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4v/dr_io/Makefile b/usr/src/uts/sun4v/dr_io/Makefile index 1de9932500..64346521b0 100644 --- a/usr/src/uts/sun4v/dr_io/Makefile +++ b/usr/src/uts/sun4v/dr_io/Makefile @@ -55,7 +55,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Turn on doubleword alignment for 64 bit registers diff --git a/usr/src/uts/sun4v/ds/Makefile b/usr/src/uts/sun4v/ds/Makefile index 64e873f53a..ed43f2f58e 100644 --- a/usr/src/uts/sun4v/ds/Makefile +++ b/usr/src/uts/sun4v/ds/Makefile @@ -77,7 +77,7 @@ LDFLAGS += -dy -Nmisc/ldc # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4v/ds_pri/Makefile b/usr/src/uts/sun4v/ds_pri/Makefile index d67e8da7d0..4fd9d986af 100644 --- a/usr/src/uts/sun4v/ds_pri/Makefile +++ b/usr/src/uts/sun4v/ds_pri/Makefile @@ -67,7 +67,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # lint pass one enforcement # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Module Dependencies diff --git a/usr/src/uts/sun4v/ebus/Makefile b/usr/src/uts/sun4v/ebus/Makefile index 6ad462ca17..a278c5ed3d 100644 --- a/usr/src/uts/sun4v/ebus/Makefile +++ b/usr/src/uts/sun4v/ebus/Makefile @@ -76,7 +76,7 @@ CFLAGS += -dalign LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4v/genunix/Makefile b/usr/src/uts/sun4v/genunix/Makefile index 3efad8b2e4..37beecd4ee 100644 --- a/usr/src/uts/sun4v/genunix/Makefile +++ b/usr/src/uts/sun4v/genunix/Makefile @@ -125,7 +125,7 @@ CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-type-limits -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-clobbered CERRWARN += -_gcc=-Wno-empty-body diff --git a/usr/src/uts/sun4v/ldc/Makefile b/usr/src/uts/sun4v/ldc/Makefile index 0175bd7b56..f1c044bb36 100644 --- a/usr/src/uts/sun4v/ldc/Makefile +++ b/usr/src/uts/sun4v/ldc/Makefile @@ -78,7 +78,7 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # diff --git a/usr/src/uts/sun4v/n2rng/Makefile b/usr/src/uts/sun4v/n2rng/Makefile index b88975168f..ba94b5bdfb 100644 --- a/usr/src/uts/sun4v/n2rng/Makefile +++ b/usr/src/uts/sun4v/n2rng/Makefile @@ -68,7 +68,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # CFLAGS += $(CCVERBOSE) -DN2 -I$(COM_DIR) LINTFLAGS += -DN2 -I$(COM_DIR) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # module dependencies diff --git a/usr/src/uts/sun4v/niumx/Makefile b/usr/src/uts/sun4v/niumx/Makefile index 756934f278..5ebcf02762 100644 --- a/usr/src/uts/sun4v/niumx/Makefile +++ b/usr/src/uts/sun4v/niumx/Makefile @@ -64,7 +64,7 @@ INC_PATH += -I$(UTSBASE)/sun4v/io/niumx # CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Turn on doubleword alignment for 64 bit registers diff --git a/usr/src/uts/sun4v/nxge/Makefile b/usr/src/uts/sun4v/nxge/Makefile index 6d29a43007..78c316d0be 100644 --- a/usr/src/uts/sun4v/nxge/Makefile +++ b/usr/src/uts/sun4v/nxge/Makefile @@ -115,7 +115,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits # diff --git a/usr/src/uts/sun4v/ontario/tsalarm/Makefile b/usr/src/uts/sun4v/ontario/tsalarm/Makefile index 7e8111d281..8f0a8a0718 100644 --- a/usr/src/uts/sun4v/ontario/tsalarm/Makefile +++ b/usr/src/uts/sun4v/ontario/tsalarm/Makefile @@ -86,7 +86,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4v/pcie/Makefile b/usr/src/uts/sun4v/pcie/Makefile index 56b54dc602..12cf0358a9 100644 --- a/usr/src/uts/sun4v/pcie/Makefile +++ b/usr/src/uts/sun4v/pcie/Makefile @@ -63,7 +63,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # LDFLAGS += -dy -Nmisc/busra -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits diff --git a/usr/src/uts/sun4v/platsvc/Makefile b/usr/src/uts/sun4v/platsvc/Makefile index b66ad32420..0c56b38552 100644 --- a/usr/src/uts/sun4v/platsvc/Makefile +++ b/usr/src/uts/sun4v/platsvc/Makefile @@ -56,7 +56,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # lint pass one enforcement # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Turn on doubleword alignment for 64 bit registers diff --git a/usr/src/uts/sun4v/px/Makefile b/usr/src/uts/sun4v/px/Makefile index 839ed8709e..d3b224707a 100644 --- a/usr/src/uts/sun4v/px/Makefile +++ b/usr/src/uts/sun4v/px/Makefile @@ -88,7 +88,7 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-clobbered -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-label diff --git a/usr/src/uts/sun4v/rootnex/Makefile b/usr/src/uts/sun4v/rootnex/Makefile index bf26875fc0..004b5140c2 100644 --- a/usr/src/uts/sun4v/rootnex/Makefile +++ b/usr/src/uts/sun4v/rootnex/Makefile @@ -70,7 +70,7 @@ CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # For now, disable these lint checks; maintainers should endeavor diff --git a/usr/src/uts/sun4v/su/Makefile b/usr/src/uts/sun4v/su/Makefile index 52719a7dab..5b2296ce5f 100644 --- a/usr/src/uts/sun4v/su/Makefile +++ b/usr/src/uts/sun4v/su/Makefile @@ -70,7 +70,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4v/unix/Makefile b/usr/src/uts/sun4v/unix/Makefile index 42ee3a613e..ac0c02abe8 100644 --- a/usr/src/uts/sun4v/unix/Makefile +++ b/usr/src/uts/sun4v/unix/Makefile @@ -121,7 +121,7 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-char-subscripts CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function diff --git a/usr/src/uts/sun4v/vcc/Makefile b/usr/src/uts/sun4v/vcc/Makefile index 8100d00ebf..3a333ba3c8 100644 --- a/usr/src/uts/sun4v/vcc/Makefile +++ b/usr/src/uts/sun4v/vcc/Makefile @@ -70,7 +70,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # compiler failes with not reached statements diff --git a/usr/src/uts/sun4v/vdc/Makefile b/usr/src/uts/sun4v/vdc/Makefile index da180435e0..9877103746 100644 --- a/usr/src/uts/sun4v/vdc/Makefile +++ b/usr/src/uts/sun4v/vdc/Makefile @@ -66,7 +66,7 @@ CFLAGS += $(CCVERBOSE) CFLAGS += -D_EXTVTOC CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) LDFLAGS += -dy -Nmisc/ldc -Nmisc/platsvc -Nmisc/scsi diff --git a/usr/src/uts/sun4v/vds/Makefile b/usr/src/uts/sun4v/vds/Makefile index 80e5028a06..664b987d0f 100644 --- a/usr/src/uts/sun4v/vds/Makefile +++ b/usr/src/uts/sun4v/vds/Makefile @@ -65,7 +65,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) CFLAGS += $(CCVERBOSE) CFLAGS += -D_EXTVTOC -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # module dependencies diff --git a/usr/src/uts/sun4v/vis/Makefile b/usr/src/uts/sun4v/vis/Makefile index f7f1f09cb7..522d46d84a 100644 --- a/usr/src/uts/sun4v/vis/Makefile +++ b/usr/src/uts/sun4v/vis/Makefile @@ -61,7 +61,7 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # lint pass one enforcement # CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) .KEEP_STATE: diff --git a/usr/src/uts/sun4v/vnet/Makefile b/usr/src/uts/sun4v/vnet/Makefile index a24d4790b6..858c2c58da 100644 --- a/usr/src/uts/sun4v/vnet/Makefile +++ b/usr/src/uts/sun4v/vnet/Makefile @@ -92,7 +92,7 @@ CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) # # Default build targets. diff --git a/usr/src/uts/sun4v/vsw/Makefile b/usr/src/uts/sun4v/vsw/Makefile index bbc07208ef..e7d0a439e7 100644 --- a/usr/src/uts/sun4v/vsw/Makefile +++ b/usr/src/uts/sun4v/vsw/Makefile @@ -88,7 +88,7 @@ LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-clobbered CERRWARN += -_gcc=-Wno-unused-variable -CERRWARN += -_gcc=-Wno-uninitialized +CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-label |
