diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2020-05-11 12:01:31 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2020-05-11 12:01:31 +0000 |
commit | 063fdf36a6e93abc3012115f9f680ba0f81bec14 (patch) | |
tree | feae45b64d22e2988395aea0a6de86789e937c23 /usr/src | |
parent | 758901a3d01e7cc303843dc190e4bfa28b76f97c (diff) | |
parent | e7d144c90b0aab78554a319cc0a94cafe23a72a2 (diff) | |
download | illumos-joyent-063fdf36a6e93abc3012115f9f680ba0f81bec14.tar.gz |
[illumos-gate merge]
commit e7d144c90b0aab78554a319cc0a94cafe23a72a2
12544 e1000g: NULL pointer errors
commit 4e2c3273e98e347b3b0d6ea03be57eda0b8def7b
12543 chxge: NULL pointer errors
commit 4f82e07802416dd88f61770ddd96e9c040095895
12538 ldmad: NULL pointer errors
commit 38ff79119b4ef2a8e52068a5d95129909aadf342
12655 niagara: NULL pointer errors
commit cee39f3ff96ecf06e603339642e5393b7c1738e8
12710 loader: vdev_read() can corrupt memory
commit ec71f88e58593e3077f03588d3c38e6cbd4e8c1a
12671 hcksum routines are too verbose
12672 want mac_hcksum_clone function
commit bf21cd9318e0a3a51b7f02c14a7c1b1aef2dc861
12612 import Pluribus bhyve port
commit 4c7b9a81057545d490dd52cf823de529d8137a5b
12718 LDT overlap with TSS reintroduced in 12608
commit 5254d4fa5763710c9674cbc8308362326643d386
12715 Update tzdata to 2020a
commit b17aa18c453380499cb628ad8e7f7536bfd9d483
12653 vnet: smatch and NULL pointer errors
commit a5efd12c64532eac05eb5a4b6901396be06125bf
12652 platsvc: smatch and NULL pointer errors
commit 6e472272d020cb1e83ec4964e2a2f5761a354bcb
12651 vsw: NULL pointer errors
commit 90c84b2b51065d8ba19244aa8e420ccfc3fb3e45
12616 cpr: NULL pointer errors
commit 7e7bf7f54a5544e467fcb1eaf3f5f47129d83d70
12617 pcie: NULL pointer errors
commit 3dddd038560f12863d73bf754e6534d071a45610
12615 todds1337: NULL pointer errors
commit 1577b7ba682b7fdc8ef49b98f2147ec01b11e568
12634 niumx: NULL pointer errors
commit 47a041a028740925012faeaf8aa122cb53545a4a
12614 todds1287: NULL pointer errors
commit fccee7da6a96828fd0fd19c6b32fe901e6b31549
12633 glvc: NULL pointer errors
commit 9d86952736be4a2132ea65d76b3dde43dc999f9e
12630 excalibur: NULL pointer errors
commit 50ed1c1e61e07032076ff0041b06b604754d190c
12631 sunfire: smatch and NULL pointer errors
commit baa111a1f46457da764bd7a40234b4f9a2de1885
12629 daktari: smatch and NULL pointer errors
commit c5fab18ea427d8368421383466fe138ed00ed68d
12628 chicago: smatch and NULL pointer errors
commit 44da0df0d621255604c6a72b29e72219d50a76d6
12627 seattle: NULL pointer errors
commit 0d41b2d927be6023812b1b3035b9c5cf84f700b6
12618 cheetah: NULL pointer errors
commit 1e901b654aeabd2bde7c1b05a0d83071d41ca493
12619 mpxu: NULL pointer errors
commit 1e1331ff02be014b4a75626f3a9ab9237f405b35
12626 boston: NULL pointer errors
commit f23a396b6eea5efd75ad61ab78e31f55a36732a8
12620 littleneck: NULL pointer errors
commit 8adb60c2f39cd295bca28a5a44fa9c4934109e61
12607 db21554: NULL pointer errors
commit 35420702b93f71061940bdddcc5401bcb0337e76
12611 rmclomv: NULL pointer errors
commit ada2da53edc6b7d3afbdff4975c5c32c01a7c72d
12536 picl: NULL pointer errors
commit 9ddb26a06d595789532ca2be60f2625a035e5baa
12603 gpio_87317: smatch and NULL pointer errors
commit 424a9dabffff3ee7b75ad66819578b015c7e72d0
12638 ntwdt: NULL pointer errors
commit fd2e3606878080ff9881c6a5d17c0dc41a944a9a
12639 n2piupc: smatch and NULL pointer errors
commit 4b2e399d2387adc4f0af512ea0e3f84da0988e76
12646 vlds: NULL pointer errors
commit eb6b10e69fa5ba733da194d3ad71a0e63338be29
12621 tazmo: smatch and NULL pointer errors
commit 12042ab213b3af68474f48555504db816a449211
12622 grover: smatch and NULL pointer errors
commit 5f94959e45722ce4c5b397c781bd33bdc12bc35f
12602 pic16f747: NULL pointer errors
commit 54b3584e66419f0f60689044f13d702660b4233f
12681 Excess service times for NFS(v3) locking calls
commit f7c6b0310a1b1045e3e955e113031eb3c485707b
12601 adm1026: NULL pointer errors
commit 111d63ac89d5f46c27a3de884ceaf358c6b4f3c7
12599 pic16f819: NULL pointer errors
commit b10a7a5c84767eaa0c2fd6cda5f456fccd17aaff
12600 ssc100: NULL pointer errors
commit 67c3b220bd061b0e5e7bed36a8deff9f85b06440
12598 ssc050: smatch and NULL pointer errors
commit 2e6bb8e703b27f1b2e066859acdc04f2f8a745f9
12613 rmc_comm: NULL pointer errors
commit 78d71c09ff583b38d95e01afefe0faf5a10b8e36
12556 sbusmem: NULL pointer errors
commit 033fe5502e8d73564183eeb70cde2e5fb6bf7f9f
12550 dad: NULL pointer errors
commit d34120274c30795a501f8eb0fca6b33dd4d49e63
12548 fcode: NULL pointer errors
commit afcb81194ea4372157c39b75a016574dcd6a81ee
12660 ontario: NULL pointer errors
commit 8b92a81b8f3ff3d4fe904caad0969cfd13b7efa6
12659 iospc: NULL pointer errors
commit 5d2f9f1aa99a42e638400d4e11f5d87ff95ce0db
12643 trapstat: NULL pointer errors
commit 7d94095ba5c8bcde15ac831ede6826ea9453ddd4
12623 cherrystone: NULL pointer errors
commit a704fb2d43b34f92d7dcac9c06204ea48237612d
12649 ldc: smatch and NULL pointer errors
commit 7331beb48fd554088b3de38ef30491d59e0d61f7
12647 dr_mem: smatch and NULL pointer errors
commit a6c18717f209deaa8516b38f5d43c0bb5855e876
12648 dr_cpu: NULL pointer errors
commit c3937c08b16d32677a7dc955a81325f2e7a61b5d
12656 ngdr: NULL pointer errors
commit 04909c8c9ef61a86dd44bdaf341a1d9a2f0206e5
12608 want memory arena for vmm applications
12609 x86 memory DR should be disabled
commit bbe1232ef8d8a5a776f6afde8466f315c8143dd4
12657 opl: NULL pointer errors
Conflicts:
usr/contrib/freebsd/sys/ata.h
usr/contrib/freebsd/x86/specialreg.h
usr/src/cmd/bhyve/Makefile
usr/src/cmd/bhyve/acpi.h
usr/src/cmd/bhyve/ahci.h
usr/src/cmd/bhyve/atkbdc.c
usr/src/cmd/bhyve/atkbdc.h
usr/src/cmd/bhyve/bhyve_sol_glue.c
usr/src/cmd/bhyve/bhyvegc.c
usr/src/cmd/bhyve/bhyvegc.h
usr/src/cmd/bhyve/bhyverun.c
usr/src/cmd/bhyve/bhyverun.h
usr/src/cmd/bhyve/block_if.c
usr/src/cmd/bhyve/block_if.h
usr/src/cmd/bhyve/console.c
usr/src/cmd/bhyve/console.h
usr/src/cmd/bhyve/consport.c
usr/src/cmd/bhyve/dbgport.h
usr/src/cmd/bhyve/inout.c
usr/src/cmd/bhyve/inout.h
usr/src/cmd/bhyve/ioapic.c
usr/src/cmd/bhyve/ioapic.h
usr/src/cmd/bhyve/mem.c
usr/src/cmd/bhyve/mem.h
usr/src/cmd/bhyve/mptbl.c
usr/src/cmd/bhyve/mptbl.h
usr/src/cmd/bhyve/pci_ahci.c
usr/src/cmd/bhyve/pci_emul.c
usr/src/cmd/bhyve/pci_emul.h
usr/src/cmd/bhyve/pci_hostbridge.c
usr/src/cmd/bhyve/pci_irq.c
usr/src/cmd/bhyve/pci_irq.h
usr/src/cmd/bhyve/pci_lpc.c
usr/src/cmd/bhyve/pci_lpc.h
usr/src/cmd/bhyve/pci_virtio_block.c
usr/src/cmd/bhyve/pci_virtio_net.c
usr/src/cmd/bhyve/pci_virtio_viona.c
usr/src/cmd/bhyve/pm.c
usr/src/cmd/bhyve/post.c
usr/src/cmd/bhyve/ps2kbd.c
usr/src/cmd/bhyve/ps2kbd.h
usr/src/cmd/bhyve/ps2mouse.c
usr/src/cmd/bhyve/ps2mouse.h
usr/src/cmd/bhyve/rfb.c
usr/src/cmd/bhyve/rfb.h
usr/src/cmd/bhyve/rtc.c
usr/src/cmd/bhyve/rtc.h
usr/src/cmd/bhyve/smbiostbl.c
usr/src/cmd/bhyve/smbiostbl.h
usr/src/cmd/bhyve/spinup_ap.c
usr/src/cmd/bhyve/spinup_ap.h
usr/src/cmd/bhyve/uart_emul.c
usr/src/cmd/bhyve/uart_emul.h
usr/src/cmd/bhyve/vga.c
usr/src/cmd/bhyve/vga.h
usr/src/cmd/bhyve/virtio.c
usr/src/cmd/bhyve/virtio.h
usr/src/cmd/bhyve/xmsr.c
usr/src/cmd/bhyve/xmsr.h
usr/src/cmd/bhyvectl/Makefile
usr/src/cmd/bhyvectl/bhyvectl.c
usr/src/compat/freebsd/amd64/machine/asmacros.h
usr/src/compat/freebsd/amd64/machine/atomic.h
usr/src/compat/freebsd/amd64/machine/cpufunc.h
usr/src/compat/freebsd/amd64/machine/fpu.h
usr/src/compat/freebsd/amd64/machine/md_var.h
usr/src/compat/freebsd/amd64/machine/param.h
usr/src/compat/freebsd/amd64/machine/pmap.h
usr/src/compat/freebsd/amd64/machine/smp.h
usr/src/compat/freebsd/amd64/machine/vmm.h
usr/src/compat/freebsd/amd64/machine/vmparam.h
usr/src/compat/freebsd/libutil.h
usr/src/compat/freebsd/net/ethernet.h
usr/src/compat/freebsd/pthread_np.h
usr/src/compat/freebsd/sys/callout.h
usr/src/compat/freebsd/sys/cdefs.h
usr/src/compat/freebsd/sys/cpuset.h
usr/src/compat/freebsd/sys/endian.h
usr/src/compat/freebsd/sys/ioctl.h
usr/src/compat/freebsd/sys/kernel.h
usr/src/compat/freebsd/sys/limits.h
usr/src/compat/freebsd/sys/malloc.h
usr/src/compat/freebsd/sys/mutex.h
usr/src/compat/freebsd/sys/param.h
usr/src/compat/freebsd/sys/pcpu.h
usr/src/compat/freebsd/sys/smp.h
usr/src/compat/freebsd/sys/systm.h
usr/src/compat/freebsd/sys/time.h
usr/src/compat/freebsd/sys/types.h
usr/src/compat/freebsd/vm/vm.h
usr/src/compat/freebsd/x86/_types.h
usr/src/compat/freebsd/x86/segments.h
usr/src/lib/libvmmapi/Makefile
usr/src/lib/libvmmapi/Makefile.com
usr/src/lib/libvmmapi/common/mapfile-vers
usr/src/lib/libvmmapi/common/vmmapi.c
usr/src/lib/libvmmapi/common/vmmapi.h
usr/src/uts/common/inet/ipf/ip_fil_solaris.c
usr/src/uts/common/io/mac/mac_provider.c
usr/src/uts/common/io/mac/mac_util.c
usr/src/uts/i86pc/dboot/dboot_startkern.c
usr/src/uts/i86pc/io/vmm/amd/amdv.c
usr/src/uts/i86pc/io/vmm/intel/ept.c
usr/src/uts/i86pc/io/vmm/intel/ept.h
usr/src/uts/i86pc/io/vmm/intel/vmcs.c
usr/src/uts/i86pc/io/vmm/intel/vmcs.h
usr/src/uts/i86pc/io/vmm/intel/vmx.c
usr/src/uts/i86pc/io/vmm/intel/vmx.h
usr/src/uts/i86pc/io/vmm/intel/vmx_controls.h
usr/src/uts/i86pc/io/vmm/intel/vmx_cpufunc.h
usr/src/uts/i86pc/io/vmm/intel/vmx_msr.c
usr/src/uts/i86pc/io/vmm/intel/vmx_msr.h
usr/src/uts/i86pc/io/vmm/intel/vmx_support.s
usr/src/uts/i86pc/io/vmm/io/vatpic.c
usr/src/uts/i86pc/io/vmm/io/vatpic.h
usr/src/uts/i86pc/io/vmm/io/vatpit.c
usr/src/uts/i86pc/io/vmm/io/vatpit.h
usr/src/uts/i86pc/io/vmm/io/vhpet.c
usr/src/uts/i86pc/io/vmm/io/vhpet.h
usr/src/uts/i86pc/io/vmm/io/vioapic.c
usr/src/uts/i86pc/io/vmm/io/vioapic.h
usr/src/uts/i86pc/io/vmm/io/vlapic.c
usr/src/uts/i86pc/io/vmm/io/vlapic.h
usr/src/uts/i86pc/io/vmm/io/vlapic_priv.h
usr/src/uts/i86pc/io/vmm/vmm.c
usr/src/uts/i86pc/io/vmm/vmm_host.c
usr/src/uts/i86pc/io/vmm/vmm_host.h
usr/src/uts/i86pc/io/vmm/vmm_instruction_emul.c
usr/src/uts/i86pc/io/vmm/vmm_ioport.c
usr/src/uts/i86pc/io/vmm/vmm_ioport.h
usr/src/uts/i86pc/io/vmm/vmm_ktr.h
usr/src/uts/i86pc/io/vmm/vmm_lapic.c
usr/src/uts/i86pc/io/vmm/vmm_lapic.h
usr/src/uts/i86pc/io/vmm/vmm_mem.h
usr/src/uts/i86pc/io/vmm/vmm_sol_dev.c
usr/src/uts/i86pc/io/vmm/vmm_sol_glue.c
usr/src/uts/i86pc/io/vmm/vmm_stat.h
usr/src/uts/i86pc/io/vmm/vmm_util.c
usr/src/uts/i86pc/io/vmm/vmm_util.h
usr/src/uts/i86pc/io/vmm/x86.c
usr/src/uts/i86pc/io/vmm/x86.h
usr/src/uts/i86pc/sys/viona_io.h
usr/src/uts/i86pc/sys/vmm.h
usr/src/uts/i86pc/sys/vmm_dev.h
usr/src/uts/i86pc/sys/vmm_impl.h
usr/src/uts/i86pc/sys/vmm_instruction_emul.h
usr/src/uts/i86pc/viona/Makefile
usr/src/uts/i86pc/vmm/Makefile
usr/src/uts/intel/ipf/Makefile
Diffstat (limited to 'usr/src')
171 files changed, 4887 insertions, 2336 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version index 164e3416ec..7b173d0d47 100644 --- a/usr/src/boot/Makefile.version +++ b/usr/src/boot/Makefile.version @@ -33,4 +33,4 @@ LOADER_VERSION = 1.1 # Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes. # The version is processed from left to right, the version number can only # be increased. -BOOT_VERSION = $(LOADER_VERSION)-2020.03.19.1 +BOOT_VERSION = $(LOADER_VERSION)-2020.05.09.1 diff --git a/usr/src/boot/lib/libstand/zfs/zfs.c b/usr/src/boot/lib/libstand/zfs/zfs.c index 665d0b4a48..34c1b7c23e 100644 --- a/usr/src/boot/lib/libstand/zfs/zfs.c +++ b/usr/src/boot/lib/libstand/zfs/zfs.c @@ -401,7 +401,7 @@ vdev_read(vdev_t *vdev __unused, void *priv, off_t offset, void *buf, full_sec_size -= secsz; /* Return of partial sector data requires a bounce buffer. */ - if ((head > 0) || do_tail_read) { + if ((head > 0) || do_tail_read || bytes < secsz) { bouncebuf = malloc(secsz); if (bouncebuf == NULL) { printf("vdev_read: out of memory\n"); @@ -427,12 +427,21 @@ vdev_read(vdev_t *vdev __unused, void *priv, off_t offset, void *buf, /* Full data return from read sectors */ if (full_sec_size > 0) { - res = read(fd, outbuf, full_sec_size); - if (res != full_sec_size) { - ret = EIO; - goto error; + if (bytes < full_sec_size) { + res = read(fd, bouncebuf, secsz); + if (res != secsz) { + ret = EIO; + goto error; + } + memcpy(outbuf, bouncebuf, bytes); + } else { + res = read(fd, outbuf, full_sec_size); + if (res != full_sec_size) { + ret = EIO; + goto error; + } + outbuf += full_sec_size; } - outbuf += full_sec_size; } /* Partial data return from last sector */ diff --git a/usr/src/cmd/bhyve/Makefile.com b/usr/src/cmd/bhyve/Makefile.com new file mode 100644 index 0000000000..4a92b622ab --- /dev/null +++ b/usr/src/cmd/bhyve/Makefile.com @@ -0,0 +1,94 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Pluribus Networks Inc. +# + +PROG= bhyve + +SRCS = atkbdc.c \ + bhyvegc.c \ + bhyverun.c \ + block_if.c \ + console.c \ + consport.c \ + inout.c \ + ioapic.c \ + mem.c \ + mptbl.c \ + pci_ahci.c \ + pci_emul.c \ + pci_hostbridge.c \ + pci_irq.c \ + pci_lpc.c \ + pci_virtio_block.c \ + pci_virtio_net.c \ + pci_virtio_viona.c \ + pm.c \ + pmtmr.c \ + post.c \ + ps2kbd.c \ + ps2mouse.c \ + rfb.c \ + rtc.c \ + smbiostbl.c \ + uart_emul.c \ + vga.c \ + virtio.c \ + vmm_instruction_emul.c \ + xmsr.c \ + spinup_ap.c \ + bhyve_sol_glue.c + +OBJS = $(SRCS:.c=.o) + +include ../../Makefile.cmd + +.KEEP_STATE: + +CFLAGS += $(CCVERBOSE) -_gcc=-Wimplicit-function-declaration +CFLAGS64 += $(CCVERBOSE) -_gcc=-Wimplicit-function-declaration +CPPFLAGS = -I$(COMPAT)/freebsd -I$(CONTRIB)/freebsd $(CPPFLAGS.master) \ + -I$(ROOT)/usr/platform/i86pc/include \ + -I$(SRC)/uts/i86pc/io/vmm \ + -I$(SRC)/uts/common \ + -I$(SRC)/uts/i86pc \ + -I$(SRC)/lib/libdladm/common +LDLIBS += -lsocket -lnsl -ldlpi -ldladm -lkstat -lmd -luuid -lvmmapi + +POST_PROCESS += ; $(GENSETDEFS) $@ + +all: $(PROG) + +$(PROG): $(OBJS) + $(LINK.c) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS) + $(POST_PROCESS) + +install: all $(ROOTUSRSBINPROG) + +clean: + $(RM) $(OBJS) + +lint: lint_SRCS + +include ../../Makefile.targ + +%.o: ../%.c + $(COMPILE.c) $< + $(POST_PROCESS_O) + +%.o: $(SRC)/uts/i86pc/io/vmm/%.c + $(COMPILE.c) $< + $(POST_PROCESS_O) + +%.o: ../%.s + $(COMPILE.s) $< diff --git a/usr/src/cmd/bhyve/amd64/Makefile b/usr/src/cmd/bhyve/amd64/Makefile new file mode 100644 index 0000000000..13cdae6663 --- /dev/null +++ b/usr/src/cmd/bhyve/amd64/Makefile @@ -0,0 +1,21 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Pluribus Networks Inc. +# + +include ../Makefile.com +include ../../Makefile.cmd.64 + +CPPFLAGS += -I$(COMPAT)/freebsd/amd64 -I$(CONTRIB)/freebsd/amd64 + +install: all $(ROOTUSRSBINPROG64) diff --git a/usr/src/cmd/bhyve/pmtmr.c b/usr/src/cmd/bhyve/pmtmr.c new file mode 100644 index 0000000000..92ab24be57 --- /dev/null +++ b/usr/src/cmd/bhyve/pmtmr.c @@ -0,0 +1,212 @@ +/*- + * Copyright (c) 2012 NetApp, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: head/usr.sbin/bhyve/pmtmr.c 259998 2013-12-28 04:01:05Z jhb $ + */ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * Copyright 2014 Pluribus Networks Inc. + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: head/usr.sbin/bhyve/pmtmr.c 259998 2013-12-28 04:01:05Z jhb $"); + +#include <sys/types.h> +#include <sys/sysctl.h> +#include <sys/time.h> +#include <machine/cpufunc.h> + +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <assert.h> +#include <pthread.h> +#ifndef __FreeBSD__ +#include <kstat.h> +#endif + +#include "acpi.h" +#include "inout.h" + +/* + * The ACPI Power Management timer is a free-running 24- or 32-bit + * timer with a frequency of 3.579545MHz + * + * This implementation will be 32-bits + */ + +#define PMTMR_FREQ 3579545 /* 3.579545MHz */ + +static pthread_mutex_t pmtmr_mtx; +static pthread_once_t pmtmr_once = PTHREAD_ONCE_INIT; + +static uint64_t pmtmr_old; + +static uint64_t pmtmr_tscf; +static uint64_t pmtmr_tsc_old; + +#ifdef __FreeBSD__ +static clockid_t clockid = CLOCK_UPTIME_FAST; +static struct timespec pmtmr_uptime_old; + +#define timespecsub(vvp, uvp) \ + do { \ + (vvp)->tv_sec -= (uvp)->tv_sec; \ + (vvp)->tv_nsec -= (uvp)->tv_nsec; \ + if ((vvp)->tv_nsec < 0) { \ + (vvp)->tv_sec--; \ + (vvp)->tv_nsec += 1000000000; \ + } \ + } while (0) + +static uint64_t +timespec_to_pmtmr(const struct timespec *tsnew, const struct timespec *tsold) +{ + struct timespec tsdiff; + int64_t nsecs; + + tsdiff = *tsnew; + timespecsub(&tsdiff, tsold); + nsecs = tsdiff.tv_sec * 1000000000 + tsdiff.tv_nsec; + assert(nsecs >= 0); + + return (nsecs * PMTMR_FREQ / 1000000000 + pmtmr_old); +} +#endif + +static uint64_t +tsc_to_pmtmr(uint64_t tsc_new, uint64_t tsc_old) +{ + + return ((tsc_new - tsc_old) * PMTMR_FREQ / pmtmr_tscf + pmtmr_old); +} + +static void +pmtmr_init(void) +{ +#ifdef __FreeBSD__ + size_t len; + int smp_tsc, err; + struct timespec tsnew, tsold = { 0 }; + + len = sizeof(smp_tsc); + err = sysctlbyname("kern.timecounter.smp_tsc", &smp_tsc, &len, NULL, 0); + assert(err == 0); + + if (smp_tsc) { + len = sizeof(pmtmr_tscf); + err = sysctlbyname("machdep.tsc_freq", &pmtmr_tscf, &len, + NULL, 0); + assert(err == 0); + + pmtmr_tsc_old = rdtsc(); + pmtmr_old = tsc_to_pmtmr(pmtmr_tsc_old, 0); + } else { + if (getenv("BHYVE_PMTMR_PRECISE") != NULL) + clockid = CLOCK_UPTIME; + + err = clock_gettime(clockid, &tsnew); + assert(err == 0); + + pmtmr_uptime_old = tsnew; + pmtmr_old = timespec_to_pmtmr(&tsnew, &tsold); + } +#else + kstat_ctl_t *kstat_ctl; + kstat_t *kstat; + kstat_named_t *kstat_cpu_freq; + + kstat_ctl = kstat_open(); + kstat = kstat_lookup(kstat_ctl, "cpu_info", 0, NULL); + kstat_read(kstat_ctl, kstat, NULL); + kstat_cpu_freq = kstat_data_lookup(kstat, "current_clock_Hz"); + pmtmr_tscf = kstat_cpu_freq->value.ul; + kstat_close(kstat_ctl); + + pmtmr_tsc_old = rdtsc(); + pmtmr_old = tsc_to_pmtmr(pmtmr_tsc_old, 0); +#endif + pthread_mutex_init(&pmtmr_mtx, NULL); +} + +static uint32_t +pmtmr_val(void) +{ + struct timespec tsnew; + uint64_t pmtmr_tsc_new; + uint64_t pmtmr_new; + int error; + + pthread_once(&pmtmr_once, pmtmr_init); + + pthread_mutex_lock(&pmtmr_mtx); + +#ifdef __FreeBSD__ + if (pmtmr_tscf) { + pmtmr_tsc_new = rdtsc(); + pmtmr_new = tsc_to_pmtmr(pmtmr_tsc_new, pmtmr_tsc_old); + pmtmr_tsc_old = pmtmr_tsc_new; + } else { + error = clock_gettime(clockid, &tsnew); + assert(error == 0); + + pmtmr_new = timespec_to_pmtmr(&tsnew, &pmtmr_uptime_old); + pmtmr_uptime_old = tsnew; + } +#else + pmtmr_tsc_new = rdtsc(); + pmtmr_new = tsc_to_pmtmr(pmtmr_tsc_new, pmtmr_tsc_old); + pmtmr_tsc_old = pmtmr_tsc_new; +#endif + pmtmr_old = pmtmr_new; + + pthread_mutex_unlock(&pmtmr_mtx); + + return (pmtmr_new); +} + +static int +pmtmr_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, + uint32_t *eax, void *arg) +{ + assert(in == 1); + + if (bytes != 4) + return (-1); + + *eax = pmtmr_val(); + + return (0); +} + +INOUT_PORT(pmtmr, IO_PMTMR, IOPORT_F_IN, pmtmr_handler); diff --git a/usr/src/cmd/bhyveconsole/Makefile b/usr/src/cmd/bhyveconsole/Makefile new file mode 100644 index 0000000000..11d34e6599 --- /dev/null +++ b/usr/src/cmd/bhyveconsole/Makefile @@ -0,0 +1,41 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2013 Pluribus Networks Inc. +# + +include ../Makefile.cmd + +SUBDIRS= $(MACH) + +all := TARGET = all +install := TARGET = install +clean := TARGET = clean +clobber := TARGET = clobber +lint := TARGET = lint + +.KEEP_STATE: + +all: $(SUBDIRS) + +clean clobber lint: $(SUBDIRS) + +install: $(SUBDIRS) + -$(RM) $(ROOTUSRSBINPROG) + -$(LN) $(ISAEXEC) $(ROOTUSRSBINPROG) + +$(SUBDIRS): FRC + @cd $@; pwd; $(MAKE) CW_NO_SHADOW=true __GNUC= $(TARGET) + +FRC: + +include ../Makefile.targ diff --git a/usr/src/cmd/bhyveconsole/bhyveconsole.c b/usr/src/cmd/bhyveconsole/bhyveconsole.c new file mode 100644 index 0000000000..7f237a72f6 --- /dev/null +++ b/usr/src/cmd/bhyveconsole/bhyveconsole.c @@ -0,0 +1,360 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2013 Pluribus Networks Inc. + */ + +#include <sys/param.h> +#include <sys/signal.h> +#include <sys/socket.h> +#include <sys/termios.h> +#include <assert.h> +#include <errno.h> +#include <libgen.h> +#include <stdarg.h> +#include <stdio.h> +#include <strings.h> +#include <unistd.h> + +#include <bhyve.h> + +static int masterfd; +static struct termios save_termios; +static int save_fd; + +static int nocmdchar = 0; +static char cmdchar = '~'; + +static const char *pname; + +#define BCONS_BUFSIZ 8192 + +static void +usage(void) +{ + (void) fprintf(stderr, "usage: %s vmname\n", pname); + exit(2); +} + +static void +bcons_error(const char *fmt, ...) +{ + va_list alist; + + (void) fprintf(stderr, "%s: ", pname); + va_start(alist, fmt); + (void) vfprintf(stderr, fmt, alist); + va_end(alist); + (void) fprintf(stderr, "\n"); +} + +static void +bcons_perror(const char *str) +{ + const char *estr; + + if ((estr = strerror(errno)) != NULL) + (void) fprintf(stderr, "%s: %s: %s\n", pname, str, estr); + else + (void) fprintf(stderr, "%s: %s: errno %d\n", pname, str, errno); +} + +/* + * Create the unix domain socket and call bhyve; handshake + * with it to determine whether it will allow us to connect. + */ +static int +get_console(const char *vmname) +{ + int sockfd = -1; + struct sockaddr_un servaddr; + char clientid[MAXPATHLEN]; + char handshake[MAXPATHLEN], c; + int msglen; + int i = 0, err = 0; + + if ((sockfd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) { + bcons_perror("could not create socket"); + return (-1); + } + + bzero(&servaddr, sizeof (servaddr)); + servaddr.sun_family = AF_UNIX; + (void) snprintf(servaddr.sun_path, sizeof (servaddr.sun_path), + BHYVE_CONS_SOCKPATH, vmname); + + if (connect(sockfd, (struct sockaddr *)&servaddr, + sizeof (servaddr)) == -1) { + bcons_perror("Could not connect to console server"); + goto bad; + } + masterfd = sockfd; + + msglen = snprintf(clientid, sizeof (clientid), "IDENT %lu\n", + getpid()); + assert(msglen > 0 && msglen < sizeof (clientid)); + + if (write(masterfd, clientid, msglen) != msglen) { + bcons_error("protocol error"); + goto bad; + } + + /* + * Take care not to accumulate more than our fill, and leave room for + * the NUL at the end. + */ + while ((err = read(masterfd, &c, 1)) == 1) { + if (i >= (sizeof (handshake) - 1)) + break; + if (c == '\n') + break; + handshake[i] = c; + i++; + } + handshake[i] = '\0'; + + /* + * If something went wrong during the handshake we bail; perhaps + * the server died off. + */ + if (err == -1) { + bcons_perror("Could not connect to console server"); + goto bad; + } + + if (strncmp(handshake, "OK", sizeof (handshake)) == 0) + return (0); + + bcons_error("Console is already in use by process ID %s.", + handshake); +bad: + (void) close(sockfd); + masterfd = -1; + return (-1); +} + +/* + * Place terminal into raw mode. + */ +static int +set_tty_rawmode(int fd) +{ + struct termios term; + if (tcgetattr(fd, &term) < 0) { + bcons_perror("failed to get user terminal settings"); + return (-1); + } + + /* Stash for later, so we can revert back to previous mode */ + save_termios = term; + save_fd = fd; + + /* disable 8->7 bit strip, start/stop, enable any char to restart */ + term.c_iflag &= ~(ISTRIP|IXON|IXANY); + /* disable NL->CR, CR->NL, ignore CR, UPPER->lower */ + term.c_iflag &= ~(INLCR|ICRNL|IGNCR|IUCLC); + /* disable output post-processing */ + term.c_oflag &= ~OPOST; + /* disable canonical mode, signal chars, echo & extended functions */ + term.c_lflag &= ~(ICANON|ISIG|ECHO|IEXTEN); + + term.c_cc[VMIN] = 1; /* byte-at-a-time */ + term.c_cc[VTIME] = 0; + + if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &term)) { + bcons_perror("failed to set user terminal to raw mode"); + return (-1); + } + + return (0); +} + +/* + * reset terminal settings for global environment + */ +static void +reset_tty(void) +{ + (void) tcsetattr(save_fd, TCSADRAIN, &save_termios); +} + +/* + * process_user_input watches the input stream for the escape sequence for + * 'quit' (by default, tilde-period). Because we might be fed just one + * keystroke at a time, state associated with the user input (are we at the + * beginning of the line? are we locally echoing the next character?) is + * maintained by beginning_of_line and local_echo across calls to the routine. + * + * This routine returns -1 when the 'quit' escape sequence has been issued, + * or an error is encountered and 0 otherwise. + */ +static int +process_user_input(int out_fd, int in_fd) +{ + static boolean_t beginning_of_line = B_TRUE; + static boolean_t local_echo = B_FALSE; + char ibuf[BCONS_BUFSIZ]; + int nbytes; + char *buf = ibuf; + char c; + + nbytes = read(in_fd, ibuf, sizeof (ibuf)); + if (nbytes == -1 && errno != EINTR) + return (-1); + + if (nbytes == -1) /* The read was interrupted. */ + return (0); + + for (c = *buf; nbytes > 0; c = *buf, --nbytes) { + buf++; + if (beginning_of_line && !nocmdchar) { + beginning_of_line = B_FALSE; + if (c == cmdchar) { + local_echo = B_TRUE; + continue; + } + } else if (local_echo) { + local_echo = B_FALSE; + if (c == '.') { + (void) write(STDOUT_FILENO, &cmdchar, 1); + (void) write(STDOUT_FILENO, &c, 1); + return (-1); + } + } + + (void) write(out_fd, &c, 1); + + beginning_of_line = (c == '\r' || c == '\n'); + } + + return (0); +} + +static int +process_output(int in_fd, int out_fd) +{ + int wrote = 0; + int cc; + char ibuf[BCONS_BUFSIZ]; + + cc = read(in_fd, ibuf, sizeof (ibuf)); + if (cc == -1 && errno != EINTR) + return (-1); + if (cc == 0) /* EOF */ + return (-1); + if (cc == -1) /* The read was interrupted. */ + return (0); + + do { + int len; + + len = write(out_fd, ibuf + wrote, cc - wrote); + if (len == -1 && errno != EINTR) + return (-1); + if (len != -1) + wrote += len; + } while (wrote < cc); + + return (0); +} + +/* + * This is the main I/O loop. + */ +static void +doio(void) +{ + struct pollfd pollfds[2]; + int res; + + /* read from vm and write to stdout */ + pollfds[0].fd = masterfd; + pollfds[0].events = POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI; + + /* read from stdin and write to vm */ + pollfds[1].fd = STDIN_FILENO; + pollfds[1].events = pollfds[0].events; + + for (;;) { + pollfds[0].revents = pollfds[1].revents = 0; + + res = poll(pollfds, + sizeof (pollfds) / sizeof (struct pollfd), -1); + + if (res == -1 && errno != EINTR) { + bcons_perror("poll failed"); + /* we are hosed, close connection */ + break; + } + + /* event from master side stdout */ + if (pollfds[0].revents) { + if (pollfds[0].revents & + (POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI)) { + if (process_output(masterfd, STDOUT_FILENO) + != 0) + break; + } else { + break; + } + } + + /* event from user stdin side */ + if (pollfds[1].revents) { + if (pollfds[1].revents & + (POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI)) { + if (process_user_input(masterfd, STDIN_FILENO) + != 0) + break; + } else { + break; + } + } + } +} + +int +main(int argc, char **argv) +{ + char *vmname; + + pname = basename(argv[0]); + + if (argc == 2) { + vmname = argv[1]; + } else { + usage(); + } + + /* + * Make contact with bhyve + */ + if (get_console(vmname) == -1) + return (1); + + (void) printf("[Connected to vm '%s' console]\n", vmname); + + if (set_tty_rawmode(STDIN_FILENO) == -1) { + reset_tty(); + bcons_perror("failed to set stdin pty to raw mode"); + return (1); + } + + /* + * Run the I/O loop until we get disconnected. + */ + doio(); + reset_tty(); + (void) printf("\n[Connection to vm '%s' console closed]\n", vmname); + + return (0); +} diff --git a/usr/src/cmd/bhyveconsole/i386/Makefile b/usr/src/cmd/bhyveconsole/i386/Makefile new file mode 100644 index 0000000000..c4f317a9fa --- /dev/null +++ b/usr/src/cmd/bhyveconsole/i386/Makefile @@ -0,0 +1,43 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2013 Pluribus Networks Inc. +# + +PROG= bhyveconsole + +OBJS= bhyveconsole.o + +SRCS= $(OBJS:%.o=../%.c) + +include ../../Makefile.cmd + +CFLAGS += $(CCVERBOSE) +LDLIBS += -lsocket + +.KEEP_STATE: + +%.o: ../%.c + $(COMPILE.c) $< + +all: $(PROG) + +$(PROG): $(OBJS) + $(LINK.c) $(OBJS) -o $@ $(LDLIBS) + $(POST_PROCESS) + +install: all $(ROOTUSRSBINPROG32) + +clean: + $(RM) $(OBJS) + +include ../../Makefile.targ diff --git a/usr/src/cmd/bhyvectl/Makefile.com b/usr/src/cmd/bhyvectl/Makefile.com new file mode 100644 index 0000000000..03ca34792c --- /dev/null +++ b/usr/src/cmd/bhyvectl/Makefile.com @@ -0,0 +1,48 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2013 Pluribus Networks Inc. +# + +PROG= bhyvectl + +SRCS = bhyvectl.c +OBJS = $(SRCS:.c=.o) + +include ../../Makefile.cmd + +.KEEP_STATE: + +CFLAGS += $(CCVERBOSE) +CPPFLAGS = -I$(COMPAT)/freebsd -I$(CONTRIB)/freebsd $(CPPFLAGS.master) \ + -I$(ROOT)/usr/platform/i86pc/include \ + -I$(SRC)/uts/i86pc/io/vmm +LDLIBS += -lvmmapi + +all: $(PROG) + +$(PROG): $(OBJS) + $(LINK.c) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS) + $(POST_PROCESS) + +install: all $(ROOTUSRSBINPROG) + +clean: + $(RM) $(OBJS) + +lint: lint_SRCS + +include ../../Makefile.targ + +%.o: ../%.c + $(COMPILE.c) -I$(SRC)/common $< + $(POST_PROCESS_O) diff --git a/usr/src/cmd/bhyvectl/amd64/Makefile b/usr/src/cmd/bhyvectl/amd64/Makefile new file mode 100644 index 0000000000..b602c50d05 --- /dev/null +++ b/usr/src/cmd/bhyvectl/amd64/Makefile @@ -0,0 +1,21 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2013 Pluribus Networks Inc. +# + +include ../Makefile.com +include ../../Makefile.cmd.64 + +CPPFLAGS += -I$(COMPAT)/freebsd/amd64 -I$(CONTRIB)/freebsd/amd64 + +install: all $(ROOTUSRSBINPROG64) diff --git a/usr/src/cmd/bhyveload-uefi/Makefile b/usr/src/cmd/bhyveload-uefi/Makefile new file mode 100644 index 0000000000..bbcbacf32f --- /dev/null +++ b/usr/src/cmd/bhyveload-uefi/Makefile @@ -0,0 +1,41 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2013 Pluribus Networks Inc. +# + +PROG = bhyveload-uefi + +include ../Makefile.cmd + +$(BUILD64)SUBDIRS += $(MACH64) + +all := TARGET = all +install := TARGET = install +clean := TARGET = clean +clobber := TARGET = clobber +lint := TARGET = lint + +.KEEP_STATE: + +all clean clobber lint: $(SUBDIRS) + +install: $(SUBDIRS) + -$(RM) $(ROOTUSRSBINPROG) + -$(LN) $(ISAEXEC) $(ROOTUSRSBINPROG) + +$(SUBDIRS): FRC + @cd $@; pwd; $(MAKE) CW_NO_SHADOW=true __GNUC= $(TARGET) + +FRC: + +include ../Makefile.targ diff --git a/usr/src/cmd/bhyveload-uefi/Makefile.com b/usr/src/cmd/bhyveload-uefi/Makefile.com new file mode 100644 index 0000000000..7865cca8d8 --- /dev/null +++ b/usr/src/cmd/bhyveload-uefi/Makefile.com @@ -0,0 +1,52 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2013 Pluribus Networks Inc. +# + +PROG= bhyveload-uefi + +SRCS = ../bhyveload-uefi.c expand_number.c +OBJS = bhyveload-uefi.o expand_number.o + +include ../../Makefile.cmd + +.KEEP_STATE: + +CFLAGS += $(CCVERBOSE) +CPPFLAGS = -I$(COMPAT)/freebsd -I$(CONTRIB)/freebsd $(CPPFLAGS.master) \ + -I$(ROOT)/usr/platform/i86pc/include +LDLIBS += -lvmmapi + +all: $(PROG) + +$(PROG): $(OBJS) + $(LINK.c) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS) + $(POST_PROCESS) + +install: all $(ROOTUSRSBINPROG) + +clean: + $(RM) $(OBJS) + +lint: lint_SRCS + +include ../../Makefile.targ + +%.o: ../%.c + $(COMPILE.c) $< + $(POST_PROCESS_O) + +%.o: $(CONTRIB)/freebsd/lib/libutil/%.c + $(COMPILE.c) $< + $(POST_PROCESS_O) + diff --git a/usr/src/cmd/bhyveload-uefi/amd64/Makefile b/usr/src/cmd/bhyveload-uefi/amd64/Makefile new file mode 100644 index 0000000000..b602c50d05 --- /dev/null +++ b/usr/src/cmd/bhyveload-uefi/amd64/Makefile @@ -0,0 +1,21 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2013 Pluribus Networks Inc. +# + +include ../Makefile.com +include ../../Makefile.cmd.64 + +CPPFLAGS += -I$(COMPAT)/freebsd/amd64 -I$(CONTRIB)/freebsd/amd64 + +install: all $(ROOTUSRSBINPROG64) diff --git a/usr/src/cmd/bhyveload-uefi/bhyveload-uefi.c b/usr/src/cmd/bhyveload-uefi/bhyveload-uefi.c new file mode 100644 index 0000000000..62a7ca5d0f --- /dev/null +++ b/usr/src/cmd/bhyveload-uefi/bhyveload-uefi.c @@ -0,0 +1,190 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2013 Pluribus Networks Inc. + */ + +#include <sys/types.h> + +#include <machine/vmm.h> + +#include <errno.h> +#include <err.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <sysexits.h> +#include <unistd.h> + +#include <vmmapi.h> + +#define KB (1024UL) +#define MB (1024 * 1024UL) +#define GB (1024 * 1024 * 1024UL) + +#define UEFI_ROM_ADDR 0xFFE00000 +#define UEFI_ROM_SIZE (2 * MB) +/* + * N.B. the UEFI code zeros the first page in memory so use the second. + */ +#define BHYVE_HOB_ADDR 0x00002000 +#define BHYVE_BO_HOB_ADDR 0x00002080 + +#define UEFI_ROM_PATH "/usr/share/bhyve/uefi-rom.bin" + +struct platform_info { + uint32_t ncpus; +}; + +/* + * Boot order code: + * 0 - EFI_CD_HD + * 1 - EFI_CD + * 2 - EFI_HD_CD + * 3 - EFI_HD + * 4 - EFI_NET + * 5 - EFI_NET_CD_HD + * 6 - EFI_HD_HD_CD + * 7 - LEGACY_CD_HD + * 8 - LEGACY_CD + * 9 - LEGACY_HD_CD + * 10 - LEGACY_HD + * 11 - EFI_SHELL + */ + +struct bootorder_info { + uint32_t guestbootorder; +}; + +static char *vmname, *progname; +static struct vmctx *ctx; + +static void +usage(void) +{ + printf("usage: %s " + "[-c vcpus] [-m mem-size] [-b bootorder]" + "<vmname>\n", progname); + exit(1); +} + +int +main(int argc, char** argv) +{ + int opt, error, fd; + int guest_ncpus; + int guest_bootorder = 0; + uint64_t mem_size; + char *membase, *rombase; + struct platform_info *pi; + struct bootorder_info *bi; + + progname = argv[0]; + + guest_ncpus = 1; + mem_size = 256 * MB; + + while ((opt = getopt(argc, argv, "c:m:b:")) != -1) { + switch (opt) { + case 'c': + guest_ncpus = atoi(optarg); + break; + case 'm': + error = vm_parse_memsize(optarg, &mem_size); + if (error != 0 || mem_size == 0) + errx(EX_USAGE, "Invalid memsize '%s'", optarg); + break; + case 'b': + guest_bootorder = atoi(optarg); + if (guest_bootorder < 0 || guest_bootorder > 11) { + errx(EX_USAGE, "Invalid bootoption: %d\n" + "\tBoot order code:\n" + "\t0 - EFI_CD_HD\n" + "\t1 - EFI_CD\n" + "\t2 - EFI_HD_CD\n" + "\t3 - EFI_HD\n" + "\t4 - EFI_NET\n" + "\t5 - EFI_NET_CD_HD\n" + "\t6 - EFI_HD_HD_CD\n" + "\t7 - LEGACY_CD_HD\n" + "\t8 - LEGACY_CD\n" + "\t9 - LEGACY_HD_CD\n" + "\t10 - LEGACY_HD\n" + "\t11 - EFI_SHELL\n", guest_bootorder); + exit(1); + } + break; + case '?': + usage(); + } + } + + argc -= optind; + argv += optind; + + if (argc != 1) + usage(); + + vmname = argv[0]; + error = vm_create(vmname); + if (error != 0 && errno != EEXIST) { + perror("vm_create"); + exit(1); + + } + + ctx = vm_open(vmname); + if (ctx == NULL) { + perror("vm_open"); + exit(1); + } + + error = vm_set_capability(ctx, 0, VM_CAP_UNRESTRICTED_GUEST, 1); + if (error) { + perror("vm_set_capability(VM_CAP_UNRESTRICTED_GUEST)"); + } + + error = vm_setup_memory(ctx, mem_size, VM_MMAP_ALL); + if (error) { + perror("vm_setup_memory"); + exit(1); + } + membase = vm_map_gpa(ctx, 0, 8 * KB); + + error = vm_setup_rom(ctx, UEFI_ROM_ADDR, UEFI_ROM_SIZE); + if (error) { + perror("vm_setup_rom"); + exit(1); + } + rombase = vm_map_gpa(ctx, UEFI_ROM_ADDR, UEFI_ROM_SIZE); + + fd = open(UEFI_ROM_PATH, O_RDONLY); + if (fd == -1) { + perror("open"); + exit(1); + } + read(fd, rombase, UEFI_ROM_SIZE); + close(fd); + + pi = (struct platform_info *)(membase + BHYVE_HOB_ADDR); + pi->ncpus = guest_ncpus; + bi = (struct bootorder_info *)(membase + BHYVE_BO_HOB_ADDR); + bi->guestbootorder = guest_bootorder; + + error = vcpu_reset(ctx, 0); + if (error) { + perror("vcpu_reset"); + exit(1); + } + + return (0); +} diff --git a/usr/src/cmd/bhyveload-uefi/i386/Makefile b/usr/src/cmd/bhyveload-uefi/i386/Makefile new file mode 100644 index 0000000000..f5b7bb6915 --- /dev/null +++ b/usr/src/cmd/bhyveload-uefi/i386/Makefile @@ -0,0 +1,18 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2013 Pluribus Networks Inc. +# + +include ../Makefile.com + +install: all $(ROOTUSRSBINPROG32) diff --git a/usr/src/cmd/ldmad/mdesc_lib.c b/usr/src/cmd/ldmad/mdesc_lib.c index cab9560fd6..44221b9f70 100644 --- a/usr/src/cmd/ldmad/mdesc_lib.c +++ b/usr/src/cmd/ldmad/mdesc_lib.c @@ -210,7 +210,7 @@ md_add_string_property(mmd_t *mdp, md_node_t *nodep, char *sp, char *bufp) propp = md_new_property(mdp, nodep, MDET_PROP_STR, sp); if (propp == NULL) { md_free_data_block(mdp, dbp); - return (NULL); + return (ENOMEM); } propp->d.dbp = dbp; return (0); diff --git a/usr/src/cmd/mdb/intel/amd64/vmm/Makefile b/usr/src/cmd/mdb/intel/amd64/vmm/Makefile new file mode 100644 index 0000000000..bf9219b435 --- /dev/null +++ b/usr/src/cmd/mdb/intel/amd64/vmm/Makefile @@ -0,0 +1,20 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2014 Pluribus Networks Inc. +# + +MAKEVARS = CW_NO_SHADOW=true __GNUC= + +include $(SRC)/Makefile.master +$(BUILD64)SUBDIRS += $(MACH64) +include ../../../Makefile.subdirs diff --git a/usr/src/cmd/mdb/intel/amd64/vmm/amd64/Makefile b/usr/src/cmd/mdb/intel/amd64/vmm/amd64/Makefile new file mode 100644 index 0000000000..49ca0c5eb3 --- /dev/null +++ b/usr/src/cmd/mdb/intel/amd64/vmm/amd64/Makefile @@ -0,0 +1,32 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2013 Pluribus Networks Inc. +# + +MODULE = vmm.so +MDBTGT = kvm + +MODSRCS = vmm.c + +include ../../../../../Makefile.cmd +include ../../../../../Makefile.cmd.64 +include ../../../Makefile.amd64 +include ../../../../Makefile.module + +CPPFLAGS = -D_KERNEL -D_MACHDEP +CPPFLAGS += -I$(COMPAT)/freebsd -I$(COMPAT)/freebsd/amd64 +CPPFLAGS += -I$(CONTRIB)/freebsd -I$(CONTRIB)/freebsd/amd64 +CPPFLAGS += -I$(SRC)/uts/common -I$(SRC)/uts/i86pc +CPPFLAGS += -I$(SRC)/cmd/mdb/common + +CPPFLAGS += -_cc=-xdryrun diff --git a/usr/src/cmd/mdb/intel/amd64/vmm/vmm.c b/usr/src/cmd/mdb/intel/amd64/vmm/vmm.c new file mode 100644 index 0000000000..9e29d8662a --- /dev/null +++ b/usr/src/cmd/mdb/intel/amd64/vmm/vmm.c @@ -0,0 +1,238 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2014 Pluribus Networks Inc. + */ + +#include <sys/param.h> + +#include <mdb/mdb_modapi.h> +#include <sys/cpuvar.h> +#include <sys/varargs.h> +#include <sys/vmm.h> +#include <sys/vmm_impl.h> + +/* + * VMM trace debug walker/dcmd code + */ + +/* + * Initialize the vmm_trace_dmsg_t walker by either using the given starting + * address, or reading the value of the kernel's vmm_debug_rbuf pointer. + * We also allocate a vmm_trace_dmsg_t for storage, and save this using the + * walk_data pointer. + */ +static int +vmm_dmsg_walk_i(mdb_walk_state_t *wsp) +{ + uintptr_t rbuf_addr; + vmm_trace_rbuf_t rbuf; + + if (wsp->walk_addr == NULL) { + if (mdb_readvar(&rbuf_addr, "vmm_debug_rbuf") == -1) { + mdb_warn("failed to read 'vmm_debug_rbuf'"); + return (WALK_ERR); + } + + if (mdb_vread(&rbuf, sizeof (vmm_trace_rbuf_t), rbuf_addr) + == -1) { + mdb_warn("failed to read vmm_trace_rbuf_t at %p", + rbuf_addr); + return (WALK_ERR); + } + + wsp->walk_addr = (uintptr_t)(vmm_trace_dmsg_t *)rbuf.dmsgh; + } + + /* + * Save ptr to head of ring buffer to prevent looping. + */ + wsp->walk_arg = (void *)wsp->walk_addr; + wsp->walk_data = mdb_alloc(sizeof (vmm_trace_dmsg_t), UM_SLEEP); + return (WALK_NEXT); +} + +/* + * At each step, read a vmm_trace_dmsg_t into our private storage, and then + * invoke the callback function. We terminate when we reach a NULL next + * pointer. + */ +static int +vmm_dmsg_walk_s(mdb_walk_state_t *wsp) +{ + int status; + + if (wsp->walk_addr == NULL) + return (WALK_DONE); + + if (mdb_vread(wsp->walk_data, sizeof (vmm_trace_dmsg_t), + wsp->walk_addr) == -1) { + mdb_warn("failed to read vmm_trace_dmsg_t at %p", + wsp->walk_addr); + return (WALK_ERR); + } + + status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data, + wsp->walk_cbdata); + + wsp->walk_addr = + (uintptr_t)(((vmm_trace_dmsg_t *)wsp->walk_data)->next); + + /* + * If we've looped then we're done. + */ + if (wsp->walk_addr == (uintptr_t)wsp->walk_arg) + wsp->walk_addr = NULL; + + return (status); +} + +/* + * The walker's fini function is invoked at the end of each walk. Since we + * dynamically allocated a vmm_trace_dmsg_t in vmm_dmsg_walk_i, we must + * free it now. + */ +static void +vmm_dmsg_walk_f(mdb_walk_state_t *wsp) +{ + mdb_free(wsp->walk_data, sizeof (vmm_trace_dmsg_t)); +} + +/* + * This routine is used by the vmm_dmsg_dump dcmd to dump content of + * VMM trace ring buffer. + */ +int +vmm_dmsg_dump(vmm_trace_dmsg_t *addr, int print_pathname, uint_t *printed) +{ + vmm_trace_dmsg_t dmsg, *dmsgh = addr; + char pathname[MAXPATHLEN]; + char merge[1024]; + + while (addr != NULL) { + if (mdb_vread(&dmsg, sizeof (dmsg), (uintptr_t)addr) != + sizeof (dmsg)) { + mdb_warn("failed to read message pointer in kernel"); + return (DCMD_ERR); + } + + (void) mdb_snprintf(merge, sizeof (merge), + "[%Y:%03d:%03d:%03d] : %s", + dmsg.timestamp.tv_sec, + (int)dmsg.timestamp.tv_nsec/1000000, + (int)(dmsg.timestamp.tv_nsec/1000)%1000, + (int)dmsg.timestamp.tv_nsec%1000, + dmsg.buf); + + mdb_printf("%s", merge); + + if (printed != NULL) { + (*printed)++; + } + + if (((addr = dmsg.next) == NULL) || (dmsg.next == dmsgh)) { + break; + } + } + + return (DCMD_OK); +} + +/* + * 1. Process flag passed to vmm_dmsg_dump dcmd. + * 2. Obtain VMM trace ring buffer pointer. + * 3. Pass VMM trace ring buffer pointer to vmm_dmsg_dump() + * to dump content of VMM trace ring buffer. + */ +int +vmm_rbuf_dump(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) +{ + vmm_trace_rbuf_t rbuf; + uint_t printed = 0; /* have we printed anything? */ + int print_pathname = FALSE; + int rval = DCMD_OK; + + if (argc > 1) { + return (DCMD_USAGE); + } + + if (mdb_getopts(argc, argv, + 'a', MDB_OPT_SETBITS, TRUE, &print_pathname) != argc) { + return (DCMD_USAGE); + } + + /* + * If ring buffer address not provided try to obtain + * it using vmm_debug_rbuf global. + */ + if ((addr == NULL) || !(flags & DCMD_ADDRSPEC)) { + if (mdb_readvar(&addr, "vmm_debug_rbuf") == -1) { + mdb_warn("Failed to read 'vmm_debug_rbuf'."); + return (DCMD_ERR); + } + } + + if (mdb_vread(&rbuf, sizeof (rbuf), addr) != sizeof (rbuf)) { + mdb_warn("Failed to read ring buffer in kernel."); + return (DCMD_ERR); + } + + if (rbuf.dmsgh == NULL) { + mdb_printf("The vmm trace ring buffer is empty.\n"); + return (DCMD_OK); + } + + rval = vmm_dmsg_dump((vmm_trace_dmsg_t *)rbuf.dmsgh, + print_pathname, &printed); + + if (rval != DCMD_OK) { + return (rval); + } + + if (printed == 0) { + mdb_warn("Failed to read vmm trace ring buffer."); + return (DCMD_ERR); + } + + return (rval); +} + +/* + * MDB module linkage information: + * + * We declare a list of structures describing our dcmds, a list of structures + * describing our walkers, and a function named _mdb_init to return a pointer + * to our module information. + */ + +static const mdb_dcmd_t dcmds[] = { + { "vmm_dmsg_dump", "[-a]", "Dump vmm trace debug messages", + vmm_rbuf_dump }, + { NULL } +}; + +static const mdb_walker_t walkers[] = { + { "vmm_dmsg", + "walk ring buffer containing vmm trace debug messages", + vmm_dmsg_walk_i, vmm_dmsg_walk_s, vmm_dmsg_walk_f }, + { NULL } +}; + +static const mdb_modinfo_t modinfo = { + MDB_API_VERSION, dcmds, walkers +}; + +const mdb_modinfo_t * +_mdb_init(void) +{ + return (&modinfo); +} diff --git a/usr/src/cmd/picl/plugins/sun4u/cherrystone/frutree/piclfrutree.c b/usr/src/cmd/picl/plugins/sun4u/cherrystone/frutree/piclfrutree.c index bc565320be..286567a046 100644 --- a/usr/src/cmd/picl/plugins/sun4u/cherrystone/frutree/piclfrutree.c +++ b/usr/src/cmd/picl/plugins/sun4u/cherrystone/frutree/piclfrutree.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * PICL plug-in that creates the FRU Hierarchy for the * SUNW,Sun-Fire-480R (Cherrystone) platform @@ -267,8 +265,8 @@ picl_frutree_fini(void) * * It processes the following events: * - * PICLEVENT_SYSEVENT_DEVICE_ADDED - * PICLEVENT_SYSEVENT_DEVICE_REMOVED + * PICLEVENT_SYSEVENT_DEVICE_ADDED + * PICLEVENT_SYSEVENT_DEVICE_REMOVED */ /* ARGSUSED */ static void @@ -1024,10 +1022,10 @@ frudr_completion_handler(char *ename, void *earg, size_t size) * now frudata has been notified that the node is to be * removed, we can actually remove it */ - fruh = NULL; + fruh = 0; (void) nvlist_lookup_uint64(earg, PICLEVENTARG_FRUHANDLE, &fruh); - if (fruh != NULL) { + if (fruh != 0) { (void) remove_picl_node(fruh); } } @@ -1048,7 +1046,7 @@ post_frudr_event(char *ename, picl_nodehdl_t parenth, picl_nodehdl_t fruh) ev_name = strdup(ename); if (ev_name == NULL) return; - if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, NULL)) { + if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, 0)) { free(ev_name); return; } @@ -1111,7 +1109,7 @@ add_power_supply(int slotnum) return (err); /* Post picl-fru-added event */ - post_frudr_event(PICL_FRU_ADDED, NULL, powermodh); + post_frudr_event(PICL_FRU_ADDED, 0, powermodh); } } return (PICL_SUCCESS); @@ -1141,7 +1139,7 @@ remove_power_supply(int slotnum) } (void) ptree_destroy_node(powermodh); /* Post picl-fru-removed event */ - post_frudr_event(PICL_FRU_REMOVED, NULL, powermodh); + post_frudr_event(PICL_FRU_REMOVED, 0, powermodh); } return (PICL_SUCCESS); } diff --git a/usr/src/cmd/picl/plugins/sun4u/chicago/envd/piclenvsetup.c b/usr/src/cmd/picl/plugins/sun4u/chicago/envd/piclenvsetup.c index 0d4578e9eb..5b3cbf2bdd 100644 --- a/usr/src/cmd/picl/plugins/sun4u/chicago/envd/piclenvsetup.c +++ b/usr/src/cmd/picl/plugins/sun4u/chicago/envd/piclenvsetup.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file contains code for setting up environmental related nodes * and properties in the PICL tree. @@ -83,23 +81,23 @@ typedef struct { */ static sensor_node_t sensor_nodes[] = { {"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_CPU0, - NULL, NULL, NULL, NULL}, + NULL, 0, 0, 0}, {"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_CPU1, - NULL, NULL, NULL, NULL}, + NULL, 0, 0, 0}, {"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_MB, - NULL, NULL, NULL, NULL}, + NULL, 0, 0, 0}, {"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_ADT7462, - NULL, NULL, NULL, NULL}, + NULL, 0, 0, 0}, {"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_LM95221, - NULL, NULL, NULL, NULL}, + NULL, 0, 0, 0}, {"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_FIRE, - NULL, NULL, NULL, NULL}, + NULL, 0, 0, 0}, {"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_LSI1064, - NULL, NULL, NULL, NULL}, + NULL, 0, 0, 0}, {"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_FRONT_PANEL, - NULL, NULL, NULL, NULL}, + NULL, 0, 0, 0}, {"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_PSU, - NULL, NULL, NULL, NULL} + NULL, 0, 0, 0} }; #define N_SENSOR_NODES (sizeof (sensor_nodes)/sizeof (sensor_nodes[0])) @@ -109,7 +107,7 @@ static sensor_node_t sensor_nodes[] = { typedef struct { char *parent_path; /* parent node path */ char *fan_name; /* fan name */ - env_fan_t *fanp; /* fan information */ + env_fan_t *fanp; /* fan information */ char *speed_unit; /* speed unit string */ picl_nodehdl_t nodeh; /* "fan" node handle */ picl_prophdl_t proph; /* "Speed" property handle */ @@ -120,15 +118,15 @@ typedef struct { */ static fan_node_t fan_nodes[] = { {"/platform/ebus@1f,464000/env-monitor@3,0", ENV_SYSTEM_FAN0, - NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL}, + NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0}, {"/platform/ebus@1f,464000/env-monitor@3,0", ENV_SYSTEM_FAN1, - NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL}, + NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0}, {"/platform/ebus@1f,464000/env-monitor@3,0", ENV_SYSTEM_FAN2, - NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL}, + NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0}, {"/platform/ebus@1f,464000/env-monitor@3,0", ENV_SYSTEM_FAN3, - NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL}, + NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0}, {"/platform/ebus@1f,464000/env-monitor@3,0", ENV_SYSTEM_FAN4, - NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL} + NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0} }; #define N_FAN_NODES (sizeof (fan_nodes)/sizeof (fan_nodes[0])) @@ -138,7 +136,7 @@ static fan_node_t fan_nodes[] = { typedef struct { char *parent_path; /* parent node path */ char *disk_name; /* disk name */ - env_disk_t *diskp; /* disk information */ + env_disk_t *diskp; /* disk information */ picl_nodehdl_t nodeh; /* "disk" node handle */ picl_prophdl_t proph; /* "Temperature" property handle */ } disk_node_t; @@ -147,10 +145,10 @@ typedef struct { * Disk node array */ static disk_node_t disk_nodes[] = { - {DISK0_NODE_PATH, ENV_DISK0, NULL, NULL, NULL}, - {DISK1_NODE_PATH, ENV_DISK1, NULL, NULL, NULL}, - {DISK2_NODE_PATH, ENV_DISK2, NULL, NULL, NULL}, - {DISK3_NODE_PATH, ENV_DISK3, NULL, NULL, NULL} + {DISK0_NODE_PATH, ENV_DISK0, NULL, 0, 0}, + {DISK1_NODE_PATH, ENV_DISK1, NULL, 0, 0}, + {DISK2_NODE_PATH, ENV_DISK2, NULL, 0, 0}, + {DISK3_NODE_PATH, ENV_DISK3, NULL, 0, 0} }; #define N_DISK_NODES (sizeof (disk_nodes)/sizeof (disk_nodes[0])) @@ -168,7 +166,7 @@ static void delete_fan_nodes_and_props(void); static int get_current_temp(ptree_rarg_t *parg, void *buf) { - tempr_t temp; + tempr_t temp; picl_prophdl_t proph; sensor_node_t *snodep; int i; @@ -197,7 +195,7 @@ get_current_temp(ptree_rarg_t *parg, void *buf) static int get_disk_temp(ptree_rarg_t *parg, void *buf) { - tempr_t temp; + tempr_t temp; picl_prophdl_t proph; disk_node_t *dnodep; int i; @@ -492,12 +490,12 @@ delete_sensor_nodes_and_props(void) for (i = 0; i < N_SENSOR_NODES; i++) { snodep = &sensor_nodes[i]; - if (snodep->nodeh != NULL) { + if (snodep->nodeh != 0) { /* delete node and all properties under it */ (void) ptree_delete_node(snodep->nodeh); (void) ptree_destroy_node(snodep->nodeh); - snodep->nodeh = NULL; - snodep->proph = NULL; + snodep->nodeh = 0; + snodep->proph = 0; } } } @@ -634,11 +632,11 @@ delete_disk_nodes_and_props(void) for (i = 0; i < N_DISK_NODES; i++) { dnodep = &disk_nodes[i]; - if (dnodep->nodeh != NULL) { + if (dnodep->nodeh != 0) { (void) ptree_delete_node(dnodep->nodeh); (void) ptree_destroy_node(dnodep->nodeh); - dnodep->nodeh = NULL; - dnodep->proph = NULL; + dnodep->nodeh = 0; + dnodep->proph = 0; } } } @@ -772,10 +770,10 @@ delete_fan_nodes_and_props(void) for (i = 0; i < N_FAN_NODES; i++) { fnodep = &fan_nodes[i]; - if (fnodep->nodeh != NULL) { + if (fnodep->nodeh != 0) { (void) ptree_delete_node(fnodep->nodeh); (void) ptree_destroy_node(fnodep->nodeh); - fnodep->nodeh = NULL; + fnodep->nodeh = 0; } } } @@ -947,9 +945,9 @@ env_picl_setup(void) for (i = 0; i < N_SENSOR_NODES; i++) { snodep = &sensor_nodes[i]; snodep->sensorp = sensor_lookup(snodep->sensor_name); - snodep->nodeh = NULL; - snodep->proph = NULL; - snodep->target_proph = NULL; + snodep->nodeh = 0; + snodep->proph = 0; + snodep->target_proph = 0; } /* @@ -958,8 +956,8 @@ env_picl_setup(void) for (i = 0; i < N_FAN_NODES; i++) { fnodep = &fan_nodes[i]; fnodep->fanp = fan_lookup(fnodep->fan_name); - fnodep->nodeh = NULL; - fnodep->proph = NULL; + fnodep->nodeh = 0; + fnodep->proph = 0; } /* @@ -968,8 +966,8 @@ env_picl_setup(void) for (i = 0; i < N_DISK_NODES; i++) { dnodep = &disk_nodes[i]; dnodep->diskp = disk_lookup(dnodep->disk_name); - dnodep->nodeh = NULL; - dnodep->proph = NULL; + dnodep->nodeh = 0; + dnodep->proph = 0; } /* diff --git a/usr/src/cmd/picl/plugins/sun4u/daktari/frutree/piclfrutree.c b/usr/src/cmd/picl/plugins/sun4u/daktari/frutree/piclfrutree.c index d9a2264f39..0c2849b678 100644 --- a/usr/src/cmd/picl/plugins/sun4u/daktari/frutree/piclfrutree.c +++ b/usr/src/cmd/picl/plugins/sun4u/daktari/frutree/piclfrutree.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * PICL plug-in that creates the FRU Hierarchy for the * SUNW,Sun-Fire-880 (Daktari) platform @@ -328,8 +326,8 @@ picl_frutree_fini(void) * * It processes the following events: * - * PICLEVENT_SYSEVENT_DEVICE_ADDED - * PICLEVENT_SYSEVENT_DEVICE_REMOVED + * PICLEVENT_SYSEVENT_DEVICE_ADDED + * PICLEVENT_SYSEVENT_DEVICE_REMOVED */ /* ARGSUSED */ static void @@ -1149,10 +1147,10 @@ frudr_completion_handler(char *ename, void *earg, size_t size) * now frudata has been notified that the node is to be * removed, we can actually remove it */ - fruh = NULL; + fruh = 0; (void) nvlist_lookup_uint64(earg, PICLEVENTARG_FRUHANDLE, &fruh); - if (fruh != NULL) { + if (fruh != 0) { (void) remove_picl_node(fruh); } } @@ -1173,7 +1171,7 @@ post_frudr_event(char *ename, picl_nodehdl_t parenth, picl_nodehdl_t fruh) ev_name = strdup(ename); if (ev_name == NULL) return; - if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, NULL)) { + if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, 0)) { free(ev_name); return; } @@ -1236,7 +1234,7 @@ add_power_supply(int slotnum) return (err); /* Post picl-fru-added event */ - post_frudr_event(PICL_FRU_ADDED, NULL, powermodh); + post_frudr_event(PICL_FRU_ADDED, 0, powermodh); } } return (PICL_SUCCESS); @@ -1268,7 +1266,7 @@ remove_power_supply(int slotnum) } /* Post picl-fru-removed event */ - post_frudr_event(PICL_FRU_REMOVED, NULL, powermodh); + post_frudr_event(PICL_FRU_REMOVED, 0, powermodh); } return (PICL_SUCCESS); diff --git a/usr/src/cmd/picl/plugins/sun4u/enchilada/envd/piclenvd.c b/usr/src/cmd/picl/plugins/sun4u/enchilada/envd/piclenvd.c index 8bcbef376e..144c9bb3f7 100644 --- a/usr/src/cmd/picl/plugins/sun4u/enchilada/envd/piclenvd.c +++ b/usr/src/cmd/picl/plugins/sun4u/enchilada/envd/piclenvd.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file contains the environmental PICL plug-in module. */ @@ -319,21 +317,21 @@ static int set_cpu_tach(ptree_warg_t *parg, const void *buf); static int get_sys_tach(ptree_rarg_t *parg, void *buf); static int set_sys_tach(ptree_warg_t *parg, const void *buf); -static int shutdown_override = 0; -static int sensor_poll_interval = SENSORPOLL_INTERVAL; +static int shutdown_override = 0; +static int sensor_poll_interval = SENSORPOLL_INTERVAL; static int warning_interval = WARNING_INTERVAL; static int disk_warning_interval = DISK_WARNING_INTERVAL; static int disk_warning_duration = DISK_WARNING_DURATION; -static int shutdown_interval = SHUTDOWN_INTERVAL; -static int disk_shutdown_interval = DISK_SHUTDOWN_INTERVAL; +static int shutdown_interval = SHUTDOWN_INTERVAL; +static int disk_shutdown_interval = DISK_SHUTDOWN_INTERVAL; static int ovtemp_monitor = 1; /* enabled */ static int pm_monitor = 1; /* enabled */ static int mon_fanstat = 1; /* enabled */ -static int cpu_mode; -static int sys_mode; -static int cpu_tach; -static int sys_tach; +static int cpu_mode; +static int sys_mode; +static int cpu_tach; +static int sys_tach; static char shutdown_cmd[] = SHUTDOWN_CMD; env_tuneable_t tuneables[] = { @@ -1034,26 +1032,27 @@ envd_setup_fans(void) /* make sure cpu0/1 present for validating cpu fans */ if (fanp->id == CPU0_FAN_ID) { if (ptree_get_node_by_path(CPU0_PATH, &tnodeh) != - PICL_SUCCESS) { - fanp->present = B_FALSE; - continue; + PICL_SUCCESS) { + fanp->present = B_FALSE; + continue; } } if (fanp->id == CPU1_FAN_ID) { if (ptree_get_node_by_path(CPU1_PATH, &tnodeh) != - PICL_SUCCESS) { - fanp->present = B_FALSE; - continue; + PICL_SUCCESS) { + fanp->present = B_FALSE; + continue; } } if (fanp->id == DIMM_FAN_ID) { if (ptree_get_node_by_path(DIMM_FAN_CONTROLLER_PATH, - &tnodeh) != PICL_SUCCESS) { - if (env_debug) - envd_log(LOG_ERR, - "dimm Fan not found in the system.\n"); - fanp->present = B_FALSE; - continue; + &tnodeh) != PICL_SUCCESS) { + if (env_debug) + envd_log(LOG_ERR, + "dimm Fan not found in the " + "system.\n"); + fanp->present = B_FALSE; + continue; } } (void) strcpy(path, "/devices"); @@ -1074,11 +1073,12 @@ envd_setup_fans(void) */ i2c_reg.reg_num = PIC16F819_COMMAND_REGISTER; i2c_reg.reg_value = (PIC16F819_SW_AWARE_MODE | - PIC16F819_FAN_FAULT_CLEAR); + PIC16F819_FAN_FAULT_CLEAR); if (ioctl(fd, I2C_SET_REG, &i2c_reg) == -1) { if (env_debug) envd_log(LOG_ERR, - "Error in writing to COMMAND reg. of DIMM FAN controller\n"); + "Error in writing to COMMAND reg. " + "of DIMM FAN controller\n"); } } else { /* Get speed range value */ @@ -1114,39 +1114,39 @@ envd_setup_disks(void) */ if (ptree_get_node_by_path(SCSI_CONTROLLER_NODE_PATH, - &tnodeh) != PICL_SUCCESS) { + &tnodeh) != PICL_SUCCESS) { if (env_debug) envd_log(LOG_ERR, - "On-Board SCSI controller not found in the system.\n"); + "On-Board SCSI controller not found " + "in the system.\n"); monitor_disk_temp = 0; return (-1); } if ((ret = ptree_get_propval_by_name(tnodeh, VENDOR_ID, - &vendor_id, - sizeof (vendor_id))) != 0) { + &vendor_id, sizeof (vendor_id))) != 0) { if (env_debug) envd_log(LOG_ERR, -"Error in getting vendor-id for SCSI controller. ret = %d errno = 0x%d\n", - ret, errno); + "Error in getting vendor-id for SCSI controller. " + "ret = %d errno = 0x%d\n", + ret, errno); monitor_disk_temp = 0; return (-1); } if ((ret = ptree_get_propval_by_name(tnodeh, DEVICE_ID, - &device_id, - sizeof (device_id))) != 0) { + &device_id, sizeof (device_id))) != 0) { if (env_debug) envd_log(LOG_ERR, -"Error in getting device-id for SCSI controller. ret = %d errno = 0x%d\n", - ret, errno); + "Error in getting device-id for SCSI controller. " + "ret = %d errno = 0x%d\n", ret, errno); monitor_disk_temp = 0; return (-1); } if (env_debug) envd_log(LOG_ERR, "vendor-id=0x%x device-id=0x%x\n", - vendor_id, device_id); + vendor_id, device_id); if ((vendor_id != LSI1030_VENDOR_ID) || - (device_id != LSI1030_DEVICE_ID)) { + (device_id != LSI1030_DEVICE_ID)) { monitor_disk_temp = 0; return (-1); } @@ -1157,20 +1157,20 @@ envd_setup_disks(void) for (i = 0; (diskp = envd_disks[i]) != NULL; i++) { if (ptree_get_node_by_path(diskp->nodepath, - &tnodeh) != PICL_SUCCESS) { + &tnodeh) != PICL_SUCCESS) { diskp->present = B_FALSE; if (env_debug) envd_log(LOG_ERR, - "DISK %d not found in the system.\n", - diskp->id); + "DISK %d not found in the system.\n", + diskp->id); continue; } diskp->fd = open(diskp->devfs_path, O_RDONLY); if (diskp->fd == -1) { diskp->present = B_FALSE; envd_log(LOG_ERR, - "Error in opening %s errno = 0x%x\n", - diskp->devfs_path, errno); + "Error in opening %s errno = 0x%x\n", + diskp->devfs_path, errno); continue; } diskp->present = B_TRUE; @@ -1179,23 +1179,23 @@ envd_setup_disks(void) * Find out if the Temperature page is supported by the disk. */ ret = scsi_log_sense(diskp->fd, SUPPORTED_LPAGES, - log_page, sizeof (log_page)); + log_page, sizeof (log_page)); if (ret != 0) { continue; } page_len = ((log_page[2] << 8) & 0xFF00) | log_page[3]; for (page_index = LOGPAGEHDRSIZE; - page_index < page_len + LOGPAGEHDRSIZE; page_index++) { + page_index < page_len + LOGPAGEHDRSIZE; page_index++) { switch (log_page[page_index]) { - case TEMPERATURE_PAGE: - diskp->tpage_supported = B_TRUE; + case TEMPERATURE_PAGE: + diskp->tpage_supported = B_TRUE; if (env_debug) envd_log(LOG_ERR, - "tpage supported for %s\n", - diskp->nodepath); - default: - break; + "tpage supported for %s\n", + diskp->nodepath); + default: + break; } } diskp->warning_tstamp = 0; @@ -1236,14 +1236,14 @@ envd_setup_sensors(void) /* make sure cpu0/1 sensors are present */ if (sensorp->id == CPU0_SENSOR_ID) { if (ptree_get_node_by_path(CPU0_PATH, &tnodeh) != - PICL_SUCCESS) { + PICL_SUCCESS) { sensorp->present = B_FALSE; continue; } } if (sensorp->id == CPU1_SENSOR_ID) { if (ptree_get_node_by_path(CPU1_PATH, &tnodeh) != - PICL_SUCCESS) { + PICL_SUCCESS) { sensorp->present = B_FALSE; continue; } @@ -1267,7 +1267,7 @@ envd_setup_sensors(void) */ if (ioctl(sensorp->fd, ADM1031_GET_TEMP_MIN_RANGE, - &tmin) != -1) { + &tmin) != -1) { sensorp->tmin = TMIN(tmin); } else { sensorp->tmin = -1; @@ -1383,7 +1383,7 @@ updateadm_ranges(char *name, uchar_t cur_lpstate) /* Read ADM default value only for the first time */ if (tsave[tindex] == 0) { if (ioctl(sensorp->fd, ADM1031_GET_TEMP_MIN_RANGE, - &tsave[tindex]) == -1) { + &tsave[tindex]) == -1) { if (env_debug) envd_log(LOG_ERR, "read tminrange ioctl failed"); @@ -1408,27 +1408,27 @@ updateadm_ranges(char *name, uchar_t cur_lpstate) * ADM 1031 Tmin/Trange register need to be reprogrammed. */ tdata = ((fanctl->fan_ctl_pairs[cur_lpstate].tMin / TMIN_UNITS) - << TMIN_SHIFT); + << TMIN_SHIFT); /* Need to pack tRange in ADM bits 2:0 */ switch (fanctl->fan_ctl_pairs[cur_lpstate].tRange) { - case 5: - break; + case 5: + break; - case 10: - tdata |= 1; - break; + case 10: + tdata |= 1; + break; - case 20: - tdata |= 2; - break; + case 20: + tdata |= 2; + break; - case 40: - tdata |= 3; - break; + case 40: + tdata |= 3; + break; - case 80: - tdata |= 4; - break; + case 80: + tdata |= 4; + break; } } else tdata = tsave[tindex]; @@ -1480,13 +1480,13 @@ pmthr(void *args) do { if (env_debug) { envd_log(LOG_INFO, - "pmstate event:0x%x flags:%x" - "comp:%d oldval:%d newval:%d path:%s\n", - pmstate.event, pmstate.flags, - pmstate.component, - pmstate.old_level, - pmstate.new_level, - pmstate.physpath); + "pmstate event:0x%x flags:%x" + "comp:%d oldval:%d newval:%d path:%s\n", + pmstate.event, pmstate.flags, + pmstate.component, + pmstate.old_level, + pmstate.new_level, + pmstate.physpath); } cur_lpstate = (pmstate.flags & PSC_ALL_LOWEST) ? 1 : 0; @@ -1518,11 +1518,11 @@ pmthr(void *args) * * FAN ON * Tmin - * ------------------------------------------- + * ------------------------------------------- * - * FAN ON/OFF + * FAN ON/OFF * - * -------------------------------------------- + * -------------------------------------------- * Tmin - Hysterisis * FAN OFF * @@ -1674,13 +1674,13 @@ handle_overtemp_interrupt(int hwm_id) if (env_debug) envd_log(LOG_ERR, - "sensor name %s, cur temp %d, " - "HW %d LW %d SD %d LS %d\n", - sensorp->name, temp, - sensorp->es_ptr->high_warning, - (int)sensorp->es_ptr->low_warning, - sensorp->es_ptr->high_shutdown, - (int)sensorp->es_ptr->low_shutdown); + "sensor name %s, cur temp %d, " + "HW %d LW %d SD %d LS %d\n", + sensorp->name, temp, + sensorp->es_ptr->high_warning, + (int)sensorp->es_ptr->low_warning, + sensorp->es_ptr->high_shutdown, + (int)sensorp->es_ptr->low_shutdown); if (TEMP_IN_WARNING_RANGE(sensorp->cur_temp, sensorp)) { /* @@ -1759,7 +1759,7 @@ wait_till_timeout: */ (void) pthread_mutex_lock(&env_monitor_mutex); ret = pthread_cond_reltimedwait_np(&env_monitor_cv, - &env_monitor_mutex, &to); + &env_monitor_mutex, &to); to.tv_sec = SENSORPOLL_INTERVAL; to.tv_nsec = 0; if (ret != ETIMEDOUT) { @@ -1798,7 +1798,7 @@ ovtemp_thr(void *args) } if (env_debug) envd_log(LOG_ERR, "ovtemp thread for %s running...\n", - hwm_devs[hwm_id]); + hwm_devs[hwm_id]); for (;;) { /* @@ -1816,7 +1816,7 @@ ovtemp_thr(void *args) */ (void) pthread_mutex_lock(&env_monitor_mutex); ret = pthread_cond_reltimedwait_np(&env_monitor_cv, - &env_monitor_mutex, &to); + &env_monitor_mutex, &to); to.tv_sec = INTERRUPTPOLL_INTERVAL; to.tv_nsec = 0; if (ret != ETIMEDOUT) { @@ -1841,27 +1841,27 @@ ovtemp_thr(void *args) if (err == -1) { if (env_debug) envd_log(LOG_ERR, - "OverTemp: Status Error"); + "OverTemp: Status Error"); continue; } if (env_debug) envd_log(LOG_ERR, "INTR %s, Stat1 %x, Stat2 %x", - hwm_devs[hwm_id], stat[0], stat[1]); + hwm_devs[hwm_id], stat[0], stat[1]); if (stat[0] & FANFAULT) { fanp = fan_lookup(hwm_fans[hwm_id][HWM_FAN1]); if (fanp && fanp->present) envd_log(LOG_ERR, ENV_FAN_FAULT, - hwm_devs[hwm_id], - hwm_fans[hwm_id][HWM_FAN1]); + hwm_devs[hwm_id], + hwm_fans[hwm_id][HWM_FAN1]); } if (stat[1] & FANFAULT) { fanp = fan_lookup(hwm_fans[hwm_id][HWM_FAN2]); if (fanp && fanp->present) envd_log(LOG_ERR, ENV_FAN_FAULT, - hwm_devs[hwm_id], - hwm_fans[hwm_id][HWM_FAN2]); + hwm_devs[hwm_id], + hwm_fans[hwm_id][HWM_FAN2]); } /* * Check respective Remote/Local High, Low before start @@ -1886,10 +1886,6 @@ dimm_fan_thr(void *args) pthread_mutex_t env_monitor_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t env_monitor_cv = PTHREAD_COND_INITIALIZER; -#ifdef __lint - args = args; -#endif - for (;;) { /* * Sleep for specified seconds before issuing IOCTL @@ -1897,7 +1893,7 @@ dimm_fan_thr(void *args) */ (void) pthread_mutex_lock(&env_monitor_mutex); ret = pthread_cond_reltimedwait_np(&env_monitor_cv, - &env_monitor_mutex, &to); + &env_monitor_mutex, &to); to.tv_sec = INTERRUPTPOLL_INTERVAL; to.tv_nsec = 0; if (ret != ETIMEDOUT) { @@ -1913,10 +1909,11 @@ dimm_fan_thr(void *args) i2c_reg.reg_num = PIC16F819_COMMAND_REGISTER; i2c_reg.reg_value = PIC16F819_SW_AWARE_MODE; if (ioctl(envd_dimm_fan.fd, - I2C_SET_REG, &i2c_reg) == -1) { + I2C_SET_REG, &i2c_reg) == -1) { if (env_debug) envd_log(LOG_ERR, - "Error in writing to COMMAND reg. of DIMM FAN controller\n"); + "Error in writing to COMMAND reg. " + "of DIMM FAN controller\n"); } /* * We initiate shutdown if fan status indicates @@ -1930,19 +1927,19 @@ dimm_fan_thr(void *args) */ envd_dimm_fan.present = B_FALSE; (void) snprintf(msgbuf, sizeof (msgbuf), - ENV_DIMM_FAN_FAILURE_SHUTDOWN_MSG, - ENV_DIMM_FAN, - dimm_fan_rpm_string, dimm_fan_status_string, - dimm_fan_command_string, - dimm_fan_debug_string); + ENV_DIMM_FAN_FAILURE_SHUTDOWN_MSG, + ENV_DIMM_FAN, + dimm_fan_rpm_string, dimm_fan_status_string, + dimm_fan_command_string, + dimm_fan_debug_string); envd_log(LOG_ALERT, msgbuf); if (system_shutdown_started == B_FALSE) { system_shutdown_started = B_TRUE; (void) snprintf(syscmd, sizeof (syscmd), - "%s \"%s\"", - SHUTDOWN_CMD, - msgbuf); + "%s \"%s\"", + SHUTDOWN_CMD, + msgbuf); envd_log(LOG_ALERT, syscmd); (void) system(syscmd); } @@ -1981,13 +1978,15 @@ scsi_log_sense(int fd, uchar_t page_code, uchar_t *pagebuf, uint16_t pagelen) if (ret_val == 0 && ucmd_buf.uscsi_status == 0) { if (env_debug) envd_log(LOG_ERR, - "log sense command for page_code 0x%x succeeded\n", page_code); + "log sense command for page_code 0x%x succeeded\n", + page_code); return (ret_val); } if (env_debug) envd_log(LOG_ERR, - "log sense command failed.ret_val = 0x%x status = 0x%x errno = 0x%x\n", - ret_val, ucmd_buf.uscsi_status, errno); + "log sense command failed.ret_val = 0x%x status = 0x%x " + "errno = 0x%x\n", + ret_val, ucmd_buf.uscsi_status, errno); return (1); } @@ -1998,8 +1997,8 @@ get_disk_temp(env_disk_t *diskp) uchar_t tpage[256]; ret = scsi_log_sense(diskp->fd, - TEMPERATURE_PAGE, - tpage, sizeof (tpage)); + TEMPERATURE_PAGE, + tpage, sizeof (tpage)); if (ret != 0) { diskp->current_temp = DISK_INVALID_TEMP; diskp->ref_temp = DISK_INVALID_TEMP; @@ -2011,7 +2010,7 @@ get_disk_temp(env_disk_t *diskp) * Temperature value of 255(0xFF) is considered INVALID. */ if ((tpage[7] == 0x02) && (tpage[4] == 0x00) && - (tpage[5] == 0x00)) { + (tpage[5] == 0x00)) { if (tpage[9] == 0xFF) { diskp->current_temp = DISK_INVALID_TEMP; return (-1); @@ -2026,7 +2025,7 @@ get_disk_temp(env_disk_t *diskp) * Temperature value of 255(0xFF) is considered INVALID. */ if ((tpage[13] == 0x02) && (tpage[10] == 0x00) && - (tpage[11] == 0x01)) { + (tpage[11] == 0x01)) { if (tpage[15] == 0xFF) { diskp->ref_temp = DISK_INVALID_TEMP; } else { @@ -2055,148 +2054,163 @@ disk_temp_thr(void *args) disk_pm_fd = open(PM_DEVICE, O_RDWR); if (disk_pm_fd == -1) { envd_log(LOG_ERR, - DISK_TEMP_THREAD_EXITING, - errno, strerror(errno)); + DISK_TEMP_THREAD_EXITING, + errno, strerror(errno)); return (NULL); } for (;;) { - /* - * Sleep for specified seconds before issuing IOCTL - * again. - */ - (void) pthread_mutex_lock(&env_monitor_mutex); - ret = pthread_cond_reltimedwait_np(&env_monitor_cv, - &env_monitor_mutex, &to); - to.tv_sec = disk_scan_interval; - to.tv_nsec = 0; - if (ret != ETIMEDOUT) { - (void) pthread_mutex_unlock(&env_monitor_mutex); - continue; - } - (void) pthread_mutex_unlock(&env_monitor_mutex); - for (i = 0; (diskp = envd_disks[i]) != NULL; i++) { - if (diskp->present == B_FALSE) - continue; - if (diskp->tpage_supported == B_FALSE) - continue; /* - * If the disk temperature is above the warning threshold - * continue monitoring until the temperature drops below - * warning threshold. - * if the temperature is in the NORMAL range monitor only - * when the disk is BUSY. - * We do not want to read the disk temperature if the disk is - * is idling. The reason for this is disk will never get into - * lowest power mode if we scan the disk temperature - * peridoically. To avoid this situation we first determine - * the idle_time of the disk. If the disk has been IDLE since - * we scanned the temperature last time we will not read the - * temperature. + * Sleep for specified seconds before issuing IOCTL + * again. */ - if (!DISK_TEMP_IN_WARNING_RANGE(diskp->current_temp, diskp)) { - pmstate.physpath = diskp->physpath; - pmstate.size = strlen(diskp->physpath); - pmstate.component = 0; - if ((idle_time = - ioctl(disk_pm_fd, - PM_GET_TIME_IDLE, &pmstate)) == -1) { - if (errno != EINTR) { - if (env_debug) + (void) pthread_mutex_lock(&env_monitor_mutex); + ret = pthread_cond_reltimedwait_np(&env_monitor_cv, + &env_monitor_mutex, &to); + to.tv_sec = disk_scan_interval; + to.tv_nsec = 0; + if (ret != ETIMEDOUT) { + (void) pthread_mutex_unlock(&env_monitor_mutex); + continue; + } + (void) pthread_mutex_unlock(&env_monitor_mutex); + for (i = 0; (diskp = envd_disks[i]) != NULL; i++) { + if (diskp->present == B_FALSE) + continue; + if (diskp->tpage_supported == B_FALSE) + continue; + /* + * If the disk temperature is above the warning + * threshold continue monitoring until the temperature + * drops below warning threshold. + * If the temperature is in the NORMAL range monitor + * only when the disk is BUSY. + * We do not want to read the disk temperature if the + * disk is is idling. The reason for this is disk will + * never get into lowest power mode if we scan the disk + * temperature peridoically. + * To avoid this situation we first determine + * the idle_time of the disk. If the disk has been + * IDLE since we scanned the temperature last time + * we will not read the temperature. + */ + if (!DISK_TEMP_IN_WARNING_RANGE(diskp->current_temp, + diskp)) { + pmstate.physpath = diskp->physpath; + pmstate.size = strlen(diskp->physpath); + pmstate.component = 0; + if ((idle_time = + ioctl(disk_pm_fd, + PM_GET_TIME_IDLE, &pmstate)) == -1) { + if (errno != EINTR) { + if (env_debug) { + envd_log(LOG_ERR, + "ioctl " + "PM_GET_TIME_IDLE " + "failed for DISK0." + " errno=0x%x\n", + errno); + } + continue; + } + continue; + } + if (idle_time >= (disk_scan_interval/2)) { + if (env_debug) { envd_log(LOG_ERR, - "ioctl PM_GET_TIME_IDLE failed for DISK0. errno=0x%x\n", - errno); + "%s idle time = %d\n", + diskp->name, idle_time); + } continue; } - continue; } - if (idle_time >= (disk_scan_interval/2)) { - if (env_debug) { - envd_log(LOG_ERR, - "%s idle time = %d\n", - diskp->name, idle_time); - } - continue; + ret = get_disk_temp(diskp); + if (ret != 0) + continue; + if (env_debug) { + envd_log(LOG_ERR, + "%s temp = %d ref. temp = %d\n", + diskp->name, diskp->current_temp, + diskp->ref_temp); } - } - ret = get_disk_temp(diskp); - if (ret != 0) - continue; - if (env_debug) { - envd_log(LOG_ERR, - "%s temp = %d ref. temp = %d\n", - diskp->name, diskp->current_temp, diskp->ref_temp); - } - /* - * If this disk already triggered system shutdown, don't - * log any more shutdown/warning messages for it. - */ - if (diskp->shutdown_initiated) - continue; - - /* - * Check for the temperature in warning and shutdown range - * and take appropriate action. - */ - if (DISK_TEMP_IN_WARNING_RANGE(diskp->current_temp, diskp)) { /* - * Check if the temperature has been in warning - * range during last disk_warning_duration interval. - * If so, the temperature is truly in warning - * range and we need to log a warning message, - * but no more than once every disk_warning_interval - * seconds. + * If this disk already triggered system shutdown, don't + * log any more shutdown/warning messages for it. */ - time_t wtstamp = diskp->warning_tstamp; - - ct = (time_t)(gethrtime() / NANOSEC); - if (diskp->warning_start == 0) - diskp->warning_start = ct; - if (((ct - diskp->warning_start) >= - disk_warning_duration) && (wtstamp == 0 || - (ct - wtstamp) >= disk_warning_interval)) { - envd_log(LOG_CRIT, ENV_WARNING_MSG, - diskp->name, diskp->current_temp, - diskp->low_warning, - diskp->high_warning); - diskp->warning_tstamp = ct; - } - } else if (diskp->warning_start != 0) - diskp->warning_start = 0; - - if (!shutdown_override && - DISK_TEMP_IN_SHUTDOWN_RANGE(diskp->current_temp, diskp)) { - ct = (time_t)(gethrtime() / NANOSEC); - if (diskp->shutdown_tstamp == 0) - diskp->shutdown_tstamp = ct; + if (diskp->shutdown_initiated) + continue; /* - * Shutdown the system if the temperature remains - * in the shutdown range for over disk_shutdown_interval - * seconds. + * Check for the temperature in warning and shutdown + * range and take appropriate action. */ - if ((ct - diskp->shutdown_tstamp) >= - disk_shutdown_interval) { - /* log error */ - diskp->shutdown_initiated = B_TRUE; - (void) snprintf(msgbuf, sizeof (msgbuf), - ENV_SHUTDOWN_MSG, diskp->name, - diskp->current_temp, diskp->low_shutdown, - diskp->high_shutdown); - envd_log(LOG_ALERT, msgbuf); - - /* shutdown the system (only once) */ - if (system_shutdown_started == B_FALSE) { - (void) snprintf(syscmd, sizeof (syscmd), - "%s \"%s\"", shutdown_cmd, msgbuf); - envd_log(LOG_ALERT, syscmd); - system_shutdown_started = B_TRUE; - (void) system(syscmd); + if (DISK_TEMP_IN_WARNING_RANGE(diskp->current_temp, + diskp)) { + /* + * Check if the temperature has been in warning + * range during last disk_warning_duration + * interval. + * If so, the temperature is truly in warning + * range and we need to log a warning message, + * but no more than once every + * disk_warning_interval seconds. + */ + time_t wtstamp = diskp->warning_tstamp; + + ct = (time_t)(gethrtime() / NANOSEC); + if (diskp->warning_start == 0) + diskp->warning_start = ct; + if (((ct - diskp->warning_start) >= + disk_warning_duration) && (wtstamp == 0 || + (ct - wtstamp) >= disk_warning_interval)) { + envd_log(LOG_CRIT, ENV_WARNING_MSG, + diskp->name, diskp->current_temp, + diskp->low_warning, + diskp->high_warning); + diskp->warning_tstamp = ct; } - } - } else if (diskp->shutdown_tstamp != 0) - diskp->shutdown_tstamp = 0; + } else if (diskp->warning_start != 0) + diskp->warning_start = 0; + + if (!shutdown_override && + DISK_TEMP_IN_SHUTDOWN_RANGE(diskp->current_temp, + diskp)) { + ct = (time_t)(gethrtime() / NANOSEC); + if (diskp->shutdown_tstamp == 0) + diskp->shutdown_tstamp = ct; + + /* + * Shutdown the system if the temperature + * remains in the shutdown range for over + * disk_shutdown_interval seconds. + */ + if ((ct - diskp->shutdown_tstamp) >= + disk_shutdown_interval) { + /* log error */ + diskp->shutdown_initiated = B_TRUE; + (void) snprintf(msgbuf, sizeof (msgbuf), + ENV_SHUTDOWN_MSG, diskp->name, + diskp->current_temp, + diskp->low_shutdown, + diskp->high_shutdown); + envd_log(LOG_ALERT, msgbuf); + + /* shutdown the system (only once) */ + if (system_shutdown_started == + B_FALSE) { + (void) snprintf(syscmd, + sizeof (syscmd), + "%s \"%s\"", shutdown_cmd, + msgbuf); + envd_log(LOG_ALERT, syscmd); + system_shutdown_started = + B_TRUE; + (void) system(syscmd); + } + } + } else if (diskp->shutdown_tstamp != 0) + diskp->shutdown_tstamp = 0; - } + } } /* end of forever loop */ } @@ -2208,7 +2222,7 @@ disk_temp_thr(void *args) static int envd_setup(void) { - int ret; + int ret; if (getenv("SUNW_piclenvd_debug") != NULL) env_debug = 1; @@ -2229,7 +2243,7 @@ envd_setup(void) * at least one sensor. */ if (envd_setup_sensors() <= 0) { - return (NULL); + return (0); } /* @@ -2259,13 +2273,13 @@ envd_setup(void) } if (envd_dimm_fan.present) { - if (dimm_fan_thr_created == B_FALSE) { - if (pthread_create(&dimm_fan_thr_id, &thr_attr, dimm_fan_thr, - NULL) != 0) - envd_log(LOG_ERR, ENVTHR_THREAD_CREATE_FAILED); - else - dimm_fan_thr_created = B_TRUE; - } + if (dimm_fan_thr_created == B_FALSE) { + if (pthread_create(&dimm_fan_thr_id, &thr_attr, + dimm_fan_thr, NULL) != 0) + envd_log(LOG_ERR, ENVTHR_THREAD_CREATE_FAILED); + else + dimm_fan_thr_created = B_TRUE; + } } /* @@ -2279,13 +2293,13 @@ envd_setup(void) pmthr_created = B_TRUE; } if (monitor_disk_temp) { - if (disk_temp_thr_created == B_FALSE) { - if (pthread_create(&disk_temp_thr_id, &thr_attr, disk_temp_thr, - NULL) != 0) - envd_log(LOG_ERR, ENVTHR_THREAD_CREATE_FAILED); - else - disk_temp_thr_created = B_TRUE; - } + if (disk_temp_thr_created == B_FALSE) { + if (pthread_create(&disk_temp_thr_id, &thr_attr, + disk_temp_thr, NULL) != 0) + envd_log(LOG_ERR, ENVTHR_THREAD_CREATE_FAILED); + else + disk_temp_thr_created = B_TRUE; + } } return (0); } @@ -2830,18 +2844,19 @@ is_dimm_fan_failed(void) if (retry_count != MAX_RETRIES_FOR_PIC16F819_REG_READ) { if (env_debug) envd_log(LOG_ERR, - "%d retries attempted in reading STATUS register.\n", + "%d retries attempted in reading STATUS " + "register.\n", (MAX_RETRIES_FOR_PIC16F819_REG_READ - retry_count)); } if (retry_count == 0) { (void) strncpy(dimm_fan_status_string, NOT_AVAILABLE, - sizeof (dimm_fan_status_string)); + sizeof (dimm_fan_status_string)); (void) strncpy(dimm_fan_command_string, NOT_AVAILABLE, - sizeof (dimm_fan_command_string)); + sizeof (dimm_fan_command_string)); (void) strncpy(dimm_fan_debug_string, NOT_AVAILABLE, - sizeof (dimm_fan_debug_string)); + sizeof (dimm_fan_debug_string)); (void) strncpy(dimm_fan_rpm_string, NOT_AVAILABLE, - sizeof (dimm_fan_rpm_string)); + sizeof (dimm_fan_rpm_string)); return (-1); } if (env_debug) @@ -2849,33 +2864,33 @@ is_dimm_fan_failed(void) "DIMM FAN STATUS reg = 0x%x\n", i2c_reg.reg_value); if (i2c_reg.reg_value & PIC16F819_FAN_FAILED) { (void) snprintf(dimm_fan_status_string, - sizeof (dimm_fan_status_string), "0x%x", - i2c_reg.reg_value); + sizeof (dimm_fan_status_string), "0x%x", + i2c_reg.reg_value); i2c_reg.reg_num = PIC16F819_DEBUG_REGISTER; if (ioctl(envd_dimm_fan.fd, I2C_GET_REG, &i2c_reg) == -1) { (void) strncpy(dimm_fan_debug_string, NOT_AVAILABLE, - sizeof (dimm_fan_debug_string)); + sizeof (dimm_fan_debug_string)); } else { (void) snprintf(dimm_fan_debug_string, - sizeof (dimm_fan_debug_string), - "0x%x", i2c_reg.reg_value); + sizeof (dimm_fan_debug_string), + "0x%x", i2c_reg.reg_value); } i2c_reg.reg_num = PIC16F819_COMMAND_REGISTER; if (ioctl(envd_dimm_fan.fd, I2C_GET_REG, &i2c_reg) == -1) { (void) strncpy(dimm_fan_command_string, NOT_AVAILABLE, - sizeof (dimm_fan_command_string)); + sizeof (dimm_fan_command_string)); } else { (void) snprintf(dimm_fan_command_string, - sizeof (dimm_fan_command_string), - "0x%x", i2c_reg.reg_value); + sizeof (dimm_fan_command_string), + "0x%x", i2c_reg.reg_value); } if (get_dimm_fan_speed(envd_dimm_fan.fd, &fan_speed) == -1) { (void) strncpy(dimm_fan_rpm_string, NOT_AVAILABLE, - sizeof (dimm_fan_rpm_string)); + sizeof (dimm_fan_rpm_string)); } else { (void) snprintf(dimm_fan_rpm_string, - sizeof (dimm_fan_rpm_string), - "%d", fan_speed); + sizeof (dimm_fan_rpm_string), + "%d", fan_speed); } return (1); } else return (0); diff --git a/usr/src/cmd/picl/plugins/sun4u/enchilada/envd/piclenvsetup.c b/usr/src/cmd/picl/plugins/sun4u/enchilada/envd/piclenvsetup.c index 56dcf64224..ca9ebe3ac6 100644 --- a/usr/src/cmd/picl/plugins/sun4u/enchilada/envd/piclenvsetup.c +++ b/usr/src/cmd/picl/plugins/sun4u/enchilada/envd/piclenvsetup.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file contains code for setting up environmental related nodes * and properties in the PICL tree. @@ -88,22 +86,22 @@ typedef struct { */ static sensor_node_t sensor_nodes[] = { {"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,58", - SENSOR_CPU0_DIE, NULL, NULL, NULL, NULL}, + SENSOR_CPU0_DIE, NULL, 0, 0, 0}, {"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,58", - SENSOR_CPU1_DIE, NULL, NULL, NULL, NULL}, + SENSOR_CPU1_DIE, NULL, 0, 0, 0}, {"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,58", - SENSOR_INT_AMB_0, NULL, NULL, NULL, NULL}, + SENSOR_INT_AMB_0, NULL, 0, 0, 0}, {"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c", - SENSOR_SYS_OUT, NULL, NULL, NULL, NULL}, + SENSOR_SYS_OUT, NULL, 0, 0, 0}, {"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c", - SENSOR_SYS_IN, NULL, NULL, NULL, NULL}, + SENSOR_SYS_IN, NULL, 0, 0, 0}, {"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c", - SENSOR_INT_AMB_1, NULL, NULL, NULL, NULL}, + SENSOR_INT_AMB_1, NULL, 0, 0, 0}, }; #define N_SENSOR_NODES (sizeof (sensor_nodes)/sizeof (sensor_nodes[0])) @@ -115,7 +113,7 @@ static sensor_node_t sensor_nodes[] = { typedef struct { char *parent_path; /* parent node path */ char *fan_name; /* fan name */ - env_fan_t *fanp; /* fan information */ + env_fan_t *fanp; /* fan information */ char *speed_unit; /* speed unit string */ picl_nodehdl_t nodeh; /* "fan" node handle */ picl_prophdl_t proph; /* "Speed" property handle */ @@ -127,19 +125,19 @@ typedef struct { */ static fan_node_t fan_nodes[] = { {"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,58", - ENV_CPU0_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL}, + ENV_CPU0_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0}, {"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,58", - ENV_CPU1_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL}, + ENV_CPU1_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0}, {"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c", - ENV_SYSTEM_OUT_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL}, + ENV_SYSTEM_OUT_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0}, {"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c", - ENV_SYSTEM_INTAKE_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL}, + ENV_SYSTEM_INTAKE_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0}, {"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,52", - ENV_DIMM_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL}, + ENV_DIMM_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0}, }; #define N_FAN_NODES (sizeof (fan_nodes)/sizeof (fan_nodes[0])) @@ -150,7 +148,7 @@ static fan_node_t fan_nodes[] = { typedef struct { char *parent_path; /* parent node path */ char *disk_name; /* disk name */ - env_disk_t *diskp; /* disk information */ + env_disk_t *diskp; /* disk information */ picl_nodehdl_t nodeh; /* "disk" node handle */ picl_prophdl_t proph; /* "Temperature" property handle */ } disk_node_t; @@ -159,8 +157,8 @@ typedef struct { * Disk node array */ static disk_node_t disk_nodes[] = { - {DISK0_NODE_PATH, ENV_DISK0, NULL, NULL, NULL}, - {DISK1_NODE_PATH, ENV_DISK1, NULL, NULL, NULL}, + {DISK0_NODE_PATH, ENV_DISK0, NULL, 0, 0}, + {DISK1_NODE_PATH, ENV_DISK1, NULL, 0, 0}, }; #define N_DISK_NODES (sizeof (disk_nodes)/sizeof (disk_nodes[0])) @@ -178,7 +176,7 @@ static void delete_fan_nodes_and_props(void); static int get_current_temp(ptree_rarg_t *parg, void *buf) { - tempr_t temp; + tempr_t temp; picl_prophdl_t proph; sensor_node_t *snodep; int i; @@ -207,7 +205,7 @@ get_current_temp(ptree_rarg_t *parg, void *buf) static int get_disk_temp(ptree_rarg_t *parg, void *buf) { - tempr_t temp; + tempr_t temp; picl_prophdl_t proph; disk_node_t *dnodep; int i; @@ -497,12 +495,12 @@ delete_sensor_nodes_and_props(void) for (i = 0; i < N_SENSOR_NODES; ++i) { snodep = &sensor_nodes[i]; - if (snodep->nodeh != NULL) { + if (snodep->nodeh != 0) { /* delete node and all properties under it */ (void) ptree_delete_node(snodep->nodeh); (void) ptree_destroy_node(snodep->nodeh); - snodep->nodeh = NULL; - snodep->proph = NULL; + snodep->nodeh = 0; + snodep->proph = 0; } } } @@ -529,11 +527,12 @@ add_disk_nodes_and_props() */ err = ptree_get_node_by_path(dnodep->parent_path, &nodeh); if (err != PICL_SUCCESS) { - if (env_debug) - envd_log(LOG_ERR, "failed to get node for path %s\n", - dnodep->parent_path); - err = PICL_SUCCESS; - continue; + if (env_debug) + envd_log(LOG_ERR, + "failed to get node for path %s\n", + dnodep->parent_path); + err = PICL_SUCCESS; + continue; } diskp = dnodep->diskp; if (diskp->present == B_FALSE) @@ -584,24 +583,24 @@ add_disk_nodes_and_props() */ (void) add_regular_prop(cnodeh, PICL_PROP_LOW_SHUTDOWN, - PICL_PTYPE_INT, PICL_READ, - sizeof (diskp->low_shutdown), - (void *)&(diskp->low_shutdown), &proph); + PICL_PTYPE_INT, PICL_READ, + sizeof (diskp->low_shutdown), + (void *)&(diskp->low_shutdown), &proph); (void) add_regular_prop(cnodeh, PICL_PROP_LOW_WARNING, - PICL_PTYPE_INT, PICL_READ, - sizeof (diskp->low_warning), - (void *)&(diskp->low_warning), &proph); + PICL_PTYPE_INT, PICL_READ, + sizeof (diskp->low_warning), + (void *)&(diskp->low_warning), &proph); (void) add_regular_prop(cnodeh, PICL_PROP_HIGH_WARNING, - PICL_PTYPE_INT, PICL_READ, - sizeof (diskp->high_warning), - (void *)&(diskp->high_warning), &proph); + PICL_PTYPE_INT, PICL_READ, + sizeof (diskp->high_warning), + (void *)&(diskp->high_warning), &proph); (void) add_regular_prop(cnodeh, PICL_PROP_HIGH_SHUTDOWN, - PICL_PTYPE_INT, PICL_READ, - sizeof (diskp->high_shutdown), - (void *)&(diskp->high_shutdown), &proph); + PICL_PTYPE_INT, PICL_READ, + sizeof (diskp->high_shutdown), + (void *)&(diskp->high_shutdown), &proph); } if (err != PICL_SUCCESS) { @@ -633,11 +632,11 @@ delete_disk_nodes_and_props(void) for (i = 0; i < N_DISK_NODES; ++i) { dnodep = &disk_nodes[i]; - if (dnodep->nodeh != NULL) { + if (dnodep->nodeh != 0) { (void) ptree_delete_node(dnodep->nodeh); (void) ptree_destroy_node(dnodep->nodeh); - dnodep->nodeh = NULL; - dnodep->proph = NULL; + dnodep->nodeh = 0; + dnodep->proph = 0; } } } @@ -716,14 +715,14 @@ add_fan_nodes_and_props() * We do not permit setting of DIMM FAN speeds. */ err = add_volatile_prop(cnodeh, pname, PICL_PTYPE_INT, - PICL_READ, sizeof (fanspeed_t), - get_current_speed, - NULL, &proph); + PICL_READ, sizeof (fanspeed_t), + get_current_speed, + NULL, &proph); } else { err = add_volatile_prop(cnodeh, pname, PICL_PTYPE_INT, - PICL_READ|PICL_WRITE, sizeof (fanspeed_t), - get_current_speed, - set_current_speed, &proph); + PICL_READ|PICL_WRITE, sizeof (fanspeed_t), + get_current_speed, + set_current_speed, &proph); } if (err != PICL_SUCCESS) @@ -772,10 +771,10 @@ delete_fan_nodes_and_props(void) for (i = 0; i < N_FAN_NODES; ++i) { fnodep = &fan_nodes[i]; - if (fnodep->nodeh != NULL) { + if (fnodep->nodeh != 0) { (void) ptree_delete_node(fnodep->nodeh); (void) ptree_destroy_node(fnodep->nodeh); - fnodep->nodeh = NULL; + fnodep->nodeh = 0; } } } @@ -943,9 +942,9 @@ env_picl_setup(void) for (i = 0; i < N_SENSOR_NODES; ++i) { snodep = &sensor_nodes[i]; snodep->sensorp = sensor_lookup(snodep->sensor_name); - snodep->nodeh = NULL; - snodep->proph = NULL; - snodep->target_proph = NULL; + snodep->nodeh = 0; + snodep->proph = 0; + snodep->target_proph = 0; } /* @@ -954,8 +953,8 @@ env_picl_setup(void) for (i = 0; i < N_FAN_NODES; ++i) { fnodep = &fan_nodes[i]; fnodep->fanp = fan_lookup(fnodep->fan_name); - fnodep->nodeh = NULL; - fnodep->proph = NULL; + fnodep->nodeh = 0; + fnodep->proph = 0; } /* @@ -964,8 +963,8 @@ env_picl_setup(void) for (i = 0; i < N_DISK_NODES; ++i) { dnodep = &disk_nodes[i]; dnodep->diskp = disk_lookup(dnodep->disk_name); - dnodep->nodeh = NULL; - dnodep->proph = NULL; + dnodep->nodeh = 0; + dnodep->proph = 0; } /* diff --git a/usr/src/cmd/picl/plugins/sun4u/excalibur/envd/piclenvsetup.c b/usr/src/cmd/picl/plugins/sun4u/excalibur/envd/piclenvsetup.c index c33b7ab029..64420e7306 100644 --- a/usr/src/cmd/picl/plugins/sun4u/excalibur/envd/piclenvsetup.c +++ b/usr/src/cmd/picl/plugins/sun4u/excalibur/envd/piclenvsetup.c @@ -24,8 +24,6 @@ * All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file contains code for setting up environmental related nodes * and properties in the PICL tree. @@ -133,7 +131,7 @@ static sensor_node_t sensor_nodes[] = { */ typedef struct { char *fan_name; /* fan name */ - env_fan_t *fanp; /* fan information */ + env_fan_t *fanp; /* fan information */ char *speed_unit; /* speed unit string */ picl_nodehdl_t nodeh; /* "fan" node handle */ picl_prophdl_t proph; /* "Speed" property handle */ @@ -203,7 +201,7 @@ get_current_target_temp(ptree_rarg_t *parg, void *buf) static int get_current_temp(ptree_rarg_t *parg, void *buf) { - tempr_t temp; + tempr_t temp; picl_prophdl_t proph; sensor_node_t *snodep; @@ -298,7 +296,7 @@ add_node_to_list(picl_nodehdl_t nodeh, node_list_t *listp) */ static node_list_t * get_node_list_by_class(picl_nodehdl_t nodeh, const char *classname, - node_list_t *listp) + node_list_t *listp) { int err; char clname[PICL_CLASSNAMELEN_MAX+1]; @@ -507,7 +505,7 @@ add_sensor_nodes_and_props(picl_nodehdl_t plath) * Skip if already initialized or no sensor info */ sensorp = snodep->sensorp; - if (snodep->nodeh != NULL || sensorp == NULL) + if (snodep->nodeh != 0 || sensorp == NULL) continue; /* @@ -628,18 +626,18 @@ delete_sensor_nodes_and_props(void) */ for (snodep = sensor_nodes; snodep->sensor_name != NULL; snodep++) { - if (snodep->sdev_proph != NULL) { + if (snodep->sdev_proph != 0) { (void) ptree_delete_prop(snodep->sdev_proph); (void) ptree_destroy_prop(snodep->sdev_proph); - snodep->sdev_proph = NULL; + snodep->sdev_proph = 0; } - if (snodep->nodeh != NULL) { + if (snodep->nodeh != 0) { /* delete node and all properties under it */ (void) ptree_delete_node(snodep->nodeh); (void) ptree_destroy_node(snodep->nodeh); - snodep->nodeh = NULL; - snodep->proph = NULL; + snodep->nodeh = 0; + snodep->proph = 0; } } } @@ -682,7 +680,7 @@ add_fan_nodes_and_props(picl_nodehdl_t plath) for (fnodep = fan_nodes; fnodep->fan_name != NULL; fnodep++) { /* Skip if already initialized or no fan info */ - if (fnodep->nodeh != NULL || fnodep->fanp == NULL) + if (fnodep->nodeh != 0 || fnodep->fanp == NULL) continue; /* @@ -731,9 +729,9 @@ add_fan_nodes_and_props(picl_nodehdl_t plath) */ pname = PICL_PROP_FAN_SPEED_UNIT; err = add_regular_prop(cnodeh, pname, - PICL_PTYPE_CHARSTRING, PICL_READ, - strlen(fnodep->speed_unit)+1, - (void *)fnodep->speed_unit, &proph); + PICL_PTYPE_CHARSTRING, PICL_READ, + strlen(fnodep->speed_unit)+1, + (void *)fnodep->speed_unit, &proph); if (err != PICL_SUCCESS) break; @@ -770,10 +768,10 @@ delete_fan_nodes_and_props(void) */ for (fnodep = fan_nodes; fnodep->fan_name != NULL; fnodep++) { - if (fnodep->nodeh != NULL) { + if (fnodep->nodeh != 0) { (void) ptree_delete_node(fnodep->nodeh); (void) ptree_destroy_node(fnodep->nodeh); - fnodep->nodeh = NULL; + fnodep->nodeh = 0; } } } @@ -806,7 +804,7 @@ get_envmodel_conf_file(char *outfilename) } (void) snprintf(pname, PATH_MAX, "%s/%s", PICLD_COMMON_PLUGIN_DIR, - ENVMODEL_CONF_FILE); + ENVMODEL_CONF_FILE); if (access(pname, R_OK) == 0) { (void) strlcpy(outfilename, pname, PATH_MAX); @@ -842,10 +840,10 @@ env_picl_setup(void) */ for (snodep = sensor_nodes; snodep->sensor_name != NULL; snodep++) { snodep->sensorp = sensor_lookup(snodep->sensor_name); - snodep->nodeh = NULL; - snodep->proph = NULL; - snodep->target_proph = NULL; - snodep->sdev_proph = NULL; + snodep->nodeh = 0; + snodep->proph = 0; + snodep->target_proph = 0; + snodep->sdev_proph = 0; } /* @@ -853,8 +851,8 @@ env_picl_setup(void) */ for (fnodep = fan_nodes; fnodep->fan_name != NULL; fnodep++) { fnodep->fanp = fan_lookup(fnodep->fan_name); - fnodep->nodeh = NULL; - fnodep->proph = NULL; + fnodep->nodeh = 0; + fnodep->proph = 0; } /* diff --git a/usr/src/cmd/picl/plugins/sun4u/frudata/fru_data.c b/usr/src/cmd/picl/plugins/sun4u/frudata/fru_data.c index e0849ebc47..f73c2585c5 100644 --- a/usr/src/cmd/picl/plugins/sun4u/frudata/fru_data.c +++ b/usr/src/cmd/picl/plugins/sun4u/frudata/fru_data.c @@ -210,7 +210,7 @@ lock_container_lock(picl_nodehdl_t nodehdl, int object_type, int operation) static hash_obj_t * lookup_node_object(picl_nodehdl_t nodehdl, int object_type, - container_tbl_t *cont_tbl) + container_tbl_t *cont_tbl) { int index_to_hash; hash_obj_t *first_hash; @@ -561,7 +561,7 @@ free_packet_list(hash_obj_t *hash_obj, container_tbl_t *cont_tbl) static void free_segment_node(hash_obj_t *hash_obj, picl_nodehdl_t nodehdl, - container_tbl_t *cont_tbl) + container_tbl_t *cont_tbl) { hash_obj_t *prev_hash_obj; hash_obj_t *next_obj; @@ -1107,7 +1107,7 @@ frudata_delete_packet(ptree_warg_t *warg, const void *buf) static int add_row_to_table(hash_obj_t *seg_obj, picl_nodehdl_t tblhdl, packet_t *pkt, - container_tbl_t *cont_tbl) + container_tbl_t *cont_tbl) { int retval; int paylen; @@ -1195,7 +1195,7 @@ add_row_to_table(hash_obj_t *seg_obj, picl_nodehdl_t tblhdl, packet_t *pkt, static int frudata_read_packet(picl_nodehdl_t nodeh, picl_prophdl_t *tblhdl, - container_tbl_t *cont_tbl, door_cred_t *cred) + container_tbl_t *cont_tbl, door_cred_t *cred) { int cnt; int retval; @@ -1388,7 +1388,7 @@ freeup(picl_nodehdl_t nodeh) static int create_segment_node(hash_obj_t *sec_obj, picl_nodehdl_t sec_node, - segment_t *segment, container_tbl_t *cont_tbl, door_cred_t *cred) + segment_t *segment, container_tbl_t *cont_tbl, door_cred_t *cred) { int retval; @@ -1745,7 +1745,7 @@ frudata_add_segment(ptree_warg_t *warg, const void *buf) static int create_section_node(picl_nodehdl_t nodehdl, int section_count, - section_t *section, container_tbl_t *cont_tbl) + section_t *section, container_tbl_t *cont_tbl) { char sec_name[SECNAMESIZE]; hash_obj_t *hash_obj; @@ -2167,7 +2167,7 @@ delete_frudata_props(picl_nodehdl_t fru_hdl) /* ARGSUSED */ static void frudata_state_change_evhandler(const char *event_name, const void *event_arg, - size_t size, void *cookie) + size_t size, void *cookie) { int rc; nvlist_t *nvlp; @@ -2180,7 +2180,7 @@ frudata_state_change_evhandler(const char *event_name, const void *event_arg, if (strcmp(event_name, PICLEVENT_STATE_CHANGE) != 0) return; - if (nvlist_unpack((char *)event_arg, size, &nvlp, NULL)) { + if (nvlist_unpack((char *)event_arg, size, &nvlp, 0)) { return; } @@ -2271,7 +2271,7 @@ frudata_state_change_evhandler(const char *event_name, const void *event_arg, /* ARGSUSED */ static void frudata_event_handler(const char *event_name, const void *event_arg, - size_t size, void *cookie) + size_t size, void *cookie) { int retval; char fullfilename[PATH_MAX]; @@ -2316,7 +2316,7 @@ frudata_event_handler(const char *event_name, const void *event_arg, /* * Function : plugin_init() is called by daemon. this routine is specified - * while registering with daemon. it performs the initialization + * while registering with daemon. it performs the initialization * of plugin module. */ diff --git a/usr/src/cmd/picl/plugins/sun4u/grover/envd/piclenvsetup.c b/usr/src/cmd/picl/plugins/sun4u/grover/envd/piclenvsetup.c index 6431df8bde..f456eb0fb2 100644 --- a/usr/src/cmd/picl/plugins/sun4u/grover/envd/piclenvsetup.c +++ b/usr/src/cmd/picl/plugins/sun4u/grover/envd/piclenvsetup.c @@ -24,8 +24,6 @@ * All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file contains code for setting up environmental related nodes * and properties in the PICL tree. @@ -154,7 +152,7 @@ static sensor_node_t sensor_nodes[] = { */ typedef struct { char *fan_name; /* fan name */ - env_fan_t *fanp; /* fan information */ + env_fan_t *fanp; /* fan information */ char *speed_unit; /* speed unit string */ picl_nodehdl_t nodeh; /* "fan" node handle */ picl_prophdl_t proph; /* "Speed" property handle */ @@ -188,7 +186,7 @@ static void delete_fan_nodes_and_props(void); static int get_current_temp(ptree_rarg_t *parg, void *buf) { - tempr_t temp; + tempr_t temp; picl_prophdl_t proph; sensor_node_t *snodep; @@ -275,7 +273,7 @@ add_node_to_list(picl_nodehdl_t nodeh, node_list_t *listp) */ static node_list_t * get_node_list_by_class(picl_nodehdl_t nodeh, const char *classname, - node_list_t *listp) + node_list_t *listp) { int err; char clname[PICL_CLASSNAMELEN_MAX+1]; @@ -484,7 +482,7 @@ add_sensor_nodes_and_props(picl_nodehdl_t plath) * Skip if already initialized or no sensor info */ sensorp = snodep->sensorp; - if (snodep->nodeh != NULL || sensorp == NULL) + if (snodep->nodeh != 0 || sensorp == NULL) continue; /* @@ -590,18 +588,18 @@ delete_sensor_nodes_and_props(void) */ for (snodep = sensor_nodes; snodep->sensor_name != NULL; snodep++) { - if (snodep->sdev_proph != NULL) { + if (snodep->sdev_proph != 0) { (void) ptree_delete_prop(snodep->sdev_proph); (void) ptree_destroy_prop(snodep->sdev_proph); - snodep->sdev_proph = NULL; + snodep->sdev_proph = 0; } - if (snodep->nodeh != NULL) { + if (snodep->nodeh != 0) { /* delete node and all properties under it */ (void) ptree_delete_node(snodep->nodeh); (void) ptree_destroy_node(snodep->nodeh); - snodep->nodeh = NULL; - snodep->proph = NULL; + snodep->nodeh = 0; + snodep->proph = 0; } } } @@ -644,7 +642,7 @@ add_fan_nodes_and_props(picl_nodehdl_t plath) for (fnodep = fan_nodes; fnodep->fan_name != NULL; fnodep++) { /* Skip if already initialized or no fan info */ - if (fnodep->nodeh != NULL || fnodep->fanp == NULL) + if (fnodep->nodeh != 0 || fnodep->fanp == NULL) continue; /* @@ -691,7 +689,7 @@ add_fan_nodes_and_props(picl_nodehdl_t plath) /* * Add other "fan" class properties */ - pname = PROP_FAN_SPEED_UNIT, + pname = PROP_FAN_SPEED_UNIT; err = add_regular_prop(cnodeh, pname, PICL_PTYPE_CHARSTRING, PICL_READ, strlen(fnodep->speed_unit)+1, @@ -732,10 +730,10 @@ delete_fan_nodes_and_props(void) */ for (fnodep = fan_nodes; fnodep->fan_name != NULL; fnodep++) { - if (fnodep->nodeh != NULL) { + if (fnodep->nodeh != 0) { (void) ptree_delete_node(fnodep->nodeh); (void) ptree_destroy_node(fnodep->nodeh); - fnodep->nodeh = NULL; + fnodep->nodeh = 0; } } } @@ -768,7 +766,7 @@ get_envmodel_conf_file(char *outfilename) } (void) snprintf(pname, PATH_MAX, "%s/%s", PICLD_COMMON_PLUGIN_DIR, - ENVMODEL_CONF_FILE); + ENVMODEL_CONF_FILE); if (access(pname, R_OK) == 0) { (void) strlcpy(outfilename, pname, PATH_MAX); @@ -793,9 +791,9 @@ env_picl_setup(void) */ for (snodep = sensor_nodes; snodep->sensor_name != NULL; snodep++) { snodep->sensorp = sensor_lookup(snodep->sensor_name); - snodep->nodeh = NULL; - snodep->proph = NULL; - snodep->sdev_proph = NULL; + snodep->nodeh = 0; + snodep->proph = 0; + snodep->sdev_proph = 0; } /* @@ -803,8 +801,8 @@ env_picl_setup(void) */ for (fnodep = fan_nodes; fnodep->fan_name != NULL; fnodep++) { fnodep->fanp = fan_lookup(fnodep->fan_name); - fnodep->nodeh = NULL; - fnodep->proph = NULL; + fnodep->nodeh = 0; + fnodep->proph = 0; } /* diff --git a/usr/src/cmd/picl/plugins/sun4u/grover/memcfg/piclmemcfg.c b/usr/src/cmd/picl/plugins/sun4u/grover/memcfg/piclmemcfg.c index 30505cc151..0277cb3c4a 100644 --- a/usr/src/cmd/picl/plugins/sun4u/grover/memcfg/piclmemcfg.c +++ b/usr/src/cmd/picl/plugins/sun4u/grover/memcfg/piclmemcfg.c @@ -24,8 +24,6 @@ * All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This plugin creates memory configuration nodes and properties in the * PICL tree for Grover/Grover+ platform. @@ -101,7 +99,7 @@ create_logical_tree(picl_nodehdl_t memh, mmodinfo_t *mmodinfo) * It means no segment for the slot if size is zero */ if (mmodinfo[i].size == 0) { - memsegh[i] = NULL; + memsegh[i] = 0; continue; } @@ -165,7 +163,7 @@ create_logical_tree(picl_nodehdl_t memh, mmodinfo_t *mmodinfo) * Add reference property to the memory module if memory * module node handle is not NULL. */ - if (mmodinfo[i].memmodh == NULL) + if (mmodinfo[i].memmodh == 0) continue; err = ptree_init_propinfo(&propinfo, PTREE_PROPINFO_VERSION, @@ -185,7 +183,7 @@ create_logical_tree(picl_nodehdl_t memh, mmodinfo_t *mmodinfo) * Undo in the logical memory tree */ for (i = 0; i < TOTAL_MEM_SLOTS; i++) { - if (memsegh[i] == NULL) + if (memsegh[i] == 0) continue; (void) ptree_delete_node(memsegh[i]); @@ -274,7 +272,7 @@ create_physical_tree(picl_nodehdl_t plfh, mmodinfo_t *mmodinfo) * logical memory tree won't link to memory module. */ for (i = 0; i < TOTAL_MEM_SLOTS; i++) - mmodinfo[i].memmodh = NULL; + mmodinfo[i].memmodh = 0; /* * Undo in the physical memory tree diff --git a/usr/src/cmd/picl/plugins/sun4u/lib/fruaccess/fru_access.c b/usr/src/cmd/picl/plugins/sun4u/lib/fruaccess/fru_access.c index aaa9e843f7..1bb24230cd 100644 --- a/usr/src/cmd/picl/plugins/sun4u/lib/fruaccess/fru_access.c +++ b/usr/src/cmd/picl/plugins/sun4u/lib/fruaccess/fru_access.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <limits.h> #include <alloca.h> #include "fru_access_impl.h" @@ -777,41 +775,41 @@ fru_open_container(picl_nodehdl_t fruhdl) retval = ptree_get_propval_by_name(fruhdl, PICL_REFPROP_SEEPROM_SRC, &tmphdl, sizeof (tmphdl)); if (retval != PICL_SUCCESS) { - return (NULL); + return (0); } /* Get the device path of the fru */ retval = ptree_get_propval_by_name(tmphdl, PICL_PROP_DEVICEPATH, devpath, PATH_MAX); if (retval != PICL_SUCCESS) { - return (NULL); + return (0); } retval = ptree_get_prop_by_name(tmphdl, PICL_PROP_BINDING_NAME, &prophdl); if (retval != PICL_SUCCESS) { - return (NULL); + return (0); } retval = ptree_get_propinfo(prophdl, &propinfo); if (retval != PICL_SUCCESS) { - return (NULL); + return (0); } bname = alloca(propinfo.piclinfo.size); if (bname == NULL) { - return (NULL); + return (0); } /* get the driver binding name */ retval = ptree_get_propval(prophdl, bname, propinfo.piclinfo.size); if (retval != PICL_SUCCESS) { - return (NULL); + return (0); } cont_hash_obj = create_container_hash_object(); if (cont_hash_obj == NULL) { - return (NULL); + return (0); } add_hashobject_to_hashtable(cont_hash_obj); @@ -823,7 +821,7 @@ fru_open_container(picl_nodehdl_t fruhdl) if (strcmp(bname, "i2c-at34c02") == 0) { device_fd = open(devpath, O_RDONLY); if (device_fd < 0) { - return (NULL); + return (0); } first_byte = 0x00; @@ -861,7 +859,7 @@ fru_open_container(picl_nodehdl_t fruhdl) retval = get_container_info(devpath, bname, &cont_info); } if (retval < 0) { - return (NULL); + return (0); } cont_hash_obj->u.cont_obj->num_of_section = cont_info.num_sections; @@ -870,7 +868,7 @@ fru_open_container(picl_nodehdl_t fruhdl) for (count = 0; count < cont_info.num_sections; count++) { sec_hash_obj = create_section_hash_object(); if (sec_hash_obj == NULL) { - return (NULL); + return (0); } add_hashobject_to_hashtable(sec_hash_obj); @@ -1101,7 +1099,7 @@ call_devfsadm(void) /* * Description : - * fru_get_sections() fills an array of section structures passed + * fru_get_sections() fills an array of section structures passed * as an argument. * * Arguments : @@ -1110,16 +1108,16 @@ call_devfsadm(void) * int : maximum number of section in a container. * * Returns : - * int - * On success,the number of section structures written is returned; - * on error, -1 is returned and "errno" is set appropriately. + * int + * On success,the number of section structures written is returned; + * on error, -1 is returned and "errno" is set appropriately. * */ /* ARGSUSED */ int fru_get_sections(container_hdl_t container, section_t *section, int maxsec, - door_cred_t *cred) + door_cred_t *cred) { int device_fd; int retrys = 1; @@ -1168,16 +1166,16 @@ fru_get_sections(container_hdl_t container, section_t *section, int maxsec, /* * Description : - * fru_get_num_segments() returns the current number of segments + * fru_get_num_segments() returns the current number of segments * in a section. * * Arguments : * section_hdl_t : section header holding section information. * * Return : - * int - * On success, the number of segments in the argument section is - * returned; on error -1 is returned. + * int + * On success, the number of segments in the argument section is + * returned; on error -1 is returned. */ /* ARGSUSED */ @@ -1284,7 +1282,7 @@ fru_get_segments(section_hdl_t section, segment_t *segment, int maxseg, int fru_add_segment(section_hdl_t section, segment_t *segment, - section_hdl_t *newsection, door_cred_t *cred) + section_hdl_t *newsection, door_cred_t *cred) { int fd; int retval; @@ -1300,7 +1298,7 @@ fru_add_segment(section_hdl_t section, segment_t *segment, hash_obj_t *sec_hash; hash_obj_t *seg_hash; fru_segdesc_t *new_seg_desc; - unsigned char *crcbuf; + unsigned char *crcbuf; section_layout_t sec_layout; segment_layout_t *seg_layout; segment_layout_t *segment_buf; @@ -1560,7 +1558,7 @@ free_segment_hash(handle_t handle, hash_obj_t *sec_hash) int fru_delete_segment(segment_hdl_t segment, section_hdl_t *newsection, - door_cred_t *cred) + door_cred_t *cred) { int num_of_seg; int bufsize; @@ -1712,14 +1710,14 @@ fru_delete_segment(segment_hdl_t segment, section_hdl_t *newsection, /* * Description : - * fru_read_segment() reads the raw contents of a segment. + * fru_read_segment() reads the raw contents of a segment. * * Arguments : segment_hdl_t : segment handle. * void * : buffer containing segment data when function returns. * size_t :number of bytes. * * Return : - * int + * int * On success, the number of bytes read is returned; * * Notes : @@ -2223,8 +2221,8 @@ fru_get_packets(segment_hdl_t segment, packet_t *packet, int maxpackets, * size_t : sizeof the buffer. * * Return : - * int - * On success, the number of bytes copied is returned; On error + * int + * On success, the number of bytes copied is returned; On error * -1 returned. */ @@ -2252,7 +2250,7 @@ fru_get_payload(packet_hdl_t packet, void *buffer, size_t nbytes, /* * Description : - * fru_update_payload() writes the contents of a packet's payload. + * fru_update_payload() writes the contents of a packet's payload. * * Arguments : packet_hdl_t : packet handle. * const void * : data buffer. @@ -2260,7 +2258,7 @@ fru_get_payload(packet_hdl_t packet, void *buffer, size_t nbytes, * packet_hdl_t : new packet handle. * * Return : - * int + * int * On success, 0 is returned; on failure * -1 is returned. */ @@ -2360,22 +2358,22 @@ fru_update_payload(packet_hdl_t packet, const void *data, size_t nbytes, * segment_hdl_t segment * A handle for the segment to which the packet will be appended. * - * packet_t *packet - * On entry, the "tag" component of "packet" specifies the tag - * value for the added packet; the "handle" component is ignored. - * On return, the "handle" component is set to the handle of the - * appended packet. + * packet_t *packet + * On entry, the "tag" component of "packet" specifies the tag + * value for the added packet; the "handle" component is ignored. + * On return, the "handle" component is set to the handle of the + * appended packet. * - * const void *payload - * A pointer to the caller's buffer containing the payload data for - * the appended packet. + * const void *payload + * A pointer to the caller's buffer containing the payload data for + * the appended packet. * - * size_t nbytes - * The size of the caller buffer. + * size_t nbytes + * The size of the caller buffer. * * Return : - * int - * On success, 0 is returned; on error -1 is returned; + * int + * On success, 0 is returned; on error -1 is returned; */ int @@ -2522,7 +2520,7 @@ fru_append_packet(segment_hdl_t segment, packet_t *packet, const void *payload, seg_hash->u.seg_obj->trailer_offset = trailer_offset; seg_hash->u.seg_obj->num_of_packets += 1; - *newsegment = segment; /* return new segment handle */ + *newsegment = segment; /* return new segment handle */ return (0); } else { errno = EAGAIN; @@ -2601,18 +2599,18 @@ free_packet_object(handle_t handle, hash_obj_t *seg_hash) /* * Description : - * fru_delete_packet() deletes a packet from a segment. + * fru_delete_packet() deletes a packet from a segment. * * Arguments : packet_hdl_t : packet number to be deleted. * segment_hdl_t : new segment handler. * * Return : - * int - * On success, 0 is returned; on error, -1. + * int + * On success, 0 is returned; on error, -1. * * NOTES - * Packets are adjacent; thus, deleting a packet requires moving - * succeeding packets to compact the resulting hole. + * Packets are adjacent; thus, deleting a packet requires moving + * succeeding packets to compact the resulting hole. */ int @@ -2666,7 +2664,7 @@ fru_delete_packet(packet_hdl_t packet, segment_hdl_t *newsegment, if (sec_hash->u.sec_obj->section.protection == READ_ONLY_SECTION) { errno = EPERM; - return (-1); /* read-only section */ + return (-1); /* read-only section */ } prev_obj = seg_hash->u.seg_obj->pkt_obj_list; diff --git a/usr/src/cmd/picl/plugins/sun4u/lw8/fruaccess/libfruaccess.c b/usr/src/cmd/picl/plugins/sun4u/lw8/fruaccess/libfruaccess.c index a4fea2bd61..0a2cf07c0c 100644 --- a/usr/src/cmd/picl/plugins/sun4u/lw8/fruaccess/libfruaccess.c +++ b/usr/src/cmd/picl/plugins/sun4u/lw8/fruaccess/libfruaccess.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <errno.h> #include <fcntl.h> @@ -78,7 +76,7 @@ int fru_append_packet(segment_hdl_t segment, packet_t *packet, segment_hdl_t *newsegment, door_cred_t *cred); int fru_delete_packet(packet_hdl_t packet, segment_hdl_t *newsegment, door_cred_t *cred); -int fru_is_data_available(picl_nodehdl_t fru); +int fru_is_data_available(picl_nodehdl_t fru); #define PICL_PROP_SC_HANDLE "SC_handle" #define PICL_PROP_DATA_AVAIL "FRUDataAvailable" @@ -114,19 +112,19 @@ fru_open_container(picl_nodehdl_t fruh) container_hdl_t container_hdl; if (fru_open_dev() == -1) { - return (NULL); + return (0); } - err = ptree_get_propval_by_name(fruh, PICL_PROP_DATA_AVAIL, NULL, NULL); + err = ptree_get_propval_by_name(fruh, PICL_PROP_DATA_AVAIL, NULL, 0); if (err != PICL_SUCCESS) { syslog(LOG_ERR, GETPV, PICL_PROP_DATA_AVAIL, err); - return (NULL); + return (0); } err = ptree_get_propval_by_name(fruh, PICL_PROP_SC_HANDLE, &container_hdl, sizeof (container_hdl_t)); if (err != PICL_SUCCESS) { syslog(LOG_ERR, GETPV, PICL_PROP_SC_HANDLE, err); - return (NULL); + return (0); } return (container_hdl); } diff --git a/usr/src/cmd/picl/plugins/sun4u/lw8/frutree/piclfrutree.c b/usr/src/cmd/picl/plugins/sun4u/lw8/frutree/piclfrutree.c index f4e14aa564..bb0c4d5567 100644 --- a/usr/src/cmd/picl/plugins/sun4u/lw8/frutree/piclfrutree.c +++ b/usr/src/cmd/picl/plugins/sun4u/lw8/frutree/piclfrutree.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This plugin-in creates the FRU Hierarchy for the * SUNW,Netra-T12 platform and manages the environmental sensors @@ -126,7 +124,7 @@ static picld_plugin_reg_t my_reg_info = { #define PICL_PROPVAL_DISABLED "disabled" #define PICL_PROPVAL_UNKNOWN "unknown" #define PICL_PROPVAL_SELF_REGULATING "self-regulating" -#define PICL_PROPVAL_PER_CENT "%" +#define PICL_PROPVAL_PER_CENT "%" #define PICL_PROP_BANK_STATUS "bank-status" /* @@ -297,7 +295,7 @@ static char *hpu_condition_table[] = {"unknown", "okay", "failing", * variables set up in init */ static picl_nodehdl_t frutreeh; -static picl_nodehdl_t sch = NULL; +static picl_nodehdl_t sch = 0; static int init_complete; static int pcix_io = 0; @@ -746,7 +744,7 @@ add_fru_node(picl_nodehdl_t parh, sgfrunode_t *sgfrunode, * if sgfrunode already there, then just carry on own the tree */ childh = find_child_by_name(parh, nodename); - if (childh != NULL) { + if (childh != 0) { /* * for frus other than dimms and ecaches, update environmental * sensors and board status if necessary @@ -807,7 +805,7 @@ add_fru_node(picl_nodehdl_t parh, sgfrunode_t *sgfrunode, * a dr event - ie post-initialisation */ if (init_complete) - post_frudr_event(PICL_FRU_ADDED, parh, NULL); + post_frudr_event(PICL_FRU_ADDED, parh, 0); /* * Create empty Devices table - we'll add lines to it as we go along @@ -941,7 +939,7 @@ add_location_node(picl_nodehdl_t parh, sgfrunode_t *sgfrunode, * if node already there, then just carry on down the tree */ childh = find_child_by_name(parh, labelp); - if (childh != NULL) { + if (childh != 0) { *childp = childh; return (PICL_SUCCESS); } @@ -1330,7 +1328,7 @@ add_intermediate_nodes(picl_nodehdl_t *nodep, char *labelp, * created) */ intermediate = find_child_by_name(*nodep, labelp); - if (intermediate == NULL) { + if (intermediate == 0) { intermediate = *nodep; err = add_intermediate_location(&intermediate, labelp, slot_name); @@ -1344,7 +1342,7 @@ add_intermediate_nodes(picl_nodehdl_t *nodep, char *labelp, * created) */ intermediate2 = find_child_by_name(intermediate, labelp); - if (intermediate2 == NULL) { + if (intermediate2 == 0) { /* * need to create intermediate fru node node */ @@ -1436,19 +1434,19 @@ find_child_by_name(picl_nodehdl_t parh, char *name) err = ptree_get_propval_by_name(parh, PICL_PROP_CHILD, &nodeh, sizeof (picl_nodehdl_t)); if (err != PICL_SUCCESS) - return (NULL); + return (0); for (;;) { err = ptree_get_propval_by_name(nodeh, PICL_PROP_NAME, nodename, sizeof (nodename)); if (err != PICL_SUCCESS) - return (NULL); + return (0); if (strcmp(name, nodename) == 0) { return (nodeh); } err = ptree_get_propval_by_name(nodeh, PICL_PROP_PEER, &nodeh, sizeof (picl_nodehdl_t)); if (err != PICL_SUCCESS) - return (NULL); + return (0); } } @@ -1457,7 +1455,7 @@ create_dimm_references(picl_nodehdl_t parh, int dimm_id, picl_nodehdl_t nodeh, picl_prophdl_t tblhdl) { int err; - picl_nodehdl_t memctlhdl = NULL; + picl_nodehdl_t memctlhdl = 0; picl_nodehdl_t memgrphdl; picl_nodehdl_t memhdl; char name[MAXPATHLEN]; @@ -1662,8 +1660,8 @@ create_cpu_references(char *pname, picl_nodehdl_t nodeh, picl_prophdl_t tblhdl) err = ptree_get_prop_by_name(cpuhdl1, PICL_REFPROP_FRU_PARENT, &prophdl); if (err != PICL_SUCCESS) { - err = add_prop_ref(cpuhdl1, nodeh, - PICL_REFPROP_FRU_PARENT); + err = add_prop_ref(cpuhdl1, nodeh, + PICL_REFPROP_FRU_PARENT); if (err != PICL_SUCCESS) return (err); err = create_table_entry(tblhdl, cpuhdl1, @@ -2024,19 +2022,19 @@ frudr_completion_handler(char *ename, void *earg, size_t size) * now frudata has been notified that the node is to be * removed, we can actually remove it */ - fruh = NULL; + fruh = 0; (void) nvlist_lookup_uint64(earg, PICLEVENTARG_FRUHANDLE, &fruh); - if (fruh != NULL) { + if (fruh != 0) { (void) remove_subtree(fruh); /* * Now repopulate the frutree with current data. */ - parh = NULL; + parh = 0; (void) nvlist_lookup_uint64(earg, PICLEVENTARG_PARENTHANDLE, &parh); - if (parh != NULL) { + if (parh != 0) { frudr_add_subtree(parh); } } @@ -2058,7 +2056,7 @@ post_frudr_event(char *ename, picl_nodehdl_t parenth, picl_nodehdl_t fruh) ev_name = strdup(ename); if (ev_name == NULL) return; - if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, NULL)) { + if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, 0)) { free(ev_name); return; } @@ -2164,7 +2162,7 @@ frudr_evhandler(const char *ename, const void *earg, size_t size, void *cookie) if (strcmp(ename, PICLEVENT_DR_AP_STATE_CHANGE) != 0) return; - if (nvlist_unpack((char *)earg, size, &nvlp, NULL)) + if (nvlist_unpack((char *)earg, size, &nvlp, 0)) return; if (nvlist_lookup_string(nvlp, PICLEVENTARG_DATA_TYPE, &dtype)) { @@ -2366,7 +2364,7 @@ frumemcfg_evhandler(const char *ename, const void *earg, size_t size, /* * find corresponding frutree dimm nodes */ - if (nvlist_unpack((char *)earg, size, &nvlp, NULL)) + if (nvlist_unpack((char *)earg, size, &nvlp, 0)) return; if (nvlist_lookup_uint64(nvlp, PICLEVENTARG_NODEHANDLE, &nodeh)) { nvlist_free(nvlp); @@ -2574,8 +2572,8 @@ next_bank: */ static int add_sensor_node(picl_nodehdl_t fruhdl, picl_nodehdl_t lochdl, char *nodename, - char *class, char *prop_class, picl_prophdl_t tblhdl, - picl_nodehdl_t *sensorhdlp) + char *class, char *prop_class, picl_prophdl_t tblhdl, + picl_nodehdl_t *sensorhdlp) { int err; @@ -2597,7 +2595,7 @@ add_sensor_node(picl_nodehdl_t fruhdl, picl_nodehdl_t lochdl, char *nodename, if (err != PICL_SUCCESS) return (err); - if (fruhdl != NULL) { + if (fruhdl != 0) { err = add_prop_ref(*sensorhdlp, fruhdl, PICL_REFPROP_FRU_PARENT); } else { @@ -3226,7 +3224,7 @@ add_env_nodes(picl_nodehdl_t nodeh, char *nodename, picl_prophdl_t tblhdl) * check if sensor node has already been created */ sprintf_buf3(buf, "%s_%s", nodename, id); - if (find_child_by_name(sch, buf) != NULL) + if (find_child_by_name(sch, buf) != 0) continue; if (env->sd_id.id.sensor_type == SG_SENSOR_TYPE_COOLING) { @@ -3267,7 +3265,7 @@ add_env_nodes(picl_nodehdl_t nodeh, char *nodename, picl_prophdl_t tblhdl) childh = nodeh; tblhdl2 = tblhdl; } - err = add_sensor_node(childh, NULL, buf, + err = add_sensor_node(childh, 0, buf, hpu_sensor_class_table[env->sd_id.id.sensor_type], hpu_sensor_prop_table[env->sd_id.id.sensor_type], tblhdl2, &sensorhdl); @@ -3627,10 +3625,10 @@ add_led_nodes(picl_nodehdl_t nodeh, char *name, int position, if (position != lom_get_led.position) continue; if (position == LOM_LED_POSITION_LOCATION) { - err = add_sensor_node(NULL, nodeh, buf, PICL_CLASS_LED, + err = add_sensor_node(0, nodeh, buf, PICL_CLASS_LED, PICL_PROP_STATE, tblhdl, &sensorhdl); } else { - err = add_sensor_node(nodeh, NULL, buf, PICL_CLASS_LED, + err = add_sensor_node(nodeh, 0, buf, PICL_CLASS_LED, PICL_PROP_STATE, tblhdl, &sensorhdl); } if (err != PICL_SUCCESS) { @@ -3863,7 +3861,7 @@ update_disk_node(struct lw8_disk *diskp) diskndh = find_child_by_name(slotndh, fruname); err = ptree_get_node_by_path(diskp->d_plat_path, &devhdl); if (err == PICL_SUCCESS) { - if (diskndh != NULL) + if (diskndh != 0) return; err = ptree_create_and_add_node(slotndh, fruname, PICL_CLASS_FRU, &diskndh); @@ -3881,7 +3879,7 @@ update_disk_node(struct lw8_disk *diskp) if (err != PICL_SUCCESS) return; } else { - if (diskndh == NULL) + if (diskndh == 0) return; err = ptree_delete_node(diskndh); if (err != PICL_SUCCESS) diff --git a/usr/src/cmd/picl/plugins/sun4u/mpxu/frudr/piclfrudr.c b/usr/src/cmd/picl/plugins/sun4u/mpxu/frudr/piclfrudr.c index 28adb31207..513f3d4ad4 100644 --- a/usr/src/cmd/picl/plugins/sun4u/mpxu/frudr/piclfrudr.c +++ b/usr/src/cmd/picl/plugins/sun4u/mpxu/frudr/piclfrudr.c @@ -894,19 +894,19 @@ find_child_by_name(picl_nodehdl_t parh, char *name) err = ptree_get_propval_by_name(parh, PICL_PROP_CHILD, &nodeh, sizeof (picl_nodehdl_t)); if (err != PICL_SUCCESS) - return (NULL); + return (0); for (;;) { err = ptree_get_propval_by_name(nodeh, PICL_PROP_NAME, nodename, sizeof (nodename)); if (err != PICL_SUCCESS) - return (NULL); + return (0); if (strcmp(name, nodename) == 0) { return (nodeh); } err = ptree_get_propval_by_name(nodeh, PICL_PROP_PEER, &nodeh, sizeof (picl_nodehdl_t)); if (err != PICL_SUCCESS) - return (NULL); + return (0); } } @@ -1241,7 +1241,7 @@ frudr_completion_handler(char *ename, void *earg, size_t size) { picl_nodehdl_t fruh; picl_nodehdl_t parh; - picl_nodehdl_t peerh = NULL; + picl_nodehdl_t peerh = 0; char nodename[PICL_PROPNAMELEN_MAX] = { '\0' }; int err; @@ -1250,10 +1250,10 @@ frudr_completion_handler(char *ename, void *earg, size_t size) * now frudata has been notified that the node is to be * removed, we can actually remove it */ - fruh = NULL; + fruh = 0; (void) nvlist_lookup_uint64(earg, PICLEVENTARG_FRUHANDLE, &fruh); - if (fruh != NULL) { + if (fruh != 0) { (void) ptree_get_propval_by_name(fruh, PICL_PROP_PEER, &peerh, sizeof (peerh)); @@ -1301,7 +1301,7 @@ frudr_completion_handler(char *ename, void *earg, size_t size) if ((sys_platform == PLAT_CHALUPA19) && (strncmp(nodename, FT_NAME, FT_NAME_LEN) == 0) && - (peerh != NULL)) { + (peerh != 0)) { /* * On Netra-440 platforms, a fan tray * may contain 2 fans (F0 and F1) but @@ -1337,7 +1337,7 @@ post_frudr_event(char *ename, picl_nodehdl_t parenth, picl_nodehdl_t fruh) ev_name = strdup(ename); if (ev_name == NULL) return; - if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, NULL)) { + if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, 0)) { free(ev_name); return; } @@ -1488,7 +1488,7 @@ frudr_evhandler(const char *ename, const void *earg, size_t size, void *cookie) return; } - if (nvlist_unpack((char *)earg, size, &nvlp, NULL)) { + if (nvlist_unpack((char *)earg, size, &nvlp, 0)) { return; } @@ -1579,7 +1579,7 @@ frudr_evhandler(const char *ename, const void *earg, size_t size, void *cookie) /* * fru was there - but has gone away */ - post_frudr_event(PICL_FRU_REMOVED, NULL, fruh); + post_frudr_event(PICL_FRU_REMOVED, 0, fruh); } } else if (rmc_flag) { /* @@ -1589,7 +1589,7 @@ frudr_evhandler(const char *ename, const void *earg, size_t size, void *cookie) */ if (ptree_get_propval_by_name(locnodeh, PICL_PROP_CHILD, &fruh, sizeof (picl_nodehdl_t)) != PICL_SUCCESS) { - fruh = NULL; + fruh = 0; } post_frudr_event(PICL_FRU_ADDED, locnodeh, fruh); } else { @@ -1598,7 +1598,7 @@ frudr_evhandler(const char *ename, const void *earg, size_t size, void *cookie) * if node already there, then just return */ childh = find_child_by_name(locnodeh, fru_name); - if (childh != NULL) { + if (childh != 0) { nvlist_free(nvlp); return; } @@ -1641,7 +1641,7 @@ frudr_evhandler(const char *ename, const void *earg, size_t size, void *cookie) /* * now post event */ - post_frudr_event(PICL_FRU_ADDED, locnodeh, NULL); + post_frudr_event(PICL_FRU_ADDED, locnodeh, 0); } nvlist_free(nvlp); } @@ -1752,7 +1752,7 @@ frutree_evhandler(const char *ename, const void *earg, size_t size, if (strcmp(ename, PICLEVENT_SYSEVENT_DEVICE_ADDED) != 0) return; - if (nvlist_unpack((char *)earg, size, &nvlp, NULL)) + if (nvlist_unpack((char *)earg, size, &nvlp, 0)) return; if (nvlist_lookup_string(nvlp, PICLEVENTARG_DATA_TYPE, &dtype)) { @@ -1894,7 +1894,7 @@ set_led(char *name, char *ptr, char *value) /* * if no fru node, then turn led off */ - if (find_child_by_name(locnodeh, DISK_FRU_NAME) != NULL) + if (find_child_by_name(locnodeh, DISK_FRU_NAME) != 0) value_ptr = value; else value_ptr = PICL_PROPVAL_OFF; @@ -2344,7 +2344,7 @@ update_disk_node(char *fruname, char *devpath) return; } diskndh = find_child_by_name(slotndh, DISK_FRU_NAME); - if (diskndh == NULL) { + if (diskndh == 0) { return; } err = ptree_get_node_by_path(devpath, &devhdl); @@ -2491,16 +2491,14 @@ check_raid(int target) static void * disk_leds_thread(void *args) { - int c; - int i; + int c; + int i; char **disk_dev; int fd; devctl_hdl_t dhdl; - int n_disks = 0, - do_raid = 0, - err = 0; + int n_disks = 0, do_raid = 0, err = 0; uint_t statep = 0; static char *mpxu_devs[] = { diff --git a/usr/src/cmd/picl/plugins/sun4u/taco/envd/piclenvd.c b/usr/src/cmd/picl/plugins/sun4u/taco/envd/piclenvd.c index 538e156510..8ca5de7a7e 100644 --- a/usr/src/cmd/picl/plugins/sun4u/taco/envd/piclenvd.c +++ b/usr/src/cmd/picl/plugins/sun4u/taco/envd/piclenvd.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file contains the environmental PICL plug-in module. */ @@ -233,15 +231,15 @@ static int get_tach(ptree_rarg_t *parg, void *buf); static int set_tach(ptree_warg_t *parg, const void *buf); static int shutdown_override = 0; -static int sensor_poll_interval = SENSORPOLL_INTERVAL; +static int sensor_poll_interval = SENSORPOLL_INTERVAL; static int warning_interval = WARNING_INTERVAL; -static int shutdown_interval = SHUTDOWN_INTERVAL; +static int shutdown_interval = SHUTDOWN_INTERVAL; static int ovtemp_monitor = 1; /* enabled */ static int pm_monitor = 1; /* enabled */ static int mon_fanstat = 1; /* enabled */ -static int hwm_mode; -static int hwm_tach_enable; +static int hwm_mode; +static int hwm_tach_enable; static char shutdown_cmd[] = SHUTDOWN_CMD; env_tuneable_t tuneables[] = { @@ -901,7 +899,7 @@ envd_setup_sensors(void) */ if (ioctl(sensorp->fd, ADM1031_GET_TEMP_MIN_RANGE, - &tmin) != -1) { + &tmin) != -1) { sensorp->tmin = TMIN(tmin); } else { sensorp->tmin = -1; @@ -1006,13 +1004,13 @@ updateadm_ranges(char *name, uchar_t cur_lpstate) if (sysfd == -1) { if (env_debug) envd_log(LOG_ERR, ENV_ADM_OPEN_FAIL, hwm_devs[sys_id], - errno, strerror(errno)); + errno, strerror(errno)); return; } /* Read ADM default value only for the first time */ if (tsave == 0) { if (ioctl(sensorp->fd, ADM1031_GET_TEMP_MIN_RANGE, - &tsave) == -1) { + &tsave) == -1) { if (env_debug) envd_log(LOG_ERR, "read tminrange ioctl failed"); @@ -1038,7 +1036,7 @@ updateadm_ranges(char *name, uchar_t cur_lpstate) * ADM 1031 Tmin/Trange register need to be reprogrammed. */ tdata = ((fanctl->fan_ctl_pairs[cur_lpstate].tMin / TMIN_UNITS) - << TMIN_SHIFT); + << TMIN_SHIFT); /* Need to pack tRange in ADM bits 2:0 */ switch (fanctl->fan_ctl_pairs[cur_lpstate].tRange) { case 5: @@ -1112,13 +1110,13 @@ pmthr(void *args) do { if (env_debug) { envd_log(LOG_INFO, - "pmstate event:0x%x flags:%x comp:%d " - "oldval:%d newval:%d path:%s\n", - pmstate.event, pmstate.flags, - pmstate.component, - pmstate.old_level, - pmstate.new_level, - pmstate.physpath); + "pmstate event:0x%x flags:%x comp:%d " + "oldval:%d newval:%d path:%s\n", + pmstate.event, pmstate.flags, + pmstate.component, + pmstate.old_level, + pmstate.new_level, + pmstate.physpath); } cur_lpstate = (pmstate.flags & PSC_ALL_LOWEST) ? 1 : 0; @@ -1149,11 +1147,11 @@ pmthr(void *args) * * FAN ON * Tmin - * ------------------------------------------- + * ------------------------------------------- * - * FAN ON/OFF + * FAN ON/OFF * - * -------------------------------------------- + * -------------------------------------------- * Tmin - Hysterisis * FAN OFF * @@ -1303,13 +1301,13 @@ handle_overtemp_interrupt(int hwm_id) if (env_debug) envd_log(LOG_ERR, - "sensor name %s, cur temp %d, " - "HW %d LW %d SD %d LS %d\n", - sensorp->name, temp, - sensorp->es_ptr->high_warning, - (int)sensorp->es_ptr->low_warning, - sensorp->es_ptr->high_shutdown, - (int)sensorp->es_ptr->low_shutdown); + "sensor name %s, cur temp %d, " + "HW %d LW %d SD %d LS %d\n", + sensorp->name, temp, + sensorp->es_ptr->high_warning, + (int)sensorp->es_ptr->low_warning, + sensorp->es_ptr->high_shutdown, + (int)sensorp->es_ptr->low_shutdown); if (TEMP_IN_WARNING_RANGE(sensorp->cur_temp, sensorp)) { /* @@ -1484,7 +1482,7 @@ envd_setup(void) * at least one sensor. */ if (envd_setup_sensors() <= 0) { - return (NULL); + return (0); } /* diff --git a/usr/src/cmd/picl/plugins/sun4u/taco/envd/piclenvsetup.c b/usr/src/cmd/picl/plugins/sun4u/taco/envd/piclenvsetup.c index 5310b2440b..df9bf69684 100644 --- a/usr/src/cmd/picl/plugins/sun4u/taco/envd/piclenvsetup.c +++ b/usr/src/cmd/picl/plugins/sun4u/taco/envd/piclenvsetup.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file contains code for setting up environmental related nodes * and properties in the PICL tree. @@ -87,15 +85,15 @@ typedef struct { static sensor_node_t sensor_nodes[] = { {"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c", SENSOR_CPU_DIE, NULL, - NULL, NULL, NULL}, + 0, 0, 0}, {"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c", SENSOR_INT_AMB, NULL, - NULL, NULL, NULL}, + 0, 0, 0}, {"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c", SENSOR_SYS_IN, NULL, - NULL, NULL, NULL} + 0, 0, 0} }; #define NSENSORS (sizeof (sensor_nodes)/sizeof (sensor_nodes[0])) @@ -106,7 +104,7 @@ static sensor_node_t sensor_nodes[] = { typedef struct { char *parent_path; /* parent node path */ char *fan_name; /* fan name */ - env_fan_t *fanp; /* fan information */ + env_fan_t *fanp; /* fan information */ char *speed_unit; /* speed unit string */ picl_nodehdl_t nodeh; /* "fan" node handle */ picl_prophdl_t proph; /* "Speed" property handle */ @@ -118,13 +116,13 @@ typedef struct { */ static fan_node_t fan_nodes[] = { {"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c", - ENV_CPU_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL}, + ENV_CPU_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0}, {"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c", - ENV_SYSTEM_INTAKE_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL}, + ENV_SYSTEM_INTAKE_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0}, {"/platform/pci@1e,600000/isa@7/i2c@0,320/hardware-monitor@0,5c", - ENV_SYSTEM_OUT_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, NULL, NULL} + ENV_SYSTEM_OUT_FAN, NULL, PROP_FAN_SPEED_UNIT_VALUE, 0, 0} }; #define NFANS (sizeof (fan_nodes)/sizeof (fan_nodes[0])) @@ -141,7 +139,7 @@ static void delete_fan_nodes_and_props(void); static int get_current_temp(ptree_rarg_t *parg, void *buf) { - tempr_t temp; + tempr_t temp; picl_prophdl_t proph; sensor_node_t *snodep; int i; @@ -427,12 +425,12 @@ delete_sensor_nodes_and_props(void) for (i = 0; i < NSENSORS; ++i) { snodep = &sensor_nodes[i]; - if (snodep->nodeh != NULL) { + if (snodep->nodeh != 0) { /* delete node and all properties under it */ (void) ptree_delete_node(snodep->nodeh); (void) ptree_destroy_node(snodep->nodeh); - snodep->nodeh = NULL; - snodep->proph = NULL; + snodep->nodeh = 0; + snodep->proph = 0; } } } @@ -553,10 +551,10 @@ delete_fan_nodes_and_props(void) for (i = 0; i < NFANS; ++i) { fnodep = &fan_nodes[i]; - if (fnodep->nodeh != NULL) { + if (fnodep->nodeh != 0) { (void) ptree_delete_node(fnodep->nodeh); (void) ptree_destroy_node(fnodep->nodeh); - fnodep->nodeh = NULL; + fnodep->nodeh = 0; } } } @@ -723,9 +721,9 @@ env_picl_setup(void) for (i = 0; i < NSENSORS; ++i) { snodep = &sensor_nodes[i]; snodep->sensorp = sensor_lookup(snodep->sensor_name); - snodep->nodeh = NULL; - snodep->proph = NULL; - snodep->target_proph = NULL; + snodep->nodeh = 0; + snodep->proph = 0; + snodep->target_proph = 0; } /* @@ -734,8 +732,8 @@ env_picl_setup(void) for (i = 0; i < NFANS; ++i) { fnodep = &fan_nodes[i]; fnodep->fanp = fan_lookup(fnodep->fan_name); - fnodep->nodeh = NULL; - fnodep->proph = NULL; + fnodep->nodeh = 0; + fnodep->proph = 0; } /* diff --git a/usr/src/cmd/picl/plugins/sun4v/mdesc/mdescplugin.c b/usr/src/cmd/picl/plugins/sun4v/mdesc/mdescplugin.c index f02c7af356..08c203a7f7 100644 --- a/usr/src/cmd/picl/plugins/sun4v/mdesc/mdescplugin.c +++ b/usr/src/cmd/picl/plugins/sun4v/mdesc/mdescplugin.c @@ -112,7 +112,7 @@ dr_handler(const char *ename, const void *earg, size_t size, void *cookie) return; } - if (nvlist_unpack((char *)earg, size, &nvlp, NULL)) { + if (nvlist_unpack((char *)earg, size, &nvlp, 0)) { return; } @@ -176,13 +176,13 @@ dsc_handler(const char *ename, const void *earg, size_t size, void *cookie) * retrieve the device's physical path from the event arg * and determine which disk (if any) we are working with */ - if (nvlist_unpack((char *)earg, size, &nvlp, NULL)) + if (nvlist_unpack((char *)earg, size, &nvlp, 0)) return; if (nvlist_lookup_string(nvlp, "devfs-path", &path)) return; lookup.path = strdup(path); - lookup.disk = NULL; + lookup.disk = 0; lookup.result = DISK_NOT_FOUND; status = ptree_walk_tree_by_class(root_node, "disk", (void *)&lookup, @@ -218,7 +218,7 @@ signal_devtree(void) size_t nvl_size; int status; - if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, NULL) != 0) + if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, 0) != 0) return; /* diff --git a/usr/src/cmd/picl/plugins/sun4v/piclsbl/piclsbl.c b/usr/src/cmd/picl/plugins/sun4v/piclsbl/piclsbl.c index e70ea55d54..4d4e3233f4 100644 --- a/usr/src/cmd/picl/plugins/sun4v/piclsbl/piclsbl.c +++ b/usr/src/cmd/picl/plugins/sun4v/piclsbl/piclsbl.c @@ -192,12 +192,12 @@ check_raid(int target) /* * Ontario SBL event handler, subscribed to: - * PICLEVENT_SYSEVENT_DEVICE_ADDED - * PICLEVENT_SYSEVENT_DEVICE_REMOVED + * PICLEVENT_SYSEVENT_DEVICE_ADDED + * PICLEVENT_SYSEVENT_DEVICE_REMOVED */ static void piclsbl_handler(const char *ename, const void *earg, size_t size, - void *cookie) + void *cookie) { char *devfs_path; char hdd_location[PICL_PROPNAMELEN_MAX]; @@ -236,7 +236,7 @@ piclsbl_handler(const char *ename, const void *earg, size_t size, /* * retrieve the device's physical path from the event payload */ - if (nvlist_unpack((char *)earg, size, &nvlp, NULL)) + if (nvlist_unpack((char *)earg, size, &nvlp, 0)) goto sbl_return; if (nvlist_lookup_string(nvlp, "devfs-path", &devfs_path)) goto sbl_return; @@ -248,7 +248,7 @@ piclsbl_handler(const char *ename, const void *earg, size_t size, * otherwise, return as it is not one of our disks. */ lookup.path = strdup(devfs_path); - lookup.disk = NULL; + lookup.disk = 0; lookup.result = DISK_NOT_FOUND; /* first, find the disk */ @@ -315,7 +315,7 @@ piclsbl_handler(const char *ename, const void *earg, size_t size, * populate the message for libpcp */ send_msg.msg_type = PCP_SBL_CONTROL; - send_msg.sub_type = NULL; + send_msg.sub_type = 0; send_msg.msg_len = sizeof (pcp_sbl_req_t); send_msg.msg_data = (uint8_t *)req_ptr; @@ -387,7 +387,7 @@ piclsbl_init(void) return; /* retrieve the root node for lookups in the event handler */ - if ((ptree_get_root(&root_node)) != NULL) + if ((ptree_get_root(&root_node)) != 0) return; /* load libpcp */ diff --git a/usr/src/cmd/picl/plugins/sun4v/pri/priplugin.c b/usr/src/cmd/picl/plugins/sun4v/pri/priplugin.c index 7ef1bad438..13bf878af8 100644 --- a/usr/src/cmd/picl/plugins/sun4v/pri/priplugin.c +++ b/usr/src/cmd/picl/plugins/sun4v/pri/priplugin.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <pri.h> #include "priplugin.h" @@ -126,14 +124,14 @@ priplugin_init(void) (void) mutex_init(&rebuild_lock, USYNC_THREAD, NULL); (void) cond_init(&rebuild_cv, USYNC_THREAD, NULL); - if ((status = thr_create(NULL, NULL, pri_worker_thread, NULL, THR_BOUND, + if ((status = thr_create(NULL, 0, pri_worker_thread, NULL, THR_BOUND, &pri_worker_thread_id)) < 0) { pri_debug(LOG_NOTICE, "priplugin: can't create worker thread: " "%d\n", status); all_thr_exit = B_TRUE; (void) mutex_destroy(&rebuild_lock); (void) cond_destroy(&rebuild_cv); - } else if ((status = thr_create(NULL, NULL, pri_reader_thread, NULL, + } else if ((status = thr_create(NULL, 0, pri_reader_thread, NULL, THR_BOUND, &pri_reader_thread_id)) < 0) { pri_debug(LOG_NOTICE, "priplugin: can't create reader thread: " "%d\n", status); diff --git a/usr/src/cmd/picl/plugins/sun4v/snmp/snmpplugin.c b/usr/src/cmd/picl/plugins/sun4v/snmp/snmpplugin.c index 62e97e1a00..767c7f7514 100644 --- a/usr/src/cmd/picl/plugins/sun4v/snmp/snmpplugin.c +++ b/usr/src/cmd/picl/plugins/sun4v/snmp/snmpplugin.c @@ -332,7 +332,7 @@ snmpplugin_init(void) * Create the tree-builder thread and let it take over */ LOGPRINTF("Tree-builder thread being created.\n"); - if ((ret = thr_create(NULL, NULL, tree_builder, NULL, + if ((ret = thr_create(NULL, 0, tree_builder, NULL, THR_BOUND, &tree_builder_thr_id)) < 0) { log_msg(LOG_ERR, SNMPP_CANT_CREATE_TREE_BUILDER, ret); snmp_fini(hdl); @@ -356,7 +356,7 @@ snmpplugin_init(void) cache_refresh_thr_exit = B_FALSE; LOGPRINTF("Cache refresher thread being created.\n"); - if (thr_create(NULL, NULL, cache_refresher, NULL, THR_BOUND, + if (thr_create(NULL, 0, cache_refresher, NULL, THR_BOUND, &cache_refresh_thr_id) < 0) { (void) cond_destroy(&cache_refresh_cv); (void) mutex_destroy(&cache_refresh_lock); @@ -489,8 +489,8 @@ tree_builder(void *arg) return (NULL); } - old_physplat_root = NULL; - physplat_root = NULL; + old_physplat_root = 0; + physplat_root = 0; LOGPRINTF("tree_builder: getting root node\n"); if ((ret = ptree_get_root(&root_node)) != PICL_SUCCESS) { @@ -514,7 +514,7 @@ tree_builder(void *arg) return ((void *)-3); } - if (rv == PICL_SUCCESS && old_physplat_root != NULL) { + if (rv == PICL_SUCCESS && old_physplat_root != 0) { LOGPRINTF("tree_builder: destroying existing nodes\n"); ptree_delete_node(old_physplat_root); ptree_destroy_node(old_physplat_root); @@ -705,7 +705,7 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p) /* * If we've already created this picl node, just return it */ - if ((nodeh = lookup_nodeh(row)) != NULL) + if ((nodeh = lookup_nodeh(row)) != 0) return (nodeh); /* @@ -715,13 +715,13 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p) */ ret = snmp_get_int(hdl, OID_entPhysicalContainedIn, row, &parent_row, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) if (ret < 0 || parent_row <= 0) parenth = subtree_root; else { parenth = make_node(subtree_root, parent_row, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) - if (parenth == NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) + if (parenth == 0) parenth = subtree_root; } @@ -732,49 +732,49 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p) */ ret = snmp_get_str(hdl, OID_entPhysicalName, row, &phys_name, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) if (ret < 0 || phys_name == NULL) { log_msg(LOG_WARNING, SNMPP_NO_ENTPHYSNAME, row); - return (NULL); + return (0); } node_name = basename(phys_name); ret = snmp_get_int(hdl, OID_entPhysicalClass, row, &ent_physclass, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) if (ret < 0) { log_msg(LOG_WARNING, SNMPP_CANT_FETCH_OBJECT_VAL, *snmp_syserr_p ? *snmp_syserr_p : ret, OID_entPhysicalClass, row); free(phys_name); - return (NULL); + return (0); } switch (ent_physclass) { case SPC_OTHER: ret = snmp_get_int(hdl, OID_sunPlatPhysicalClass, row, &sunplat_physclass, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) if (ret < 0) { log_msg(LOG_WARNING, SNMPP_CANT_FETCH_OBJECT_VAL, *snmp_syserr_p ? *snmp_syserr_p : ret, OID_sunPlatPhysicalClass, row); free(phys_name); - return (NULL); + return (0); } if (sunplat_physclass == SSPC_ALARM) { ret = snmp_get_int(hdl, OID_sunPlatAlarmType, row, &alarm_type, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) if (ret < 0) { log_msg(LOG_WARNING, SNMPP_CANT_FETCH_OBJECT_VAL, *snmp_syserr_p ? *snmp_syserr_p : ret, OID_sunPlatAlarmType, row); free(phys_name); - return (NULL); + return (0); } if (alarm_type == SSAT_VISIBLE) { @@ -785,14 +785,14 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p) add_prop(nodeh, &proph, node_name, row, PP_STATE, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) } else { ADD_NODE(PICL_CLASS_OTHER) } add_prop(nodeh, &proph, node_name, row, PP_OPSTATUS, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) break; case SPC_UNKNOWN: @@ -803,14 +803,14 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p) ADD_NODE(PICL_CLASS_CHASSIS) add_prop(nodeh, &proph, node_name, row, PP_OPSTATUS, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) break; case SPC_BACKPLANE: ADD_NODE(PICL_CLASS_BACKPLANE) add_prop(nodeh, &proph, node_name, row, PP_OPSTATUS, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) break; case SPC_CONTAINER: @@ -818,66 +818,66 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p) add_prop(nodeh, &proph, node_name, row, PP_OPSTATUS, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) add_prop(nodeh, &proph, node_name, row, PP_SLOT_TYPE, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) break; case SPC_POWERSUPPLY: ret = snmp_get_int(hdl, OID_sunPlatPowerSupplyClass, row, &ps_class, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) if (ret < 0) { log_msg(LOG_WARNING, SNMPP_CANT_FETCH_OBJECT_VAL, *snmp_syserr_p ? *snmp_syserr_p : ret, OID_sunPlatPowerSupplyClass, row); free(phys_name); - return (NULL); + return (0); } if (ps_class == SSPSC_BATTERY) { ADD_NODE(PICL_CLASS_BATTERY) add_prop(nodeh, &proph, node_name, row, PP_BATT_STATUS, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) } else { ADD_NODE(PICL_CLASS_POWERSUPPLY) } add_prop(nodeh, &proph, node_name, row, PP_OPSTATUS, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) break; case SPC_FAN: ADD_NODE(PICL_CLASS_FAN) add_prop(nodeh, &proph, node_name, row, PP_OPSTATUS, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) break; case SPC_SENSOR: ret = snmp_get_int(hdl, OID_sunPlatSensorClass, row, &sensor_class, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) if (ret < 0) { log_msg(LOG_WARNING, SNMPP_CANT_FETCH_OBJECT_VAL, *snmp_syserr_p ? *snmp_syserr_p : ret, OID_sunPlatSensorClass, row); free(phys_name); - return (NULL); + return (0); } ret = snmp_get_int(hdl, OID_sunPlatSensorType, row, &sensor_type, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) if (ret < 0) { log_msg(LOG_WARNING, SNMPP_CANT_FETCH_OBJECT_VAL, *snmp_syserr_p ? *snmp_syserr_p : ret, OID_sunPlatSensorType, row); free(phys_name); - return (NULL); + return (0); } if (sensor_class == SSSC_NUMERIC) { @@ -902,26 +902,26 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p) add_prop(nodeh, &proph, node_name, row, PP_SENSOR_VALUE, snmp_syserr_p); } - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) add_prop(nodeh, &proph, node_name, row, PP_OPSTATUS, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) add_prop(nodeh, &proph, node_name, row, PP_BASE_UNITS, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) add_prop(nodeh, &proph, node_name, row, PP_EXPONENT, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) add_prop(nodeh, &proph, node_name, row, PP_RATE_UNITS, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) add_thresholds(nodeh, row, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) } else if (sensor_class == SSSC_BINARY) { if (sensor_type == SSST_TEMPERATURE) { @@ -940,19 +940,19 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p) add_prop(nodeh, &proph, node_name, row, PP_OPSTATUS, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) add_prop(nodeh, &proph, node_name, row, PP_CONDITION, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) add_prop(nodeh, &proph, node_name, row, PP_EXPECTED, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) } else { log_msg(LOG_ERR, SNMPP_UNSUPP_SENSOR_CLASS, sensor_class, row); - return (NULL); + return (0); } break; @@ -961,15 +961,15 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p) add_prop(nodeh, &proph, node_name, row, PP_OPSTATUS, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) add_prop(nodeh, &proph, node_name, row, PP_REPLACEABLE, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) add_prop(nodeh, &proph, node_name, row, PP_HOTSWAPPABLE, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) break; case SPC_PORT: @@ -984,32 +984,32 @@ make_node(picl_nodehdl_t subtree_root, int row, int *snmp_syserr_p) log_msg(LOG_WARNING, SNMPP_UNKNOWN_ENTPHYSCLASS, ent_physclass, row); free(phys_name); - return (NULL); + return (0); } add_prop(nodeh, &proph, node_name, row, PP_DESCRIPTION, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) add_prop(nodeh, &proph, node_name, row, PP_LABEL, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) add_prop(nodeh, &proph, node_name, row, PP_HW_REVISION, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) add_prop(nodeh, &proph, node_name, row, PP_FW_REVISION, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) add_prop(nodeh, &proph, node_name, row, PP_SERIAL_NUM, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) add_prop(nodeh, &proph, node_name, row, PP_MFG_NAME, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) add_prop(nodeh, &proph, node_name, row, PP_MODEL_NAME, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) add_prop(nodeh, &proph, node_name, row, PP_IS_FRU, snmp_syserr_p); - CHECK_LINKRESET(snmp_syserr_p, NULL) + CHECK_LINKRESET(snmp_syserr_p, 0) free(phys_name); save_nodeh(nodeh, row); @@ -1057,7 +1057,7 @@ static picl_nodehdl_t lookup_nodeh(int row) { if (row >= n_physplat_nodes) - return (NULL); + return (0); return (physplat_nodes[row]); } diff --git a/usr/src/cmd/picl/plugins/sun4v/snmp/snmpplugin.h b/usr/src/cmd/picl/plugins/sun4v/snmp/snmpplugin.h index 8bd7d87db1..6454552b7a 100644 --- a/usr/src/cmd/picl/plugins/sun4v/snmp/snmpplugin.h +++ b/usr/src/cmd/picl/plugins/sun4v/snmp/snmpplugin.h @@ -71,7 +71,7 @@ typedef struct { if (ptree_create_and_add_node(parenth, node_name, cl, \ &nodeh) != PICL_SUCCESS) { \ log_msg(LOG_ERR, SNMPP_ADD_NODE_FAIL, node_name, cl); \ - return (NULL); \ + return (0); \ } \ } diff --git a/usr/src/compat/freebsd/vm/pmap.h b/usr/src/compat/freebsd/vm/pmap.h new file mode 100644 index 0000000000..5958c4b101 --- /dev/null +++ b/usr/src/compat/freebsd/vm/pmap.h @@ -0,0 +1,21 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2014 Pluribus Networks Inc. + */ + +#ifndef _COMPAT_FREEBSD_VM_PMAP_H_ +#define _COMPAT_FREEBSD_VM_PMAP_H_ + +#include <machine/pmap.h> + +#endif /* _COMPAT_FREEBSD_VM_PMAP_H_ */ diff --git a/usr/src/data/zoneinfo/africa b/usr/src/data/zoneinfo/africa index feb6017d95..724744f377 100644 --- a/usr/src/data/zoneinfo/africa +++ b/usr/src/data/zoneinfo/africa @@ -867,19 +867,25 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis # Morocco will be on GMT starting from Sunday, May 5th 2019 at 3am. # The switch to GMT+1 will occur on Sunday, June 9th 2019 at 2am.... # http://fr.le360.ma/societe/voici-la-date-du-retour-a-lheure-legale-au-maroc-188222 -# -# From Paul Eggert (2019-05-20): -# This agrees with our 2018-11-01 guess that the Moroccan government -# would continue the practice of falling back at 03:00 the last Sunday -# before Ramadan, and of springing forward at 02:00 the first Sunday after -# Ramadan, as this has been the practice since 2012. To implement this, -# transition dates for 2019 through 2087 were determined by running the -# following program under GNU Emacs 26.2. -# (let ((islamic-year 1440)) + +# From Semlali Naoufal (2020-04-14): +# Following the announcement by the Moroccan government, the switch to +# GMT time will take place on Sunday, April 19, 2020 from 3 a.m. and +# the return to GMT+1 time will take place on Sunday, May 31, 2020 at 2 a.m.... +# https://maroc-diplomatique.net/maroc-le-retour-a-lheure-gmt-est-prevu-dimanche-prochain/ +# http://aujourdhui.ma/actualite/gmt1-retour-a-lheure-normale-dimanche-prochain-1 +# +# From Paul Eggert (2020-04-14): +# For now, guess that in the future Morocco will fall back at 03:00 +# the last Sunday before Ramadan, and spring forward at 02:00 the +# first Sunday after the day after Ramadan. To implement this, +# transition dates for 2021 through 2087 were determined by running +# the following program under GNU Emacs 26.3. +# (let ((islamic-year 1442)) # (require 'cal-islam) # (while (< islamic-year 1511) # (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year))) -# (b (calendar-islamic-to-absolute (list 10 1 islamic-year))) +# (b (1+ (calendar-islamic-to-absolute (list 10 1 islamic-year)))) # (sunday 0)) # (while (/= sunday (mod (setq a (1- a)) 7))) # (while (/= sunday (mod b 7)) @@ -939,7 +945,7 @@ Rule Morocco 2018 only - Jun 17 2:00 1:00 - Rule Morocco 2019 only - May 5 3:00 -1:00 - Rule Morocco 2019 only - Jun 9 2:00 0 - Rule Morocco 2020 only - Apr 19 3:00 -1:00 - -Rule Morocco 2020 only - May 24 2:00 0 - +Rule Morocco 2020 only - May 31 2:00 0 - Rule Morocco 2021 only - Apr 11 3:00 -1:00 - Rule Morocco 2021 only - May 16 2:00 0 - Rule Morocco 2022 only - Mar 27 3:00 -1:00 - @@ -955,7 +961,7 @@ Rule Morocco 2026 only - Mar 22 2:00 0 - Rule Morocco 2027 only - Feb 7 3:00 -1:00 - Rule Morocco 2027 only - Mar 14 2:00 0 - Rule Morocco 2028 only - Jan 23 3:00 -1:00 - -Rule Morocco 2028 only - Feb 27 2:00 0 - +Rule Morocco 2028 only - Mar 5 2:00 0 - Rule Morocco 2029 only - Jan 14 3:00 -1:00 - Rule Morocco 2029 only - Feb 18 2:00 0 - Rule Morocco 2029 only - Dec 30 3:00 -1:00 - @@ -971,7 +977,7 @@ Rule Morocco 2033 only - Dec 25 2:00 0 - Rule Morocco 2034 only - Nov 5 3:00 -1:00 - Rule Morocco 2034 only - Dec 17 2:00 0 - Rule Morocco 2035 only - Oct 28 3:00 -1:00 - -Rule Morocco 2035 only - Dec 2 2:00 0 - +Rule Morocco 2035 only - Dec 9 2:00 0 - Rule Morocco 2036 only - Oct 19 3:00 -1:00 - Rule Morocco 2036 only - Nov 23 2:00 0 - Rule Morocco 2037 only - Oct 4 3:00 -1:00 - @@ -987,7 +993,7 @@ Rule Morocco 2041 only - Sep 29 2:00 0 - Rule Morocco 2042 only - Aug 10 3:00 -1:00 - Rule Morocco 2042 only - Sep 21 2:00 0 - Rule Morocco 2043 only - Aug 2 3:00 -1:00 - -Rule Morocco 2043 only - Sep 6 2:00 0 - +Rule Morocco 2043 only - Sep 13 2:00 0 - Rule Morocco 2044 only - Jul 24 3:00 -1:00 - Rule Morocco 2044 only - Aug 28 2:00 0 - Rule Morocco 2045 only - Jul 9 3:00 -1:00 - @@ -1003,7 +1009,7 @@ Rule Morocco 2049 only - Jul 4 2:00 0 - Rule Morocco 2050 only - May 15 3:00 -1:00 - Rule Morocco 2050 only - Jun 26 2:00 0 - Rule Morocco 2051 only - May 7 3:00 -1:00 - -Rule Morocco 2051 only - Jun 11 2:00 0 - +Rule Morocco 2051 only - Jun 18 2:00 0 - Rule Morocco 2052 only - Apr 28 3:00 -1:00 - Rule Morocco 2052 only - Jun 2 2:00 0 - Rule Morocco 2053 only - Apr 13 3:00 -1:00 - @@ -1019,7 +1025,7 @@ Rule Morocco 2057 only - Apr 8 2:00 0 - Rule Morocco 2058 only - Feb 17 3:00 -1:00 - Rule Morocco 2058 only - Mar 31 2:00 0 - Rule Morocco 2059 only - Feb 9 3:00 -1:00 - -Rule Morocco 2059 only - Mar 16 2:00 0 - +Rule Morocco 2059 only - Mar 23 2:00 0 - Rule Morocco 2060 only - Feb 1 3:00 -1:00 - Rule Morocco 2060 only - Mar 7 2:00 0 - Rule Morocco 2061 only - Jan 16 3:00 -1:00 - @@ -1029,13 +1035,13 @@ Rule Morocco 2062 only - Feb 12 2:00 0 - Rule Morocco 2062 only - Dec 31 3:00 -1:00 - Rule Morocco 2063 only - Feb 4 2:00 0 - Rule Morocco 2063 only - Dec 16 3:00 -1:00 - -Rule Morocco 2064 only - Jan 20 2:00 0 - +Rule Morocco 2064 only - Jan 27 2:00 0 - Rule Morocco 2064 only - Dec 7 3:00 -1:00 - Rule Morocco 2065 only - Jan 11 2:00 0 - Rule Morocco 2065 only - Nov 22 3:00 -1:00 - Rule Morocco 2066 only - Jan 3 2:00 0 - Rule Morocco 2066 only - Nov 14 3:00 -1:00 - -Rule Morocco 2066 only - Dec 19 2:00 0 - +Rule Morocco 2066 only - Dec 26 2:00 0 - Rule Morocco 2067 only - Nov 6 3:00 -1:00 - Rule Morocco 2067 only - Dec 11 2:00 0 - Rule Morocco 2068 only - Oct 21 3:00 -1:00 - @@ -1045,13 +1051,13 @@ Rule Morocco 2069 only - Nov 17 2:00 0 - Rule Morocco 2070 only - Oct 5 3:00 -1:00 - Rule Morocco 2070 only - Nov 9 2:00 0 - Rule Morocco 2071 only - Sep 20 3:00 -1:00 - -Rule Morocco 2071 only - Oct 25 2:00 0 - +Rule Morocco 2071 only - Nov 1 2:00 0 - Rule Morocco 2072 only - Sep 11 3:00 -1:00 - Rule Morocco 2072 only - Oct 16 2:00 0 - Rule Morocco 2073 only - Aug 27 3:00 -1:00 - Rule Morocco 2073 only - Oct 8 2:00 0 - Rule Morocco 2074 only - Aug 19 3:00 -1:00 - -Rule Morocco 2074 only - Sep 23 2:00 0 - +Rule Morocco 2074 only - Sep 30 2:00 0 - Rule Morocco 2075 only - Aug 11 3:00 -1:00 - Rule Morocco 2075 only - Sep 15 2:00 0 - Rule Morocco 2076 only - Jul 26 3:00 -1:00 - @@ -1061,7 +1067,7 @@ Rule Morocco 2077 only - Aug 22 2:00 0 - Rule Morocco 2078 only - Jul 10 3:00 -1:00 - Rule Morocco 2078 only - Aug 14 2:00 0 - Rule Morocco 2079 only - Jun 25 3:00 -1:00 - -Rule Morocco 2079 only - Jul 30 2:00 0 - +Rule Morocco 2079 only - Aug 6 2:00 0 - Rule Morocco 2080 only - Jun 16 3:00 -1:00 - Rule Morocco 2080 only - Jul 21 2:00 0 - Rule Morocco 2081 only - Jun 1 3:00 -1:00 - @@ -1077,7 +1083,7 @@ Rule Morocco 2085 only - May 27 2:00 0 - Rule Morocco 2086 only - Apr 14 3:00 -1:00 - Rule Morocco 2086 only - May 19 2:00 0 - Rule Morocco 2087 only - Mar 30 3:00 -1:00 - -Rule Morocco 2087 only - May 4 2:00 0 - +Rule Morocco 2087 only - May 11 2:00 0 - # For dates after the somewhat-arbitrary cutoff of 2087, assume that # Morocco will no longer observe DST. At some point this table will # need to be extended, though quite possibly Morocco will change the @@ -1179,7 +1185,7 @@ Link Africa/Maputo Africa/Lusaka # Zambia Rule Namibia 1994 only - Mar 21 0:00 -1:00 WAT Rule Namibia 1994 2017 - Sep Sun>=1 2:00 0 CAT Rule Namibia 1995 2017 - Apr Sun>=1 2:00 -1:00 WAT -# Rearguard section, for parsers that do not support negative DST. +# Rearguard section, for parsers lacking negative DST; see ziguard.awk. #Rule Namibia 1994 only - Mar 21 0:00 0 WAT #Rule Namibia 1994 2017 - Sep Sun>=1 2:00 1:00 CAT #Rule Namibia 1995 2017 - Apr Sun>=1 2:00 0 WAT @@ -1193,7 +1199,7 @@ Zone Africa/Windhoek 1:08:24 - LMT 1892 Feb 8 2:00 - SAST 1990 Mar 21 # independence # Vanguard section, for zic and other parsers that support negative DST. 2:00 Namibia %s -# Rearguard section, for parsers that do not support negative DST. +# Rearguard section, for parsers lacking negative DST; see ziguard.awk. # 2:00 - CAT 1994 Mar 21 0:00 # From Paul Eggert (2017-04-07): # The official date of the 2017 rule change was 2017-10-24. See: diff --git a/usr/src/data/zoneinfo/asia b/usr/src/data/zoneinfo/asia index b29c896e5f..106efad877 100644 --- a/usr/src/data/zoneinfo/asia +++ b/usr/src/data/zoneinfo/asia @@ -286,6 +286,27 @@ Zone Asia/Yangon 6:24:47 - LMT 1880 # or Rangoon # China +# From Phake Nick (2020-04-15): +# According to this news report: +# http://news.sina.com.cn/c/2004-09-01/19524201403.shtml +# on April 11, 1919, newspaper in Shanghai said clocks in Shanghai will spring +# forward for an hour starting from midnight of that Saturday. The report did +# not mention what happened in Shanghai thereafter, but it mentioned that a +# similar trial in Tianjin which ended at October 1st as citizens are told to +# recede the clock on September 30 from 12:00pm to 11:00pm. The trial at +# Tianjin got terminated in 1920. +# +# From Paul Eggert (2020-04-15): +# The Returns of Trade and Trade Reports, page 711, says "Daylight saving was +# given a trial during the year, and from the 12th April to the 1st October +# the clocks were all set one hour ahead of sun time. Though the scheme was +# generally esteemed a success, it was announced early in 1920 that it would +# not be repeated." +# +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Shang 1919 only - Apr 12 24:00 1:00 D +Rule Shang 1919 only - Sep 30 24:00 0 S + # From Paul Eggert (2018-10-02): # The following comes from Table 1 of: # Li Yu. Research on the daylight saving movement in 1940s Shanghai. @@ -294,6 +315,89 @@ Zone Asia/Yangon 6:24:47 - LMT 1880 # or Rangoon # The table lists dates only; I am guessing 00:00 and 24:00 transition times. # Also, the table lists the planned end of DST in 1949, but the corresponding # zone line cuts this off on May 28, when the Communists took power. + +# From Phake Nick (2020-04-15): +# +# For the history of time in Shanghai between 1940-1942, the situation is +# actually slightly more complex than the table [below].... At the time, +# there were three different authorities in Shanghai, including Shanghai +# International Settlement, a settlement established by western countries with +# its own westernized form of government, Shanghai French Concession, similar +# to the international settlement but is controlled by French, and then the +# rest of the city of Shanghai, which have already been controlled by Japanese +# force through a puppet local government (Wang Jingwei regime). It was +# additionally complicated by the circumstances that, according to the 1940s +# Shanghai summer time essay cited in the database, some +# departments/businesses/people in the Shanghai city itself during that time +# period, refused to change their clock and instead only changed their opening +# hours. +# +# For example, as quoted in the article, in 1940, other than the authority +# itself, power, tram, bus companies, cinema, department stores, and other +# public service organizations have all decided to follow the summer time and +# spring forward the clock. On the other hand, the custom office refused to +# spring forward the clock because of worry on mechanical wear to the physical +# clock, postal office refused to spring forward because of disruption to +# business and log-keeping, although they did changed their office hour to +# match rest of the city. So is travel agents, and also weather +# observatory. It is said both time standards had their own supporters in the +# city at the time, those who prefer new time standard would have moved their +# clock while those who prefer the old time standard would keep their clock +# unchange, and there were different clocks that use different time standard +# in the city at the time for people who use different time standard to adjust +# their clock to their preferred time. +# +# a. For the 1940 May 31 spring forward, the essay claim that it was +# coordinared between the international settlement authority and the French +# concession authority and have gathered support from Hong Kong and Xiamen, +# that it would spring forward an hour from May 31 "midnight", and the essay +# claim "Hong Kong government implemented the spring forward in the same time +# on the same date as Shanghai". +# +# b. For the 1940 fall back, it was said that they initially intended to do +# so on September 30 00:59 at night, however they postponed it to October 12 +# after discussion with relevant parties. However schools restored to the +# original schedule ten days earlier. +# +# c. For the 1941 spring forward, it is said to start from March 15 +# "following the previous year's method", and in addition to that the essay +# cited an announcement in 1941 from the Wang regime which said the Special +# City of Shanghai under Wang regime control will follow the DST rule set by +# the Settlements, irrespective of the original DST plan announced by the Wang +# regime for other area under its control(April 1 to September 30). (no idea +# to situation before that announcement) +# +# d. For the 1941 fall back, it was said that the fall back would occurs at +# the end of September (A newspaper headline cited by the essay, published on +# October 1, 1941, have the headlines which said "French Concession would +# rewind to the old clock this morning), but it ultimately didn't happen due +# to disagreement between the international settlement authority and the +# French concession authority, and the fall back ultimately occurred on +# November 1. +# +# e. In 1941 December, Japan have officially started war with the United +# States and the United Kingdom, and in Shanghai they have marched into the +# international settlement, taken over its control +# +# f. For the 1942 spring forward, the essay said that the spring forward +# started on January 31. It said this time the custom office and postal +# department will also change their clocks, unlike before. +# +# g. The essay itself didn't cover any specific changes thereafter until the +# end of the war, it quoted a November 1942 command from the government of the +# Wang regime, which claim the daylight saving time applies year round during +# the war. However, the essay ambiguously said the period is "February 1 to +# September 30", which I don't really understand what is the meaning of such +# period in the context of year round implementation here.. More researches +# might be needed to show exactly what happened during that period of time. + +# From Phake Nick (2020-04-15): +# According to a Japanese tour bus pamphlet in Nanjing area believed to be +# from around year 1941: http://www.tt-museum.jp/tairiku_0280_nan1941.html , +# the schedule listed was in the format of Japanese time. Which indicate some +# use of the Japanese time (instead of syncing by DST) might have occurred in +# the Yangtze river delta area during that period of time although the scope +# of such use will need to be investigated to determine. # # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Shang 1940 only - Jun 1 0:00 1:00 D @@ -572,7 +676,7 @@ Zone Asia/Urumqi 5:50:20 - LMT 1928 6:00 - +06 -# Hong Kong (Xianggang) +# Hong Kong # Milne gives 7:36:41.7; round this. @@ -582,9 +686,7 @@ Zone Asia/Urumqi 5:50:20 - LMT 1928 # it is not [an] observatory, but the official meteorological agency of HK, # and also serves as the official timing agency), there are some missing # and incorrect rules. Although the exact switch over time is missing, I -# think 3:30 is correct. The official DST record for Hong Kong can be -# obtained from -# http://www.hko.gov.hk/gts/time/Summertime.htm +# think 3:30 is correct. # From Phake Nick (2018-10-27): # According to Singaporean newspaper @@ -695,10 +797,10 @@ Zone Asia/Urumqi 5:50:20 - LMT 1928 # Resolution of the Legislative Council passed on 9 May 1979 # https://www.legco.gov.hk/yr78-79/english/lc_sitg/hansard/h790509.pdf#page=39 -# From Paul Eggert (2019-05-31): +# From Paul Eggert (2020-04-15): # Here are the dates given at -# https://www.hko.gov.hk/gts/time/Summertime.htm -# as of 2014-06-19: +# https://www.hko.gov.hk/en/gts/time/Summertime.htm +# as of 2020-02-10: # Year Period # 1941 15 Jun to 30 Sep # 1942 Whole year @@ -1828,6 +1930,47 @@ Zone Asia/Jerusalem 2:20:54 - LMT 1880 # '9:00' and 'JST' is from Guy Harris. +# From Paul Eggert (2020-01-19): +# Starting in the 7th century, Japan generally followed an ancient Chinese +# timekeeping system that divided night and day into six hours each, +# with hour length depending on season. In 1873 the government +# started requiring the use of a Western style 24-hour clock. See: +# Yulia Frumer, "Making Time: Astronomical Time Measurement in Tokugawa Japan" +# <https://www.worldcat.org/oclc/1043907065>. As the tzdb code and +# data support only 24-hour clocks, its tables model timestamps before +# 1873 using Western-style local mean time. + +# From Hideyuki Suzuki (1998-11-09): +# 'Tokyo' usually stands for the former location of Tokyo Astronomical +# Observatory: 139° 44' 40.90" E (9h 18m 58.727s), 35° 39' 16.0" N. +# This data is from 'Rika Nenpyou (Chronological Scientific Tables) 1996' +# edited by National Astronomical Observatory of Japan.... +# JST (Japan Standard Time) has been used since 1888-01-01 00:00 (JST). +# The law is enacted on 1886-07-07. + +# From Hideyuki Suzuki (1998-11-16): +# The ordinance No. 51 (1886) established "standard time" in Japan, +# which stands for the time on 135° E. +# In the ordinance No. 167 (1895), "standard time" was renamed to "central +# standard time". And the same ordinance also established "western standard +# time", which stands for the time on 120° E.... But "western standard +# time" was abolished in the ordinance No. 529 (1937). In the ordinance No. +# 167, there is no mention regarding for what place western standard time is +# standard.... +# +# I wrote "ordinance" above, but I don't know how to translate. +# In Japanese it's "chokurei", which means ordinance from emperor. + +# From Yu-Cheng Chuang (2013-07-12): +# ...the Meiji Emperor announced Ordinance No. 167 of Meiji Year 28 "The clause +# about standard time" ... The adoption began from Jan 1, 1896. +# https://ja.wikisource.org/wiki/標準時ニ關スル件_(公布時) +# +# ...the Showa Emperor announced Ordinance No. 529 of Showa Year 12 ... which +# means the whole Japan territory, including later occupations, adopt Japan +# Central Time (UT+9). The adoption began on Oct 1, 1937. +# https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件 + # From Paul Eggert (1995-03-06): # Today's _Asahi Evening News_ (page 4) reports that Japan had # daylight saving between 1948 and 1951, but "the system was discontinued @@ -1876,37 +2019,6 @@ Rule Japan 1948 1951 - Sep Sat>=8 25:00 0 S Rule Japan 1949 only - Apr Sat>=1 24:00 1:00 D Rule Japan 1950 1951 - May Sat>=1 24:00 1:00 D -# From Hideyuki Suzuki (1998-11-09): -# 'Tokyo' usually stands for the former location of Tokyo Astronomical -# Observatory: 139° 44' 40.90" E (9h 18m 58.727s), 35° 39' 16.0" N. -# This data is from 'Rika Nenpyou (Chronological Scientific Tables) 1996' -# edited by National Astronomical Observatory of Japan.... -# JST (Japan Standard Time) has been used since 1888-01-01 00:00 (JST). -# The law is enacted on 1886-07-07. - -# From Hideyuki Suzuki (1998-11-16): -# The ordinance No. 51 (1886) established "standard time" in Japan, -# which stands for the time on 135° E. -# In the ordinance No. 167 (1895), "standard time" was renamed to "central -# standard time". And the same ordinance also established "western standard -# time", which stands for the time on 120° E.... But "western standard -# time" was abolished in the ordinance No. 529 (1937). In the ordinance No. -# 167, there is no mention regarding for what place western standard time is -# standard.... -# -# I wrote "ordinance" above, but I don't know how to translate. -# In Japanese it's "chokurei", which means ordinance from emperor. - -# From Yu-Cheng Chuang (2013-07-12): -# ...the Meiji Emperor announced Ordinance No. 167 of Meiji Year 28 "The clause -# about standard time" ... The adoption began from Jan 1, 1896. -# https://ja.wikisource.org/wiki/標準時ニ關スル件_(公布時) -# -# ...the Showa Emperor announced Ordinance No. 529 of Showa Year 12 ... which -# means the whole Japan territory, including later occupations, adopt Japan -# Central Time (UT+9). The adoption began on Oct 1, 1937. -# https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Tokyo 9:18:59 - LMT 1887 Dec 31 15:00u 9:00 Japan J%sT @@ -3086,22 +3198,9 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # [T]he Palestinian cabinet decision (Mar 8th 2016) published on # http://www.palestinecabinet.gov.ps/WebSite/Upload/Decree/GOV_17/16032016134830.pdf # states that summer time will end on Oct 29th at 01:00. -# -# From Tim Parenti (2016-10-19): -# Predict fall transitions on October's last Saturday at 01:00 from now on. -# This is consistent with the 2016 transition as well as our spring -# predictions. -# -# From Paul Eggert (2016-10-19): -# It's also consistent with predictions in the following URLs today: -# https://www.timeanddate.com/time/change/gaza-strip/gaza -# https://www.timeanddate.com/time/change/west-bank/hebron # From Sharef Mustafa (2018-03-16): -# Palestine summer time will start on Mar 24th 2018 by advancing the -# clock by 60 minutes as per Palestinian cabinet decision published on -# the official website, though the decree did not specify the exact -# time of the time shift. +# Palestine summer time will start on Mar 24th 2018 ... # http://www.palestinecabinet.gov.ps/Website/AR/NDecrees/ViewFile.ashx?ID=e7a42ab7-ee23-435a-b9c8-a4f7e81f3817 # From Even Scharning (2019-03-23): @@ -3111,15 +3210,20 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # From Sharif Mustafa (2019-03-26): # The Palestinian cabinet announced today that the switch to DST will # be on Fri Mar 29th 2019 by advancing the clock by 60 minutes. -# The decree signing date is Mar 12th but it was not published till today. -# The decree does not specify the exact time of switch. # http://palestinecabinet.gov.ps/Website/AR/NDecrees/ViewFile.ashx?ID=e54e9ea1-50ee-4137-84df-0d6c78da259b # # From Even Scharning (2019-04-10): # Our source in Palestine said it happened Friday 29 at 00:00 local time.... + +# From Sharef Mustafa (2019-10-18): +# Palestine summer time will end on midnight Oct 26th 2019 ... +# http://www.palestinecabinet.gov.ps/website/ar/ViewDetails?ID=43948 # # From Paul Eggert (2019-04-10): # For now, guess spring-ahead transitions are March's last Friday at 00:00. +# +# From Tim Parenti (2016-10-19): +# Predict fall transitions on October's last Saturday at 01:00 from now on. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule EgyptAsia 1957 only - May 10 0:00 1:00 S diff --git a/usr/src/data/zoneinfo/backward b/usr/src/data/zoneinfo/backward index b4ae3cf9d3..e13ae527a9 100644 --- a/usr/src/data/zoneinfo/backward +++ b/usr/src/data/zoneinfo/backward @@ -17,6 +17,7 @@ Link America/Atikokan America/Coral_Harbour Link America/Argentina/Cordoba America/Cordoba Link America/Tijuana America/Ensenada Link America/Indiana/Indianapolis America/Fort_Wayne +Link America/Nuuk America/Godthab Link America/Indiana/Indianapolis America/Indianapolis Link America/Argentina/Jujuy America/Jujuy Link America/Indiana/Knox America/Knox_IN diff --git a/usr/src/data/zoneinfo/europe b/usr/src/data/zoneinfo/europe index 361b396c02..5593c6079d 100644 --- a/usr/src/data/zoneinfo/europe +++ b/usr/src/data/zoneinfo/europe @@ -549,12 +549,13 @@ Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2 0:00 1:00 IST 1947 Nov 2 2:00s 0:00 - GMT 1948 Apr 18 2:00s 0:00 GB-Eire GMT/IST 1968 Oct 27 -# The next line is for when negative SAVE values are used. +# Vanguard section, for zic and other parsers that support negative DST. 1:00 Eire IST/GMT -# These three lines are for when SAVE values are always nonnegative. +# Rearguard section, for parsers lacking negative DST; see ziguard.awk. # 1:00 - IST 1971 Oct 31 2:00u # 0:00 GB-Eire GMT/IST 1996 # 0:00 EU GMT/IST +# End of rearguard section. ############################################################################### @@ -1018,7 +1019,7 @@ Zone Europe/Prague 0:57:44 - LMT 1850 1:00 Czech CE%sT 1946 Dec 1 3:00 # Vanguard section, for zic and other parsers that support negative DST. 1:00 -1:00 GMT 1947 Feb 23 2:00 -# Rearguard section, for parsers that do not support negative DST. +# Rearguard section, for parsers lacking negative DST; see ziguard.awk. # 0:00 - GMT 1947 Feb 23 2:00 # End of rearguard section. 1:00 Czech CE%sT 1979 @@ -1175,14 +1176,17 @@ Zone America/Danmarkshavn -1:14:40 - LMT 1916 Jul 28 -3:00 - -03 1980 Apr 6 2:00 -3:00 EU -03/-02 1996 0:00 - GMT +# +# Use the old name Scoresbysund, as the current name Ittoqqortoormiit +# exceeds tzdb's 14-letter limit and has no common English abbreviation. Zone America/Scoresbysund -1:27:52 - LMT 1916 Jul 28 # Ittoqqortoormiit -2:00 - -02 1980 Apr 6 2:00 -2:00 C-Eur -02/-01 1981 Mar 29 -1:00 EU -01/+00 -Zone America/Godthab -3:26:56 - LMT 1916 Jul 28 # Nuuk +Zone America/Nuuk -3:26:56 - LMT 1916 Jul 28 # Godthåb -3:00 - -03 1980 Apr 6 2:00 -3:00 EU -03/-02 -Zone America/Thule -4:35:08 - LMT 1916 Jul 28 # Pituffik air base +Zone America/Thule -4:35:08 - LMT 1916 Jul 28 # Pituffik -4:00 Thule A%sT # Estonia @@ -1552,7 +1556,7 @@ Zone Europe/Budapest 1:16:20 - LMT 1890 Oct # # From January 1st, 1908 the whole of Iceland was standardised at 1 hour # behind GMT. Previously, local mean solar time was used in different parts -# of Iceland, the almanak had been based on Reykjavik mean solar time which +# of Iceland, the almanak had been based on Reykjavík mean solar time which # was 1 hour and 28 minutes behind GMT. # # "first day of winter" referred to [below] means the first day of the 26 weeks diff --git a/usr/src/data/zoneinfo/northamerica b/usr/src/data/zoneinfo/northamerica index 8771d96e64..febf05bfdd 100644 --- a/usr/src/data/zoneinfo/northamerica +++ b/usr/src/data/zoneinfo/northamerica @@ -86,7 +86,7 @@ # For more about the first ten years of DST in the United States, see # Robert Garland, Ten years of daylight saving from the Pittsburgh standpoint # (Carnegie Library of Pittsburgh, 1927). -# http://www.clpgh.org/exhibit/dst.html +# https://web.archive.org/web/20160517155308/http://www.clpgh.org/exhibit/dst.html # # Shanks says that DST was called "War Time" in the US in 1918 and 1919. # However, DST was imposed by the Standard Time Act of 1918, which @@ -1470,7 +1470,8 @@ Zone America/Goose_Bay -4:01:40 - LMT 1884 # Happy Valley-Goose Bay -4:00 Canada A%sT -# west Labrador, Nova Scotia, Prince Edward I +# west Labrador, Nova Scotia, Prince Edward I, +# Îles-de-la-Madeleine, Listuguj reserve # From Brian Inglis (2015-07-20): # From the historical weather station records available at: @@ -1489,6 +1490,13 @@ Zone America/Goose_Bay -4:01:40 - LMT 1884 # Happy Valley-Goose Bay # in Canada to observe DST in 1971 but not 1970; for now we'll assume # this is a typo. +# From Jeffery Nichols (2020-01-09): +# America/Halifax ... also applies to Îles-de-la-Madeleine and the Listuguj +# reserve in Quebec. Officially, this came into effect on January 1, 2007 +# (Legal Time Act, CQLR c T-5.1), but the legislative debates surrounding that +# bill say that it is "accommodating the customs and practices" of those +# regions, which suggests that they have always been in-line with Halifax. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Halifax 1916 only - Apr 1 0:00 1:00 D Rule Halifax 1916 only - Oct 1 0:00 0 S @@ -1582,19 +1590,20 @@ Zone America/Moncton -4:19:08 - LMT 1883 Dec 9 # Quebec -# From Paul Eggert (2015-03-24): +# From Paul Eggert (2020-01-10): # See America/Toronto for most of Quebec, including Montreal. +# See America/Halifax for the Îles de la Madeleine and the Listuguj reserve. # # Matthews and Vincent (1998) also write that Quebec east of the -63 # meridian is supposed to observe AST, but residents as far east as # Natashquan use EST/EDT, and residents east of Natashquan use AST. # The Quebec department of justice writes in # "The situation in Minganie and Basse-Côte-Nord" -# http://www.justice.gouv.qc.ca/english/publications/generale/temps-minganie-a.htm +# https://www.justice.gouv.qc.ca/en/department/ministre/functions-and-responsabilities/legal-time-in-quebec/the-situation-in-minganie-and-basse-cote-nord/ # that the coastal strip from just east of Natashquan to Blanc-Sablon # observes Atlantic standard time all year round. -# https://www.assnat.qc.ca/Media/Process.aspx?MediaId=ANQ.Vigie.Bll.DocumentGenerique_8845en -# says this common practice was codified into law as of 2007. +# This common practice was codified into law as of 2007; see Legal Time Act, +# CQLR c T-5.1 <http://legisquebec.gouv.qc.ca/en/ShowDoc/cs/T-5.1>. # For lack of better info, guess this practice began around 1970, contra to # Shanks & Pottenger who have this region observing AST/ADT. @@ -1613,6 +1622,15 @@ Zone America/Blanc-Sablon -3:48:28 - LMT 1884 # Nipigon (EST) and Rainy River (CST) are the largest that we know of. # Far west Ontario is like Winnipeg; far east Quebec is like Halifax. +# From Jeffery Nichols (2020-02-06): +# According to the [Shanks] atlas, those western Ontario zones are huge, +# covering most of Ontario northwest of Sault Ste Marie and Timmins. +# The zones seem to include towns bigger than the ones they're named after, +# like Dryden in America/Rainy_River and Wawa (and maybe Attawapiskat) in +# America/Nipigon. I assume it's too much trouble to change the name of the +# zone (like when you found out that America/Glace_Bay includes Sydney, Nova +# Scotia).... + # From Mark Brader (2003-07-26): # [According to the Toronto Star] Orillia, Ontario, adopted DST # effective Saturday, 1912-06-22, 22:00; the article mentions that @@ -2419,6 +2437,18 @@ Zone America/Creston -7:46:04 - LMT 1884 # obtained in November 2008 should be ignored... # I apologize for reporting incorrect information in 2008. +# From Tim Parenti (2020-03-05): +# The government of Yukon announced [yesterday] the cessation of seasonal time +# changes. "After clocks are pushed ahead one hour on March 8, the territory +# will remain on [UTC-07]. ... [The government] found 93 per cent of +# respondents wanted to end seasonal time changes and, of that group, 70 per +# cent wanted 'permanent Pacific Daylight Saving Time.'" +# https://www.cbc.ca/news/canada/north/yukon-end-daylight-saving-time-1.5486358 +# +# Although the government press release prefers PDT, we prefer MST for +# consistency with nearby Dawson Creek, Creston, and Fort Nelson. +# https://yukon.ca/en/news/yukon-end-seasonal-time-change + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule NT_YK 1918 only - Apr 14 2:00 1:00 D Rule NT_YK 1918 only - Oct 27 2:00 0 S @@ -2473,11 +2503,13 @@ Zone America/Inuvik 0 - -00 1953 # Inuvik founded Zone America/Whitehorse -9:00:12 - LMT 1900 Aug 20 -9:00 NT_YK Y%sT 1967 May 28 0:00 -8:00 NT_YK P%sT 1980 - -8:00 Canada P%sT + -8:00 Canada P%sT 2020 Mar 8 2:00 + -7:00 - MST Zone America/Dawson -9:17:40 - LMT 1900 Aug 20 -9:00 NT_YK Y%sT 1973 Oct 28 0:00 -8:00 NT_YK P%sT 1980 - -8:00 Canada P%sT + -8:00 Canada P%sT 2020 Mar 8 2:00 + -7:00 - MST ############################################################################### diff --git a/usr/src/data/zoneinfo/zone.tab.txt b/usr/src/data/zoneinfo/zone.tab.txt index 408fcb2051..8d056e3748 100644 --- a/usr/src/data/zoneinfo/zone.tab.txt +++ b/usr/src/data/zoneinfo/zone.tab.txt @@ -131,8 +131,8 @@ CA +4906-11631 America/Creston MST - BC (Creston) CA +5946-12014 America/Dawson_Creek MST - BC (Dawson Cr, Ft St John) CA +5848-12242 America/Fort_Nelson MST - BC (Ft Nelson) CA +4916-12307 America/Vancouver Pacific - BC (most areas) -CA +6043-13503 America/Whitehorse Pacific - Yukon (south) -CA +6404-13925 America/Dawson Pacific - Yukon (north) +CA +6043-13503 America/Whitehorse Pacific - Yukon (east) +CA +6404-13925 America/Dawson Pacific - Yukon (west) CC -1210+09655 Indian/Cocos CD -0418+01518 Africa/Kinshasa Dem. Rep. of Congo (west) CD -1140+02728 Africa/Lubumbashi Dem. Rep. of Congo (east) @@ -189,7 +189,7 @@ GF +0456-05220 America/Cayenne GG +492717-0023210 Europe/Guernsey GH +0533-00013 Africa/Accra GI +3608-00521 Europe/Gibraltar -GL +6411-05144 America/Godthab Greenland (most areas) +GL +6411-05144 America/Nuuk Greenland (most areas) GL +7646-01840 America/Danmarkshavn National Park (east coast) GL +7029-02158 America/Scoresbysund Scoresbysund/Ittoqqortoormiit GL +7634-06847 America/Thule Thule/Pituffik @@ -335,7 +335,7 @@ RU +554521+0373704 Europe/Moscow MSK+00 - Moscow area # The obsolescent zone.tab format cannot represent Europe/Simferopol well. # Put it in RU section and list as UA. See "territorial claims" above. # Programs should use zone1970.tab instead; see above. -UA +4457+03406 Europe/Simferopol MSK+00 - Crimea +UA +4457+03406 Europe/Simferopol Crimea RU +5836+04939 Europe/Kirov MSK+00 - Kirov RU +4621+04803 Europe/Astrakhan MSK+01 - Astrakhan RU +4844+04425 Europe/Volgograd MSK+01 - Volgograd @@ -399,8 +399,8 @@ TV -0831+17913 Pacific/Funafuti TW +2503+12130 Asia/Taipei TZ -0648+03917 Africa/Dar_es_Salaam UA +5026+03031 Europe/Kiev Ukraine (most areas) -UA +4837+02218 Europe/Uzhgorod Ruthenia -UA +4750+03510 Europe/Zaporozhye Zaporozh'ye/Zaporizhia; Lugansk/Luhansk (east) +UA +4837+02218 Europe/Uzhgorod Transcarpathia +UA +4750+03510 Europe/Zaporozhye Zaporozhye and east Lugansk UG +0019+03225 Africa/Kampala UM +2813-17722 Pacific/Midway Midway Islands UM +1917+16637 Pacific/Wake Wake Island diff --git a/usr/src/data/zoneinfo/zone_sun.tab b/usr/src/data/zoneinfo/zone_sun.tab index 2ac2bf24a9..a82bb5fc93 100644 --- a/usr/src/data/zoneinfo/zone_sun.tab +++ b/usr/src/data/zoneinfo/zone_sun.tab @@ -154,8 +154,8 @@ CA +4906-11631 America/Creston - MST - BC (Creston) CA +5946-12014 America/Dawson_Creek - MST - BC (Dawson Cr, Ft St John) CA +5848-12242 America/Fort_Nelson - MST - BC (Ft Nelson) CA +4916-12307 America/Vancouver - Pacific - BC (most areas) -CA +6043-13503 America/Whitehorse - Pacific - Yukon (south) -CA +6404-13925 America/Dawson - Pacific - Yukon (north) +CA +6043-13503 America/Whitehorse - Pacific - Yukon (east) +CA +6404-13925 America/Dawson - Pacific - Yukon (west) CC -1210+09655 Indian/Cocos - CD -0418+01518 Africa/Kinshasa - Dem. Rep. of Congo (west) CD -1140+02728 Africa/Lubumbashi - Dem. Rep. of Congo (east) @@ -212,7 +212,7 @@ GF +0456-05220 America/Cayenne - GG +492717-0023210 Europe/Guernsey - GH +0533-00013 Africa/Accra - GI +3608-00521 Europe/Gibraltar - -GL +6411-05144 America/Godthab - Greenland (most areas) +GL +6411-05144 America/Nuuk - Greenland (most areas) GL +7646-01840 America/Danmarkshavn - National Park (east coast) GL +7029-02158 America/Scoresbysund - Scoresbysund/Ittoqqortoormiit GL +7634-06847 America/Thule - Thule/Pituffik @@ -422,9 +422,9 @@ UA +5026+03031 Europe/Kiev - Ukraine (most areas) # Upstream zoneinfo have put it in RU section but listed it as UA # However, libzoneinfo relies on this file being sorted and so we place it in # the UA section. -UA +4457+03406 Europe/Simferopol - MSK+00 - Crimea -UA +4837+02218 Europe/Uzhgorod - Ruthenia -UA +4750+03510 Europe/Zaporozhye - Zaporozh'ye/Zaporizhia; Lugansk/Luhansk (east) +UA +4457+03406 Europe/Simferopol - Crimea +UA +4837+02218 Europe/Uzhgorod - Transcarpathia +UA +4750+03510 Europe/Zaporozhye - Zaporozhye and east Lugansk UG +0019+03225 Africa/Kampala - UM +2813-17722 Pacific/Midway - Midway Islands UM +1917+16637 Pacific/Wake - Wake Island diff --git a/usr/src/pkg/manifests/system-data-zoneinfo.mf b/usr/src/pkg/manifests/system-data-zoneinfo.mf index 620600e7a4..94e0512a28 100644 --- a/usr/src/pkg/manifests/system-data-zoneinfo.mf +++ b/usr/src/pkg/manifests/system-data-zoneinfo.mf @@ -13,11 +13,11 @@ # Copyright 2018 Nexenta Systems, Inc. # Copyright (c) 2014 Joyent, Inc. All rights reserved. # Copyright 2017 OmniTI Computer Consulting, Inc. All rights reserved. -# Copyright 2019 OmniOS Community Edition (OmniOSce) Association. +# Copyright 2020 OmniOS Community Edition (OmniOSce) Association. # set name=pkg.fmri \ - value=pkg:/system/data/zoneinfo@2019.3,$(PKGVERS_BUILTON)-$(PKGVERS_BRANCH) + value=pkg:/system/data/zoneinfo@2020.1,$(PKGVERS_BUILTON)-$(PKGVERS_BRANCH) set name=pkg.description value="timezone information" set name=pkg.summary value="Timezone Information" set name=info.classification value=org.opensolaris.category.2008:System/Core @@ -122,7 +122,6 @@ file path=usr/share/lib/zoneinfo/America/El_Salvador file path=usr/share/lib/zoneinfo/America/Fort_Nelson file path=usr/share/lib/zoneinfo/America/Fortaleza file path=usr/share/lib/zoneinfo/America/Glace_Bay -file path=usr/share/lib/zoneinfo/America/Godthab file path=usr/share/lib/zoneinfo/America/Goose_Bay file path=usr/share/lib/zoneinfo/America/Grand_Turk file path=usr/share/lib/zoneinfo/America/Grenada @@ -173,6 +172,7 @@ file path=usr/share/lib/zoneinfo/America/Noronha file path=usr/share/lib/zoneinfo/America/North_Dakota/Beulah file path=usr/share/lib/zoneinfo/America/North_Dakota/Center file path=usr/share/lib/zoneinfo/America/North_Dakota/New_Salem +file path=usr/share/lib/zoneinfo/America/Nuuk file path=usr/share/lib/zoneinfo/America/Ojinaga file path=usr/share/lib/zoneinfo/America/Panama file path=usr/share/lib/zoneinfo/America/Pangnirtung @@ -525,6 +525,7 @@ hardlink path=usr/share/lib/zoneinfo/America/Ensenada \ target=../America/Tijuana hardlink path=usr/share/lib/zoneinfo/America/Fort_Wayne \ target=../America/Indiana/Indianapolis +hardlink path=usr/share/lib/zoneinfo/America/Godthab target=Nuuk hardlink path=usr/share/lib/zoneinfo/America/Indianapolis \ target=../America/Indiana/Indianapolis hardlink path=usr/share/lib/zoneinfo/America/Jujuy \ diff --git a/usr/src/tools/scripts/gensetdefs.pl b/usr/src/tools/scripts/gensetdefs.pl new file mode 100644 index 0000000000..8ca5782feb --- /dev/null +++ b/usr/src/tools/scripts/gensetdefs.pl @@ -0,0 +1,31 @@ +#!/usr/bin/perl -w +# +# COPYRIGHT 2013 Pluribus Networks Inc. +# +# All rights reserved. This copyright notice is Copyright Management +# Information under 17 USC 1202 and is included to protect this work and +# deter copyright infringement. Removal or alteration of this Copyright +# Management Information without the express written permission from +# Pluribus Networks Inc is prohibited, and any such unauthorized removal +# or alteration will be a violation of federal law. + +use strict; + +my @Sections = split(/\n/, `elfedit -r -e \'shdr:sh_name -osimple\' $ARGV[0] 2>&1`); + +foreach my $Section (@Sections) { + if ($Section =~ "^set_") { + print "\tfixing $Section\n"; + + chomp(my $SectionAddr = `elfedit -r -e \'shdr:sh_addr -onum $Section\' $ARGV[0] 2>&1`); + chomp(my $SectionSize = `elfedit -r -e \'shdr:sh_size -onum $Section\' $ARGV[0] 2>&1`); + my $SectionEnd = hex($SectionAddr) + hex($SectionSize); + + `elfedit -e \'sym:st_bind __start_$Section global\' $ARGV[0] 2>&1`; + `elfedit -e \'sym:st_value __start_$Section $SectionAddr\' $ARGV[0] 2>&1`; + `elfedit -e \'sym:st_shndx __start_$Section $Section\' $ARGV[0] 2>&1`; + `elfedit -e \'sym:st_bind __stop_$Section global\' $ARGV[0] 2>&1`; + `elfedit -e \'sym:st_value __stop_$Section $SectionEnd\' $ARGV[0] 2>&1`; + `elfedit -e \'sym:st_shndx __stop_$Section $Section\' $ARGV[0] 2>&1`; + } +} diff --git a/usr/src/uts/common/io/bnx/bnx.h b/usr/src/uts/common/io/bnx/bnx.h index e1d53fa9d7..9ef282678e 100644 --- a/usr/src/uts/common/io/bnx/bnx.h +++ b/usr/src/uts/common/io/bnx/bnx.h @@ -55,12 +55,6 @@ extern "C" { -/* - */ -#pragma weak hcksum_retrieve -#pragma weak hcksum_assoc - - #include "listq.h" #include "lm5706.h" #include "54xx_reg.h" diff --git a/usr/src/uts/common/io/bnx/bnxsnd.c b/usr/src/uts/common/io/bnx/bnxsnd.c index 16f1b03c10..f6e154c056 100644 --- a/usr/src/uts/common/io/bnx/bnxsnd.c +++ b/usr/src/uts/common/io/bnx/bnxsnd.c @@ -611,7 +611,7 @@ bnx_xmit_ring_xmit_mblk(um_device_t * const umdevice, umpacket->frag_list.cnt = 0; umpacket->mp = mp; - hcksum_retrieve(mp, NULL, NULL, NULL, NULL, NULL, NULL, &pflags); + mac_hcksum_get(mp, NULL, NULL, NULL, NULL, &pflags); bnx_xmit_pkt_cpy(umdevice, umpacket); diff --git a/usr/src/uts/common/io/chxge/pe.c b/usr/src/uts/common/io/chxge/pe.c index 652edba984..48a796470a 100644 --- a/usr/src/uts/common/io/chxge/pe.c +++ b/usr/src/uts/common/io/chxge/pe.c @@ -414,12 +414,12 @@ pe_start(ch_t *sa, mblk_t *mp, uint32_t flg) lseg = ch_bind_dvma_handle(sa, len, (void *)mp->b_rptr, &hmp[nseg], mseg - nseg); - if (lseg == NULL) { + if (lseg == 0) { sa->sge->intr_cnt.tx_no_dvma1++; if ((lseg = ch_bind_dma_handle(sa, len, (void *)mp->b_rptr, &hmp[nseg], - mseg - nseg)) == NULL) { + mseg - nseg)) == 0) { sa->sge->intr_cnt.tx_no_dma1++; /* @@ -444,7 +444,7 @@ pe_start(ch_t *sa, mblk_t *mp, uint32_t flg) lseg = ch_bind_dma_handle(sa, len, (void *)mp->b_rptr, &hmp[nseg], mseg - nseg); - if (lseg == NULL) { + if (lseg == 0) { sa->sge->intr_cnt.tx_no_dma1++; /* @@ -512,12 +512,12 @@ pe_start(ch_t *sa, mblk_t *mp, uint32_t flg) nseg = ch_bind_dvma_handle(sa, len, (void *)mp->b_rptr, &hmp[0], 16); - if (nseg == NULL) { + if (nseg == 0) { sa->sge->intr_cnt.tx_no_dvma2++; nseg = ch_bind_dma_handle(sa, len, (void *)mp->b_rptr, &hmp[0], 16); - if (nseg == NULL) { + if (nseg == 0) { sa->sge->intr_cnt.tx_no_dma2++; /* @@ -530,7 +530,7 @@ pe_start(ch_t *sa, mblk_t *mp, uint32_t flg) } else { nseg = ch_bind_dma_handle(sa, len, (void *)mp->b_rptr, &hmp[0], 16); - if (nseg == NULL) { + if (nseg == 0) { sa->sge->intr_cnt.tx_no_dma2++; /* diff --git a/usr/src/uts/common/io/e1000g/e1000g_alloc.c b/usr/src/uts/common/io/e1000g/e1000g_alloc.c index c7496cd164..8a460fd45a 100644 --- a/usr/src/uts/common/io/e1000g/e1000g_alloc.c +++ b/usr/src/uts/common/io/e1000g/e1000g_alloc.c @@ -830,7 +830,7 @@ e1000g_free_dvma_buffer(dma_buffer_t *buf) return; } - buf->dma_address = NULL; + buf->dma_address = 0; if (buf->address != NULL) { kmem_free(buf->address, buf->size); diff --git a/usr/src/uts/common/klm/nlm_impl.h b/usr/src/uts/common/klm/nlm_impl.h index 68604309a2..9caae1a8c7 100644 --- a/usr/src/uts/common/klm/nlm_impl.h +++ b/usr/src/uts/common/klm/nlm_impl.h @@ -28,7 +28,7 @@ */ /* - * Copyright 2012 Nexenta Systems, Inc. All rights reserved. + * Copyright 2019 Nexenta by DDN, Inc. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright 2016 Joyent, Inc. */ @@ -112,7 +112,7 @@ struct _kthread; * We pass three callback functions to nlm_do_lock: * nlm_reply_cb: send a normal RPC reply * nlm_res_cb: do a _res (message style) RPC (call) - * nlm_testargs_cb: do a "granted" RPC call (after blocking) + * nlm_granted_cb: do a "granted" RPC call (after blocking) * Only one of the 1st or 2nd is used. * The 3rd is used only for blocking * @@ -123,7 +123,7 @@ struct _kthread; */ typedef bool_t (*nlm_reply_cb)(SVCXPRT *, nlm4_res *); typedef enum clnt_stat (*nlm_res_cb)(nlm4_res *, void *, CLIENT *); -typedef enum clnt_stat (*nlm_testargs_cb)(nlm4_testargs *, void *, CLIENT *); +typedef enum clnt_stat (*nlm_granted_cb)(nlm4_testargs *, nlm4_res *, CLIENT *); typedef enum clnt_stat (*nlm_testres_cb)(nlm4_testres *, void *, CLIENT *); /* @@ -624,7 +624,7 @@ void nlm_do_notify2(nlm_sm_status *, void *, struct svc_req *); void nlm_do_test(nlm4_testargs *, nlm4_testres *, struct svc_req *, nlm_testres_cb); void nlm_do_lock(nlm4_lockargs *, nlm4_res *, struct svc_req *, - nlm_reply_cb, nlm_res_cb, nlm_testargs_cb); + nlm_reply_cb, nlm_res_cb, nlm_granted_cb); void nlm_do_cancel(nlm4_cancargs *, nlm4_res *, struct svc_req *, nlm_res_cb); void nlm_do_unlock(nlm4_unlockargs *, nlm4_res *, diff --git a/usr/src/uts/common/klm/nlm_rpc_handle.c b/usr/src/uts/common/klm/nlm_rpc_handle.c index 9ddf56856c..b022acc380 100644 --- a/usr/src/uts/common/klm/nlm_rpc_handle.c +++ b/usr/src/uts/common/klm/nlm_rpc_handle.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright 2019 Nexenta by DDN, Inc. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. */ @@ -130,6 +130,7 @@ update_host_rpcbinding(struct nlm_host *hostp, int vers) static int refresh_nlm_rpc(struct nlm_host *hostp, nlm_rpc_t *rpcp) { + uint32_t zero = 0; int ret; if (rpcp->nr_handle == NULL) { @@ -175,6 +176,12 @@ refresh_nlm_rpc(struct nlm_host *hostp, nlm_rpc_t *rpcp) if (NLM_STALE_CLNT(stat)) { ret = ESTALE; } + /* + * Need to reset the XID after the null call above, + * otherwise we'll reuse the XID from that call. + */ + (void) CLNT_CONTROL(rpcp->nr_handle, CLSET_XID, + (char *)&zero); } } @@ -209,7 +216,8 @@ again: rc = cv_wait_sig(&hostp->nh_rpcb_cv, &hostp->nh_lock); if (rc == 0) { mutex_exit(&hostp->nh_lock); - return (EINTR); + rc = EINTR; + goto errout; } } @@ -229,7 +237,8 @@ again: */ if (hostp->nh_rpcb_ustat != RPC_SUCCESS) { mutex_exit(&hostp->nh_lock); - return (ENOENT); + rc = ENOENT; + goto errout; } } @@ -263,7 +272,7 @@ again: } destroy_rpch(rpcp); - return (rc); + goto errout; } DTRACE_PROBE2(end, struct nlm_host *, hostp, @@ -271,6 +280,10 @@ again: *rpcpp = rpcp; return (0); + +errout: + NLM_ERR("Can't get RPC client handle for: %s", hostp->nh_name); + return (rc); } void diff --git a/usr/src/uts/common/klm/nlm_rpc_svc.c b/usr/src/uts/common/klm/nlm_rpc_svc.c index 2911b31877..1f04e3f036 100644 --- a/usr/src/uts/common/klm/nlm_rpc_svc.c +++ b/usr/src/uts/common/klm/nlm_rpc_svc.c @@ -26,7 +26,7 @@ */ /* - * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright 2019 Nexenta by DDN, Inc. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. */ @@ -63,7 +63,7 @@ * 32-bit lock ranges. */ static void -nlm_convert_to_nlm_lock(struct nlm_lock *dst, struct nlm4_lock *src) +nlm_convert_to_nlm_lock(struct nlm_lock *dst, const struct nlm4_lock *src) { dst->caller_name = src->caller_name; dst->fh = src->fh; @@ -76,12 +76,22 @@ nlm_convert_to_nlm_lock(struct nlm_lock *dst, struct nlm4_lock *src) } /* + * Up-convert for v1 granted response + */ +static void +nlm_convert_to_nlm4_res(struct nlm4_res *dst, const struct nlm_res *src) +{ + dst->cookie = src->cookie; + dst->stat.stat = (nlm4_stats) src->stat.stat; +} + +/* * Up-convert for v1 svc functions with a 32-bit lock range arg. * Note that lock range checks (like overflow) are done later, * in nlm_init_flock(). */ static void -nlm_convert_to_nlm4_lock(struct nlm4_lock *dst, struct nlm_lock *src) +nlm_convert_to_nlm4_lock(struct nlm4_lock *dst, const struct nlm_lock *src) { dst->caller_name = src->caller_name; @@ -93,7 +103,7 @@ nlm_convert_to_nlm4_lock(struct nlm4_lock *dst, struct nlm_lock *src) } static void -nlm_convert_to_nlm4_share(struct nlm4_share *dst, struct nlm_share *src) +nlm_convert_to_nlm4_share(struct nlm4_share *dst, const struct nlm_share *src) { dst->caller_name = src->caller_name; @@ -113,7 +123,7 @@ nlm_convert_to_nlm4_share(struct nlm4_share *dst, struct nlm_share *src) * valid 32-bit lock range. */ static void -nlm_convert_to_nlm_holder(struct nlm_holder *dst, struct nlm4_holder *src) +nlm_convert_to_nlm_holder(struct nlm_holder *dst, const struct nlm4_holder *src) { dst->exclusive = src->exclusive; dst->svid = src->svid; @@ -133,7 +143,7 @@ nlm_convert_to_nlm_stats(enum nlm4_stats src) } static void -nlm_convert_to_nlm_res(struct nlm_res *dst, struct nlm4_res *src) +nlm_convert_to_nlm_res(struct nlm_res *dst, const struct nlm4_res *src) { dst->cookie = src->cookie; dst->stat.stat = nlm_convert_to_nlm_stats(src->stat.stat); @@ -175,7 +185,7 @@ nlm_test_1_svc(struct nlm_testargs *argp, nlm_testres *resp, * Callback functions for nlm_lock_1_svc */ static bool_t nlm_lock_1_reply(SVCXPRT *, nlm4_res *); -static enum clnt_stat nlm_granted_1_cb(nlm4_testargs *, void *, CLIENT *); +static enum clnt_stat nlm_granted_1_cb(nlm4_testargs *, nlm4_res *, CLIENT *); bool_t nlm_lock_1_svc(nlm_lockargs *argp, nlm_res *resp, @@ -215,7 +225,7 @@ nlm_lock_1_reply(SVCXPRT *transp, nlm4_res *resp) } static enum clnt_stat -nlm_granted_1_cb(nlm4_testargs *argp, void *resp, CLIENT *clnt) +nlm_granted_1_cb(nlm4_testargs *argp, nlm4_res *resp, CLIENT *clnt) { nlm_testargs args1; nlm_res res1; @@ -229,9 +239,7 @@ nlm_granted_1_cb(nlm4_testargs *argp, void *resp, CLIENT *clnt) rv = nlm_granted_1(&args1, &res1, clnt); - /* NB: We have a result our caller will not free. */ - xdr_free((xdrproc_t)xdr_nlm_res, (void *)&res1); - (void) resp; + nlm_convert_to_nlm4_res(resp, &res1); return (rv); } @@ -355,7 +363,8 @@ nlm_test_res_1_cb(nlm4_testres *res4, void *null, CLIENT *clnt) * Callback functions for nlm_lock_msg_1_svc */ static enum clnt_stat nlm_lock_res_1_cb(nlm4_res *, void *, CLIENT *); -static enum clnt_stat nlm_granted_msg_1_cb(nlm4_testargs *, void *, CLIENT *); +static enum clnt_stat nlm_granted_msg_1_cb(nlm4_testargs *, nlm4_res *, + CLIENT *); bool_t nlm_lock_msg_1_svc(nlm_lockargs *argp, void *resp, @@ -396,16 +405,22 @@ nlm_lock_res_1_cb(nlm4_res *resp, void *null, CLIENT *clnt) } static enum clnt_stat -nlm_granted_msg_1_cb(nlm4_testargs *argp, void *null, CLIENT *clnt) +nlm_granted_msg_1_cb(nlm4_testargs *argp, nlm4_res *resp, CLIENT *clnt) { nlm_testargs args1; + int rv; args1.cookie = argp->cookie; args1.exclusive = argp->exclusive; nlm_convert_to_nlm_lock(&args1.alock, &argp->alock); - return (nlm_granted_msg_1(&args1, null, clnt)); + rv = nlm_granted_msg_1(&args1, NULL, clnt); + + /* MSG call doesn't fill in *resp, so do it here. */ + if (rv != RPC_SUCCESS) + resp->stat.stat = nlm4_failed; + return (rv); } @@ -693,7 +708,6 @@ nlm4_test_4_svc(nlm4_testargs *argp, nlm4_testres *resp, struct svc_req *sr) * Callback functions for nlm4_lock_4_svc */ static bool_t nlm4_lock_4_reply(SVCXPRT *, nlm4_res *); -static enum clnt_stat nlm4_granted_4_cb(nlm4_testargs *, void *, CLIENT *); bool_t nlm4_lock_4_svc(nlm4_lockargs *argp, nlm4_res *resp, @@ -703,7 +717,7 @@ nlm4_lock_4_svc(nlm4_lockargs *argp, nlm4_res *resp, /* NLM4_LOCK */ nlm_do_lock(argp, resp, sr, nlm4_lock_4_reply, NULL, - nlm4_granted_4_cb); + nlm4_granted_4); /* above does its own reply */ return (FALSE); @@ -715,22 +729,6 @@ nlm4_lock_4_reply(SVCXPRT *transp, nlm4_res *resp) return (svc_sendreply(transp, xdr_nlm4_res, (char *)resp)); } -static enum clnt_stat -nlm4_granted_4_cb(nlm4_testargs *argp, void *resp, CLIENT *clnt) -{ - nlm4_res res4; - int rv; - - bzero(&res4, sizeof (res4)); - rv = nlm4_granted_4(argp, &res4, clnt); - - /* NB: We have a result our caller will not free. */ - xdr_free((xdrproc_t)xdr_nlm4_res, (void *)&res4); - (void) resp; - - return (rv); -} - bool_t nlm4_cancel_4_svc(nlm4_cancargs *argp, nlm4_res *resp, struct svc_req *sr) { @@ -773,6 +771,8 @@ nlm4_test_msg_4_svc(nlm4_testargs *argp, void *resp, struct svc_req *sr) * Callback functions for nlm4_lock_msg_4_svc * (using the RPC client stubs directly) */ +static enum clnt_stat nlm4_granted_msg_4_cb(nlm4_testargs *, nlm4_res *, + CLIENT *); bool_t nlm4_lock_msg_4_svc(nlm4_lockargs *argp, void *resp, @@ -784,7 +784,7 @@ nlm4_lock_msg_4_svc(nlm4_lockargs *argp, void *resp, bzero(&res4, sizeof (res4)); nlm_do_lock(argp, &res4, sr, NULL, nlm4_lock_res_4, - nlm4_granted_msg_4); + nlm4_granted_msg_4_cb); /* NB: We have a result our caller will not free. */ xdr_free((xdrproc_t)xdr_nlm4_res, (void *)&res4); @@ -794,6 +794,20 @@ nlm4_lock_msg_4_svc(nlm4_lockargs *argp, void *resp, return (FALSE); } +static enum clnt_stat +nlm4_granted_msg_4_cb(nlm4_testargs *argp, nlm4_res *resp, CLIENT *clnt) +{ + int rv; + + rv = nlm4_granted_msg_4(argp, NULL, clnt); + + /* MSG call doesn't fill in *resp, so do it here. */ + if (rv != RPC_SUCCESS) + resp->stat.stat = nlm4_failed; + + return (rv); +} + bool_t nlm4_cancel_msg_4_svc(nlm4_cancargs *argp, void *resp, struct svc_req *sr) { diff --git a/usr/src/uts/common/klm/nlm_service.c b/usr/src/uts/common/klm/nlm_service.c index dceabaf53f..f4f733443e 100644 --- a/usr/src/uts/common/klm/nlm_service.c +++ b/usr/src/uts/common/klm/nlm_service.c @@ -27,7 +27,7 @@ /* * Copyright (c) 2012, 2016 by Delphix. All rights reserved. - * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright 2019 Nexenta by DDN, Inc. All rights reserved. * Copyright 2014 Joyent, Inc. All rights reserved. */ @@ -81,6 +81,7 @@ struct nlm_block_cb_data { struct nlm_host *hostp; struct nlm_vhold *nvp; struct flock64 *flp; + bool_t registered; }; /* @@ -107,9 +108,9 @@ static void nlm_block( nlm4_lockargs *lockargs, struct nlm_host *host, struct nlm_vhold *nvp, - nlm_rpc_t *rpcp, struct flock64 *fl, - nlm_testargs_cb grant_cb); + nlm_granted_cb grant_cb, + rpcvers_t); static vnode_t *nlm_fh_to_vp(struct netobj *); static struct nlm_vhold *nlm_fh_to_vhold(struct nlm_host *, struct netobj *); @@ -314,6 +315,11 @@ nlm_do_notify2(nlm_sm_status *argp, void *res, struct svc_req *sr) * NLM_TEST, NLM_TEST_MSG, * NLM4_TEST, NLM4_TEST_MSG, * Client inquiry about locks, non-blocking. + * + * Arg cb is NULL for NLM_TEST, NLM4_TEST, and + * non-NULL for NLM_TEST_MSG, NLM4_TEST_MSG + * The MSG forms use the cb to send the reply, + * and don't return a reply for this call. */ void nlm_do_test(nlm4_testargs *argp, nlm4_testres *resp, @@ -455,10 +461,19 @@ out: * We also have to keep a list of locks (pending + granted) * both to handle retransmitted requests, and to keep the * vnodes for those locks active. + * + * Callback arguments: + * reply_cb Used to send a normal RPC reply just as if + * we had filled in a response for our caller. + * Needed because we do work after the reply. + * res_cb Used for the MSG calls, where there's no + * regular RPC response. + * grant_cb Used to CALL the client informing them of a + * granted lock after a "blocked" reply. */ void nlm_do_lock(nlm4_lockargs *argp, nlm4_res *resp, struct svc_req *sr, - nlm_reply_cb reply_cb, nlm_res_cb res_cb, nlm_testargs_cb grant_cb) + nlm_reply_cb reply_cb, nlm_res_cb res_cb, nlm_granted_cb grant_cb) { struct nlm_globals *g; struct flock64 fl; @@ -492,20 +507,18 @@ nlm_do_lock(nlm4_lockargs *argp, nlm4_res *resp, struct svc_req *sr, struct nlm_host *, host, nlm4_lockargs *, argp); /* - * If we may need to do _msg_ call needing an RPC - * callback, get the RPC client handle now, - * so we know if we can bind to the NLM service on - * this client. - * - * Note: host object carries transport type. - * One client using multiple transports gets - * separate sysids for each of its transports. + * If this is a MSG call (NLM_LOCK_MSG, NLM4_LOCK_MSG) + * we'll have res_cb != NULL, and we know we'll need an + * RPC client handle _now_ so we can send the response. + * If we can't get an rpc handle (rpcp) then we have + * no way to respond, and the client will time out. */ - if (res_cb != NULL || (grant_cb != NULL && argp->block == TRUE)) { + if (res_cb != NULL) { error = nlm_host_get_rpc(host, sr->rq_vers, &rpcp); if (error != 0) { + ASSERT(rpcp == NULL); status = nlm4_denied_nolocks; - goto doreply; + goto out; } } @@ -584,6 +597,8 @@ nlm_do_lock(nlm4_lockargs *argp, nlm4_res *resp, struct svc_req *sr, /* * OK, can detach this thread, so this call * will block below (after we reply). + * The "blocked" reply tells the client to + * expect a "granted" call-back later. */ status = nlm4_blocked; do_blocking = TRUE; @@ -655,11 +670,12 @@ doreply: * "detach" it from the RPC SVC pool, allowing it * to block indefinitely if needed. */ - ASSERT(rpcp != NULL); + ASSERT(grant_cb != NULL); (void) svc_detach_thread(sr->rq_xprt); - nlm_block(argp, host, nvp, rpcp, &fl, grant_cb); + nlm_block(argp, host, nvp, &fl, grant_cb, sr->rq_vers); } +out: DTRACE_PROBE3(lock__end, struct nlm_globals *, g, struct nlm_host *, host, nlm4_res *, resp); @@ -679,25 +695,26 @@ static void nlm_block(nlm4_lockargs *lockargs, struct nlm_host *host, struct nlm_vhold *nvp, - nlm_rpc_t *rpcp, struct flock64 *flp, - nlm_testargs_cb grant_cb) + nlm_granted_cb grant_cb, + rpcvers_t vers) { nlm4_testargs args; + nlm4_res res; int error; flk_callback_t flk_cb; struct nlm_block_cb_data cb_data; + nlm_rpc_t *rpcp = NULL; + enum clnt_stat status; /* * Keep a list of blocked locks on nh_pending, and use it * to cancel these threads in nlm_destroy_client_pending. * - * Check to see if this lock is already in the list - * and if not, add an entry for it. Allocate first, - * then if we don't insert, free the new one. - * Caller already has vp held. + * Check to see if this lock is already in the list. If so, + * some earlier call is already blocked getting this lock, + * so there's nothing more this call needs to do. */ - error = nlm_slreq_register(host, nvp, flp); if (error != 0) { /* @@ -710,9 +727,22 @@ nlm_block(nlm4_lockargs *lockargs, return; } + /* + * Make sure we can get an RPC client handle we can use to + * deliver the "granted" callback if/when we get the lock. + * If we can't, there's no point blocking to get the lock + * for them because they'll never find out about it. + */ + error = nlm_host_get_rpc(host, vers, &rpcp); + if (error != 0) { + (void) nlm_slreq_unregister(host, nvp, flp); + return; + } + cb_data.hostp = host; cb_data.nvp = nvp; cb_data.flp = flp; + cb_data.registered = TRUE; flk_init_callback(&flk_cb, nlm_block_callback, &cb_data); /* BSD: VOP_ADVLOCK(vp, NULL, F_SETLK, fl, F_REMOTE); */ @@ -720,23 +750,60 @@ nlm_block(nlm4_lockargs *lockargs, F_REMOTELOCK | FREAD | FWRITE, (u_offset_t)0, &flk_cb, CRED(), NULL); + /* + * If the nlm_block_callback didn't already do it... + */ + if (cb_data.registered) + (void) nlm_slreq_unregister(host, nvp, flp); + if (error != 0) { /* * We failed getting the lock, but have no way to * tell the client about that. Let 'em time out. */ - (void) nlm_slreq_unregister(host, nvp, flp); return; } - /* + * ... else we got the lock on behalf of this client. + * + * We MUST either tell the client about this lock + * (via the "granted" callback RPC) or unlock. + * * Do the "granted" call-back to the client. */ + bzero(&args, sizeof (args)); args.cookie = lockargs->cookie; args.exclusive = lockargs->exclusive; args.alock = lockargs->alock; + bzero(&res, sizeof (res)); + + /* + * Not using the NLM_INVOKE_CALLBACK() macro because + * we need to take actions on errors. + */ + status = (*grant_cb)(&args, &res, (rpcp)->nr_handle); + if (status != RPC_SUCCESS) { + struct rpc_err err; + + CLNT_GETERR((rpcp)->nr_handle, &err); + NLM_ERR("NLM: %s callback failed: " + "stat %d, err %d\n", "grant", status, + err.re_errno); + res.stat.stat = nlm4_failed; + } + if (res.stat.stat != nlm4_granted) { + /* + * Failed to deliver the granted callback, so + * the client doesn't know about this lock. + * Unlock the lock. The client will time out. + */ + (void) nlm_vop_frlock(nvp->nv_vp, F_UNLCK, flp, + F_REMOTELOCK | FREAD | FWRITE, + (u_offset_t)0, NULL, CRED(), NULL); + } + xdr_free((xdrproc_t)xdr_nlm4_res, (void *)&res); - NLM_INVOKE_CALLBACK("grant", rpcp, &args, grant_cb); + nlm_host_rele_rpc(host, rpcp); } /* @@ -756,6 +823,7 @@ nlm_block_callback(flk_cb_when_t when, void *data) if (when == FLK_AFTER_SLEEP) { (void) nlm_slreq_unregister(cb_data->hostp, cb_data->nvp, cb_data->flp); + cb_data->registered = FALSE; } return (0); diff --git a/usr/src/uts/common/os/strsubr.c b/usr/src/uts/common/os/strsubr.c index ac1ee2d1ce..1e18a0ce9e 100644 --- a/usr/src/uts/common/os/strsubr.c +++ b/usr/src/uts/common/os/strsubr.c @@ -28,6 +28,7 @@ * Copyright (c) 2016 by Delphix. All rights reserved. * Copyright 2018 Joyent, Inc. * Copyright 2018 OmniOS Community Edition (OmniOSce) Association. + * Copyright 2018 Joyent, Inc. */ #include <sys/types.h> diff --git a/usr/src/uts/i86pc/io/viona/viona.c b/usr/src/uts/i86pc/io/viona/viona.c new file mode 100644 index 0000000000..40bdd80a6e --- /dev/null +++ b/usr/src/uts/i86pc/io/viona/viona.c @@ -0,0 +1,1404 @@ +/* + * Copyright (c) 2013 Chris Torek <torek @ torek net> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * Copyright 2015 Pluribus Networks Inc. + */ + +#include <sys/conf.h> +#include <sys/file.h> +#include <sys/stat.h> +#include <sys/ddi.h> +#include <sys/sunddi.h> +#include <sys/sunndi.h> +#include <sys/sysmacros.h> +#include <sys/strsubr.h> +#include <sys/strsun.h> +#include <vm/seg_kmem.h> + +#include <sys/dls.h> +#include <sys/mac_client.h> + +#include <sys/viona_io.h> + +#define MB (1024UL * 1024) +#define GB (1024UL * MB) + +/* + * Min. octets in an ethernet frame minus FCS + */ +#define MIN_BUF_SIZE 60 + +#define VIONA_NAME "Virtio Network Accelerator" + +#define VIONA_CTL_MINOR 0 +#define VIONA_CTL_NODE_NAME "ctl" + +#define VIONA_CLI_NAME "viona" + +#define VTNET_MAXSEGS 32 + +#define VRING_ALIGN 4096 + +#define VRING_DESC_F_NEXT (1 << 0) +#define VRING_DESC_F_WRITE (1 << 1) +#define VRING_DESC_F_INDIRECT (1 << 2) + +#define VRING_AVAIL_F_NO_INTERRUPT 1 + +#define VRING_USED_F_NO_NOTIFY 1 + +#define BCM_NIC_DRIVER "bnxe" +/* + * Host capabilities + */ +#define VIRTIO_NET_F_MAC (1 << 5) /* host supplies MAC */ +#define VIRTIO_NET_F_MRG_RXBUF (1 << 15) /* host can merge RX buffers */ +#define VIRTIO_NET_F_STATUS (1 << 16) /* config status field available */ + +#define VIONA_S_HOSTCAPS \ + (VIRTIO_NET_F_MAC | VIRTIO_NET_F_MRG_RXBUF | \ + VIRTIO_NET_F_STATUS) + +#pragma pack(1) +struct virtio_desc { + uint64_t vd_addr; + uint32_t vd_len; + uint16_t vd_flags; + uint16_t vd_next; +}; +#pragma pack() + +#pragma pack(1) +struct virtio_used { + uint32_t vu_idx; + uint32_t vu_tlen; +}; +#pragma pack() + +#pragma pack(1) +struct virtio_net_mrgrxhdr { + uint8_t vrh_flags; + uint8_t vrh_gso_type; + uint16_t vrh_hdr_len; + uint16_t vrh_gso_size; + uint16_t vrh_csum_start; + uint16_t vrh_csum_offset; + uint16_t vrh_bufs; +}; +struct virtio_net_hdr { + uint8_t vrh_flags; + uint8_t vrh_gso_type; + uint16_t vrh_hdr_len; + uint16_t vrh_gso_size; + uint16_t vrh_csum_start; + uint16_t vrh_csum_offset; +}; +#pragma pack() + +typedef struct viona_vring_hqueue { + /* Internal state */ + uint16_t hq_size; + kmutex_t hq_a_mutex; + kmutex_t hq_u_mutex; + uint16_t hq_cur_aidx; /* trails behind 'avail_idx' */ + + /* Host-context pointers to the queue */ + caddr_t hq_baseaddr; + uint16_t *hq_avail_flags; + uint16_t *hq_avail_idx; /* monotonically increasing */ + uint16_t *hq_avail_ring; + + uint16_t *hq_used_flags; + uint16_t *hq_used_idx; /* monotonically increasing */ + struct virtio_used *hq_used_ring; +} viona_vring_hqueue_t; + + +typedef struct viona_link { + datalink_id_t l_linkid; + + struct vm *l_vm; + size_t l_vm_lomemsize; + caddr_t l_vm_lomemaddr; + size_t l_vm_himemsize; + caddr_t l_vm_himemaddr; + + mac_handle_t l_mh; + mac_client_handle_t l_mch; + + kmem_cache_t *l_desb_kmc; + + pollhead_t l_pollhead; + + viona_vring_hqueue_t l_rx_vring; + uint_t l_rx_intr; + + viona_vring_hqueue_t l_tx_vring; + kcondvar_t l_tx_cv; + uint_t l_tx_intr; + kmutex_t l_tx_mutex; + int l_tx_outstanding; + uint32_t l_features; +} viona_link_t; + +typedef struct { + frtn_t d_frtn; + viona_link_t *d_link; + uint_t d_ref; + uint16_t d_cookie; + int d_len; +} viona_desb_t; + +typedef struct viona_soft_state { + viona_link_t *ss_link; +} viona_soft_state_t; + +typedef struct used_elem { + uint16_t id; + uint32_t len; +} used_elem_t; + +static void *viona_state; +static dev_info_t *viona_dip; +static id_space_t *viona_minor_ids; +/* + * copy tx mbufs from virtio ring to avoid necessitating a wait + * for packet transmission to free resources. + */ +static boolean_t copy_tx_mblks = B_TRUE; + +extern struct vm *vm_lookup_by_name(char *name); +extern uint64_t vm_gpa2hpa(struct vm *vm, uint64_t gpa, size_t len); + +static int viona_attach(dev_info_t *dip, ddi_attach_cmd_t cmd); +static int viona_detach(dev_info_t *dip, ddi_detach_cmd_t cmd); +static int viona_open(dev_t *devp, int flag, int otype, cred_t *credp); +static int viona_close(dev_t dev, int flag, int otype, cred_t *credp); +static int viona_ioctl(dev_t dev, int cmd, intptr_t data, int mode, + cred_t *credp, int *rval); +static int viona_chpoll(dev_t dev, short events, int anyyet, short *reventsp, + struct pollhead **phpp); + +static int viona_ioc_create(viona_soft_state_t *ss, vioc_create_t *u_create); +static int viona_ioc_delete(viona_soft_state_t *ss); + +static int viona_vm_map(viona_link_t *link); +static caddr_t viona_gpa2kva(viona_link_t *link, uint64_t gpa); +static void viona_vm_unmap(viona_link_t *link); + +static int viona_ioc_rx_ring_init(viona_link_t *link, + vioc_ring_init_t *u_ri); +static int viona_ioc_tx_ring_init(viona_link_t *link, + vioc_ring_init_t *u_ri); +static int viona_ioc_rx_ring_reset(viona_link_t *link); +static int viona_ioc_tx_ring_reset(viona_link_t *link); +static void viona_ioc_rx_ring_kick(viona_link_t *link); +static void viona_ioc_tx_ring_kick(viona_link_t *link); +static int viona_ioc_rx_intr_clear(viona_link_t *link); +static int viona_ioc_tx_intr_clear(viona_link_t *link); + +static void viona_rx(void *arg, mac_resource_handle_t mrh, mblk_t *mp, + boolean_t loopback); +static void viona_tx(viona_link_t *link, viona_vring_hqueue_t *hq); + +static struct cb_ops viona_cb_ops = { + viona_open, + viona_close, + nodev, + nodev, + nodev, + nodev, + nodev, + viona_ioctl, + nodev, + nodev, + nodev, + viona_chpoll, + ddi_prop_op, + 0, + D_MP | D_NEW | D_HOTPLUG, + CB_REV, + nodev, + nodev +}; + +static struct dev_ops viona_ops = { + DEVO_REV, + 0, + nodev, + nulldev, + nulldev, + viona_attach, + viona_detach, + nodev, + &viona_cb_ops, + NULL, + ddi_power, + ddi_quiesce_not_needed +}; + +static struct modldrv modldrv = { + &mod_driverops, + VIONA_NAME, + &viona_ops, +}; + +static struct modlinkage modlinkage = { + MODREV_1, &modldrv, NULL +}; + +int +_init(void) +{ + int ret; + + ret = ddi_soft_state_init(&viona_state, + sizeof (viona_soft_state_t), 0); + if (ret == 0) { + ret = mod_install(&modlinkage); + if (ret != 0) { + ddi_soft_state_fini(&viona_state); + return (ret); + } + } + + return (ret); +} + +int +_fini(void) +{ + int ret; + + ret = mod_remove(&modlinkage); + if (ret == 0) { + ddi_soft_state_fini(&viona_state); + } + + return (ret); +} + +int +_info(struct modinfo *modinfop) +{ + return (mod_info(&modlinkage, modinfop)); +} + +static void +set_viona_tx_mode() +{ + major_t bcm_nic_major; + if ((bcm_nic_major = ddi_name_to_major(BCM_NIC_DRIVER)) + != DDI_MAJOR_T_NONE) { + if (ddi_hold_installed_driver(bcm_nic_major) != NULL) { + copy_tx_mblks = B_FALSE; + ddi_rele_driver(bcm_nic_major); + } + } +} + +static int +viona_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) +{ + if (cmd != DDI_ATTACH) { + return (DDI_FAILURE); + } + + viona_minor_ids = id_space_create("viona_minor_id", + VIONA_CTL_MINOR + 1, UINT16_MAX); + + if (ddi_create_minor_node(dip, VIONA_CTL_NODE_NAME, + S_IFCHR, VIONA_CTL_MINOR, DDI_PSEUDO, 0) != DDI_SUCCESS) { + return (DDI_FAILURE); + } + + viona_dip = dip; + + set_viona_tx_mode(); + ddi_report_dev(viona_dip); + + return (DDI_SUCCESS); +} + +static int +viona_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) +{ + if (cmd != DDI_DETACH) { + return (DDI_FAILURE); + } + + id_space_destroy(viona_minor_ids); + + ddi_remove_minor_node(viona_dip, NULL); + + viona_dip = NULL; + + return (DDI_SUCCESS); +} + +static int +viona_open(dev_t *devp, int flag, int otype, cred_t *credp) +{ + int minor; + + if (otype != OTYP_CHR) { + return (EINVAL); + } + + if (drv_priv(credp) != 0) { + return (EPERM); + } + + if (getminor(*devp) != VIONA_CTL_MINOR) { + return (ENXIO); + } + + minor = id_alloc(viona_minor_ids); + if (minor == 0) { + /* All minors are busy */ + return (EBUSY); + } + + if (ddi_soft_state_zalloc(viona_state, minor) != DDI_SUCCESS) { + id_free(viona_minor_ids, minor); + } + + *devp = makedevice(getmajor(*devp), minor); + + return (0); +} + +static int +viona_close(dev_t dev, int flag, int otype, cred_t *credp) +{ + int minor; + viona_soft_state_t *ss; + + if (otype != OTYP_CHR) { + return (EINVAL); + } + + if (drv_priv(credp) != 0) { + return (EPERM); + } + + minor = getminor(dev); + + ss = ddi_get_soft_state(viona_state, minor); + if (ss == NULL) { + return (ENXIO); + } + + viona_ioc_delete(ss); + + ddi_soft_state_free(viona_state, minor); + + id_free(viona_minor_ids, minor); + + return (0); +} + +static int +viona_ioctl(dev_t dev, int cmd, intptr_t data, int mode, + cred_t *credp, int *rval) +{ + viona_soft_state_t *ss; + int err = 0; + + ss = ddi_get_soft_state(viona_state, getminor(dev)); + if (ss == NULL) { + return (ENXIO); + } + + switch (cmd) { + case VNA_IOC_CREATE: + err = viona_ioc_create(ss, (vioc_create_t *)data); + break; + case VNA_IOC_DELETE: + err = viona_ioc_delete(ss); + break; + case VNA_IOC_SET_FEATURES: + if (ss->ss_link == NULL) { + return (ENOSYS); + } + ss->ss_link->l_features = *(int *)data & VIONA_S_HOSTCAPS; + break; + case VNA_IOC_GET_FEATURES: + if (ss->ss_link == NULL) { + return (ENOSYS); + } + *(int *)data = VIONA_S_HOSTCAPS; + break; + case VNA_IOC_RX_RING_INIT: + if (ss->ss_link == NULL) { + return (ENOSYS); + } + err = viona_ioc_rx_ring_init(ss->ss_link, + (vioc_ring_init_t *)data); + break; + case VNA_IOC_RX_RING_RESET: + if (ss->ss_link == NULL) { + return (ENOSYS); + } + err = viona_ioc_rx_ring_reset(ss->ss_link); + break; + case VNA_IOC_RX_RING_KICK: + if (ss->ss_link == NULL) { + return (ENOSYS); + } + viona_ioc_rx_ring_kick(ss->ss_link); + err = 0; + break; + case VNA_IOC_TX_RING_INIT: + if (ss->ss_link == NULL) { + return (ENOSYS); + } + err = viona_ioc_tx_ring_init(ss->ss_link, + (vioc_ring_init_t *)data); + break; + case VNA_IOC_TX_RING_RESET: + if (ss->ss_link == NULL) { + return (ENOSYS); + } + err = viona_ioc_tx_ring_reset(ss->ss_link); + break; + case VNA_IOC_TX_RING_KICK: + if (ss->ss_link == NULL) { + return (ENOSYS); + } + viona_ioc_tx_ring_kick(ss->ss_link); + err = 0; + break; + case VNA_IOC_RX_INTR_CLR: + if (ss->ss_link == NULL) { + return (ENOSYS); + } + err = viona_ioc_rx_intr_clear(ss->ss_link); + break; + case VNA_IOC_TX_INTR_CLR: + if (ss->ss_link == NULL) { + return (ENOSYS); + } + err = viona_ioc_tx_intr_clear(ss->ss_link); + break; + default: + err = ENOTTY; + break; + } + + return (err); +} + +static int +viona_chpoll(dev_t dev, short events, int anyyet, short *reventsp, + struct pollhead **phpp) +{ + viona_soft_state_t *ss; + + ss = ddi_get_soft_state(viona_state, getminor(dev)); + if (ss == NULL || ss->ss_link == NULL) { + return (ENXIO); + } + + *reventsp = 0; + + if (ss->ss_link->l_rx_intr && (events & POLLIN)) { + *reventsp |= POLLIN; + } + + if (ss->ss_link->l_tx_intr && (events & POLLOUT)) { + *reventsp |= POLLOUT; + } + + if (*reventsp == 0 && !anyyet) { + *phpp = &ss->ss_link->l_pollhead; + } + + return (0); +} + +static int +viona_ioc_create(viona_soft_state_t *ss, vioc_create_t *u_create) +{ + vioc_create_t k_create; + viona_link_t *link; + char cli_name[MAXNAMELEN]; + int err; + + if (ss->ss_link != NULL) { + return (ENOSYS); + } + if (copyin(u_create, &k_create, sizeof (k_create)) != 0) { + return (EFAULT); + } + + link = kmem_zalloc(sizeof (viona_link_t), KM_SLEEP); + + link->l_linkid = k_create.c_linkid; + link->l_vm = vm_lookup_by_name(k_create.c_vmname); + if (link->l_vm == NULL) { + err = ENXIO; + goto bail; + } + + link->l_vm_lomemsize = k_create.c_lomem_size; + link->l_vm_himemsize = k_create.c_himem_size; + err = viona_vm_map(link); + if (err != 0) { + goto bail; + } + + err = mac_open_by_linkid(link->l_linkid, &link->l_mh); + if (err != 0) { + cmn_err(CE_WARN, "viona create mac_open_by_linkid" + " returned %d\n", err); + goto bail; + } + + snprintf(cli_name, sizeof (cli_name), "%s-%d", + VIONA_CLI_NAME, link->l_linkid); + err = mac_client_open(link->l_mh, &link->l_mch, cli_name, 0); + if (err != 0) { + cmn_err(CE_WARN, "viona create mac_client_open" + " returned %d\n", err); + goto bail; + } + + link->l_features = VIONA_S_HOSTCAPS; + link->l_desb_kmc = kmem_cache_create(cli_name, + sizeof (viona_desb_t), 0, NULL, NULL, NULL, NULL, NULL, 0); + + mutex_init(&link->l_rx_vring.hq_a_mutex, NULL, MUTEX_DRIVER, NULL); + mutex_init(&link->l_rx_vring.hq_u_mutex, NULL, MUTEX_DRIVER, NULL); + mutex_init(&link->l_rx_vring.hq_a_mutex, NULL, MUTEX_DRIVER, NULL); + mutex_init(&link->l_tx_vring.hq_u_mutex, NULL, MUTEX_DRIVER, NULL); + if (copy_tx_mblks) { + mutex_init(&link->l_tx_mutex, NULL, MUTEX_DRIVER, NULL); + cv_init(&link->l_tx_cv, NULL, CV_DRIVER, NULL); + } + ss->ss_link = link; + + return (0); + +bail: + if (link->l_mch != NULL) { + mac_client_close(link->l_mch, 0); + } + if (link->l_mh != NULL) { + mac_close(link->l_mh); + } + + kmem_free(link, sizeof (viona_link_t)); + + return (err); +} + +static int +viona_ioc_delete(viona_soft_state_t *ss) +{ + viona_link_t *link; + + link = ss->ss_link; + if (link == NULL) { + return (ENOSYS); + } + if (copy_tx_mblks) { + mutex_enter(&link->l_tx_mutex); + while (link->l_tx_outstanding != 0) { + cv_wait(&link->l_tx_cv, &link->l_tx_mutex); + } + mutex_exit(&link->l_tx_mutex); + } + if (link->l_mch != NULL) { + mac_rx_clear(link->l_mch); + mac_client_close(link->l_mch, 0); + } + if (link->l_mh != NULL) { + mac_close(link->l_mh); + } + + viona_vm_unmap(link); + mutex_destroy(&link->l_tx_vring.hq_a_mutex); + mutex_destroy(&link->l_tx_vring.hq_u_mutex); + mutex_destroy(&link->l_rx_vring.hq_a_mutex); + mutex_destroy(&link->l_rx_vring.hq_u_mutex); + if (copy_tx_mblks) { + mutex_destroy(&link->l_tx_mutex); + cv_destroy(&link->l_tx_cv); + } + + kmem_cache_destroy(link->l_desb_kmc); + + kmem_free(link, sizeof (viona_link_t)); + + ss->ss_link = NULL; + + return (0); +} + +static caddr_t +viona_mapin_vm_chunk(viona_link_t *link, uint64_t gpa, size_t len) +{ + caddr_t addr; + size_t offset; + pfn_t pfnum; + + if (len == 0) + return (NULL); + + addr = vmem_alloc(heap_arena, len, VM_SLEEP); + if (addr == NULL) + return (NULL); + + for (offset = 0; offset < len; offset += PAGESIZE) { + pfnum = btop(vm_gpa2hpa(link->l_vm, gpa + offset, PAGESIZE)); + ASSERT(pfnum); + hat_devload(kas.a_hat, addr + offset, PAGESIZE, pfnum, + PROT_READ | PROT_WRITE, HAT_LOAD_LOCK); + } + + return (addr); +} + +/* + * Map the guest physical address space into the kernel virtual address space. + */ +static int +viona_vm_map(viona_link_t *link) +{ + link->l_vm_lomemaddr = viona_mapin_vm_chunk(link, + 0, link->l_vm_lomemsize); + if (link->l_vm_lomemaddr == NULL) + return (-1); + link->l_vm_himemaddr = viona_mapin_vm_chunk(link, + 4 * (1024 * 1024 * 1024UL), link->l_vm_himemsize); + if (link->l_vm_himemsize && link->l_vm_himemaddr == NULL) + return (-1); + + return (0); +} + +/* + * Translate a guest physical address into a kernel virtual address. + */ +static caddr_t +viona_gpa2kva(viona_link_t *link, uint64_t gpa) +{ + if (gpa < link->l_vm_lomemsize) + return (link->l_vm_lomemaddr + gpa); + + gpa -= (4 * GB); + if (gpa < link->l_vm_himemsize) + return (link->l_vm_himemaddr + gpa); + + return (NULL); +} + +static void +viona_vm_unmap(viona_link_t *link) +{ + if (link->l_vm_lomemaddr) { + hat_unload(kas.a_hat, link->l_vm_lomemaddr, + link->l_vm_lomemsize, HAT_UNLOAD_UNLOCK); + vmem_free(heap_arena, link->l_vm_lomemaddr, + link->l_vm_lomemsize); + } + if (link->l_vm_himemaddr) { + hat_unload(kas.a_hat, link->l_vm_himemaddr, + link->l_vm_himemsize, HAT_UNLOAD_UNLOCK); + vmem_free(heap_arena, link->l_vm_himemaddr, + link->l_vm_himemsize); + } +} + +static int +viona_ioc_ring_init_common(viona_link_t *link, viona_vring_hqueue_t *hq, + vioc_ring_init_t *u_ri) +{ + vioc_ring_init_t k_ri; + + if (copyin(u_ri, &k_ri, sizeof (k_ri)) != 0) { + return (EFAULT); + } + + hq->hq_size = k_ri.ri_qsize; + hq->hq_baseaddr = viona_gpa2kva(link, k_ri.ri_qaddr); + if (hq->hq_baseaddr == NULL) + return (EINVAL); + + hq->hq_avail_flags = (uint16_t *)(viona_gpa2kva(link, + k_ri.ri_qaddr + hq->hq_size * sizeof (struct virtio_desc))); + if (hq->hq_avail_flags == NULL) + return (EINVAL); + hq->hq_avail_idx = hq->hq_avail_flags + 1; + hq->hq_avail_ring = hq->hq_avail_flags + 2; + + hq->hq_used_flags = (uint16_t *)(viona_gpa2kva(link, + P2ROUNDUP(k_ri.ri_qaddr + + hq->hq_size * sizeof (struct virtio_desc) + 2, VRING_ALIGN))); + if (hq->hq_used_flags == NULL) + return (EINVAL); + hq->hq_used_idx = hq->hq_used_flags + 1; + hq->hq_used_ring = (struct virtio_used *)(hq->hq_used_flags + 2); + + /* + * Initialize queue indexes + */ + hq->hq_cur_aidx = 0; + + return (0); +} + +static int +viona_ioc_rx_ring_init(viona_link_t *link, vioc_ring_init_t *u_ri) +{ + viona_vring_hqueue_t *hq; + int rval; + + hq = &link->l_rx_vring; + + rval = viona_ioc_ring_init_common(link, hq, u_ri); + if (rval != 0) { + return (rval); + } + + return (0); +} + +static int +viona_ioc_tx_ring_init(viona_link_t *link, vioc_ring_init_t *u_ri) +{ + viona_vring_hqueue_t *hq; + + hq = &link->l_tx_vring; + + return (viona_ioc_ring_init_common(link, hq, u_ri)); +} + +static int +viona_ioc_ring_reset_common(viona_vring_hqueue_t *hq) +{ + /* + * Reset all soft state + */ + hq->hq_cur_aidx = 0; + + return (0); +} + +static int +viona_ioc_rx_ring_reset(viona_link_t *link) +{ + viona_vring_hqueue_t *hq; + + mac_rx_clear(link->l_mch); + + hq = &link->l_rx_vring; + + return (viona_ioc_ring_reset_common(hq)); +} + +static int +viona_ioc_tx_ring_reset(viona_link_t *link) +{ + viona_vring_hqueue_t *hq; + + hq = &link->l_tx_vring; + + return (viona_ioc_ring_reset_common(hq)); +} + +static void +viona_ioc_rx_ring_kick(viona_link_t *link) +{ + viona_vring_hqueue_t *hq = &link->l_rx_vring; + + atomic_or_16(hq->hq_used_flags, VRING_USED_F_NO_NOTIFY); + + mac_rx_set(link->l_mch, viona_rx, link); +} + +/* + * Return the number of available descriptors in the vring taking care + * of the 16-bit index wraparound. + */ +static inline int +viona_hq_num_avail(viona_vring_hqueue_t *hq) +{ + uint16_t ndesc; + + /* + * We're just computing (a-b) in GF(216). + * + * The only glitch here is that in standard C, + * uint16_t promotes to (signed) int when int has + * more than 16 bits (pretty much always now), so + * we have to force it back to unsigned. + */ + ndesc = (unsigned)*hq->hq_avail_idx - (unsigned)hq->hq_cur_aidx; + + ASSERT(ndesc <= hq->hq_size); + + return (ndesc); +} + +static void +viona_ioc_tx_ring_kick(viona_link_t *link) +{ + viona_vring_hqueue_t *hq = &link->l_tx_vring; + + do { + atomic_or_16(hq->hq_used_flags, VRING_USED_F_NO_NOTIFY); + while (viona_hq_num_avail(hq)) { + viona_tx(link, hq); + } + if (copy_tx_mblks) { + mutex_enter(&link->l_tx_mutex); + if (link->l_tx_outstanding != 0) { + cv_wait_sig(&link->l_tx_cv, &link->l_tx_mutex); + } + mutex_exit(&link->l_tx_mutex); + } + atomic_and_16(hq->hq_used_flags, ~VRING_USED_F_NO_NOTIFY); + } while (viona_hq_num_avail(hq)); +} + +static int +viona_ioc_rx_intr_clear(viona_link_t *link) +{ + link->l_rx_intr = 0; + + return (0); +} + +static int +viona_ioc_tx_intr_clear(viona_link_t *link) +{ + link->l_tx_intr = 0; + + return (0); +} +#define VQ_MAX_DESCRIPTORS 512 + +static int +vq_popchain(viona_link_t *link, viona_vring_hqueue_t *hq, struct iovec *iov, +int n_iov, uint16_t *cookie) +{ + int i; + int ndesc, nindir; + int idx, head, next; + struct virtio_desc *vdir, *vindir, *vp; + + idx = hq->hq_cur_aidx; + ndesc = (uint16_t)((unsigned)*hq->hq_avail_idx - (unsigned)idx); + + if (ndesc == 0) + return (0); + if (ndesc > hq->hq_size) { + cmn_err(CE_NOTE, "ndesc (%d) out of range\n", ndesc); + return (-1); + } + + head = hq->hq_avail_ring[idx & (hq->hq_size - 1)]; + next = head; + + for (i = 0; i < VQ_MAX_DESCRIPTORS; next = vdir->vd_next) { + if (next >= hq->hq_size) { + cmn_err(CE_NOTE, "descriptor index (%d)" + "out of range\n", next); + return (-1); + } + + vdir = (struct virtio_desc *)(hq->hq_baseaddr + + next * sizeof (struct virtio_desc)); + if ((vdir->vd_flags & VRING_DESC_F_INDIRECT) == 0) { + if (i > n_iov) + return (-1); + iov[i].iov_base = viona_gpa2kva(link, vdir->vd_addr); + if (iov[i].iov_base == NULL) { + cmn_err(CE_NOTE, "invalid guest physical" + " address 0x%"PRIx64"\n", vdir->vd_addr); + return (-1); + } + iov[i++].iov_len = vdir->vd_len; + } else { + nindir = vdir->vd_len / 16; + if ((vdir->vd_len & 0xf) || nindir == 0) { + cmn_err(CE_NOTE, "invalid indir len 0x%x\n", + vdir->vd_len); + return (-1); + } + vindir = (struct virtio_desc *) + viona_gpa2kva(link, vdir->vd_addr); + if (vindir == NULL) { + cmn_err(CE_NOTE, "invalid guest physical" + " address 0x%"PRIx64"\n", vdir->vd_addr); + return (-1); + } + next = 0; + for (;;) { + vp = &vindir[next]; + if (vp->vd_flags & VRING_DESC_F_INDIRECT) { + cmn_err(CE_NOTE, "indirect desc" + " has INDIR flag\n"); + return (-1); + } + if (i > n_iov) + return (-1); + iov[i].iov_base = + viona_gpa2kva(link, vp->vd_addr); + if (iov[i].iov_base == NULL) { + cmn_err(CE_NOTE, "invalid guest" + " physical address 0x%"PRIx64"\n", + vp->vd_addr); + return (-1); + } + iov[i++].iov_len = vp->vd_len; + + if (i > VQ_MAX_DESCRIPTORS) + goto loopy; + if ((vp->vd_flags & VRING_DESC_F_NEXT) == 0) + break; + + next = vp->vd_next; + if (next >= nindir) { + cmn_err(CE_NOTE, "invalid next" + " %d > %d\n", next, nindir); + return (-1); + } + } + } + if ((vdir->vd_flags & VRING_DESC_F_NEXT) == 0) { + *cookie = head; + hq->hq_cur_aidx++; + return (i); + } + } + +loopy: + cmn_err(CE_NOTE, "%d > descriptor loop count\n", i); + + return (-1); +} + +static void +vq_pushchain(viona_vring_hqueue_t *hq, uint32_t len, uint16_t cookie) +{ + struct virtio_used *vu; + int uidx; + + uidx = *hq->hq_used_idx; + vu = &hq->hq_used_ring[uidx++ & (hq->hq_size - 1)]; + vu->vu_idx = cookie; + vu->vu_tlen = len; + membar_producer(); + *hq->hq_used_idx = uidx; +} + +static void +vq_pushchain_mrgrx(viona_vring_hqueue_t *hq, int num_bufs, used_elem_t *elem) +{ + struct virtio_used *vu; + int uidx; + int i; + + uidx = *hq->hq_used_idx; + if (num_bufs == 1) { + vu = &hq->hq_used_ring[uidx++ & (hq->hq_size - 1)]; + vu->vu_idx = elem[0].id; + vu->vu_tlen = elem[0].len; + } else { + for (i = 0; i < num_bufs; i++) { + vu = &hq->hq_used_ring[(uidx + i) & (hq->hq_size - 1)]; + vu->vu_idx = elem[i].id; + vu->vu_tlen = elem[i].len; + } + uidx = uidx + num_bufs; + } + membar_producer(); + *hq->hq_used_idx = uidx; +} + +/* + * Copy bytes from mp to iov. + * copied_buf: Total num_bytes copied from mblk to iov array. + * buf: pointer to iov_base. + * i: index of iov array. Mainly used to identify if we are + * dealing with first iov array element. + * rxhdr_size: Virtio header size. Two possibilities in case + * of MRGRX buf, header has 2 additional bytes. + * In case of mrgrx, virtio header should be part of iov[0]. + * In case of non-mrgrx, virtio header may or may not be part + * of iov[0]. + */ +static int +copy_in_mblk(mblk_t *mp, int copied_buf, caddr_t buf, struct iovec *iov, + int i, int rxhdr_size) +{ + int copied_chunk = 0; + mblk_t *ml; + int total_buf_len = iov->iov_len; + /* + * iov[0] might have header, adjust + * total_buf_len accordingly + */ + if (i == 0) { + total_buf_len = iov->iov_len - rxhdr_size; + } + for (ml = mp; ml != NULL; ml = ml->b_cont) { + size_t chunk = MBLKL(ml); + /* + * If chunk is less than + * copied_buf we should move + * to correct msgblk + */ + if (copied_buf != 0) { + if (copied_buf < chunk) { + chunk -= copied_buf; + } else { + copied_buf -= chunk; + continue; + } + } + /* + * iov[0] already has virtio header. + * and if copied chunk is length of iov_len break + */ + if (copied_chunk == total_buf_len) { + break; + } + /* + * Sometimes chunk is total mblk len, sometimes mblk is + * divided into multiple chunks. + */ + if (chunk > copied_buf) { + if (chunk > copied_chunk) { + if ((chunk + copied_chunk) > total_buf_len) + chunk = (size_t)total_buf_len + - copied_chunk; + } else { + if (chunk > (total_buf_len - copied_chunk)) + chunk = (size_t)((total_buf_len + - copied_chunk) - chunk); + } + bcopy(ml->b_rptr + copied_buf, buf, chunk); + } else { + if (chunk > (total_buf_len - copied_chunk)) { + chunk = (size_t)(total_buf_len - copied_chunk); + } + bcopy(ml->b_rptr + copied_buf, buf, chunk); + } + buf += chunk; + copied_chunk += chunk; + } + return (copied_chunk); +} + +static void +viona_rx(void *arg, mac_resource_handle_t mrh, mblk_t *mp, + boolean_t loopback) +{ + viona_link_t *link = arg; + viona_vring_hqueue_t *hq = &link->l_rx_vring; + mblk_t *mp0 = mp; + + while (viona_hq_num_avail(hq)) { + struct iovec iov[VTNET_MAXSEGS]; + size_t mblklen; + int n, i = 0; + uint16_t cookie; + struct virtio_net_hdr *vrx; + struct virtio_net_mrgrxhdr *vmrgrx; + mblk_t *ml; + caddr_t buf; + int total_len = 0; + int copied_buf = 0; + int num_bufs = 0; + int num_pops = 0; + used_elem_t uelem[VTNET_MAXSEGS]; + + if (mp == NULL) { + break; + } + mblklen = msgsize(mp); + if (mblklen == 0) { + break; + } + + mutex_enter(&hq->hq_a_mutex); + n = vq_popchain(link, hq, iov, VTNET_MAXSEGS, &cookie); + mutex_exit(&hq->hq_a_mutex); + if (n <= 0) { + break; + } + num_pops++; + if (link->l_features & VIRTIO_NET_F_MRG_RXBUF) { + int total_n = n; + int mrgrxhdr_size = sizeof (struct virtio_net_mrgrxhdr); + /* + * Get a pointer to the rx header, and use the + * data immediately following it for the packet buffer. + */ + vmrgrx = (struct virtio_net_mrgrxhdr *)iov[0].iov_base; + if (n == 1) { + buf = iov[0].iov_base + mrgrxhdr_size; + } + while (mblklen > copied_buf) { + if (total_n == i) { + mutex_enter(&hq->hq_a_mutex); + n = vq_popchain(link, hq, &iov[i], + VTNET_MAXSEGS, &cookie); + mutex_exit(&hq->hq_a_mutex); + if (n <= 0) { + freemsgchain(mp0); + return; + } + num_pops++; + total_n += n; + } + if (total_n > i) { + int copied_chunk = 0; + if (i != 0) { + buf = iov[i].iov_base; + } + copied_chunk = copy_in_mblk(mp, + copied_buf, buf, &iov[i], i, + mrgrxhdr_size); + copied_buf += copied_chunk; + uelem[i].id = cookie; + uelem[i].len = copied_chunk; + if (i == 0) { + uelem[i].len += mrgrxhdr_size; + } + } + num_bufs++; + i++; + } + } else { + boolean_t virt_hdr_incl_iov = B_FALSE; + int rxhdr_size = sizeof (struct virtio_net_hdr); + /* First element is header */ + vrx = (struct virtio_net_hdr *)iov[0].iov_base; + if (n == 1 || iov[0].iov_len > rxhdr_size) { + buf = iov[0].iov_base + rxhdr_size; + virt_hdr_incl_iov = B_TRUE; + total_len += rxhdr_size; + if (iov[0].iov_len < rxhdr_size) { + // Buff too small to fit pkt. Drop it. + freemsgchain(mp0); + return; + } + } else { + total_len = iov[0].iov_len; + } + if (iov[0].iov_len == rxhdr_size) + i++; + while (mblklen > copied_buf) { + if (n > i) { + int copied_chunk = 0; + if (i != 0) { + buf = iov[i].iov_base; + } + /* + * In case of non-mrgrx buf, first + * descriptor always has header and + * rest of the descriptors have data. + * But it is not guaranteed that first + * descriptor will only have virtio + * header. It might also have data. + */ + if (virt_hdr_incl_iov) { + copied_chunk = copy_in_mblk(mp, + copied_buf, buf, &iov[i], + i, rxhdr_size); + } else { + copied_chunk = copy_in_mblk(mp, + copied_buf, buf, &iov[i], + i, 0); + } + copied_buf += copied_chunk; + total_len += copied_chunk; + } else { + /* + * Drop packet as it cant fit + * in buf provided by guest. + */ + freemsgchain(mp0); + return; + } + i++; + } + } + /* + * The only valid field in the rx packet header is the + * number of buffers, which is always 1 without TSO + * support. + */ + if (link->l_features & VIRTIO_NET_F_MRG_RXBUF) { + memset(vmrgrx, 0, sizeof (struct virtio_net_mrgrxhdr)); + vmrgrx->vrh_bufs = num_bufs; + /* + * Make sure iov[0].iov_len >= MIN_BUF_SIZE + * otherwise guest will consider it as invalid frame. + */ + if (num_bufs == 1 && uelem[0].len < MIN_BUF_SIZE) { + uelem[0].len = MIN_BUF_SIZE; + } + /* + * Release this chain and handle more chains. + */ + mutex_enter(&hq->hq_u_mutex); + vq_pushchain_mrgrx(hq, num_pops, uelem); + mutex_exit(&hq->hq_u_mutex); + } else { + memset(vrx, 0, sizeof (struct virtio_net_hdr)); + if (total_len < MIN_BUF_SIZE) { + total_len = MIN_BUF_SIZE; + } + /* + * Release this chain and handle more chains. + */ + mutex_enter(&hq->hq_u_mutex); + vq_pushchain(hq, total_len, cookie); + mutex_exit(&hq->hq_u_mutex); + } + + mp = mp->b_next; + } + + if ((*hq->hq_avail_flags & VRING_AVAIL_F_NO_INTERRUPT) == 0) { + if (atomic_cas_uint(&link->l_rx_intr, 0, 1) == 0) { + pollwakeup(&link->l_pollhead, POLLIN); + } + } + + freemsgchain(mp0); +} + +static void +viona_desb_free(viona_desb_t *dp) +{ + viona_link_t *link; + viona_vring_hqueue_t *hq; + struct virtio_used *vu; + int uidx; + uint_t ref; + + ref = atomic_dec_uint_nv(&dp->d_ref); + if (ref != 0) + return; + + link = dp->d_link; + hq = &link->l_tx_vring; + + mutex_enter(&hq->hq_u_mutex); + vq_pushchain(hq, dp->d_len, dp->d_cookie); + mutex_exit(&hq->hq_u_mutex); + + kmem_cache_free(link->l_desb_kmc, dp); + + if ((*hq->hq_avail_flags & VRING_AVAIL_F_NO_INTERRUPT) == 0) { + if (atomic_cas_uint(&link->l_tx_intr, 0, 1) == 0) { + pollwakeup(&link->l_pollhead, POLLOUT); + } + } + if (copy_tx_mblks) { + mutex_enter(&link->l_tx_mutex); + if (--link->l_tx_outstanding == 0) { + cv_broadcast(&link->l_tx_cv); + } + mutex_exit(&link->l_tx_mutex); + } +} + +static void +viona_tx(viona_link_t *link, viona_vring_hqueue_t *hq) +{ + struct iovec iov[VTNET_MAXSEGS]; + uint16_t cookie; + int i, n; + mblk_t *mp_head, *mp_tail, *mp; + viona_desb_t *dp; + mac_client_handle_t link_mch = link->l_mch; + + mp_head = mp_tail = NULL; + + mutex_enter(&hq->hq_a_mutex); + n = vq_popchain(link, hq, iov, VTNET_MAXSEGS, &cookie); + mutex_exit(&hq->hq_a_mutex); + ASSERT(n != 0); + + dp = kmem_cache_alloc(link->l_desb_kmc, KM_SLEEP); + dp->d_frtn.free_func = viona_desb_free; + dp->d_frtn.free_arg = (void *)dp; + dp->d_link = link; + dp->d_cookie = cookie; + + dp->d_ref = 0; + dp->d_len = iov[0].iov_len; + + for (i = 1; i < n; i++) { + dp->d_ref++; + dp->d_len += iov[i].iov_len; + if (copy_tx_mblks) { + mp = desballoc((uchar_t *)iov[i].iov_base, + iov[i].iov_len, BPRI_MED, &dp->d_frtn); + ASSERT(mp); + } else { + mp = allocb(iov[i].iov_len, BPRI_MED); + ASSERT(mp); + bcopy((uchar_t *)iov[i].iov_base, mp->b_wptr, + iov[i].iov_len); + } + mp->b_wptr += iov[i].iov_len; + if (mp_head == NULL) { + ASSERT(mp_tail == NULL); + mp_head = mp; + } else { + ASSERT(mp_tail != NULL); + mp_tail->b_cont = mp; + } + mp_tail = mp; + } + if (copy_tx_mblks == B_FALSE) { + viona_desb_free(dp); + } + if (copy_tx_mblks) { + mutex_enter(&link->l_tx_mutex); + link->l_tx_outstanding++; + mutex_exit(&link->l_tx_mutex); + } + mac_tx(link_mch, mp_head, 0, MAC_DROP_ON_NO_DESC, NULL); +} diff --git a/usr/src/uts/i86pc/io/vmm/offsets.in b/usr/src/uts/i86pc/io/vmm/offsets.in new file mode 100644 index 0000000000..4b1fe1d6b6 --- /dev/null +++ b/usr/src/uts/i86pc/io/vmm/offsets.in @@ -0,0 +1,72 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2014 Pluribus Networks Inc. + */ + +#include <sys/types.h> +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/cpuvar.h> + +#include <machine/pmap.h> + +#include <machine/vmm.h> +#include "intel/vmx_cpufunc.h" +#include "intel/vmx.h" + +vmxctx + tmpstktop VMXCTX_TMPSTKTOP + guest_rdi VMXCTX_GUEST_RDI + guest_rsi VMXCTX_GUEST_RSI + guest_rdx VMXCTX_GUEST_RDX + guest_rcx VMXCTX_GUEST_RCX + guest_r8 VMXCTX_GUEST_R8 + guest_r9 VMXCTX_GUEST_R9 + guest_rax VMXCTX_GUEST_RAX + guest_rbx VMXCTX_GUEST_RBX + guest_rbp VMXCTX_GUEST_RBP + guest_r10 VMXCTX_GUEST_R10 + guest_r11 VMXCTX_GUEST_R11 + guest_r12 VMXCTX_GUEST_R12 + guest_r13 VMXCTX_GUEST_R13 + guest_r14 VMXCTX_GUEST_R14 + guest_r15 VMXCTX_GUEST_R15 + guest_cr2 VMXCTX_GUEST_CR2 + host_r15 VMXCTX_HOST_R15 + host_r14 VMXCTX_HOST_R14 + host_r13 VMXCTX_HOST_R13 + host_r12 VMXCTX_HOST_R12 + host_rbp VMXCTX_HOST_RBP + host_rsp VMXCTX_HOST_RSP + host_rbx VMXCTX_HOST_RBX + host_rip VMXCTX_HOST_RIP + launch_error VMXCTX_LAUNCH_ERROR + +vmx VMX_SIZE + +\#define VM_SUCCESS 0 +\#define VM_FAIL_INVALID 1 +\#define VM_FAIL_VALID 2 + +\#define VMX_RETURN_DIRECT 0 +\#define VMX_RETURN_LONGJMP 1 +\#define VMX_RETURN_VMRESUME 2 +\#define VMX_RETURN_VMLAUNCH 3 +\#define VMX_RETURN_AST 4 + +cpu + cpu_thread + +_kthread + t_lwp + _tu._ts._t_astflag T_ASTFLAG diff --git a/usr/src/uts/i86pc/io/vmm/vmm_ipi.h b/usr/src/uts/i86pc/io/vmm/vmm_ipi.h new file mode 100644 index 0000000000..4dff03ba1f --- /dev/null +++ b/usr/src/uts/i86pc/io/vmm/vmm_ipi.h @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2011 NetApp, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: head/sys/amd64/vmm/vmm_ipi.h 260466 2014-01-09 03:25:54Z neel $ + */ + +#ifndef _VMM_IPI_H_ +#define _VMM_IPI_H_ + +#ifdef __FreeBSD__ +int vmm_ipi_alloc(void); +void vmm_ipi_free(int num); +#endif + +#endif diff --git a/usr/src/uts/i86pc/io/vmm/vmm_sol_mem.c b/usr/src/uts/i86pc/io/vmm/vmm_sol_mem.c new file mode 100644 index 0000000000..3bb5412d16 --- /dev/null +++ b/usr/src/uts/i86pc/io/vmm/vmm_sol_mem.c @@ -0,0 +1,111 @@ +/*- + * Copyright (c) 2011 NetApp, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: head/sys/amd64/vmm/vmm_mem.c 245678 2013-01-20 03:42:49Z neel $ + */ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * Copyright 2013 Pluribus Networks Inc. + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: head/sys/amd64/vmm/vmm_mem.c 245678 2013-01-20 03:42:49Z neel $"); + +#include <sys/param.h> +#include <sys/lock.h> +#include <sys/mutex.h> +#include <sys/systm.h> +#include <sys/malloc.h> +#include <sys/kernel.h> + +#include <vm/vm.h> +#include <machine/pmap.h> + +#include <sys/ddi.h> + +#include "vmm_util.h" +#include "vmm_mem.h" + +int +vmm_mem_init(void) +{ + return (0); +} + +vm_paddr_t +vmm_mem_alloc(size_t size) +{ + clock_t usec = 2 * 1000000; + vm_paddr_t pa; + caddr_t addr; + + if (size != PAGE_SIZE) + panic("vmm_mem_alloc: invalid allocation size %lu", size); + + while (usec > 0) { + if ((addr = kmem_zalloc(PAGE_SIZE, KM_NOSLEEP)) != NULL) { + ASSERT(((uintptr_t)addr & PAGE_MASK) == 0); + pa = vtophys((vm_offset_t)addr); + return (pa); + } + delay(drv_usectohz((clock_t)500000)); + usec -= 500000; + } + + return (NULL); +} + +void +vmm_mem_free(vm_paddr_t base, size_t length) +{ + page_t *pp; + + if (base & PAGE_MASK) { + panic("vmm_mem_free: base 0x%0lx must be aligned on a " + "0x%0x boundary\n", base, PAGE_SIZE); + } + + if (length != PAGE_SIZE) { + panic("vmm_mem_free: invalid length %lu", length); + } + + pp = page_numtopp_nolock(btop(base)); + kmem_free((void *)pp->p_offset, PAGE_SIZE); +} + +vm_paddr_t +vmm_mem_maxaddr(void) +{ + + return (ptob(physmax + 1)); +} diff --git a/usr/src/uts/i86pc/io/vmm/vmx_assym.s b/usr/src/uts/i86pc/io/vmm/vmx_assym.s new file mode 100644 index 0000000000..d84ca30275 --- /dev/null +++ b/usr/src/uts/i86pc/io/vmm/vmx_assym.s @@ -0,0 +1 @@ +#include "vmx_assym.h" diff --git a/usr/src/uts/i86pc/vm/seg_vmm.c b/usr/src/uts/i86pc/vm/seg_vmm.c index faebf9ac36..beb5e81d53 100644 --- a/usr/src/uts/i86pc/vm/seg_vmm.c +++ b/usr/src/uts/i86pc/vm/seg_vmm.c @@ -14,12 +14,15 @@ */ /* - * VM - Virtual-Machine-Memory segment + * segvmm - Virtual-Machine-Memory segment * * The vmm segment driver was designed for mapping regions of kernel memory * allocated to an HVM instance into userspace for manipulation there. It * draws direct lineage from the umap segment driver, but meant for larger * mappings with fewer restrictions. + * + * seg*k*vmm, in contrast, has mappings for every VMM into kas. We use its + * mappings here only to find the relevant PFNs in segvmm_fault_in(). */ @@ -93,7 +96,7 @@ static struct seg_ops segvmm_ops = { /* - * Create a kernel/user-mapped segment. + * Create a kernel/user-mapped segment. ->kaddr is the segkvmm mapping. */ int segvmm_create(struct seg **segpp, void *argsp) diff --git a/usr/src/uts/sparc/io/pciex/pcie_sparc.c b/usr/src/uts/sparc/io/pciex/pcie_sparc.c index de5def9f4a..1634078cbc 100644 --- a/usr/src/uts/sparc/io/pciex/pcie_sparc.c +++ b/usr/src/uts/sparc/io/pciex/pcie_sparc.c @@ -67,7 +67,7 @@ int pcie_plat_pwr_setup(dev_info_t *dip) { if (ddi_prop_create(DDI_DEV_T_NONE, dip, DDI_PROP_CANSLEEP, - "pm-want-child-notification?", NULL, NULL) != DDI_PROP_SUCCESS) { + "pm-want-child-notification?", NULL, 0) != DDI_PROP_SUCCESS) { PCIE_DBG("%s(%d): can't create pm-want-child-notification \n", ddi_driver_name(dip), ddi_get_instance(dip)); return (DDI_FAILURE); diff --git a/usr/src/uts/sparc/os/cpr_sparc.c b/usr/src/uts/sparc/os/cpr_sparc.c index 3dd44bb9e6..2b409b952a 100644 --- a/usr/src/uts/sparc/os/cpr_sparc.c +++ b/usr/src/uts/sparc/os/cpr_sparc.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * cpr functions for supported sparc platforms */ @@ -363,8 +361,8 @@ cpr_abbreviate_devpath(char *in_path, char *out_path) *out_path = '\0'; while ((cmpt = cpr_next_component(&position)) != NULL) { - pnode_t long_match = NULL; - pnode_t short_match = NULL; + pnode_t long_match = 0; + pnode_t short_match = 0; int short_hits = 0; char *name; char *prefix = cpr_get_prefix(cmpt); diff --git a/usr/src/uts/sun/io/dada/targets/dad.c b/usr/src/uts/sun/io/dada/targets/dad.c index b3be5f3ea5..c9e8b393b6 100644 --- a/usr/src/uts/sun/io/dada/targets/dad.c +++ b/usr/src/uts/sun/io/dada/targets/dad.c @@ -315,7 +315,7 @@ static struct cb_ops dcd_cb_ops = { 0, /* streamtab */ D_64BIT | D_MP | D_NEW, /* Driver compatibility flag */ CB_REV, /* cb_rev */ - dcdaread, /* async I/O read entry point */ + dcdaread, /* async I/O read entry point */ dcdawrite /* async I/O write entry point */ }; @@ -2255,7 +2255,7 @@ make_dcd_cmd(struct dcd_disk *un, struct buf *bp, int (*func)()) &p_lblksrt, NULL, NULL, - 0) != NULL) { + 0) != 0) { lblocks = 0; p_lblksrt = 0; } @@ -3041,7 +3041,7 @@ dcddump(dev_t dev, caddr_t addr, daddr_t blkno, int nblk) /* ARGSUSED3 */ static int dcdioctl(dev_t dev, int cmd, intptr_t arg, int flag, - cred_t *cred_p, int *rval_p) + cred_t *cred_p, int *rval_p) { auto int32_t data[512 / (sizeof (int32_t))]; struct dk_cinfo *info; @@ -3882,7 +3882,7 @@ static int dcd_write_deviceid(struct dcd_disk *un) { - int status; + int status; diskaddr_t blk; struct udcd_cmd ucmd; struct dcd_cmd cdb; @@ -4177,7 +4177,7 @@ dcd_validate_model_serial(char *str, int *retlen, int totallen) #ifndef lint void clean_print(dev_info_t *dev, char *label, uint_t level, - char *title, char *data, int len) + char *title, char *data, int len) { int i; char buf[256]; diff --git a/usr/src/uts/sun/io/sbusmem.c b/usr/src/uts/sun/io/sbusmem.c index c747c93dfc..1f0934707c 100644 --- a/usr/src/uts/sun/io/sbusmem.c +++ b/usr/src/uts/sun/io/sbusmem.c @@ -111,10 +111,6 @@ static struct modlinkage modlinkage = { static int sbmem_rw(dev_t, struct uio *, enum uio_rw, cred_t *); -#if !defined(lint) -static char sbusmem_initmsg[] = "sbusmem _init: sbusmem.c\t1.28\t08/19/2008\n"; -#endif - int _init(void) { @@ -206,7 +202,7 @@ sbmem_attach(dev_info_t *devi, ddi_attach_cmd_t cmd) } if (ddi_create_minor_node(devi, ident, S_IFCHR, instance, - DDI_PSEUDO, NULL) == DDI_FAILURE) { + DDI_PSEUDO, 0) == DDI_FAILURE) { kmem_free(ident, ilen); ddi_remove_minor_node(devi, NULL); ddi_soft_state_free(sbusmem_state_head, instance); @@ -279,15 +275,12 @@ sbmem_close(dev_t dev, int flag, int otyp, struct cred *cred) } static int -sbmem_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result) +sbmem_info(dev_info_t *dip __unused, ddi_info_cmd_t infocmd, void *arg, + void **result) { int instance, error = DDI_FAILURE; struct sbusmem_unit *un; -#if defined(lint) || defined(__lint) - dip = dip; -#endif /* lint || __lint */ - switch (infocmd) { case DDI_INFO_DEVT2DEVINFO: instance = getminor((dev_t)arg); @@ -328,7 +321,7 @@ sbmem_write(dev_t dev, struct uio *uio, cred_t *cred) } static int -sbmem_rw(dev_t dev, struct uio *uio, enum uio_rw rw, cred_t *cred) +sbmem_rw(dev_t dev, struct uio *uio, enum uio_rw rw, cred_t *cred __unused) { uint_t c; struct iovec *iov; @@ -338,10 +331,6 @@ sbmem_rw(dev_t dev, struct uio *uio, enum uio_rw rw, cred_t *cred) dev_info_t *dip; caddr_t reg; -#if defined(lint) || defined(__lint) - cred = cred; -#endif /* lint || __lint */ - instance = getminor(dev); if ((un = ddi_get_soft_state(sbusmem_state_head, instance)) == NULL) { return (ENXIO); @@ -383,15 +372,11 @@ sbmem_rw(dev_t dev, struct uio *uio, enum uio_rw rw, cred_t *cred) static int sbmem_devmap(dev_t dev, devmap_cookie_t dhp, offset_t off, size_t len, - size_t *maplen, uint_t model) + size_t *maplen, uint_t model __unused) { struct sbusmem_unit *un; int instance, error; -#if defined(lint) || defined(__lint) - model = model; -#endif /* lint || __lint */ - instance = getminor(dev); if ((un = ddi_get_soft_state(sbusmem_state_head, instance)) == NULL) { return (ENXIO); diff --git a/usr/src/uts/sun4/io/efcode/fcode.c b/usr/src/uts/sun4/io/efcode/fcode.c index 8610697835..eebe57bf7f 100644 --- a/usr/src/uts/sun4/io/efcode/fcode.c +++ b/usr/src/uts/sun4/io/efcode/fcode.c @@ -206,7 +206,7 @@ fc_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) fc_max_opens * sizeof (struct fc_state), KM_SLEEP); if (ddi_create_minor_node(dip, "fcode", S_IFCHR, - 0, DDI_PSEUDO, NULL) == DDI_FAILURE) { + 0, DDI_PSEUDO, 0) == DDI_FAILURE) { kmem_free(fc_states, fc_max_opens * sizeof (struct fc_state)); error = DDI_FAILURE; diff --git a/usr/src/uts/sun4/io/fpc/fpc-kstats.c b/usr/src/uts/sun4/io/fpc/fpc-kstats.c index 38a390031b..89949e9927 100644 --- a/usr/src/uts/sun4/io/fpc/fpc-kstats.c +++ b/usr/src/uts/sun4/io/fpc/fpc-kstats.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/sunddi.h> #include <sys/sunndi.h> @@ -281,7 +279,7 @@ fpc_dev_kstat(fire_perfcnt_t reg_group, uint8_t num_inst) (void) strncpy(dev_name, "tlu", sizeof (dev_name)); num_events = sizeof (fire_tlu_events) / sizeof (fi_kev_mask_t); num_events2 = sizeof (fire_tlu2_events) / - sizeof (fi_kev_mask_t); + sizeof (fi_kev_mask_t); fire_events = fire_tlu_events; fire_events2 = fire_tlu2_events; num_cntrs = NUM_TLU_COUNTERS; @@ -297,8 +295,7 @@ fpc_dev_kstat(fire_perfcnt_t reg_group, uint8_t num_inst) } for (i = 0; i < num_inst; i++) { - ksinfop = (fi_ksinfo_t *)kmem_zalloc(sizeof (fi_ksinfo_t), - KM_SLEEP); + ksinfop = kmem_zalloc(sizeof (fi_ksinfo_t), KM_SLEEP); ksinfop->pic_num_events = num_events; ksinfop->pic_reg_group = reg_group; @@ -361,7 +358,7 @@ fpc_dev_kstat(fire_perfcnt_t reg_group, uint8_t num_inst) /* create counter kstats */ ksinfop->cntr_ksp = fpc_create_cntr_kstat(dev_name, i, - fpc_cntr_kstat_update, ksinfop, num_cntrs); + fpc_cntr_kstat_update, ksinfop, num_cntrs); if (ksinfop->cntr_ksp == NULL) goto err; @@ -384,7 +381,7 @@ fpc_create_name_kstat(char *name, fi_ksinfo_t *pp, fi_kev_mask_t *ev, for (i = base; i < (base + num_cntrs); i++) { pp->pic_name_ksp[i] = fpc_create_picN_kstat(name, i, - pp->pic_sel_shift[i], pp->pic_num_events, ev); + pp->pic_sel_shift[i], pp->pic_num_events, ev); if (pp->pic_name_ksp[i] == NULL) return (FAILURE); @@ -408,7 +405,7 @@ fpc_create_picN_kstat(char *mod_name, int pic, int pic_sel_shift, int num_ev, (void) snprintf(pic_name, sizeof (pic_name), "pic%d", pic); if ((picN_ksp = kstat_create(mod_name, 0, pic_name, - "bus", KSTAT_TYPE_NAMED, num_ev, NULL)) == NULL) { + "bus", KSTAT_TYPE_NAMED, num_ev, 0)) == NULL) { cmn_err(CE_WARN, "%s %s : kstat create failed", mod_name, pic_name); return (NULL); @@ -423,7 +420,7 @@ fpc_create_picN_kstat(char *mod_name, int pic, int pic_sel_shift, int num_ev, */ for (event = 0; event < num_ev - 1; event++) { pic_named_data[event].value.ui64 = - (ev_array[event].pcr_mask << pic_sel_shift); + (ev_array[event].pcr_mask << pic_sel_shift); kstat_named_init(&pic_named_data[event], ev_array[event].event_name, KSTAT_DATA_UINT64); @@ -433,7 +430,7 @@ fpc_create_picN_kstat(char *mod_name, int pic, int pic_sel_shift, int num_ev, * add the clear_pic entry */ pic_named_data[event].value.ui64 = - (uint64_t)~(ev_array[event].pcr_mask << pic_sel_shift); + (uint64_t)~(ev_array[event].pcr_mask << pic_sel_shift); kstat_named_init(&pic_named_data[event], ev_array[event].event_name, KSTAT_DATA_UINT64); @@ -471,7 +468,7 @@ fpc_create_cntr_kstat(char *name, int instance, int (*update)(kstat_t *, int), if ((counters_ksp = kstat_create(name, instance, "counters", "bus", KSTAT_TYPE_NAMED, num_pics + 1, KSTAT_FLAG_WRITABLE)) == NULL) { cmn_err(CE_WARN, "kstat_create for %s%d failed", - name, instance); + name, instance); return (NULL); } diff --git a/usr/src/uts/sun4/io/trapstat.c b/usr/src/uts/sun4/io/trapstat.c index 4f99221bc0..75e5dab413 100644 --- a/usr/src/uts/sun4/io/trapstat.c +++ b/usr/src/uts/sun4/io/trapstat.c @@ -151,14 +151,14 @@ * Globals. (The complete mapping can be found in the UltraSPARC I&II User's * Manual.) * - * Note that the sets of globals are per trap _type_, not per trap _level_. + * Note that the sets of globals are per trap _type_, not per trap _level_. * Thus, when executing a TL>0 trap handler, one may not have registers * available (for example, both trap-instruction traps and spill traps execute * on the alternate globals; if a trap-instruction trap induces a window spill, * the window spill handler has no available globals). For trapstat, this is * problematic: a register is required to transfer control from one arbitrary * location (in the interposing trap table) to another (in the actual trap - * table). + * table). * * We solve this problem by exploiting the trap table's location at the bottom * of valid kernel memory (i.e. at KERNELBASE). We locate the interposing trap @@ -173,7 +173,7 @@ * Actual trap table: * * +--------------------------------+- 2ff - * | | . + * | | . * | Non-trap instruction, TL>0 | . <-----------------------+ * | | . <-----------------------|-+ * |- - - - - - - - - - - - - - - - +- 200 <-----------------------|-|-+ @@ -323,11 +323,11 @@ * * To accurately determine the amount of time spent executing the TLB miss * handler, one must get a timestamp on trap entry and trap exit, subtract the - * latter from the former, and add the result to an accumulating count. + * latter from the former, and add the result to an accumulating count. * Consider flow of control during normal TLB miss processing (where "ldx * [%g2], %g2" is an arbitrary TLB-missing instruction): - * - * + - - - - - - - -+ + * + * + - - - - - - - -+ * : : * : ldx [%g2], %g2 :<-------------------------------------------------------+ * : : Return from trap: | @@ -357,10 +357,10 @@ * As the above diagram indicates, interposing on the trap table allows one * only to determine a timestamp on trap _entry_: when the TLB miss handler * has completed filling the TLB, a "retry" will be issued, and control will - * transfer immediately back to the missing %pc. + * transfer immediately back to the missing %pc. * * To obtain a timestamp on trap exit, we must then somehow interpose between - * the "retry" and the subsequent control transfer to the TLB-missing + * the "retry" and the subsequent control transfer to the TLB-missing * instruction. To do this, we _push_ a trap level. The basic idea is to * spoof a TLB miss by raising TL, setting the %tpc to be within text * controlled by trapstat (the "TLB return entry") and branching to the @@ -371,7 +371,7 @@ * Here is the above TLB miss flow control diagram modified to reflect * trapstat's operation: * - * + - - - - - - - -+ + * + - - - - - - - -+ * : : * : ldx [%g2], %g2 :<-------------------------------------------------------+ * : : Return from trap: | @@ -928,8 +928,8 @@ trapstat_enable() cpu_t *cp = CPU; cp->cpu_m.cpu_tstat_flags |= TSTAT_TLB_STATS; - (void) hv_set_ctx0(NULL, NULL); - (void) hv_set_ctxnon0(NULL, NULL); + (void) hv_set_ctx0(0, 0); + (void) hv_set_ctxnon0(0, 0); } } #endif @@ -1114,7 +1114,7 @@ trapstat_tlbretent(tstat_percpu_t *tcpu, tstat_tlbretent_t *ret, static const uint32_t retent[TSTAT_TLBRET_NINSTR] = { #ifndef sun4v 0x87410000, /* rd %tick, %g3 */ - 0x03000000, /* sethi %hi(stat), %g1 */ + 0x03000000, /* sethi %hi(stat), %g1 */ 0x82106000, /* or %g1, %lo(stat), %g1 */ 0x89297001, /* sllx %g5, 1, %g4 */ 0x8931303e, /* srlx %g4, 62, %g4 */ @@ -1129,19 +1129,19 @@ trapstat_tlbretent(tstat_percpu_t *tcpu, tstat_tlbretent_t *ret, 0xc4586000, /* ldx [%g1 + tmiss_count], %g2 */ 0x8400a001, /* add %g2, 1, %g2 */ 0xc4706000, /* stx %g2, [%g1 + tmiss_count] */ - 0x0d000000, /* sethi %hi(tdata_tmptick), %g6 */ - 0xc459a000, /* ldx [%g6 + %lo(tdata_tmptick)], %g2 */ + 0x0d000000, /* sethi %hi(tdata_tmptick), %g6 */ + 0xc459a000, /* ldx [%g6 + %lo(tdata_tmptick)], %g2 */ 0x8620c002, /* sub %g3, %g2, %g3 */ 0xc4586000, /* ldx [%g1 + tmiss_time], %g2 */ 0x84008003, /* add %g2, %g3, %g2 */ 0xc4706000, /* stx %g2, [%g1 + tmiss_time] */ 0x83f00000 /* retry */ #else /* sun4v */ - 0x82102008, /* mov SCRATCHPAD_CPUID, %g1 */ + 0x82102008, /* mov SCRATCHPAD_CPUID, %g1 */ 0xced84400, /* ldxa [%g1]ASI_SCRATCHPAD, %g7 */ 0x8f29f000, /* sllx %g7, TSTAT_DATA_SHIFT, %g7 */ 0x87410000, /* rd %tick, %g3 */ - 0x03000000, /* sethi %hi(stat), %g1 */ + 0x03000000, /* sethi %hi(stat), %g1 */ 0x82004007, /* add %g1, %g7, %g1 */ 0x82106000, /* or %g1, %lo(stat), %g1 */ 0x8929703d, /* sllx %g5, 61, %g4 */ @@ -1151,9 +1151,9 @@ trapstat_tlbretent(tstat_percpu_t *tcpu, tstat_tlbretent_t *ret, 0xc4586000, /* ldx [%g1 + tmiss_count], %g2 */ 0x8400a001, /* add %g2, 1, %g2 */ 0xc4706000, /* stx %g2, [%g1 + tmiss_count] */ - 0x0d000000, /* sethi %hi(tdata_tmptick), %g6 */ + 0x0d000000, /* sethi %hi(tdata_tmptick), %g6 */ 0x8c018007, /* add %g6, %g7, %g6 */ - 0xc459a000, /* ldx [%g6 + %lo(tdata_tmptick)], %g2 */ + 0xc459a000, /* ldx [%g6 + %lo(tdata_tmptick)], %g2 */ 0x8620c002, /* sub %g3, %g2, %g3 */ 0xc4586000, /* ldx [%g1 + tmiss_time], %g2 */ 0x84008003, /* add %g2, %g3, %g2 */ @@ -1291,7 +1291,7 @@ trapstat_tlbent(tstat_percpu_t *tcpu, int entno) */ static const uint32_t tlbent[] = { #ifndef sun4v - 0x03000000, /* sethi %hi(stat), %g1 */ + 0x03000000, /* sethi %hi(stat), %g1 */ 0xc4586000, /* ldx [%g1 + %lo(stat)], %g2 */ 0x8400a001, /* add %g2, 1, %g2 */ 0xc4706000, /* stx %g2, [%g1 + %lo(stat)] */ @@ -1309,14 +1309,14 @@ trapstat_tlbent(tstat_percpu_t *tcpu, int entno) 0xc2d80000, /* ldxa [%g0]ASI_MMU, %g1 */ 0x83307030, /* srlx %g1, CTXSHIFT, %g1 */ 0x02c04004, /* brz,pn %g1, .+0x10 */ - 0x03000000, /* sethi %hi(new_tpc), %g1 */ + 0x03000000, /* sethi %hi(new_tpc), %g1 */ 0x82106000, /* or %g1, %lo(new_tpc), %g1 */ 0x30800002, /* ba,a .+0x8 */ 0x82106000, /* or %g1, %lo(new_tpc), %g1 */ 0x81904000, /* wrpr %g1, %g0, %tpc */ 0x82006004, /* add %g1, 4, %g1 */ 0x83904000, /* wrpr %g1, %g0, %tnpc */ - 0x03000000, /* sethi %hi(tmptick), %g1 */ + 0x03000000, /* sethi %hi(tmptick), %g1 */ 0x85410000, /* rd %tick, %g2 */ 0xc4706000, /* stx %g2, [%g1 + %lo(tmptick)] */ 0x30800000, /* ba,a addr */ @@ -1325,7 +1325,7 @@ trapstat_tlbent(tstat_percpu_t *tcpu, int entno) 0x82102008, /* mov SCRATCHPAD_CPUID, %g1 */ 0xc8d84400, /* ldxa [%g1]ASI_SCRATCHPAD, %g4 */ 0x89293000, /* sllx %g4, TSTAT_DATA_SHIFT, %g4 */ - 0x03000000, /* sethi %hi(stat), %g1 */ + 0x03000000, /* sethi %hi(stat), %g1 */ 0x82004004, /* add %g1, %g4, %g1 */ 0xc4586000, /* ldx [%g1 + %lo(stat)], %g2 */ 0x8400a001, /* add %g2, 1, %g2 */ @@ -1347,14 +1347,14 @@ trapstat_tlbent(tstat_percpu_t *tcpu, int entno) 0xc2d80400, /* ldxa [%g0]ASI_SCRATCHPAD, %g1 */ 0xc2586000, /* ldx [%g1 + MMFSA_?_CTX], %g1 */ 0x02c04004, /* brz,pn %g1, .+0x10 */ - 0x03000000, /* sethi %hi(new_tpc), %g1 */ + 0x03000000, /* sethi %hi(new_tpc), %g1 */ 0x82106000, /* or %g1, %lo(new_tpc), %g1 */ 0x30800002, /* ba,a .+0x8 */ 0x82106000, /* or %g1, %lo(new_tpc), %g1 */ 0x81904000, /* wrpr %g1, %g0, %tpc */ 0x82006004, /* add %g1, 4, %g1 */ 0x83904000, /* wrpr %g1, %g0, %tnpc */ - 0x03000000, /* sethi %hi(tmptick), %g1 */ + 0x03000000, /* sethi %hi(tmptick), %g1 */ 0x82004004, /* add %g1, %g4, %g1 */ 0x85410000, /* rd %tick, %g2 */ 0xc4706000, /* stx %g2, [%g1 + %lo(tmptick)] */ @@ -1505,7 +1505,7 @@ trapstat_make_traptab(tstat_percpu_t *tcpu) * back before branching to the actual trap table entry. */ static const uint32_t enabled[TSTAT_ENT_NINSTR] = { - 0x03000000, /* sethi %hi(stat), %g1 */ + 0x03000000, /* sethi %hi(stat), %g1 */ 0xc4586000, /* ldx [%g1 + %lo(stat)], %g2 */ 0x8400a001, /* add %g2, 1, %g2 */ 0xc4706000, /* stx %g2, [%g1 + %lo(stat)] */ @@ -1617,9 +1617,9 @@ trapstat_make_traptab(tstat_percpu_t *tcpu) * the interposing trap table. */ static const uint32_t enabled[TSTAT_ENT_NINSTR] = { - 0x03000000, /* sethi %hi(stat), %g1 */ + 0x03000000, /* sethi %hi(stat), %g1 */ 0x82106000, /* or %g1, %lo[stat), %g1 */ - 0x05000000, /* sethi %hi(addr), %g2 */ + 0x05000000, /* sethi %hi(addr), %g2 */ 0x8410a000, /* or %g2, %lo(addr), %g2 */ 0x86102008, /* mov ASI_SCRATCHPAD_CPUID, %g3 */ 0xc6d8c400, /* ldxa [%g3]ASI_SCRATCHPAD, %g3 */ @@ -1628,7 +1628,7 @@ trapstat_make_traptab(tstat_percpu_t *tcpu) }; static const uint32_t enabled_cont[TSTAT_ENT_NINSTR] = { - 0xc8584003, /* ldx [%g1 + %g3], %g4 */ + 0xc8584003, /* ldx [%g1 + %g3], %g4 */ 0x88012001, /* add %g4, 1, %g4 */ 0x81c08000, /* jmp %g2 */ 0xc8704003, /* stx %g4, [%g1 + %g3] */ diff --git a/usr/src/uts/sun4u/adm1026/Makefile b/usr/src/uts/sun4u/adm1026/Makefile index f3d51c0215..abe50e2bda 100755 --- a/usr/src/uts/sun4u/adm1026/Makefile +++ b/usr/src/uts/sun4u/adm1026/Makefile @@ -22,8 +22,6 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#pragma ident "%Z%%M% %I% %E% SMI" -# # This makefile drives the production of the adm1026 driver kernel module # # sun4u implementation architecture dependent @@ -37,9 +35,8 @@ UTSBASE = ../.. # # Define the module and object file sets. # -MODULE = adm1026 +MODULE = adm1026 OBJECTS = $(ADM1026_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(ADM1026_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) # @@ -47,25 +44,16 @@ ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) # include $(UTSBASE)/sun4u/Makefile.sun4u -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) LDFLAGS += -dy -N misc/i2c_svc -# compile time debug flag - - # # Define targets # ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) .KEEP_STATE: - all: $(ALL_DEPS) def: $(DEF_DEPS) @@ -74,12 +62,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # Include common targets. diff --git a/usr/src/uts/sun4u/boston/Makefile b/usr/src/uts/sun4u/boston/Makefile index 77a8dbdc0a..417eb3a663 100644 --- a/usr/src/uts/sun4u/boston/Makefile +++ b/usr/src/uts/sun4u/boston/Makefile @@ -46,12 +46,8 @@ 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 # @@ -59,9 +55,7 @@ check := TARGET= check # .KEEP_STATE: -def all clean clean.lint clobber modlist: $(BOSTON_KMODS) - -modlintlib: $(BOSTON_KMODS) +def all clean clobber modlist: $(BOSTON_KMODS) install: $(ROOT_BOSTON_DIR) \ $(USR_BOSTON_DIR) \ @@ -74,24 +68,6 @@ install: $(ROOT_BOSTON_DIR) \ check install_h: -lint: modlintlib - -# -# The 'lint.platmod' target lints the boston 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/boston.c. -# -LINT_LIBS = $(LINT_LIB) \ - -L$(BOSTON_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) "\nBoston Platform-dependent module: global crosschecks:" - @-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.2) - $(BOSTON_KMODS): FRC @cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET) diff --git a/usr/src/uts/sun4u/boston/os/boston.c b/usr/src/uts/sun4u/boston/os/boston.c index 119e5d2f7b..2862266b10 100644 --- a/usr/src/uts/sun4u/boston/os/boston.c +++ b/usr/src/uts/sun4u/boston/os/boston.c @@ -51,7 +51,7 @@ int (*rmc_req_now)(rmc_comm_msg_t *, uint8_t) = NULL; void startup_platform(void) { - mutex_init(&mi2cv_mutex, NULL, NULL, NULL); + mutex_init(&mi2cv_mutex, NULL, MUTEX_ADAPTIVE, NULL); } int diff --git a/usr/src/uts/sun4u/cheetah/Makefile b/usr/src/uts/sun4u/cheetah/Makefile index d9a17fd409..cd92def8df 100644 --- a/usr/src/uts/sun4u/cheetah/Makefile +++ b/usr/src/uts/sun4u/cheetah/Makefile @@ -41,7 +41,6 @@ UTSBASE = ../.. # MODULE = SUNW,UltraSPARC-III OBJECTS = $(CHEETAH_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(CHEETAH_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_CPU_DIR)/$(MODULE) ROOTSOFTLINKS = $(SOFTLINKS:%=$(ROOT_PSM_CPU_DIR)/%) @@ -62,15 +61,9 @@ CLEANFILES += $(CPULIB) $(SYM_MOD) # Define targets # ALL_TARGET = $(SYM_MOD) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = def $(BINARY) $(ROOTMODULE) $(ROOTSOFTLINKS) # -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) - -# # cpu-module-specific flags # CPPFLAGS += -DCPU_MODULE -DCHEETAH @@ -89,12 +82,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) $(CPULIB): $(OBJECTS) @@ -112,17 +99,6 @@ $(ROOTSOFTLINKS): $(ROOTMODULE) # include $(UTSBASE)/sun4u/Makefile.targ -# -# 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_STATIC_UNUSED -LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV - CERRWARN += -_gcc=-Wno-parentheses CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits diff --git a/usr/src/uts/sun4u/cherrystone/Makefile b/usr/src/uts/sun4u/cherrystone/Makefile index 415c9b4021..1fdf3597a7 100644 --- a/usr/src/uts/sun4u/cherrystone/Makefile +++ b/usr/src/uts/sun4u/cherrystone/Makefile @@ -23,8 +23,6 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" -# # This makefile drives the production of all Cherrystone system # dependent modules for the sun4u architecture. # @@ -45,12 +43,8 @@ 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 # @@ -58,15 +52,13 @@ check := TARGET= check # .KEEP_STATE: -def all clean.lint clean clobber modlist: $(CHERRYSTONE_KMODS) - -modlintlib: $(CHERRYSTONE_KMODS) +def all clean clobber modlist: $(CHERRYSTONE_KMODS) IMPLEMENTED_PLATFORM = SUNW,Sun-Fire-480R LINKED_PLATFORMS = SUNW,Sun-Fire-V490 -install: $(ROOT_CHERRYSTONE_DIR) $(USR_CHERRYSTONE_DIR) \ +install: $(ROOT_CHERRYSTONE_DIR) $(USR_CHERRYSTONE_DIR) \ $(USR_CHERRYSTONE_INC_DIR) \ $(USR_CHERRYSTONE_SBIN_DIR) \ $(USR_CHERRYSTONE_LIB_DIR) \ @@ -85,18 +77,6 @@ $(CHERRYSTONE_CRYPTO_LINKS): $(ROOT_CHERRYSTONE_CRYPTO_DIR_64) $(SYMLINK) $(ROOT_US3_CRYPTO_LINK)/$@ \ $(ROOT_CHERRYSTONE_CRYPTO_DIR_64)/$@ -lint: modlintlib - -LINT_LIBS = $(LINT_LIB) \ - -L$(CHERRYSTONE_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) "\nCherrystone Platform-dependent module: global crosschecks:" - @-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.2) - $(CHERRYSTONE_KMODS): FRC @cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET) diff --git a/usr/src/uts/sun4u/cherrystone/os/cherrystone.c b/usr/src/uts/sun4u/cherrystone/os/cherrystone.c index 5b24d1a3da..1baeda6b35 100644 --- a/usr/src/uts/sun4u/cherrystone/os/cherrystone.c +++ b/usr/src/uts/sun4u/cherrystone/os/cherrystone.c @@ -101,7 +101,7 @@ startup_platform(void) extern int disable_watchdog_on_exit; disable_watchdog_on_exit = 1; - mutex_init(&cherry_pcf8584_mutex, NULL, NULL, NULL); + mutex_init(&cherry_pcf8584_mutex, NULL, MUTEX_ADAPTIVE, NULL); } #pragma weak mmu_init_large_pages @@ -295,14 +295,15 @@ plat_discover_slice(pfn_t pfn, pfn_t *first, pfn_t *last) /*ARGSUSED*/ void plat_freelist_process(int mnode) -{} +{ +} /* * Called for each board/cpu/PA range detected in plat_fill_mc(). */ static void update_mem_bounds(int boardid, int cpuid, int bankid, - uint64_t base, uint64_t size) + uint64_t base, uint64_t size) { uint64_t end; int mnode; diff --git a/usr/src/uts/sun4u/chicago/Makefile b/usr/src/uts/sun4u/chicago/Makefile index 683b077445..8795f4f948 100644 --- a/usr/src/uts/sun4u/chicago/Makefile +++ b/usr/src/uts/sun4u/chicago/Makefile @@ -22,8 +22,6 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# # uts/sun4u/chicago/Makefile # # This makefile drives the production of the sun4u chicago platform @@ -48,12 +46,8 @@ 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 # @@ -61,9 +55,7 @@ check := TARGET= check # .KEEP_STATE: -def all clean clean.lint clobber modlist: $(CHICAGO_KMODS) - -modlintlib: $(CHICAGO_KMODS) +def all clean clobber modlist: $(CHICAGO_KMODS) install: $(ROOT_CHICAGO_DIR) \ $(USR_CHICAGO_DIR) \ @@ -75,24 +67,6 @@ install: $(ROOT_CHICAGO_DIR) \ check install_h: -lint: modlintlib - -# -# The 'lint.platmod' target lints the chicago 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/chicago.c. -# -LINT_LIBS = $(LINT_LIB) \ - -L$(CHICAGO_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) "\nChicago Platform-dependent module: global crosschecks:" - @-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.2) - $(CHICAGO_KMODS): FRC @cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET) diff --git a/usr/src/uts/sun4u/chicago/io/fpc/fpc-impl-4u.c b/usr/src/uts/sun4u/chicago/io/fpc/fpc-impl-4u.c index 850501397a..aa96f19079 100644 --- a/usr/src/uts/sun4u/chicago/io/fpc/fpc-impl-4u.c +++ b/usr/src/uts/sun4u/chicago/io/fpc/fpc-impl-4u.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/file.h> #include <sys/sunndi.h> #include <sys/sunddi.h> @@ -189,8 +187,7 @@ bad_regs_length: if (regs_p) kmem_free(regs_p, regs_length); bad_regs_p: - if (platform_specific_data) - kmem_free(platform_specific_data, sizeof (fire4u_specific_t)); + kmem_free(platform_specific_data, sizeof (fire4u_specific_t)); if (nodename) kmem_free(nodename, nodename_size); diff --git a/usr/src/uts/sun4u/chicago/os/chicago.c b/usr/src/uts/sun4u/chicago/os/chicago.c index f1cfc84bfe..205e940eba 100644 --- a/usr/src/uts/sun4u/chicago/os/chicago.c +++ b/usr/src/uts/sun4u/chicago/os/chicago.c @@ -23,8 +23,6 @@ * 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> @@ -53,7 +51,7 @@ static void get_ebus_rtc_vaddr(void); void startup_platform(void) { - mutex_init(&chicago_mi2cv_mutex, NULL, NULL, NULL); + mutex_init(&chicago_mi2cv_mutex, NULL, MUTEX_ADAPTIVE, NULL); } int diff --git a/usr/src/uts/sun4u/cpr/Makefile b/usr/src/uts/sun4u/cpr/Makefile index af9b3a9635..69438cd16a 100644 --- a/usr/src/uts/sun4u/cpr/Makefile +++ b/usr/src/uts/sun4u/cpr/Makefile @@ -47,10 +47,6 @@ OBJECTS = $(CPR_FIRST_OBJS:%=$(OBJS_DIR)/%) \ $(CPR_IMPL_OBJS:%=$(OBJS_DIR)/%) \ $(CPR_OBJS:%=$(OBJS_DIR)/%) \ $(CPR_SPARC_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(CPR_FIRST_OBJS:%.o=$(LINTS_DIR)/%.ln) \ - $(CPR_OBJS:%.o=$(LINTS_DIR)/%.ln) \ - $(CPR_IMPL_OBJS:%.o=$(LINTS_DIR)/%.ln) \ - $(CPR_SPARC_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_MISC_DIR)/$(MODULE) # @@ -66,29 +62,13 @@ include $(UTSBASE)/sun4u/Makefile.sun4u # Define targets # ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) - -# # Depends on bootdev # LDFLAGS += -dy -N misc/bootdev -# -# 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_PTRDIFF_OVERFLOW -LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON -LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN - CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-label CERRWARN += $(CNOWARN_UNINIT) @@ -108,12 +88,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # diff --git a/usr/src/uts/sun4u/cpu/us3_common.c b/usr/src/uts/sun4u/cpu/us3_common.c index 22477e2a4c..38a06c2731 100644 --- a/usr/src/uts/sun4u/cpu/us3_common.c +++ b/usr/src/uts/sun4u/cpu/us3_common.c @@ -1418,7 +1418,8 @@ cpu_log_fast_ecc_error(caddr_t tpc, int priv, int tl, uint64_t ceen, */ if ((t_afsr_errs & (C_AFSR_UCU | C_AFSR_L3_UCU)) && aflt->flt_panic == 0 && aflt->flt_priv != 0 && - curthread->t_ontrap == NULL && curthread->t_lofault == NULL) { + curthread->t_ontrap == NULL && + curthread->t_lofault == (uintptr_t)NULL) { get_cpu_error_state(&cpu_error_regs); if (IS_PANTHER(cpunodes[CPU->cpu_id].implementation)) { aflt->flt_panic |= @@ -4549,7 +4550,7 @@ cpu_error_to_resource_type(struct async_flt *aflt) */ static void cpu_payload_add_aflt(struct async_flt *aflt, nvlist_t *payload, - nvlist_t *resource, int *afar_status, int *synd_status) + nvlist_t *resource, int *afar_status, int *synd_status) { ch_async_flt_t *ch_flt = (ch_async_flt_t *)aflt; *synd_status = AFLT_STAT_INVALID; @@ -5351,7 +5352,7 @@ afsr_to_synd_status(uint_t cpuid, uint64_t afsr, uint64_t afsr_bit) void sticksync_slave(void) { - int i; + int i; int tries = 0; int64_t tskew; int64_t av_tskew; @@ -5494,7 +5495,7 @@ cpu_uninit_private(struct cpu *cp) ASSERT(chprp); cpu_uninit_ecache_scrub_dr(cp); CPU_PRIVATE(cp) = NULL; - ch_err_tl1_paddrs[cp->cpu_id] = NULL; + ch_err_tl1_paddrs[cp->cpu_id] = 0; kmem_cache_free(ch_private_cache, chprp); cmp_delete_cpu(cp->cpu_id); @@ -6175,8 +6176,8 @@ cpu_check_ce_errors(void *arg) * * flag == SCRUBBER_CEEN_CHECK * called from memscrubber, just check/scrub, no reset - * paddr physical addr. for start of scrub pages - * vaddr virtual addr. for scrub area + * paddr physical addr. for start of scrub pages + * vaddr virtual addr. for scrub area * psz page size of area to be scrubbed * * flag == TIMEOUT_CEEN_CHECK @@ -6316,9 +6317,9 @@ cpu_ce_delayed_ec_logout(uint64_t afar) void cpu_ce_detected(ch_cpu_errors_t *cpu_error_regs, int flag) { - ch_async_flt_t ch_flt; + ch_async_flt_t ch_flt; struct async_flt *aflt; - char pr_reason[MAX_REASON_STRING]; + char pr_reason[MAX_REASON_STRING]; bzero(&ch_flt, sizeof (ch_async_flt_t)); ch_flt.flt_trapped_ce = flag; @@ -6356,8 +6357,8 @@ cpu_log_and_clear_ce(ch_async_flt_t *ch_flt) struct async_flt *aflt; uint64_t afsr, afsr_errs; ch_cpu_logout_t *clop; - char pr_reason[MAX_REASON_STRING]; - on_trap_data_t *otp = curthread->t_ontrap; + char pr_reason[MAX_REASON_STRING]; + on_trap_data_t *otp = curthread->t_ontrap; aflt = (struct async_flt *)ch_flt; afsr = aflt->flt_stat; @@ -7017,7 +7018,7 @@ fpras_failure(int op, int how) * ie, don't panic for copyin, copyout, kcopy and bcopy called * under on_fault and do panic for unprotected bcopy and hwblkpagecopy. */ - aflt->flt_panic = (curthread->t_lofault == NULL); + aflt->flt_panic = (curthread->t_lofault == (uintptr_t)NULL); /* * XOR the source instruction block with the copied instruction diff --git a/usr/src/uts/sun4u/daktari/Makefile b/usr/src/uts/sun4u/daktari/Makefile index 2e5a318a1f..9a2a3f02c0 100644 --- a/usr/src/uts/sun4u/daktari/Makefile +++ b/usr/src/uts/sun4u/daktari/Makefile @@ -23,9 +23,6 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# -#ident "%Z%%M% %I% %E% SMI" -# # This makefile drives the production of all Daktari system # dependent modules for the sun4u architecture. # @@ -47,12 +44,8 @@ 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 # @@ -60,15 +53,13 @@ check := TARGET= check # .KEEP_STATE: -def all clean.lint clean clobber modlist: $(DAKTARI_KMODS) - -modlintlib: $(DAKTARI_KMODS) +def all clean clobber modlist: $(DAKTARI_KMODS) IMPLEMENTED_PLATFORM = SUNW,Sun-Fire-880 LINKED_PLATFORMS = SUNW,Sun-Fire-V890 -install: $(ROOT_DAKTARI_DIR) $(USR_DAKTARI_DIR) \ +install: $(ROOT_DAKTARI_DIR) $(USR_DAKTARI_DIR) \ $(USR_DAKTARI_INC_DIR) \ $(USR_DAKTARI_SBIN_DIR) \ $(USR_DAKTARI_LIB_DIR) \ @@ -86,25 +77,6 @@ $(DAKTARI_CRYPTO_LINKS): $(ROOT_DAKTARI_CRYPTO_DIR_64) install_h check: FRC @cd sys; pwd; $(MAKE) $(TARGET) - -lint: modlintlib - -# -# The 'lint.platmod' target lints the daktari 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/daktari.c. -# -LINT_LIBS = $(LINT_LIB) \ - -L$(DAKTARI_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) "\nDaktari Platform-dependent module: global crosschecks:" - @-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.2) - $(DAKTARI_KMODS): FRC @cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET) diff --git a/usr/src/uts/sun4u/daktari/io/hpc3130_dak.c b/usr/src/uts/sun4u/daktari/io/hpc3130_dak.c index a0247ea880..47e9b8ac2b 100644 --- a/usr/src/uts/sun4u/daktari/io/hpc3130_dak.c +++ b/usr/src/uts/sun4u/daktari/io/hpc3130_dak.c @@ -336,7 +336,7 @@ hpc3130_get(intptr_t arg, int reg, hpc3130_unit_t *unitp, int mode) i2c_transfer_t *i2c_tran_pointer; int err = DDI_SUCCESS; - if (arg == NULL) { + if (arg == (intptr_t)NULL) { D2CMN_ERR((CE_WARN, "ioctl: arg passed in to " "ioctl = NULL")); return (EINVAL); @@ -380,7 +380,7 @@ hpc3130_set(intptr_t arg, int reg, hpc3130_unit_t *unitp, int mode) int err = DDI_SUCCESS; uint8_t passin_byte; - if (arg == NULL) { + if (arg == (intptr_t)NULL) { D2CMN_ERR((CE_WARN, "ioctl: arg passed in to " "ioctl = NULL")); return (EINVAL); @@ -413,11 +413,11 @@ hpc3130_set(intptr_t arg, int reg, hpc3130_unit_t *unitp, int mode) static int hpc3130_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp, - int *rvalp) + int *rvalp) { _NOTE(ARGUNUSED(credp, rvalp)) hpc3130_unit_t *unitp; - int err = DDI_SUCCESS; + int err = DDI_SUCCESS; i2c_transfer_t *i2c_tran_pointer; i2c_reg_t ioctl_reg; int port = MINOR_TO_PORT(getminor(dev)); @@ -522,7 +522,7 @@ hpc3130_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp, break; case I2C_GET_REG: - if (arg == NULL) { + if (arg == (intptr_t)NULL) { D2CMN_ERR((CE_WARN, "ioctl: arg passed in to " "ioctl = NULL")); err = EINVAL; @@ -566,7 +566,7 @@ hpc3130_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp, break; case I2C_SET_REG: - if (arg == NULL) { + if (arg == (intptr_t)NULL) { D2CMN_ERR((CE_WARN, "ioctl: arg passed in to " "ioctl = NULL")); err = EINVAL; @@ -581,7 +581,7 @@ hpc3130_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp, } (void) i2c_transfer_alloc(unitp->hpc3130_hdl, &i2c_tran_pointer, 2, 0, I2C_SLEEP); - if (i2c_tran_pointer == NULL) { + if (i2c_tran_pointer == NULL) { D2CMN_ERR((CE_WARN, "Failed in I2C_GET_REG " "i2c_tran_pointer not allocated")); err = ENOMEM; @@ -685,11 +685,11 @@ hpc3130_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp, } static int -hpc3130_poll(dev_t dev, short events, int anyyet, short - *reventsp, struct pollhead **phpp) +hpc3130_poll(dev_t dev, short events, int anyyet, short *reventsp, + struct pollhead **phpp) { _NOTE(ARGUNUSED(events)) - hpc3130_unit_t *unitp; + hpc3130_unit_t *unitp; int port = MINOR_TO_PORT(getminor(dev)); int instance = MINOR_TO_INST(getminor(dev)); @@ -983,7 +983,7 @@ hpc3130_do_attach(dev_info_t *dip) minor_number = INST_TO_MINOR(instance) | PORT_TO_MINOR(I2C_PORT(i)); if (ddi_create_minor_node(dip, name, S_IFCHR, minor_number, - "ddi_i2c:controller", NULL) == DDI_FAILURE) { + "ddi_i2c:controller", 0) == DDI_FAILURE) { D1CMN_ERR((CE_WARN, "ddi_create_minor_node failed " "for %s", name)); ddi_remove_intr(dip, 0u, @@ -1112,7 +1112,7 @@ hpc3130_set_led(hpc3130_unit_t *unitp, int slot, int led, uint8_t value) int hpc3130_get_led(i2c_client_hdl_t handle, int slot, - int led, uint8_t *value) + int led, uint8_t *value) { uint8_t temp; @@ -1126,7 +1126,7 @@ hpc3130_get_led(i2c_client_hdl_t handle, int slot, static int hpc3130_write(i2c_client_hdl_t handle, uint8_t offset, - uint8_t port, uint8_t data) + uint8_t port, uint8_t data) { ASSERT(port < HPC3130_MAX_SLOT); ASSERT(handle); @@ -1137,7 +1137,7 @@ hpc3130_write(i2c_client_hdl_t handle, uint8_t offset, static int hpc3130_read(i2c_client_hdl_t handle, uint8_t offset, - uint8_t port, uint8_t *data) + uint8_t port, uint8_t *data) { ASSERT(port < HPC3130_MAX_SLOT); ASSERT(handle); @@ -1148,7 +1148,7 @@ hpc3130_read(i2c_client_hdl_t handle, uint8_t offset, static int hpc3130_rw(i2c_client_hdl_t handle, uint8_t reg, - boolean_t write, uint8_t *data) + boolean_t write, uint8_t *data) { i2c_transfer_t *i2c_tran_pointer; int err; @@ -1201,7 +1201,7 @@ hpc3130_rw(i2c_client_hdl_t handle, uint8_t reg, */ static int hpc3130_init(dev_info_t *dip, - struct tuple *init_sequence) + struct tuple *init_sequence) { int slot; @@ -1445,7 +1445,7 @@ out: static int hpc3130_debounce_status(i2c_client_hdl_t handle, - int slot, uint8_t *status) + int slot, uint8_t *status) { int count, limit; uint8_t old; @@ -1484,7 +1484,7 @@ hpc3130_debounce_status(i2c_client_hdl_t handle, static int hpc3130_slot_connect(caddr_t ops_arg, hpc_slot_t slot_hdl, - void *data, uint_t flags) + void *data, uint_t flags) { _NOTE(ARGUNUSED(slot_hdl, data, flags)) uint8_t control; @@ -1673,7 +1673,7 @@ out: static int hpc3130_slot_disconnect(caddr_t ops_arg, hpc_slot_t slot_hdl, - void *data, uint_t flags) + void *data, uint_t flags) { _NOTE(ARGUNUSED(slot_hdl, data, flags)) uint8_t control; @@ -1800,7 +1800,7 @@ out: static int hpc3130_verify_slot_power(hpc3130_unit_t *hpc3130_p, i2c_client_hdl_t handle, - uint8_t offset, char *phys_slot, boolean_t slot_target_state) + uint8_t offset, char *phys_slot, boolean_t slot_target_state) { uint8_t tries = 0; uint8_t status; @@ -1870,7 +1870,7 @@ hpc3130_verify_slot_power(hpc3130_unit_t *hpc3130_p, i2c_client_hdl_t handle, static int hpc3130_slot_insert(caddr_t ops_arg, hpc_slot_t slot_hdl, - void *data, uint_t flags) + void *data, uint_t flags) { _NOTE(ARGUNUSED(ops_arg, slot_hdl, data, flags)) return (HPC_ERR_NOTSUPPORTED); @@ -1878,7 +1878,7 @@ hpc3130_slot_insert(caddr_t ops_arg, hpc_slot_t slot_hdl, static int hpc3130_slot_remove(caddr_t ops_arg, hpc_slot_t slot_hdl, - void *data, uint_t flags) + void *data, uint_t flags) { _NOTE(ARGUNUSED(ops_arg, slot_hdl, data, flags)) return (HPC_ERR_NOTSUPPORTED); @@ -1886,7 +1886,7 @@ hpc3130_slot_remove(caddr_t ops_arg, hpc_slot_t slot_hdl, static int hpc3130_slot_control(caddr_t ops_arg, hpc_slot_t slot_hdl, - int request, caddr_t arg) + int request, caddr_t arg) { _NOTE(ARGUNUSED(slot_hdl)) i2c_client_hdl_t handle; @@ -2049,9 +2049,9 @@ hpc3130_lookup_slot(char *nexus, int pcidev) { int i = 0; - while ((slot_translate[i].pcidev != pcidev || - strcmp(nexus, slot_translate[i].nexus) != 0) && - i < HPC3130_LOOKUP_SLOTS) + while (i < HPC3130_LOOKUP_SLOTS && + (slot_translate[i].pcidev != pcidev || + strcmp(nexus, slot_translate[i].nexus) != 0)) i++; ASSERT(i != HPC3130_LOOKUP_SLOTS); return (i); diff --git a/usr/src/uts/sun4u/db21554/Makefile b/usr/src/uts/sun4u/db21554/Makefile index ef3d37f0f3..79b523ba96 100644 --- a/usr/src/uts/sun4u/db21554/Makefile +++ b/usr/src/uts/sun4u/db21554/Makefile @@ -41,7 +41,6 @@ UTSBASE = ../.. # MODULE = db21554 OBJECTS = $(DB21554_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(DB21554_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) # @@ -53,18 +52,12 @@ include $(UTSBASE)/sun4u/Makefile.sun4u # Define targets # ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # Turn this on once compiler understands v9 in it's backend #INLINES += $(UTSBASE)/sun4u/io/pci.il # -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) - -# # Turn on doubleword alignment for 64 bit registers # CFLAGS += -dalign @@ -79,13 +72,6 @@ CFLAGS += -DPCI_HOTPLUG # LDFLAGS += -dy -Nmisc/pcihp -# -# 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 - CERRWARN += -_gcc=-Wno-parentheses CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-type-limits @@ -102,12 +88,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # diff --git a/usr/src/uts/sun4u/excalibur/Makefile b/usr/src/uts/sun4u/excalibur/Makefile index 9c110d7809..ea5b6dc325 100644 --- a/usr/src/uts/sun4u/excalibur/Makefile +++ b/usr/src/uts/sun4u/excalibur/Makefile @@ -24,8 +24,6 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#pragma ident "%Z%%M% %I% %E% SMI" -# # This makefile drives the production of the sun4u excalibur platform # module. # @@ -48,12 +46,8 @@ 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 # @@ -61,9 +55,7 @@ check := TARGET= check # .KEEP_STATE: -def all clean clean.lint clobber modlist: $(EXCALIBUR_KMODS) - -modlintlib: $(EXCALIBUR_KMODS) +def all clean clobber modlist: $(EXCALIBUR_KMODS) install: $(ROOT_EXCALIBUR_DIR) \ $(USR_EXCALIBUR_DIR) \ @@ -75,24 +67,6 @@ install: $(ROOT_EXCALIBUR_DIR) \ check install_h: -lint: modlintlib - -# -# The 'lint.platmod' target lints the excalibur 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/excalibur.c. -# -LINT_LIBS = $(LINT_LIB) \ - -L$(EXCALIBUR_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) "\nExcalibur Platform-dependent module: global crosschecks:" - @-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.2) - $(EXCALIBUR_KMODS): FRC @cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET) diff --git a/usr/src/uts/sun4u/excalibur/io/xcalwd.c b/usr/src/uts/sun4u/excalibur/io/xcalwd.c index a712ae5102..62cb0aaa70 100644 --- a/usr/src/uts/sun4u/excalibur/io/xcalwd.c +++ b/usr/src/uts/sun4u/excalibur/io/xcalwd.c @@ -196,7 +196,7 @@ _info(struct modinfo *modinfop) /*ARGSUSED*/ static int xcalwd_getinfo(dev_info_t *dip, ddi_info_cmd_t cmd, - void *arg, void **resultp) + void *arg, void **resultp) { int retval; dev_t dev = (dev_t)arg; @@ -255,7 +255,7 @@ xcalwd_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) } if (ddi_create_minor_node(dip, MINOR_DEVICE_NAME, - S_IFCHR, instance, DDI_PSEUDO, NULL) == DDI_FAILURE) { + S_IFCHR, instance, DDI_PSEUDO, 0) == DDI_FAILURE) { cmn_err(CE_WARN, "create minor node failed\n"); return (DDI_FAILURE); } @@ -396,7 +396,7 @@ xcalwd_close(dev_t dev, int flag, int otyp, cred_t *credp) /*ARGSUSED*/ static int xcalwd_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, - cred_t *cred_p, int *rvalp) + cred_t *cred_p, int *rvalp) { int instance; xcalwd_state_t *tsp; diff --git a/usr/src/uts/sun4u/excalibur/os/excalibur.c b/usr/src/uts/sun4u/excalibur/os/excalibur.c index 2727e25ac3..9dd7b33a13 100644 --- a/usr/src/uts/sun4u/excalibur/os/excalibur.c +++ b/usr/src/uts/sun4u/excalibur/os/excalibur.c @@ -24,8 +24,6 @@ * 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> @@ -66,7 +64,7 @@ static xcalfan_info_t xcalfans[] = { void startup_platform(void) { - mutex_init(&excal_pcf8584_mutex, NULL, NULL, NULL); + mutex_init(&excal_pcf8584_mutex, NULL, MUTEX_ADAPTIVE, NULL); } int @@ -185,7 +183,7 @@ plat_get_mem_unum(int synd_code, uint64_t flt_addr, int flt_bus_id, { if (flt_in_memory && (p2get_mem_unum != NULL)) return (p2get_mem_unum(synd_code, P2ALIGN(flt_addr, 8), - buf, buflen, lenp)); + buf, buflen, lenp)); else return (ENOTSUP); } diff --git a/usr/src/uts/sun4u/gpio_87317/Makefile b/usr/src/uts/sun4u/gpio_87317/Makefile index 86374e2b13..a0962484f3 100644 --- a/usr/src/uts/sun4u/gpio_87317/Makefile +++ b/usr/src/uts/sun4u/gpio_87317/Makefile @@ -39,9 +39,8 @@ UTSBASE = ../.. # # Define the module and object file sets. # -MODULE = gpio_87317 +MODULE = gpio_87317 OBJECTS = $(GPIO_87317_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(GPIO_87317_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) # @@ -52,14 +51,9 @@ include $(UTSBASE)/sun4u/Makefile.sun4u # # Define targets # -ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint +ALL_TARGET = $(BINARY) INSTALL_TARGET = $(BINARY) $(ROOTMODULE) -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses # @@ -75,16 +69,9 @@ 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/Makefile.targ - diff --git a/usr/src/uts/sun4u/grover/io/grfans.c b/usr/src/uts/sun4u/grover/io/grfans.c index 73219668da..0f8e397b4a 100644 --- a/usr/src/uts/sun4u/grover/io/grfans.c +++ b/usr/src/uts/sun4u/grover/io/grfans.c @@ -215,7 +215,7 @@ grfans_do_attach(dev_info_t *dip) if (ddi_create_minor_node(dip, "cpu_fan", S_IFCHR, DEVINST_TO_MINOR(instance) | CHANNEL_TO_MINOR(CPU_FAN_CHANNEL), - FANS_NODE_TYPE, NULL) == DDI_FAILURE) { + FANS_NODE_TYPE, 0) == DDI_FAILURE) { cmn_err(CE_WARN, "%s ddi_create_minor_node failed" " for cpu fan", name); ddi_regs_map_free(&unitp->cpufan_rhandle); @@ -228,7 +228,7 @@ grfans_do_attach(dev_info_t *dip) if (ddi_create_minor_node(dip, "sys_fan", S_IFCHR, DEVINST_TO_MINOR(instance) | CHANNEL_TO_MINOR(SYSTEM_FAN_CHANNEL), - FANS_NODE_TYPE, NULL) == DDI_FAILURE) { + FANS_NODE_TYPE, 0) == DDI_FAILURE) { cmn_err(CE_WARN, "%s ddi_create_minor_node failed" " for system fan", name); ddi_regs_map_free(&unitp->cpufan_rhandle); diff --git a/usr/src/uts/sun4u/grover/os/grover.c b/usr/src/uts/sun4u/grover/os/grover.c index 6a84c726e1..3cb4cc58c3 100644 --- a/usr/src/uts/sun4u/grover/os/grover.c +++ b/usr/src/uts/sun4u/grover/os/grover.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/param.h> #include <sys/systm.h> #include <sys/sunddi.h> @@ -57,12 +55,12 @@ set_platform_defaults(void) * of Southbridge. */ #define GROVER_ISA_PATHNAME "/pci@1f,0/isa@7" -ddi_acc_handle_t grover_isa_handle; /* handle for isa pci space */ +ddi_acc_handle_t grover_isa_handle; /* handle for isa pci space */ void load_platform_drivers(void) { - dev_info_t *dip; /* dip of the isa driver */ + dev_info_t *dip; /* dip of the isa driver */ if (i_ddi_attach_hw_nodes("power") != DDI_SUCCESS) @@ -88,12 +86,10 @@ load_platform_drivers(void) dip = e_ddi_hold_devi_by_path(GROVER_ISA_PATHNAME, 0); if (dip == NULL) { cmn_err(CE_PANIC, "Could not install the isa driver\n"); - return; } if (pci_config_setup(dip, &grover_isa_handle) != DDI_SUCCESS) { cmn_err(CE_PANIC, "Could not get the config space of isa\n"); - return; } } diff --git a/usr/src/uts/sun4u/grover/platmod/Makefile b/usr/src/uts/sun4u/grover/platmod/Makefile index c217de09a7..7962801ce2 100644 --- a/usr/src/uts/sun4u/grover/platmod/Makefile +++ b/usr/src/uts/sun4u/grover/platmod/Makefile @@ -40,7 +40,6 @@ UTSBASE = ../../.. # MODULE = platmod OBJECTS = $(GROVER_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(GROVER_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_GROVER_MISC_DIR)/$(MODULE) PLAT_DIR = . @@ -60,7 +59,6 @@ CLEANFILES += $(PLATLIB) $(SYM_MOD) # Define targets # ALL_TARGET = $(SYM_MOD) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # @@ -81,18 +79,10 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) check: -LINT_LIB_DIR = $(GROVER_LINT_LIB_DIR) - $(PLATLIB): $(OBJECTS) $(BUILD.SO) $(OBJECTS) diff --git a/usr/src/uts/sun4u/io/gpio_87317.c b/usr/src/uts/sun4u/io/gpio_87317.c index 450425e407..3c218b58b5 100644 --- a/usr/src/uts/sun4u/io/gpio_87317.c +++ b/usr/src/uts/sun4u/io/gpio_87317.c @@ -213,7 +213,7 @@ gpio_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) instance = ddi_get_instance(dip); DBG(dip, "attach: instance is %d", instance, 0, 0, 0, 0); if (ddi_soft_state_zalloc(statep, instance) != DDI_SUCCESS) - goto attach_failed; + goto attach_failed; softc = getsoftc(instance); softc->gp_dip = dip; softc->gp_state = 0; @@ -226,7 +226,7 @@ gpio_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) dev_attr.devacc_attr_dataorder = DDI_STRICTORDER_ACC; if (ddi_regs_map_setup(dip, 0, (caddr_t *)&softc->gp_regs, 0, 0, &dev_attr, &softc->gp_handle) != DDI_SUCCESS) - goto attach_failed; + goto attach_failed; DBG(dip, "attach: regs=0x%p", (uintptr_t)softc->gp_regs, 0, 0, 0, 0); DBG(dip, "attach: port 1 data is %x", @@ -254,10 +254,10 @@ gpio_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) (uintptr_t)ddi_get8(softc->gp_handle, &softc->gp_regs[7]), 0, 0, 0, 0); - /* Create device minor nodes. */ + /* Create device minor nodes. */ if (ddi_create_minor_node(dip, "gpio", S_IFCHR, - instance, NULL, NULL) == DDI_FAILURE) { + instance, NULL, 0) == DDI_FAILURE) { ddi_regs_map_free(&softc->gp_handle); goto attach_failed; } @@ -267,7 +267,7 @@ gpio_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) case DDI_RESUME: - /* Nothing to do for a resume. */ + /* Nothing to do for a resume. */ return (DDI_SUCCESS); @@ -340,7 +340,7 @@ gpio_close(dev_t dev, int flag, int otyp, cred_t *credp) /* ARGSUSED */ static int gpio_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp, - int *rvalp) + int *rvalp) { int instance = getminor(dev); struct gpio_softc *softc = getsoftc(instance); @@ -423,7 +423,7 @@ gpio_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp, #ifdef DEBUG void gpio_debug(dev_info_t *dip, char *format, uint_t arg1, uint_t arg2, uint_t arg3, - uint_t arg4, uint_t arg5) + uint_t arg4, uint_t arg5) { if (gpio_debug_flag == 0) { return; diff --git a/usr/src/uts/sun4u/io/i2c/clients/adm1026.c b/usr/src/uts/sun4u/io/i2c/clients/adm1026.c index 7ab697104c..4e8340d642 100644 --- a/usr/src/uts/sun4u/io/i2c/clients/adm1026.c +++ b/usr/src/uts/sun4u/io/i2c/clients/adm1026.c @@ -312,7 +312,7 @@ adm1026_do_attach(dev_info_t *dip) D2CMN_ERR((CE_WARN, "adm1026_do_attach: ddi_create_minor_node")); if (ddi_create_minor_node(dip, "adm1026", S_IFCHR, instance, - "ddi_i2c:led_control", NULL) == DDI_FAILURE) { + "ddi_i2c:led_control", 0) == DDI_FAILURE) { cmn_err(CE_WARN, "adm1026_do_attach: ddi_create_minor_node failed"); ddi_soft_state_free(adm1026soft_statep, instance); @@ -438,7 +438,7 @@ adm1026_put8(adm1026_unit_t *unitp, uint8_t reg, uint8_t val) */ static int adm1026_send8(adm1026_unit_t *unitp, uint8_t reg, uint8_t reg_val, - uint8_t reg_mask) + uint8_t reg_mask) { uint8_t val = 0; int err; @@ -593,7 +593,7 @@ adm1026_get_config(adm1026_unit_t *unitp, int cmd, uint32_t mask, uint32_t *val) static int adm1026_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp, - int *rvalp) + int *rvalp) { _NOTE(ARGUNUSED(credp, rvalp)) diff --git a/usr/src/uts/sun4u/io/i2c/clients/pic16f819.c b/usr/src/uts/sun4u/io/i2c/clients/pic16f819.c index 0f093c72d5..71cfcde9b3 100644 --- a/usr/src/uts/sun4u/io/i2c/clients/pic16f819.c +++ b/usr/src/uts/sun4u/io/i2c/clients/pic16f819.c @@ -275,17 +275,17 @@ pic16f819_close(dev_t dev, int flags, int otyp, cred_t *credp) static int pic16f819_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, - cred_t *credp, int *rvalp) + cred_t *credp, int *rvalp) { _NOTE(ARGUNUSED(credp, rvalp)) - struct pic16f819_unit *unitp; - int instance; - int err = 0; + struct pic16f819_unit *unitp; + int instance; + int err = 0; i2c_reg_t ioctl_reg; - uchar_t val8; + uchar_t val8; - if (arg == NULL) { + if (arg == (intptr_t)NULL) { D2CMN_ERR((CE_WARN, "PIC16F819: ioctl: arg passed in to ioctl " "= NULL\n")); err = EINVAL; @@ -389,7 +389,7 @@ pic16f819_do_attach(dev_info_t *dip) "%s%d", ddi_node_name(dip), instance); if (ddi_create_minor_node(dip, "fan_1", S_IFCHR, instance, - "ddi_i2c:pic", NULL) == DDI_FAILURE) { + "ddi_i2c:pic", 0) == DDI_FAILURE) { cmn_err(CE_WARN, "%s ddi_create_minor_node failed for " "%s\n", unitp->pic16f819_name, "pic16f819"); ddi_soft_state_free(pic16f819soft_statep, instance); diff --git a/usr/src/uts/sun4u/io/i2c/clients/ssc050.c b/usr/src/uts/sun4u/io/i2c/clients/ssc050.c index 1cf46a0574..1a79a14f4f 100644 --- a/usr/src/uts/sun4u/io/i2c/clients/ssc050.c +++ b/usr/src/uts/sun4u/io/i2c/clients/ssc050.c @@ -306,7 +306,7 @@ ssc050_set(struct ssc050_unit *unitp, int reg, uchar_t byte) static int ssc050_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp, - int *rvalp) + int *rvalp) { _NOTE(ARGUNUSED(credp, rvalp)) @@ -317,14 +317,14 @@ ssc050_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp, i2c_reg_t ioctl_reg; int port = MINOR_TO_PORT(getminor(dev)); int instance = MINOR_TO_INST(getminor(dev)); - uchar_t reg, val8; - uchar_t control; + uchar_t reg, val8; + uchar_t control; uchar_t fan_count; int divisor; int32_t fan_speed; uint8_t inverted_mask; - if (arg == NULL) { + if (arg == (intptr_t)NULL) { D2CMN_ERR((CE_WARN, "SSC050: ioctl: arg passed in to ioctl " "= NULL")); return (EINVAL); @@ -498,10 +498,10 @@ ssc050_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp, val8)); err = ssc050_set(unitp, reg, val8 | SSC050_DATADIRECTION_BIT); - if (err != I2C_SUCCESS) { - break; - } - delay(10); + if (err != I2C_SUCCESS) { + break; + } + delay(10); } } @@ -647,7 +647,7 @@ ssc050_do_attach(dev_info_t *dip) PORT_TO_MINOR(I2C_PORT(i)); if (ddi_create_minor_node(dip, name, S_IFCHR, minor_number, - "ddi_i2c:ioexp", NULL) == DDI_FAILURE) { + "ddi_i2c:ioexp", 0) == DDI_FAILURE) { cmn_err(CE_WARN, "%s: failed to create node for %s", unitp->name, name); ddi_soft_state_free(ssc050soft_statep, instance); @@ -684,7 +684,7 @@ ssc050_do_detach(dev_info_t *dip) int ssc050_get_port_bit(dev_info_t *dip, int port, int bit, uchar_t *rval, - int flags) + int flags) { struct ssc050_unit *unitp; int instance; diff --git a/usr/src/uts/sun4u/io/i2c/clients/ssc100.c b/usr/src/uts/sun4u/io/i2c/clients/ssc100.c index 9ebc3eabc8..0c92f7b977 100644 --- a/usr/src/uts/sun4u/io/i2c/clients/ssc100.c +++ b/usr/src/uts/sun4u/io/i2c/clients/ssc100.c @@ -294,7 +294,7 @@ ssc100_set(struct ssc100_unit *unitp, uchar_t byte) static int ssc100_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, - cred_t *credp, int *rvalp) + cred_t *credp, int *rvalp) { _NOTE(ARGUNUSED(credp, rvalp)) @@ -306,7 +306,7 @@ ssc100_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, i2c_reg_t ioctl_reg; uchar_t byte; - if (arg == NULL) { + if (arg == (intptr_t)NULL) { D2CMN_ERR((CE_WARN, "SSC100: ioctl: arg passed in to ioctl " "= NULL")); err = EINVAL; @@ -529,7 +529,7 @@ ssc100_do_attach(dev_info_t *dip) "%s%d", ddi_node_name(dip), instance); if (ddi_create_minor_node(dip, "ssc100", S_IFCHR, instance, - "ddi_i2c:ioexp", NULL) == DDI_FAILURE) { + "ddi_i2c:ioexp", 0) == DDI_FAILURE) { cmn_err(CE_WARN, "%s ddi_create_minor_node failed for " "%s", unitp->ssc100_name, "ssc100"); ddi_soft_state_free(ssc100soft_statep, instance); diff --git a/usr/src/uts/sun4u/io/pci/db21554.c b/usr/src/uts/sun4u/io/pci/db21554.c index f51ad8c0e6..fc1e83fd19 100644 --- a/usr/src/uts/sun4u/io/pci/db21554.c +++ b/usr/src/uts/sun4u/io/pci/db21554.c @@ -321,7 +321,7 @@ static void db_pci_get_conf_regs(ddi_acc_handle_t config_handle, #ifdef DEBUG static void db_debug(uint64_t func_id, dev_info_t *dip, char *fmt, - uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5); + uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5); #endif static int db_prop_op(dev_t dev, dev_info_t *dip, ddi_prop_op_t prop_op, @@ -348,34 +348,34 @@ static struct cb_ops db_cb_ops = { nodev /* int (*cb_awrite)() */ }; -static uint8_t db_ddi_get8(ddi_acc_impl_t *handle, uint8_t *addr); +static uint8_t db_ddi_get8(ddi_acc_impl_t *handle, uint8_t *addr); static uint16_t db_ddi_get16(ddi_acc_impl_t *handle, uint16_t *addr); static uint32_t db_ddi_get32(ddi_acc_impl_t *handle, uint32_t *addr); static uint64_t db_ddi_get64(ddi_acc_impl_t *handle, uint64_t *addr); -static void db_ddi_put8(ddi_acc_impl_t *handle, uint8_t *addr, - uint8_t data); -static void db_ddi_put16(ddi_acc_impl_t *handle, uint16_t *addr, - uint16_t data); -static void db_ddi_put32(ddi_acc_impl_t *handle, uint32_t *addr, - uint32_t data); -static void db_ddi_put64(ddi_acc_impl_t *handle, uint64_t *addr, - uint64_t data); -static void db_ddi_rep_get8(ddi_acc_impl_t *handle, uint8_t *host_addr, - uint8_t *dev_addr, size_t repcount, uint_t flags); -static void db_ddi_rep_get16(ddi_acc_impl_t *handle, uint16_t *host_addr, - uint16_t *dev_addr, size_t repcount, uint_t flags); -static void db_ddi_rep_get32(ddi_acc_impl_t *handle, uint32_t *host_addr, - uint32_t *dev_addr, size_t repcount, uint_t flags); -static void db_ddi_rep_get64(ddi_acc_impl_t *handle, uint64_t *host_addr, - uint64_t *dev_addr, size_t repcount, uint_t flags); -static void db_ddi_rep_put8(ddi_acc_impl_t *handle, uint8_t *host_addr, - uint8_t *dev_addr, size_t repcount, uint_t flags); -static void db_ddi_rep_put16(ddi_acc_impl_t *handle, uint16_t *host_addr, - uint16_t *dev_addr, size_t repcount, uint_t flags); -static void db_ddi_rep_put32(ddi_acc_impl_t *handle, uint32_t *host_addr, - uint32_t *dev_addr, size_t repcount, uint_t flags); -static void db_ddi_rep_put64(ddi_acc_impl_t *handle, uint64_t *host_addr, - uint64_t *dev_addr, size_t repcount, uint_t flags); +static void db_ddi_put8(ddi_acc_impl_t *handle, uint8_t *addr, + uint8_t data); +static void db_ddi_put16(ddi_acc_impl_t *handle, uint16_t *addr, + uint16_t data); +static void db_ddi_put32(ddi_acc_impl_t *handle, uint32_t *addr, + uint32_t data); +static void db_ddi_put64(ddi_acc_impl_t *handle, uint64_t *addr, + uint64_t data); +static void db_ddi_rep_get8(ddi_acc_impl_t *handle, uint8_t *host_addr, + uint8_t *dev_addr, size_t repcount, uint_t flags); +static void db_ddi_rep_get16(ddi_acc_impl_t *handle, uint16_t *host_addr, + uint16_t *dev_addr, size_t repcount, uint_t flags); +static void db_ddi_rep_get32(ddi_acc_impl_t *handle, uint32_t *host_addr, + uint32_t *dev_addr, size_t repcount, uint_t flags); +static void db_ddi_rep_get64(ddi_acc_impl_t *handle, uint64_t *host_addr, + uint64_t *dev_addr, size_t repcount, uint_t flags); +static void db_ddi_rep_put8(ddi_acc_impl_t *handle, uint8_t *host_addr, + uint8_t *dev_addr, size_t repcount, uint_t flags); +static void db_ddi_rep_put16(ddi_acc_impl_t *handle, uint16_t *host_addr, + uint16_t *dev_addr, size_t repcount, uint_t flags); +static void db_ddi_rep_put32(ddi_acc_impl_t *handle, uint32_t *host_addr, + uint32_t *dev_addr, size_t repcount, uint_t flags); +static void db_ddi_rep_put64(ddi_acc_impl_t *handle, uint64_t *host_addr, + uint64_t *dev_addr, size_t repcount, uint_t flags); static struct dev_ops db_dev_ops = { DEVO_REV, /* devo_rev */ @@ -410,16 +410,16 @@ static struct modlinkage modlinkage = { }; /* soft state pointer and structure template. */ -static void *db_state; +static void *db_state; /* * forward function declarations: */ static void db_uninitchild(dev_info_t *); -static int db_initchild(dev_info_t *child); -static int db_create_pci_prop(dev_info_t *child); -static int db_save_config_regs(db_ctrl_t *dbp); -static int db_restore_config_regs(db_ctrl_t *dbp); +static int db_initchild(dev_info_t *child); +static int db_create_pci_prop(dev_info_t *child); +static int db_save_config_regs(db_ctrl_t *dbp); +static int db_restore_config_regs(db_ctrl_t *dbp); /* * FMA error callback @@ -675,7 +675,7 @@ db_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) if (ddi_create_minor_node(dip, name, S_IFCHR, PCIHP_AP_MINOR_NUM(instance, PCIHP_DEBUG_MINOR), - NULL, NULL) == DDI_FAILURE) { + NULL, 0) == DDI_FAILURE) { cmn_err(CE_NOTE, "%s#%d: node creation failure", ddi_driver_name(dbp->dip), instance); } @@ -1443,7 +1443,7 @@ db_close(dev_t dev, int flag, int otyp, cred_t *cred_p) /*ARGSUSED*/ static int db_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *cred_p, - int *rval_p) + int *rval_p) { int rc = DDI_SUCCESS; #ifdef DB_DEBUG @@ -1698,15 +1698,15 @@ db_pci_get_conf_regs(ddi_acc_handle_t config_handle, db_conf_regs_t *cr) /* * Function: db_pci_map * - * Note: Only memory accesses are direct. IO could be direct - * or indirect. Config accesses are always indirect. - * The question here is, does the "assigned-addresses" - * property entry represents the addresses in the - * local domain or the host domain itself. - * Strictly speaking, the assumption should be that - * it is in the local domain, as the transactions - * upstream or downstream are automatically - * translated by the bridge chip anyway. + * Note: Only memory accesses are direct. IO could be direct + * or indirect. Config accesses are always indirect. + * The question here is, does the "assigned-addresses" + * property entry represents the addresses in the + * local domain or the host domain itself. + * Strictly speaking, the assumption should be that + * it is in the local domain, as the transactions + * upstream or downstream are automatically + * translated by the bridge chip anyway. * * Return values: * DDI_SUCCESS: map call by child device success @@ -1715,7 +1715,7 @@ db_pci_get_conf_regs(ddi_acc_handle_t config_handle, db_conf_regs_t *cr) static int db_pci_map(dev_info_t *dip, dev_info_t *rdip, ddi_map_req_t *mp, - off_t offset, off_t len, caddr_t *addrp) + off_t offset, off_t len, caddr_t *addrp) { register dev_info_t *pdip; int reg_proplen, num_regs, rnumber; @@ -2088,7 +2088,7 @@ char *db_ctlop_name[] = { static int db_ctlops(dev_info_t *dip, dev_info_t *rdip, - ddi_ctl_enum_t ctlop, void *arg, void *result) + ddi_ctl_enum_t ctlop, void *arg, void *result) { if ((ctlop >= DDI_CTLOPS_DMAPMAPC) && @@ -2865,7 +2865,7 @@ db_ddi_put64(ddi_acc_impl_t *handle, uint64_t *addr, uint64_t data) */ static void db_ddi_rep_get8(ddi_acc_impl_t *handle, uint8_t *host_addr, - uint8_t *dev_addr, size_t repcount, uint_t flags) + uint8_t *dev_addr, size_t repcount, uint_t flags) { if (flags == DDI_DEV_AUTOINCR) for (; repcount; repcount--) @@ -2881,7 +2881,7 @@ db_ddi_rep_get8(ddi_acc_impl_t *handle, uint8_t *host_addr, */ static void db_ddi_rep_get16(ddi_acc_impl_t *handle, uint16_t *host_addr, - uint16_t *dev_addr, size_t repcount, uint_t flags) + uint16_t *dev_addr, size_t repcount, uint_t flags) { if (flags == DDI_DEV_AUTOINCR) for (; repcount; repcount--) @@ -2897,7 +2897,7 @@ db_ddi_rep_get16(ddi_acc_impl_t *handle, uint16_t *host_addr, */ static void db_ddi_rep_get32(ddi_acc_impl_t *handle, uint32_t *host_addr, - uint32_t *dev_addr, size_t repcount, uint_t flags) + uint32_t *dev_addr, size_t repcount, uint_t flags) { if (flags == DDI_DEV_AUTOINCR) for (; repcount; repcount--) @@ -2913,7 +2913,7 @@ db_ddi_rep_get32(ddi_acc_impl_t *handle, uint32_t *host_addr, */ static void db_ddi_rep_get64(ddi_acc_impl_t *handle, uint64_t *host_addr, - uint64_t *dev_addr, size_t repcount, uint_t flags) + uint64_t *dev_addr, size_t repcount, uint_t flags) { if (flags == DDI_DEV_AUTOINCR) for (; repcount; repcount--) @@ -2929,7 +2929,7 @@ db_ddi_rep_get64(ddi_acc_impl_t *handle, uint64_t *host_addr, */ static void db_ddi_rep_put8(ddi_acc_impl_t *handle, uint8_t *host_addr, - uint8_t *dev_addr, size_t repcount, uint_t flags) + uint8_t *dev_addr, size_t repcount, uint_t flags) { if (flags == DDI_DEV_AUTOINCR) for (; repcount; repcount--) @@ -2945,7 +2945,7 @@ db_ddi_rep_put8(ddi_acc_impl_t *handle, uint8_t *host_addr, */ static void db_ddi_rep_put16(ddi_acc_impl_t *handle, uint16_t *host_addr, - uint16_t *dev_addr, size_t repcount, uint_t flags) + uint16_t *dev_addr, size_t repcount, uint_t flags) { if (flags == DDI_DEV_AUTOINCR) for (; repcount; repcount--) @@ -2961,7 +2961,7 @@ db_ddi_rep_put16(ddi_acc_impl_t *handle, uint16_t *host_addr, */ static void db_ddi_rep_put32(ddi_acc_impl_t *handle, uint32_t *host_addr, - uint32_t *dev_addr, size_t repcount, uint_t flags) + uint32_t *dev_addr, size_t repcount, uint_t flags) { if (flags == DDI_DEV_AUTOINCR) for (; repcount; repcount--) @@ -2977,7 +2977,7 @@ db_ddi_rep_put32(ddi_acc_impl_t *handle, uint32_t *host_addr, */ static void db_ddi_rep_put64(ddi_acc_impl_t *handle, uint64_t *host_addr, - uint64_t *dev_addr, size_t repcount, uint_t flags) + uint64_t *dev_addr, size_t repcount, uint_t flags) { if (flags == DDI_DEV_AUTOINCR) for (; repcount; repcount--) @@ -2991,7 +2991,7 @@ db_ddi_rep_put64(ddi_acc_impl_t *handle, uint64_t *host_addr, static void db_debug(uint64_t func_id, dev_info_t *dip, char *fmt, - uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5) + uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5) { char *s = NULL; uint_t dip_no_disp = 0; @@ -3097,7 +3097,7 @@ db_fm_fini(db_ctrl_t *db_p) /*ARGSUSED*/ static int db_fm_init_child(dev_info_t *dip, dev_info_t *tdip, int cap, - ddi_iblock_cookie_t *ibc) + ddi_iblock_cookie_t *ibc) { db_ctrl_t *db_p = (db_ctrl_t *)ddi_get_soft_state(db_state, ddi_get_instance(dip)); diff --git a/usr/src/uts/sun4u/io/pic16f747.c b/usr/src/uts/sun4u/io/pic16f747.c index 011a8974d0..0a8a4d398c 100644 --- a/usr/src/uts/sun4u/io/pic16f747.c +++ b/usr/src/uts/sun4u/io/pic16f747.c @@ -220,7 +220,7 @@ pic_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) (void) sprintf(name, "env-monitor%d", inst); minor = PIC_INST_TO_MINOR(inst) | PIC_UNIT_TO_MINOR(0); if (ddi_create_minor_node(dip, name, S_IFCHR, minor, - DDI_PSEUDO, NULL) == DDI_FAILURE) { + DDI_PSEUDO, 0) == DDI_FAILURE) { cmn_err(CE_WARN, "ddi_create_minor_node() failed for inst %d\n", inst); @@ -261,7 +261,7 @@ pic_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) minor_name = pic_nodes[i].minor_name; minor = PIC_INST_TO_MINOR(inst) | PIC_UNIT_TO_MINOR(i); if (ddi_create_minor_node(dip, minor_name, S_IFCHR, - minor, PICDEV_NODE_TYPE, NULL) == DDI_FAILURE) { + minor, PICDEV_NODE_TYPE, 0) == DDI_FAILURE) { cmn_err(CE_WARN, "%s:%d ddi_create_minor_node failed", ddi_driver_name(dip), inst); diff --git a/usr/src/uts/sun4u/io/rmc_comm_drvintf.c b/usr/src/uts/sun4u/io/rmc_comm_drvintf.c index 6c173379e0..58fd2db8eb 100644 --- a/usr/src/uts/sun4u/io/rmc_comm_drvintf.c +++ b/usr/src/uts/sun4u/io/rmc_comm_drvintf.c @@ -360,13 +360,13 @@ rmc_comm_send_req_resp(struct rmc_comm_state *rcs, rmc_comm_msg_t *request, if (response != NULL) { exp_resp->msg_type = response->msg_type; exp_resp->msg_buf = (uint8_t *)response->msg_buf; - exp_resp->msg_msglen = (uint16_t)response->msg_bytes; - exp_resp->msg_bufsiz = (uint16_t)response->msg_len; + exp_resp->msg_msglen = response->msg_bytes; + exp_resp->msg_bufsiz = response->msg_len; } else { exp_resp->msg_type = DP_NULL_MSG; - exp_resp->msg_buf = (uint8_t)NULL; - exp_resp->msg_bufsiz = (uint16_t)0; - exp_resp->msg_msglen = (uint16_t)0; + exp_resp->msg_buf = NULL; + exp_resp->msg_bufsiz = 0; + exp_resp->msg_msglen = 0; } /* @@ -374,7 +374,7 @@ rmc_comm_send_req_resp(struct rmc_comm_state *rcs, rmc_comm_msg_t *request, */ req.msg_type = request->msg_type; req.msg_buf = (uint8_t *)request->msg_buf; - req.msg_msglen = (uint16_t)request->msg_len; + req.msg_msglen = request->msg_len; /* * send the message and wait for the reply or ACKnowledgment @@ -636,7 +636,7 @@ int rmc_comm_reg_intr(uint8_t msg_type, rmc_comm_intrfunc_t intr_handler, rmc_comm_msg_t *msgbuf, uint_t *state, kmutex_t *lock) { - struct rmc_comm_state *rcs; + struct rmc_comm_state *rcs; dp_msg_intr_t *msgintr; int err = RCNOERR; diff --git a/usr/src/uts/sun4u/io/rmclomv.c b/usr/src/uts/sun4u/io/rmclomv.c index 13c10e3a01..9d00fdd6fb 100644 --- a/usr/src/uts/sun4u/io/rmclomv.c +++ b/usr/src/uts/sun4u/io/rmclomv.c @@ -399,7 +399,7 @@ rmclomv_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) return (DDI_FAILURE); err = ddi_create_minor_node(dip, "rmclomv", S_IFCHR, - instance, DDI_PSEUDO, NULL); + instance, DDI_PSEUDO, 0); if (err != DDI_SUCCESS) return (DDI_FAILURE); @@ -1621,7 +1621,7 @@ refresh_name_cache(int force_fail) if (retval == 0) { retval = rmclomv_do_cmd(DP_GET_SYSINFO, DP_GET_SYSINFO_R, - sizeof (sysinfo), NULL, (intptr_t)&sysinfo); + sizeof (sysinfo), (intptr_t)NULL, (intptr_t)&sysinfo); } if (retval == 0) { fru_cmd.handle = DP_NULL_HANDLE; @@ -2896,7 +2896,7 @@ rmclomv_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *cred_p, case ENVMONIOCCHASSISSERIALNUM: retval = rmclomv_do_cmd(DP_GET_SDP_VERSION, DP_GET_SDP_VERSION_R, sizeof (rmc_sdpver_r), - NULL, (intptr_t)&rmc_sdpver_r); + (intptr_t)NULL, (intptr_t)&rmc_sdpver_r); if (retval != 0) { cmn_err(CE_WARN, "DP_GET_SDP_VERSION failed, ret=%d\n", @@ -2908,7 +2908,7 @@ rmclomv_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *cred_p, } retval = rmclomv_do_cmd(DP_GET_CHASSIS_SERIALNUM, DP_GET_CHASSIS_SERIALNUM_R, sizeof (rmc_serialnum_r), - NULL, (intptr_t)&rmc_serialnum_r); + (intptr_t)NULL, (intptr_t)&rmc_serialnum_r); if (retval != 0) { break; @@ -2940,7 +2940,7 @@ rmclomv_checkrmc(caddr_t arg) int err; int retries; int state; - dp_get_sysinfo_r_t sysinfo; + dp_get_sysinfo_r_t sysinfo; CALLB_CPR_INIT(&cprinfo, &rmclomv_checkrmc_lock, callb_generic_cpr, "rmclomv_checkrmc"); @@ -3005,7 +3005,7 @@ rmclomv_checkrmc(caddr_t arg) mutex_exit(&rmclomv_checkrmc_lock); err = rmclomv_do_cmd(DP_GET_SYSINFO, DP_GET_SYSINFO_R, - sizeof (sysinfo), NULL, (intptr_t)&sysinfo); + sizeof (sysinfo), (intptr_t)NULL, (intptr_t)&sysinfo); if (err == 0) { mutex_enter(&rmclomv_state_lock); state = rmclomv_rmc_state; @@ -3393,7 +3393,7 @@ plat_timesync(void *arg) if (arg != NULL) { /* Request the time from the RMC clock. */ retval = rmclomv_do_cmd(DP_GET_DATE_TIME, DP_GET_DATE_TIME_R, - DATE_TIME_MSG_SIZE, NULL, (intptr_t)&buffer); + DATE_TIME_MSG_SIZE, (intptr_t)NULL, (intptr_t)&buffer); /* * If we were able to get the time lets set the local clock. diff --git a/usr/src/uts/sun4u/io/todds1287.c b/usr/src/uts/sun4u/io/todds1287.c index 35dc7ad8fc..bf9cb8bd42 100644 --- a/usr/src/uts/sun4u/io/todds1287.c +++ b/usr/src/uts/sun4u/io/todds1287.c @@ -176,7 +176,7 @@ static ddi_softintr_t ds1287_softintr_id; static kmutex_t ds1287_reg_mutex; /* Protects ds1287 Registers */ static struct modldrv modldrv = { - &mod_driverops, /* Type of module. This one is a driver */ + &mod_driverops, /* Type of module. This one is a driver */ "ds1287 clock driver", /* Name of the module. */ &ds1287_ops, /* driver ops */ }; @@ -354,7 +354,7 @@ ds1287_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) * creating the minor node. */ if (ddi_create_minor_node(dip, "power_button", S_IFCHR, - (instance << 8) + 0, "ddi_power_button", NULL) == DDI_FAILURE) { + (instance << 8) + 0, "ddi_power_button", 0) == DDI_FAILURE) { cmn_err(CE_WARN, "ds1287_attach: Failed to create minor node"); goto error3; } @@ -453,7 +453,7 @@ ds1287_close(dev_t dev, int flags, int otyp, cred_t *credp) /*ARGSUSED4*/ static int ds1287_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, - cred_t *credp, int *rvalp) + cred_t *credp, int *rvalp) { struct ds1287 *softsp; int clone; diff --git a/usr/src/uts/sun4u/io/todds1337.c b/usr/src/uts/sun4u/io/todds1337.c index 319928bde7..4688467769 100644 --- a/usr/src/uts/sun4u/io/todds1337.c +++ b/usr/src/uts/sun4u/io/todds1337.c @@ -67,8 +67,8 @@ static uint_t todds1337_set_watchdog_timer(uint_t); static uint_t todds1337_clear_watchdog_timer(void); static void todds1337_set_power_alarm(timestruc_t); static void todds1337_clear_power_alarm(void); -static int todds1337_setup_prom(); -static void todds1337_rele_prom(); +static int todds1337_setup_prom(void); +static void todds1337_rele_prom(void); static int todds1337_prom_getdate(struct rtc_t *rtc); static int todds1337_prom_setdate(struct rtc_t *rtc); @@ -90,7 +90,7 @@ static ihandle_t todds1337_ihandle = 0; #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; +static struct rtc_t soft_rtc; /* * cp_ops structure @@ -898,7 +898,7 @@ todds1337_getinfo(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, * execute the get-time method */ static int -todds1337_setup_prom() +todds1337_setup_prom(void) { pnode_t todnode; char tod1337_devpath[MAXNAMELEN]; @@ -920,7 +920,7 @@ todds1337_setup_prom() /* * Now open the node and store it's ihandle */ - if ((todds1337_ihandle = prom_open(tod1337_devpath)) == NULL) { + if ((todds1337_ihandle = prom_open(tod1337_devpath)) == 0) { cmn_err(CE_WARN, "prom_open failed"); return (DDI_FAILURE); } @@ -932,7 +932,7 @@ todds1337_setup_prom() * Closes the prom interface */ static void -todds1337_rele_prom() +todds1337_rele_prom(void) { (void) prom_close(todds1337_ihandle); } @@ -958,7 +958,7 @@ todds1337_prom_getdate(struct rtc_t *rtc) (void) p1275_cif_handler(&ci); promif_postprom(); - year = p1275_cell2int(ci[6]); + year = p1275_cell2int(ci[6]); rtc->rtc_mon = p1275_cell2int(ci[7]); rtc->rtc_dom = p1275_cell2int(ci[8]); rtc->rtc_dow = 0; diff --git a/usr/src/uts/sun4u/littleneck/Makefile b/usr/src/uts/sun4u/littleneck/Makefile index 134c28b1d8..c6c7ba37e0 100644 --- a/usr/src/uts/sun4u/littleneck/Makefile +++ b/usr/src/uts/sun4u/littleneck/Makefile @@ -23,8 +23,6 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" -# # This makefile drives the production of all Littleneck system # dependent modules for the sun4u architecture. # @@ -45,12 +43,8 @@ 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 # @@ -58,11 +52,9 @@ check := TARGET= check # .KEEP_STATE: -def all clean.lint clean clobber modlist: $(LITTLENECK_KMODS) - -modlintlib: $(LITTLENECK_KMODS) +def all clean clobber modlist: $(LITTLENECK_KMODS) -install: $(ROOT_LITTLENECK_DIR) $(USR_LITTLENECK_DIR) \ +install: $(ROOT_LITTLENECK_DIR) $(USR_LITTLENECK_DIR) \ $(USR_LITTLENECK_INC_DIR) \ $(USR_LITTLENECK_SBIN_DIR) \ $(USR_LITTLENECK_LIB_DIR) \ @@ -71,18 +63,6 @@ install: $(ROOT_LITTLENECK_DIR) $(USR_LITTLENECK_DIR) \ install_h check: -lint: modlintlib - -LINT_LIBS = $(LINT_LIB) \ - -L$(LITTLENECK_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) "\nLittleneck Platform-dependent module: global crosschecks:" - @-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.2) - $(LITTLENECK_KMODS): FRC @cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET) diff --git a/usr/src/uts/sun4u/littleneck/io/pcf8574_lneck.c b/usr/src/uts/sun4u/littleneck/io/pcf8574_lneck.c index 8b0bcd007e..767d2a4f24 100644 --- a/usr/src/uts/sun4u/littleneck/io/pcf8574_lneck.c +++ b/usr/src/uts/sun4u/littleneck/io/pcf8574_lneck.c @@ -229,18 +229,18 @@ pcf8574_close(dev_t dev, int flags, int otyp, cred_t *credp) } static int -pcf8574_get(struct pcf8574_unit *unitp, uchar_t *byte) { +pcf8574_get(struct pcf8574_unit *unitp, uchar_t *byte) +{ i2c_transfer_t *i2c_tran_pointer; int err = I2C_SUCCESS; D1CMN_ERR((CE_WARN, "Entered the pcf8574_get routine\n")); (void) i2c_transfer_alloc(unitp->pcf8574_hdl, &i2c_tran_pointer, - 0, 1, I2C_SLEEP); + 0, 1, I2C_SLEEP); if (i2c_tran_pointer == NULL) { D2CMN_ERR((CE_WARN, "%s: Failed in pcf8574_get " - "i2c_tran_pointer not allocated\n", - unitp->pcf8574_name)); + "i2c_tran_pointer not allocated\n", unitp->pcf8574_name)); return (ENOMEM); } @@ -249,13 +249,13 @@ pcf8574_get(struct pcf8574_unit *unitp, uchar_t *byte) { err = i2c_transfer(unitp->pcf8574_hdl, i2c_tran_pointer); if (err) { D2CMN_ERR((CE_WARN, "%s: Failed in the i2c_transfer routine\n", - unitp->pcf8574_name)); + unitp->pcf8574_name)); i2c_transfer_free(unitp->pcf8574_hdl, i2c_tran_pointer); return (err); } D1CMN_ERR((CE_WARN, "Back from a transfer value is %x\n", - i2c_tran_pointer->i2c_rbuf[0])); + i2c_tran_pointer->i2c_rbuf[0])); *byte = i2c_tran_pointer->i2c_rbuf[0]; i2c_transfer_free(unitp->pcf8574_hdl, i2c_tran_pointer); @@ -263,16 +263,17 @@ pcf8574_get(struct pcf8574_unit *unitp, uchar_t *byte) { } static int -pcf8574_set(struct pcf8574_unit *unitp, uchar_t byte) { +pcf8574_set(struct pcf8574_unit *unitp, uchar_t byte) +{ i2c_transfer_t *i2c_tran_pointer; int err = I2C_SUCCESS; (void) i2c_transfer_alloc(unitp->pcf8574_hdl, &i2c_tran_pointer, - 1, 0, I2C_SLEEP); + 1, 0, I2C_SLEEP); if (i2c_tran_pointer == NULL) { D2CMN_ERR((CE_WARN, "%s: Failed in pcf8574_set " - "i2c_tran_pointer not allocated\n", - unitp->pcf8574_name)); + "i2c_tran_pointer not allocated\n", + unitp->pcf8574_name)); return (ENOMEM); } @@ -280,13 +281,12 @@ pcf8574_set(struct pcf8574_unit *unitp, uchar_t byte) { i2c_tran_pointer->i2c_wbuf[0] = byte; D1CMN_ERR((CE_NOTE, "%s: contains %x\n", unitp->pcf8574_name, - i2c_tran_pointer->i2c_wbuf[0])); + i2c_tran_pointer->i2c_wbuf[0])); err = i2c_transfer(unitp->pcf8574_hdl, i2c_tran_pointer); if (err) { D2CMN_ERR((CE_WARN, "%s: Failed in the pcf8574_set" - " i2c_transfer routine\n", - unitp->pcf8574_name)); + " i2c_transfer routine\n", unitp->pcf8574_name)); i2c_transfer_free(unitp->pcf8574_hdl, i2c_tran_pointer); return (err); } @@ -296,7 +296,7 @@ pcf8574_set(struct pcf8574_unit *unitp, uchar_t byte) { static int pcf8574_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, - cred_t *credp, int *rvalp) + cred_t *credp, int *rvalp) { _NOTE(ARGUNUSED(credp, rvalp)) struct pcf8574_unit *unitp; @@ -306,7 +306,7 @@ pcf8574_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, i2c_port_t ioctl_port; uchar_t byte; - if (arg == NULL) { + if (arg == (intptr_t)NULL) { D2CMN_ERR((CE_WARN, "PCF8574: ioctl: arg passed in to ioctl " "= NULL\n")); err = EINVAL; @@ -523,7 +523,7 @@ pcf8574_do_attach(dev_info_t *dip) if (ddi_create_minor_node(dip, "pcf8574", S_IFCHR, instance, - "ddi_i2c:ioexp", NULL) == DDI_FAILURE) { + "ddi_i2c:ioexp", 0) == DDI_FAILURE) { cmn_err(CE_WARN, "%s ddi_create_minor_node failed for " "%s\n", unitp->pcf8574_name, "pcf8574"); ddi_soft_state_free(pcf8574soft_statep, instance); diff --git a/usr/src/uts/sun4u/littleneck/os/littleneck.c b/usr/src/uts/sun4u/littleneck/os/littleneck.c index cb299c8117..9a048efc20 100644 --- a/usr/src/uts/sun4u/littleneck/os/littleneck.c +++ b/usr/src/uts/sun4u/littleneck/os/littleneck.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/param.h> #include <sys/systm.h> #include <sys/sunddi.h> @@ -51,7 +49,7 @@ int (*p2get_mem_unum)(int, uint64_t, char *, int, int *); void startup_platform(void) { - mutex_init(&lneck_pcf8584_mutex, NULL, NULL, NULL); + mutex_init(&lneck_pcf8584_mutex, NULL, MUTEX_ADAPTIVE, NULL); } int @@ -149,7 +147,7 @@ plat_get_mem_unum(int synd_code, uint64_t flt_addr, int flt_bus_id, { if (flt_in_memory && (p2get_mem_unum != NULL)) return (p2get_mem_unum(synd_code, P2ALIGN(flt_addr, 8), - buf, buflen, lenp)); + buf, buflen, lenp)); else return (ENOTSUP); } diff --git a/usr/src/uts/sun4u/mpxu/Makefile b/usr/src/uts/sun4u/mpxu/Makefile index e7170e8e2d..6014c8761e 100644 --- a/usr/src/uts/sun4u/mpxu/Makefile +++ b/usr/src/uts/sun4u/mpxu/Makefile @@ -45,12 +45,8 @@ 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 # @@ -58,11 +54,7 @@ check := TARGET= check # .KEEP_STATE: -def all clean clean.lint clobber modlist: $(MPXU_KMODS) $(CLOSED_MPXU_KMODS) - -lintlib: unix - -modlintlib: $(MPXU_KMODS) $(CLOSED_MPXU_KMODS) +def all clean clobber modlist: $(MPXU_KMODS) $(CLOSED_MPXU_KMODS) IMPLEMENTED_PLATFORM = SUNW,Sun-Fire-V240 @@ -95,19 +87,6 @@ $(MPXU_CRYPTO_LINKS): $(ROOT_MPXU_CRYPTO_DIR_64) install_h check: FRC @cd sys; pwd; $(MAKE) $(TARGET) - -lint: modlintlib - -LINT_LIBS = $(LINT_LIB) \ - -L$(MPXU_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) "\nMPXU Platform-dependent module: global crosschecks:" - @-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.2) - # # # Include common targets. diff --git a/usr/src/uts/sun4u/mpxu/io/tsalarm.c b/usr/src/uts/sun4u/mpxu/io/tsalarm.c index 7c56f1d63f..819c44a0a6 100644 --- a/usr/src/uts/sun4u/mpxu/io/tsalarm.c +++ b/usr/src/uts/sun4u/mpxu/io/tsalarm.c @@ -211,7 +211,7 @@ tsalarm_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) * the device's softc, is used to direct peculiar behavior. */ if (ddi_create_minor_node(dip, "lom", S_IFCHR, 0, - DDI_PSEUDO, NULL) == DDI_FAILURE) + DDI_PSEUDO, 0) == DDI_FAILURE) goto attach_failed; ddi_report_dev(dip); @@ -288,7 +288,7 @@ tsalarm_close(dev_t dev, int flag, int otyp, cred_t *credp) /* ARGSUSED */ static int tsalarm_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, - cred_t *credp, int *rvalp) + cred_t *credp, int *rvalp) { int inst = getminor(dev); struct tsalarm_softc *softc; diff --git a/usr/src/uts/sun4u/ngdr/io/dr.c b/usr/src/uts/sun4u/ngdr/io/dr.c index e89ea0b05e..73b1528c7e 100644 --- a/usr/src/uts/sun4u/ngdr/io/dr.c +++ b/usr/src/uts/sun4u/ngdr/io/dr.c @@ -556,7 +556,7 @@ int dr_enable = 1; /*ARGSUSED3*/ static int dr_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, - cred_t *cred_p, int *rval_p) + cred_t *cred_p, int *rval_p) { int rv = 0; int instance; @@ -706,7 +706,7 @@ dr_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) { int rv, rv2; int bd; - int instance; + int instance; sbd_error_t *err; dr_softstate_t *softsp; @@ -768,7 +768,7 @@ dr_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) minor_num = DR_MAKE_MINOR(instance, bd); rv = ddi_create_minor_node(dip, name, S_IFCHR, - minor_num, DDI_NT_SBD_ATTACHMENT_POINT, NULL); + minor_num, DDI_NT_SBD_ATTACHMENT_POINT, 0); if (rv != DDI_SUCCESS) rv = DDI_FAILURE; } @@ -806,7 +806,7 @@ dr_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) static int dr_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) { - int instance; + int instance; dr_softstate_t *softsp; switch (cmd) { @@ -1293,7 +1293,8 @@ dr_test_board(dr_handle_t *hp) * devlists for the board have been initialized. */ static void -dr_make_comp_nodes(dr_board_t *bp) { +dr_make_comp_nodes(dr_board_t *bp) +{ int i; @@ -1580,7 +1581,7 @@ dr_dev_is_target(dr_dev_unit_t *dp, int present_only, uint_t uset) static void dr_dev_make_list(dr_handle_t *hp, sbd_comp_type_t type, int present_only, - dr_common_unit_t ***devlist, int *devnum) + dr_common_unit_t ***devlist, int *devnum) { dr_board_t *bp = hp->h_bd; int unum; @@ -1702,10 +1703,10 @@ dr_dev_clean_up(dr_handle_t *hp, dr_common_unit_t **list, int devnum) static int dr_dev_walk(dr_handle_t *hp, sbd_comp_type_t type, int present_only, - int (*pre_op)(dr_handle_t *, dr_common_unit_t **, int), - void (*op)(dr_handle_t *, dr_common_unit_t *), - int (*post_op)(dr_handle_t *, dr_common_unit_t **, int), - void (*board_op)(dr_handle_t *, dr_common_unit_t **, int)) + int (*pre_op)(dr_handle_t *, dr_common_unit_t **, int), + void (*op)(dr_handle_t *, dr_common_unit_t *), + int (*post_op)(dr_handle_t *, dr_common_unit_t **, int), + void (*board_op)(dr_handle_t *, dr_common_unit_t **, int)) { int devnum, rv; dr_common_unit_t **devlist; @@ -1740,7 +1741,7 @@ dr_dev_noop(dr_handle_t *hp, dr_common_unit_t **devlist, int devnum) static void dr_attach_update_state(dr_handle_t *hp, - dr_common_unit_t **devlist, int devnum) + dr_common_unit_t **devlist, int devnum) { dr_board_t *bp = hp->h_bd; int i; @@ -1841,7 +1842,7 @@ dr_dev_configure(dr_handle_t *hp) static void dr_release_update_state(dr_handle_t *hp, - dr_common_unit_t **devlist, int devnum) + dr_common_unit_t **devlist, int devnum) { _NOTE(ARGUNUSED(devlist)) _NOTE(ARGUNUSED(devnum)) @@ -1965,7 +1966,7 @@ dr_dev_release(dr_handle_t *hp) static void dr_detach_update_state(dr_handle_t *hp, - dr_common_unit_t **devlist, int devnum) + dr_common_unit_t **devlist, int devnum) { dr_board_t *bp = hp->h_bd; int i; @@ -2686,7 +2687,7 @@ dr_nt_to_dev_type(int nt) */ static int dr_check_transition(dr_board_t *bp, dr_devset_t *devsetp, - struct dr_state_trans *transp, int cmd) + struct dr_state_trans *transp, int cmd) { int s, ut; int state_err = 0; diff --git a/usr/src/uts/sun4u/opl/io/dm2s.c b/usr/src/uts/sun4u/opl/io/dm2s.c index 92735d9981..1e6a1f9fc0 100644 --- a/usr/src/uts/sun4u/opl/io/dm2s.c +++ b/usr/src/uts/sun4u/opl/io/dm2s.c @@ -177,8 +177,8 @@ struct streamtab dm2s_streamtab = { NULL }; -DDI_DEFINE_STREAM_OPS(dm2s_ops, nulldev, nulldev, dm2s_attach, \ - dm2s_detach, nodev, dm2s_info, D_NEW | D_MP | D_MTPERMOD, \ +DDI_DEFINE_STREAM_OPS(dm2s_ops, nulldev, nulldev, dm2s_attach, + dm2s_detach, nodev, dm2s_info, D_NEW | D_MP | D_MTPERMOD, &dm2s_streamtab, ddi_quiesce_not_supported); @@ -296,7 +296,7 @@ dm2s_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) (void) sprintf(name, "%s%d", DM2S_MODNAME, instance); if (ddi_create_minor_node(dip, name, S_IFCHR, instance, - DDI_PSEUDO, NULL) == DDI_FAILURE) { + DDI_PSEUDO, 0) == DDI_FAILURE) { ddi_remove_minor_node(dip, NULL); cmn_err(CE_WARN, "Device node creation failed."); goto error; diff --git a/usr/src/uts/sun4u/opl/io/drmach.c b/usr/src/uts/sun4u/opl/io/drmach.c index 0999f18e15..651b60d8ba 100644 --- a/usr/src/uts/sun4u/opl/io/drmach.c +++ b/usr/src/uts/sun4u/opl/io/drmach.c @@ -218,14 +218,14 @@ static int drmach_node_ddi_get_prop(drmach_node_t *np, static int drmach_node_ddi_get_proplen(drmach_node_t *np, char *name, int *len); -static int drmach_get_portid(drmach_node_t *); +static int drmach_get_portid(drmach_node_t *); static sbd_error_t *drmach_i_status(drmachid_t, drmach_status_t *); static int opl_check_dr_status(); static void drmach_io_dispose(drmachid_t); static sbd_error_t *drmach_io_release(drmachid_t); static sbd_error_t *drmach_io_status(drmachid_t, drmach_status_t *); -static int drmach_init(void); -static void drmach_fini(void); +static int drmach_init(void); +static void drmach_fini(void); static void drmach_swap_pa(drmach_mem_t *, drmach_mem_t *); static drmach_board_t *drmach_get_board_by_bnum(int); @@ -457,7 +457,7 @@ struct drmach_hotcpu { drmach_board_t *bp; int bnum; int core_id; - int rv; + int rv; int option; }; @@ -652,7 +652,7 @@ drmach_setup_core_info(drmach_board_t *obj) typedef struct { drmach_node_walk_args_t *nwargs; - int (*cb)(drmach_node_walk_args_t *args); + int (*cb)(drmach_node_walk_args_t *args); int err; } drmach_node_ddi_walk_args_t; @@ -686,7 +686,7 @@ drmach_node_ddi_walk_cb(dev_info_t *dip, void *arg) static int drmach_node_ddi_walk(drmach_node_t *np, void *data, - int (*cb)(drmach_node_walk_args_t *args)) + int (*cb)(drmach_node_walk_args_t *args)) { drmach_node_walk_args_t args; drmach_node_ddi_walk_args_t nargs; @@ -735,7 +735,7 @@ drmach_node_ddi_get_parent(drmach_node_t *np, drmach_node_t *pp) static pnode_t drmach_node_ddi_get_dnode(drmach_node_t *np) { - return ((pnode_t)NULL); + return (0); } static drmach_node_t * @@ -769,7 +769,7 @@ drmach_node_ddi_get_dip(drmach_node_t *np) static int drmach_node_walk(drmach_node_t *np, void *param, - int (*cb)(drmach_node_walk_args_t *args)) + int (*cb)(drmach_node_walk_args_t *args)) { return (np->walk(np, param, cb)); } @@ -977,7 +977,7 @@ drmach_configure(drmachid_t id, int flags) static sbd_error_t * drmach_device_new(drmach_node_t *node, - drmach_board_t *bp, int portid, drmachid_t *idp) + drmach_board_t *bp, int portid, drmachid_t *idp) { int i; int rv; @@ -1541,7 +1541,7 @@ drmach_get_portid(drmach_node_t *np) static int drmach_name2type_idx(char *name) { - int index, ntypes; + int index, ntypes; if (name == NULL) return (-1); @@ -1656,7 +1656,7 @@ drmach_board_find_devices_cb(drmach_node_walk_args_t *args) sbd_error_t * drmach_board_find_devices(drmachid_t id, void *a, - sbd_error_t *(*found)(void *a, const char *, int, drmachid_t)) + sbd_error_t *(*found)(void *a, const char *, int, drmachid_t)) { drmach_board_t *bp = (drmach_board_t *)id; sbd_error_t *err; @@ -2782,7 +2782,7 @@ drmach_cpu_poweron(struct cpu *cp) int drmach_cpu_poweroff(struct cpu *cp) { - int rv = 0; + int rv = 0; processorid_t cpuid = cp->cpu_id; DRMACH_PR("drmach_cpu_poweroff: stopping cpuid %d\n", cp->cpu_id); @@ -2957,7 +2957,7 @@ opl_check_dr_status() static struct memlist * drmach_memlist_add_span(drmach_copy_rename_program_t *p, - struct memlist *mlist, uint64_t base, uint64_t len) + struct memlist *mlist, uint64_t base, uint64_t len) { struct memlist *ml, *tl, *nl; @@ -3072,7 +3072,7 @@ static int fmem_timeout = 17; /* * The empirical data on some OPL system shows that * we can copy 250 MB per second. We set it to - * 80 MB to be conservative. In normal case, + * 80 MB to be conservative. In normal case, * this timeout does not affect anything. */ @@ -3113,7 +3113,7 @@ static int drmach_copy_rename_timeout = 500; static int drmach_copy_rename_prog__relocatable(drmach_copy_rename_program_t *prog, - int cpuid) + int cpuid) { struct memlist *ml; register int rtn; @@ -3412,7 +3412,7 @@ drmach_unlock_critical(caddr_t va) sbd_error_t * drmach_copy_rename_init(drmachid_t t_id, drmachid_t s_id, - struct memlist *c_ml, drmachid_t *pgm_id) + struct memlist *c_ml, drmachid_t *pgm_id) { drmach_mem_t *s_mem; drmach_mem_t *t_mem; @@ -3690,7 +3690,7 @@ drmach_copy_rename_init(drmachid_t t_id, drmachid_t s_id, /* * max_elms - max number of memlist structures that - * may be allocated for the CPU memory list. + * may be allocated for the CPU memory list. * If there are too many memory span (because * of fragmentation) than number of memlist * available, we should return error. @@ -4042,7 +4042,7 @@ drmach_copy_rename(drmachid_t id) prog->critical->scf_reg_base = (*prog->data->scf_get_base_addr)(); if (prog->critical->scf_reg_base == (uint64_t)-1 || - prog->critical->scf_reg_base == NULL) { + prog->critical->scf_reg_base == 0) { prog->data->fmem_status.error = EOPL_FMEM_SCF_ERR; drmach_unlock_critical((caddr_t)prog); return; diff --git a/usr/src/uts/sun4u/opl/io/mc-opl.c b/usr/src/uts/sun4u/opl/io/mc-opl.c index 7d267110da..2ed14e6d22 100644 --- a/usr/src/uts/sun4u/opl/io/mc-opl.c +++ b/usr/src/uts/sun4u/opl/io/mc-opl.c @@ -607,12 +607,12 @@ mc_close(dev_t devp, int flag, int otyp, cred_t *credp) /* ARGSUSED */ static int mc_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp, - int *rvalp) + int *rvalp) { mc_flt_page_t flt_page; if (cmd == MCIOC_FAULT_PAGE) { - if (arg == NULL) + if (arg == (intptr_t)NULL) return (EINVAL); if (ddi_copyin((const void *)arg, (void *)&flt_page, @@ -1986,7 +1986,7 @@ mc_error_handler_mir(mc_opl_t *mcp, int bank, mc_rsaddr_info_t *rsaddr) } static int mc_process_error(mc_opl_t *mcp, int bank, mc_aflt_t *mc_aflt, - mc_flt_stat_t *flt_stat) + mc_flt_stat_t *flt_stat) { int ptrl_error = mc_aflt->mflt_is_ptrl; int rv = 0; @@ -2981,7 +2981,7 @@ mc_opl_get_physical_board(int sb) /* ARGSUSED */ int mc_get_mem_unum(int synd_code, uint64_t flt_addr, char *buf, int buflen, - int *lenp) + int *lenp) { int i; int j; @@ -4019,7 +4019,7 @@ mc_dump_dimm_info(board_dimm_info_t *bd_dimmp) /* ARGSUSED */ static int mc_ioctl_debug(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp, - int *rvalp) + int *rvalp) { caddr_t buf, kbuf; uint64_t pa; diff --git a/usr/src/uts/sun4u/opl/io/oplkmdrv.c b/usr/src/uts/sun4u/opl/io/oplkmdrv.c index be026a7c80..c2dfee332c 100644 --- a/usr/src/uts/sun4u/opl/io/oplkmdrv.c +++ b/usr/src/uts/sun4u/opl/io/oplkmdrv.c @@ -241,7 +241,7 @@ okm_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) */ okmsp->km_clean |= OKM_CLEAN_NODE; if (ddi_create_minor_node(dip, OKM_NODENAME, S_IFCHR, - instance, NULL, NULL) == DDI_FAILURE) { + instance, NULL, 0) == DDI_FAILURE) { cmn_err(CE_WARN, "Device node creation failed"); okm_cleanup(okmsp); return (DDI_FAILURE); diff --git a/usr/src/uts/sun4u/opl/io/oplmsu/oplmsu.c b/usr/src/uts/sun4u/opl/io/oplmsu/oplmsu.c index 4037644c39..dd1ed50fdb 100644 --- a/usr/src/uts/sun4u/opl/io/oplmsu/oplmsu.c +++ b/usr/src/uts/sun4u/opl/io/oplmsu/oplmsu.c @@ -660,7 +660,7 @@ oplmsu_close(queue_t *urq, int flag, cred_t *cred_p) cmn_err(CE_WARN, "oplmsu: close: node_flag = 0x%lx", node_flag); } - ctrl->minor = NULL; + ctrl->minor = 0; ctrl->queue = NULL; wbuf_id = ctrl->wbuf_id; wtout_id = ctrl->wtout_id; diff --git a/usr/src/uts/sun4u/opl/io/pcicmu/pcmu_counters.c b/usr/src/uts/sun4u/opl/io/pcicmu/pcmu_counters.c index baa214a87e..edc92c1228 100644 --- a/usr/src/uts/sun4u/opl/io/pcicmu/pcmu_counters.c +++ b/usr/src/uts/sun4u/opl/io/pcicmu/pcmu_counters.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/async.h> #include <sys/sunddi.h> @@ -56,7 +54,7 @@ pcmu_create_name_kstat(char *name, pcmu_ksinfo_t *pp, pcmu_kev_mask_t *ev) for (i = 0; i < NUM_OF_PICS; i++) { pp->pic_name_ksp[i] = pcmu_create_picN_kstat(name, - i, pp->pic_shift[i], pp->pic_no_evs, ev); + i, pp->pic_shift[i], pp->pic_no_evs, ev); if (pp->pic_name_ksp[i] == NULL) { cmn_err(CE_WARN, "pci: unable to create name kstat"); @@ -85,7 +83,7 @@ pcmu_delete_name_kstat(pcmu_ksinfo_t *pp) */ static kstat_t * pcmu_create_picN_kstat(char *mod_name, int pic, int pic_shift, - int num_ev, pcmu_kev_mask_t *ev_array) + int num_ev, pcmu_kev_mask_t *ev_array) { struct kstat_named *pic_named_data; int inst = 0; @@ -95,9 +93,9 @@ pcmu_create_picN_kstat(char *mod_name, int pic, int pic_shift, (void) sprintf(pic_name, "pic%d", pic); if ((picN_ksp = kstat_create(mod_name, inst, pic_name, - "bus", KSTAT_TYPE_NAMED, num_ev, NULL)) == NULL) { + "bus", KSTAT_TYPE_NAMED, num_ev, 0)) == NULL) { cmn_err(CE_WARN, "%s %s : kstat create failed", - mod_name, pic_name); + mod_name, pic_name); /* * It is up to the calling function to delete any kstats @@ -158,7 +156,7 @@ kstat_t *pcmu_create_cntr_kstat(pcmu_t *pcmu_p, char *name, "counters", "bus", KSTAT_TYPE_NAMED, num_pics + 1, KSTAT_FLAG_WRITABLE)) == NULL) { cmn_err(CE_WARN, "%s%d counters kstat_create failed", - drv_name, drv_instance); + drv_name, drv_instance); return (NULL); } diff --git a/usr/src/uts/sun4u/pcie/Makefile b/usr/src/uts/sun4u/pcie/Makefile index b1ad4eb65f..81f4d70472 100644 --- a/usr/src/uts/sun4u/pcie/Makefile +++ b/usr/src/uts/sun4u/pcie/Makefile @@ -42,8 +42,6 @@ UTSBASE = ../.. MODULE = pcie OBJECTS = $(PCIE_MISC_OBJS:%=$(OBJS_DIR)/%) \ $(PCI_STRING_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(PCIE_MISC_OBJS:%.o=$(LINTS_DIR)/%.ln) \ - $(PCI_STRING_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_MISC_DIR)/$(MODULE) # @@ -55,7 +53,6 @@ include $(UTSBASE)/sun4u/Makefile.sun4u # Define targets # ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # @@ -81,12 +78,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # diff --git a/usr/src/uts/sun4u/pic16f747/Makefile b/usr/src/uts/sun4u/pic16f747/Makefile index 530a5790a8..2b3a292a69 100644 --- a/usr/src/uts/sun4u/pic16f747/Makefile +++ b/usr/src/uts/sun4u/pic16f747/Makefile @@ -35,7 +35,6 @@ UTSBASE = ../.. # MODULE = pic16f747 OBJECTS = $(PIC16F747_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(PIC16F747_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) # @@ -50,10 +49,6 @@ ALL_TARGET = $(BINARY) LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses # @@ -69,16 +64,9 @@ 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/Makefile.targ - diff --git a/usr/src/uts/sun4u/pic16f819/Makefile b/usr/src/uts/sun4u/pic16f819/Makefile index 2df7ffa19d..cb0b95b4ed 100644 --- a/usr/src/uts/sun4u/pic16f819/Makefile +++ b/usr/src/uts/sun4u/pic16f819/Makefile @@ -22,10 +22,6 @@ # Copyright 2004 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" -# - # This makefile drives the pic16f819 build. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -37,7 +33,6 @@ UTSBASE = ../.. # MODULE = pic16f819 OBJECTS = $(PIC16F819_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(PIC16F819_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) # @@ -45,18 +40,12 @@ ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) # include $(UTSBASE)/sun4u/Makefile.sun4u -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) - LDFLAGS += -dy -N misc/i2c_svc # # Define targets # ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) .KEEP_STATE: @@ -69,12 +58,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # diff --git a/usr/src/uts/sun4u/rmc_comm/Makefile b/usr/src/uts/sun4u/rmc_comm/Makefile index ac8785ac2b..4afebe2b65 100644 --- a/usr/src/uts/sun4u/rmc_comm/Makefile +++ b/usr/src/uts/sun4u/rmc_comm/Makefile @@ -23,8 +23,6 @@ # 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 rmc_comm driver kernel # module in the sun4u systems # @@ -39,7 +37,6 @@ UTSBASE = ../.. # MODULE = rmc_comm OBJECTS = $(RMC_COMM_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(RMC_COMM_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) CONF_SRCDIR = $(UTSBASE)/sun4u/io @@ -52,32 +49,14 @@ include $(UTSBASE)/sun4u/Makefile.sun4u # Define targets # ALL_TARGET = $(BINARY) $(SRC_CONFILE) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) - -# # Turn on doubleword alignment for 64 bit registers # CFLAGS += -dalign # -# 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 - -# # Default build targets. # .KEEP_STATE: @@ -90,12 +69,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # diff --git a/usr/src/uts/sun4u/rmclomv/Makefile b/usr/src/uts/sun4u/rmclomv/Makefile index 9d77985ad2..8243155cb6 100644 --- a/usr/src/uts/sun4u/rmclomv/Makefile +++ b/usr/src/uts/sun4u/rmclomv/Makefile @@ -39,7 +39,6 @@ UTSBASE = ../.. # MODULE = rmclomv OBJECTS = $(RMCLOMV_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(RMCLOMV_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) CONF_SRCDIR = $(UTSBASE)/sun4u/io @@ -52,13 +51,8 @@ include $(UTSBASE)/sun4u/Makefile.sun4u # Define targets # ALL_TARGET = $(BINARY) $(SRC_CONFILE) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) LDFLAGS += -dy -Ndrv/rmc_comm -Ndrv/pmugpio # @@ -66,14 +60,6 @@ LDFLAGS += -dy -Ndrv/rmc_comm -Ndrv/pmugpio # CFLAGS += -dalign -# -# 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 -LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN - CERRWARN += -_gcc=-Wno-parentheses # @@ -89,12 +75,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # diff --git a/usr/src/uts/sun4u/seattle/Makefile b/usr/src/uts/sun4u/seattle/Makefile index 5cb4516a06..e9ff071a63 100644 --- a/usr/src/uts/sun4u/seattle/Makefile +++ b/usr/src/uts/sun4u/seattle/Makefile @@ -46,12 +46,8 @@ 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 # @@ -59,9 +55,7 @@ check := TARGET= check # .KEEP_STATE: -def all clean clean.lint clobber modlist: $(SEATTLE_KMODS) - -modlintlib: $(SEATTLE_KMODS) +def all clean clobber modlist: $(SEATTLE_KMODS) LINKED_PLATFORMS = SUNW,Sun-Fire-V245 @@ -78,24 +72,6 @@ install: $(ROOT_SEATTLE_DIR) \ check install_h: -lint: modlintlib - -# -# The 'lint.platmod' target lints the seattle 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/seattle.c. -# -LINT_LIBS = $(LINT_LIB) \ - -L$(SEATTLE_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) "\nSeattle Platform-dependent module: global crosschecks:" - @-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.2) - $(SEATTLE_KMODS): FRC @cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET) diff --git a/usr/src/uts/sun4u/seattle/os/seattle.c b/usr/src/uts/sun4u/seattle/os/seattle.c index 50eeb7ca09..80faf2faa3 100644 --- a/usr/src/uts/sun4u/seattle/os/seattle.c +++ b/usr/src/uts/sun4u/seattle/os/seattle.c @@ -52,7 +52,7 @@ int (*rmc_req_now)(rmc_comm_msg_t *, uint8_t) = NULL; void startup_platform(void) { - mutex_init(&mi2cv_mutex, NULL, NULL, NULL); + mutex_init(&mi2cv_mutex, NULL, MUTEX_ADAPTIVE, NULL); } int diff --git a/usr/src/uts/sun4u/ssc050/Makefile b/usr/src/uts/sun4u/ssc050/Makefile index 13bfe470b6..7701b0cef3 100644 --- a/usr/src/uts/sun4u/ssc050/Makefile +++ b/usr/src/uts/sun4u/ssc050/Makefile @@ -22,10 +22,6 @@ # Copyright 2004 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" -# - # This makefile drives the ssc050 build. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -37,7 +33,6 @@ UTSBASE = ../.. # MODULE = ssc050 OBJECTS = $(SSC050_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(SSC050_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) # @@ -45,18 +40,12 @@ ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) # include $(UTSBASE)/sun4u/Makefile.sun4u -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) - LDFLAGS += -dy -N misc/i2c_svc # # Define targets # ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) .KEEP_STATE: @@ -69,12 +58,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # diff --git a/usr/src/uts/sun4u/ssc100/Makefile b/usr/src/uts/sun4u/ssc100/Makefile index 579f19a910..f42fdb1b17 100644 --- a/usr/src/uts/sun4u/ssc100/Makefile +++ b/usr/src/uts/sun4u/ssc100/Makefile @@ -22,10 +22,6 @@ # Copyright 2004 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" -# - # This makefile drives the ssc100 build. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -37,7 +33,6 @@ UTSBASE = ../.. # MODULE = ssc100 OBJECTS = $(SSC100_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(SSC100_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) # @@ -45,18 +40,12 @@ ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) # include $(UTSBASE)/sun4u/Makefile.sun4u -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) - LDFLAGS += -dy -N misc/i2c_svc # # Define targets # ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) .KEEP_STATE: @@ -69,12 +58,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # diff --git a/usr/src/uts/sun4u/sunfire/Makefile b/usr/src/uts/sun4u/sunfire/Makefile index ee5e425567..d3d0cfc768 100644 --- a/usr/src/uts/sun4u/sunfire/Makefile +++ b/usr/src/uts/sun4u/sunfire/Makefile @@ -23,8 +23,6 @@ # 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 sun4u sunfire platform # module. # @@ -47,12 +45,8 @@ 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 # @@ -60,11 +54,9 @@ check := TARGET= check # .KEEP_STATE: -def all clean clean.lint clobber modlist: \ +def all clean clobber modlist: \ $(SUNFIRE_KMODS) $(CLOSED_SUNFIRE_KMODS) -modlintlib: $(SUNFIRE_KMODS) $(CLOSED_SUNFIRE_KMODS) - IMPLEMENTED_PLATFORM = SUNW,Ultra-Enterprise install: $(ROOT_SUNFIRE_DIR) $(USR_SUNFIRE_DIR) \ @@ -76,24 +68,6 @@ install: $(ROOT_SUNFIRE_DIR) $(USR_SUNFIRE_DIR) \ install_h check: FRC @cd sys; pwd; $(MAKE) $(TARGET) -lint: modlintlib - -# -# The 'lint.platmod' target lints the sunfire 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/sunfire.c. -# -LINT_LIBS = $(LINT_LIB) \ - -L$(SUNFIRE_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) "\nSunfire Platform-dependent module: global crosschecks:" - @-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.2) - $(SUNFIRE_KMODS): FRC @cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET) diff --git a/usr/src/uts/sun4u/sunfire/io/ac.c b/usr/src/uts/sun4u/sunfire/io/ac.c index c19cad9264..19cf822093 100644 --- a/usr/src/uts/sun4u/sunfire/io/ac.c +++ b/usr/src/uts/sun4u/sunfire/io/ac.c @@ -905,8 +905,8 @@ ac_add_picN_kstats(dev_info_t *dip) }; struct kstat_named *ac_pic_named_data; - int event, pic; - char pic_name[30]; + int event, pic; + char pic_name[30]; int instance = ddi_get_instance(dip); int pic_shift = 0; @@ -918,7 +918,7 @@ ac_add_picN_kstats(dev_info_t *dip) (void) sprintf(pic_name, "pic%d", pic); /* pic0, pic1 ... */ if ((ac_picN_ksp[pic] = kstat_create("ac", instance, pic_name, "bus", KSTAT_TYPE_NAMED, - AC_NUM_EVENTS + 1, NULL)) == NULL) { + AC_NUM_EVENTS + 1, 0)) == NULL) { cmn_err(CE_WARN, "ac %s: kstat_create failed", pic_name); diff --git a/usr/src/uts/sun4u/sunfire/io/fhc.c b/usr/src/uts/sun4u/sunfire/io/fhc.c index d47130bddc..d89eb3dfb5 100644 --- a/usr/src/uts/sun4u/sunfire/io/fhc.c +++ b/usr/src/uts/sun4u/sunfire/io/fhc.c @@ -245,7 +245,7 @@ short clk_danger_temp = 68; /* Clock Board Danger Temperature */ short dft_warn_temp = 60; /* default warning temp value */ short dft_danger_temp = 68; /* default danger temp value */ -short cpu_warn_temp_4x = 60; /* CPU/Memory warning temp for 400 MHZ */ +short cpu_warn_temp_4x = 60; /* CPU/Memory warning temp for 400 MHZ */ short cpu_danger_temp_4x = 68; /* CPU/Memory danger temp for 400 MHZ */ /* @@ -398,7 +398,7 @@ static struct cb_ops fhc_cb_ops = { nulldev, /* dump */ nulldev, /* read */ nulldev, /* write */ - nulldev, /* ioctl */ + nulldev, /* ioctl */ nodev, /* devmap */ nodev, /* mmap */ nodev, /* segmap */ @@ -1321,7 +1321,7 @@ done: */ static void fhc_remove_intr_impl(dev_info_t *dip, dev_info_t *rdip, - ddi_intr_handle_impl_t *hdlp) + ddi_intr_handle_impl_t *hdlp) { volatile uint_t *mondo_vec_reg; volatile uint_t tmpreg; @@ -1490,7 +1490,7 @@ fhc_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, */ static int fhc_ctlops(dev_info_t *dip, dev_info_t *rdip, - ddi_ctl_enum_t op, void *arg, void *result) + ddi_ctl_enum_t op, void *arg, void *result) { switch (op) { @@ -1529,7 +1529,6 @@ fhc_ctlops(dev_info_t *dip, dev_info_t *rdip, /* ARGSUSED */ static void fhc_xlate_intrs(ddi_intr_handle_impl_t *hdlp, uint32_t ign) - { uint32_t mondo; @@ -2384,8 +2383,8 @@ cpu_on_board(int board) int upa_a = board << 1; int upa_b = (board << 1) + 1; - if ((cpunodes[upa_a].nodeid != NULL) || - (cpunodes[upa_b].nodeid != NULL)) { + if ((cpunodes[upa_a].nodeid != 0) || + (cpunodes[upa_b].nodeid != 0)) { return (1); } else { return (0); @@ -3385,7 +3384,7 @@ fhc_cpu_poweron(struct cpu *cp) static void os_completes_shutdown(void) { - pfn_t pfn; + pfn_t pfn; tte_t tte; volatile uint_t *src; volatile uint_t *dst; diff --git a/usr/src/uts/sun4u/sunfire/io/sysctrl.c b/usr/src/uts/sun4u/sunfire/io/sysctrl.c index 206829b2a2..16ae450198 100644 --- a/usr/src/uts/sun4u/sunfire/io/sysctrl.c +++ b/usr/src/uts/sun4u/sunfire/io/sysctrl.c @@ -806,7 +806,7 @@ sysctrl_attach(dev_info_t *devi, ddi_attach_cmd_t cmd) * perform initialization to allow setting of powerfail-time */ if ((dip = ddi_find_devinfo("options", -1, 0)) == NULL) - softsp->options_nodeid = (pnode_t)NULL; + softsp->options_nodeid = (pnode_t)0; else softsp->options_nodeid = (pnode_t)ddi_get_nodeid(dip); @@ -1218,7 +1218,7 @@ sysc_pkt_fini(sysc_cfga_pkt_t *pkt, intptr_t arg, int flag) /* ARGSUSED */ static int sysctrl_ioctl(dev_t devt, int cmd, intptr_t arg, int flag, cred_t *cred_p, - int *rval_p) + int *rval_p) { struct sysctrl_soft_state *softsp; sysc_cfga_pkt_t sysc_pkt; diff --git a/usr/src/uts/sun4u/sunfire/io/sysctrl_quiesce.c b/usr/src/uts/sun4u/sunfire/io/sysctrl_quiesce.c index b9b091f759..86f576bf22 100644 --- a/usr/src/uts/sun4u/sunfire/io/sysctrl_quiesce.c +++ b/usr/src/uts/sun4u/sunfire/io/sysctrl_quiesce.c @@ -576,7 +576,7 @@ sysctrl_resume(sysc_cfga_pkt_t *pkt) */ if (sysc_watchdog_suspended) { mutex_enter(&tod_lock); - tod_ops.tod_set_watchdog_timer( + (void) tod_ops.tod_set_watchdog_timer( watchdog_timeout_seconds); mutex_exit(&tod_lock); } @@ -731,7 +731,7 @@ sysctrl_suspend(sysc_cfga_pkt_t *pkt) */ if (watchdog_activated) { mutex_enter(&tod_lock); - tod_ops.tod_clear_watchdog_timer(); + (void) tod_ops.tod_clear_watchdog_timer(); mutex_exit(&tod_lock); sysc_watchdog_suspended = 1; } else { diff --git a/usr/src/uts/sun4u/tazmo/Makefile b/usr/src/uts/sun4u/tazmo/Makefile index 1f69f760e9..53480d8bb5 100644 --- a/usr/src/uts/sun4u/tazmo/Makefile +++ b/usr/src/uts/sun4u/tazmo/Makefile @@ -24,8 +24,6 @@ # Copyright 2005 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 sun4u tazmo platform # module. # @@ -48,12 +46,8 @@ 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 # @@ -61,9 +55,7 @@ check := TARGET= check # .KEEP_STATE: -def all clean clean.lint clobber modlist: $(TAZMO_KMODS) $(CLOSED_TAZMO_KMODS) - -modlintlib: $(TAZMO_KMODS) $(CLOSED_TAZMO_KMODS) +def all clean clobber modlist: $(TAZMO_KMODS) $(CLOSED_TAZMO_KMODS) install: $(ROOT_TAZMO_DIR) $(USR_TAZMO_DIR) \ $(USR_TAZMO_INC_DIR) \ @@ -73,24 +65,6 @@ install: $(ROOT_TAZMO_DIR) $(USR_TAZMO_DIR) \ check install_h: -lint: modlintlib - -# -# The 'lint.platmod' target lints the tazmo 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/tazmo.c. -# -LINT_LIBS = $(LINT_LIB) \ - -L$(TAZMO_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) "\nTazmo Platform-dependent module: global crosschecks:" - @-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.2) - $(TAZMO_KMODS): FRC @cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET) diff --git a/usr/src/uts/sun4u/tazmo/io/envctrl.c b/usr/src/uts/sun4u/tazmo/io/envctrl.c index 40e7f6532b..30c3e93feb 100644 --- a/usr/src/uts/sun4u/tazmo/io/envctrl.c +++ b/usr/src/uts/sun4u/tazmo/io/envctrl.c @@ -59,13 +59,13 @@ #include <sys/envctrl.h> /* Environment header */ /* driver entry point fn definitions */ -static int envctrl_open(queue_t *, dev_t *, int, int, cred_t *); +static int envctrl_open(queue_t *, dev_t *, int, int, cred_t *); static int envctrl_close(queue_t *, int, cred_t *); -static uint_t envctrl_bus_isr(caddr_t); -static uint_t envctrl_dev_isr(caddr_t); +static uint_t envctrl_bus_isr(caddr_t); +static uint_t envctrl_dev_isr(caddr_t); /* configuration entry point fn definitions */ -static int envctrl_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **); +static int envctrl_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **); static int envctrl_attach(dev_info_t *, ddi_attach_cmd_t); static int envctrl_detach(dev_info_t *, ddi_detach_cmd_t); @@ -141,7 +141,7 @@ static int controller_present[] = {-1, -1, -1}; #ifdef MULTIFAN static int envctrl_fan_debug = 0; #endif -static int eHc_debug = 0; +static int eHc_debug = 0; static int power_supply_previous_state[] = {-1, -1, -1}; extern void pci_thermal_rem_intr(dev_info_t *, uint_t); @@ -274,12 +274,12 @@ static struct modlinkage envctrlmodlinkage = { #define EHC_DEV3 0x06 #define EHC_DEV4 0x08 #define EHC_DEV5 0x0A -#define EHC_DEV6 0x0C +#define EHC_DEV6 0x0C #define EHC_DEV7 0x0E /* - * CONTROL OF CHIP + * CONTROL OF CHIP * PCF8591 Temp sensing control register definitions * * 7 6 5 4 3 2 1 0 @@ -520,7 +520,7 @@ envctrl_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) (void) sprintf(name, "envctrl%d", instance); if (ddi_create_minor_node(dip, name, S_IFCHR, instance, DDI_PSEUDO, - NULL) == DDI_FAILURE) { + 0) == DDI_FAILURE) { ddi_remove_minor_node(dip, NULL); goto remhardintr1; } @@ -1449,7 +1449,7 @@ envctrl_init_bus(struct envctrlunit *unitp) { int i; - uint8_t noval = NULL; + uint8_t noval = 0; struct envctrl_tda8444t_chip fan; int fans[] = {ENVCTRL_CPU_FANS, ENVCTRL_PS_FANS, ENVCTRL_AFB_FANS}; @@ -1890,7 +1890,7 @@ envctrl_get_lm75_temp(struct envctrlunit *unitp) } else { k = lmval /2; } - return (k); + return (k); } @@ -1975,7 +1975,7 @@ envctrl_get_sys_temperatures(struct envctrlunit *unitp, uint8_t *diag_tempr) int i; struct envctrl_tda8444t_chip fan; uint8_t psaddr[] = {PSTEMP3, PSTEMP2, PSTEMP1, PSTEMP0}; - uint8_t noval = NULL; + uint8_t noval = 0; uint8_t fspval; ASSERT(MUTEX_HELD(&unitp->umutex)); @@ -2050,11 +2050,11 @@ envctrl_get_sys_temperatures(struct envctrlunit *unitp, uint8_t *diag_tempr) unitp->current_mode == ENVCTRL_NORMAL_MODE) { unitp->shutdown = B_TRUE; } - if (unitp->current_mode == ENVCTRL_NORMAL_MODE) { - cmn_err(CE_WARN, - "Ambient Temperature is %d C, shutdown now\n", - ambtemp); - } + if (unitp->current_mode == ENVCTRL_NORMAL_MODE) { + cmn_err(CE_WARN, + "Ambient Temperature is %d C, shutdown now\n", + ambtemp); + } } else { if (envctrl_isother_fault_led(unitp, fspval, ENVCTRL_FSP_TEMP_ERR)) { @@ -2106,16 +2106,16 @@ envctrl_get_sys_temperatures(struct envctrlunit *unitp, uint8_t *diag_tempr) } if (temperature < 0) { - fan.val = MAX_FAN_SPEED; /* blast it is out of range */ + fan.val = MAX_FAN_SPEED; /* blast it is out of range */ } else if (temperature > MAX_AMB_TEMP) { fan.val = MAX_FAN_SPEED; fspval |= (ENVCTRL_FSP_TEMP_ERR | ENVCTRL_FSP_GEN_ERR); - if (unitp->current_mode == ENVCTRL_NORMAL_MODE) { - cmn_err(CE_WARN, - "CPU Fans set to MAX. CPU Temp is %d C\n", - hicputemp); - } + if (unitp->current_mode == ENVCTRL_NORMAL_MODE) { + cmn_err(CE_WARN, + "CPU Fans set to MAX. CPU Temp is %d C\n", + hicputemp); + } } else if (ambtemp < MAX_AMB_TEMP) { if (!envctrl_p0_enclosure) { fan.val = acme_cpu_fanspd[temperature]; @@ -3635,7 +3635,7 @@ eHc_after_read_pcf8584(struct eHc_envcunit *ehcp, uint8_t *data) */ static int eHc_write_tda8444(struct eHc_envcunit *ehcp, int byteaddress, int instruction, - int subaddress, uint8_t *buf, int size) + int subaddress, uint8_t *buf, int size) { uint8_t control; int i, status; @@ -3687,7 +3687,7 @@ eHc_write_tda8444(struct eHc_envcunit *ehcp, int byteaddress, int instruction, */ static int eHc_read_pcf8574a(struct eHc_envcunit *ehcp, int byteaddress, uint8_t *buf, - int size) + int size) { int i; int status; @@ -3742,7 +3742,7 @@ eHc_read_pcf8574a(struct eHc_envcunit *ehcp, int byteaddress, uint8_t *buf, */ static int eHc_write_pcf8574a(struct eHc_envcunit *ehcp, int byteaddress, uint8_t *buf, - int size) + int size) { int i; int status; @@ -3789,7 +3789,7 @@ eHc_write_pcf8574a(struct eHc_envcunit *ehcp, int byteaddress, uint8_t *buf, */ static int eHc_read_pcf8574(struct eHc_envcunit *ehcp, int byteaddress, uint8_t *buf, - int size) + int size) { int i; int status; @@ -3844,7 +3844,7 @@ eHc_read_pcf8574(struct eHc_envcunit *ehcp, int byteaddress, uint8_t *buf, */ static int eHc_write_pcf8574(struct eHc_envcunit *ehcp, int byteaddress, uint8_t *buf, - int size) + int size) { int i; int status; @@ -3890,7 +3890,7 @@ eHc_write_pcf8574(struct eHc_envcunit *ehcp, int byteaddress, uint8_t *buf, */ static int eHc_read_lm75(struct eHc_envcunit *ehcp, int byteaddress, uint8_t *buf, - int size) + int size) { int i; int status; @@ -3944,7 +3944,7 @@ eHc_read_lm75(struct eHc_envcunit *ehcp, int byteaddress, uint8_t *buf, */ static int eHc_write_pcf8583(struct eHc_envcunit *ehcp, int byteaddress, uint8_t *buf, - int size) + int size) { int i; int status; @@ -3988,7 +3988,7 @@ eHc_write_pcf8583(struct eHc_envcunit *ehcp, int byteaddress, uint8_t *buf, */ static int eHc_read_pcf8591(struct eHc_envcunit *ehcp, int byteaddress, int channel, - int autoinc, int amode, int aenable, uint8_t *buf, int size) + int autoinc, int amode, int aenable, uint8_t *buf, int size) { int i; int status; diff --git a/usr/src/uts/sun4u/todds1287/Makefile b/usr/src/uts/sun4u/todds1287/Makefile index ee0d883bc9..df904ac01e 100644 --- a/usr/src/uts/sun4u/todds1287/Makefile +++ b/usr/src/uts/sun4u/todds1287/Makefile @@ -40,7 +40,6 @@ UTSBASE = ../.. # MODULE = todds1287 OBJECTS = $(TODDS1287_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(TODDS1287_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_TOD_DIR)/$(MODULE) # @@ -52,21 +51,8 @@ include $(UTSBASE)/sun4u/Makefile.sun4u # Define targets # ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) -# -# 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 - CERRWARN += $(CNOWARN_UNINIT) # @@ -82,16 +68,9 @@ 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/Makefile.targ - diff --git a/usr/src/uts/sun4u/todds1337/Makefile b/usr/src/uts/sun4u/todds1337/Makefile index 4e7ebf7363..3d068d04a7 100644 --- a/usr/src/uts/sun4u/todds1337/Makefile +++ b/usr/src/uts/sun4u/todds1337/Makefile @@ -22,8 +22,6 @@ # 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 todds1337 kernel module. # # sun4u implementation architecture dependent @@ -39,7 +37,6 @@ UTSBASE = ../.. # MODULE = todds1337 OBJECTS = $(TODDS1337_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(TODDS1337_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_TOD_DIR)/$(MODULE) # @@ -51,24 +48,11 @@ include $(UTSBASE)/sun4u/Makefile.sun4u # Define targets # ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) - LDFLAGS += -dy -N misc/i2c_svc # -# 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 - -# # Default build targets. # .KEEP_STATE: @@ -81,16 +65,9 @@ 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/Makefile.targ - diff --git a/usr/src/uts/sun4v/cpu/niagara_perfctr.c b/usr/src/uts/sun4v/cpu/niagara_perfctr.c index d32191727b..9e70093f7a 100644 --- a/usr/src/uts/sun4v/cpu/niagara_perfctr.c +++ b/usr/src/uts/sun4v/cpu/niagara_perfctr.c @@ -598,7 +598,7 @@ ni_delete_name_kstat(ni_ksinfo_t *pp) */ static kstat_t * ni_create_picN_kstat(char *mod_name, int pic, int pic_sel_shift, - int num_ev, ni_kev_mask_t *ev_array) + int num_ev, ni_kev_mask_t *ev_array) { struct kstat_named *pic_named_data; int inst = 0; @@ -608,7 +608,7 @@ ni_create_picN_kstat(char *mod_name, int pic, int pic_sel_shift, (void) sprintf(pic_name, "pic%d", pic); if ((picN_ksp = kstat_create(mod_name, inst, pic_name, - "bus", KSTAT_TYPE_NAMED, num_ev, NULL)) == NULL) { + "bus", KSTAT_TYPE_NAMED, num_ev, 0)) == NULL) { cmn_err(CE_WARN, "%s %s : kstat create failed", mod_name, pic_name); @@ -656,7 +656,7 @@ ni_create_picN_kstat(char *mod_name, int pic, int pic_sel_shift, */ static kstat_t * ni_create_cntr_kstat(char *name, int instance, int (*update)(kstat_t *, int), - void *ksinfop) + void *ksinfop) { struct kstat *counters_ksp; struct kstat_named *counters_named_data; diff --git a/usr/src/uts/sun4v/dr_cpu/Makefile b/usr/src/uts/sun4v/dr_cpu/Makefile index f4a96fa25a..2a2800ea37 100644 --- a/usr/src/uts/sun4v/dr_cpu/Makefile +++ b/usr/src/uts/sun4v/dr_cpu/Makefile @@ -23,8 +23,6 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -36,7 +34,6 @@ UTSBASE = ../.. # MODULE = dr_cpu OBJECTS = $(DR_CPU_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(DR_CPU_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_MISC_DIR)/$(MODULE) # @@ -48,15 +45,9 @@ include $(UTSBASE)/sun4v/Makefile.sun4v # 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 @@ -79,12 +70,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # diff --git a/usr/src/uts/sun4v/dr_mem/Makefile b/usr/src/uts/sun4v/dr_mem/Makefile index f55ea3ef6b..3f8233df47 100644 --- a/usr/src/uts/sun4v/dr_mem/Makefile +++ b/usr/src/uts/sun4v/dr_mem/Makefile @@ -34,7 +34,6 @@ UTSBASE = ../.. # MODULE = dr_mem OBJECTS = $(DR_MEM_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(DR_MEM_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_MISC_DIR)/$(MODULE) # @@ -46,13 +45,8 @@ include $(UTSBASE)/sun4v/Makefile.sun4v # Define targets # ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses # @@ -78,12 +72,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # diff --git a/usr/src/uts/sun4v/glvc/Makefile b/usr/src/uts/sun4v/glvc/Makefile index 997f92cef7..5d44984f49 100644 --- a/usr/src/uts/sun4v/glvc/Makefile +++ b/usr/src/uts/sun4v/glvc/Makefile @@ -22,9 +22,7 @@ # 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 virtual channel driver +# This makefile drives the production of the virtual channel driver # kernel module. # # sun4v implementation architecture dependent @@ -38,9 +36,8 @@ UTSBASE = ../.. # # Define the module and object file sets. # -MODULE = glvc +MODULE = glvc OBJECTS = $(GLVC_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(GLVC_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) # @@ -59,24 +56,9 @@ CLEANFILES += $(MODSTUBS_O) # Define targets # ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # -# 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_ASSIGN_NARROW_CONV -LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON - -# # Default build targets. # .KEEP_STATE: @@ -89,12 +71,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # diff --git a/usr/src/uts/sun4v/io/dr_cpu.c b/usr/src/uts/sun4v/io/dr_cpu.c index f2cfbb5873..e980cb55de 100644 --- a/usr/src/uts/sun4v/io/dr_cpu.c +++ b/usr/src/uts/sun4v/io/dr_cpu.c @@ -583,7 +583,7 @@ dr_cpu_res_array_init(dr_cpu_hdr_t *req, drctl_rsrc_t *rsrc, int nrsrc) * on the memory allocated for the message buffer * itself. */ - if (rsrc[idx].offset != NULL) { + if (rsrc[idx].offset != 0) { err_str = (char *)rsrc + rsrc[idx].offset; err_len = strlen(err_str) + 1; diff --git a/usr/src/uts/sun4v/io/dr_mem.c b/usr/src/uts/sun4v/io/dr_mem.c index c9695e7c6f..2443f4d550 100644 --- a/usr/src/uts/sun4v/io/dr_mem.c +++ b/usr/src/uts/sun4v/io/dr_mem.c @@ -611,7 +611,7 @@ dr_mem_res_array_init(dr_mem_hdr_t *req, drctl_rsrc_t *rsrc, int nrsrc) * on the memory allocated for the message buffer * itself. */ - if (rsrc[idx].offset != NULL) { + if (rsrc[idx].offset != 0) { err_str = (char *)rsrc + rsrc[idx].offset; err_len = strlen(err_str) + 1; @@ -768,7 +768,7 @@ dr_mem_list_query(dr_mem_hdr_t *req, dr_mem_hdr_t **resp, int *resp_len) /* allocate a response message, should be freed by caller */ nml = 0; rlen = sizeof (dr_mem_hdr_t); - if (req_mblks->addr == NULL && req_mblks->size == 0) { + if (req_mblks->addr == 0 && req_mblks->size == 0) { /* * Request is for domain's full view of it's memory. * place a copy in phys_copy then release the memlist lock. @@ -926,8 +926,8 @@ dr_mem_unconfigure(dr_mem_blk_t *mbp, int *status) if (!MBLK_IS_VALID(mbp)) { DR_DBG_MEM("invalid mblk 0x%lx.0x%lx\n", mbp->addr, mbp->size); - *status = DR_MEM_STAT_CONFIGURED; - rv = DR_MEM_RES_EINVAL; + *status = DR_MEM_STAT_CONFIGURED; + rv = DR_MEM_RES_EINVAL; } else if (rv = mem_del(btop(mbp->addr), btop(mbp->size))) { *status = DR_MEM_STAT_CONFIGURED; } else { diff --git a/usr/src/uts/sun4v/io/glvc/glvc.c b/usr/src/uts/sun4v/io/glvc/glvc.c index 8c151416aa..77dd8c60f3 100644 --- a/usr/src/uts/sun4v/io/glvc/glvc.c +++ b/usr/src/uts/sun4v/io/glvc/glvc.c @@ -254,7 +254,7 @@ glvc_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) { int instance; int err; - glvc_soft_state_t *softsp; + glvc_soft_state_t *softsp; switch (cmd) { case DDI_ATTACH: @@ -338,7 +338,7 @@ glvc_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) va_to_pa((caddr_t)softsp->mb_send_buf); err = ddi_create_minor_node(dip, "glvc", S_IFCHR, - instance, DDI_PSEUDO, NULL); + instance, DDI_PSEUDO, 0); if (err != DDI_SUCCESS) { kmem_free(softsp->mb_recv_buf, softsp->mtu); kmem_free(softsp->mb_send_buf, softsp->mtu); @@ -412,7 +412,7 @@ glvc_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) { int instance; int err; - glvc_soft_state_t *softsp; + glvc_soft_state_t *softsp; switch (cmd) { diff --git a/usr/src/uts/sun4v/io/iospc/iospc.c b/usr/src/uts/sun4v/io/iospc/iospc.c index 47efae480c..8ca72c2539 100644 --- a/usr/src/uts/sun4v/io/iospc/iospc.c +++ b/usr/src/uts/sun4v/io/iospc/iospc.c @@ -377,7 +377,7 @@ iospc_create_picN_kstat(char *mod_name, int pic, uint64_t ev_offset, (void) snprintf(pic_name, PIC_STR_LEN, "pic%1d", pic); if ((picN_ksp = kstat_create(mod_name, 0, pic_name, - "bus", KSTAT_TYPE_NAMED, num_ev, NULL)) == NULL) { + "bus", KSTAT_TYPE_NAMED, num_ev, 0)) == NULL) { return (NULL); } @@ -467,7 +467,7 @@ iospc_create_cntr_kstat(char *name, int dev_inst, */ static int iospc_perfcnt_program(iospc_t *iospc_p, iospc_grp_t *grp_p, - iospc_ksinfo_t *ksinfo_p, uint64_t new_events) + iospc_ksinfo_t *ksinfo_p, uint64_t new_events) { uint64_t old_events; int rval = SUCCESS; diff --git a/usr/src/uts/sun4v/io/ldc.c b/usr/src/uts/sun4v/io/ldc.c index 939c260834..0b2b94d173 100644 --- a/usr/src/uts/sun4v/io/ldc.c +++ b/usr/src/uts/sun4v/io/ldc.c @@ -288,18 +288,6 @@ ldc_inject_error(ldc_chan_t *ldcp, uint64_t error) return (B_TRUE); } -#define D1 \ -if (ldcdbg & 0x01) \ - ldcdebug - -#define D2 \ -if (ldcdbg & 0x02) \ - ldcdebug - -#define DWARN \ -if (ldcdbg & 0x04) \ - ldcdebug - #define DUMP_PAYLOAD(id, addr) \ { \ char buf[65*3]; \ @@ -321,10 +309,10 @@ if (ldcdbg & 0x04) \ (msg->env & LDC_FRAG_START) ? 'B' : ' ', \ (msg->env & LDC_FRAG_STOP) ? 'E' : ' ', \ (msg->env & LDC_LEN_MASK)); \ - } else { \ + } else { \ D2((c)->id, "%s: msg%d (/%x/%x/%x/,env=%x)", (s), \ mid, msg->type, msg->stype, msg->ctrl, msg->env); \ - } \ + } \ } #define LDC_INJECT_RESET(_ldcp) ldc_inject_error(_ldcp, LDC_ERR_RESET) @@ -337,10 +325,6 @@ extern void i_ldc_mem_inject_dring_clear(ldc_chan_t *ldcp); #define DBG_ALL_LDCS -1 -#define D1 -#define D2 -#define DWARN - #define DUMP_PAYLOAD(id, addr) #define DUMP_LDC_PKT(c, s, addr) @@ -461,10 +445,10 @@ _info(struct modinfo *modinfop) int _fini(void) { - int rv, status; - ldc_chan_t *tmp_ldcp, *ldcp; - ldc_dring_t *tmp_dringp, *dringp; - ldc_mem_info_t minfo; + int rv, status; + ldc_chan_t *tmp_ldcp, *ldcp; + ldc_dring_t *tmp_dringp, *dringp; + ldc_mem_info_t minfo; /* Unlink the driver module from the system */ status = mod_remove(&ml); @@ -564,7 +548,7 @@ i_ldc_h2v_error(int h_error) case H_ENOTSUPPORTED: return (ENOTSUP); - case H_ETOOMANY: + case H_ETOOMANY: return (ENOSPC); case H_ECHANNEL: @@ -809,8 +793,8 @@ i_ldc_clear_intr(ldc_chan_t *ldcp, cnex_intrtype_t itype) static int i_ldc_set_rx_head(ldc_chan_t *ldcp, uint64_t head) { - int rv; - int retries; + int rv; + int retries; ASSERT(MUTEX_HELD(&ldcp->lock)); for (retries = 0; retries < ldc_max_retries; retries++) { @@ -840,7 +824,7 @@ i_ldc_set_rx_head(ldc_chan_t *ldcp, uint64_t head) static void i_ldc_get_tx_head(ldc_chan_t *ldcp, uint64_t *head) { - ldc_msg_t *pkt; + ldc_msg_t *pkt; ASSERT(MUTEX_HELD(&ldcp->tx_lock)); @@ -876,8 +860,8 @@ i_ldc_get_tx_head(ldc_chan_t *ldcp, uint64_t *head) static int i_ldc_get_tx_tail(ldc_chan_t *ldcp, uint64_t *tail) { - int rv; - uint64_t current_head, new_tail; + int rv; + uint64_t current_head, new_tail; ASSERT(MUTEX_HELD(&ldcp->tx_lock)); /* Read the head and tail ptrs from HV */ @@ -924,7 +908,7 @@ static int i_ldc_set_tx_tail(ldc_chan_t *ldcp, uint64_t tail) { int rv, retval = EWOULDBLOCK; - int retries; + int retries; ASSERT(MUTEX_HELD(&ldcp->tx_lock)); for (retries = 0; retries < ldc_max_retries; retries++) { @@ -1131,7 +1115,7 @@ i_ldc_send_pkt(ldc_chan_t *ldcp, uint8_t pkttype, uint8_t subtype, uint8_t ctrlmsg) { int rv; - ldc_msg_t *pkt; + ldc_msg_t *pkt; uint64_t tx_tail; uint32_t curr_seqid; @@ -1236,8 +1220,8 @@ i_ldc_check_seqid(ldc_chan_t *ldcp, ldc_msg_t *msg) static int i_ldc_process_VER(ldc_chan_t *ldcp, ldc_msg_t *msg) { - int rv = 0, idx = ldcp->next_vidx; - ldc_msg_t *pkt; + int rv = 0, idx = ldcp->next_vidx; + ldc_msg_t *pkt; uint64_t tx_tail; ldc_ver_t *rcvd_ver; @@ -1533,8 +1517,8 @@ i_ldc_process_VER(ldc_chan_t *ldcp, ldc_msg_t *msg) static int i_ldc_process_RTS(ldc_chan_t *ldcp, ldc_msg_t *msg) { - int rv = 0; - ldc_msg_t *pkt; + int rv = 0; + ldc_msg_t *pkt; uint64_t tx_tail; boolean_t sent_NACK = B_FALSE; @@ -1660,7 +1644,7 @@ i_ldc_process_RTS(ldc_chan_t *ldcp, ldc_msg_t *msg) static int i_ldc_process_RTR(ldc_chan_t *ldcp, ldc_msg_t *msg) { - int rv = 0; + int rv = 0; boolean_t sent_NACK = B_FALSE; D2(ldcp->id, "i_ldc_process_RTR: (0x%llx) received RTR\n", ldcp->id); @@ -1824,7 +1808,7 @@ static int i_ldc_process_data_ACK(ldc_chan_t *ldcp, ldc_msg_t *msg) { int rv; - uint64_t tx_head; + uint64_t tx_head; ldc_msg_t *pkt; /* Obtain Tx lock */ @@ -1892,7 +1876,7 @@ i_ldc_process_data_ACK(ldc_chan_t *ldcp, ldc_msg_t *msg) static int i_ldc_ctrlmsg(ldc_chan_t *ldcp, ldc_msg_t *msg) { - int rv = 0; + int rv = 0; D1(ldcp->id, "i_ldc_ctrlmsg: (%llx) tstate = %lx, hstate = %lx\n", ldcp->id, ldcp->tstate, ldcp->hstate); @@ -2102,9 +2086,9 @@ i_ldc_tx_hdlr(caddr_t arg1, caddr_t arg2) { _NOTE(ARGUNUSED(arg2)) - int rv; - ldc_chan_t *ldcp; - boolean_t notify_client = B_FALSE; + int rv; + ldc_chan_t *ldcp; + boolean_t notify_client = B_FALSE; uint64_t notify_event = 0, link_state; /* Get the channel for which interrupt was received */ @@ -2227,8 +2211,8 @@ i_ldc_rx_process_hvq(ldc_chan_t *ldcp, boolean_t *notify_client, uint64_t *notify_event) { int rv; - uint64_t rx_head, rx_tail; - ldc_msg_t *msg; + uint64_t rx_head, rx_tail; + ldc_msg_t *msg; uint64_t link_state, first_fragment = 0; boolean_t trace_length = B_TRUE; @@ -2580,7 +2564,7 @@ i_ldc_rx_ackpeek(ldc_chan_t *ldcp, uint64_t rx_head, uint64_t rx_tail) int ldc_init(uint64_t id, ldc_attr_t *attr, ldc_handle_t *handle) { - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; int rv, exit_val; uint64_t ra_base, nentries; uint64_t qlen; @@ -2728,7 +2712,7 @@ ldc_init(uint64_t id, ldc_attr_t *attr, ldc_handle_t *handle) /* Create a transmit queue */ ldcp->tx_q_va = (uint64_t) contig_mem_alloc(ldcp->tx_q_entries << LDC_PACKET_SHIFT); - if (ldcp->tx_q_va == NULL) { + if (ldcp->tx_q_va == 0) { cmn_err(CE_WARN, "ldc_init: (0x%lx) TX queue allocation failed\n", ldcp->id); @@ -2745,7 +2729,7 @@ ldc_init(uint64_t id, ldc_attr_t *attr, ldc_handle_t *handle) /* Create a receive queue */ ldcp->rx_q_va = (uint64_t) contig_mem_alloc(ldcp->rx_q_entries << LDC_PACKET_SHIFT); - if (ldcp->rx_q_va == NULL) { + if (ldcp->rx_q_va == 0) { cmn_err(CE_WARN, "ldc_init: (0x%lx) RX queue allocation failed\n", ldcp->id); @@ -2775,7 +2759,7 @@ ldc_init(uint64_t id, ldc_attr_t *attr, ldc_handle_t *handle) ldcp->rx_dq_va = (uint64_t) kmem_alloc(ldcp->rx_dq_entries << LDC_PACKET_SHIFT, KM_SLEEP); - if (ldcp->rx_dq_va == NULL) { + if (ldcp->rx_dq_va == 0) { cmn_err(CE_WARN, "ldc_init: (0x%lx) RX data queue " "allocation failed\n", ldcp->id); @@ -2831,8 +2815,7 @@ cleanup_on_exit: mutex_destroy(&ldcp->tx_lock); mutex_destroy(&ldcp->lock); - if (ldcp) - kmem_free(ldcp, sizeof (ldc_chan_t)); + kmem_free(ldcp, sizeof (ldc_chan_t)); return (exit_val); } @@ -2846,11 +2829,11 @@ cleanup_on_exit: int ldc_fini(ldc_handle_t handle) { - ldc_chan_t *ldcp; - ldc_chan_t *tmp_ldcp; - uint64_t id; + ldc_chan_t *ldcp; + ldc_chan_t *tmp_ldcp; + uint64_t id; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_fini: invalid channel handle\n"); return (EINVAL); } @@ -2895,7 +2878,7 @@ ldc_fini(ldc_handle_t handle) /* Free the map table for this channel */ if (ldcp->mtbl) { - (void) hv_ldc_set_map_table(ldcp->id, NULL, NULL); + (void) hv_ldc_set_map_table(ldcp->id, 0, 0); if (ldcp->mtbl->contigmem) contig_mem_free(ldcp->mtbl->table, ldcp->mtbl->size); else @@ -2951,10 +2934,10 @@ ldc_fini(ldc_handle_t handle) int ldc_open(ldc_handle_t handle) { - ldc_chan_t *ldcp; - int rv; + ldc_chan_t *ldcp; + int rv; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_open: invalid channel handle\n"); return (EINVAL); } @@ -2979,7 +2962,7 @@ ldc_open(ldc_handle_t handle) /* * Unregister/Register the tx queue with the hypervisor */ - rv = hv_ldc_tx_qconf(ldcp->id, NULL, NULL); + rv = hv_ldc_tx_qconf(ldcp->id, 0, 0); if (rv) { cmn_err(CE_WARN, "ldc_open: (0x%lx) channel tx queue unconf failed\n", @@ -3003,7 +2986,7 @@ ldc_open(ldc_handle_t handle) /* * Unregister/Register the rx queue with the hypervisor */ - rv = hv_ldc_rx_qconf(ldcp->id, NULL, NULL); + rv = hv_ldc_rx_qconf(ldcp->id, 0, 0); if (rv) { cmn_err(CE_WARN, "ldc_open: (0x%lx) channel rx queue unconf failed\n", @@ -3032,8 +3015,8 @@ ldc_open(ldc_handle_t handle) cmn_err(CE_WARN, "ldc_open: (0x%lx) channel register failed\n", ldcp->id); ldcp->tstate &= ~TS_QCONF_RDY; - (void) hv_ldc_tx_qconf(ldcp->id, NULL, NULL); - (void) hv_ldc_rx_qconf(ldcp->id, NULL, NULL); + (void) hv_ldc_tx_qconf(ldcp->id, 0, 0); + (void) hv_ldc_rx_qconf(ldcp->id, 0, 0); mutex_exit(&ldcp->lock); return (EIO); } @@ -3050,8 +3033,8 @@ ldc_open(ldc_handle_t handle) ldcp->id); (void) i_ldc_unregister_channel(ldcp); ldcp->tstate &= ~TS_QCONF_RDY; - (void) hv_ldc_tx_qconf(ldcp->id, NULL, NULL); - (void) hv_ldc_rx_qconf(ldcp->id, NULL, NULL); + (void) hv_ldc_tx_qconf(ldcp->id, 0, 0); + (void) hv_ldc_rx_qconf(ldcp->id, 0, 0); mutex_exit(&ldcp->lock); return (EIO); } @@ -3102,11 +3085,11 @@ ldc_open(ldc_handle_t handle) int ldc_close(ldc_handle_t handle) { - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; int rv = 0, retries = 0; boolean_t chk_done = B_FALSE; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_close: invalid channel handle\n"); return (EINVAL); } @@ -3230,7 +3213,7 @@ ldc_close(ldc_handle_t handle) /* * Unregister queues */ - rv = hv_ldc_tx_qconf(ldcp->id, NULL, NULL); + rv = hv_ldc_tx_qconf(ldcp->id, 0, 0); if (rv) { cmn_err(CE_WARN, "ldc_close: (0x%lx) channel TX queue unconf failed\n", @@ -3239,7 +3222,7 @@ ldc_close(ldc_handle_t handle) mutex_exit(&ldcp->lock); return (EIO); } - rv = hv_ldc_rx_qconf(ldcp->id, NULL, NULL); + rv = hv_ldc_rx_qconf(ldcp->id, 0, 0); if (rv) { cmn_err(CE_WARN, "ldc_close: (0x%lx) channel RX queue unconf failed\n", @@ -3280,7 +3263,7 @@ ldc_reg_callback(ldc_handle_t handle, { ldc_chan_t *ldcp; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_reg_callback: invalid channel handle\n"); return (EINVAL); @@ -3327,7 +3310,7 @@ ldc_unreg_callback(ldc_handle_t handle) { ldc_chan_t *ldcp; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_unreg_callback: invalid channel handle\n"); return (EINVAL); @@ -3373,12 +3356,12 @@ ldc_unreg_callback(ldc_handle_t handle) int ldc_up(ldc_handle_t handle) { - int rv; - ldc_chan_t *ldcp; - ldc_msg_t *ldcmsg; - uint64_t tx_tail, tstate, link_state; + int rv; + ldc_chan_t *ldcp; + ldc_msg_t *ldcmsg; + uint64_t tx_tail, tstate, link_state; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_up: invalid channel handle\n"); return (EINVAL); } @@ -3515,9 +3498,9 @@ ldc_up(ldc_handle_t handle) int ldc_down(ldc_handle_t handle) { - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_down: invalid channel handle\n"); return (EINVAL); } @@ -3539,7 +3522,7 @@ ldc_status(ldc_handle_t handle, ldc_status_t *status) { ldc_chan_t *ldcp; - if (handle == NULL || status == NULL) { + if (handle == 0 || status == NULL) { DWARN(DBG_ALL_LDCS, "ldc_status: invalid argument\n"); return (EINVAL); } @@ -3559,9 +3542,9 @@ ldc_status(ldc_handle_t handle, ldc_status_t *status) int ldc_set_cb_mode(ldc_handle_t handle, ldc_cb_mode_t cmode) { - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_set_intr_mode: invalid channel handle\n"); return (EINVAL); @@ -3613,11 +3596,11 @@ ldc_set_cb_mode(ldc_handle_t handle, ldc_cb_mode_t cmode) int ldc_chkq(ldc_handle_t handle, boolean_t *hasdata) { - int rv; - uint64_t rx_head, rx_tail; - ldc_chan_t *ldcp; + int rv; + uint64_t rx_head, rx_tail; + ldc_chan_t *ldcp; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_chkq: invalid channel handle\n"); return (EINVAL); } @@ -3720,11 +3703,11 @@ ldc_chkq(ldc_handle_t handle, boolean_t *hasdata) int ldc_read(ldc_handle_t handle, caddr_t bufp, size_t *sizep) { - ldc_chan_t *ldcp; - uint64_t rx_head = 0, rx_tail = 0; + ldc_chan_t *ldcp; + uint64_t rx_head = 0, rx_tail = 0; int rv = 0, exit_val; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_read: invalid channel handle\n"); return (EINVAL); } @@ -3809,11 +3792,11 @@ ldc_read(ldc_handle_t handle, caddr_t bufp, size_t *sizep) static int i_ldc_read_raw(ldc_chan_t *ldcp, caddr_t target_bufp, size_t *sizep) { - uint64_t q_size_mask; - ldc_msg_t *msgp; + uint64_t q_size_mask; + ldc_msg_t *msgp; uint8_t *msgbufp; int rv = 0, space; - uint64_t rx_head, rx_tail; + uint64_t rx_head, rx_tail; space = *sizep; @@ -3885,13 +3868,13 @@ static int i_ldc_read_packet(ldc_chan_t *ldcp, caddr_t target_bufp, size_t *sizep) { int rv = 0; - uint64_t rx_head = 0, rx_tail = 0; - uint64_t curr_head = 0; - ldc_msg_t *msg; - caddr_t target; - size_t len = 0, bytes_read = 0; - int retries = 0; - uint64_t q_va, q_size_mask; + uint64_t rx_head = 0, rx_tail = 0; + uint64_t curr_head = 0; + ldc_msg_t *msg; + caddr_t target; + size_t len = 0, bytes_read = 0; + int retries = 0; + uint64_t q_va, q_size_mask; uint64_t first_fragment = 0; target = target_bufp; @@ -4286,7 +4269,7 @@ ldc_write(ldc_handle_t handle, caddr_t buf, size_t *sizep) ldc_chan_t *ldcp; int rv = 0; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_write: invalid channel handle\n"); return (EINVAL); } @@ -4332,8 +4315,8 @@ ldc_write(ldc_handle_t handle, caddr_t buf, size_t *sizep) static int i_ldc_write_raw(ldc_chan_t *ldcp, caddr_t buf, size_t *sizep) { - ldc_msg_t *ldcmsg; - uint64_t tx_head, tx_tail, new_tail; + ldc_msg_t *ldcmsg; + uint64_t tx_head, tx_tail, new_tail; int rv = 0; size_t size; @@ -4463,11 +4446,11 @@ i_ldc_write_raw(ldc_chan_t *ldcp, caddr_t buf, size_t *sizep) static int i_ldc_write_packet(ldc_chan_t *ldcp, caddr_t buf, size_t *size) { - ldc_msg_t *ldcmsg; - uint64_t tx_head, tx_tail, new_tail, start; + ldc_msg_t *ldcmsg; + uint64_t tx_head, tx_tail, new_tail, start; uint64_t txq_size_mask, numavail; - uint8_t *msgbuf, *source = (uint8_t *)buf; - size_t len, bytes_written = 0, remaining; + uint8_t *msgbuf, *source = (uint8_t *)buf; + size_t len, bytes_written = 0, remaining; int rv; uint32_t curr_seqid; @@ -4735,7 +4718,7 @@ ldc_info(ldc_handle_t handle, ldc_info_t *info) ldc_chan_t *ldcp; uint64_t avail; - if (handle == NULL || info == NULL) { + if (handle == 0 || info == NULL) { DWARN(DBG_ALL_LDCS, "ldc_get_info: invalid args\n"); return (EINVAL); } diff --git a/usr/src/uts/sun4v/io/ldc_shm.c b/usr/src/uts/sun4v/io/ldc_shm.c index f35bcdb7f0..f8edd4f845 100644 --- a/usr/src/uts/sun4v/io/ldc_shm.c +++ b/usr/src/uts/sun4v/io/ldc_shm.c @@ -191,10 +191,10 @@ i_ldc_init_mapin(ldc_soft_state_t *ldcssp, uint64_t major, uint64_t minor) int ldc_mem_alloc_handle(ldc_handle_t handle, ldc_mem_handle_t *mhandle) { - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; ldc_mhdl_t *mhdl; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_alloc_handle: invalid channel handle\n"); return (EINVAL); @@ -250,10 +250,10 @@ ldc_mem_alloc_handle(ldc_handle_t handle, ldc_mem_handle_t *mhandle) int ldc_mem_free_handle(ldc_mem_handle_t mhandle) { - ldc_mhdl_t *mhdl, *phdl; - ldc_chan_t *ldcp; + ldc_mhdl_t *mhdl, *phdl; + ldc_chan_t *ldcp; - if (mhandle == NULL) { + if (mhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_free_handle: invalid memory handle\n"); return (EINVAL); @@ -346,7 +346,7 @@ i_ldc_mem_bind_handle(ldc_mem_handle_t mhandle, caddr_t vaddr, size_t len, uint8_t mtype, uint8_t perm, ldc_mem_cookie_t *cookie, uint32_t *ccount) { ldc_mhdl_t *mhdl; - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; ldc_mtbl_t *mtbl; ldc_memseg_t *memseg; ldc_mte_t tmp_mte; @@ -357,9 +357,9 @@ i_ldc_mem_bind_handle(ldc_mem_handle_t mhandle, caddr_t vaddr, size_t len, uint64_t pg_shift, pg_size, pg_size_code, pg_mask; pgcnt_t npages; caddr_t v_align, addr; - int i, rv; + int i, rv; - if (mhandle == NULL) { + if (mhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_bind_handle: invalid memory handle\n"); return (EINVAL); @@ -400,7 +400,7 @@ i_ldc_mem_bind_handle(ldc_mem_handle_t mhandle, caddr_t vaddr, size_t len, mtbl = kmem_zalloc(sizeof (ldc_mtbl_t), KM_SLEEP); mtbl->num_entries = mtbl->num_avail = ldc_maptable_entries; mtbl->size = ldc_maptable_entries * sizeof (ldc_mte_slot_t); - mtbl->next_entry = NULL; + mtbl->next_entry = 0; mtbl->contigmem = B_TRUE; /* Allocate the table itself */ @@ -671,10 +671,10 @@ int ldc_mem_nextcookie(ldc_mem_handle_t mhandle, ldc_mem_cookie_t *cookie) { ldc_mhdl_t *mhdl; - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; ldc_memseg_t *memseg; - if (mhandle == NULL) { + if (mhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_nextcookie: invalid memory handle\n"); return (EINVAL); @@ -727,14 +727,14 @@ int ldc_mem_unbind_handle(ldc_mem_handle_t mhandle) { ldc_mhdl_t *mhdl; - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; ldc_mtbl_t *mtbl; ldc_memseg_t *memseg; uint64_t cookie_addr; uint64_t pg_shift, pg_size_code; int i, rv, retries; - if (mhandle == NULL) { + if (mhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_unbind_handle: invalid memory handle\n"); return (EINVAL); @@ -827,7 +827,7 @@ ldc_mem_info(ldc_mem_handle_t mhandle, ldc_mem_info_t *minfo) { ldc_mhdl_t *mhdl; - if (mhandle == NULL) { + if (mhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_info: invalid memory handle\n"); return (EINVAL); } @@ -862,20 +862,20 @@ int ldc_mem_copy(ldc_handle_t handle, caddr_t vaddr, uint64_t off, size_t *size, ldc_mem_cookie_t *cookies, uint32_t ccount, uint8_t direction) { - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; uint64_t local_voff, local_valign; uint64_t cookie_addr, cookie_size; uint64_t pg_shift, pg_size, pg_size_code; - uint64_t export_caddr, export_poff, export_psize, export_size; + uint64_t export_caddr, export_poff, export_psize, export_size; uint64_t local_ra, local_poff, local_psize; uint64_t copy_size, copied_len = 0, total_bal = 0, idx = 0; pgcnt_t npages; size_t len = *size; - int i, rv = 0; + int i, rv = 0; uint64_t chid; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_copy: invalid channel handle\n"); return (EINVAL); } @@ -984,7 +984,7 @@ ldc_mem_copy(ldc_handle_t handle, caddr_t vaddr, uint64_t off, size_t *size, copy_size, &copied_len); if (rv != 0) { - int error = EIO; + int error = EIO; uint64_t rx_hd, rx_tl; DWARN(chid, @@ -1088,17 +1088,17 @@ int ldc_mem_rdwr_cookie(ldc_handle_t handle, caddr_t vaddr, size_t *size, caddr_t paddr, uint8_t direction) { - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; uint64_t local_voff, local_valign; uint64_t pg_shift, pg_size, pg_size_code; - uint64_t target_pa, target_poff, target_psize, target_size; + uint64_t target_pa, target_poff, target_psize, target_size; uint64_t local_ra, local_poff, local_psize; uint64_t copy_size, copied_len = 0; pgcnt_t npages; size_t len = *size; - int rv = 0; + int rv = 0; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_rdwr_cookie: invalid channel handle\n"); return (EINVAL); @@ -1259,7 +1259,7 @@ i_ldc_mem_map(ldc_mem_handle_t mhandle, ldc_mem_cookie_t *cookie, { int i, j, idx, rv, retries; - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; ldc_mhdl_t *mhdl; ldc_memseg_t *memseg; caddr_t tmpaddr; @@ -1269,7 +1269,7 @@ i_ldc_mem_map(ldc_mem_handle_t mhandle, ldc_mem_cookie_t *cookie, uint64_t cookie_addr, cookie_off, cookie_size; tte_t ldc_tte; - if (mhandle == NULL) { + if (mhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_map: invalid memory handle\n"); return (EINVAL); } @@ -1519,7 +1519,7 @@ ldc_mem_unmap(ldc_mem_handle_t mhandle) { int i, rv; ldc_mhdl_t *mhdl = (ldc_mhdl_t *)mhandle; - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; ldc_memseg_t *memseg; if (mhdl == 0 || mhdl->status != LDC_MAPPED) { @@ -1586,14 +1586,14 @@ static int i_ldc_mem_acquire_release(ldc_mem_handle_t mhandle, uint8_t direction, uint64_t offset, size_t size) { - int err; + int err; ldc_mhdl_t *mhdl; ldc_chan_t *ldcp; ldc_memseg_t *memseg; caddr_t local_vaddr; size_t copy_size; - if (mhandle == NULL) { + if (mhandle == 0) { DWARN(DBG_ALL_LDCS, "i_ldc_mem_acquire_release: invalid memory handle\n"); return (EINVAL); @@ -1691,7 +1691,7 @@ ldc_mem_dring_create(uint32_t len, uint32_t dsize, ldc_dring_handle_t *dhandle) D1(DBG_ALL_LDCS, "ldc_mem_dring_create: len=0x%x, size=0x%x\n", len, dsize); - if (dhandle == NULL) { + if (dhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_create: invalid dhandle\n"); return (EINVAL); } @@ -1754,7 +1754,7 @@ ldc_mem_dring_destroy(ldc_dring_handle_t dhandle) D1(DBG_ALL_LDCS, "ldc_mem_dring_destroy: entered\n"); - if (dhandle == NULL) { + if (dhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_destroy: invalid desc ring handle\n"); return (EINVAL); @@ -1822,19 +1822,19 @@ ldc_mem_dring_bind(ldc_handle_t handle, ldc_dring_handle_t dhandle, uint8_t mtype, uint8_t perm, ldc_mem_cookie_t *cookie, uint32_t *ccount) { int err; - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; ldc_dring_t *dringp; ldc_mem_handle_t mhandle; /* check to see if channel is initalized */ - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_bind: invalid channel handle\n"); return (EINVAL); } ldcp = (ldc_chan_t *)handle; - if (dhandle == NULL) { + if (dhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_bind: invalid desc ring handle\n"); return (EINVAL); @@ -1885,7 +1885,7 @@ ldc_mem_dring_bind(ldc_handle_t handle, ldc_dring_handle_t dhandle, /* create an memory handle */ err = ldc_mem_alloc_handle(handle, &mhandle); - if (err || mhandle == NULL) { + if (err || mhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_bind: (0x%llx) error allocating mhandle\n", ldcp->id); @@ -1914,7 +1914,7 @@ ldc_mem_dring_bind(ldc_handle_t handle, ldc_dring_handle_t dhandle, (void) ldc_mem_free_handle(mhandle); dringp->ldcp = NULL; - dringp->mhdl = NULL; + dringp->mhdl = 0; *ccount = 0; mutex_exit(&dringp->lock); @@ -1941,10 +1941,10 @@ int ldc_mem_dring_nextcookie(ldc_dring_handle_t dhandle, ldc_mem_cookie_t *cookie) { int rv = 0; - ldc_dring_t *dringp; + ldc_dring_t *dringp; ldc_chan_t *ldcp; - if (dhandle == NULL) { + if (dhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_nextcookie: invalid desc ring handle\n"); return (EINVAL); @@ -1982,11 +1982,11 @@ ldc_mem_dring_nextcookie(ldc_dring_handle_t dhandle, ldc_mem_cookie_t *cookie) int ldc_mem_dring_unbind(ldc_dring_handle_t dhandle) { - ldc_dring_t *dringp; + ldc_dring_t *dringp; ldc_dring_t *tmp_dringp; ldc_chan_t *ldcp; - if (dhandle == NULL) { + if (dhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_unbind: invalid desc ring handle\n"); return (EINVAL); @@ -2035,7 +2035,7 @@ ldc_mem_dring_unbind(ldc_dring_handle_t dhandle) (void) ldc_mem_free_handle((ldc_mem_handle_t)dringp->mhdl); dringp->ldcp = NULL; - dringp->mhdl = NULL; + dringp->mhdl = 0; dringp->status = LDC_UNBOUND; mutex_exit(&dringp->lock); @@ -2124,7 +2124,7 @@ ldc_mem_dring_info(ldc_dring_handle_t dhandle, ldc_mem_info_t *minfo) ldc_dring_t *dringp; int rv; - if (dhandle == NULL) { + if (dhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_info: invalid desc ring handle\n"); return (EINVAL); @@ -2143,7 +2143,7 @@ ldc_mem_dring_info(ldc_dring_handle_t dhandle, ldc_mem_info_t *minfo) } } else { minfo->vaddr = dringp->base; - minfo->raddr = NULL; + minfo->raddr = 0; minfo->status = dringp->status; } @@ -2164,19 +2164,19 @@ ldc_mem_dring_map(ldc_handle_t handle, ldc_mem_cookie_t *cookie, ldc_dring_handle_t *dhandle) { int err; - ldc_chan_t *ldcp = (ldc_chan_t *)handle; + ldc_chan_t *ldcp = (ldc_chan_t *)handle; ldc_mem_handle_t mhandle; ldc_dring_t *dringp; size_t dring_size; - if (dhandle == NULL) { + if (dhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_map: invalid dhandle\n"); return (EINVAL); } /* check to see if channel is initalized */ - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_map: invalid channel handle\n"); return (EINVAL); @@ -2234,7 +2234,7 @@ ldc_mem_dring_map(ldc_handle_t handle, ldc_mem_cookie_t *cookie, /* create an memory handle */ err = ldc_mem_alloc_handle(handle, &mhandle); - if (err || mhandle == NULL) { + if (err || mhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_map: cannot alloc hdl err=%d\n", err); @@ -2278,11 +2278,11 @@ ldc_mem_dring_map(ldc_handle_t handle, ldc_mem_cookie_t *cookie, int ldc_mem_dring_unmap(ldc_dring_handle_t dhandle) { - ldc_dring_t *dringp; + ldc_dring_t *dringp; ldc_dring_t *tmp_dringp; ldc_chan_t *ldcp; - if (dhandle == NULL) { + if (dhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_unmap: invalid desc ring handle\n"); return (EINVAL); @@ -2356,14 +2356,14 @@ static int i_ldc_dring_acquire_release(ldc_dring_handle_t dhandle, uint8_t direction, uint64_t start, uint64_t end) { - int err; + int err; ldc_dring_t *dringp; ldc_chan_t *ldcp; ldc_mhdl_t *mhdl; uint64_t soff; size_t copy_size; - if (dhandle == NULL) { + if (dhandle == 0) { DWARN(DBG_ALL_LDCS, "i_ldc_dring_acquire_release: invalid desc ring handle\n"); return (EINVAL); diff --git a/usr/src/uts/sun4v/io/mdeg.c b/usr/src/uts/sun4v/io/mdeg.c index 18441c2e3c..687ace384b 100644 --- a/usr/src/uts/sun4v/io/mdeg.c +++ b/usr/src/uts/sun4v/io/mdeg.c @@ -67,7 +67,7 @@ typedef struct mdeg_clnt { * held when modifying any client information. */ static struct mdeg { - taskq_t *taskq; /* for internal processing */ + taskq_t *taskq; /* for internal processing */ boolean_t enabled; /* enable/disable taskq processing */ kmutex_t lock; /* synchronize MD updates */ md_t *md_prev; /* previous MD */ @@ -94,8 +94,8 @@ static void mdeg_dump_table(void); #else /* DEBUG */ #define MDEG_DBG _NOTE(CONSTCOND) if (0) printf -#define MDEG_DUMP_CLNT -#define MDEG_DUMP_TABLE() +#define MDEG_DUMP_CLNT(...) +#define MDEG_DUMP_TABLE(...) #endif /* DEBUG */ @@ -334,7 +334,7 @@ mdeg_notify_client_reg(mdeg_clnt_t *clnt) */ if (clnt->pspec == NULL) { /* call the client callback */ - (*clnt->cb)(clnt->cb_arg, NULL); + (void) (*clnt->cb)(clnt->cb_arg, NULL); goto done; } @@ -387,7 +387,7 @@ mdeg_notify_client_reg(mdeg_clnt_t *clnt) mdeg_res->added.nelem = nnodes; /* call the client callback */ - (*clnt->cb)(clnt->cb_arg, mdeg_res); + (void) (*clnt->cb)(clnt->cb_arg, mdeg_res); done: mutex_exit(&mdeg.lock); @@ -602,7 +602,7 @@ mdeg_notify_client(void *arg) */ if (clnt->pspec == NULL) { /* call the client callback */ - (*clnt->cb)(clnt->cb_arg, NULL); + (void) (*clnt->cb)(clnt->cb_arg, NULL); MDEG_DBG("MDEG client callback done\n"); goto cleanup; @@ -634,7 +634,7 @@ mdeg_notify_client(void *arg) mdeg_get_diff_results(mdd, &mdeg_res); /* call the client callback */ - (*clnt->cb)(clnt->cb_arg, &mdeg_res); + (void) (*clnt->cb)(clnt->cb_arg, &mdeg_res); MDEG_DBG("MDEG client callback done\n"); @@ -658,13 +658,13 @@ mdeg_find_start_node(md_t *md, mdeg_node_spec_t *nspec) nname = md_find_name(md, nspec->namep); aname = md_find_name(md, "fwd"); - nnodes = md_scan_dag(md, NULL, nname, aname, NULL); + nnodes = md_scan_dag(md, 0, nname, aname, NULL); if (nnodes == 0) return (MDE_INVAL_ELEM_COOKIE); nodesp = kmem_alloc(sizeof (mde_cookie_t) * nnodes, KM_SLEEP); - (void) md_scan_dag(md, NULL, nname, aname, nodesp); + (void) md_scan_dag(md, 0, nname, aname, nodesp); for (idx = 0; idx < nnodes; idx++) { diff --git a/usr/src/uts/sun4v/io/n2piupc/n2piupc.h b/usr/src/uts/sun4v/io/n2piupc/n2piupc.h index b9c224618f..689d0c5ef5 100644 --- a/usr/src/uts/sun4v/io/n2piupc/n2piupc.h +++ b/usr/src/uts/sun4v/io/n2piupc/n2piupc.h @@ -31,8 +31,6 @@ * Definitions which deal with things other than registers. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -65,8 +63,8 @@ extern int n2piupc_debug; #define N2PIUPC_DBG1 if (n2piupc_debug >= 1) printf #define N2PIUPC_DBG2 if (n2piupc_debug >= 2) printf #else -#define N2PIUPC_DBG1 0 && -#define N2PIUPC_DBG2 0 && +#define N2PIUPC_DBG1(...) +#define N2PIUPC_DBG2(...) #endif /* DEBUG */ diff --git a/usr/src/uts/sun4v/io/n2piupc/n2piupc_kstats.c b/usr/src/uts/sun4v/io/n2piupc/n2piupc_kstats.c index 0b22142ea2..6881d58a20 100644 --- a/usr/src/uts/sun4v/io/n2piupc/n2piupc_kstats.c +++ b/usr/src/uts/sun4v/io/n2piupc/n2piupc_kstats.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/kstat.h> #include "n2piupc_acc.h" @@ -68,7 +66,7 @@ n2piupc_kstat_init() /* Create basic pic event-type pair. */ grp_p->name_kstats_pp = kmem_zalloc((grp_p->num_counters * - sizeof (kstat_t)), KM_SLEEP); + sizeof (kstat_t)), KM_SLEEP); if (n2piupc_create_name_kstat(grp_p) != DDI_SUCCESS) { n2piupc_kstat_fini(); N2PIUPC_DBG1("n2piupc: init: failure exit\n"); @@ -183,7 +181,7 @@ n2piupc_create_picN_kstat(char *mod_name, int pic, uint64_t ev_offset, (void) snprintf(pic_name, PIC_STR_LEN, "pic%1d", pic); if ((picN_ksp = kstat_create(mod_name, 0, pic_name, - "bus", KSTAT_TYPE_NAMED, num_ev, NULL)) == NULL) { + "bus", KSTAT_TYPE_NAMED, num_ev, 0)) == NULL) { cmn_err(CE_WARN, "%s %s : kstat create failed", mod_name, pic_name); return (NULL); diff --git a/usr/src/uts/sun4v/io/niumx/niumx.c b/usr/src/uts/sun4v/io/niumx/niumx.c index b455d287e6..76b30a3804 100644 --- a/usr/src/uts/sun4v/io/niumx/niumx.c +++ b/usr/src/uts/sun4v/io/niumx/niumx.c @@ -97,19 +97,19 @@ static struct bus_ops niumx_bus_ops = { 0, niumx_ctlops, ddi_bus_prop_op, - 0, /* (*bus_get_eventcookie)(); */ + 0, /* (*bus_get_eventcookie)(); */ 0, /* (*bus_add_eventcall)(); */ - 0, /* (*bus_remove_eventcall)(); */ + 0, /* (*bus_remove_eventcall)(); */ 0, /* (*bus_post_event)(); */ 0, /* (*bus_intr_ctl)(); */ - 0, /* (*bus_config)(); */ - 0, /* (*bus_unconfig)(); */ - niumx_fm_init_child, /* (*bus_fm_init)(); */ - 0, /* (*bus_fm_fini)(); */ + 0, /* (*bus_config)(); */ + 0, /* (*bus_unconfig)(); */ + niumx_fm_init_child, /* (*bus_fm_init)(); */ + 0, /* (*bus_fm_fini)(); */ 0, /* (*bus_enter)() */ 0, /* (*bus_exit)() */ 0, /* (*bus_power)() */ - niumx_intr_ops /* (*bus_intr_op)(); */ + niumx_intr_ops /* (*bus_intr_op)(); */ }; extern struct cb_ops niumx_cb_ops; @@ -199,7 +199,7 @@ void niumx_intr_dist(void *arg) { niumx_devstate_t *niumxds_p = (niumx_devstate_t *)arg; - kmutex_t *lock_p = &niumxds_p->niumx_mutex; + kmutex_t *lock_p = &niumxds_p->niumx_mutex; int i; niumx_ih_t *ih_p = niumxds_p->niumx_ihtable; @@ -367,13 +367,13 @@ niumx_fm_init_child(dev_info_t *dip, dev_info_t *cdip, int cap, /*ARGSUSED*/ int niumx_map(dev_info_t *dip, dev_info_t *rdip, ddi_map_req_t *mp, - off_t offset, off_t len, caddr_t *vaddrp) + off_t offset, off_t len, caddr_t *vaddrp) { struct regspec p_regspec; ddi_map_req_t p_mapreq; - niu_regspec_t *reg_p; - int i, rn = mp->map_obj.rnumber, reglen, rnglen, rngnum, ret; - niumx_ranges_t *rng_p; + niu_regspec_t *reg_p; + int i, rn = mp->map_obj.rnumber, reglen, rnglen, rngnum, ret; + niumx_ranges_t *rng_p; uint32_t reg_begin, rng_begin; @@ -453,7 +453,7 @@ err: */ int niumx_ctlops(dev_info_t *dip, dev_info_t *rdip, - ddi_ctl_enum_t ctlop, void *arg, void *result) + ddi_ctl_enum_t ctlop, void *arg, void *result) { niu_regspec_t *reg_p; int reglen, totreg; @@ -644,7 +644,7 @@ niumx_removechild(dev_info_t *dip) /*ARGSUSED*/ int niumx_dma_allochdl(dev_info_t *dip, dev_info_t *rdip, ddi_dma_attr_t *attrp, - int (*waitfp)(caddr_t), caddr_t arg, ddi_dma_handle_t *handlep) + int (*waitfp)(caddr_t), caddr_t arg, ddi_dma_handle_t *handlep) { ddi_dma_impl_t *mp; int sleep = (waitfp == DDI_DMA_SLEEP) ? KM_SLEEP : KM_NOSLEEP; @@ -671,7 +671,7 @@ niumx_dma_allochdl(dev_info_t *dip, dev_info_t *rdip, ddi_dma_attr_t *attrp, mp->dmai_fault_check = NULL; mp->dmai_fault_notify = NULL; - mp->dmai_attr = *attrp; /* set requestors attr info */ + mp->dmai_attr = *attrp; /* set requestors attr info */ DBG(NIUMX_DBG_DMA_ALLOCH, dip, "mp=%p\n", mp); @@ -714,16 +714,16 @@ niumx_dma_freehdl(dev_info_t *dip, dev_info_t *rdip, ddi_dma_handle_t handle) * dma handle members affected (set on exit): * mp->dmai_object - dmareq->dmar_object * mp->dmai_rflags - dmareq->dmar_flags - * mp->dmai_pfn0 - 1st page pfn (if va/size pair and not shadow) - * mp->dmai_roffset - initialized to starting page offset + * mp->dmai_pfn0 - 1st page pfn (if va/size pair and not shadow) + * mp->dmai_roffset - initialized to starting page offset * mp->dmai_size - # of total pages of entire object * mp->dmai_cookie - new cookie alloc'd */ /*ARGSUSED*/ int niumx_dma_bindhdl(dev_info_t *dip, dev_info_t *rdip, - ddi_dma_handle_t handle, ddi_dma_req_t *dmareq, - ddi_dma_cookie_t *cookiep, uint_t *ccountp) + ddi_dma_handle_t handle, ddi_dma_req_t *dmareq, + ddi_dma_cookie_t *cookiep, uint_t *ccountp) { int (*waitfp)(caddr_t) = dmareq->dmar_fp; ddi_dma_impl_t *mp = (ddi_dma_impl_t *)handle; @@ -921,7 +921,7 @@ niumx_set_intr(dev_info_t *dip, dev_info_t *rdip, int ret = DDI_SUCCESS; uint64_t hvret; niumx_devstate_t *niumxds_p; /* devstate pointer */ - int instance = ddi_get_instance(dip); + int instance = ddi_get_instance(dip); niumxds_p = (niumx_devstate_t *)ddi_get_soft_state(niumx_state, instance); @@ -1142,7 +1142,7 @@ niumx_rem_intr(dev_info_t *dip, dev_info_t *rdip, niumx_ih_t *ih_p; int ret = DDI_SUCCESS, state; hrtime_t start; - niusysino_t sysino; + niusysino_t sysino; niumx_devstate_t *niumxds_p; /* devstate pointer */ int instance = ddi_get_instance(dip); @@ -1175,7 +1175,8 @@ niumx_rem_intr(dev_info_t *dip, dev_info_t *rdip, ih_p->ih_sysino = 0; hdlp->ih_vector = (uint32_t)sysino; - if (hdlp->ih_vector != NULL) i_ddi_rem_ivintr(hdlp); + if (hdlp->ih_vector != 0) + i_ddi_rem_ivintr(hdlp); fail: return (ret); diff --git a/usr/src/uts/sun4v/io/ntwdt.c b/usr/src/uts/sun4v/io/ntwdt.c index 5dcace595a..ac11471533 100644 --- a/usr/src/uts/sun4v/io/ntwdt.c +++ b/usr/src/uts/sun4v/io/ntwdt.c @@ -314,7 +314,7 @@ ntwdt_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) * is initialized. */ if (ddi_create_minor_node(dip, NTWDT_MINOR_NODE, S_IFCHR, 0, - DDI_PSEUDO, NULL) == DDI_FAILURE) { + DDI_PSEUDO, 0) == DDI_FAILURE) { cmn_err(CE_WARN, "failed to create Minor Node: %s", NTWDT_MINOR_NODE); goto err3; @@ -466,7 +466,7 @@ ntwdt_close(dev_t dev, int flag, int otyp, cred_t *credp) /*ARGSUSED*/ static int ntwdt_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp, - int *rvalp) + int *rvalp) { int instance = getminor(dev); int retval = 0; diff --git a/usr/src/uts/sun4v/io/vlds.c b/usr/src/uts/sun4v/io/vlds.c index a33978680e..e630328f0d 100644 --- a/usr/src/uts/sun4v/io/vlds.c +++ b/usr/src/uts/sun4v/io/vlds.c @@ -327,7 +327,7 @@ vlds_attach(dev_info_t *devi, ddi_attach_cmd_t cmd) } if (ddi_create_minor_node(devi, VLDS_NAME, S_IFCHR, - 0, DDI_PSEUDO, NULL) == DDI_FAILURE) { + 0, DDI_PSEUDO, 0) == DDI_FAILURE) { ddi_remove_minor_node(devi, NULL); return (DDI_FAILURE); } diff --git a/usr/src/uts/sun4v/io/vnet.c b/usr/src/uts/sun4v/io/vnet.c index 96fb04175d..8abeaf911b 100644 --- a/usr/src/uts/sun4v/io/vnet.c +++ b/usr/src/uts/sun4v/io/vnet.c @@ -2481,7 +2481,7 @@ vnet_rx_ring_stat(mac_ring_driver_t rdriver, uint_t stat, uint64_t *val) macp = &vresp->macreg; cbp = macp->m_callbacks; - cbp->mc_getstat(macp->m_driver, stat, val); + (void) cbp->mc_getstat(macp->m_driver, stat, val); return (0); } diff --git a/usr/src/uts/sun4v/io/vnet_gen.c b/usr/src/uts/sun4v/io/vnet_gen.c index c872b641c6..ae89f44a33 100644 --- a/usr/src/uts/sun4v/io/vnet_gen.c +++ b/usr/src/uts/sun4v/io/vnet_gen.c @@ -297,7 +297,7 @@ static char vgen_linkprop_propname[] = "linkprop"; * 1.3 VLAN and HybridIO support. * 1.4 Jumbo Frame support. * 1.5 Link State Notification support with optional support - * for Physical Link information. + * for Physical Link information. * 1.6 Support for RxDringData mode. */ static vgen_ver_t vgen_versions[VGEN_NUM_VER] = { {1, 6} }; @@ -697,7 +697,7 @@ vgen_tx(void *arg, mblk_t *mp) */ static mblk_t * vgen_vlan_frame_fixtag(vgen_port_t *portp, mblk_t *mp, boolean_t is_tagged, - uint16_t vid) + uint16_t vid) { vgen_t *vgenp; boolean_t dst_tagged; @@ -781,8 +781,8 @@ vgen_portsend(vgen_port_t *portp, mblk_t *mp) vgen_ldc_t *ldcp; int status; int rv = VGEN_SUCCESS; - vgen_t *vgenp = portp->vgenp; - vnet_t *vnetp = vgenp->vnetp; + vgen_t *vgenp; + vnet_t *vnetp; boolean_t is_tagged; boolean_t dec_refcnt = B_FALSE; uint16_t vlan_id; @@ -792,6 +792,9 @@ vgen_portsend(vgen_port_t *portp, mblk_t *mp) return (VGEN_FAILURE); } + vgenp = portp->vgenp; + vnetp = vgenp->vnetp; + if (portp->use_vsw_port) { (void) atomic_inc_32(&vgenp->vsw_port_refcnt); portp = portp->vgenp->vsw_portp; @@ -1396,8 +1399,8 @@ vgen_readmd_exit: */ static void vgen_vlan_read_ids(void *arg, int type, md_t *mdp, mde_cookie_t node, - uint16_t *pvidp, uint16_t **vidspp, uint16_t *nvidsp, - uint16_t *default_idp) + uint16_t *pvidp, uint16_t **vidspp, uint16_t *nvidsp, + uint16_t *default_idp) { vgen_t *vgenp; vnet_t *vnetp; @@ -1686,7 +1689,7 @@ vgen_mtu_read(vgen_t *vgenp, md_t *mdp, mde_cookie_t node, uint32_t *mtu) static void vgen_linkprop_read(vgen_t *vgenp, md_t *mdp, mde_cookie_t node, - boolean_t *pls) + boolean_t *pls) { int rv; uint64_t val; @@ -1714,8 +1717,8 @@ vgen_mdeg_reg(vgen_t *vgenp) mdeg_node_spec_t *parentp; uint_t templatesz; int rv; - mdeg_handle_t dev_hdl = NULL; - mdeg_handle_t port_hdl = NULL; + mdeg_handle_t dev_hdl = 0; + mdeg_handle_t port_hdl = 0; templatesz = sizeof (vgen_prop_template); pspecp = kmem_zalloc(templatesz, KM_NOSLEEP); @@ -1767,7 +1770,7 @@ vgen_mdeg_reg(vgen_t *vgenp) return (DDI_SUCCESS); mdeg_reg_fail: - if (dev_hdl != NULL) { + if (dev_hdl != 0) { (void) mdeg_unregister(dev_hdl); } KMEM_FREE(parentp); @@ -1780,13 +1783,13 @@ mdeg_reg_fail: static void vgen_mdeg_unreg(vgen_t *vgenp) { - if (vgenp->mdeg_dev_hdl != NULL) { + if (vgenp->mdeg_dev_hdl != 0) { (void) mdeg_unregister(vgenp->mdeg_dev_hdl); - vgenp->mdeg_dev_hdl = NULL; + vgenp->mdeg_dev_hdl = 0; } - if (vgenp->mdeg_port_hdl != NULL) { + if (vgenp->mdeg_port_hdl != 0) { (void) mdeg_unregister(vgenp->mdeg_port_hdl); - vgenp->mdeg_port_hdl = NULL; + vgenp->mdeg_port_hdl = 0; } if (vgenp->mdeg_parentp != NULL) { @@ -1803,7 +1806,7 @@ vgen_mdeg_port_cb(void *cb_argp, mdeg_result_t *resp) { int idx; int vsw_idx = -1; - uint64_t val; + uint64_t val; vgen_t *vgenp; if ((resp == NULL) || (cb_argp == NULL)) { @@ -2108,7 +2111,7 @@ vgen_add_port(vgen_t *vgenp, md_t *mdp, mde_cookie_t mdex) /* read properties of the port from its md node */ static int vgen_port_read_props(vgen_port_t *portp, vgen_t *vgenp, md_t *mdp, - mde_cookie_t mdex) + mde_cookie_t mdex) { uint64_t port_num; uint64_t *ldc_ids; @@ -2362,7 +2365,7 @@ vgen_port_detach_mdeg(vgen_port_t *portp) static int vgen_update_port(vgen_t *vgenp, md_t *curr_mdp, mde_cookie_t curr_mdex, - md_t *prev_mdp, mde_cookie_t prev_mdex) + md_t *prev_mdp, mde_cookie_t prev_mdex) { uint64_t cport_num; uint64_t pport_num; @@ -2454,10 +2457,10 @@ vgen_port_stat(vgen_port_t *portp, uint_t stat) static int vgen_ldc_attach(vgen_port_t *portp, uint64_t ldc_id) { - vgen_t *vgenp; - vgen_ldc_t *ldcp; - ldc_attr_t attr; - int status; + vgen_t *vgenp; + vgen_ldc_t *ldcp; + ldc_attr_t attr; + int status; ldc_status_t istatus; char kname[MAXNAMELEN]; int instance; @@ -2567,7 +2570,7 @@ static void vgen_ldc_detach(vgen_ldc_t *ldcp) { vgen_port_t *portp; - vgen_t *vgenp; + vgen_t *vgenp; ASSERT(ldcp != NULL); @@ -3000,7 +3003,7 @@ vgen_ldc_cb(uint64_t event, caddr_t arg) _NOTE(ARGUNUSED(event)) vgen_ldc_t *ldcp; vgen_t *vgenp; - ldc_status_t istatus; + ldc_status_t istatus; vgen_stats_t *statsp; uint_t ret = LDC_SUCCESS; @@ -3012,7 +3015,7 @@ vgen_ldc_cb(uint64_t event, caddr_t arg) mutex_enter(&ldcp->cblock); statsp->callbacks++; - if ((ldcp->ldc_status == LDC_INIT) || (ldcp->ldc_handle == NULL)) { + if ((ldcp->ldc_status == LDC_INIT) || (ldcp->ldc_handle == 0)) { DWARN(vgenp, ldcp, "status(%d) is LDC_INIT\n", ldcp->ldc_status); mutex_exit(&ldcp->cblock); @@ -3111,8 +3114,8 @@ vgen_handle_evt_read(vgen_ldc_t *ldcp, vgen_caller_t caller) size_t msglen; vgen_t *vgenp = LDC_TO_VGEN(ldcp); vio_msg_tag_t *tagp; - ldc_status_t istatus; - boolean_t has_data; + ldc_status_t istatus; + boolean_t has_data; DBG1(vgenp, ldcp, "enter\n"); @@ -4227,7 +4230,7 @@ vgen_handshake_done(vgen_ldc_t *ldcp) { vgen_t *vgenp = LDC_TO_VGEN(ldcp); uint32_t hphase = ldcp->hphase; - int status = 0; + int status = 0; switch (hphase) { @@ -5724,7 +5727,7 @@ vgen_check_sid(vgen_ldc_t *ldcp, vio_msg_tag_t *tagp) */ static void vgen_init_dring_reg_msg(vgen_ldc_t *ldcp, vio_dring_reg_msg_t *msg, - uint8_t option) + uint8_t option) { vio_msg_tag_t *tagp; diff --git a/usr/src/uts/sun4v/io/vsw.c b/usr/src/uts/sun4v/io/vsw.c index 6ec8f997bd..1c4738d3e6 100644 --- a/usr/src/uts/sun4v/io/vsw.c +++ b/usr/src/uts/sun4v/io/vsw.c @@ -747,7 +747,7 @@ static int vsw_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) { vsw_t **vswpp, *vswp; - int instance; + int instance; instance = ddi_get_instance(dip); vswp = ddi_get_soft_state(vsw_state, instance); @@ -1435,8 +1435,8 @@ mdeg_reg_fail: kmem_free(pspecp, templatesz); kmem_free(inst_specp, sizeof (mdeg_node_spec_t)); - vswp->mdeg_hdl = NULL; - vswp->mdeg_port_hdl = NULL; + vswp->mdeg_hdl = 0; + vswp->mdeg_port_hdl = 0; return (1); } @@ -1446,10 +1446,10 @@ vsw_mdeg_unregister(vsw_t *vswp) { D1(vswp, "vsw_mdeg_unregister: enter"); - if (vswp->mdeg_hdl != NULL) + if (vswp->mdeg_hdl != 0) (void) mdeg_unregister(vswp->mdeg_hdl); - if (vswp->mdeg_port_hdl != NULL) + if (vswp->mdeg_port_hdl != 0) (void) mdeg_unregister(vswp->mdeg_port_hdl); if (vswp->inst_spec != NULL) { @@ -1812,8 +1812,8 @@ vsw_get_initial_md_properties(vsw_t *vswp, md_t *mdp, mde_cookie_t node) */ static void vsw_vlan_read_ids(void *arg, int type, md_t *mdp, mde_cookie_t node, - uint16_t *pvidp, vsw_vlanid_t **vidspp, uint16_t *nvidsp, - uint16_t *default_idp) + uint16_t *pvidp, vsw_vlanid_t **vidspp, uint16_t *nvidsp, + uint16_t *default_idp) { vsw_t *vswp; vsw_port_t *portp; @@ -2054,7 +2054,7 @@ vsw_mtu_update(vsw_t *vswp, uint32_t mtu) static void vsw_linkprop_read(vsw_t *vswp, md_t *mdp, mde_cookie_t node, - boolean_t *pls) + boolean_t *pls) { int rv; uint64_t val; @@ -2134,7 +2134,7 @@ vsw_update_md_prop(vsw_t *vswp, md_t *mdp, mde_cookie_t node) uint_t ddi_instance; uint8_t new_smode; int i; - uint64_t macaddr = 0; + uint64_t macaddr = 0; enum {MD_init = 0x1, MD_physname = 0x2, MD_macaddr = 0x4, @@ -2449,7 +2449,7 @@ fail_update: */ static int vsw_port_read_props(vsw_port_t *portp, vsw_t *vswp, - md_t *mdp, mde_cookie_t *node) + md_t *mdp, mde_cookie_t *node) { uint64_t ldc_id; uint8_t *addrp; @@ -2597,7 +2597,7 @@ vsw_port_add(vsw_t *vswp, md_t *mdp, mde_cookie_t *node) static int vsw_port_update(vsw_t *vswp, md_t *curr_mdp, mde_cookie_t curr_mdex, - md_t *prev_mdp, mde_cookie_t prev_mdex) + md_t *prev_mdp, mde_cookie_t prev_mdex) { uint64_t cport_num; uint64_t pport_num; diff --git a/usr/src/uts/sun4v/io/vsw_ldc.c b/usr/src/uts/sun4v/io/vsw_ldc.c index ee651e692b..099bb2b42d 100644 --- a/usr/src/uts/sun4v/io/vsw_ldc.c +++ b/usr/src/uts/sun4v/io/vsw_ldc.c @@ -279,7 +279,7 @@ extern uint32_t vsw_nrbufs_factor; * 1.3 VLAN and HybridIO support. * 1.4 Jumbo Frame support. * 1.5 Link State Notification support with optional support - * for Physical Link information. + * for Physical Link information. * 1.6 Support for RxDringData mode. */ static ver_sup_t vsw_versions[] = { {1, 6} }; @@ -471,7 +471,7 @@ vsw_port_detach(vsw_t *vswp, int p_instance) void vsw_detach_ports(vsw_t *vswp) { - vsw_port_list_t *plist = &vswp->plist; + vsw_port_list_t *plist = &vswp->plist; vsw_port_t *port = NULL; D1(vswp, "%s: enter", __func__); @@ -562,11 +562,11 @@ vsw_port_delete(vsw_port_t *port) static int vsw_ldc_attach(vsw_port_t *port, uint64_t ldc_id) { - vsw_t *vswp = port->p_vswp; - vsw_ldc_t *ldcp = NULL; - ldc_attr_t attr; + vsw_t *vswp = port->p_vswp; + vsw_ldc_t *ldcp = NULL; + ldc_attr_t attr; ldc_status_t istatus; - int status = DDI_FAILURE; + int status = DDI_FAILURE; char kname[MAXNAMELEN]; enum { PROG_init = 0x0, PROG_callback = 0x1, @@ -719,8 +719,8 @@ ldc_attach_fail: static void vsw_ldc_detach(vsw_ldc_t *ldcp) { - int rv; - vsw_t *vswp = ldcp->ldc_port->p_vswp; + int rv; + vsw_t *vswp = ldcp->ldc_port->p_vswp; int retries = 0; D2(vswp, "%s: detaching channel %lld", __func__, ldcp->ldc_id); @@ -773,7 +773,7 @@ vsw_ldc_detach(vsw_ldc_t *ldcp) (void) ldc_fini(ldcp->ldc_handle); ldcp->ldc_status = LDC_INIT; - ldcp->ldc_handle = NULL; + ldcp->ldc_handle = 0; ldcp->ldc_vswp = NULL; mutex_destroy(&ldcp->msg_thr_lock); @@ -800,7 +800,7 @@ vsw_ldc_detach(vsw_ldc_t *ldcp) static int vsw_ldc_init(vsw_ldc_t *ldcp) { - vsw_t *vswp = ldcp->ldc_vswp; + vsw_t *vswp = ldcp->ldc_vswp; ldc_status_t istatus = 0; int rv; @@ -1238,7 +1238,7 @@ static uint_t vsw_ldc_cb(uint64_t event, caddr_t arg) { vsw_ldc_t *ldcp = (vsw_ldc_t *)arg; - vsw_t *vswp = ldcp->ldc_vswp; + vsw_t *vswp = ldcp->ldc_vswp; D1(vswp, "%s: enter: ldcid (%lld)\n", __func__, ldcp->ldc_id); @@ -1246,7 +1246,7 @@ vsw_ldc_cb(uint64_t event, caddr_t arg) ldcp->ldc_stats.callbacks++; mutex_enter(&ldcp->status_lock); - if ((ldcp->ldc_status == LDC_INIT) || (ldcp->ldc_handle == NULL)) { + if ((ldcp->ldc_status == LDC_INIT) || (ldcp->ldc_handle == 0)) { mutex_exit(&ldcp->status_lock); mutex_exit(&ldcp->ldc_cblock); return (LDC_SUCCESS); @@ -2075,11 +2075,11 @@ void vsw_process_pkt(void *arg) { vsw_ldc_t *ldcp = (vsw_ldc_t *)arg; - vsw_t *vswp = ldcp->ldc_vswp; + vsw_t *vswp = ldcp->ldc_vswp; size_t msglen; vio_msg_tag_t *tagp; uint64_t *ldcmsg; - int rv = 0; + int rv = 0; D1(vswp, "%s enter: ldcid (%lld)\n", __func__, ldcp->ldc_id); @@ -2145,7 +2145,7 @@ vsw_process_pkt(void *arg) */ static void vsw_dispatch_ctrl_task(vsw_ldc_t *ldcp, void *cpkt, vio_msg_tag_t *tagp, - int msglen) + int msglen) { vsw_ctrl_task_t *ctaskp = NULL; vsw_port_t *port = ldcp->ldc_port; @@ -2221,7 +2221,7 @@ vsw_process_ctrl_pkt(void *arg) { vsw_ctrl_task_t *ctaskp = (vsw_ctrl_task_t *)arg; vsw_ldc_t *ldcp = ctaskp->ldcp; - vsw_t *vswp = ldcp->ldc_vswp; + vsw_t *vswp = ldcp->ldc_vswp; vio_msg_tag_t tag; uint16_t env; @@ -2305,7 +2305,7 @@ void vsw_process_ctrl_ver_pkt(vsw_ldc_t *ldcp, void *pkt) { vio_ver_msg_t *ver_pkt; - vsw_t *vswp = ldcp->ldc_vswp; + vsw_t *vswp = ldcp->ldc_vswp; D1(vswp, "%s(%lld): enter", __func__, ldcp->ldc_id); @@ -3362,7 +3362,7 @@ vsw_process_physlink_msg(vsw_ldc_t *ldcp, void *pkt) static void vsw_process_data_pkt(vsw_ldc_t *ldcp, void *dpkt, vio_msg_tag_t *tagp, - uint32_t msglen) + uint32_t msglen) { uint16_t env = tagp->vio_subtype_env; vsw_t *vswp = ldcp->ldc_vswp; @@ -3747,7 +3747,7 @@ vsw_portsend(vsw_port_t *port, mblk_t *mp) { mblk_t *mpt; int count; - vsw_ldc_t *ldcp = port->ldcp; + vsw_ldc_t *ldcp = port->ldcp; int status = 0; count = vsw_vlan_frame_untag(port, VSW_VNETPORT, &mp, &mpt); @@ -3763,7 +3763,7 @@ vsw_portsend(vsw_port_t *port, mblk_t *mp) * priority frames is also counted and returned. * * Params: - * vswp: pointer to the instance of vsw + * vswp: pointer to the instance of vsw * np: head of packet chain to be broken * npt: tail of packet chain to be broken * @@ -3775,7 +3775,7 @@ vsw_portsend(vsw_port_t *port, mblk_t *mp) */ static uint32_t vsw_get_pri_packets(vsw_t *vswp, mblk_t **np, mblk_t **npt, - mblk_t **hp, mblk_t **hpt) + mblk_t **hp, mblk_t **hpt) { mblk_t *tmp = NULL; mblk_t *smp = NULL; @@ -3840,7 +3840,7 @@ vsw_get_pri_packets(vsw_t *vswp, mblk_t **np, mblk_t **npt, static int vsw_ldctx_pri(void *arg, mblk_t *mp, mblk_t *mpt, uint32_t count) { - vsw_ldc_t *ldcp = (vsw_ldc_t *)arg; + vsw_ldc_t *ldcp = (vsw_ldc_t *)arg; mblk_t *tmp; mblk_t *smp; mblk_t *hmp; /* high prio pkts head */ @@ -3884,7 +3884,7 @@ vsw_ldctx_pri(void *arg, mblk_t *mp, mblk_t *mpt, uint32_t count) static int vsw_ldctx(void *arg, mblk_t *mp, mblk_t *mpt, uint32_t count) { - vsw_ldc_t *ldcp = (vsw_ldc_t *)arg; + vsw_ldc_t *ldcp = (vsw_ldc_t *)arg; mblk_t *tmp = NULL; ASSERT(count != 0); @@ -3952,7 +3952,7 @@ vsw_ldcsend_pkt(vsw_ldc_t *ldcp, mblk_t *mp) vgen_stats_t *statsp = &ldcp->ldc_stats; if ((!(ldcp->lane_out.lstate & VSW_LANE_ACTIVE)) || - (ldcp->ldc_status != LDC_UP) || (ldcp->ldc_handle == NULL)) { + (ldcp->ldc_status != LDC_UP) || (ldcp->ldc_handle == 0)) { (void) atomic_inc_32(&statsp->tx_pri_fail); DWARN(vswp, "%s(%lld) status(%d) lstate(0x%llx), dropping " "packet\n", __func__, ldcp->ldc_id, ldcp->ldc_status, @@ -4121,7 +4121,7 @@ vsw_descrsend(vsw_ldc_t *ldcp, mblk_t *mp) ASSERT(mp != NULL); if ((!(ldcp->lane_out.lstate & VSW_LANE_ACTIVE)) || - (ldcp->ldc_status != LDC_UP) || (ldcp->ldc_handle == NULL)) { + (ldcp->ldc_status != LDC_UP) || (ldcp->ldc_handle == 0)) { DERR(vswp, "%s(%lld) status(%d) state (0x%llx), dropping pkt", __func__, ldcp->ldc_id, ldcp->ldc_status, ldcp->lane_out.lstate); @@ -4566,7 +4566,7 @@ vsw_map_dring_cmn(vsw_ldc_t *ldcp, vio_dring_reg_msg_t *dring_pkt) return (dp); fail: - if (dp->dring_handle != NULL) { + if (dp->dring_handle != 0) { (void) ldc_mem_dring_unmap(dp->dring_handle); } kmem_free(dp, sizeof (*dp)); @@ -4836,9 +4836,9 @@ display_state(void) { vsw_t *vswp; vsw_port_list_t *plist; - vsw_port_t *port; - vsw_ldc_t *ldcp; - extern vsw_t *vsw_head; + vsw_port_t *port; + vsw_ldc_t *ldcp; + extern vsw_t *vsw_head; cmn_err(CE_NOTE, "***** system state *****"); diff --git a/usr/src/uts/sun4v/io/vsw_rxdring.c b/usr/src/uts/sun4v/io/vsw_rxdring.c index 5661a00bd8..adbed65efc 100644 --- a/usr/src/uts/sun4v/io/vsw_rxdring.c +++ b/usr/src/uts/sun4v/io/vsw_rxdring.c @@ -415,7 +415,7 @@ vsw_destroy_rx_dring(vsw_ldc_t *ldcp) } /* Finally, free the receive descriptor ring */ - if (dp->dring_handle != NULL) { + if (dp->dring_handle != 0) { (void) ldc_mem_dring_unbind(dp->dring_handle); (void) ldc_mem_dring_destroy(dp->dring_handle); } @@ -491,7 +491,7 @@ vsw_map_tx_dring(vsw_ldc_t *ldcp, void *pkt) return (dp); fail: - if (dp->dring_handle != NULL) { + if (dp->dring_handle != 0) { (void) ldc_mem_dring_unmap(dp->dring_handle); } kmem_free(dp, sizeof (*dp)); @@ -512,10 +512,10 @@ vsw_unmap_tx_dring(vsw_ldc_t *ldcp) } /* Unmap tx data area and free data handle */ - if (dp->data_handle != NULL) { + if (dp->data_handle != 0) { (void) ldc_mem_unmap(dp->data_handle); (void) ldc_mem_free_handle(dp->data_handle); - dp->data_handle = NULL; + dp->data_handle = 0; } /* Free tx data area cookies */ @@ -527,9 +527,9 @@ vsw_unmap_tx_dring(vsw_ldc_t *ldcp) } /* Unmap peer's dring */ - if (dp->dring_handle != NULL) { + if (dp->dring_handle != 0) { (void) ldc_mem_dring_unmap(dp->dring_handle); - dp->dring_handle = NULL; + dp->dring_handle = 0; } mutex_destroy(&dp->txlock); @@ -877,7 +877,7 @@ vsw_dringsend_shm(vsw_ldc_t *ldcp, mblk_t *mp) vsw_t *vswp = ldcp->ldc_vswp; if ((!(lane_in->lstate & VSW_LANE_ACTIVE)) || - (ldcp->ldc_status != LDC_UP) || (ldcp->ldc_handle == NULL)) { + (ldcp->ldc_status != LDC_UP) || (ldcp->ldc_handle == 0)) { DWARN(vswp, "%s(%lld) status(%d) lstate(0x%llx), dropping " "packet\n", __func__, ldcp->ldc_id, ldcp->ldc_status, lane_in->lstate); diff --git a/usr/src/uts/sun4v/io/vsw_txdring.c b/usr/src/uts/sun4v/io/vsw_txdring.c index afe0e5b6e5..26a9a401a9 100644 --- a/usr/src/uts/sun4v/io/vsw_txdring.c +++ b/usr/src/uts/sun4v/io/vsw_txdring.c @@ -394,7 +394,7 @@ vsw_destroy_tx_dring(vsw_ldc_t *ldcp) */ for (i = 0; i < vsw_num_descriptors; i++) { paddr = (vsw_private_desc_t *)dp->priv_addr + i; - if (paddr->memhandle != NULL) { + if (paddr->memhandle != 0) { if (paddr->bound == 1) { if (ldc_mem_unbind_handle( paddr->memhandle) != 0) { @@ -414,7 +414,7 @@ vsw_destroy_tx_dring(vsw_ldc_t *ldcp) "at pos %d", dp, i); continue; } - paddr->memhandle = NULL; + paddr->memhandle = 0; } mutex_destroy(&paddr->dstate_lock); } @@ -425,7 +425,7 @@ vsw_destroy_tx_dring(vsw_ldc_t *ldcp) /* * Now unbind and destroy the ring itself. */ - if (dp->dring_handle != NULL) { + if (dp->dring_handle != 0) { (void) ldc_mem_dring_unbind(dp->dring_handle); (void) ldc_mem_dring_destroy(dp->dring_handle); } @@ -505,7 +505,7 @@ vsw_unmap_rx_dring(vsw_ldc_t *ldcp) vsw_destroy_rxpools, fvmp, DDI_SLEEP); } - if (dp->dring_handle != NULL) { + if (dp->dring_handle != 0) { (void) ldc_mem_dring_unmap(dp->dring_handle); } kmem_free(dp, sizeof (dring_info_t)); @@ -800,7 +800,7 @@ vsw_dringsend(vsw_ldc_t *ldcp, mblk_t *mp) /* TODO: make test a macro */ if ((!(ldcp->lane_out.lstate & VSW_LANE_ACTIVE)) || - (ldcp->ldc_status != LDC_UP) || (ldcp->ldc_handle == NULL)) { + (ldcp->ldc_status != LDC_UP) || (ldcp->ldc_handle == 0)) { DWARN(vswp, "%s(%lld) status(%d) lstate(0x%llx), dropping " "packet\n", __func__, ldcp->ldc_id, ldcp->ldc_status, ldcp->lane_out.lstate); @@ -942,7 +942,7 @@ vsw_dringsend_free_exit: */ int vsw_dring_find_free_desc(dring_info_t *dringp, - vsw_private_desc_t **priv_p, int *idx) + vsw_private_desc_t **priv_p, int *idx) { vsw_private_desc_t *addr = NULL; int num = vsw_num_descriptors; diff --git a/usr/src/uts/sun4v/kt/Makefile b/usr/src/uts/sun4v/kt/Makefile index f4721ae345..4d2d27ba15 100644 --- a/usr/src/uts/sun4v/kt/Makefile +++ b/usr/src/uts/sun4v/kt/Makefile @@ -37,7 +37,6 @@ UTSBASE = ../.. # MODULE = SPARC-T3 OBJECTS = $(NIAGARA2CPU_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(NIAGARA2CPU_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_CPU_DIR)/$(MODULE) CPU_DIR = . @@ -57,13 +56,9 @@ CLEANFILES += $(CPULIB) $(SYM_MOD) # Define targets # ALL_TARGET = $(SYM_MOD) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = def $(BINARY) $(ROOTMODULE) -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) -DKT_IMPL +CFLAGS += -DKT_IMPL # # The ATOMIC_BO_ENABLE_SHIFT enables backoff in atomic routines. @@ -95,12 +90,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) $(CPULIB): $(OBJECTS) diff --git a/usr/src/uts/sun4v/ldc/Makefile b/usr/src/uts/sun4v/ldc/Makefile index f1c044bb36..4e4aaba6d4 100644 --- a/usr/src/uts/sun4v/ldc/Makefile +++ b/usr/src/uts/sun4v/ldc/Makefile @@ -42,7 +42,6 @@ UTSBASE = ../.. # MODULE = ldc OBJECTS = $(LDC_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(LDC_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_MISC_DIR)/$(MODULE) # @@ -61,23 +60,8 @@ CLEANFILES += $(MODSTUBS_O) # Define targets # ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) -# -# 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_ASSIGN_NARROW_CONV -LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW - CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses @@ -94,12 +78,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # diff --git a/usr/src/uts/sun4v/n2piupc/Makefile b/usr/src/uts/sun4v/n2piupc/Makefile index c4cd3e1b44..2577303a0b 100644 --- a/usr/src/uts/sun4v/n2piupc/Makefile +++ b/usr/src/uts/sun4v/n2piupc/Makefile @@ -41,7 +41,6 @@ UTSBASE = ../.. # MODULE = n2piupc OBJECTS = $(N2PIUPC_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(N2PIUPC_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) CONF_SRCDIR = $(UTSBASE)/sun4v/io/n2piupc @@ -54,7 +53,6 @@ include $(UTSBASE)/sun4v/Makefile.sun4v # Define targets # ALL_TARGET = $(BINARY) $(SRC_CONFFILE) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # @@ -62,10 +60,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # INC_PATH += -I$(UTSBASE)/sun4v/io/n2piupc -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-unused-label # @@ -74,11 +68,6 @@ CERRWARN += -_gcc=-Wno-unused-label CFLAGS += -dalign -DMODULE_NAME=\"$(MODULE)\" # -# Lint needs module name too -# -LINTFLAGS += -DMODULE_NAME=\"$(MODULE)\" - -# # Default build targets. # .KEEP_STATE: @@ -91,12 +80,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # diff --git a/usr/src/uts/sun4v/niagara/Makefile b/usr/src/uts/sun4v/niagara/Makefile index 713198a991..181c06f9d4 100644 --- a/usr/src/uts/sun4v/niagara/Makefile +++ b/usr/src/uts/sun4v/niagara/Makefile @@ -40,7 +40,6 @@ UTSBASE = ../.. # MODULE = SUNW,UltraSPARC-T1 OBJECTS = $(NIAGARACPU_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(NIAGARACPU_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_CPU_DIR)/$(MODULE) CPU_DIR = . @@ -60,13 +59,9 @@ CLEANFILES += $(CPULIB) $(SYM_MOD) # Define targets # ALL_TARGET = $(SYM_MOD) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = def $(BINARY) $(ROOTMODULE) -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) -DNIAGARA_IMPL +CFLAGS += -DNIAGARA_IMPL CERRWARN += -_gcc=-Wno-parentheses # @@ -88,12 +83,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) $(CPULIB): $(OBJECTS) diff --git a/usr/src/uts/sun4v/niagara2/Makefile b/usr/src/uts/sun4v/niagara2/Makefile index 39a01ef025..f6f4d3843e 100644 --- a/usr/src/uts/sun4v/niagara2/Makefile +++ b/usr/src/uts/sun4v/niagara2/Makefile @@ -39,7 +39,6 @@ UTSBASE = ../.. # MODULE = SUNW,UltraSPARC-T2 OBJECTS = $(NIAGARA2CPU_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(NIAGARA2CPU_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_CPU_DIR)/$(MODULE) CPU_DIR = . @@ -59,13 +58,9 @@ CLEANFILES += $(CPULIB) $(SYM_MOD) # Define targets # ALL_TARGET = $(SYM_MOD) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = def $(BINARY) $(ROOTMODULE) -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) -DNIAGARA2_IMPL +CFLAGS += -DNIAGARA2_IMPL # # cpu-module-specific flags @@ -97,12 +92,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) $(CPULIB): $(OBJECTS) diff --git a/usr/src/uts/sun4v/ntwdt/Makefile b/usr/src/uts/sun4v/ntwdt/Makefile index 5aae3d419a..2685934ffe 100644 --- a/usr/src/uts/sun4v/ntwdt/Makefile +++ b/usr/src/uts/sun4v/ntwdt/Makefile @@ -22,8 +22,6 @@ # Copyright 2007 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 ntwdt driver module. # # sun4v implementation architecture dependent @@ -37,9 +35,8 @@ UTSBASE = ../.. # # Define the module and object file sets. # -MODULE = ntwdt +MODULE = ntwdt OBJECTS = $(NTWDT_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(NTWDT_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) CONF_SRCDIR = $(UTSBASE)/sun4v/io @@ -59,15 +56,9 @@ CLEANFILES += $(MODSTUBS_O) # Define targets # ALL_TARGET = $(BINARY) $(SRC_CONFILE) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # -# lint pass one enforcement -# -CFLAGS += -v - -# # Default build targets. # .KEEP_STATE: @@ -80,12 +71,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # diff --git a/usr/src/uts/sun4v/ontario/io/tsalarm.c b/usr/src/uts/sun4v/ontario/io/tsalarm.c index ebf15565c8..7fb9577028 100644 --- a/usr/src/uts/sun4v/ontario/io/tsalarm.c +++ b/usr/src/uts/sun4v/ontario/io/tsalarm.c @@ -410,7 +410,7 @@ tsalarm_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) * the device's softc, is used to direct peculiar behavior. */ if (ddi_create_minor_node(dip, "lom", S_IFCHR, 0, - DDI_PSEUDO, NULL) == DDI_FAILURE) { + DDI_PSEUDO, 0) == DDI_FAILURE) { goto attach_failed; } @@ -749,7 +749,7 @@ glvc_alarm_get(int alarm_type, int *alarm_state, tsalarm_softc_t *sc) req_ptr->alarm_id = alarm_type; send_msg.msg_type = PCP_ALARM_CONTROL; - send_msg.sub_type = NULL; + send_msg.sub_type = 0; send_msg.msg_len = sizeof (tsal_pcp_alarm_req_t); send_msg.msg_data = (uint8_t *)req_ptr; @@ -824,7 +824,7 @@ glvc_alarm_set(int alarm_type, int new_state, tsalarm_softc_t *sc) req_ptr->alarm_id = alarm_type; send_msg.msg_type = PCP_ALARM_CONTROL; - send_msg.sub_type = NULL; + send_msg.sub_type = 0; send_msg.msg_len = sizeof (tsal_pcp_alarm_req_t); send_msg.msg_data = (uint8_t *)req_ptr; diff --git a/usr/src/uts/sun4v/pcie/Makefile b/usr/src/uts/sun4v/pcie/Makefile index 12cf0358a9..7378fe095d 100644 --- a/usr/src/uts/sun4v/pcie/Makefile +++ b/usr/src/uts/sun4v/pcie/Makefile @@ -42,8 +42,6 @@ UTSBASE = ../.. MODULE = pcie OBJECTS = $(PCIE_MISC_OBJS:%=$(OBJS_DIR)/%) \ $(PCI_STRING_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(PCIE_MISC_OBJS:%.o=$(LINTS_DIR)/%.ln) \ - $(PCI_STRING_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_MISC_DIR)/$(MODULE) # @@ -55,7 +53,6 @@ include $(UTSBASE)/sun4v/Makefile.sun4v # Define targets # ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # @@ -81,12 +78,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # diff --git a/usr/src/uts/sun4v/platsvc/Makefile b/usr/src/uts/sun4v/platsvc/Makefile index 0c56b38552..14315fe472 100644 --- a/usr/src/uts/sun4v/platsvc/Makefile +++ b/usr/src/uts/sun4v/platsvc/Makefile @@ -35,9 +35,8 @@ UTSBASE = ../.. # # Define the module and object file sets. # -MODULE = platsvc +MODULE = platsvc OBJECTS = $(PLATSVC_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(PLATSVC_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_MISC_DIR)/$(MODULE) # @@ -49,13 +48,8 @@ include $(UTSBASE)/sun4v/Makefile.sun4v # Define targets # ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) CERRWARN += $(CNOWARN_UNINIT) # @@ -81,12 +75,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # diff --git a/usr/src/uts/sun4v/sys/ldc_impl.h b/usr/src/uts/sun4v/sys/ldc_impl.h index 4acea4f84f..be381ad018 100644 --- a/usr/src/uts/sun4v/sys/ldc_impl.h +++ b/usr/src/uts/sun4v/sys/ldc_impl.h @@ -229,7 +229,7 @@ typedef struct ldc_msg { uint8_t _type; /* Message type */ uint8_t _stype; /* Message subtype */ uint8_t _ctrl; /* Control/Error Message */ - uint8_t _env; /* Message Envelope */ + uint8_t _env; /* Message Envelope */ uint32_t _seqid; /* Sequence ID */ union { @@ -285,7 +285,7 @@ typedef union { pgszc:4; /* <3:0> pgsz code */ } mte_bit; - uint64_t ll; + uint64_t ll; } ldc_mte_t; @@ -300,8 +300,8 @@ typedef union { #define mte_pgszc mte_bit.pgszc #define MTE_BSZS_SHIFT(sz) ((sz) * 3) -#define MTEBYTES(sz) (MMU_PAGESIZE << MTE_BSZS_SHIFT(sz)) -#define MTEPAGES(sz) (1 << MTE_BSZS_SHIFT(sz)) +#define MTEBYTES(sz) (MMU_PAGESIZE << MTE_BSZS_SHIFT(sz)) +#define MTEPAGES(sz) (1 << MTE_BSZS_SHIFT(sz)) #define MTE_PAGE_SHIFT(sz) (MMU_PAGESHIFT + MTE_BSZS_SHIFT(sz)) #define MTE_PAGE_OFFSET(sz) (MTEBYTES(sz) - 1) #define MTE_PAGEMASK(sz) (~MTE_PAGE_OFFSET(sz)) @@ -400,7 +400,7 @@ typedef struct ldc_dring { ldc_mem_handle_t mhdl; /* Mem handle to desc ring */ struct ldc_dring *ch_next; /* Next dring in channel */ - struct ldc_dring *next; /* Next dring overall */ + struct ldc_dring *next; /* Next dring overall */ } ldc_dring_t; @@ -493,11 +493,11 @@ struct ldc_chan { * LDC module soft state structure */ typedef struct ldc_soft_state { - kmutex_t lock; /* Protects ldc_soft_state_t */ + kmutex_t lock; /* Protects ldc_soft_state_t */ ldc_cnex_t cinfo; /* channel nexus info */ uint64_t channel_count; /* Number of channels */ uint64_t channels_open; /* Number of open channels */ - ldc_chan_t *chan_list; /* List of LDC endpoints */ + ldc_chan_t *chan_list; /* List of LDC endpoints */ ldc_dring_t *dring_list; /* Descriptor rings (for export) */ kmem_cache_t *memhdl_cache; /* Memory handle cache */ @@ -522,9 +522,9 @@ if (ldcdbg & 0x02) \ if (ldcdbg & 0x04) \ ldcdebug #else -#define D1 -#define D2 -#define DWARN +#define D1(...) +#define D2(...) +#define DWARN(...) #endif #ifdef __cplusplus diff --git a/usr/src/uts/sun4v/sys/vnet.h b/usr/src/uts/sun4v/sys/vnet.h index 81b958fedf..04d2df006a 100644 --- a/usr/src/uts/sun4v/sys/vnet.h +++ b/usr/src/uts/sun4v/sys/vnet.h @@ -90,16 +90,16 @@ typedef struct vnet_hio_kstats { kstat_named_t oerrors; /* required by kstat for MIB II objects(RFC 1213) */ - kstat_named_t rbytes; /* MIB - ifInOctets */ + kstat_named_t rbytes; /* MIB - ifInOctets */ kstat_named_t rbytes64; - kstat_named_t obytes; /* MIB - ifOutOctets */ + kstat_named_t obytes; /* MIB - ifOutOctets */ kstat_named_t obytes64; - kstat_named_t multircv; /* MIB - ifInNUcastPkts */ - kstat_named_t multixmt; /* MIB - ifOutNUcastPkts */ + kstat_named_t multircv; /* MIB - ifInNUcastPkts */ + kstat_named_t multixmt; /* MIB - ifOutNUcastPkts */ kstat_named_t brdcstrcv; /* MIB - ifInNUcastPkts */ kstat_named_t brdcstxmt; /* MIB - ifOutNUcastPkts */ - kstat_named_t norcvbuf; /* MIB - ifInDiscards */ - kstat_named_t noxmtbuf; /* MIB - ifOutDiscards */ + kstat_named_t norcvbuf; /* MIB - ifInDiscards */ + kstat_named_t noxmtbuf; /* MIB - ifOutDiscards */ } vnet_hio_kstats_t; typedef struct vnet_tx_ring_stats { @@ -348,10 +348,10 @@ enum { DBG_LEVEL1 = 0x01, DBG_LEVEL2 = 0x02, DBG_WARN = 0x04, #else -#define DBG1(...) if (0) do { } while (0) -#define DBG2(...) if (0) do { } while (0) -#define DWARN(...) if (0) do { } while (0) -#define DERR(...) if (0) do { } while (0) +#define DBG1(...) +#define DBG2(...) +#define DWARN(...) +#define DERR(...) #endif diff --git a/usr/src/uts/sun4v/trapstat/Makefile b/usr/src/uts/sun4v/trapstat/Makefile index fa735a534e..1e1c5b71b1 100644 --- a/usr/src/uts/sun4v/trapstat/Makefile +++ b/usr/src/uts/sun4v/trapstat/Makefile @@ -22,8 +22,6 @@ # 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 trapstat kernel module. # # sun4v implementation architecture dependent @@ -39,7 +37,6 @@ UTSBASE = ../.. # MODULE = trapstat OBJECTS = $(TRAPSTAT_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(TRAPSTAT_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) CONF_SRCDIR = $(UTSBASE)/sun4/io @@ -52,23 +49,9 @@ include $(UTSBASE)/sun4v/Makefile.sun4v # Define targets # ALL_TARGET = $(BINARY) $(SRC_CONFFILE) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # -# 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_STATIC_UNUSED - -# # Default build targets. # .KEEP_STATE: @@ -81,12 +64,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # diff --git a/usr/src/uts/sun4v/vfalls/Makefile b/usr/src/uts/sun4v/vfalls/Makefile index 001654791b..57494194a4 100644 --- a/usr/src/uts/sun4v/vfalls/Makefile +++ b/usr/src/uts/sun4v/vfalls/Makefile @@ -39,7 +39,6 @@ UTSBASE = ../.. # MODULE = SUNW,UltraSPARC-T2+ OBJECTS = $(NIAGARA2CPU_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(NIAGARA2CPU_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_CPU_DIR)/$(MODULE) CPU_DIR = . @@ -59,13 +58,9 @@ CLEANFILES += $(CPULIB) $(SYM_MOD) # Define targets # ALL_TARGET = $(SYM_MOD) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = def $(BINARY) $(ROOTMODULE) -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) -DVFALLS_IMPL +CFLAGS += -DVFALLS_IMPL # # cpu-module-specific flags @@ -97,12 +92,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) $(CPULIB): $(OBJECTS) diff --git a/usr/src/uts/sun4v/vlds/Makefile b/usr/src/uts/sun4v/vlds/Makefile index 7ef22bfc35..4bc93801bd 100644 --- a/usr/src/uts/sun4v/vlds/Makefile +++ b/usr/src/uts/sun4v/vlds/Makefile @@ -39,7 +39,6 @@ UTSBASE = ../.. # MODULE = vlds OBJECTS = $(VLDS_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(VLDS_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) # @@ -58,13 +57,8 @@ CLEANFILES += $(MODSTUBS_O) # Define targets # ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses # @@ -84,12 +78,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # diff --git a/usr/src/uts/sun4v/vnet/Makefile b/usr/src/uts/sun4v/vnet/Makefile index 858c2c58da..21e1ea2b9c 100644 --- a/usr/src/uts/sun4v/vnet/Makefile +++ b/usr/src/uts/sun4v/vnet/Makefile @@ -42,7 +42,6 @@ UTSBASE = ../.. # MODULE = vnet OBJECTS = $(VNET_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(VNET_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) # @@ -61,13 +60,8 @@ CLEANFILES += $(MODSTUBS_O) # Define targets # ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) CFLAGS += -DVGEN_HANDLE_LOST_PKTS # @@ -75,17 +69,6 @@ CFLAGS += -DVGEN_HANDLE_LOST_PKTS # LDFLAGS += -dy -N misc/mac -N drv/ip -N misc/ldc -N misc/platsvc -# -# 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_STATIC_UNUSED -LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON - CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-clobbered CERRWARN += -_gcc=-Wno-unused-label @@ -107,12 +90,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # diff --git a/usr/src/uts/sun4v/vsw/Makefile b/usr/src/uts/sun4v/vsw/Makefile index e7d0a439e7..7d012ec8a0 100644 --- a/usr/src/uts/sun4v/vsw/Makefile +++ b/usr/src/uts/sun4v/vsw/Makefile @@ -42,7 +42,6 @@ UTSBASE = ../.. # MODULE = vsw OBJECTS = $(VSW_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(VSW_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) # @@ -65,26 +64,10 @@ LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) - -# # Module dependencies # LDFLAGS += -dy -Nmisc/ldc -Nmisc/mac -Nmisc/platsvc -# -# 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_STATIC_UNUSED -LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON - CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-clobbered CERRWARN += -_gcc=-Wno-unused-variable @@ -105,12 +88,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # |