From 8a878cd175b9a9d240edbc1c5d81d0edb43f6094 Mon Sep 17 00:00:00 2001 From: Josef 'Jeff' Sipek Date: Thu, 18 Jan 2018 21:08:21 -0500 Subject: [PATCH] preprocessor cleanup: __sparc This gets rid of all code surrounded by #ifdef-#endif/#ifndef-#endif (optionally with an #else). --- arch/x86/kernel/platform/i86pc/os/ssp.c | 5 - kernel/comstar/port/qlt/qlt.c | 9 - kernel/cpr/cpr_dump.c | 1306 ++----------------- kernel/cpr/cpr_main.c | 349 ----- kernel/cpr/cpr_misc.c | 1337 +++----------------- kernel/cpr/cpr_mod.c | 204 --- kernel/drivers/net/bge/bge_chip2.c | 26 - kernel/drivers/net/bge/bge_main2.c | 4 - kernel/drivers/net/chxge/ch.c | 157 --- kernel/drivers/net/chxge/pe.c | 114 -- kernel/drivers/net/e1000g/e1000g_alloc.c | 143 --- kernel/drivers/net/e1000g/e1000g_main.c | 112 -- kernel/drivers/net/e1000g/e1000g_rx.c | 10 - kernel/drivers/net/e1000g/e1000g_tx.c | 25 - kernel/drivers/net/hxge/hxge_main.c | 5 - kernel/drivers/net/igb/igb_buf.c | 4 - kernel/drivers/net/igb/igb_main.c | 64 - kernel/drivers/net/ixgbe/ixgbe_buf.c | 4 - kernel/drivers/net/ixgbe/ixgbe_main.c | 66 - kernel/drivers/net/nxge/nxge_send.c | 18 - kernel/drivers/net/sfe/sfe.c | 6 - kernel/drivers/net/sfxge/sfxge_intr.c | 5 - kernel/drivers/ramdisk/ramdisk.c | 13 - kernel/drivers/scsi/targets/sd/sd.c | 8 - kernel/fs/proc/prcontrol.c | 70 - kernel/fs/proc/prioctl.c | 27 - kernel/fs/proc/prusrio.c | 7 - kernel/fs/proc/prvnops.c | 195 --- kernel/fs/vfs.c | 26 - kernel/fs/zfs/lz4.c | 3 - kernel/krtld/kobj.c | 31 - kernel/os/autoconf.c | 6 - kernel/os/bp_map.c | 5 - kernel/os/core.c | 3 - kernel/os/dtrace_subr.c | 3 - kernel/os/exec.c | 11 - kernel/os/exit.c | 4 - kernel/os/fork.c | 10 - kernel/os/kdi.c | 18 - kernel/os/kstat_fr.c | 14 - kernel/os/lwp.c | 13 - kernel/os/main.c | 13 - kernel/os/mem_cage.c | 4 - kernel/os/mmapobj.c | 9 - kernel/os/pcifm.c | 17 - kernel/os/rctl_proc.c | 5 - kernel/os/subr.c | 6 - kernel/os/sunddi.c | 8 - kernel/os/sunndi.c | 4 - kernel/os/sunpci.c | 22 - kernel/os/sunpm.c | 2 - kernel/os/sysent.c | 8 - kernel/syscall/sigaction.c | 12 - kernel/syscall/uadmin.c | 4 - kernel/vm/seg_kmem.c | 219 ---- kernel/vm/vm_as.c | 13 - kernel/vm/vm_page.c | 47 - kernel/vm/vm_pagelist.c | 202 --- usr/src/cmd/csh/sh.misc.c | 12 - .../cmd/dtrace/test/tst/common/safety/tst.vahole.d | 4 - usr/src/cmd/halt/halt.c | 5 - usr/src/cmd/mdb/common/kmdb/kaif_start.c | 104 -- usr/src/cmd/mdb/common/kmdb/kctl/kctl_main.c | 5 - usr/src/cmd/mdb/common/kmdb/kmdb_fault.c | 13 - usr/src/cmd/mdb/common/kmdb/kmdb_kvm.c | 4 - usr/src/cmd/mdb/common/kmdb/kmdb_main.c | 4 - usr/src/cmd/mdb/common/kmdb/kmdb_promif.c | 30 - usr/src/cmd/mdb/common/kmdb/kmdb_promio.c | 4 - usr/src/cmd/mdb/common/kmdb/kmdb_stubs.c | 6 - usr/src/cmd/mdb/common/mdb/mdb_cmds.c | 239 ---- usr/src/cmd/mdb/common/mdb/mdb_disasm.c | 87 -- usr/src/cmd/mdb/common/mdb/mdb_kproc.c | 4 - usr/src/cmd/mdb/common/mdb/mdb_main.c | 4 - usr/src/cmd/mdb/common/mdb/mdb_proc.c | 87 -- usr/src/cmd/mdb/common/mdb/mdb_tdb.c | 11 - .../cmd/perl/contrib/Sun/Solaris/Kstat/Kstat.xs | 247 ---- usr/src/cmd/power/handlers.c | 11 - usr/src/cmd/prtconf/prt_xxx.c | 4 - usr/src/cmd/ptools/pflags/pflags.c | 13 - usr/src/cmd/sgs/elfedit/common/elfedit.c | 9 - usr/src/cmd/sgs/elfedit/common/elfedit.msg | 2 - usr/src/cmd/sgs/link_audit/common/truss.c | 6 - usr/src/cmd/stat/kstat/kstat.c | 253 ---- usr/src/cmd/truss/fcall.c | 78 -- usr/src/cmd/truss/print.c | 72 -- usr/src/common/crypto/sha1/sha1.c | 11 - usr/src/common/crypto/sha2/sha2.c | 22 - usr/src/common/ficl/loader.c | 4 - usr/src/common/ficl/softcore/lz4.c | 3 - usr/src/lib/libc/port/gen/walkstack.c | 33 - usr/src/lib/libc/port/threads/thr.c | 24 - usr/src/lib/libc_db/common/thread_db.c | 57 - usr/src/lib/libcpc/common/obsoleted.c | 12 - usr/src/lib/libdevinfo/devfsinfo.c | 2 - usr/src/lib/libdevinfo/devfsmap.c | 1197 ------------------ usr/src/lib/libdtrace/common/dt_link.c | 16 - usr/src/lib/libdtrace/common/dt_open.c | 12 - usr/src/lib/libkvm/common/test.c | 4 - usr/src/lib/libm/common/Q/expm1l.c | 2 - .../tst.vahole.d => lib/libm/common/Q/powl.c} | 49 +- .../libm/common/m9x/__fex_sparc.c} | 46 +- usr/src/lib/libm/common/m9x/remquol.c | 7 - usr/src/lib/libmvec/common/__vexpf.c | 30 - usr/src/lib/libproc/common/Pcore.c | 105 -- usr/src/lib/libproc/common/Psymtab_machelf32.c | 16 - usr/src/psm/stand/boot/common/heap_kmem.c | 10 - usr/src/stand/lib/inet/dhcpv4.c | 4 - usr/src/uts/common/conf/param.c | 12 - usr/src/uts/common/dtrace/fasttrap.c | 4 - usr/src/uts/common/exec/elf/elf_notes.c | 58 - usr/src/uts/common/exec/elf/old_notes.c | 40 - usr/src/uts/common/io/audio/ac97/ac97.c | 5 - .../uts/common/io/audio/drv/audio1575/audio1575.c | 20 - usr/src/uts/common/io/bofi.c | 3 - usr/src/uts/common/io/bscbus.c | 8 - usr/src/uts/common/io/bscv.c | 361 ------ usr/src/uts/common/io/cmlb.c | 8 - .../uts/common/io/fibre-channel/fca/qlc/ql_api.c | 45 - usr/src/uts/common/io/hme/hme.c | 26 - usr/src/uts/common/io/hotplug/pcihp/pcihp.c | 13 - usr/src/uts/common/io/i8042.c | 199 --- usr/src/uts/common/io/ib/adapters/hermon/hermon.c | 4 - .../uts/common/io/ib/adapters/hermon/hermon_cfg.c | 84 -- .../uts/common/io/ib/adapters/hermon/hermon_ci.c | 21 - .../uts/common/io/ib/adapters/hermon/hermon_misc.c | 13 - .../uts/common/io/ib/adapters/hermon/hermon_mr.c | 5 - .../uts/common/io/ib/adapters/tavor/tavor_cfg.c | 77 -- usr/src/uts/common/io/ib/adapters/tavor/tavor_ci.c | 4 - usr/src/uts/common/io/ib/adapters/tavor/tavor_mr.c | 20 - usr/src/uts/common/io/kb8042/at_keyprocess.c | 4 - usr/src/uts/common/io/kb8042/kb8042.c | 169 --- usr/src/uts/common/io/kbd.c | 59 - usr/src/uts/common/io/kbtrans/usb_keytables.c | 4 - usr/src/uts/common/io/ldterm.c | 2 - usr/src/uts/common/io/mem.c | 145 --- usr/src/uts/common/io/mr_sas/mr_sas.c | 51 - usr/src/uts/common/io/openprom.c | 23 - usr/src/uts/common/io/pciex/pcie.c | 5 - usr/src/uts/common/io/power.c | 3 - .../uts/common/io/scsi/adapters/mpt_sas/mptsas.c | 43 - usr/src/uts/common/io/scsi/impl/scsi_resource.c | 12 - usr/src/uts/common/io/scsi/targets/st.c | 4 - usr/src/uts/common/io/stream.c | 4 - usr/src/uts/common/io/usb/hcd/ehci/ehci.c | 12 - usr/src/uts/common/io/usb/hcd/ehci/ehci_polled.c | 6 - usr/src/uts/common/io/usb/hcd/openhci/ohci.c | 8 - usr/src/uts/common/io/usb/hcd/uhci/uhci.c | 2 - usr/src/uts/common/io/usb/hcd/uhci/uhcipolled.c | 8 - usr/src/uts/common/io/xge/drv/xge.c | 6 - usr/src/uts/common/io/xge/drv/xgell.c | 8 - usr/src/uts/common/tnf/tnf_trace.c | 42 - 151 files changed, 308 insertions(+), 9361 deletions(-) rewrite kernel/cpr/cpr_dump.c (89%) rewrite kernel/cpr/cpr_misc.c (85%) copy usr/src/{cmd/dtrace/test/tst/common/safety/tst.vahole.d => lib/libm/common/Q/powl.c} (65%) copy usr/src/{cmd/dtrace/test/tst/common/safety/tst.vahole.d => lib/libm/common/m9x/__fex_sparc.c} (65%) diff --git a/arch/x86/kernel/platform/i86pc/os/ssp.c b/arch/x86/kernel/platform/i86pc/os/ssp.c index 093a2d5e56..8d71f0b0e3 100644 --- a/arch/x86/kernel/platform/i86pc/os/ssp.c +++ b/arch/x86/kernel/platform/i86pc/os/ssp.c @@ -106,13 +106,8 @@ __stack_chk_fail(void) static void salsa_hash(unsigned int *); -#ifdef __sparc -extern uint64_t ultra_gettick(void); -#define SSP_GET_TICK ultra_gettick -#else extern hrtime_t tsc_read(void); #define SSP_GET_TICK tsc_read -#endif /* __sparc */ /* called from os/startup.c */ void diff --git a/kernel/comstar/port/qlt/qlt.c b/kernel/comstar/port/qlt/qlt.c index c374e3e960..9719d2d24a 100644 --- a/kernel/comstar/port/qlt/qlt.c +++ b/kernel/comstar/port/qlt/qlt.c @@ -933,9 +933,7 @@ qlt_setup_interrupts(qlt_state_t *qlt) /* * x86 has a bug in the ddi_intr_block_enable/disable area (6562198). */ -#ifndef __sparc if (qlt_enable_msi != 0) { -#endif if (ddi_intr_get_supported_types(qlt->dip, &itypes) != DDI_SUCCESS) { itypes = DDI_INTR_TYPE_FIXED; } @@ -949,9 +947,7 @@ qlt_setup_interrupts(qlt_state_t *qlt) if (qlt_setup_msi(qlt) == DDI_SUCCESS) return (DDI_SUCCESS); } -#ifndef __sparc } -#endif return (qlt_setup_fixed(qlt)); } @@ -988,13 +984,8 @@ qlt_populate_hba_fru_details(struct fct_local_port *port, kmem_free(bufp, (uint_t)len); bufp = NULL; } else { -#ifdef __sparc - (void) snprintf(port_attrs->option_rom_version, - FCHBA_OPTION_ROM_VERSION_LEN, "No Fcode found"); -#else (void) snprintf(port_attrs->option_rom_version, FCHBA_OPTION_ROM_VERSION_LEN, "N/A"); -#endif } port_attrs->vendor_specific_id = qlt->nvram->subsystem_vendor_id[0] | qlt->nvram->subsystem_vendor_id[1] << 8; diff --git a/kernel/cpr/cpr_dump.c b/kernel/cpr/cpr_dump.c dissimilarity index 89% index 2b48011990..314f0f478b 100644 --- a/kernel/cpr/cpr_dump.c +++ b/kernel/cpr/cpr_dump.c @@ -1,1196 +1,110 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Fill in and write out the cpr state file - * 1. Allocate and write headers, ELF and cpr dump header - * 2. Allocate bitmaps according to phys_install - * 3. Tag kernel pages into corresponding bitmap - * 4. Write bitmaps to state file - * 5. Write actual physical page data to state file - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Local defines and variables */ -#define BTOb(bytes) ((bytes) << 3) /* Bytes to bits, log2(NBBY) */ -#define bTOB(bits) ((bits) >> 3) /* bits to Bytes, log2(NBBY) */ - -#if defined(__sparc) -static uint_t cpr_pages_tobe_dumped; -static uint_t cpr_regular_pgs_dumped; -static int cpr_dump_regular_pages(vnode_t *); -static int cpr_count_upages(int, bitfunc_t); -static int cpr_compress_and_write(vnode_t *, uint_t, pfn_t, pgcnt_t); -#endif - -int cpr_flush_write(vnode_t *); - -int cpr_contig_pages(vnode_t *, int); - -void cpr_clear_bitmaps(); - -extern size_t cpr_get_devsize(dev_t); -extern int i_cpr_dump_setup(vnode_t *); -extern int i_cpr_blockzero(char *, char **, int *, vnode_t *); -extern int cpr_test_mode; -int cpr_setbit(pfn_t, int); -int cpr_clrbit(pfn_t, int); - -ctrm_t cpr_term; - -char *cpr_buf, *cpr_buf_end; -int cpr_buf_blocks; /* size of cpr_buf in blocks */ -size_t cpr_buf_size; /* size of cpr_buf in bytes */ -size_t cpr_bitmap_size; -int cpr_nbitmaps; - -char *cpr_pagedata; /* page buffer for compression / tmp copy */ -size_t cpr_pagedata_size; /* page buffer size in bytes */ - -#if defined(__sparc) -static char *cpr_wptr; /* keep track of where to write to next */ -static int cpr_file_bn; /* cpr state-file block offset */ -static int cpr_disk_writes_ok; -static size_t cpr_dev_space = 0; -#endif - -char cpr_pagecopy[CPR_MAXCONTIG * MMU_PAGESIZE]; - -#if defined(__sparc) -/* - * On some platforms bcopy may modify the thread structure - * during bcopy (eg, to prevent cpu migration). If the - * range we are currently writing out includes our own - * thread structure then it will be snapshotted by bcopy - * including those modified members - and the updates made - * on exit from bcopy will no longer be seen when we later - * restore the mid-bcopy kthread_t. So if the range we - * need to copy overlaps with our thread structure we will - * use a simple byte copy. - */ -void -cprbcopy(void *from, void *to, size_t bytes) -{ - extern int curthreadremapped; - caddr_t kthrend; - - kthrend = (caddr_t)curthread + sizeof (kthread_t) - 1; - if (curthreadremapped || (kthrend >= (caddr_t)from && - kthrend < (caddr_t)from + bytes + sizeof (kthread_t) - 1)) { - caddr_t src = from, dst = to; - - while (bytes-- > 0) - *dst++ = *src++; - } else { - bcopy(from, to, bytes); - } -} - -/* - * Allocate pages for buffers used in writing out the statefile - */ -static int -cpr_alloc_bufs(void) -{ - char *allocerr = "Unable to allocate memory for cpr buffer"; - size_t size; - - /* - * set the cpr write buffer size to at least the historic - * size (128k) or large enough to store the both the early - * set of statefile structures (well under 0x800) plus the - * bitmaps, and roundup to the next pagesize. - */ - size = PAGE_ROUNDUP(dbtob(4) + cpr_bitmap_size); - cpr_buf_size = MAX(size, CPRBUFSZ); - cpr_buf_blocks = btodb(cpr_buf_size); - cpr_buf = kmem_alloc(cpr_buf_size, KM_NOSLEEP); - if (cpr_buf == NULL) { - cpr_err(CE_WARN, allocerr); - return (ENOMEM); - } - cpr_buf_end = cpr_buf + cpr_buf_size; - - cpr_pagedata_size = mmu_ptob(CPR_MAXCONTIG + 1); - cpr_pagedata = kmem_alloc(cpr_pagedata_size, KM_NOSLEEP); - if (cpr_pagedata == NULL) { - kmem_free(cpr_buf, cpr_buf_size); - cpr_buf = NULL; - cpr_err(CE_WARN, allocerr); - return (ENOMEM); - } - - return (0); -} - - -/* - * Set bitmap size in bytes based on phys_install. - */ -void -cpr_set_bitmap_size(void) -{ - struct memlist *pmem; - size_t size = 0; - - memlist_read_lock(); - for (pmem = phys_install; pmem; pmem = pmem->ml_next) - size += pmem->ml_size; - memlist_read_unlock(); - cpr_bitmap_size = BITMAP_BYTES(size); -} - - -/* - * CPR dump header contains the following information: - * 1. header magic -- unique to cpr state file - * 2. kernel return pc & ppn for resume - * 3. current thread info - * 4. debug level and test mode - * 5. number of bitmaps allocated - * 6. number of page records - */ -static int -cpr_write_header(vnode_t *vp) -{ - extern ushort_t cpr_mach_type; - struct cpr_dump_desc cdump; - pgcnt_t bitmap_pages; - pgcnt_t kpages, vpages, upages; - pgcnt_t cpr_count_kpages(int mapflag, bitfunc_t bitfunc); - - cdump.cdd_magic = (uint_t)CPR_DUMP_MAGIC; - cdump.cdd_version = CPR_VERSION; - cdump.cdd_machine = cpr_mach_type; - cdump.cdd_debug = cpr_debug; - cdump.cdd_test_mode = cpr_test_mode; - cdump.cdd_bitmaprec = cpr_nbitmaps; - - cpr_clear_bitmaps(); - - /* - * Remember how many pages we plan to save to statefile. - * This information will be used for sanity checks. - * Untag those pages that will not be saved to statefile. - */ - kpages = cpr_count_kpages(REGULAR_BITMAP, cpr_setbit); - vpages = cpr_count_volatile_pages(REGULAR_BITMAP, cpr_clrbit); - upages = cpr_count_upages(REGULAR_BITMAP, cpr_setbit); - cdump.cdd_dumppgsize = kpages - vpages + upages; - cpr_pages_tobe_dumped = cdump.cdd_dumppgsize; - CPR_DEBUG(CPR_DEBUG7, - "\ncpr_write_header: kpages %ld - vpages %ld + upages %ld = %d\n", - kpages, vpages, upages, cdump.cdd_dumppgsize); - - /* - * Some pages contain volatile data (cpr_buf and storage area for - * sensitive kpages), which are no longer needed after the statefile - * is dumped to disk. We have already untagged them from regular - * bitmaps. Now tag them into the volatile bitmaps. The pages in - * volatile bitmaps will be claimed during resume, and the resumed - * kernel will free them. - */ - (void) cpr_count_volatile_pages(VOLATILE_BITMAP, cpr_setbit); - - bitmap_pages = mmu_btopr(cpr_bitmap_size); - - /* - * Export accurate statefile size for statefile allocation retry. - * statefile_size = all the headers + total pages + - * number of pages used by the bitmaps. - * Roundup will be done in the file allocation code. - */ - STAT->cs_nocomp_statefsz = sizeof (cdd_t) + sizeof (cmd_t) + - (sizeof (cbd_t) * cdump.cdd_bitmaprec) + - (sizeof (cpd_t) * cdump.cdd_dumppgsize) + - mmu_ptob(cdump.cdd_dumppgsize + bitmap_pages); - - /* - * If the estimated statefile is not big enough, - * go retry now to save un-necessary operations. - */ - if (!(CPR->c_flags & C_COMPRESSING) && - (STAT->cs_nocomp_statefsz > STAT->cs_est_statefsz)) { - if (cpr_debug & (CPR_DEBUG1 | CPR_DEBUG7)) - prom_printf("cpr_write_header: " - "STAT->cs_nocomp_statefsz > " - "STAT->cs_est_statefsz\n"); - return (ENOSPC); - } - - /* now write cpr dump descriptor */ - return (cpr_write(vp, (caddr_t)&cdump, sizeof (cdd_t))); -} - - -/* - * CPR dump tail record contains the following information: - * 1. header magic -- unique to cpr state file - * 2. all misc info that needs to be passed to cprboot or resumed kernel - */ -static int -cpr_write_terminator(vnode_t *vp) -{ - cpr_term.magic = (uint_t)CPR_TERM_MAGIC; - cpr_term.va = (cpr_ptr)&cpr_term; - cpr_term.pfn = (cpr_ext)va_to_pfn(&cpr_term); - - /* count the last one (flush) */ - cpr_term.real_statef_size = STAT->cs_real_statefsz + - btod(cpr_wptr - cpr_buf) * DEV_BSIZE; - - CPR_DEBUG(CPR_DEBUG9, "cpr_dump: Real Statefile Size: %ld\n", - STAT->cs_real_statefsz); - - cpr_tod_get(&cpr_term.tm_shutdown); - - return (cpr_write(vp, (caddr_t)&cpr_term, sizeof (cpr_term))); -} - -/* - * Write bitmap descriptor array, followed by merged bitmaps. - */ -static int -cpr_write_bitmap(vnode_t *vp) -{ - char *rmap, *vmap, *dst, *tail; - size_t size, bytes; - cbd_t *dp; - int err; - - dp = CPR->c_bmda; - if (err = cpr_write(vp, (caddr_t)dp, cpr_nbitmaps * sizeof (*dp))) - return (err); - - /* - * merge regular and volatile bitmaps into tmp space - * and write to disk - */ - for (; dp->cbd_size; dp++) { - rmap = (char *)dp->cbd_reg_bitmap; - vmap = (char *)dp->cbd_vlt_bitmap; - for (size = dp->cbd_size; size; size -= bytes) { - bytes = min(size, sizeof (cpr_pagecopy)); - tail = &cpr_pagecopy[bytes]; - for (dst = cpr_pagecopy; dst < tail; dst++) - *dst = *rmap++ | *vmap++; - if (err = cpr_write(vp, cpr_pagecopy, bytes)) - break; - } - } - - return (err); -} - - -static int -cpr_write_statefile(vnode_t *vp) -{ - uint_t error = 0; - extern int i_cpr_check_pgs_dumped(); - void flush_windows(void); - pgcnt_t spages; - char *str; - - flush_windows(); - - /* - * to get an accurate view of kas, we need to untag sensitive - * pages *before* dumping them because the disk driver makes - * allocations and changes kas along the way. The remaining - * pages referenced in the bitmaps are dumped out later as - * regular kpages. - */ - str = "cpr_write_statefile:"; - spages = i_cpr_count_sensitive_kpages(REGULAR_BITMAP, cpr_clrbit); - CPR_DEBUG(CPR_DEBUG7, "%s untag %ld sens pages\n", str, spages); - - /* - * now it's OK to call a driver that makes allocations - */ - cpr_disk_writes_ok = 1; - - /* - * now write out the clean sensitive kpages - * according to the sensitive descriptors - */ - error = i_cpr_dump_sensitive_kpages(vp); - if (error) { - CPR_DEBUG(CPR_DEBUG7, - "%s cpr_dump_sensitive_kpages() failed!\n", str); - return (error); - } - - /* - * cpr_dump_regular_pages() counts cpr_regular_pgs_dumped - */ - error = cpr_dump_regular_pages(vp); - if (error) { - CPR_DEBUG(CPR_DEBUG7, - "%s cpr_dump_regular_pages() failed!\n", str); - return (error); - } - - /* - * sanity check to verify the right number of pages were dumped - */ - error = i_cpr_check_pgs_dumped(cpr_pages_tobe_dumped, - cpr_regular_pgs_dumped); - - if (error) { - prom_printf("\n%s page count mismatch!\n", str); -#ifdef DEBUG - if (cpr_test_mode) - debug_enter(NULL); -#endif - } - - return (error); -} -#endif - - -/* - * creates the CPR state file, the following sections are - * written out in sequence: - * - writes the cpr dump header - * - writes the memory usage bitmaps - * - writes the platform dependent info - * - writes the remaining user pages - * - writes the kernel pages - */ -#if defined(__x86) - _NOTE(ARGSUSED(0)) -#endif -int -cpr_dump(vnode_t *vp) -{ -#if defined(__sparc) - int error; - - if (cpr_buf == NULL) { - ASSERT(cpr_pagedata == NULL); - if (error = cpr_alloc_bufs()) - return (error); - } - /* point to top of internal buffer */ - cpr_wptr = cpr_buf; - - /* initialize global variables used by the write operation */ - cpr_file_bn = cpr_statefile_offset(); - cpr_dev_space = 0; - - /* allocate bitmaps */ - if (CPR->c_bmda == NULL) { - if (error = i_cpr_alloc_bitmaps()) { - cpr_err(CE_WARN, "cannot allocate bitmaps"); - return (error); - } - } - - if (error = i_cpr_prom_pages(CPR_PROM_SAVE)) - return (error); - - if (error = i_cpr_dump_setup(vp)) - return (error); - - /* - * set internal cross checking; we dont want to call - * a disk driver that makes allocations until after - * sensitive pages are saved - */ - cpr_disk_writes_ok = 0; - - /* - * 1253112: heap corruption due to memory allocation when dumpping - * statefile. - * Theoretically on Sun4u only the kernel data nucleus, kvalloc and - * kvseg segments can be contaminated should memory allocations happen - * during sddump, which is not supposed to happen after the system - * is quiesced. Let's call the kernel pages that tend to be affected - * 'sensitive kpages' here. To avoid saving inconsistent pages, we - * will allocate some storage space to save the clean sensitive pages - * aside before statefile dumping takes place. Since there may not be - * much memory left at this stage, the sensitive pages will be - * compressed before they are saved into the storage area. - */ - if (error = i_cpr_save_sensitive_kpages()) { - CPR_DEBUG(CPR_DEBUG7, - "cpr_dump: save_sensitive_kpages failed!\n"); - return (error); - } - - /* - * since all cpr allocations are done (space for sensitive kpages, - * bitmaps, cpr_buf), kas is stable, and now we can accurately - * count regular and sensitive kpages. - */ - if (error = cpr_write_header(vp)) { - CPR_DEBUG(CPR_DEBUG7, - "cpr_dump: cpr_write_header() failed!\n"); - return (error); - } - - if (error = i_cpr_write_machdep(vp)) - return (error); - - if (error = i_cpr_blockzero(cpr_buf, &cpr_wptr, NULL, NULL)) - return (error); - - if (error = cpr_write_bitmap(vp)) - return (error); - - if (error = cpr_write_statefile(vp)) { - CPR_DEBUG(CPR_DEBUG7, - "cpr_dump: cpr_write_statefile() failed!\n"); - return (error); - } - - if (error = cpr_write_terminator(vp)) - return (error); - - if (error = cpr_flush_write(vp)) - return (error); - - if (error = i_cpr_blockzero(cpr_buf, &cpr_wptr, &cpr_file_bn, vp)) - return (error); -#endif - - return (0); -} - - -#if defined(__sparc) -/* - * cpr_xwalk() is called many 100x with a range within kvseg or kvseg_reloc; - * a page-count from each range is accumulated at arg->pages. - */ -static void -cpr_xwalk(void *arg, void *base, size_t size) -{ - struct cpr_walkinfo *cwip = arg; - - cwip->pages += cpr_count_pages(base, size, - cwip->mapflag, cwip->bitfunc, DBG_DONTSHOWRANGE); - cwip->size += size; - cwip->ranges++; -} - -/* - * cpr_walk() is called many 100x with a range within kvseg or kvseg_reloc; - * a page-count from each range is accumulated at arg->pages. - */ -static void -cpr_walk(void *arg, void *base, size_t size) -{ - caddr_t addr = base; - caddr_t addr_end = addr + size; - - /* - * If we are about to start walking the range of addresses we - * carved out of the kernel heap for the large page heap walk - * heap_lp_arena to find what segments are actually populated - */ - if (SEGKMEM_USE_LARGEPAGES && - addr == heap_lp_base && addr_end == heap_lp_end && - vmem_size(heap_lp_arena, VMEM_ALLOC) < size) { - vmem_walk(heap_lp_arena, VMEM_ALLOC, cpr_xwalk, arg); - } else { - cpr_xwalk(arg, base, size); - } -} - - -/* - * faster scan of kvseg using vmem_walk() to visit - * allocated ranges. - */ -pgcnt_t -cpr_scan_kvseg(int mapflag, bitfunc_t bitfunc, struct seg *seg) -{ - struct cpr_walkinfo cwinfo; - - bzero(&cwinfo, sizeof (cwinfo)); - cwinfo.mapflag = mapflag; - cwinfo.bitfunc = bitfunc; - - vmem_walk(heap_arena, VMEM_ALLOC, cpr_walk, &cwinfo); - - if (cpr_debug & CPR_DEBUG7) { - prom_printf("walked %d sub-ranges, total pages %ld\n", - cwinfo.ranges, mmu_btop(cwinfo.size)); - cpr_show_range(seg->s_base, seg->s_size, - mapflag, bitfunc, cwinfo.pages); - } - - return (cwinfo.pages); -} - - -/* - * cpr_walk_kpm() is called for every used area within the large - * segkpm virtual address window. A page-count is accumulated at - * arg->pages. - */ -static void -cpr_walk_kpm(void *arg, void *base, size_t size) -{ - struct cpr_walkinfo *cwip = arg; - - cwip->pages += cpr_count_pages(base, size, - cwip->mapflag, cwip->bitfunc, DBG_DONTSHOWRANGE); - cwip->size += size; - cwip->ranges++; -} - - -/* - * faster scan of segkpm using hat_kpm_walk() to visit only used ranges. - */ -/*ARGSUSED*/ -static pgcnt_t -cpr_scan_segkpm(int mapflag, bitfunc_t bitfunc, struct seg *seg) -{ - struct cpr_walkinfo cwinfo; - - if (kpm_enable == 0) - return (0); - - bzero(&cwinfo, sizeof (cwinfo)); - cwinfo.mapflag = mapflag; - cwinfo.bitfunc = bitfunc; - hat_kpm_walk(cpr_walk_kpm, &cwinfo); - - if (cpr_debug & CPR_DEBUG7) { - prom_printf("walked %d sub-ranges, total pages %ld\n", - cwinfo.ranges, mmu_btop(cwinfo.size)); - cpr_show_range(segkpm->s_base, segkpm->s_size, - mapflag, bitfunc, cwinfo.pages); - } - - return (cwinfo.pages); -} - - -/* - * Sparsely filled kernel segments are registered in kseg_table for - * easier lookup. See also block comment for cpr_count_seg_pages. - */ - -#define KSEG_SEG_ADDR 0 /* address of struct seg */ -#define KSEG_PTR_ADDR 1 /* address of pointer to struct seg */ - -typedef struct { - struct seg **st_seg; /* segment pointer or segment address */ - pgcnt_t (*st_fcn)(int, bitfunc_t, struct seg *); /* function to call */ - int st_addrtype; /* address type in st_seg */ -} ksegtbl_entry_t; - -ksegtbl_entry_t kseg_table[] = { - {(struct seg **)&kvseg, cpr_scan_kvseg, KSEG_SEG_ADDR}, - {&segkpm, cpr_scan_segkpm, KSEG_PTR_ADDR}, - {NULL, 0, 0} -}; - - -/* - * Compare seg with each entry in kseg_table; when there is a match - * return the entry pointer, otherwise return NULL. - */ -static ksegtbl_entry_t * -cpr_sparse_seg_check(struct seg *seg) -{ - ksegtbl_entry_t *ste = &kseg_table[0]; - struct seg *tseg; - - for (; ste->st_seg; ste++) { - tseg = (ste->st_addrtype == KSEG_PTR_ADDR) ? - *ste->st_seg : (struct seg *)ste->st_seg; - - if (seg == tseg) - return (ste); - } - - return ((ksegtbl_entry_t *)NULL); -} - - -/* - * Count pages within each kernel segment; call cpr_sparse_seg_check() - * to find out whether a sparsely filled segment needs special - * treatment (e.g. kvseg). - * Todo: A "segop_cpr" like segop_dump should be introduced, the cpr - * module shouldn't need to know segment details like if it is - * sparsely filled or not (makes kseg_table obsolete). - */ -pgcnt_t -cpr_count_seg_pages(int mapflag, bitfunc_t bitfunc) -{ - struct seg *segp; - pgcnt_t pages; - ksegtbl_entry_t *ste; - - pages = 0; - for (segp = AS_SEGFIRST(&kas); segp; segp = AS_SEGNEXT(&kas, segp)) { - if (ste = cpr_sparse_seg_check(segp)) { - pages += (ste->st_fcn)(mapflag, bitfunc, segp); - } else { - pages += cpr_count_pages(segp->s_base, - segp->s_size, mapflag, bitfunc, DBG_SHOWRANGE); - } - } - - return (pages); -} - - -/* - * count kernel pages within kas and any special ranges - */ -pgcnt_t -cpr_count_kpages(int mapflag, bitfunc_t bitfunc) -{ - pgcnt_t kas_cnt; - - /* - * Some pages need to be taken care of differently. - * eg: panicbuf pages of sun4m are not in kas but they need - * to be saved. On sun4u, the physical pages of panicbuf are - * allocated via prom_retain(). - */ - kas_cnt = i_cpr_count_special_kpages(mapflag, bitfunc); - kas_cnt += cpr_count_seg_pages(mapflag, bitfunc); - - CPR_DEBUG(CPR_DEBUG9, "cpr_count_kpages: kas_cnt=%ld\n", kas_cnt); - CPR_DEBUG(CPR_DEBUG7, "\ncpr_count_kpages: %ld pages, 0x%lx bytes\n", - kas_cnt, mmu_ptob(kas_cnt)); - - return (kas_cnt); -} - - -/* - * Set a bit corresponding to the arg phys page number; - * returns 0 when the ppn is valid and the corresponding - * map bit was clear, otherwise returns 1. - */ -int -cpr_setbit(pfn_t ppn, int mapflag) -{ - char *bitmap; - cbd_t *dp; - pfn_t rel; - int clr; - - for (dp = CPR->c_bmda; dp->cbd_size; dp++) { - if (PPN_IN_RANGE(ppn, dp)) { - bitmap = DESC_TO_MAP(dp, mapflag); - rel = ppn - dp->cbd_spfn; - if ((clr = isclr(bitmap, rel)) != 0) - setbit(bitmap, rel); - return (clr == 0); - } - } - - return (1); -} - - -/* - * Clear a bit corresponding to the arg phys page number. - */ -int -cpr_clrbit(pfn_t ppn, int mapflag) -{ - char *bitmap; - cbd_t *dp; - pfn_t rel; - int set; - - for (dp = CPR->c_bmda; dp->cbd_size; dp++) { - if (PPN_IN_RANGE(ppn, dp)) { - bitmap = DESC_TO_MAP(dp, mapflag); - rel = ppn - dp->cbd_spfn; - if ((set = isset(bitmap, rel)) != 0) - clrbit(bitmap, rel); - return (set == 0); - } - } - - return (1); -} - - -/* ARGSUSED */ -int -cpr_nobit(pfn_t ppn, int mapflag) -{ - return (0); -} - - -/* - * Lookup a bit corresponding to the arg phys page number. - */ -int -cpr_isset(pfn_t ppn, int mapflag) -{ - char *bitmap; - cbd_t *dp; - pfn_t rel; - - for (dp = CPR->c_bmda; dp->cbd_size; dp++) { - if (PPN_IN_RANGE(ppn, dp)) { - bitmap = DESC_TO_MAP(dp, mapflag); - rel = ppn - dp->cbd_spfn; - return (isset(bitmap, rel)); - } - } - - return (0); -} - - -/* - * Go thru all pages and pick up any page not caught during the invalidation - * stage. This is also used to save pages with cow lock or phys page lock held - * (none zero p_lckcnt or p_cowcnt) - */ -static int -cpr_count_upages(int mapflag, bitfunc_t bitfunc) -{ - page_t *pp, *page0; - pgcnt_t dcnt = 0, tcnt = 0; - pfn_t pfn; - - page0 = pp = page_first(); - - do { - if (pp->p_vnode == NULL || PP_ISKAS(pp) || - PP_ISFREE(pp) && PP_ISAGED(pp)) - continue; - - pfn = page_pptonum(pp); - if (pf_is_memory(pfn)) { - tcnt++; - if ((*bitfunc)(pfn, mapflag) == 0) - dcnt++; /* dirty count */ - } - } while ((pp = page_next(pp)) != page0); - - STAT->cs_upage2statef = dcnt; - CPR_DEBUG(CPR_DEBUG9, "cpr_count_upages: dirty=%ld total=%ld\n", - dcnt, tcnt); - CPR_DEBUG(CPR_DEBUG7, "cpr_count_upages: %ld pages, 0x%lx bytes\n", - dcnt, mmu_ptob(dcnt)); - page0 = NULL; /* for Lint */ - return (dcnt); -} - - -/* - * try compressing pages based on cflag, - * and for DEBUG kernels, verify uncompressed data checksum; - * - * this routine replaces common code from - * i_cpr_compress_and_save() and cpr_compress_and_write() - */ -char * -cpr_compress_pages(cpd_t *dp, pgcnt_t pages, int cflag) -{ - size_t nbytes, clen, len; - uint32_t test_sum; - char *datap; - - nbytes = mmu_ptob(pages); - - /* - * set length to the original uncompressed data size; - * always init cpd_flag to zero - */ - dp->cpd_length = nbytes; - dp->cpd_flag = 0; - -#ifdef DEBUG - /* - * Make a copy of the uncompressed data so we can checksum it. - * Compress that copy so the checksum works at the other end - */ - cprbcopy(CPR->c_mapping_area, cpr_pagecopy, nbytes); - dp->cpd_usum = checksum32(cpr_pagecopy, nbytes); - dp->cpd_flag |= CPD_USUM; - datap = cpr_pagecopy; -#else - datap = CPR->c_mapping_area; - dp->cpd_usum = 0; -#endif - - /* - * try compressing the raw data to cpr_pagedata; - * if there was a size reduction: record the new length, - * flag the compression, and point to the compressed data. - */ - dp->cpd_csum = 0; - if (cflag) { - clen = compress(datap, cpr_pagedata, nbytes); - if (clen < nbytes) { - dp->cpd_flag |= CPD_COMPRESS; - dp->cpd_length = clen; - datap = cpr_pagedata; -#ifdef DEBUG - dp->cpd_csum = checksum32(datap, clen); - dp->cpd_flag |= CPD_CSUM; - - /* - * decompress the data back to a scratch area - * and compare the new checksum with the original - * checksum to verify the compression. - */ - bzero(cpr_pagecopy, sizeof (cpr_pagecopy)); - len = decompress(datap, cpr_pagecopy, - clen, sizeof (cpr_pagecopy)); - test_sum = checksum32(cpr_pagecopy, len); - ASSERT(test_sum == dp->cpd_usum); -#endif - } - } - - return (datap); -} - - -/* - * 1. Prepare cpr page descriptor and write it to file - * 2. Compress page data and write it out - */ -static int -cpr_compress_and_write(vnode_t *vp, uint_t va, pfn_t pfn, pgcnt_t npg) -{ - int error = 0; - char *datap; - cpd_t cpd; /* cpr page descriptor */ - extern void i_cpr_mapin(caddr_t, uint_t, pfn_t); - extern void i_cpr_mapout(caddr_t, uint_t); - - i_cpr_mapin(CPR->c_mapping_area, npg, pfn); - - CPR_DEBUG(CPR_DEBUG3, "mapped-in %ld pages, vaddr 0x%p, pfn 0x%lx\n", - npg, (void *)CPR->c_mapping_area, pfn); - - /* - * Fill cpr page descriptor. - */ - cpd.cpd_magic = (uint_t)CPR_PAGE_MAGIC; - cpd.cpd_pfn = pfn; - cpd.cpd_pages = npg; - - STAT->cs_dumped_statefsz += mmu_ptob(npg); - - datap = cpr_compress_pages(&cpd, npg, CPR->c_flags & C_COMPRESSING); - - /* Write cpr page descriptor */ - error = cpr_write(vp, (caddr_t)&cpd, sizeof (cpd_t)); - - /* Write compressed page data */ - error = cpr_write(vp, (caddr_t)datap, cpd.cpd_length); - - /* - * Unmap the pages for tlb and vac flushing - */ - i_cpr_mapout(CPR->c_mapping_area, npg); - - if (error) { - CPR_DEBUG(CPR_DEBUG1, - "cpr_compress_and_write: vp 0x%p va 0x%x ", (void *)vp, va); - CPR_DEBUG(CPR_DEBUG1, "pfn 0x%lx blk %d err %d\n", - pfn, cpr_file_bn, error); - } else { - cpr_regular_pgs_dumped += npg; - } - - return (error); -} - - -int -cpr_write(vnode_t *vp, caddr_t buffer, size_t size) -{ - caddr_t fromp = buffer; - size_t bytes, wbytes; - int error; - - if (cpr_dev_space == 0) { - if (vp->v_type == VBLK) { - cpr_dev_space = cpr_get_devsize(vp->v_rdev); - ASSERT(cpr_dev_space); - } else - cpr_dev_space = 1; /* not used in this case */ - } - - /* - * break the write into multiple part if request is large, - * calculate count up to buf page boundary, then write it out. - * repeat until done. - */ - while (size) { - bytes = MIN(size, cpr_buf_end - cpr_wptr); - cprbcopy(fromp, cpr_wptr, bytes); - cpr_wptr += bytes; - fromp += bytes; - size -= bytes; - if (cpr_wptr < cpr_buf_end) - return (0); /* buffer not full yet */ - ASSERT(cpr_wptr == cpr_buf_end); - - wbytes = dbtob(cpr_file_bn + cpr_buf_blocks); - if (vp->v_type == VBLK) { - if (wbytes > cpr_dev_space) - return (ENOSPC); - } else { - if (wbytes > VTOI(vp)->i_size) - return (ENOSPC); - } - - CPR_DEBUG(CPR_DEBUG3, - "cpr_write: frmp=%p wptr=%p cnt=%lx...", - (void *)fromp, (void *)cpr_wptr, bytes); - /* - * cross check, this should not happen! - */ - if (cpr_disk_writes_ok == 0) { - prom_printf("cpr_write: disk write too early!\n"); - return (EINVAL); - } - - do_polled_io = 1; - error = fop_dump(vp, cpr_buf, cpr_file_bn, cpr_buf_blocks, - NULL); - do_polled_io = 0; - CPR_DEBUG(CPR_DEBUG3, "done\n"); - - STAT->cs_real_statefsz += cpr_buf_size; - - if (error) { - cpr_err(CE_WARN, "cpr_write error %d", error); - return (error); - } - cpr_file_bn += cpr_buf_blocks; /* Increment block count */ - cpr_wptr = cpr_buf; /* back to top of buffer */ - } - return (0); -} - - -int -cpr_flush_write(vnode_t *vp) -{ - int nblk; - int error; - - /* - * Calculate remaining blocks in buffer, rounded up to nearest - * disk block - */ - nblk = btod(cpr_wptr - cpr_buf); - - do_polled_io = 1; - error = fop_dump(vp, (caddr_t)cpr_buf, cpr_file_bn, nblk, NULL); - do_polled_io = 0; - - cpr_file_bn += nblk; - if (error) - CPR_DEBUG(CPR_DEBUG2, "cpr_flush_write: error (%d)\n", - error); - return (error); -} - -void -cpr_clear_bitmaps(void) -{ - cbd_t *dp; - - for (dp = CPR->c_bmda; dp->cbd_size; dp++) { - bzero((void *)dp->cbd_reg_bitmap, - (size_t)dp->cbd_size * 2); - } - CPR_DEBUG(CPR_DEBUG7, "\ncleared reg and vlt bitmaps\n"); -} - -int -cpr_contig_pages(vnode_t *vp, int flag) -{ - int chunks = 0, error = 0; - pgcnt_t i, j, totbit; - pfn_t spfn; - cbd_t *dp; - uint_t spin_cnt = 0; - extern int i_cpr_compress_and_save(); - - for (dp = CPR->c_bmda; dp->cbd_size; dp++) { - spfn = dp->cbd_spfn; - totbit = BTOb(dp->cbd_size); - i = 0; /* Beginning of bitmap */ - j = 0; - while (i < totbit) { - while ((j < CPR_MAXCONTIG) && ((j + i) < totbit)) { - if (isset((char *)dp->cbd_reg_bitmap, j+i)) - j++; - else /* not contiguous anymore */ - break; - } - - if (j) { - chunks++; - if (flag == SAVE_TO_STORAGE) { - error = i_cpr_compress_and_save( - chunks, spfn + i, j); - if (error) - return (error); - } else if (flag == WRITE_TO_STATEFILE) { - error = cpr_compress_and_write(vp, 0, - spfn + i, j); - if (error) - return (error); - else { - spin_cnt++; - if ((spin_cnt & 0x5F) == 1) - cpr_spinning_bar(); - } - } - } - - i += j; - if (j != CPR_MAXCONTIG) { - /* Stopped on a non-tagged page */ - i++; - } - - j = 0; - } - } - - if (flag == STORAGE_DESC_ALLOC) - return (chunks); - else - return (0); -} - - -void -cpr_show_range(caddr_t vaddr, size_t size, - int mapflag, bitfunc_t bitfunc, pgcnt_t count) -{ - char *action, *bname; - - bname = (mapflag == REGULAR_BITMAP) ? "regular" : "volatile"; - if (bitfunc == cpr_setbit) - action = "tag"; - else if (bitfunc == cpr_clrbit) - action = "untag"; - else - action = "none"; - prom_printf("range (0x%p, 0x%p), %s bitmap, %s %ld\n", - (void *)vaddr, (void *)(vaddr + size), bname, action, count); -} - - -pgcnt_t -cpr_count_pages(caddr_t sva, size_t size, - int mapflag, bitfunc_t bitfunc, int showrange) -{ - caddr_t va, eva; - pfn_t pfn; - pgcnt_t count = 0; - - eva = sva + PAGE_ROUNDUP(size); - for (va = sva; va < eva; va += MMU_PAGESIZE) { - pfn = va_to_pfn(va); - if (pfn != PFN_INVALID && pf_is_memory(pfn)) { - if ((*bitfunc)(pfn, mapflag) == 0) - count++; - } - } - - if ((cpr_debug & CPR_DEBUG7) && showrange == DBG_SHOWRANGE) - cpr_show_range(sva, size, mapflag, bitfunc, count); - - return (count); -} - - -pgcnt_t -cpr_count_volatile_pages(int mapflag, bitfunc_t bitfunc) -{ - pgcnt_t count = 0; - - if (cpr_buf) { - count += cpr_count_pages(cpr_buf, cpr_buf_size, - mapflag, bitfunc, DBG_SHOWRANGE); - } - if (cpr_pagedata) { - count += cpr_count_pages(cpr_pagedata, cpr_pagedata_size, - mapflag, bitfunc, DBG_SHOWRANGE); - } - count += i_cpr_count_storage_pages(mapflag, bitfunc); - - CPR_DEBUG(CPR_DEBUG7, "cpr_count_vpages: %ld pages, 0x%lx bytes\n", - count, mmu_ptob(count)); - return (count); -} - - -static int -cpr_dump_regular_pages(vnode_t *vp) -{ - int error; - - cpr_regular_pgs_dumped = 0; - error = cpr_contig_pages(vp, WRITE_TO_STATEFILE); - if (!error) - CPR_DEBUG(CPR_DEBUG7, "cpr_dump_regular_pages() done.\n"); - return (error); -} -#endif +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Fill in and write out the cpr state file + * 1. Allocate and write headers, ELF and cpr dump header + * 2. Allocate bitmaps according to phys_install + * 3. Tag kernel pages into corresponding bitmap + * 4. Write bitmaps to state file + * 5. Write actual physical page data to state file + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Local defines and variables */ +#define BTOb(bytes) ((bytes) << 3) /* Bytes to bits, log2(NBBY) */ +#define bTOB(bits) ((bits) >> 3) /* bits to Bytes, log2(NBBY) */ + + +int cpr_flush_write(vnode_t *); + +int cpr_contig_pages(vnode_t *, int); + +void cpr_clear_bitmaps(); + +extern size_t cpr_get_devsize(dev_t); +extern int i_cpr_dump_setup(vnode_t *); +extern int i_cpr_blockzero(char *, char **, int *, vnode_t *); +extern int cpr_test_mode; +int cpr_setbit(pfn_t, int); +int cpr_clrbit(pfn_t, int); + +ctrm_t cpr_term; + +char *cpr_buf, *cpr_buf_end; +int cpr_buf_blocks; /* size of cpr_buf in blocks */ +size_t cpr_buf_size; /* size of cpr_buf in bytes */ +size_t cpr_bitmap_size; +int cpr_nbitmaps; + +char *cpr_pagedata; /* page buffer for compression / tmp copy */ +size_t cpr_pagedata_size; /* page buffer size in bytes */ + + +char cpr_pagecopy[CPR_MAXCONTIG * MMU_PAGESIZE]; + + + +/* + * creates the CPR state file, the following sections are + * written out in sequence: + * - writes the cpr dump header + * - writes the memory usage bitmaps + * - writes the platform dependent info + * - writes the remaining user pages + * - writes the kernel pages + */ +#if defined(__x86) + _NOTE(ARGSUSED(0)) +#endif +int +cpr_dump(vnode_t *vp) +{ + + return (0); +} + + diff --git a/kernel/cpr/cpr_main.c b/kernel/cpr/cpr_main.c index 593466b5d0..a971c60a6d 100644 --- a/kernel/cpr/cpr_main.c +++ b/kernel/cpr/cpr_main.c @@ -235,138 +235,6 @@ cpr_main(int sleeptype) } -#if defined(__sparc) - -/* - * check/disable or re-enable UFS logging - */ -static void -cpr_log_status(int enable, int *svstat, vnode_t *vp) -{ - int cmd, status, error; - char *str, *able; - fiolog_t fl; - refstr_t *mntpt; - - str = "cpr_log_status"; - bzero(&fl, sizeof (fl)); - fl.error = FIOLOG_ENONE; - - /* - * when disabling, first get and save logging status (0 or 1) - */ - if (enable == 0) { - if (error = fop_ioctl(vp, _FIOISLOG, - (uintptr_t)&status, FKIOCTL, CRED(), NULL, NULL)) { - mntpt = vfs_getmntpoint(vp->v_vfsp); - prom_printf("%s: \"%s\", cant get logging " - "status, error %d\n", str, refstr_value(mntpt), - error); - refstr_rele(mntpt); - return; - } - *svstat = status; - if (cpr_debug & CPR_DEBUG5) { - mntpt = vfs_getmntpoint(vp->v_vfsp); - errp("%s: \"%s\", logging status = %d\n", - str, refstr_value(mntpt), status); - refstr_rele(mntpt); - }; - - able = "disable"; - cmd = _FIOLOGDISABLE; - } else { - able = "enable"; - cmd = _FIOLOGENABLE; - } - - /* - * disable or re-enable logging when the saved status is 1 - */ - if (*svstat == 1) { - error = fop_ioctl(vp, cmd, (uintptr_t)&fl, - FKIOCTL, CRED(), NULL, NULL); - if (error) { - mntpt = vfs_getmntpoint(vp->v_vfsp); - prom_printf("%s: \"%s\", cant %s logging, error %d\n", - str, refstr_value(mntpt), able, error); - refstr_rele(mntpt); - } else { - if (cpr_debug & CPR_DEBUG5) { - mntpt = vfs_getmntpoint(vp->v_vfsp); - errp("%s: \"%s\", logging is now %sd\n", - str, refstr_value(mntpt), able); - refstr_rele(mntpt); - }; - } - } - - /* - * when enabling logging, reset the saved status - * to unknown for next time - */ - if (enable) - *svstat = -1; -} - -/* - * enable/disable UFS logging on filesystems containing cpr_default_path - * and cpr statefile. since the statefile can be on any fs, that fs - * needs to be handled separately. this routine and cprboot expect that - * CPR_CONFIG and CPR_DEFAULT both reside on the same fs, rootfs. cprboot - * is loaded from the device with rootfs and uses the same device to open - * both CPR_CONFIG and CPR_DEFAULT (see common/support.c). moving either - * file outside of rootfs would cause errors during cprboot, plus cpr and - * fsck problems with the new fs if logging were enabled. - */ - -static int -cpr_ufs_logging(int enable) -{ - static int def_status = -1, sf_status = -1; - struct vfs *vfsp; - char *fname; - vnode_t *vp; - int error; - - if (cpr_reusable_mode) - return (0); - - if (error = cpr_open_deffile(FREAD, &vp)) - return (error); - vfsp = vp->v_vfsp; - if (!cpr_is_ufs(vfsp)) { - (void) fop_close(vp, FREAD, 1, (offset_t)0, CRED(), NULL); - VN_RELE(vp); - return (0); - } - - cpr_log_status(enable, &def_status, vp); - (void) fop_close(vp, FREAD, 1, (offset_t)0, CRED(), NULL); - VN_RELE(vp); - - fname = cpr_build_statefile_path(); - if (fname == NULL) - return (ENOENT); - if (error = vn_open(fname, UIO_SYSSPACE, FCREAT|FWRITE, - 0600, &vp, CRCREAT, 0)) { - prom_printf("cpr_ufs_logging: cant open/create \"%s\", " - "error %d\n", fname, error); - return (error); - } - - /* - * check logging status for the statefile if it resides - * on a different fs and the type is a regular file - */ - if (vp->v_vfsp != vfsp && vp->v_type == VREG) - cpr_log_status(enable, &sf_status, vp); - (void) fop_close(vp, FWRITE, 1, (offset_t)0, CRED(), NULL); - VN_RELE(vp); - - return (0); -} -#endif /* @@ -440,9 +308,6 @@ cpr_suspend_cpus(void) static int cpr_suspend(int sleeptype) { -#if defined(__sparc) - int sf_realloc, nverr; -#endif int rc = 0; int skt_rc = 0; @@ -458,18 +323,6 @@ cpr_suspend(int sleeptype) i_cpr_alloc_cpus(); -#if defined(__sparc) - ASSERT(sleeptype == CPR_TODISK); - if (!cpr_reusable_mode) { - /* - * We need to validate default file before fs - * functionality is disabled. - */ - if (rc = cpr_validate_definfo(0)) - return (rc); - } - i_cpr_save_machdep_info(); -#endif PMD(PMD_SX, ("cpr_suspend: stop scans\n")) /* Stop PM scans ASAP */ @@ -478,12 +331,6 @@ cpr_suspend(int sleeptype) pm_dispatch_to_dep_thread(PM_DEP_WK_CPR_SUSPEND, NULL, NULL, PM_DEP_WAIT, NULL, 0); -#if defined(__sparc) - ASSERT(sleeptype == CPR_TODISK); - cpr_set_substate(C_ST_MP_OFFLINE); - if (rc = cpr_mp_offline()) - return (rc); -#endif /* * Ask Xorg to suspend the frame buffer, and wait for it to happen */ @@ -545,63 +392,6 @@ cpr_suspend(int sleeptype) if (!pm_reattach_noinvol()) return (ENXIO); -#if defined(__sparc) - ASSERT(sleeptype == CPR_TODISK); - /* - * if ufs logging is enabled, we need to disable before - * stopping kernel threads so that ufs delete and roll - * threads can do the work. - */ - cpr_set_substate(C_ST_DISABLE_UFS_LOGGING); - if (rc = cpr_ufs_logging(0)) - return (rc); - - /* - * Use sync_all to swap out all user pages and find out how much - * extra space needed for user pages that don't have back store - * space left. - */ - CPR_STAT_EVENT_START(" swapout upages"); - vfs_sync(SYNC_ALL); - CPR_STAT_EVENT_END(" swapout upages"); - - cpr_set_bitmap_size(); - -alloc_statefile: - /* - * If our last state was C_ST_DUMP_NOSPC, we're trying to - * realloc the statefile, otherwise this is the first attempt. - */ - sf_realloc = (CPR->c_substate == C_ST_DUMP_NOSPC) ? 1 : 0; - - CPR_STAT_EVENT_START(" alloc statefile"); - cpr_set_substate(C_ST_STATEF_ALLOC); - if (rc = cpr_alloc_statefile(sf_realloc)) { - if (sf_realloc) - errp("realloc failed\n"); - return (rc); - } - CPR_STAT_EVENT_END(" alloc statefile"); - - /* - * Sync the filesystem to preserve its integrity. - * - * This sync is also used to flush out all B_DELWRI buffers - * (fs cache) which are mapped and neither dirty nor referenced - * before cpr_invalidate_pages destroys them. - * fsflush does similar thing. - */ - sync(); - - /* - * destroy all clean file mapped kernel pages - */ - CPR_STAT_EVENT_START(" clean pages"); - CPR_DEBUG(CPR_DEBUG1, ("cleaning up mapped pages...")); - (void) callb_execute_class(CB_CL_CPR_VM, CB_CODE_CPR_CHKPT); - CPR_DEBUG(CPR_DEBUG1, ("done\n")); - CPR_STAT_EVENT_END(" clean pages"); -#endif /* @@ -697,14 +487,6 @@ alloc_statefile: PMD(PMD_SX, ("cpr_suspend: prom suspend prepost\n")) prom_suspend_prepost(); -#if defined(__sparc) - /* - * getting ready to write ourself out, flush the register - * windows to make sure that our stack is good when we - * come back on the resume side. - */ - flush_windows(); -#endif /* * For S3, we're done @@ -714,49 +496,6 @@ alloc_statefile: cpr_set_substate(C_ST_NODUMP); return (rc); } -#if defined(__sparc) - /* - * FATAL: NO MORE MEMORY ALLOCATION ALLOWED AFTER THIS POINT!!! - * - * The system is quiesced at this point, we are ready to either dump - * to the state file for a extended sleep or a simple shutdown for - * systems with non-volatile memory. - */ - - /* - * special handling for reusable: - */ - if (cpr_reusable_mode) { - cpr_set_substate(C_ST_SETPROPS_1); - if (nverr = cpr_set_properties(1)) - return (nverr); - } - - cpr_set_substate(C_ST_DUMP); - rc = cpr_dump(C_VP); - - /* - * if any error occurred during dump, more - * special handling for reusable: - */ - if (rc && cpr_reusable_mode) { - cpr_set_substate(C_ST_SETPROPS_0); - if (nverr = cpr_set_properties(0)) - return (nverr); - } - - if (rc == ENOSPC) { - cpr_set_substate(C_ST_DUMP_NOSPC); - (void) cpr_resume(sleeptype); - goto alloc_statefile; - } else if (rc == 0) { - if (cpr_reusable_mode) { - cpr_set_substate(C_ST_REUSABLE); - longjmp(&ttolwp(curthread)->lwp_qsav); - } else - rc = cpr_set_properties(1); - } -#endif PMD(PMD_SX, ("cpr_suspend: return %d\n", rc)) return (rc); } @@ -867,32 +606,6 @@ cpr_resume(int sleeptype) * and the one that caused the failure, if necessary." */ switch (CPR->c_substate) { -#if defined(__sparc) - case C_ST_DUMP: - /* - * This is most likely a full-fledged cpr_resume after - * a complete and successful cpr suspend. Just roll back - * everything. - */ - ASSERT(sleeptype == CPR_TODISK); - break; - - case C_ST_REUSABLE: - case C_ST_DUMP_NOSPC: - case C_ST_SETPROPS_0: - case C_ST_SETPROPS_1: - /* - * C_ST_REUSABLE and C_ST_DUMP_NOSPC are the only two - * special switch cases here. The other two do not have - * any state change during cpr_suspend() that needs to - * be rolled back. But these are exit points from - * cpr_suspend, so theoretically (or in the future), it - * is possible that a need for roll back of a state - * change arises between these exit points. - */ - ASSERT(sleeptype == CPR_TODISK); - goto rb_dump; -#endif case C_ST_NODUMP: PMD(PMD_SX, ("cpr_resume: NODUMP\n")) @@ -906,15 +619,6 @@ cpr_resume(int sleeptype) PMD(PMD_SX, ("cpr_resume: SUSPEND_DEVICES\n")) goto rb_suspend_devices; -#if defined(__sparc) - case C_ST_STATEF_ALLOC: - ASSERT(sleeptype == CPR_TODISK); - goto rb_statef_alloc; - - case C_ST_DISABLE_UFS_LOGGING: - ASSERT(sleeptype == CPR_TODISK); - goto rb_disable_ufs_logging; -#endif case C_ST_PM_REATTACH_NOINVOL: PMD(PMD_SX, ("cpr_resume: REATTACH_NOINVOL\n")) @@ -924,11 +628,6 @@ cpr_resume(int sleeptype) PMD(PMD_SX, ("cpr_resume: STOP_USER_THREADS\n")) goto rb_stop_user_threads; -#if defined(__sparc) - case C_ST_MP_OFFLINE: - PMD(PMD_SX, ("cpr_resume: MP_OFFLINE\n")) - goto rb_mp_offline; -#endif #if defined(__x86) case C_ST_MP_PAUSED: @@ -970,7 +669,6 @@ rb_nodump: } prom_resume_prepost(); -#if !defined(__sparc) /* * Need to sync the software clock with the hardware clock. * On Sparc, this occurs in the sparc-specific cbe. However @@ -980,12 +678,7 @@ rb_nodump: if (tsc_resume_in_cyclic == 0) tsc_resume(); -#endif -#if defined(__sparc) - if (cpr_suspend_succeeded && (boothowto & RB_DEBUG)) - kdi_dvec_cpr_restart(); -#endif #if defined(__x86) @@ -1147,27 +840,6 @@ rb_suspend_devices: PMD(PMD_SX, ("cpr_resume: lock mgr\n")) cpr_lock_mgr(lm_cprresume); -#if defined(__sparc) - /* - * This is a partial (half) resume during cpr suspend, we - * haven't yet given up on the suspend. On return from here, - * cpr_suspend() will try to reallocate and retry the suspend. - */ - if (CPR->c_substate == C_ST_DUMP_NOSPC) { - return (0); - } - - if (sleeptype == CPR_TODISK) { -rb_statef_alloc: - cpr_statef_close(); - -rb_disable_ufs_logging: - /* - * if ufs logging was disabled, re-enable - */ - (void) cpr_ufs_logging(1); - } -#endif rb_pm_reattach_noinvol: /* @@ -1213,11 +885,6 @@ rb_stop_user_threads: } mutex_exit(&srn_clone_lock); -#if defined(__sparc) -rb_mp_offline: - if (cpr_mp_online()) - cpr_err(CE_WARN, "Failed to online all the processors."); -#endif rb_others: PMD(PMD_SX, ("cpr_resume: dep thread\n")) @@ -1231,10 +898,6 @@ rb_others: cpr_stat_record_events(); } -#if defined(__sparc) - if (sleeptype == CPR_TODISK && !cpr_reusable_mode) - cpr_clear_definfo(); -#endif i_cpr_free_cpus(); CPR_DEBUG(CPR_DEBUG1, "Sending SIGTHAW..."); @@ -1310,11 +973,6 @@ cpr_all_online(void) { int rc = 0; -#ifdef __sparc - /* - * do nothing - */ -#else cpu_t *cp; @@ -1338,7 +996,6 @@ cpr_all_online(void) */ cpr_restore_offline(); } -#endif return (rc); } @@ -1349,11 +1006,6 @@ static void cpr_restore_offline(void) { -#ifdef __sparc - /* - * do nothing - */ -#else cpu_t *cp; int rc = 0; @@ -1374,6 +1026,5 @@ cpr_restore_offline(void) } } while ((cp = cp->cpu_next) != cpu_list); -#endif } diff --git a/kernel/cpr/cpr_misc.c b/kernel/cpr/cpr_misc.c dissimilarity index 85% index bc7a415f90..d4d1f789b6 100644 --- a/kernel/cpr/cpr_misc.c +++ b/kernel/cpr/cpr_misc.c @@ -1,1150 +1,187 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - * Copyright 2015 Nexenta Systems, Inc. All rights reserved. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* for swapfs_minfree */ -#include -#include -#include -#include - -/* - * CPR miscellaneous support routines - */ -#define cpr_open(path, mode, vpp) (vn_open(path, UIO_SYSSPACE, \ - mode, 0600, vpp, CRCREAT, 0)) -#define cpr_rdwr(rw, vp, basep, cnt) (vn_rdwr(rw, vp, (caddr_t)(basep), \ - cnt, 0LL, UIO_SYSSPACE, 0, (rlim64_t)MAXOFF_T, CRED(), \ - NULL)) - -extern void clkset(time_t); -extern cpu_t *i_cpr_bootcpu(void); -extern caddr_t i_cpr_map_setup(void); -extern void i_cpr_free_memory_resources(void); - -extern kmutex_t cpr_slock; -extern size_t cpr_buf_size; -extern char *cpr_buf; -extern size_t cpr_pagedata_size; -extern char *cpr_pagedata; -extern int cpr_bufs_allocated; -extern int cpr_bitmaps_allocated; - -#if defined(__sparc) -static struct cprconfig cprconfig; -static int cprconfig_loaded = 0; -static int cpr_statefile_ok(vnode_t *, int); -static int cpr_p_online(cpu_t *, int); -static void cpr_save_mp_state(void); -#endif - -int cpr_is_ufs(struct vfs *); -int cpr_is_zfs(struct vfs *); - -char cpr_default_path[] = CPR_DEFAULT; - -#define COMPRESS_PERCENT 40 /* approx compression ratio in percent */ -#define SIZE_RATE 115 /* increase size by 15% */ -#define INTEGRAL 100 /* for integer math */ - - -/* - * cmn_err() followed by a 1/4 second delay; this gives the - * logging service a chance to flush messages and helps avoid - * intermixing output from prom_printf(). - */ -/*PRINTFLIKE2*/ -void -cpr_err(int ce, const char *fmt, ...) -{ - va_list adx; - - va_start(adx, fmt); - vcmn_err(ce, fmt, adx); - va_end(adx); - drv_usecwait(MICROSEC >> 2); -} - - -int -cpr_init(int fcn) -{ - /* - * Allow only one suspend/resume process. - */ - if (mutex_tryenter(&cpr_slock) == 0) - return (EBUSY); - - CPR->c_flags = 0; - CPR->c_substate = 0; - CPR->c_cprboot_magic = 0; - CPR->c_alloc_cnt = 0; - - CPR->c_fcn = fcn; - if (fcn == AD_CPR_REUSABLE) - CPR->c_flags |= C_REUSABLE; - else - CPR->c_flags |= C_SUSPENDING; - if (fcn == AD_SUSPEND_TO_RAM || fcn == DEV_SUSPEND_TO_RAM) { - return (0); - } -#if defined(__sparc) - if (fcn != AD_CPR_NOCOMPRESS && fcn != AD_CPR_TESTNOZ) - CPR->c_flags |= C_COMPRESSING; - /* - * reserve CPR_MAXCONTIG virtual pages for cpr_dump() - */ - CPR->c_mapping_area = i_cpr_map_setup(); - if (CPR->c_mapping_area == 0) { /* no space in kernelmap */ - cpr_err(CE_CONT, "Unable to alloc from kernelmap.\n"); - mutex_exit(&cpr_slock); - return (EAGAIN); - } - if (cpr_debug & CPR_DEBUG3) - cpr_err(CE_CONT, "Reserved virtual range from 0x%p for writing " - "kas\n", (void *)CPR->c_mapping_area); -#endif - - return (0); -} - -/* - * This routine releases any resources used during the checkpoint. - */ -void -cpr_done(void) -{ - cpr_stat_cleanup(); - i_cpr_bitmap_cleanup(); - - /* - * Free pages used by cpr buffers. - */ - if (cpr_buf) { - kmem_free(cpr_buf, cpr_buf_size); - cpr_buf = NULL; - } - if (cpr_pagedata) { - kmem_free(cpr_pagedata, cpr_pagedata_size); - cpr_pagedata = NULL; - } - - i_cpr_free_memory_resources(); - mutex_exit(&cpr_slock); - cpr_err(CE_CONT, "System has been resumed.\n"); -} - - -#if defined(__sparc) -/* - * reads config data into cprconfig - */ -static int -cpr_get_config(void) -{ - static char config_path[] = CPR_CONFIG; - struct cprconfig *cf = &cprconfig; - struct vnode *vp; - char *fmt; - int err; - - if (cprconfig_loaded) - return (0); - - fmt = "cannot %s config file \"%s\", error %d\n"; - if (err = vn_open(config_path, UIO_SYSSPACE, FREAD, 0, &vp, 0, 0)) { - cpr_err(CE_CONT, fmt, "open", config_path, err); - return (err); - } - - err = cpr_rdwr(UIO_READ, vp, cf, sizeof (*cf)); - (void) fop_close(vp, FREAD, 1, (offset_t)0, CRED(), NULL); - VN_RELE(vp); - if (err) { - cpr_err(CE_CONT, fmt, "read", config_path, err); - return (err); - } - - if (cf->cf_magic == CPR_CONFIG_MAGIC) - cprconfig_loaded = 1; - else { - cpr_err(CE_CONT, "invalid config file \"%s\", " - "rerun pmconfig(1M)\n", config_path); - err = EINVAL; - } - - return (err); -} - - -/* - * concat fs and path fields of the cprconfig structure; - * returns pointer to the base of static data - */ -static char * -cpr_cprconfig_to_path(void) -{ - static char full_path[MAXNAMELEN]; - struct cprconfig *cf = &cprconfig; - char *ptr; - - /* - * build /fs/path without extra '/' - */ - (void) strcpy(full_path, cf->cf_fs); - if (strcmp(cf->cf_fs, "/")) - (void) strcat(full_path, "/"); - ptr = cf->cf_path; - if (*ptr == '/') - ptr++; - (void) strcat(full_path, ptr); - return (full_path); -} - - -/* - * Verify that the information in the configuration file regarding the - * location for the statefile is still valid, depending on cf_type. - * for CFT_UFS, cf_fs must still be a mounted filesystem, it must be - * mounted on the same device as when pmconfig was last run, - * and the translation of that device to a node in the prom's - * device tree must be the same as when pmconfig was last run. - * for CFT_SPEC and CFT_ZVOL, cf_path must be the path to a block - * special file, it must have no file system mounted on it, - * and the translation of that device to a node in the prom's - * device tree must be the same as when pmconfig was last run. - */ -static int -cpr_verify_statefile_path(void) -{ - struct cprconfig *cf = &cprconfig; - static const char long_name[] = "Statefile pathname is too long.\n"; - static const char lookup_fmt[] = "Lookup failed for " - "cpr statefile device %s.\n"; - static const char path_chg_fmt[] = "Device path for statefile " - "has changed from %s to %s.\t%s\n"; - static const char rerun[] = "Please rerun pmconfig(1m)."; - struct vfs *vfsp = NULL, *vfsp_save = rootvfs; - ufsvfs_t *ufsvfsp = (ufsvfs_t *)rootvfs->vfs_data; - ufsvfs_t *ufsvfsp_save = ufsvfsp; - int error; - struct vnode *vp; - char *slash, *tail, *longest; - char *errstr; - int found = 0; - union { - char un_devpath[OBP_MAXPATHLEN]; - char un_sfpath[MAXNAMELEN]; - } un; -#define devpath un.un_devpath -#define sfpath un.un_sfpath - - ASSERT(cprconfig_loaded); - /* - * We need not worry about locking or the timing of releasing - * the vnode, since we are single-threaded now. - */ - - switch (cf->cf_type) { - case CFT_SPEC: - error = i_devname_to_promname(cf->cf_devfs, devpath, - OBP_MAXPATHLEN); - if (error || strcmp(devpath, cf->cf_dev_prom)) { - cpr_err(CE_CONT, path_chg_fmt, - cf->cf_dev_prom, devpath, rerun); - return (error); - } - /*FALLTHROUGH*/ - case CFT_ZVOL: - if (strlen(cf->cf_path) > sizeof (sfpath)) { - cpr_err(CE_CONT, long_name); - return (ENAMETOOLONG); - } - if ((error = lookupname(cf->cf_devfs, - UIO_SYSSPACE, FOLLOW, NULLVPP, &vp)) != 0) { - cpr_err(CE_CONT, lookup_fmt, cf->cf_devfs); - return (error); - } - if (vp->v_type != VBLK) - errstr = "statefile must be a block device"; - else if (vfs_devismounted(vp->v_rdev)) - errstr = "statefile device must not " - "have a file system mounted on it"; - else if (IS_SWAPVP(vp)) - errstr = "statefile device must not " - "be configured as swap file"; - else - errstr = NULL; - - VN_RELE(vp); - if (errstr) { - cpr_err(CE_CONT, "%s.\n", errstr); - return (ENOTSUP); - } - - return (error); - case CFT_UFS: - break; /* don't indent all the original code */ - default: - cpr_err(CE_PANIC, "invalid cf_type"); - } - - /* - * The original code for UFS statefile - */ - if (strlen(cf->cf_fs) + strlen(cf->cf_path) + 2 > sizeof (sfpath)) { - cpr_err(CE_CONT, long_name); - return (ENAMETOOLONG); - } - - bzero(sfpath, sizeof (sfpath)); - (void) strcpy(sfpath, cpr_cprconfig_to_path()); - - if (*sfpath != '/') { - cpr_err(CE_CONT, "Statefile pathname %s " - "must begin with a /\n", sfpath); - return (EINVAL); - } - - /* - * Find the longest prefix of the statefile pathname which - * is the mountpoint of a filesystem. This string must - * match the cf_fs field we read from the config file. Other- - * wise the user has changed things without running pmconfig. - */ - tail = longest = sfpath + 1; /* pt beyond the leading "/" */ - while ((slash = strchr(tail, '/')) != NULL) { - *slash = '\0'; /* temporarily terminate the string */ - if ((error = lookupname(sfpath, - UIO_SYSSPACE, FOLLOW, NULLVPP, &vp)) != 0) { - *slash = '/'; - cpr_err(CE_CONT, "A directory in the " - "statefile path %s was not found.\n", sfpath); - VN_RELE(vp); - - return (error); - } - - vfs_list_read_lock(); - vfsp = rootvfs; - do { - ufsvfsp = (struct ufsvfs *)vfsp->vfs_data; - if (ufsvfsp != NULL && ufsvfsp->vfs_root == vp) { - found = 1; - break; - } - vfsp = vfsp->vfs_next; - } while (vfsp != rootvfs); - vfs_list_unlock(); - - /* - * If we have found a filesystem mounted on the current - * path prefix, remember the end of the string in - * "longest". If it happens to be the the exact fs - * saved in the configuration file, save the current - * ufsvfsp so we can make additional checks further down. - */ - if (found) { - longest = slash; - if (strcmp(cf->cf_fs, sfpath) == 0) { - ufsvfsp_save = ufsvfsp; - vfsp_save = vfsp; - } - found = 0; - } - - VN_RELE(vp); - *slash = '/'; - tail = slash + 1; - } - *longest = '\0'; - if (cpr_is_ufs(vfsp_save) == 0 || strcmp(cf->cf_fs, sfpath)) { - cpr_err(CE_CONT, "Filesystem containing " - "the statefile when pmconfig was run (%s) has " - "changed to %s. %s\n", cf->cf_fs, sfpath, rerun); - return (EINVAL); - } - - if ((error = lookupname(cf->cf_devfs, - UIO_SYSSPACE, FOLLOW, NULLVPP, &vp)) != 0) { - cpr_err(CE_CONT, lookup_fmt, cf->cf_devfs); - return (error); - } - - if (ufsvfsp_save->vfs_devvp->v_rdev != vp->v_rdev) { - cpr_err(CE_CONT, "Filesystem containing " - "statefile no longer mounted on device %s. " - "See power.conf(4).", cf->cf_devfs); - VN_RELE(vp); - return (ENXIO); - } - VN_RELE(vp); - - error = i_devname_to_promname(cf->cf_devfs, devpath, OBP_MAXPATHLEN); - if (error || strcmp(devpath, cf->cf_dev_prom)) { - cpr_err(CE_CONT, path_chg_fmt, - cf->cf_dev_prom, devpath, rerun); - return (error); - } - - return (0); -} - -/* - * Make sure that the statefile can be used as a block special statefile - * (meaning that is exists and has nothing mounted on it) - * Returns errno if not a valid statefile. - */ -int -cpr_check_spec_statefile(void) -{ - int err; - - if (err = cpr_get_config()) - return (err); - ASSERT(cprconfig.cf_type == CFT_SPEC || - cprconfig.cf_type == CFT_ZVOL); - - if (cprconfig.cf_devfs == NULL) - return (ENXIO); - - return (cpr_verify_statefile_path()); - -} - -int -cpr_alloc_statefile(int alloc_retry) -{ - register int rc = 0; - char *str; - - /* - * Statefile size validation. If checkpoint the first time, disk blocks - * allocation will be done; otherwise, just do file size check. - * if statefile allocation is being retried, C_VP will be inited - */ - if (alloc_retry) { - str = "\n-->Retrying statefile allocation..."; - if (cpr_debug & (CPR_DEBUG1 | CPR_DEBUG7)) - prom_printf(str); - if (C_VP->v_type != VBLK) - (void) fop_dumpctl(C_VP, DUMP_FREE, NULL, NULL); - } else { - /* - * Open an exiting file for writing, the state file needs to be - * pre-allocated since we can't and don't want to do allocation - * during checkpoint (too much of the OS is disabled). - * - do a preliminary size checking here, if it is too small, - * allocate more space internally and retry. - * - check the vp to make sure it's the right type. - */ - char *path = cpr_build_statefile_path(); - - if (path == NULL) - return (ENXIO); - else if (rc = cpr_verify_statefile_path()) - return (rc); - - if (rc = vn_open(path, UIO_SYSSPACE, - FCREAT|FWRITE, 0600, &C_VP, CRCREAT, 0)) { - cpr_err(CE_WARN, "cannot open statefile %s", path); - return (rc); - } - } - - /* - * Only ufs and block special statefiles supported - */ - if (C_VP->v_type != VREG && C_VP->v_type != VBLK) { - cpr_err(CE_CONT, - "Statefile must be regular file or block special file."); - return (EACCES); - } - - if (rc = cpr_statefile_ok(C_VP, alloc_retry)) - return (rc); - - if (C_VP->v_type != VBLK) { - /* - * sync out the fs change due to the statefile reservation. - */ - (void) VFS_SYNC(C_VP->v_vfsp, 0, CRED()); - - /* - * Validate disk blocks allocation for the state file. - * Ask the file system prepare itself for the dump operation. - */ - if (rc = fop_dumpctl(C_VP, DUMP_ALLOC, NULL, NULL)) { - cpr_err(CE_CONT, "Error allocating " - "blocks for cpr statefile."); - return (rc); - } - } - return (0); -} - - -/* - * Lookup device size and return available space in bytes. - * NOTE: Since prop_op(9E) can't tell the difference between a character - * and a block reference, it is ok to ask for "Size" instead of "Nblocks". - */ -size_t -cpr_get_devsize(dev_t dev) -{ - size_t bytes = 0; - - bytes = cdev_Size(dev); - if (bytes == 0) - bytes = cdev_size(dev); - - if (bytes > CPR_SPEC_OFFSET) - bytes -= CPR_SPEC_OFFSET; - else - bytes = 0; - - return (bytes); -} - - -/* - * increase statefile size - */ -static int -cpr_grow_statefile(vnode_t *vp, u_longlong_t newsize) -{ - extern uchar_t cpr_pagecopy[]; - struct inode *ip = VTOI(vp); - u_longlong_t offset; - int error, increase; - ssize_t resid; - - rw_enter(&ip->i_contents, RW_READER); - increase = (ip->i_size < newsize); - offset = ip->i_size; - rw_exit(&ip->i_contents); - - if (increase == 0) - return (0); - - /* - * write to each logical block to reserve disk space - */ - error = 0; - cpr_pagecopy[0] = '1'; - for (; offset < newsize; offset += ip->i_fs->fs_bsize) { - if (error = vn_rdwr(UIO_WRITE, vp, (caddr_t)cpr_pagecopy, - ip->i_fs->fs_bsize, (offset_t)offset, UIO_SYSSPACE, 0, - (rlim64_t)MAXOFF_T, CRED(), &resid)) { - if (error == ENOSPC) { - cpr_err(CE_WARN, "error %d while reserving " - "disk space for statefile %s\n" - "wanted %lld bytes, file is %lld short", - error, cpr_cprconfig_to_path(), - newsize, newsize - offset); - } - break; - } - } - return (error); -} - - -/* - * do a simple estimate of the space needed to hold the statefile - * taking compression into account, but be fairly conservative - * so we have a better chance of completing; when dump fails, - * the retry cost is fairly high. - * - * Do disk blocks allocation for the state file if no space has - * been allocated yet. Since the state file will not be removed, - * allocation should only be done once. - */ -static int -cpr_statefile_ok(vnode_t *vp, int alloc_retry) -{ - extern size_t cpr_bitmap_size; - struct inode *ip = VTOI(vp); - const int UCOMP_RATE = 20; /* comp. ratio*10 for user pages */ - u_longlong_t size, isize, ksize, raw_data; - char *str, *est_fmt; - size_t space; - int error; - - /* - * number of pages short for swapping. - */ - STAT->cs_nosw_pages = k_anoninfo.ani_mem_resv; - if (STAT->cs_nosw_pages < 0) - STAT->cs_nosw_pages = 0; - - str = "cpr_statefile_ok:"; - - CPR_DEBUG(CPR_DEBUG9, "Phys swap: max=%lu resv=%lu\n", - k_anoninfo.ani_max, k_anoninfo.ani_phys_resv); - CPR_DEBUG(CPR_DEBUG9, "Mem swap: max=%ld resv=%lu\n", - MAX(availrmem - swapfs_minfree, 0), - k_anoninfo.ani_mem_resv); - CPR_DEBUG(CPR_DEBUG9, "Total available swap: %ld\n", - CURRENT_TOTAL_AVAILABLE_SWAP); - - /* - * try increasing filesize by 15% - */ - if (alloc_retry) { - /* - * block device doesn't get any bigger - */ - if (vp->v_type == VBLK) { - if (cpr_debug & (CPR_DEBUG1 | CPR_DEBUG6)) - prom_printf( - "Retry statefile on special file\n"); - return (ENOMEM); - } else { - rw_enter(&ip->i_contents, RW_READER); - size = (ip->i_size * SIZE_RATE) / INTEGRAL; - rw_exit(&ip->i_contents); - } - if (cpr_debug & (CPR_DEBUG1 | CPR_DEBUG6)) - prom_printf("Retry statefile size = %lld\n", size); - } else { - u_longlong_t cpd_size; - pgcnt_t npages, nback; - int ndvram; - - ndvram = 0; - (void) callb_execute_class(CB_CL_CPR_FB, - (int)(uintptr_t)&ndvram); - if (cpr_debug & (CPR_DEBUG1 | CPR_DEBUG6)) - prom_printf("ndvram size = %d\n", ndvram); - - /* - * estimate 1 cpd_t for every (CPR_MAXCONTIG / 2) pages - */ - npages = cpr_count_kpages(REGULAR_BITMAP, cpr_nobit); - cpd_size = sizeof (cpd_t) * (npages / (CPR_MAXCONTIG / 2)); - raw_data = cpd_size + cpr_bitmap_size; - ksize = ndvram + mmu_ptob(npages); - - est_fmt = "%s estimated size with " - "%scompression %lld, ksize %lld\n"; - nback = mmu_ptob(STAT->cs_nosw_pages); - if (CPR->c_flags & C_COMPRESSING) { - size = ((ksize * COMPRESS_PERCENT) / INTEGRAL) + - raw_data + ((nback * 10) / UCOMP_RATE); - CPR_DEBUG(CPR_DEBUG1, est_fmt, str, "", size, ksize); - } else { - size = ksize + raw_data + nback; - CPR_DEBUG(CPR_DEBUG1, est_fmt, str, "no ", - size, ksize); - } - } - - /* - * All this is much simpler for a block device - */ - if (vp->v_type == VBLK) { - space = cpr_get_devsize(vp->v_rdev); - if (cpr_debug & (CPR_DEBUG1 | CPR_DEBUG6)) - prom_printf("statefile dev size %lu\n", space); - - /* - * Export the estimated filesize info, this value will be - * compared before dumping out the statefile in the case of - * no compression. - */ - STAT->cs_est_statefsz = size; - if (cpr_debug & (CPR_DEBUG1 | CPR_DEBUG6)) - prom_printf("%s Estimated statefile size %llu, " - "space %lu\n", str, size, space); - if (size > space) { - cpr_err(CE_CONT, "Statefile partition too small."); - return (ENOMEM); - } - return (0); - } else { - if (CPR->c_alloc_cnt++ > C_MAX_ALLOC_RETRY) { - cpr_err(CE_CONT, "Statefile allocation retry failed\n"); - return (ENOMEM); - } - - /* - * Estimate space needed for the state file. - * - * State file size in bytes: - * kernel size + non-cache pte seg + - * bitmap size + cpr state file headers size - * (round up to fs->fs_bsize) - */ - size = blkroundup(ip->i_fs, size); - - /* - * Export the estimated filesize info, this value will be - * compared before dumping out the statefile in the case of - * no compression. - */ - STAT->cs_est_statefsz = size; - error = cpr_grow_statefile(vp, size); - if (cpr_debug & (CPR_DEBUG1 | CPR_DEBUG6)) { - rw_enter(&ip->i_contents, RW_READER); - isize = ip->i_size; - rw_exit(&ip->i_contents); - prom_printf("%s Estimated statefile size %lld, " - "i_size %lld\n", str, size, isize); - } - - return (error); - } -} - - -void -cpr_statef_close(void) -{ - if (C_VP) { - if (!cpr_reusable_mode) - (void) fop_dumpctl(C_VP, DUMP_FREE, NULL, NULL); - (void) fop_close(C_VP, FWRITE, 1, (offset_t)0, CRED(), NULL); - VN_RELE(C_VP); - C_VP = 0; - } -} - - -/* - * open cpr default file and display error - */ -int -cpr_open_deffile(int mode, vnode_t **vpp) -{ - int error; - - if (error = cpr_open(cpr_default_path, mode, vpp)) - cpr_err(CE_CONT, "cannot open \"%s\", error %d\n", - cpr_default_path, error); - return (error); -} - - -/* - * write cdef_t to disk. This contains the original values of prom - * properties that we modify. We fill in the magic number of the file - * here as a signal to the booter code that the state file is valid. - * Be sure the file gets synced, since we may be shutting down the OS. - */ -int -cpr_write_deffile(cdef_t *cdef) -{ - struct vnode *vp; - char *str; - int rc; - - if (rc = cpr_open_deffile(FCREAT|FWRITE, &vp)) - return (rc); - - if (rc = cpr_rdwr(UIO_WRITE, vp, cdef, sizeof (*cdef))) - str = "write"; - else if (rc = fop_fsync(vp, FSYNC, CRED(), NULL)) - str = "fsync"; - (void) fop_close(vp, FWRITE, 1, (offset_t)0, CRED(), NULL); - VN_RELE(vp); - - if (rc) { - cpr_err(CE_WARN, "%s error %d, file \"%s\"", - str, rc, cpr_default_path); - } - return (rc); -} - -/* - * Clear the magic number in the defaults file. This tells the booter - * program that the state file is not current and thus prevents - * any attempt to restore from an obsolete state file. - */ -void -cpr_clear_definfo(void) -{ - struct vnode *vp; - cmini_t mini; - - if ((CPR->c_cprboot_magic != CPR_DEFAULT_MAGIC) || - cpr_open_deffile(FCREAT|FWRITE, &vp)) - return; - mini.magic = mini.reusable = 0; - (void) cpr_rdwr(UIO_WRITE, vp, &mini, sizeof (mini)); - (void) fop_close(vp, FWRITE, 1, (offset_t)0, CRED(), NULL); - VN_RELE(vp); -} - -/* - * If the cpr default file is invalid, then we must not be in reusable mode - * if it is valid, it tells us our mode - */ -int -cpr_get_reusable_mode(void) -{ - struct vnode *vp; - cmini_t mini; - int rc; - - if (cpr_open(cpr_default_path, FREAD, &vp)) - return (0); - - rc = cpr_rdwr(UIO_READ, vp, &mini, sizeof (mini)); - (void) fop_close(vp, FREAD, 1, (offset_t)0, CRED(), NULL); - VN_RELE(vp); - if (rc == 0 && mini.magic == CPR_DEFAULT_MAGIC) - return (mini.reusable); - - return (0); -} -#endif - -/* - * clock/time related routines - */ -static time_t cpr_time_stamp; - - -void -cpr_tod_get(cpr_time_t *ctp) -{ - timestruc_t ts; - - mutex_enter(&tod_lock); - ts = TODOP_GET(tod_ops); - mutex_exit(&tod_lock); - ctp->tv_sec = (time32_t)ts.tv_sec; - ctp->tv_nsec = (int32_t)ts.tv_nsec; -} - -void -cpr_tod_status_set(int tod_flag) -{ - mutex_enter(&tod_lock); - tod_status_set(tod_flag); - mutex_exit(&tod_lock); -} - -void -cpr_save_time(void) -{ - cpr_time_stamp = gethrestime_sec(); -} - -/* - * correct time based on saved time stamp or hardware clock - */ -void -cpr_restore_time(void) -{ - clkset(cpr_time_stamp); -} - -#if defined(__sparc) -/* - * CPU ONLINE/OFFLINE CODE - */ -int -cpr_mp_offline(void) -{ - cpu_t *cp, *bootcpu; - int rc = 0; - int brought_up_boot = 0; - - /* - * Do nothing for UP. - */ - if (ncpus == 1) - return (0); - - mutex_enter(&cpu_lock); - - cpr_save_mp_state(); - - bootcpu = i_cpr_bootcpu(); - if (!CPU_ACTIVE(bootcpu)) { - if ((rc = cpr_p_online(bootcpu, CPU_CPR_ONLINE))) { - mutex_exit(&cpu_lock); - return (rc); - } - brought_up_boot = 1; - } - - cp = cpu_list; - do { - if (cp == bootcpu) - continue; - if (cp->cpu_flags & CPU_OFFLINE) - continue; - if ((rc = cpr_p_online(cp, CPU_CPR_OFFLINE))) { - mutex_exit(&cpu_lock); - return (rc); - } - } while ((cp = cp->cpu_next) != cpu_list); - if (brought_up_boot && (cpr_debug & (CPR_DEBUG1 | CPR_DEBUG6))) - prom_printf("changed cpu %p to state %d\n", - (void *)bootcpu, CPU_CPR_ONLINE); - mutex_exit(&cpu_lock); - - return (rc); -} - -int -cpr_mp_online(void) -{ - cpu_t *cp, *bootcpu = CPU; - int rc = 0; - - /* - * Do nothing for UP. - */ - if (ncpus == 1) - return (0); - - /* - * cpr_save_mp_state() sets CPU_CPR_ONLINE in cpu_cpr_flags - * to indicate a cpu was online at the time of cpr_suspend(); - * now restart those cpus that were marked as CPU_CPR_ONLINE - * and actually are offline. - */ - mutex_enter(&cpu_lock); - for (cp = bootcpu->cpu_next; cp != bootcpu; cp = cp->cpu_next) { - /* - * Clear the CPU_FROZEN flag in all cases. - */ - cp->cpu_flags &= ~CPU_FROZEN; - - if (CPU_CPR_IS_OFFLINE(cp)) - continue; - if (CPU_ACTIVE(cp)) - continue; - if ((rc = cpr_p_online(cp, CPU_CPR_ONLINE))) { - mutex_exit(&cpu_lock); - return (rc); - } - } - - /* - * turn off the boot cpu if it was offlined - */ - if (CPU_CPR_IS_OFFLINE(bootcpu)) { - if ((rc = cpr_p_online(bootcpu, CPU_CPR_OFFLINE))) { - mutex_exit(&cpu_lock); - return (rc); - } - } - mutex_exit(&cpu_lock); - return (0); -} - -static void -cpr_save_mp_state(void) -{ - cpu_t *cp; - - ASSERT(MUTEX_HELD(&cpu_lock)); - - cp = cpu_list; - do { - cp->cpu_cpr_flags &= ~CPU_CPR_ONLINE; - if (CPU_ACTIVE(cp)) - CPU_SET_CPR_FLAGS(cp, CPU_CPR_ONLINE); - } while ((cp = cp->cpu_next) != cpu_list); -} - -/* - * change cpu to online/offline - */ -static int -cpr_p_online(cpu_t *cp, int state) -{ - int rc; - - ASSERT(MUTEX_HELD(&cpu_lock)); - - switch (state) { - case CPU_CPR_ONLINE: - rc = cpu_online(cp); - break; - case CPU_CPR_OFFLINE: - rc = cpu_offline(cp, CPU_FORCED); - break; - } - if (rc) { - cpr_err(CE_WARN, "Failed to change processor %d to " - "state %d, (errno %d)", cp->cpu_id, state, rc); - } - return (rc); -} - -/* - * Construct the pathname of the state file and return a pointer to - * caller. Read the config file to get the mount point of the - * filesystem and the pathname within fs. - */ -char * -cpr_build_statefile_path(void) -{ - struct cprconfig *cf = &cprconfig; - - if (cpr_get_config()) - return (NULL); - - switch (cf->cf_type) { - case CFT_UFS: - if (strlen(cf->cf_path) + strlen(cf->cf_fs) >= MAXNAMELEN - 1) { - cpr_err(CE_CONT, "Statefile path is too long.\n"); - return (NULL); - } - return (cpr_cprconfig_to_path()); - case CFT_ZVOL: - /*FALLTHROUGH*/ - case CFT_SPEC: - return (cf->cf_devfs); - default: - cpr_err(CE_PANIC, "invalid statefile type"); - /*NOTREACHED*/ - return (NULL); - } -} - -int -cpr_statefile_is_spec(void) -{ - if (cpr_get_config()) - return (0); - return (cprconfig.cf_type == CFT_SPEC); -} - -char * -cpr_get_statefile_prom_path(void) -{ - struct cprconfig *cf = &cprconfig; - - ASSERT(cprconfig_loaded); - ASSERT(cf->cf_magic == CPR_CONFIG_MAGIC); - ASSERT(cf->cf_type == CFT_SPEC || cf->cf_type == CFT_ZVOL); - return (cf->cf_dev_prom); -} - - -/* - * XXX The following routines need to be in the vfs source code. - */ - -int -cpr_is_ufs(struct vfs *vfsp) -{ - char *fsname; - - fsname = vfssw[vfsp->vfs_fstype].vsw_name; - return (strcmp(fsname, "ufs") == 0); -} - -int -cpr_is_zfs(struct vfs *vfsp) -{ - char *fsname; - - fsname = vfssw[vfsp->vfs_fstype].vsw_name; - return (strcmp(fsname, "zfs") == 0); -} - -/* - * This is a list of file systems that are allowed to be writeable when a - * reusable statefile checkpoint is taken. They must not have any state that - * cannot be restored to consistency by simply rebooting using the checkpoint. - * (In contrast to ufs and pcfs which have disk state that could get - * out of sync with the in-kernel data). - */ -int -cpr_reusable_mount_check(void) -{ - struct vfs *vfsp; - char *fsname; - char **cpp; - static char *cpr_writeok_fss[] = { - "autofs", "devfs", "fd", "lofs", "mntfs", "namefs", "nfs", - "proc", "tmpfs", "ctfs", "objfs", "dev", NULL - }; - - vfs_list_read_lock(); - vfsp = rootvfs; - do { - if (vfsp->vfs_flag & VFS_RDONLY) { - vfsp = vfsp->vfs_next; - continue; - } - fsname = vfssw[vfsp->vfs_fstype].vsw_name; - for (cpp = cpr_writeok_fss; *cpp; cpp++) { - if (strcmp(fsname, *cpp) == 0) - break; - } - /* - * if the inner loop reached the NULL terminator, - * the current fs-type does not match any OK-type - */ - if (*cpp == NULL) { - cpr_err(CE_CONT, "a filesystem of type %s is " - "mounted read/write.\nReusable statefile requires " - "no writeable filesystem of this type be mounted\n", - fsname); - vfs_list_unlock(); - return (EINVAL); - } - vfsp = vfsp->vfs_next; - } while (vfsp != rootvfs); - vfs_list_unlock(); - return (0); -} - -/* - * return statefile offset in DEV_BSIZE units - */ -int -cpr_statefile_offset(void) -{ - return (cprconfig.cf_type != CFT_UFS ? btod(CPR_SPEC_OFFSET) : 0); -} - -/* - * Force a fresh read of the cprinfo per uadmin 3 call - */ -void -cpr_forget_cprconfig(void) -{ - cprconfig_loaded = 0; -} -#endif +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* for swapfs_minfree */ +#include +#include +#include +#include + +/* + * CPR miscellaneous support routines + */ +#define cpr_open(path, mode, vpp) (vn_open(path, UIO_SYSSPACE, \ + mode, 0600, vpp, CRCREAT, 0)) +#define cpr_rdwr(rw, vp, basep, cnt) (vn_rdwr(rw, vp, (caddr_t)(basep), \ + cnt, 0LL, UIO_SYSSPACE, 0, (rlim64_t)MAXOFF_T, CRED(), \ + NULL)) + +extern void clkset(time_t); +extern cpu_t *i_cpr_bootcpu(void); +extern caddr_t i_cpr_map_setup(void); +extern void i_cpr_free_memory_resources(void); + +extern kmutex_t cpr_slock; +extern size_t cpr_buf_size; +extern char *cpr_buf; +extern size_t cpr_pagedata_size; +extern char *cpr_pagedata; +extern int cpr_bufs_allocated; +extern int cpr_bitmaps_allocated; + + +int cpr_is_ufs(struct vfs *); +int cpr_is_zfs(struct vfs *); + +char cpr_default_path[] = CPR_DEFAULT; + +#define COMPRESS_PERCENT 40 /* approx compression ratio in percent */ +#define SIZE_RATE 115 /* increase size by 15% */ +#define INTEGRAL 100 /* for integer math */ + + +/* + * cmn_err() followed by a 1/4 second delay; this gives the + * logging service a chance to flush messages and helps avoid + * intermixing output from prom_printf(). + */ +/*PRINTFLIKE2*/ +void +cpr_err(int ce, const char *fmt, ...) +{ + va_list adx; + + va_start(adx, fmt); + vcmn_err(ce, fmt, adx); + va_end(adx); + drv_usecwait(MICROSEC >> 2); +} + + +int +cpr_init(int fcn) +{ + /* + * Allow only one suspend/resume process. + */ + if (mutex_tryenter(&cpr_slock) == 0) + return (EBUSY); + + CPR->c_flags = 0; + CPR->c_substate = 0; + CPR->c_cprboot_magic = 0; + CPR->c_alloc_cnt = 0; + + CPR->c_fcn = fcn; + if (fcn == AD_CPR_REUSABLE) + CPR->c_flags |= C_REUSABLE; + else + CPR->c_flags |= C_SUSPENDING; + if (fcn == AD_SUSPEND_TO_RAM || fcn == DEV_SUSPEND_TO_RAM) { + return (0); + } + + return (0); +} + +/* + * This routine releases any resources used during the checkpoint. + */ +void +cpr_done(void) +{ + cpr_stat_cleanup(); + i_cpr_bitmap_cleanup(); + + /* + * Free pages used by cpr buffers. + */ + if (cpr_buf) { + kmem_free(cpr_buf, cpr_buf_size); + cpr_buf = NULL; + } + if (cpr_pagedata) { + kmem_free(cpr_pagedata, cpr_pagedata_size); + cpr_pagedata = NULL; + } + + i_cpr_free_memory_resources(); + mutex_exit(&cpr_slock); + cpr_err(CE_CONT, "System has been resumed.\n"); +} + + + +/* + * clock/time related routines + */ +static time_t cpr_time_stamp; + + +void +cpr_tod_get(cpr_time_t *ctp) +{ + timestruc_t ts; + + mutex_enter(&tod_lock); + ts = TODOP_GET(tod_ops); + mutex_exit(&tod_lock); + ctp->tv_sec = (time32_t)ts.tv_sec; + ctp->tv_nsec = (int32_t)ts.tv_nsec; +} + +void +cpr_tod_status_set(int tod_flag) +{ + mutex_enter(&tod_lock); + tod_status_set(tod_flag); + mutex_exit(&tod_lock); +} + +void +cpr_save_time(void) +{ + cpr_time_stamp = gethrestime_sec(); +} + +/* + * correct time based on saved time stamp or hardware clock + */ +void +cpr_restore_time(void) +{ + clkset(cpr_time_stamp); +} + diff --git a/kernel/cpr/cpr_mod.c b/kernel/cpr/cpr_mod.c index 623ed0dba0..e7b6b7ddde 100644 --- a/kernel/cpr/cpr_mod.c +++ b/kernel/cpr/cpr_mod.c @@ -56,9 +56,6 @@ extern void cpr_done(void); extern void i_cpr_stop_other_cpus(void); extern int i_cpr_power_down(int); -#if defined(__sparc) -extern void cpr_forget_cprconfig(void); -#endif static struct modlmisc modlmisc = { &mod_miscops, "checkpoint resume" @@ -127,17 +124,6 @@ int cpr(int fcn, void *mdep) { -#if defined(__sparc) - static const char noswapstr[] = "reusable statefile requires " - "that no swap area be configured.\n"; - static const char blockstr[] = "reusable statefile must be " - "a block device. See power.conf(4) and pmconfig(1M).\n"; - static const char normalfmt[] = "cannot run normal " - "checkpoint/resume when in reusable statefile mode. " - "use uadmin A_FREEZE AD_REUSEFINI (uadmin %d %d) " - "to exit reusable statefile mode.\n"; - static const char modefmt[] = "%s in reusable mode.\n"; -#endif register int rc = 0; int cpr_sleeptype; @@ -148,24 +134,6 @@ cpr(int fcn, void *mdep) */ switch (fcn) { -#if defined(__sparc) - case AD_CHECK_SUSPEND_TO_RAM: - case AD_SUSPEND_TO_RAM: - return (ENOTSUP); - case AD_CHECK_SUSPEND_TO_DISK: - case AD_SUSPEND_TO_DISK: - case AD_CPR_REUSEINIT: - case AD_CPR_NOCOMPRESS: - case AD_CPR_FORCE: - case AD_CPR_REUSABLE: - case AD_CPR_REUSEFINI: - case AD_CPR_TESTZ: - case AD_CPR_TESTNOZ: - case AD_CPR_TESTHALT: - case AD_CPR_SUSP_DEVICES: - cpr_sleeptype = CPR_TODISK; - break; -#endif #if defined(__x86) case AD_CHECK_SUSPEND_TO_DISK: case AD_SUSPEND_TO_DISK: @@ -193,91 +161,9 @@ cpr(int fcn, void *mdep) break; #endif } -#if defined(__sparc) - /* - * Need to know if we're in reusable mode, but we will likely have - * rebooted since REUSEINIT, so we have to get the info from the - * file system - */ - if (!cpr_reusable_mode) - cpr_reusable_mode = cpr_get_reusable_mode(); - - cpr_forget_cprconfig(); -#endif switch (fcn) { -#if defined(__sparc) - case AD_CPR_REUSEINIT: - if (!i_cpr_reusable_supported()) - return (ENOTSUP); - if (!cpr_statefile_is_spec()) { - cpr_err(CE_CONT, blockstr); - return (EINVAL); - } - if ((rc = cpr_check_spec_statefile()) != 0) - return (rc); - if (swapinfo) { - cpr_err(CE_CONT, noswapstr); - return (EINVAL); - } - cpr_test_mode = 0; - break; - - case AD_CPR_NOCOMPRESS: - case AD_CPR_COMPRESS: - case AD_CPR_FORCE: - if (cpr_reusable_mode) { - cpr_err(CE_CONT, normalfmt, A_FREEZE, AD_REUSEFINI); - return (ENOTSUP); - } - cpr_test_mode = 0; - break; - - case AD_CPR_REUSABLE: - if (!i_cpr_reusable_supported()) - return (ENOTSUP); - if (!cpr_statefile_is_spec()) { - cpr_err(CE_CONT, blockstr); - return (EINVAL); - } - if ((rc = cpr_check_spec_statefile()) != 0) - return (rc); - if (swapinfo) { - cpr_err(CE_CONT, noswapstr); - return (EINVAL); - } - if ((rc = cpr_reusable_mount_check()) != 0) - return (rc); - cpr_test_mode = 0; - break; - - case AD_CPR_REUSEFINI: - if (!i_cpr_reusable_supported()) - return (ENOTSUP); - cpr_test_mode = 0; - break; - - case AD_CPR_TESTZ: - case AD_CPR_TESTNOZ: - case AD_CPR_TESTHALT: - if (cpr_reusable_mode) { - cpr_err(CE_CONT, normalfmt, A_FREEZE, AD_REUSEFINI); - return (ENOTSUP); - } - cpr_test_mode = 1; - break; - - case AD_CPR_CHECK: - if (!i_cpr_is_supported(cpr_sleeptype) || cpr_reusable_mode) - return (ENOTSUP); - return (0); - - case AD_CPR_PRINT: - CPR_STAT_EVENT_END("POST CPR DELAY"); - cpr_stat_event_print(); - return (0); -#endif case AD_CPR_DEBUG0: cpr_debug = 0; @@ -342,11 +228,6 @@ cpr(int fcn, void *mdep) if (!i_cpr_is_supported(cpr_sleeptype)) return (ENOTSUP); -#if defined(__sparc) - if ((cpr_sleeptype == CPR_TODISK && - !cpr_is_ufs(rootvfs) && !cpr_is_zfs(rootvfs))) - return (ENOTSUP); -#endif if (fcn == AD_CHECK_SUSPEND_TO_RAM || fcn == DEV_CHECK_SUSPEND_TO_RAM) { @@ -354,33 +235,6 @@ cpr(int fcn, void *mdep) return (0); } -#if defined(__sparc) - if (fcn == AD_CPR_REUSEINIT) { - if (mutex_tryenter(&cpr_slock) == 0) - return (EBUSY); - if (cpr_reusable_mode) { - cpr_err(CE_CONT, modefmt, "already"); - mutex_exit(&cpr_slock); - return (EBUSY); - } - rc = i_cpr_reuseinit(); - mutex_exit(&cpr_slock); - return (rc); - } - - if (fcn == AD_CPR_REUSEFINI) { - if (mutex_tryenter(&cpr_slock) == 0) - return (EBUSY); - if (!cpr_reusable_mode) { - cpr_err(CE_CONT, modefmt, "not"); - mutex_exit(&cpr_slock); - return (EINVAL); - } - rc = i_cpr_reusefini(); - mutex_exit(&cpr_slock); - return (rc); - } -#endif /* * acquire cpr serial lock and init cpr state structure. @@ -388,14 +242,6 @@ cpr(int fcn, void *mdep) if (rc = cpr_init(fcn)) return (rc); -#if defined(__sparc) - if (fcn == AD_CPR_REUSABLE) { - if ((rc = i_cpr_check_cprinfo()) != 0) { - mutex_exit(&cpr_slock); - return (rc); - } - } -#endif /* * Call the main cpr routine. If we are successful, we will be coming @@ -418,56 +264,6 @@ cpr(int fcn, void *mdep) return (rc); } -#if defined(__sparc) - - PMD(PMD_SX, ("cpr: Suspend operation succeeded.\n")) - /* - * Back from a successful checkpoint - */ - if (fcn == AD_CPR_TESTZ || fcn == AD_CPR_TESTNOZ) { - mdboot(0, AD_BOOT, "", B_FALSE); - /* NOTREACHED */ - } - - /* make sure there are no more changes to the device tree */ - PMD(PMD_SX, ("cpr: dev tree freeze\n")) - devtree_freeze(); - - /* - * stop other cpus and raise our priority. since there is only - * one active cpu after this, and our priority will be too high - * for us to be preempted, we're essentially single threaded - * from here on out. - */ - PMD(PMD_SX, ("cpr: stop other cpus\n")) - i_cpr_stop_other_cpus(); - PMD(PMD_SX, ("cpr: spl6\n")) - (void) spl6(); - - /* - * try and reset leaf devices. reset_leaves() should only - * be called when there are no other threads that could be - * accessing devices - */ - PMD(PMD_SX, ("cpr: reset leaves\n")) - reset_leaves(); - - /* - * If i_cpr_power_down() succeeds, it'll not return - * - * Drives with write-cache enabled need to flush - * their cache. - */ - if (fcn != AD_CPR_TESTHALT) { - PMD(PMD_SX, ("cpr: power down\n")) - (void) i_cpr_power_down(cpr_sleeptype); - } - ASSERT(cpr_sleeptype == CPR_TODISK); - /* currently CPR_TODISK comes back via a boot path */ - CPR_DEBUG(CPR_DEBUG1, "(Done. Please Switch Off)\n"); - halt(NULL); - /* NOTREACHED */ -#endif } PMD(PMD_SX, ("cpr: cpr done\n")) cpr_done(); diff --git a/kernel/drivers/net/bge/bge_chip2.c b/kernel/drivers/net/bge/bge_chip2.c index a3882a7cff..66cd0eddb6 100644 --- a/kernel/drivers/net/bge/bge_chip2.c +++ b/kernel/drivers/net/bge/bge_chip2.c @@ -885,12 +885,6 @@ bge_nic_setwin(bge_t *bgep, bge_regno_t base) bgep->lastWriteZeroData = ((base == (bge_regno_t)0) ? B_TRUE : B_FALSE); } -#ifdef __sparc - if (DEVICE_5717_SERIES_CHIPSETS(bgep) || - DEVICE_5725_SERIES_CHIPSETS(bgep)) { - base = LE_32(base); - } -#endif pci_config_put32(bgep->cfg_handle, PCI_CONF_BGE_MWBAR, base); } @@ -912,15 +906,11 @@ bge_nic_get32(bge_t *bgep, bge_regno_t addr) } #endif -#ifdef __sparc - data = bge_nic_read32(bgep, addr); -#else bge_nic_setwin(bgep, addr & ~MWBAR_GRANULE_MASK); addr &= MWBAR_GRANULE_MASK; addr += NIC_MEM_WINDOW_OFFSET; data = ddi_get32(bgep->io_handle, PIO_ADDR(bgep, addr)); -#endif BGE_TRACE(("bge_nic_get32($%p, 0x%lx) = 0x%08x", (void *)bgep, addr, data)); @@ -947,22 +937,11 @@ bge_nic_put32(bge_t *bgep, bge_regno_t addr, uint32_t data) } #endif -#ifdef __sparc - if (DEVICE_5717_SERIES_CHIPSETS(bgep) || - DEVICE_5725_SERIES_CHIPSETS(bgep)) { - addr = LE_32(addr); - } - pci_config_put32(bgep->cfg_handle, PCI_CONF_BGE_MWBAR, addr); - data = LE_32(data); - pci_config_put32(bgep->cfg_handle, PCI_CONF_BGE_MWDAR, data); - pci_config_put32(bgep->cfg_handle, PCI_CONF_BGE_MWBAR, 0); -#else bge_nic_setwin(bgep, addr & ~MWBAR_GRANULE_MASK); addr &= MWBAR_GRANULE_MASK; addr += NIC_MEM_WINDOW_OFFSET; ddi_put32(bgep->io_handle, PIO_ADDR(bgep, addr), data); BGE_PCICHK(bgep); -#endif } static uint64_t bge_nic_get64(bge_t *bgep, bge_regno_t addr); @@ -2622,9 +2601,6 @@ bge_chip_id_init(bge_t *bgep) cidp->chip_label = 5727; } cidp->msi_enabled = bge_enable_msi; -#ifdef __sparc - cidp->mask_pci_int = LE_32(MHCR_MASK_PCI_INT_OUTPUT); -#endif cidp->bge_dma_rwctrl = LE_32(PDRWCR_VAR_5717); cidp->pci_type = BGE_PCI_E; cidp->mbuf_lo_water_rdma = RDMA_MBUF_LOWAT_5705; @@ -3669,7 +3645,6 @@ bge_chip_sync(bge_t *bgep) return (retval); } -#ifndef __sparc static bge_regno_t quiesce_regs[] = { READ_DMA_MODE_REG, DMA_COMPLETION_MODE_REG, @@ -3703,7 +3678,6 @@ bge_chip_stop_nonblocking(bge_t *bgep) bgep->bge_chip_state = BGE_CHIP_STOPPED; } -#endif /* * bge_chip_stop() -- stop all chip processing diff --git a/kernel/drivers/net/bge/bge_main2.c b/kernel/drivers/net/bge/bge_main2.c index dc0174c4a3..e358a9e897 100644 --- a/kernel/drivers/net/bge/bge_main2.c +++ b/kernel/drivers/net/bge/bge_main2.c @@ -4184,9 +4184,6 @@ bge_suspend(bge_t *bgep) * This function returns DDI_SUCCESS on success, or DDI_FAILURE on failure. * DDI_FAILURE indicates an error condition and should almost never happen. */ -#ifdef __sparc -#define bge_quiesce ddi_quiesce_not_supported -#else static int bge_quiesce(dev_info_t *devinfo) { @@ -4207,7 +4204,6 @@ bge_quiesce(dev_info_t *devinfo) return (DDI_SUCCESS); } -#endif /* * detach(9E) -- Detach a device from the system diff --git a/kernel/drivers/net/chxge/ch.c b/kernel/drivers/net/chxge/ch.c index b4ee85d840..fa1760ef9f 100644 --- a/kernel/drivers/net/chxge/ch.c +++ b/kernel/drivers/net/chxge/ch.c @@ -86,9 +86,6 @@ static void ch_set_name(ch_t *chp, int unit); static void ch_free_name(ch_t *chp); static void ch_get_prop(ch_t *chp); -#if defined(__sparc) -static void ch_free_dvma_handles(ch_t *chp); -#endif /* GLD interfaces */ static int ch_reset(gld_mac_info_t *); @@ -199,11 +196,7 @@ static struct cb_ops cb_ch_ops = { nochpoll, /* cb_chpoll */ ddi_prop_op, /* report driver property information - prop_op(9e) */ &chinfo, /* cb_stream */ -#if defined(__sparc) - D_MP | D_64BIT, -#else D_MP, /* cb_flag (supports multi-threading) */ -#endif CB_REV, /* cb_rev */ nodev, /* cb_aread */ nodev /* cb_awrite */ @@ -834,9 +827,6 @@ ch_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) mutex_destroy(&chp->ch_dh_lck); mutex_destroy(&chp->mac_lock); ch_free_dma_handles(chp); -#if defined(__sparc) - ch_free_dvma_handles(chp); -#endif ch_free_name(chp); kmem_free(chp, sizeof (ch_t)); gld_mac_free(macinfo); @@ -1210,153 +1200,6 @@ ch_unbind_dma_handle(ch_t *chp, free_dh_t *dhe) mutex_exit(&chp->ch_dh_lck); } -#if defined(__sparc) -/* - * DVMA stuff. Solaris only. - */ - -/* - * create a dvma handle and return a dma handle entry. - * DVMA is on sparc only! - */ - -free_dh_t * -ch_get_dvma_handle(ch_t *chp) -{ - ddi_dma_handle_t ch_dh; - ddi_dma_lim_t ch_dvma_attr; - free_dh_t *dhe; - int rv; - - dhe = (free_dh_t *)kmem_zalloc(sizeof (*dhe), KM_SLEEP); - - ch_dvma_attr.dlim_addr_lo = 0; - ch_dvma_attr.dlim_addr_hi = 0xffffffff; - ch_dvma_attr.dlim_cntr_max = 0xffffffff; - ch_dvma_attr.dlim_burstsizes = 0xfff; - ch_dvma_attr.dlim_minxfer = 1; - ch_dvma_attr.dlim_dmaspeed = 0; - - rv = dvma_reserve( - chp->ch_dip, /* device dev_info */ - &ch_dvma_attr, /* DVMA attributes */ - 3, /* number of pages */ - &ch_dh); /* DVMA handle */ - - if (rv != DDI_SUCCESS) { - - cmn_err(CE_WARN, - "%s: ch_get_dvma_handle: dvma_reserve() error %d\n", - chp->ch_name, rv); - - kmem_free(dhe, sizeof (*dhe)); - - return ((free_dh_t *)0); - } - - dhe->dhe_dh = (ulong_t)ch_dh; - - return (dhe); -} - -/* - * free the linked list of dvma descriptor entries. - * DVMA is only on sparc! - */ - -static void -ch_free_dvma_handles(ch_t *chp) -{ - free_dh_t *dhe, *the; - - dhe = chp->ch_vdh; - while (dhe) { - dvma_release((ddi_dma_handle_t)dhe->dhe_dh); - the = dhe; - dhe = dhe->dhe_next; - kmem_free(the, sizeof (*the)); - } - chp->ch_vdh = NULL; -} - -/* - * ch_bind_dvma_handle() - * - * returns # of entries used off of cmdQ_ce_t array to hold physical addrs. - * DVMA in sparc only - * - * chp - per-board descriptor - * size - # bytes mapped - * vaddr - virtual address - * cmp - array of cmdQ_ce_t entries - * cnt - # free entries in cmp array - */ - -uint32_t -ch_bind_dvma_handle(ch_t *chp, int size, caddr_t vaddr, cmdQ_ce_t *cmp, - uint32_t cnt) -{ - ddi_dma_cookie_t cookie; - ddi_dma_handle_t ch_dh; - uint32_t n = 1; - free_dh_t *dhe; - - mutex_enter(&chp->ch_dh_lck); - if ((dhe = chp->ch_vdh) != NULL) { - chp->ch_vdh = dhe->dhe_next; - } - mutex_exit(&chp->ch_dh_lck); - - if (dhe == NULL) { - return (0); - } - - ch_dh = (ddi_dma_handle_t)dhe->dhe_dh; - n = cnt; - - dvma_kaddr_load( - ch_dh, /* dvma handle */ - vaddr, /* virtual address */ - size, /* length of object */ - 0, /* start at index 0 */ - &cookie); - - dvma_sync(ch_dh, 0, DDI_DMA_SYNC_FORDEV); - - cookie.dmac_notused = 0; - n = 1; - - cmp->ce_pa = cookie.dmac_laddress; - cmp->ce_dh = dhe; - cmp->ce_len = cookie.dmac_size; - cmp->ce_mp = NULL; - cmp->ce_flg = DH_DVMA; /* indicate a dvma descriptor */ - - return (n); -} - -/* - * ch_unbind_dvma_handle() - * - * frees resources alloacted by ch_bind_dvma_handle(). - * - * frees DMA handle - */ - -void -ch_unbind_dvma_handle(ch_t *chp, free_dh_t *dhe) -{ - ddi_dma_handle_t ch_dh = (ddi_dma_handle_t)dhe->dhe_dh; - - dvma_unload(ch_dh, 0, -1); - - mutex_enter(&chp->ch_dh_lck); - dhe->dhe_next = chp->ch_vdh; - chp->ch_vdh = dhe; - mutex_exit(&chp->ch_dh_lck); -} - -#endif /* defined(__sparc) */ /* * send received packet up stream. diff --git a/kernel/drivers/net/chxge/pe.c b/kernel/drivers/net/chxge/pe.c index 652edba984..019ed8a909 100644 --- a/kernel/drivers/net/chxge/pe.c +++ b/kernel/drivers/net/chxge/pe.c @@ -266,10 +266,6 @@ pe_start(ch_t *sa, mblk_t *mp, uint32_t flg) int freeme = 0; /* we have an mblk to free in case of error */ uint32_t ch_bind_dma_handle(ch_t *, int, caddr_t, cmdQ_ce_t *, uint32_t); -#if defined(__sparc) - uint32_t ch_bind_dvma_handle(ch_t *, int, caddr_t, cmdQ_ce_t *, - uint32_t); -#endif int rv; /* return value on error */ #ifdef CONFIG_CHELSIO_T1_OFFLOAD @@ -409,61 +405,6 @@ pe_start(ch_t *sa, mblk_t *mp, uint32_t flg) */ } -#if defined(__sparc) - if (sa->ch_config.enable_dvma) { - lseg = ch_bind_dvma_handle(sa, len, - (void *)mp->b_rptr, - &hmp[nseg], mseg - nseg); - if (lseg == NULL) { - sa->sge->intr_cnt.tx_no_dvma1++; - if ((lseg = ch_bind_dma_handle(sa, len, - (void *)mp->b_rptr, - &hmp[nseg], - mseg - nseg)) == NULL) { - sa->sge->intr_cnt.tx_no_dma1++; - - /* - * ran out of space. Gonna bale - */ - rv = 0; - - /* - * we may have processed - * previous mblks and have - * descriptors. If so, we need - * to free the meta struct - * entries before freeing - * the mblk. - */ - if (nseg) - goto error; - goto error1; - } - } - } else { - lseg = ch_bind_dma_handle(sa, len, - (void *)mp->b_rptr, &hmp[nseg], - mseg - nseg); - if (lseg == NULL) { - sa->sge->intr_cnt.tx_no_dma1++; - - /* - * ran out of space. Gona bale - */ - rv = 0; - - /* - * we may have processed previous - * mblks and have descriptors. If so, - * we need to free the meta struct - * entries before freeing the mblk. - */ - if (nseg) - goto error; - goto error1; - } - } -#else /* defined(__sparc) */ lseg = ch_bind_dma_handle(sa, len, (void *)mp->b_rptr, &hmp[nseg], mseg - nseg); @@ -485,7 +426,6 @@ pe_start(ch_t *sa, mblk_t *mp, uint32_t flg) goto error; goto error1; } -#endif /* defined(__sparc) */ nseg += lseg; mp = mp->b_cont; } @@ -507,40 +447,6 @@ pe_start(ch_t *sa, mblk_t *mp, uint32_t flg) /* we assume that we always have data with one packet */ len = MLEN(mp); -#if defined(__sparc) - if (sa->ch_config.enable_dvma) { - nseg = ch_bind_dvma_handle(sa, len, - (void *)mp->b_rptr, - &hmp[0], 16); - if (nseg == NULL) { - sa->sge->intr_cnt.tx_no_dvma2++; - nseg = ch_bind_dma_handle(sa, len, - (void *)mp->b_rptr, - &hmp[0], 16); - if (nseg == NULL) { - sa->sge->intr_cnt.tx_no_dma2++; - - /* - * ran out of space. Gona bale - */ - rv = 0; - goto error1; - } - } - } else { - nseg = ch_bind_dma_handle(sa, len, - (void *)mp->b_rptr, &hmp[0], 16); - if (nseg == NULL) { - sa->sge->intr_cnt.tx_no_dma2++; - - /* - * ran out of space. Gona bale - */ - rv = 0; - goto error1; - } - } -#else /* defined(__sparc) */ nseg = ch_bind_dma_handle(sa, len, (void *)mp->b_rptr, &hmp[0], 16); if (nseg == 0) { @@ -552,7 +458,6 @@ pe_start(ch_t *sa, mblk_t *mp, uint32_t flg) rv = 0; goto error1; } -#endif /* defined(__sparc) */ /* * dummy arp message to handle PR3309 & PR2928 @@ -584,10 +489,6 @@ error: if (cmp->ce_dh) { if (cmp->ce_flg == DH_DMA) ch_unbind_dma_handle(sa, cmp->ce_dh); -#if defined(__sparc) - else - ch_unbind_dvma_handle(sa, cmp->ce_dh); -#endif } cmp++; } @@ -1554,21 +1455,6 @@ void pe_dma_handle_init(ch_t *chp, int cnt) { free_dh_t *dhe; -#if defined(__sparc) - int tcnt = cnt/2; - - for (; cnt; cnt--) { - dhe = ch_get_dvma_handle(chp); - if (dhe == NULL) - break; - mutex_enter(&chp->ch_dh_lck); - dhe->dhe_next = chp->ch_vdh; - chp->ch_vdh = dhe; - mutex_exit(&chp->ch_dh_lck); - } - - cnt += tcnt; -#endif while (cnt--) { dhe = ch_get_dma_handle(chp); if (dhe == NULL) diff --git a/kernel/drivers/net/e1000g/e1000g_alloc.c b/kernel/drivers/net/e1000g/e1000g_alloc.c index 95122b0fc2..2e26a41785 100644 --- a/kernel/drivers/net/e1000g/e1000g_alloc.c +++ b/kernel/drivers/net/e1000g/e1000g_alloc.c @@ -63,10 +63,6 @@ static int e1000g_dma_mem_alloc_82546(dma_buffer_t *buf, static boolean_t e1000g_cross_64k_bound(void *, uintptr_t); static void e1000g_free_dma_buffer(dma_buffer_t *); -#ifdef __sparc -static int e1000g_alloc_dvma_buffer(struct e1000g *, dma_buffer_t *, size_t); -static void e1000g_free_dvma_buffer(dma_buffer_t *); -#endif static int e1000g_alloc_descriptors(struct e1000g *Adapter); static void e1000g_free_descriptors(struct e1000g *Adapter); static int e1000g_alloc_packets(struct e1000g *Adapter); @@ -82,19 +78,11 @@ static ddi_device_acc_attr_t e1000g_desc_acc_attr = { }; /* DMA access attributes for DMA buffers */ -#ifdef __sparc -static ddi_device_acc_attr_t e1000g_buf_acc_attr = { - DDI_DEVICE_ATTR_V0, - DDI_STRUCTURE_BE_ACC, - DDI_STRICTORDER_ACC, -}; -#else static ddi_device_acc_attr_t e1000g_buf_acc_attr = { DDI_DEVICE_ATTR_V0, DDI_STRUCTURE_LE_ACC, DDI_STRICTORDER_ACC, }; -#endif /* DMA attributes for tx mblk buffers */ static ddi_dma_attr_t e1000g_tx_dma_attr = { @@ -144,22 +132,8 @@ static ddi_dma_attr_t e1000g_desc_dma_attr = { DDI_DMA_FLAGERR, /* dma_attr_flags */ }; -#ifdef __sparc -static ddi_dma_lim_t e1000g_dma_limits = { - (uint_t)0, /* dlim_addr_lo */ - (uint_t)0xffffffff, /* dlim_addr_hi */ - (uint_t)0xffffffff, /* dlim_cntr_max */ - (uint_t)0xfc00fc, /* dlim_burstsizes for 32 and 64 bit xfers */ - 0x1, /* dlim_minxfer */ - 1024 /* dlim_speed */ -}; -#endif -#ifdef __sparc -static dma_type_t e1000g_dma_type = USE_DVMA; -#else static dma_type_t e1000g_dma_type = USE_DMA; -#endif extern krwlock_t e1000g_dma_type_lock; @@ -773,79 +747,6 @@ e1000g_free_packets(struct e1000g *Adapter) e1000g_free_rx_packets(rx_data, B_FALSE); } -#ifdef __sparc -static int -e1000g_alloc_dvma_buffer(struct e1000g *Adapter, - dma_buffer_t *buf, size_t size) -{ - int mystat; - dev_info_t *devinfo; - ddi_dma_cookie_t cookie; - - if (e1000g_force_detach) - devinfo = Adapter->priv_dip; - else - devinfo = Adapter->dip; - - mystat = dvma_reserve(devinfo, - &e1000g_dma_limits, - Adapter->dvma_page_num, - &buf->dma_handle); - - if (mystat != DDI_SUCCESS) { - buf->dma_handle = NULL; - E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL, - "Could not allocate dvma buffer handle: %d\n", mystat); - return (DDI_FAILURE); - } - - buf->address = kmem_alloc(size, KM_NOSLEEP); - - if (buf->address == NULL) { - if (buf->dma_handle != NULL) { - dvma_release(buf->dma_handle); - buf->dma_handle = NULL; - } - E1000G_DEBUGLOG_0(Adapter, E1000G_WARN_LEVEL, - "Could not allocate dvma buffer memory\n"); - return (DDI_FAILURE); - } - - dvma_kaddr_load(buf->dma_handle, - buf->address, size, 0, &cookie); - - buf->dma_address = cookie.dmac_laddress; - buf->size = size; - buf->len = 0; - - return (DDI_SUCCESS); -} - -static void -e1000g_free_dvma_buffer(dma_buffer_t *buf) -{ - if (buf->dma_handle != NULL) { - dvma_unload(buf->dma_handle, 0, -1); - } else { - return; - } - - buf->dma_address = NULL; - - if (buf->address != NULL) { - kmem_free(buf->address, buf->size); - buf->address = NULL; - } - - if (buf->dma_handle != NULL) { - dvma_release(buf->dma_handle); - buf->dma_handle = NULL; - } - - buf->size = 0; - buf->len = 0; -} -#endif static int e1000g_alloc_dma_buffer(struct e1000g *Adapter, @@ -1154,14 +1055,6 @@ e1000g_alloc_tx_packets(e1000g_tx_ring_t *tx_ring) * than the tx_bcopy_thresh. */ switch (e1000g_dma_type) { -#ifdef __sparc - case USE_DVMA: - mystat = dvma_reserve(devinfo, - &e1000g_dma_limits, - Adapter->dvma_page_num, - &packet->tx_dma_handle); - break; -#endif case USE_DMA: mystat = ddi_dma_alloc_handle(devinfo, &e1000g_tx_dma_attr, @@ -1189,12 +1082,6 @@ e1000g_alloc_tx_packets(e1000g_tx_ring_t *tx_ring) tx_buf = packet->tx_buf; switch (e1000g_dma_type) { -#ifdef __sparc - case USE_DVMA: - mystat = e1000g_alloc_dvma_buffer(Adapter, - tx_buf, Adapter->tx_buffer_size); - break; -#endif case USE_DMA: mystat = e1000g_alloc_dma_buffer(Adapter, tx_buf, Adapter->tx_buffer_size, &dma_attr); @@ -1206,11 +1093,6 @@ e1000g_alloc_tx_packets(e1000g_tx_ring_t *tx_ring) if (mystat != DDI_SUCCESS) { ASSERT(packet->tx_dma_handle != NULL); switch (e1000g_dma_type) { -#ifdef __sparc - case USE_DVMA: - dvma_release(packet->tx_dma_handle); - break; -#endif case USE_DMA: ddi_dma_free_handle(&packet->tx_dma_handle); break; @@ -1335,12 +1217,6 @@ e1000g_alloc_rx_sw_packet(e1000g_rx_data_t *rx_data, ddi_dma_attr_t *p_dma_attr) rx_buf = packet->rx_buf; switch (e1000g_dma_type) { -#ifdef __sparc - case USE_DVMA: - mystat = e1000g_alloc_dvma_buffer(Adapter, - rx_buf, Adapter->rx_buffer_size); - break; -#endif case USE_DMA: if (Adapter->mem_workaround_82546 && ((Adapter->shared.mac.type == e1000_82545) || @@ -1403,15 +1279,6 @@ e1000g_free_rx_sw_packet(p_rx_sw_packet_t packet, boolean_t full_release) rx_buf = packet->rx_buf; switch (packet->dma_type) { -#ifdef __sparc - case USE_DVMA: - if (rx_buf->address != NULL) { - rx_buf->size += E1000G_IPALIGNROOM; - rx_buf->address -= E1000G_IPALIGNROOM; - } - e1000g_free_dvma_buffer(rx_buf); - break; -#endif case USE_DMA: e1000g_free_dma_buffer(rx_buf); break; @@ -1476,11 +1343,6 @@ e1000g_free_tx_packets(e1000g_tx_ring_t *tx_ring) /* Free the Tx DMA handle for dynamical binding */ if (packet->tx_dma_handle != NULL) { switch (packet->dma_type) { -#ifdef __sparc - case USE_DVMA: - dvma_release(packet->tx_dma_handle); - break; -#endif case USE_DMA: ddi_dma_free_handle(&packet->tx_dma_handle); break; @@ -1501,11 +1363,6 @@ e1000g_free_tx_packets(e1000g_tx_ring_t *tx_ring) tx_buf = packet->tx_buf; switch (packet->dma_type) { -#ifdef __sparc - case USE_DVMA: - e1000g_free_dvma_buffer(tx_buf); - break; -#endif case USE_DMA: e1000g_free_dma_buffer(tx_buf); break; diff --git a/kernel/drivers/net/e1000g/e1000g_main.c b/kernel/drivers/net/e1000g/e1000g_main.c index d0e1968c9f..b43b4cf902 100644 --- a/kernel/drivers/net/e1000g/e1000g_main.c +++ b/kernel/drivers/net/e1000g/e1000g_main.c @@ -152,9 +152,6 @@ static int e1000g_rem_intrs(struct e1000g *); static int e1000g_enable_intrs(struct e1000g *); static int e1000g_disable_intrs(struct e1000g *); static boolean_t e1000g_link_up(struct e1000g *); -#ifdef __sparc -static boolean_t e1000g_find_mac_address(struct e1000g *); -#endif static void e1000g_get_phy_state(struct e1000g *); static int e1000g_fm_error_cb(dev_info_t *dip, ddi_fm_error_t *err, const void *impl_data); @@ -276,11 +273,7 @@ uint32_t e1000g_mblks_pending = 0; * after the system board level DR operation. For this reason, the global * variable e1000g_force_detach must be B_FALSE on SPARC platform. */ -#ifdef __sparc -boolean_t e1000g_force_detach = B_FALSE; -#else boolean_t e1000g_force_detach = B_TRUE; -#endif private_devi_list_t *e1000g_private_devi_list = NULL; /* @@ -825,11 +818,7 @@ e1000g_set_driver_params(struct e1000g *Adapter) /* Enable the TTL workaround for 82541/82547 */ e1000_set_ttl_workaround_state_82541(hw, B_TRUE); -#ifdef __sparc - Adapter->strip_crc = B_TRUE; -#else Adapter->strip_crc = B_FALSE; -#endif /* setup the maximum MTU size of the chip */ e1000g_setup_max_mtu(Adapter); @@ -939,32 +928,9 @@ e1000g_set_bufsize(struct e1000g *Adapter) uint64_t tx_size; dev_info_t *devinfo = Adapter->dip; -#ifdef __sparc - ulong_t iommu_pagesize; -#endif /* Get the system page size */ Adapter->sys_page_sz = ddi_ptob(devinfo, (ulong_t)1); -#ifdef __sparc - iommu_pagesize = dvma_pagesize(devinfo); - if (iommu_pagesize != 0) { - if (Adapter->sys_page_sz == iommu_pagesize) { - if (iommu_pagesize > 0x4000) - Adapter->sys_page_sz = 0x4000; - } else { - if (Adapter->sys_page_sz > iommu_pagesize) - Adapter->sys_page_sz = iommu_pagesize; - } - } - if (Adapter->lso_enable) { - Adapter->dvma_page_num = E1000_LSO_MAXLEN / - Adapter->sys_page_sz + E1000G_DEFAULT_DVMA_PAGE_NUM; - } else { - Adapter->dvma_page_num = Adapter->max_frame_size / - Adapter->sys_page_sz + E1000G_DEFAULT_DVMA_PAGE_NUM; - } - ASSERT(Adapter->dvma_page_num >= E1000G_DEFAULT_DVMA_PAGE_NUM); -#endif Adapter->min_frame_size = ETHERMIN + ETHERFCSL; @@ -1402,13 +1368,6 @@ e1000g_init(struct e1000g *Adapter) } result = 0; -#ifdef __sparc - /* - * First, we try to get the local ethernet address from OBP. If - * failed, then we get it from the EEPROM of NIC card. - */ - result = e1000g_find_mac_address(Adapter); -#endif /* Get the local ethernet address. */ if (!result) { mutex_enter(&e1000g_nvm_lock); @@ -5828,77 +5787,6 @@ e1000g_set_external_loopback_10(struct e1000g *Adapter) E1000_WRITE_REG(hw, E1000_CTRL, ctrl); } -#ifdef __sparc -static boolean_t -e1000g_find_mac_address(struct e1000g *Adapter) -{ - struct e1000_hw *hw = &Adapter->shared; - uchar_t *bytes; - struct ether_addr sysaddr; - uint_t nelts; - int err; - boolean_t found = B_FALSE; - - /* - * The "vendor's factory-set address" may already have - * been extracted from the chip, but if the property - * "local-mac-address" is set we use that instead. - * - * We check whether it looks like an array of 6 - * bytes (which it should, if OBP set it). If we can't - * make sense of it this way, we'll ignore it. - */ - err = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, Adapter->dip, - DDI_PROP_DONTPASS, "local-mac-address", &bytes, &nelts); - if (err == DDI_PROP_SUCCESS) { - if (nelts == ETHERADDRL) { - while (nelts--) - hw->mac.addr[nelts] = bytes[nelts]; - found = B_TRUE; - } - ddi_prop_free(bytes); - } - - /* - * Look up the OBP property "local-mac-address?". If the user has set - * 'local-mac-address? = false', use "the system address" instead. - */ - if (ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, Adapter->dip, 0, - "local-mac-address?", &bytes, &nelts) == DDI_PROP_SUCCESS) { - if (strncmp("false", (caddr_t)bytes, (size_t)nelts) == 0) { - if (localetheraddr(NULL, &sysaddr) != 0) { - bcopy(&sysaddr, hw->mac.addr, ETHERADDRL); - found = B_TRUE; - } - } - ddi_prop_free(bytes); - } - - /* - * Finally(!), if there's a valid "mac-address" property (created - * if we netbooted from this interface), we must use this instead - * of any of the above to ensure that the NFS/install server doesn't - * get confused by the address changing as Solaris takes over! - */ - err = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, Adapter->dip, - DDI_PROP_DONTPASS, "mac-address", &bytes, &nelts); - if (err == DDI_PROP_SUCCESS) { - if (nelts == ETHERADDRL) { - while (nelts--) - hw->mac.addr[nelts] = bytes[nelts]; - found = B_TRUE; - } - ddi_prop_free(bytes); - } - - if (found) { - bcopy(hw->mac.addr, hw->mac.perm_addr, - ETHERADDRL); - } - - return (found); -} -#endif static int e1000g_add_intrs(struct e1000g *Adapter) diff --git a/kernel/drivers/net/e1000g/e1000g_rx.c b/kernel/drivers/net/e1000g/e1000g_rx.c index 3e12e172ed..4d5ab46317 100644 --- a/kernel/drivers/net/e1000g/e1000g_rx.c +++ b/kernel/drivers/net/e1000g/e1000g_rx.c @@ -525,19 +525,9 @@ e1000g_receive(e1000g_rx_ring_t *rx_ring, mblk_t **tail, uint_t sz) length = current_desc->length; -#ifdef __sparc - if (packet->dma_type == USE_DVMA) - dvma_sync(rx_buf->dma_handle, 0, - DDI_DMA_SYNC_FORKERNEL); - else - (void) ddi_dma_sync(rx_buf->dma_handle, - E1000G_IPALIGNROOM, length, - DDI_DMA_SYNC_FORKERNEL); -#else (void) ddi_dma_sync(rx_buf->dma_handle, E1000G_IPALIGNROOM, length, DDI_DMA_SYNC_FORKERNEL); -#endif if (e1000g_check_dma_handle( rx_buf->dma_handle) != DDI_FM_OK) { diff --git a/kernel/drivers/net/e1000g/e1000g_tx.c b/kernel/drivers/net/e1000g/e1000g_tx.c index 654b4bf1ef..635859aba4 100644 --- a/kernel/drivers/net/e1000g/e1000g_tx.c +++ b/kernel/drivers/net/e1000g/e1000g_tx.c @@ -92,11 +92,6 @@ e1000g_free_tx_swpkt(register p_tx_sw_packet_t packet) case USE_BCOPY: packet->tx_buf->len = 0; break; -#ifdef __sparc - case USE_DVMA: - dvma_unload(packet->tx_dma_handle, 0, -1); - break; -#endif case USE_DMA: (void) ddi_dma_unbind_handle(packet->tx_dma_handle); break; @@ -1313,16 +1308,8 @@ e1000g_tx_copy(e1000g_tx_ring_t *tx_ring, p_tx_sw_packet_t packet, tx_buf->len = ETHERMIN; } -#ifdef __sparc - if (packet->dma_type == USE_DVMA) - dvma_sync(tx_buf->dma_handle, 0, DDI_DMA_SYNC_FORDEV); - else - (void) ddi_dma_sync(tx_buf->dma_handle, 0, - tx_buf->len, DDI_DMA_SYNC_FORDEV); -#else (void) ddi_dma_sync(tx_buf->dma_handle, 0, tx_buf->len, DDI_DMA_SYNC_FORDEV); -#endif packet->data_transfer_type = USE_BCOPY; @@ -1367,18 +1354,6 @@ e1000g_tx_bind(e1000g_tx_ring_t *tx_ring, p_tx_sw_packet_t packet, mblk_t *mp) * times specified by *countp - 1. */ switch (packet->dma_type) { -#ifdef __sparc - case USE_DVMA: - dvma_kaddr_load(packet->tx_dma_handle, - (caddr_t)mp->b_rptr, len, 0, &dma_cookie); - - dvma_sync(packet->tx_dma_handle, 0, - DDI_DMA_SYNC_FORDEV); - - ncookies = 1; - packet->data_transfer_type = USE_DVMA; - break; -#endif case USE_DMA: if ((mystat = ddi_dma_addr_bind_handle( packet->tx_dma_handle, NULL, diff --git a/kernel/drivers/net/hxge/hxge_main.c b/kernel/drivers/net/hxge/hxge_main.c index ed520ccb8b..03cfc086c4 100644 --- a/kernel/drivers/net/hxge/hxge_main.c +++ b/kernel/drivers/net/hxge/hxge_main.c @@ -71,13 +71,8 @@ uint32_t hxge_tx_lb_policy = HXGE_TX_LB_TCPUDP; * hxge_rx_bcopy_size_type: receive buffer block size type. * hxge_rx_threshold_lo: copy only up to tunable block size type. */ -#if defined(__sparc) -hxge_rxbuf_threshold_t hxge_rx_threshold_hi = HXGE_RX_COPY_6; -hxge_rxbuf_threshold_t hxge_rx_threshold_lo = HXGE_RX_COPY_4; -#else hxge_rxbuf_threshold_t hxge_rx_threshold_hi = HXGE_RX_COPY_NONE; hxge_rxbuf_threshold_t hxge_rx_threshold_lo = HXGE_RX_COPY_NONE; -#endif hxge_rxbuf_type_t hxge_rx_buf_size_type = RCR_PKTBUFSZ_0; rtrace_t hpi_rtracebuf; diff --git a/kernel/drivers/net/igb/igb_buf.c b/kernel/drivers/net/igb/igb_buf.c index ff607b16f8..7f1235b09e 100644 --- a/kernel/drivers/net/igb/igb_buf.c +++ b/kernel/drivers/net/igb/igb_buf.c @@ -39,11 +39,7 @@ static void igb_free_tcb_lists(igb_tx_ring_t *); static int igb_alloc_rcb_lists(igb_rx_data_t *); static void igb_free_rcb_lists(igb_rx_data_t *); -#ifdef __sparc -#define IGB_DMA_ALIGNMENT 0x0000000000002000ull -#else #define IGB_DMA_ALIGNMENT 0x0000000000001000ull -#endif /* * DMA attributes for tx/rx descriptors diff --git a/kernel/drivers/net/igb/igb_main.c b/kernel/drivers/net/igb/igb_main.c index 74d56e2fda..809f4a9406 100644 --- a/kernel/drivers/net/igb/igb_main.c +++ b/kernel/drivers/net/igb/igb_main.c @@ -3367,70 +3367,6 @@ static boolean_t igb_find_mac_address(igb_t *igb) { struct e1000_hw *hw = &igb->hw; -#ifdef __sparc - uchar_t *bytes; - struct ether_addr sysaddr; - uint_t nelts; - int err; - boolean_t found = B_FALSE; - - /* - * The "vendor's factory-set address" may already have - * been extracted from the chip, but if the property - * "local-mac-address" is set we use that instead. - * - * We check whether it looks like an array of 6 - * bytes (which it should, if OBP set it). If we can't - * make sense of it this way, we'll ignore it. - */ - err = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, igb->dip, - DDI_PROP_DONTPASS, "local-mac-address", &bytes, &nelts); - if (err == DDI_PROP_SUCCESS) { - if (nelts == ETHERADDRL) { - while (nelts--) - hw->mac.addr[nelts] = bytes[nelts]; - found = B_TRUE; - } - ddi_prop_free(bytes); - } - - /* - * Look up the OBP property "local-mac-address?". If the user has set - * 'local-mac-address? = false', use "the system address" instead. - */ - if (ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, igb->dip, 0, - "local-mac-address?", &bytes, &nelts) == DDI_PROP_SUCCESS) { - if (strncmp("false", (caddr_t)bytes, (size_t)nelts) == 0) { - if (localetheraddr(NULL, &sysaddr) != 0) { - bcopy(&sysaddr, hw->mac.addr, ETHERADDRL); - found = B_TRUE; - } - } - ddi_prop_free(bytes); - } - - /* - * Finally(!), if there's a valid "mac-address" property (created - * if we netbooted from this interface), we must use this instead - * of any of the above to ensure that the NFS/install server doesn't - * get confused by the address changing as Solaris takes over! - */ - err = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, igb->dip, - DDI_PROP_DONTPASS, "mac-address", &bytes, &nelts); - if (err == DDI_PROP_SUCCESS) { - if (nelts == ETHERADDRL) { - while (nelts--) - hw->mac.addr[nelts] = bytes[nelts]; - found = B_TRUE; - } - ddi_prop_free(bytes); - } - - if (found) { - bcopy(hw->mac.addr, hw->mac.perm_addr, ETHERADDRL); - return (B_TRUE); - } -#endif /* * Read the device MAC address from the EEPROM diff --git a/kernel/drivers/net/ixgbe/ixgbe_buf.c b/kernel/drivers/net/ixgbe/ixgbe_buf.c index 8869fb062c..6526f1d226 100644 --- a/kernel/drivers/net/ixgbe/ixgbe_buf.c +++ b/kernel/drivers/net/ixgbe/ixgbe_buf.c @@ -38,11 +38,7 @@ static void ixgbe_free_tcb_lists(ixgbe_tx_ring_t *); static int ixgbe_alloc_rcb_lists(ixgbe_rx_data_t *); static void ixgbe_free_rcb_lists(ixgbe_rx_data_t *); -#ifdef __sparc -#define IXGBE_DMA_ALIGNMENT 0x0000000000002000ull -#else #define IXGBE_DMA_ALIGNMENT 0x0000000000001000ull -#endif /* * DMA attributes for tx/rx descriptors. diff --git a/kernel/drivers/net/ixgbe/ixgbe_main.c b/kernel/drivers/net/ixgbe/ixgbe_main.c index 21d7723546..0824f155d2 100644 --- a/kernel/drivers/net/ixgbe/ixgbe_main.c +++ b/kernel/drivers/net/ixgbe/ixgbe_main.c @@ -4006,73 +4006,7 @@ is_valid_mac_addr(uint8_t *mac_addr) static bool ixgbe_find_mac_address(ixgbe_t *ixgbe) { -#ifdef __sparc - struct ixgbe_hw *hw = &ixgbe->hw; - uchar_t *bytes; - struct ether_addr sysaddr; - uint_t nelts; - int err; - bool found = B_FALSE; - - /* - * The "vendor's factory-set address" may already have - * been extracted from the chip, but if the property - * "local-mac-address" is set we use that instead. - * - * We check whether it looks like an array of 6 - * bytes (which it should, if OBP set it). If we can't - * make sense of it this way, we'll ignore it. - */ - err = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, ixgbe->dip, - DDI_PROP_DONTPASS, "local-mac-address", &bytes, &nelts); - if (err == DDI_PROP_SUCCESS) { - if (nelts == ETHERADDRL) { - while (nelts--) - hw->mac.addr[nelts] = bytes[nelts]; - found = B_TRUE; - } - ddi_prop_free(bytes); - } - - /* - * Look up the OBP property "local-mac-address?". If the user has set - * 'local-mac-address? = false', use "the system address" instead. - */ - if (ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, ixgbe->dip, 0, - "local-mac-address?", &bytes, &nelts) == DDI_PROP_SUCCESS) { - if (strncmp("false", (caddr_t)bytes, (size_t)nelts) == 0) { - if (localetheraddr(NULL, &sysaddr) != 0) { - bcopy(&sysaddr, hw->mac.addr, ETHERADDRL); - found = B_TRUE; - } - } - ddi_prop_free(bytes); - } - - /* - * Finally(!), if there's a valid "mac-address" property (created - * if we netbooted from this interface), we must use this instead - * of any of the above to ensure that the NFS/install server doesn't - * get confused by the address changing as illumos takes over! - */ - err = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, ixgbe->dip, - DDI_PROP_DONTPASS, "mac-address", &bytes, &nelts); - if (err == DDI_PROP_SUCCESS) { - if (nelts == ETHERADDRL) { - while (nelts--) - hw->mac.addr[nelts] = bytes[nelts]; - found = B_TRUE; - } - ddi_prop_free(bytes); - } - - if (found) { - bcopy(hw->mac.addr, hw->mac.perm_addr, ETHERADDRL); - return (B_TRUE); - } -#else _NOTE(ARGUNUSED(ixgbe)); -#endif return (B_TRUE); } diff --git a/kernel/drivers/net/nxge/nxge_send.c b/kernel/drivers/net/nxge/nxge_send.c index cf57cb2aa4..49a9432cdf 100644 --- a/kernel/drivers/net/nxge/nxge_send.c +++ b/kernel/drivers/net/nxge/nxge_send.c @@ -1265,9 +1265,6 @@ nxge_do_softlso(mblk_t *mp, uint32_t mss) int available, len, left; uint16_t ip_id; uint32_t tcp_seq; -#ifdef __sparc - uint32_t tcp_seq_tmp; -#endif mblk_t *datamp; uchar_t *rptr; mblk_t *nmp; @@ -1590,12 +1587,7 @@ nxge_do_softlso(mblk_t *mp, uint32_t mss) niph->ip_len = htons(mss + iphlen + tcphlen); ip_id = ntohs(niph->ip_id); ntcph = (struct tcphdr *)(nmp->b_rptr + ehlen + iphlen); -#ifdef __sparc - bcopy((char *)&ntcph->th_seq, &tcp_seq_tmp, 4); - tcp_seq = ntohl(tcp_seq_tmp); -#else tcp_seq = ntohl(ntcph->th_seq); -#endif ntcph->th_flags &= ~(TH_FIN | TH_PUSH | TH_RST); @@ -1644,12 +1636,7 @@ nxge_do_softlso(mblk_t *mp, uint32_t mss) ntcph->th_flags &= ~(TH_FIN | TH_PUSH | TH_RST | TH_URG); -#ifdef __sparc - tcp_seq_tmp = htonl(tcp_seq); - bcopy(&tcp_seq_tmp, (char *)&ntcph->th_seq, 4); -#else ntcph->th_seq = htonl(tcp_seq); -#endif DB_CKSUMFLAGS(nmp) = (uint16_t)hckflags; DB_CKSUMSTART(nmp) = start_offset; DB_CKSUMSTUFF(nmp) = stuff_offset; @@ -1682,12 +1669,7 @@ nxge_do_softlso(mblk_t *mp, uint32_t mss) niph->ip_len = htons(msgsize(nmp->b_cont) + iphlen + tcphlen); ntcph = (struct tcphdr *)(nmp->b_rptr + ehlen + iphlen); tcp_seq += mss; -#ifdef __sparc - tcp_seq_tmp = htonl(tcp_seq); - bcopy(&tcp_seq_tmp, (char *)&ntcph->th_seq, 4); -#else ntcph->th_seq = htonl(tcp_seq); -#endif ntcph->th_flags = (otcph->th_flags & ~TH_URG); DB_CKSUMFLAGS(nmp) = (uint16_t)hckflags; diff --git a/kernel/drivers/net/sfe/sfe.c b/kernel/drivers/net/sfe/sfe.c index 5ed5295bb3..289dddd9c7 100644 --- a/kernel/drivers/net/sfe/sfe.c +++ b/kernel/drivers/net/sfe/sfe.c @@ -952,7 +952,6 @@ sfe_stop_chip(struct gem_dev *dp) return (GEM_SUCCESS); } -#ifndef __sparc /* * Stop nic core gracefully for quiesce */ @@ -990,7 +989,6 @@ sfe_stop_chip_quiesce(struct gem_dev *dp) } return (DDI_SUCCESS); } -#endif /* * Setup media mode @@ -2339,9 +2337,6 @@ sfedetach(dev_info_t *dip, ddi_detach_cmd_t cmd) * This function returns DDI_SUCCESS on success, or DDI_FAILURE on failure. * DDI_FAILURE indicates an error condition and should almost never happen. */ -#ifdef __sparc -#define sfe_quiesce ddi_quiesce_not_supported -#else static int sfe_quiesce(dev_info_t *dip) { @@ -2357,7 +2352,6 @@ sfe_quiesce(dev_info_t *dip) return (ret); } -#endif /* ======================================================== */ /* diff --git a/kernel/drivers/net/sfxge/sfxge_intr.c b/kernel/drivers/net/sfxge/sfxge_intr.c index 33d9d67f5e..ba09aa4e85 100644 --- a/kernel/drivers/net/sfxge/sfxge_intr.c +++ b/kernel/drivers/net/sfxge/sfxge_intr.c @@ -511,11 +511,6 @@ sfxge_intr_init(sfxge_t *sp) ASSERT3U(sip->si_state, ==, SFXGE_INTR_UNINITIALIZED); -#ifdef __sparc - /* PSARC 2007/453 */ - (void) ddi_prop_create(DDI_DEV_T_NONE, dip, DDI_PROP_CANSLEEP, - "#msix-request", NULL, 0); -#endif /* Get the map of supported interrupt types */ err = ddi_intr_get_supported_types(dip, &types); diff --git a/kernel/drivers/ramdisk/ramdisk.c b/kernel/drivers/ramdisk/ramdisk.c index 359c652822..34bb8aa347 100644 --- a/kernel/drivers/ramdisk/ramdisk.c +++ b/kernel/drivers/ramdisk/ramdisk.c @@ -116,9 +116,6 @@ struct rd_ops { * Flag to disable the use of real ramdisks (in the OBP - on Sparc) when * the associated memory is no longer available - set in the bootops section. */ -#ifdef __sparc -extern int bootops_obp_ramdisk_disabled; -#endif /* __sparc */ /* * An opaque handle where information about our set of ramdisk devices lives. @@ -947,10 +944,6 @@ rd_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) } else { const struct rd_ops *ops; -#ifdef __sparc - if (bootops_obp_ramdisk_disabled) - goto attach_failed; -#endif /* __sparc */ RD_STRIP_PREFIX(name, ddi_node_name(dip)); @@ -1228,13 +1221,7 @@ rd_strategy(struct buf *bp) rsp = ddi_get_soft_state(rd_statep, getminor(bp->b_edev)); offset = bp->b_blkno * DEV_BSIZE; -#ifdef __sparc - if (rsp == NULL || - (bootops_obp_ramdisk_disabled && - (rsp->rd_dip != rd_dip || rd_dip == NULL))) { /* OBP ramdisk */ -#else /* __sparc */ if (rsp == NULL) { -#endif /* __sparc */ bp->b_error = ENXIO; bp->b_flags |= B_ERROR; } else if (offset >= rsp->rd_size) { diff --git a/kernel/drivers/scsi/targets/sd/sd.c b/kernel/drivers/scsi/targets/sd/sd.c index 678e119943..137ba270f2 100644 --- a/kernel/drivers/scsi/targets/sd/sd.c +++ b/kernel/drivers/scsi/targets/sd/sd.c @@ -13985,14 +13985,6 @@ sd_shadow_buf_free(struct buf *bp) xp = SD_GET_XBUF(bp); ASSERT(xp != NULL); -#if defined(__sparc) - /* - * Call bp_mapout() before freeing the buf, in case a lower - * layer or HBA had done a bp_mapin(). we must do this here - * as we are the "originator" of the shadow buf. - */ - bp_mapout(bp); -#endif /* * Null out b_iodone before freeing the bp, to ensure that the driver diff --git a/kernel/fs/proc/prcontrol.c b/kernel/fs/proc/prcontrol.c index 9d2d583c29..04eaa32dae 100644 --- a/kernel/fs/proc/prcontrol.c +++ b/kernel/fs/proc/prcontrol.c @@ -64,10 +64,6 @@ static void pr_settrace(proc_t *, sigset_t *); static int pr_setfpregs(prnode_t *, prfpregset_t *); -#if defined(__sparc) -static int pr_setxregs(prnode_t *, prxregset_t *); -static int pr_setasrs(prnode_t *, asrset_t); -#endif static int pr_setvaddr(prnode_t *, caddr_t); static int pr_clearsig(prnode_t *); static int pr_clearflt(prnode_t *); @@ -92,10 +88,6 @@ typedef union { sysset_t sysset; /* PCSENTRY, PCSEXIT */ prgregset_t prgregset; /* PCSREG, PCAGENT */ prfpregset_t prfpregset; /* PCSFPREG */ -#if defined(__sparc) - prxregset_t prxregset; /* PCSXREG */ - asrset_t asrset; /* PCSASRS */ -#endif prwatch_t prwatch; /* PCWATCH */ priovec_t priovec; /* PCREAD, PCWRITE */ prcred_t prcred; /* PCSCRED */ @@ -157,14 +149,6 @@ ctlsize(long cmd, size_t resid, arg_t *argp) case PCSFPREG: size += sizeof (prfpregset_t); break; -#if defined(__sparc) - case PCSXREG: - size += sizeof (prxregset_t); - break; - case PCSASRS: - size += sizeof (asrset_t); - break; -#endif case PCWATCH: size += sizeof (prwatch_t); break; @@ -423,18 +407,9 @@ pr_control(long cmd, arg_t *argp, prnode_t *pnp, cred_t *cr) break; case PCSXREG: /* set extra registers */ -#if defined(__sparc) - error = pr_setxregs(pnp, &argp->prxregset); -#else error = EINVAL; -#endif break; -#if defined(__sparc) - case PCSASRS: /* set ancillary state registers */ - error = pr_setasrs(pnp, argp->asrset); - break; -#endif case PCSVADDR: /* set virtual address at which to resume */ error = pr_setvaddr(pnp, argp->vaddr); @@ -1710,51 +1685,6 @@ pr_setfpregs32(prnode_t *pnp, prfpregset32_t *prfpregset) } #endif /* _SYSCALL32_IMPL */ -#if defined(__sparc) -/* ARGSUSED */ -static int -pr_setxregs(prnode_t *pnp, prxregset_t *prxregset) -{ - proc_t *p = pnp->pr_common->prc_proc; - kthread_t *t = pr_thread(pnp); /* returns locked thread */ - - if (!ISTOPPED(t) && !VSTOPPED(t) && !DSTOPPED(t)) { - thread_unlock(t); - return (EBUSY); - } - thread_unlock(t); - - if (!prhasx(p)) - return (EINVAL); /* No extra register support */ - - /* drop p_lock while touching the lwp's stack */ - mutex_exit(&p->p_lock); - prsetprxregs(ttolwp(t), (caddr_t)prxregset); - mutex_enter(&p->p_lock); - - return (0); -} - -static int -pr_setasrs(prnode_t *pnp, asrset_t asrset) -{ - proc_t *p = pnp->pr_common->prc_proc; - kthread_t *t = pr_thread(pnp); /* returns locked thread */ - - if (!ISTOPPED(t) && !VSTOPPED(t) && !DSTOPPED(t)) { - thread_unlock(t); - return (EBUSY); - } - thread_unlock(t); - - /* drop p_lock while touching the lwp's stack */ - mutex_exit(&p->p_lock); - prsetasregs(ttolwp(t), asrset); - mutex_enter(&p->p_lock); - - return (0); -} -#endif static int pr_setvaddr(prnode_t *pnp, caddr_t vaddr) diff --git a/kernel/fs/proc/prioctl.c b/kernel/fs/proc/prioctl.c index 396cefa430..637742936b 100644 --- a/kernel/fs/proc/prioctl.c +++ b/kernel/fs/proc/prioctl.c @@ -256,11 +256,7 @@ prioctl( break; case PIOCSXREG: /* set extra registers */ case PIOCGXREG: /* get extra registers */ -#if defined(__sparc) - thingsize = sizeof (prxregset_t); -#else thingsize = 0; -#endif break; case PIOCACTION: thingsize = (nsig-1) * sizeof (struct sigaction); @@ -292,11 +288,6 @@ prioctl( break; #endif /* __i386 || __amd64 */ -#if defined(__sparc) - case PIOCGWIN: - thingsize = sizeof (gwindows_t); - break; -#endif /* __sparc */ case PIOCOPENM: /* open mapped object for reading */ if (cmaddr == NULL) @@ -1304,24 +1295,6 @@ startover: } #endif /* __i386 || __amd64 */ -#if defined(__sparc) - case PIOCGWIN: /* get gwindows_t (see sys/reg.h) */ - { - gwindows_t *gwp = thing; - - /* drop p->p_lock while touching the stack */ - mutex_exit(&p->p_lock); - bzero(gwp, sizeof (*gwp)); - prgetwindows(lwp, gwp); - mutex_enter(&p->p_lock); - prunlock(pnp); - if (copyout(gwp, cmaddr, sizeof (*gwp))) - error = EFAULT; - kmem_free(gwp, sizeof (gwindows_t)); - thing = NULL; - break; - } -#endif /* __sparc */ default: prunlock(pnp); diff --git a/kernel/fs/proc/prusrio.c b/kernel/fs/proc/prusrio.c index a16ab106e4..ad01eb6c02 100644 --- a/kernel/fs/proc/prusrio.c +++ b/kernel/fs/proc/prusrio.c @@ -34,9 +34,6 @@ #include #include -#if defined(__sparc) -#include -#endif #define STACK_BUF_SIZE 64 /* power of 2 */ @@ -61,10 +58,6 @@ prusrio(proc_t *p, enum uio_rw rw, struct uio *uiop, int old) allocated = 1; } -#if defined(__sparc) - if (p == curproc) - (void) flush_user_windows_to_stack(NULL); -#endif switch (rw) { case UIO_READ: diff --git a/kernel/fs/proc/prvnops.c b/kernel/fs/proc/prvnops.c index 9e9cecc538..d3ae755258 100644 --- a/kernel/fs/proc/prvnops.c +++ b/kernel/fs/proc/prvnops.c @@ -70,9 +70,6 @@ #include #include #include -#if defined(__sparc) -#include -#endif #if defined(__x86) #include #endif @@ -189,12 +186,6 @@ static prdirent_t lwpiddir[] = { "templates" }, { PR_SPYMASTER, 9 * sizeof (prdirent_t), sizeof (prdirent_t), "spymaster" }, -#if defined(__sparc) - { PR_GWINDOWS, 10 * sizeof (prdirent_t), sizeof (prdirent_t), - "gwindows" }, - { PR_ASRS, 11 * sizeof (prdirent_t), sizeof (prdirent_t), - "asrs" }, -#endif }; #define NLWPIDDIRFILES (sizeof (lwpiddir) / sizeof (lwpiddir[0]) - 2) @@ -583,9 +574,6 @@ static int pr_read_inval(), pr_read_as(), pr_read_status(), pr_read_watch(), pr_read_lwpstatus(), pr_read_lwpsinfo(), pr_read_lwpusage(), pr_read_xregs(), pr_read_priv(), pr_read_spymaster(), pr_read_secflags(), -#if defined(__sparc) - pr_read_gwindows(), pr_read_asrs(), -#endif pr_read_piddir(), pr_read_pidfile(), pr_read_opagedata(); static int (*pr_read_function[PR_NFILES])() = { @@ -627,10 +615,6 @@ static int (*pr_read_function[PR_NFILES])() = { pr_read_inval, /* /proc//lwp//templates */ pr_read_inval, /* /proc//lwp//templates/ */ pr_read_spymaster, /* /proc//lwp//spymaster */ -#if defined(__sparc) - pr_read_gwindows, /* /proc//lwp//gwindows */ - pr_read_asrs, /* /proc//lwp//asrs */ -#endif pr_read_priv, /* /proc//priv */ pr_read_inval, /* /proc//path */ pr_read_inval, /* /proc//path/xxx */ @@ -1536,42 +1520,7 @@ out: static int pr_read_xregs(prnode_t *pnp, uio_t *uiop) { -#if defined(__sparc) - proc_t *p; - kthread_t *t; - int error; - char *xreg; - size_t size; - - ASSERT(pnp->pr_type == PR_XREGS); - - xreg = kmem_zalloc(sizeof (prxregset_t), KM_SLEEP); - - if ((error = prlock(pnp, ZNO)) != 0) - goto out; - - p = pnp->pr_common->prc_proc; - t = pnp->pr_common->prc_thread; - - size = prhasx(p)? prgetprxregsize(p) : 0; - if (uiop->uio_offset >= size) { - prunlock(pnp); - goto out; - } - - /* drop p->p_lock while (possibly) touching the stack */ - mutex_exit(&p->p_lock); - prgetprxregs(ttolwp(t), xreg); - mutex_enter(&p->p_lock); - prunlock(pnp); - - error = pr_uioread(xreg, size, uiop); -out: - kmem_free(xreg, sizeof (prxregset_t)); - return (error); -#else return (0); -#endif } static int @@ -1618,88 +1567,6 @@ pr_read_secflags(prnode_t *pnp, uio_t *uiop) return (pr_uioread(&ret, sizeof (ret), uiop)); } -#if defined(__sparc) - -static int -pr_read_gwindows(prnode_t *pnp, uio_t *uiop) -{ - proc_t *p; - kthread_t *t; - gwindows_t *gwp; - int error; - size_t size; - - ASSERT(pnp->pr_type == PR_GWINDOWS); - - gwp = kmem_zalloc(sizeof (gwindows_t), KM_SLEEP); - - if ((error = prlock(pnp, ZNO)) != 0) - goto out; - - p = pnp->pr_common->prc_proc; - t = pnp->pr_common->prc_thread; - - /* - * Drop p->p_lock while touching the stack. - * The P_PR_LOCK flag prevents the lwp from - * disappearing while we do this. - */ - mutex_exit(&p->p_lock); - if ((size = prnwindows(ttolwp(t))) != 0) - size = sizeof (gwindows_t) - - (SPARC_MAXREGWINDOW - size) * sizeof (struct rwindow); - if (uiop->uio_offset >= size) { - mutex_enter(&p->p_lock); - prunlock(pnp); - goto out; - } - prgetwindows(ttolwp(t), gwp); - mutex_enter(&p->p_lock); - prunlock(pnp); - - error = pr_uioread(gwp, size, uiop); -out: - kmem_free(gwp, sizeof (gwindows_t)); - return (error); -} - -/* ARGSUSED */ -static int -pr_read_asrs(prnode_t *pnp, uio_t *uiop) -{ - int error; - - ASSERT(pnp->pr_type == PR_ASRS); - - /* the asrs file exists only for sparc v9 _LP64 processes */ - if ((error = prlock(pnp, ZNO)) == 0) { - proc_t *p = pnp->pr_common->prc_proc; - kthread_t *t = pnp->pr_common->prc_thread; - asrset_t asrset; - - if (p->p_model != DATAMODEL_LP64 || - uiop->uio_offset >= sizeof (asrset_t)) { - prunlock(pnp); - return (0); - } - - /* - * Drop p->p_lock while touching the stack. - * The P_PR_LOCK flag prevents the lwp from - * disappearing while we do this. - */ - mutex_exit(&p->p_lock); - prgetasregs(ttolwp(t), asrset); - mutex_enter(&p->p_lock); - prunlock(pnp); - - error = pr_uioread(&asrset[0], sizeof (asrset_t), uiop); - } - - return (error); -} - -#endif /* __sparc */ static int pr_read_piddir(prnode_t *pnp, uio_t *uiop) @@ -3147,46 +3014,6 @@ prgetattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, vap->va_size = 0; } break; -#if defined(__sparc) - case PR_GWINDOWS: - { - kthread_t *t; - int n; - - /* - * If there is no lwp then just make the size zero. - * This can happen if the lwp exits between the fop_lookup() - * of the /proc//lwp//gwindows file and the - * fop_getattr() of the resulting vnode. - */ - if ((t = pcp->prc_thread) == NULL) { - vap->va_size = 0; - break; - } - /* - * Drop p->p_lock while touching the stack. - * The P_PR_LOCK flag prevents the lwp from - * disappearing while we do this. - */ - mutex_exit(&p->p_lock); - if ((n = prnwindows(ttolwp(t))) == 0) - vap->va_size = 0; - else - vap->va_size = PR_OBJSIZE(gwindows32_t, gwindows_t) - - (SPARC_MAXREGWINDOW - n) * - PR_OBJSIZE(struct rwindow32, struct rwindow); - mutex_enter(&p->p_lock); - break; - } - case PR_ASRS: -#ifdef _LP64 - if (p->p_model == DATAMODEL_LP64) - vap->va_size = sizeof (asrset_t); - else -#endif - vap->va_size = 0; - break; -#endif case PR_CTL: case PR_LWPCTL: default: @@ -3348,10 +3175,6 @@ static vnode_t *(*pr_lookup_function[PR_NFILES])() = { pr_lookup_tmpldir, /* /proc//lwp//templates */ pr_lookup_notdir, /* /proc//lwp//templates/ */ pr_lookup_notdir, /* /proc//lwp//spymaster */ -#if defined(__sparc) - pr_lookup_notdir, /* /proc//lwp//gwindows */ - pr_lookup_notdir, /* /proc//lwp//asrs */ -#endif pr_lookup_notdir, /* /proc//priv */ pr_lookup_pathdir, /* /proc//path */ pr_lookup_notdir, /* /proc//path/xxx */ @@ -3958,14 +3781,6 @@ pr_lookup_lwpiddir(vnode_t *dp, char *comp) } } -#if defined(__sparc) - /* the asrs file exists only for sparc v9 _LP64 processes */ - if (type == PR_ASRS && p->p_model != DATAMODEL_LP64) { - prunlock(dpnp); - prfreenode(pnp); - return (NULL); - } -#endif mutex_enter(&dpnp->pr_mutex); @@ -4712,10 +4527,6 @@ static int (*pr_readdir_function[PR_NFILES])() = { pr_readdir_tmpldir, /* /proc//lwp//templates */ pr_readdir_notdir, /* /proc//lwp//templates/ */ pr_readdir_notdir, /* /proc//lwp//spymaster */ -#if defined(__sparc) - pr_readdir_notdir, /* /proc//lwp//gwindows */ - pr_readdir_notdir, /* /proc//lwp//asrs */ -#endif pr_readdir_notdir, /* /proc//priv */ pr_readdir_pathdir, /* /proc//path */ pr_readdir_notdir, /* /proc//path/xxx */ @@ -5210,12 +5021,6 @@ pr_readdir_lwpiddir(prnode_t *pnp, uio_t *uiop, int *eofp) continue; } } -#if defined(__sparc) - /* the asrs file exists only for sparc v9 _LP64 processes */ - if (dirp->d_ino == PR_ASRS && - pcp->prc_datamodel != DATAMODEL_LP64) - continue; -#endif bcopy(dirp, &dirent, sizeof (prdirent_t)); if (dirent.d_ino == PR_LWPDIR) dirent.d_ino = pmkino(0, pslot, dirp->d_ino); diff --git a/kernel/fs/vfs.c b/kernel/fs/vfs.c index 6766e886c8..7b353bf1ae 100644 --- a/kernel/fs/vfs.c +++ b/kernel/fs/vfs.c @@ -4187,31 +4187,6 @@ vfs_rele(vfs_t *vfsp) } } -#ifdef __sparc - -/* - * Part of the implementation of booting off a mirrored root - * involves a change of dev_t for the root device. To - * accomplish this, first remove the existing hash table - * entry for the root device, convert to the new dev_t, - * then re-insert in the hash table at the head of the list. - */ -void -vfs_root_redev(vfs_t *vfsp, dev_t ndev, int fstype) -{ - vfs_list_lock(); - - vfs_hash_remove(vfsp); - - vfsp->vfs_dev = ndev; - vfs_make_fsid(&vfsp->vfs_fsid, ndev, fstype); - - vfs_hash_add(vfsp, 1); - - vfs_list_unlock(); -} - -#else /* x86 NEWBOOT */ #if defined(__x86) extern int hvmboot_rootconf(); @@ -4395,7 +4370,6 @@ getrootfs(char **fstypp, char **fsmodp) *fstypp = rootfs.bo_fstype; *fsmodp = "nfs"; } -#endif /* * VFS feature routines diff --git a/kernel/fs/zfs/lz4.c b/kernel/fs/zfs/lz4.c index 3aa1b74ef3..6d4c06b5f4 100644 --- a/kernel/fs/zfs/lz4.c +++ b/kernel/fs/zfs/lz4.c @@ -237,9 +237,6 @@ lz4_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n) #define LZ4_FORCE_UNALIGNED_ACCESS 1 #endif -#ifdef __sparc -#define LZ4_FORCE_SW_BITCOUNT -#endif /* * Compiler Options diff --git a/kernel/krtld/kobj.c b/kernel/krtld/kobj.c index 9e5b88da55..199632886e 100644 --- a/kernel/krtld/kobj.c +++ b/kernel/krtld/kobj.c @@ -280,11 +280,7 @@ static caddr_t _data; * variable to modify it - within krtld, of course - * outside of krtld, e_data is used in all kernels. */ -#if defined(__sparc) -static caddr_t _edata; -#else extern caddr_t _edata; -#endif Addr dynseg = 0; /* load address of "dynamic" segment */ size_t dynsize; /* "dynamic" segment size */ @@ -855,13 +851,6 @@ load_exec(val_t *bootaux, char *filename) if (sp->st_name == 0 || sp->st_shndx == SHN_UNDEF) continue; -#if defined(__sparc) - /* - * Register symbols are ignored in the kernel - */ - if (ELF_ST_TYPE(sp->st_info) == STT_SPARC_REGISTER) - continue; -#endif /* __sparc */ sym_insert(mp, mp->strings + sp->st_name, i); } @@ -2980,21 +2969,6 @@ do_symbols(struct module *mp, Elf64_Addr bss_base) name = mp->strings + sp->st_name; if (sp->st_shndx != SHN_UNDEF && sp->st_shndx != SHN_COMMON) continue; -#if defined(__sparc) - /* - * Register symbols are ignored in the kernel - */ - if (ELF_ST_TYPE(sp->st_info) == STT_SPARC_REGISTER) { - if (*name != '\0') { - _kobj_printf(ops, "%s: named REGISTER symbol ", - mp->filename); - _kobj_printf(ops, "not supported '%s'\n", - name); - err = DOSYM_UNDEF; - } - continue; - } -#endif /* __sparc */ /* * TLS symbols are ignored in the kernel */ @@ -4094,11 +4068,6 @@ kobj_segbrk(caddr_t *spp, size_t size, size_t align, caddr_t limit) alloc_pgsz = lg_pagesize; } -#if defined(__sparc) - /* account for redzone */ - if (limit) - limit -= alloc_pgsz; -#endif /* __sparc */ va = ALIGN((uintptr_t)*spp, align); pva = P2ROUNDUP((uintptr_t)*spp, alloc_pgsz); diff --git a/kernel/os/autoconf.c b/kernel/os/autoconf.c index 229c250a64..e30bd309e9 100644 --- a/kernel/os/autoconf.c +++ b/kernel/os/autoconf.c @@ -366,11 +366,7 @@ create_devinfo_tree(void) pnode_t nodeid; i_ddi_node_cache_init(); -#if defined(__sparc) - nodeid = prom_nextnode(0); -#else /* x86 */ nodeid = DEVI_SID_NODEID; -#endif top_devinfo = i_ddi_alloc_node(NULL, rootname, nodeid, -1, NULL, KM_SLEEP); ndi_hold_devi(top_devinfo); /* never release the root */ @@ -395,7 +391,6 @@ create_devinfo_tree(void) */ di_dfs(ddi_root_node(), get_neighbors, 0); -#if !defined(__sparc) /* * On x86, there is no prom. Create device tree by * probing pci config space @@ -404,7 +399,6 @@ create_devinfo_tree(void) extern void impl_setup_ddi(void); impl_setup_ddi(); } -#endif /* x86 */ } /* diff --git a/kernel/os/bp_map.c b/kernel/os/bp_map.c index 0fd5a5d216..2c5888072f 100644 --- a/kernel/os/bp_map.c +++ b/kernel/os/bp_map.c @@ -38,12 +38,7 @@ #include #include -#ifdef __sparc -#include -#define BP_FLUSH(addr, size) flush_instr_mem((void *)addr, size); -#else #define BP_FLUSH(addr, size) -#endif int bp_force_copy = 0; typedef enum { diff --git a/kernel/os/core.c b/kernel/os/core.c index b3c12a80de..0ff74898d1 100644 --- a/kernel/os/core.c +++ b/kernel/os/core.c @@ -434,9 +434,6 @@ do_core(char *fp, int sig, enum core_types core_type, struct core_globals *cg) if (error == 0) { int closerr; -#if defined(__sparc) - (void) flush_user_windows_to_stack(NULL); -#endif if ((eswp = PTOU(curproc)->u_execsw) == NULL || (eswp = findexec_by_magic(eswp->exec_magic)) == NULL) { error = ENOSYS; diff --git a/kernel/os/dtrace_subr.c b/kernel/os/dtrace_subr.c index 680f04a958..e04b343d61 100644 --- a/kernel/os/dtrace_subr.c +++ b/kernel/os/dtrace_subr.c @@ -33,9 +33,6 @@ #include #include -#ifdef __sparc -#include -#endif void (*dtrace_cpu_init)(processorid_t); void (*dtrace_modload)(struct modctl *); diff --git a/kernel/os/exec.c b/kernel/os/exec.c index 7db6a17cb6..bd355249a3 100644 --- a/kernel/os/exec.c +++ b/kernel/os/exec.c @@ -422,10 +422,6 @@ exec_common(const char *fname, const char **argp, const char **envp, ASSERT(curthread->t_schedctl == NULL); -#if defined(__sparc) - if (p->p_utraps != NULL) - utrap_free(p); -#endif /* __sparc */ /* * Close all close-on-exec files. @@ -1926,13 +1922,6 @@ exec_args(execa_t *uap, uarg_t *args, intpdata_t *intp, void **auxvpp) ASSERT(P2PHASE((uintptr_t)usrstack, args->stk_align) == 0); -#if defined(__sparc) - /* - * Make sure user register windows are empty before - * attempting to make a new stack. - */ - (void) flush_user_windows_to_stack(NULL); -#endif for (size = PAGESIZE; ; size *= 2) { args->stk_size = size; diff --git a/kernel/os/exit.c b/kernel/os/exit.c index a24cea16a9..c8b8caf005 100644 --- a/kernel/os/exit.c +++ b/kernel/os/exit.c @@ -557,10 +557,6 @@ proc_exit(int why, int what) ASSERT(p == curproc); (void) freectty(B_TRUE); -#if defined(__sparc) - if (p->p_utraps != NULL) - utrap_free(p); -#endif if (p->p_semacct) /* IPC semaphore exit */ semexit(p); rv = wstat(why, what); diff --git a/kernel/os/fork.c b/kernel/os/fork.c index ff559c5e65..b2e8030d65 100644 --- a/kernel/os/fork.c +++ b/kernel/os/fork.c @@ -207,13 +207,6 @@ cfork(int isvfork, int isfork1, int flags) goto forkerr; } -#if defined(__sparc) - /* - * Ensure that the user stack is fully constructed - * before creating the child process structure. - */ - (void) flush_user_windows_to_stack(NULL); -#endif mutex_enter(&p->p_lock); /* @@ -476,9 +469,6 @@ cfork(int isvfork, int isfork1, int flags) if (p->p_pctx) forkpctx(p, cp); -#ifdef __sparc - utrap_dup(p, cp); -#endif /* * If the child process has been marked to stop on exit * from this fork, arrange for all other lwps to stop in diff --git a/kernel/os/kdi.c b/kernel/os/kdi.c index 482c47dd84..216dc16646 100644 --- a/kernel/os/kdi.c +++ b/kernel/os/kdi.c @@ -60,24 +60,6 @@ kdi_dvec_handle_fault(greg_t trapno, greg_t pc, greg_t sp, int cpuid) } #endif -#if defined(__sparc) -/* - * Called on the CPU being initialized - */ -void -kdi_dvec_cpu_init(struct cpu *cp) -{ - kdi_dvec->dv_kctl_cpu_init(); - kdi_dvec->dv_cpu_init(cp); -} - -void -kdi_dvec_cpr_restart(void) -{ - kdi_dvec->dv_kctl_cpu_init(); - kdi_dvec->dv_cpr_restart(); -} -#endif /* __sparc */ void kdi_dvec_modavail(void) diff --git a/kernel/os/kstat_fr.c b/kernel/os/kstat_fr.c index 93c04cff8d..9b3a901e18 100644 --- a/kernel/os/kstat_fr.c +++ b/kernel/os/kstat_fr.c @@ -863,11 +863,7 @@ system_misc_kstat_update(kstat_t *ksp, int rw) return (0); } -#ifdef __sparc -extern caddr_t econtig32; -#else /* !__sparc */ extern caddr_t econtig; -#endif /* __sparc */ /* ARGSUSED */ static int @@ -887,17 +883,7 @@ system_pages_kstat_update(kstat_t *ksp, int rw) system_pages_kstat.nfree_calls.value.ul = kobj_stat.nfree_calls; system_pages_kstat.kernelbase.value.ul = (ulong_t)KERNELBASE; -#ifdef __sparc - /* - * kstat should REALLY be modified to also report kmem64_base and - * kmem64_end (see sun4u/os/startup.c), as the virtual address range - * [ kernelbase .. econtig ] no longer is truly reflective of the - * kernel's vallocs... - */ - system_pages_kstat.econtig.value.ul = (ulong_t)econtig32; -#else /* !__sparc */ system_pages_kstat.econtig.value.ul = (ulong_t)econtig; -#endif /* __sparc */ system_pages_kstat.freemem.value.ul = (ulong_t)freemem; system_pages_kstat.availrmem.value.ul = (ulong_t)availrmem; diff --git a/kernel/os/lwp.c b/kernel/os/lwp.c index 9ba92a3900..44653c33d7 100644 --- a/kernel/os/lwp.c +++ b/kernel/os/lwp.c @@ -869,12 +869,6 @@ lwp_exit(void) mutex_exit(&p->p_lock); -#if defined(__sparc) - /* - * Ensure that the user stack is fully abandoned.. - */ - trash_user_windows(); -#endif tsd_exit(); /* free thread specific data */ @@ -1810,10 +1804,6 @@ forklwp(klwp_t *lwp, proc_t *cp, id_t lwpid) ASSERT(p == curproc); ASSERT(t == curthread || (SUSPENDED(t) && lwp->lwp_asleep == 0)); -#if defined(__sparc) - if (t == curthread) - (void) flush_user_windows_to_stack(NULL); -#endif if (t == curthread) /* copy args out of registers first */ @@ -1850,9 +1840,6 @@ forklwp(klwp_t *lwp, proc_t *cp, id_t lwpid) /* fix up child's lwp */ clwp->lwp_pcb.pcb_flags = 0; -#if defined(__sparc) - clwp->lwp_pcb.pcb_step = STEP_NONE; -#endif clwp->lwp_cursig = 0; clwp->lwp_extsig = 0; clwp->lwp_curinfo = NULL; diff --git a/kernel/os/main.c b/kernel/os/main.c index 92ec21a2b0..0766abd182 100644 --- a/kernel/os/main.c +++ b/kernel/os/main.c @@ -401,10 +401,6 @@ main(void) vmobject_init(&kvps[KV_KVP].v_object, &kvps[KV_KVP]); vmobject_init(&kvps[KV_ZVP].v_object, &kvps[KV_ZVP]); -#if defined(__sparc) - vmobject_init(&kvps[KV_MPVP].v_object, &kvps[KV_MPVP]); - vmobject_init(&kvps[KV_PROMVP].v_object, &kvps[KV_PROMVP]); -#endif /* * Once 'startup()' completes, the thread_reaper() daemon would be @@ -509,9 +505,7 @@ main(void) * and swap have been set up. */ consconfig(); -#ifndef __sparc release_bootstrap(); -#endif /* * attach drivers with ddi-forceattach prop @@ -560,13 +554,6 @@ main(void) */ start_other_cpus(0); -#ifdef __sparc - /* - * Release bootstrap here since PROM interfaces are - * used to start other CPUs above. - */ - release_bootstrap(); -#endif /* * Finish lgrp initialization after all CPUS are brought online. diff --git a/kernel/os/mem_cage.c b/kernel/os/mem_cage.c index d668ae93dd..5d42627239 100644 --- a/kernel/os/mem_cage.c +++ b/kernel/os/mem_cage.c @@ -1599,10 +1599,6 @@ kcage_invalidate_page(page_t *pp, pgcnt_t *nfreedp) { int result; -#if defined(__sparc) - VERIFY(pp->p_object != &promvp.v_object); - ASSERT(pp->p_vnode != &promvp); -#endif /* __sparc */ ASSERT(!PP_ISFREE(pp)); ASSERT(PAGE_EXCL(pp)); diff --git a/kernel/os/mmapobj.c b/kernel/os/mmapobj.c index de407e04e7..7813816567 100644 --- a/kernel/os/mmapobj.c +++ b/kernel/os/mmapobj.c @@ -1323,15 +1323,6 @@ calc_loadable(Ehdr *ehdrp, caddr_t phdrbase, int nphdrs, size_t *len, size_t max_align = 0; size_t min_align = PAGESIZE; /* needed for vmem_xalloc */ STRUCT_HANDLE(myphdr, mph); -#if defined(__sparc) - extern int vac_size; - - /* - * Want to prevent aliasing by making the start address at least be - * aligned to vac_size. - */ - min_align = MAX(PAGESIZE, vac_size); -#endif model = get_udatamodel(); STRUCT_SET_HANDLE(mph, model, (struct myphdr *)phdrbase); diff --git a/kernel/os/pcifm.c b/kernel/os/pcifm.c index f8c0251476..2acc856c8e 100644 --- a/kernel/os/pcifm.c +++ b/kernel/os/pcifm.c @@ -56,9 +56,6 @@ pci_fm_err_t pci_bdg_err_tbl[] = { PCI_DET_PERR, PCI_STAT_PERROR, NULL, DDI_FM_UNKNOWN, PCI_MDPE, PCI_STAT_S_PERROR, PCI_TARG_MDPE, DDI_FM_UNKNOWN, PCI_REC_SERR, PCI_STAT_S_SYSERR, NULL, DDI_FM_UNKNOWN, -#if defined(__sparc) - PCI_MA, PCI_STAT_R_MAST_AB, PCI_TARG_MA, DDI_FM_UNKNOWN, -#endif PCI_REC_TA, PCI_STAT_R_TARG_AB, PCI_TARG_REC_TA, DDI_FM_UNKNOWN, PCI_SIG_TA, PCI_STAT_S_TARG_AB, NULL, DDI_FM_UNKNOWN, NULL, 0, NULL, 0, @@ -1306,20 +1303,6 @@ pci_check_regs(dev_info_t *dip, void *arg) static void pci_fix_ranges(dev_info_t *dip, pci_ranges_t *pci_ranges, int nrange) { -#if defined(__sparc) - char *name = ddi_binding_name(dip); - - if ((strcmp(name, "pci108e,8000") == 0) || - (strcmp(name, "pci108e,a000") == 0) || - (strcmp(name, "pci108e,a001") == 0)) { - int i; - for (i = 0; i < nrange; i++, pci_ranges++) - if ((pci_ranges->child_high & PCI_REG_ADDR_M) == - PCI_ADDR_CONFIG) - pci_ranges->parent_low |= - pci_ranges->child_high; - } -#endif } static int diff --git a/kernel/os/rctl_proc.c b/kernel/os/rctl_proc.c index 9b7324fe7b..9be3c51dfa 100644 --- a/kernel/os/rctl_proc.c +++ b/kernel/os/rctl_proc.c @@ -247,13 +247,8 @@ rctlproc_default_init(struct proc *initp, rctl_alloc_gp_t *gp) /* * RLIMIT_STACK: deny always, no default action. */ -#ifdef __sparc - rlp64.rlim_cur = DFLSSIZ; - rlp64.rlim_max = LONG_MAX; -#else rlp64.rlim_cur = DFLSSIZ; rlp64.rlim_max = MAXSSIZ; -#endif (void) rctl_rlimit_set(rctlproc_legacy[RLIMIT_STACK], initp, &rlp64, gp, RCTL_LOCAL_DENY, 0, kcred); diff --git a/kernel/os/subr.c b/kernel/os/subr.c index 00cfe671b2..784d1add80 100644 --- a/kernel/os/subr.c +++ b/kernel/os/subr.c @@ -52,9 +52,6 @@ #include #include -#ifdef __sparc -#include -#endif /* * Routine which sets a user error; placed in @@ -397,9 +394,6 @@ void no_trap(void) { if (curthread->t_ontrap != NULL) { -#ifdef __sparc - membar_sync(); /* deferred error barrier (see sparcv9_subr.s) */ -#endif curthread->t_ontrap = curthread->t_ontrap->ot_prev; } } diff --git a/kernel/os/sunddi.c b/kernel/os/sunddi.c index d9e02f0aad..ca89706faa 100644 --- a/kernel/os/sunddi.c +++ b/kernel/os/sunddi.c @@ -616,7 +616,6 @@ ddi_peekpokeio(dev_info_t *devi, struct uio *uio, enum uio_rw rw, * On sparc, they're implemented in assembler to avoid spilling * register windows in the common (copyin) case .. */ -#if !defined(__sparc) int ddi_copyin(const void *buf, void *kernbuf, size_t size, int flags) { @@ -632,7 +631,6 @@ ddi_copyout(const void *buf, void *kernbuf, size_t size, int flags) return (kcopy(buf, kernbuf, size) ? -1 : 0); return (copyout(buf, kernbuf, size)); } -#endif /* !__sparc */ /* * Conversions in nexus pagesize units. We don't duplicate the @@ -682,7 +680,6 @@ ddi_exit_critical(unsigned int spl) * Nexus ctlops punter */ -#if !defined(__sparc) /* * Request bus_ctl parent to handle a bus_ctl request * @@ -703,13 +700,11 @@ ddi_ctlops(dev_info_t *d, dev_info_t *r, ddi_ctl_enum_t op, void *a, void *v) return ((*fp)(d, r, op, a, v)); } -#endif /* * DMA/DVMA setup */ -#if !defined(__sparc) /* * Request bus_dma_ctl parent to fiddle with a dma request. * @@ -727,7 +722,6 @@ ddi_dma_mctl(dev_info_t *dip, dev_info_t *rdip, fp = DEVI(dip)->devi_ops->devo_bus_ops->bus_dma_ctl; return ((*fp) (dip, rdip, handle, request, offp, lenp, objp, flags)); } -#endif /* * For all DMA control functions, call the DMA control @@ -755,7 +749,6 @@ ddi_dma_map(dev_info_t *dip, dev_info_t *rdip, return (DDI_FAILURE); } -#if !defined(__sparc) /* * The SPARC versions of these routines are done in assembler to @@ -886,7 +879,6 @@ ddi_dma_unbind_handle(ddi_dma_handle_t h) return ((*funcp)(dip, rdip, h)); } -#endif /* !__sparc */ /* * DMA burst sizes, and transfer minimums diff --git a/kernel/os/sunndi.c b/kernel/os/sunndi.c index 93c66fbcf9..9a1b8a121d 100644 --- a/kernel/os/sunndi.c +++ b/kernel/os/sunndi.c @@ -68,10 +68,6 @@ #include #include -#ifdef __sparc -#include /* getpil/setpil */ -#include /* membar_sync */ -#endif /* * ndi property handling diff --git a/kernel/os/sunpci.c b/kernel/os/sunpci.c index 70e0883496..5389ad2a22 100644 --- a/kernel/os/sunpci.c +++ b/kernel/os/sunpci.c @@ -376,12 +376,8 @@ pci_save_config_regs(dev_info_t *dip) uint32_t *regbuf, *p; uint8_t *maskbuf; size_t maskbufsz, regbufsz, capbufsz; -#ifdef __sparc - ddi_acc_hdl_t *hp; -#else ddi_device_acc_attr_t attr; caddr_t cfgaddr; -#endif off_t offset = 0; uint8_t cap_ptr, cap_id; int pcie = 0; @@ -390,14 +386,6 @@ pci_save_config_regs(dev_info_t *dip) PMD(PMD_SX, ("pci_save_config_regs %s:%d\n", ddi_driver_name(dip), ddi_get_instance(dip))) -#ifdef __sparc - if (pci_config_setup(dip, &confhdl) != DDI_SUCCESS) { - cmn_err(CE_WARN, "%s%d can't get config handle", - ddi_driver_name(dip), ddi_get_instance(dip)); - - return (DDI_FAILURE); - } -#else /* Set up cautious config access handle */ attr.devacc_attr_version = DDI_DEVICE_ATTR_V1; attr.devacc_attr_endian_flags = DDI_STRUCTURE_LE_ACC; @@ -410,7 +398,6 @@ pci_save_config_regs(dev_info_t *dip) return (DDI_FAILURE); } -#endif /* * Determine if it implements capabilities @@ -451,22 +438,13 @@ no_cap: maskbufsz = (size_t)((PCIE_CONF_HDR_SIZE/ sizeof (uint32_t)) >> INDEX_SHIFT); maskbuf = kmem_zalloc(maskbufsz, KM_SLEEP); -#ifdef __sparc - hp = impl_acc_hdl_get(confhdl); -#endif for (i = 0; i < (PCIE_CONF_HDR_SIZE / sizeof (uint32_t)); i++) { -#ifdef __sparc - ret = ddi_peek32(dip, (int32_t *)(hp->ah_addr + offset), - (int32_t *)p); - if (ret == DDI_SUCCESS) { -#else /* * ddi_peek doesn't work on x86, so we use cautious pci * config access instead. */ *p = pci_config_get32(confhdl, offset); if (*p != -1) { -#endif /* it is readable register. set the bit */ maskbuf[i >> INDEX_SHIFT] |= (uint8_t)(1 << (i & BITMASK)); diff --git a/kernel/os/sunpm.c b/kernel/os/sunpm.c index 72cf9f3183..32c092059d 100644 --- a/kernel/os/sunpm.c +++ b/kernel/os/sunpm.c @@ -363,7 +363,6 @@ pm_cpupm_t cpupm_default_mode = PM_CPUPM_EVENT; */ int autoS3_enabled; -#if !defined(__sparc) /* * on sparc these live in fillsysinfo.c * @@ -380,7 +379,6 @@ int cpr_supported_override; */ int cpr_platform_enable = 0; -#endif /* * pm_S3_enabled indicates that we believe the platform can support S3, diff --git a/kernel/os/sysent.c b/kernel/os/sysent.c index 057b6d7663..eb85202980 100644 --- a/kernel/os/sysent.c +++ b/kernel/os/sysent.c @@ -193,10 +193,6 @@ int seteuid(uid_t); int setreuid(uid_t, uid_t); int setregid(gid_t, gid_t); int install_utrap(utrap_entry_t type, utrap_handler_t, utrap_handler_t *); -#ifdef __sparc -int sparc_utrap_install(utrap_entry_t type, utrap_handler_t, - utrap_handler_t, utrap_handler_t *, utrap_handler_t *); -#endif int syslwp_create(ucontext_t *, int, id_t *); void syslwp_exit(); @@ -360,11 +356,7 @@ typedef int64_t (*llfcn_t)(); /* for casting one-word returns */ #define IF_LP64(true, false) false #endif -#if defined(__sparc) -#define IF_sparc(true, false) true -#else #define IF_sparc(true, false) false -#endif #if defined(__i386) && !defined(__amd64) #define IF_i386(true, false) true diff --git a/kernel/syscall/sigaction.c b/kernel/syscall/sigaction.c index 5bbc984928..3fabff2986 100644 --- a/kernel/syscall/sigaction.c +++ b/kernel/syscall/sigaction.c @@ -57,20 +57,8 @@ sigaction(int sig, struct sigaction *actp, struct sigaction *oactp) * act and oact might be the same address, so copyin act first. */ if (actp) { -#if defined(__sparc) - void (*handler)(); -#endif if (copyin(actp, &act, sizeof (act))) return (set_errno(EFAULT)); -#if defined(__sparc) - /* - * Check alignment of handler - */ - handler = act.sa_handler; - if (handler != SIG_IGN && handler != SIG_DFL && - ((uintptr_t)handler & 0x3) != 0) - return (set_errno(EINVAL)); -#endif } p = curproc; diff --git a/kernel/syscall/uadmin.c b/kernel/syscall/uadmin.c index b0f8873ba5..b4165daec1 100644 --- a/kernel/syscall/uadmin.c +++ b/kernel/syscall/uadmin.c @@ -312,13 +312,11 @@ kadmin(int cmd, int fcn, void *mdep, cred_t *credp) case A_CONFIG: switch (fcn) { case AD_UPDATE_BOOT_CONFIG: -#ifndef __sparc { extern void fastboot_update_config(const char *); fastboot_update_config(mdep); } -#endif break; } @@ -383,11 +381,9 @@ kadmin(int cmd, int fcn, void *mdep, cred_t *credp) } else panic_bootstr = mdep; -#ifndef __sparc extern void fastboot_update_and_load(int, char *); fastboot_update_and_load(fcn, mdep); -#endif panic("forced crash dump initiated at user request"); /*NOTREACHED*/ diff --git a/kernel/vm/seg_kmem.c b/kernel/vm/seg_kmem.c index 32534f0dc4..b240f07b98 100644 --- a/kernel/vm/seg_kmem.c +++ b/kernel/vm/seg_kmem.c @@ -48,10 +48,6 @@ #include #include -#ifdef __sparc -#include -#include -#endif /* * seg_kmem is the primary kernel memory segment driver. It @@ -228,25 +224,10 @@ kernelheap_init( size_t heap_size; vmem_t *heaptext_parent; size_t heap_lp_size = 0; -#ifdef __sparc - size_t kmem64_sz = kmem64_aligned_end - kmem64_base; -#endif /* __sparc */ kernelheap = heap_start; ekernelheap = heap_end; -#ifdef __sparc - heap_lp_size = (((uintptr_t)heap_end - (uintptr_t)heap_start) / 4); - /* - * Bias heap_lp start address by kmem64_sz to reduce collisions - * in 4M kernel TSB between kmem64 area and heap_lp - */ - kmem64_sz = P2ROUNDUP(kmem64_sz, MMU_PAGESIZE256M); - if (kmem64_sz <= heap_lp_size / 2) - heap_lp_size -= kmem64_sz; - heap_lp_base = ekernelheap - heap_lp_size; - heap_lp_end = heap_lp_base + heap_lp_size; -#endif /* __sparc */ /* * If this platform has a 'core' heap area, then the space for @@ -260,12 +241,10 @@ kernelheap_init( textbase = (uintptr_t)core_end - HEAPTEXT_SIZE; core_size -= HEAPTEXT_SIZE; } -#ifndef __sparc else { ekernelheap -= HEAPTEXT_SIZE; textbase = (uintptr_t)ekernelheap; } -#endif heap_size = (uintptr_t)ekernelheap - (uintptr_t)kernelheap; heap_arena = vmem_init("heap", kernelheap, heap_size, PAGESIZE, @@ -298,29 +277,8 @@ kernelheap_init( (void) vmem_xalloc(heap_arena, first_avail - kernelheap, PAGESIZE, 0, 0, kernelheap, first_avail, VM_NOSLEEP | VM_BESTFIT | VM_PANIC); -#ifdef __sparc - heap32_arena = vmem_create("heap32", (void *)SYSBASE32, - SYSLIMIT32 - SYSBASE32 - HEAPTEXT_SIZE, PAGESIZE, NULL, - NULL, NULL, 0, VM_SLEEP); - /* - * Prom claims the physical and virtual resources used by panicbuf - * and inter_vec_table. So reserve space for panicbuf, intr_vec_table, - * reserved interrupt vector data structures from 32-bit heap. - */ - (void) vmem_xalloc(heap32_arena, PANICBUFSIZE, PAGESIZE, 0, 0, - panicbuf, panicbuf + PANICBUFSIZE, - VM_NOSLEEP | VM_BESTFIT | VM_PANIC); - - (void) vmem_xalloc(heap32_arena, IVSIZE, PAGESIZE, 0, 0, - intr_vec_table, (caddr_t)intr_vec_table + IVSIZE, - VM_NOSLEEP | VM_BESTFIT | VM_PANIC); - - textbase = SYSLIMIT32 - HEAPTEXT_SIZE; - heaptext_parent = NULL; -#else /* __sparc */ heap32_arena = heap_core_arena; heaptext_parent = heap_core_arena; -#endif /* __sparc */ heaptext_arena = vmem_create("heaptext", (void *)textbase, HEAPTEXT_SIZE, PAGESIZE, NULL, NULL, heaptext_parent, 0, VM_SLEEP); @@ -419,13 +377,8 @@ boot_alloc(void *inaddr, size_t size, uint_t align) "BOP_GONE"); size = ptob(btopr(size)); -#ifdef __sparc - if (bop_alloc_chunk(addr, size, align) != (caddr_t)addr) - panic("boot_alloc: bop_alloc_chunk failed"); -#else if (BOP_ALLOC(bootops, addr, size, align) != addr) panic("boot_alloc: BOP_ALLOC failed"); -#endif boot_mapin((caddr_t)addr, size); return (addr); } @@ -644,10 +597,8 @@ segkmem_dump(struct seg *seg) if (seg == &kvseg) { vmem_walk(heap_arena, VMEM_ALLOC | VMEM_REENTRANT, segkmem_dump_range, seg->s_as); -#ifndef __sparc vmem_walk(heaptext_arena, VMEM_ALLOC | VMEM_REENTRANT, segkmem_dump_range, seg->s_as); -#endif } else if (seg == &kvseg_core) { vmem_walk(heap_core_arena, VMEM_ALLOC | VMEM_REENTRANT, segkmem_dump_range, seg->s_as); @@ -927,11 +878,9 @@ segkmem_alloc_vn(vmem_t *vmp, size_t size, int vmflag, struct vnode *vp) ASSERT(vp != NULL); if (kvseg.s_base == NULL) { -#ifndef __sparc if (bootops->bsys_alloc == NULL) halt("Memory allocation between bop_alloc() and " "kmem_alloc().\n"); -#endif /* * There's not a lot of memory to go around during boot, @@ -1444,65 +1393,6 @@ segkmem_lpsetup() { int use_large_pages = 0; -#ifdef __sparc - - size_t memtotal = physmem * PAGESIZE; - - if (heap_lp_base == NULL) { - segkmem_lpsize = PAGESIZE; - return (0); - } - - /* get a platform dependent value of large page size for kernel heap */ - segkmem_lpsize = get_segkmem_lpsize(segkmem_lpsize); - - if (segkmem_lpsize <= PAGESIZE) { - /* - * put virtual space reserved for the large page kernel - * back to the regular heap - */ - vmem_xfree(heap_arena, heap_lp_base, - heap_lp_end - heap_lp_base); - heap_lp_base = NULL; - heap_lp_end = NULL; - segkmem_lpsize = PAGESIZE; - return (0); - } - - /* set heap_lp quantum if necessary */ - if (segkmem_heaplp_quantum == 0 || !ISP2(segkmem_heaplp_quantum) || - P2PHASE(segkmem_heaplp_quantum, segkmem_lpsize)) { - segkmem_heaplp_quantum = segkmem_lpsize; - } - - /* set kmem_lp quantum if necessary */ - if (segkmem_kmemlp_quantum == 0 || !ISP2(segkmem_kmemlp_quantum) || - segkmem_kmemlp_quantum > segkmem_heaplp_quantum) { - segkmem_kmemlp_quantum = segkmem_heaplp_quantum; - } - - /* set total amount of memory allowed for large page kernel heap */ - if (segkmem_kmemlp_max == 0) { - if (segkmem_kmemlp_pcnt == 0 || segkmem_kmemlp_pcnt > 100) - segkmem_kmemlp_pcnt = 12; - segkmem_kmemlp_max = (memtotal * segkmem_kmemlp_pcnt) / 100; - } - segkmem_kmemlp_max = P2ROUNDUP(segkmem_kmemlp_max, - segkmem_heaplp_quantum); - - /* fix lp kmem preallocation request if necesssary */ - if (segkmem_kmemlp_min) { - segkmem_kmemlp_min = P2ROUNDUP(segkmem_kmemlp_min, - segkmem_heaplp_quantum); - if (segkmem_kmemlp_min > segkmem_kmemlp_max) - segkmem_kmemlp_min = segkmem_kmemlp_max; - } - - use_large_pages = 1; - segkmem_lpszc = page_szc(segkmem_lpsize); - segkmem_lpshift = page_get_shift(segkmem_lpszc); - -#endif return (use_large_pages); } @@ -1527,112 +1417,3 @@ segkmem_zio_init(void *zio_mem_base, size_t zio_mem_size) ASSERT(zio_alloc_arena != NULL); } -#ifdef __sparc - - -static void * -segkmem_alloc_ppa(vmem_t *vmp, size_t size, int vmflag) -{ - size_t ppaquantum = btopr(segkmem_lpsize) * sizeof (page_t *); - void *addr; - - if (ppaquantum <= PAGESIZE) - return (segkmem_alloc(vmp, size, vmflag)); - - ASSERT((size & (ppaquantum - 1)) == 0); - - addr = vmem_xalloc(vmp, size, ppaquantum, 0, 0, NULL, NULL, vmflag); - if (addr != NULL && segkmem_xalloc(vmp, addr, size, vmflag, 0, - segkmem_page_create, NULL) == NULL) { - vmem_xfree(vmp, addr, size); - addr = NULL; - } - - return (addr); -} - -static void -segkmem_free_ppa(vmem_t *vmp, void *addr, size_t size) -{ - size_t ppaquantum = btopr(segkmem_lpsize) * sizeof (page_t *); - - ASSERT(addr != NULL); - - if (ppaquantum <= PAGESIZE) { - segkmem_free(vmp, addr, size); - } else { - segkmem_free(NULL, addr, size); - vmem_xfree(vmp, addr, size); - } -} - -void -segkmem_heap_lp_init() -{ - segkmem_lpcb_t *lpcb = &segkmem_lpcb; - size_t heap_lp_size = heap_lp_end - heap_lp_base; - size_t lpsize = segkmem_lpsize; - size_t ppaquantum; - void *addr; - - if (segkmem_lpsize <= PAGESIZE) { - ASSERT(heap_lp_base == NULL); - ASSERT(heap_lp_end == NULL); - return; - } - - ASSERT(segkmem_heaplp_quantum >= lpsize); - ASSERT((segkmem_heaplp_quantum & (lpsize - 1)) == 0); - ASSERT(lpcb->lp_uselp == 0); - ASSERT(heap_lp_base != NULL); - ASSERT(heap_lp_end != NULL); - ASSERT(heap_lp_base < heap_lp_end); - ASSERT(heap_lp_arena == NULL); - ASSERT(((uintptr_t)heap_lp_base & (lpsize - 1)) == 0); - ASSERT(((uintptr_t)heap_lp_end & (lpsize - 1)) == 0); - - /* create large page heap arena */ - heap_lp_arena = vmem_create("heap_lp", heap_lp_base, heap_lp_size, - segkmem_heaplp_quantum, NULL, NULL, NULL, 0, VM_SLEEP); - - ASSERT(heap_lp_arena != NULL); - - /* This arena caches memory already mapped by large pages */ - kmem_lp_arena = vmem_create("kmem_lp", NULL, 0, segkmem_kmemlp_quantum, - segkmem_alloc_lpi, segkmem_free_lpi, heap_lp_arena, 0, VM_SLEEP); - - ASSERT(kmem_lp_arena != NULL); - - mutex_init(&lpcb->lp_lock, NULL, MUTEX_DEFAULT, NULL); - cv_init(&lpcb->lp_cv, NULL, CV_DEFAULT, NULL); - - /* - * this arena is used for the array of page_t pointers necessary - * to call hat_mem_load_array - */ - ppaquantum = btopr(lpsize) * sizeof (page_t *); - segkmem_ppa_arena = vmem_create("segkmem_ppa", NULL, 0, ppaquantum, - segkmem_alloc_ppa, segkmem_free_ppa, heap_arena, ppaquantum, - VM_SLEEP); - - ASSERT(segkmem_ppa_arena != NULL); - - /* prealloacate some memory for the lp kernel heap */ - if (segkmem_kmemlp_min) { - - ASSERT(P2PHASE(segkmem_kmemlp_min, - segkmem_heaplp_quantum) == 0); - - if ((addr = segkmem_alloc_lpi(heap_lp_arena, - segkmem_kmemlp_min, VM_SLEEP)) != NULL) { - - addr = vmem_add(kmem_lp_arena, addr, - segkmem_kmemlp_min, VM_SLEEP); - ASSERT(addr != NULL); - } - } - - lpcb->lp_uselp = 1; -} - -#endif diff --git a/kernel/vm/vm_as.c b/kernel/vm/vm_as.c index ef8f49b38e..834bbedcf8 100644 --- a/kernel/vm/vm_as.c +++ b/kernel/vm/vm_as.c @@ -473,19 +473,6 @@ again: */ if (base + seg->s_size > addr) { if (addr >= base || eaddr > base) { -#ifdef __sparc - extern const struct seg_ops segnf_ops; - - /* - * no-fault segs must disappear if overlaid. - * XXX need new segment type so - * we don't have to check s_ops - */ - if (seg->s_ops == &segnf_ops) { - seg_unmap(seg); - goto again; - } -#endif return (-1); /* overlapping segment */ } } diff --git a/kernel/vm/vm_page.c b/kernel/vm/vm_page.c index 145768b67e..3dd337d86a 100644 --- a/kernel/vm/vm_page.c +++ b/kernel/vm/vm_page.c @@ -4444,16 +4444,6 @@ do_page_relocate( *nrelocp = 0; -#if defined(__sparc) - /* - * We need to wait till OBP has completed - * its boot-time handoff of its resources to the kernel - * before we allow page relocation - */ - if (page_relocate_ready == 0) { - return (EAGAIN); - } -#endif /* * If this is not a base page, @@ -4531,28 +4521,6 @@ do_page_relocate( } #endif /* DEBUG */ -#if defined(__sparc) - /* - * Let hat_page_relocate() complete the relocation if it's kernel page - */ - if (VN_ISKAS(targ->p_vnode)) { - *replacement = repl; - if (hat_page_relocate(target, replacement, nrelocp) != 0) { - if (grouplock != 0) { - group_page_unlock(targ); - } - if (dofree) { - *replacement = NULL; - page_free_replacement_page(repl); - page_create_putback(dofree); - } - VM_STAT_ADD(vmm_vmstats.ppr_krelocfail[szc]); - return (EAGAIN); - } - VM_STAT_ADD(vmm_vmstats.ppr_relocok[szc]); - return (0); - } -#endif first_repl = repl; @@ -6379,24 +6347,9 @@ page_capture_pre_checks(page_t *pp, uint_t flags) { ASSERT(pp != NULL); -#if defined(__sparc) - if (pp->p_vnode == &promvp) { - return (EPERM); - } - - if (PP_ISNORELOC(pp) && !(flags & CAPTURE_GET_CAGE) && - (flags & CAPTURE_PHYSMEM)) { - return (ENOENT); - } - - if (PP_ISNORELOCKERNEL(pp)) { - return (EPERM); - } -#else if (PP_ISKAS(pp)) { return (EPERM); } -#endif /* __sparc */ /* only physmem currently has the restrictions checked below */ if (!(flags & CAPTURE_PHYSMEM)) { diff --git a/kernel/vm/vm_pagelist.c b/kernel/vm/vm_pagelist.c index da4fc5b7da..826506798f 100644 --- a/kernel/vm/vm_pagelist.c +++ b/kernel/vm/vm_pagelist.c @@ -130,12 +130,8 @@ struct vmm_vmstats_str vmm_vmstats; #endif /* VM_STATS */ -#if defined(__sparc) -#define LPGCREATE 0 -#else /* enable page_get_contig_pages */ #define LPGCREATE 1 -#endif int pg_contig_disable; int pg_lpgcreate_nocage = LPGCREATE; @@ -293,9 +289,6 @@ typedef struct hw_page_map { int hpm_shift; pfn_t hpm_base; size_t *hpm_color_current[MAX_MNODE_MRANGES]; -#if defined(__sparc) - uint_t pad[4]; -#endif } hw_page_map_t; /* @@ -1457,11 +1450,6 @@ page_list_add(page_t *pp, int flags) } -#if defined(__sparc) - if (PP_ISNORELOC(pp)) { - kcage_freemem_add(1); - } -#endif /* * It is up to the caller to unlock the page! */ @@ -1469,105 +1457,6 @@ page_list_add(page_t *pp, int flags) } -#ifdef __sparc -/* - * This routine is only used by kcage_init during system startup. - * It performs the function of page_list_sub/PP_SETNORELOC/page_list_add - * without the overhead of taking locks and updating counters. - */ -void -page_list_noreloc_startup(page_t *pp) -{ - page_t **ppp; - uint_t bin; - int mnode; - int mtype; - int flags = 0; - - /* - * If this is a large page on the freelist then - * break it up into smaller pages. - */ - if (pp->p_szc != 0) - page_boot_demote(pp); - - /* - * Get list page is currently on. - */ - bin = PP_2_BIN(pp); - mnode = PP_2_MEM_NODE(pp); - mtype = PP_2_MTYPE(pp); - ASSERT(mtype == MTYPE_RELOC); - ASSERT(pp->p_szc == 0); - - if (PP_ISAGED(pp)) { - ppp = &PAGE_FREELISTS(mnode, 0, bin, mtype); - flags |= PG_FREE_LIST; - } else { - ppp = &PAGE_CACHELISTS(mnode, bin, mtype); - flags |= PG_CACHE_LIST; - } - - ASSERT(*ppp != NULL); - - /* - * Delete page from current list. - */ - if (*ppp == pp) - *ppp = pp->p_next; /* go to next page */ - if (*ppp == pp) { - *ppp = NULL; /* page list is gone */ - } else { - pp->p_prev->p_next = pp->p_next; - pp->p_next->p_prev = pp->p_prev; - } - - /* - * Decrement page counters - */ - page_ctr_sub_internal(mnode, mtype, pp, flags); - - /* - * Set no reloc for cage initted pages. - */ - PP_SETNORELOC(pp); - - mtype = PP_2_MTYPE(pp); - ASSERT(mtype == MTYPE_NORELOC); - - /* - * Get new list for page. - */ - if (PP_ISAGED(pp)) { - ppp = &PAGE_FREELISTS(mnode, 0, bin, mtype); - } else { - ppp = &PAGE_CACHELISTS(mnode, bin, mtype); - } - - /* - * Insert page on new list. - */ - if (*ppp == NULL) { - *ppp = pp; - pp->p_next = pp->p_prev = pp; - } else { - pp->p_next = *ppp; - pp->p_prev = (*ppp)->p_prev; - (*ppp)->p_prev = pp; - pp->p_prev->p_next = pp; - } - - /* - * Increment page counters - */ - page_ctr_add_internal(mnode, mtype, pp, flags); - - /* - * Update cage freemem counter - */ - atomic_inc_ulong(&kcage_freemem); -} -#else /* __sparc */ /* ARGSUSED */ void @@ -1575,7 +1464,6 @@ page_list_noreloc_startup(page_t *pp) { panic("page_list_noreloc_startup: should be here only for sparc"); } -#endif void page_list_add_pages(page_t *pp, int flags) @@ -1612,10 +1500,6 @@ page_list_add_pages(page_t *pp, int flags) mutex_exit(pcm); pgcnt = page_get_pagecnt(pp->p_szc); -#if defined(__sparc) - if (PP_ISNORELOC(pp)) - kcage_freemem_add(pgcnt); -#endif for (i = 0; i < pgcnt; i++, pp++) page_unlock_nocapture(pp); } @@ -1707,11 +1591,6 @@ try_again: page_ctr_sub(mnode, mtype, pp, flags); mutex_exit(pcm); -#if defined(__sparc) - if (PP_ISNORELOC(pp)) { - kcage_freemem_sub(1); - } -#endif return; } @@ -1758,11 +1637,6 @@ try_again: page_ctr_sub(mnode, mtype, pp, flags); page_freelist_unlock(mnode); -#if defined(__sparc) - if (PP_ISNORELOC(pp)) { - kcage_freemem_sub(1); - } -#endif } void @@ -1830,14 +1704,6 @@ try_again: page_freelist_unlock(mnode); } -#if defined(__sparc) - if (PP_ISNORELOC(pp)) { - pgcnt_t pgcnt; - - pgcnt = page_get_pagecnt(pp->p_szc); - kcage_freemem_sub(pgcnt); - } -#endif } /* @@ -2282,9 +2148,6 @@ page_freelist_coalesce(int mnode, uchar_t szc, uint_t color, uint_t ceq_mask, pgcnt_t cands = 0, szcpgcnt = page_get_pagecnt(szc); page_t *ret_pp; MEM_NODE_ITERATOR_DECL(it); -#if defined(__sparc) - pfn_t pfnum0, nlo, nhi; -#endif if (mpss_coalesce_disable) { ASSERT(szc < MMU_PAGE_SIZES); @@ -2384,39 +2247,9 @@ page_freelist_coalesce(int mnode, uchar_t szc, uint_t color, uint_t ceq_mask, idx0 = PNUM_TO_IDX(mnode, r, pfnum); ASSERT(idx0 < len); -#if defined(__sparc) - pfnum0 = pfnum; /* page corresponding to idx0 */ - nhi = 0; /* search kcage ranges */ -#endif for (idx = idx0; wrap == 0 || (idx < idx0 && wrap < 2); ) { -#if defined(__sparc) - /* - * Find lowest intersection of kcage ranges and mnode. - * MTYPE_NORELOC means look in the cage, otherwise outside. - */ - if (nhi <= pfnum) { - if (kcage_next_range(mtype == MTYPE_NORELOC, pfnum, - (wrap == 0 ? hi : pfnum0), &nlo, &nhi)) - goto wrapit; - - /* jump to the next page in the range */ - if (pfnum < nlo) { - pfnum = P2ROUNDUP(nlo, szcpgcnt); - MEM_NODE_ITERATOR_INIT(pfnum, mnode, szc, &it); - idx = PNUM_TO_IDX(mnode, r, pfnum); - if (idx >= len || pfnum >= hi) - goto wrapit; - if ((PFN_2_COLOR(pfnum, szc, &it) ^ color) & - ceq_mask) - goto next; - if (interleaved_mnodes && - PFN_2_MEM_NODE(pfnum) != mnode) - goto next; - } - } -#endif if (PAGE_COUNTERS(mnode, r, idx) != full) goto next; @@ -2436,14 +2269,6 @@ page_freelist_coalesce(int mnode, uchar_t szc, uint_t color, uint_t ceq_mask, PFN_2_COLOR(pfnum, szc, &it), mrange) = idx; page_freelist_unlock(mnode); rw_exit(&page_ctrs_rwlock[mnode]); -#if defined(__sparc) - if (PP_ISNORELOC(ret_pp)) { - pgcnt_t npgs; - - npgs = page_get_pagecnt(ret_pp->p_szc); - kcage_freemem_sub(npgs); - } -#endif return (ret_pp); } } else { @@ -2476,9 +2301,6 @@ wrapit: MEM_NODE_ITERATOR_INIT(pfnum, mnode, szc, &it); idx = PNUM_TO_IDX(mnode, r, pfnum); wrap++; -#if defined(__sparc) - nhi = 0; /* search kcage ranges */ -#endif } } @@ -2651,15 +2473,6 @@ page_freelist_split(uchar_t szc, uint_t color, int mnode, int mtype, pfnhi, pp->p_szc, szc, ccolor, PC_ALLOC); if (ret_pp) { page_freelist_unlock(mnode); -#if defined(__sparc) - if (PP_ISNORELOC(ret_pp)) { - pgcnt_t npgs; - - npgs = page_get_pagecnt( - ret_pp->p_szc); - kcage_freemem_sub(npgs); - } -#endif return (ret_pp); } } @@ -3019,13 +2832,6 @@ try_again: panic("free page is not. pp %p", (void *)pp); mutex_exit(pcm); -#if defined(__sparc) - ASSERT(!kcage_on || PP_ISNORELOC(pp) || - (flags & PG_NORELOC) == 0); - - if (PP_ISNORELOC(pp)) - kcage_freemem_sub(page_get_pagecnt(szc)); -#endif VM_STAT_ADD(vmm_vmstats.pgmf_allocok[szc]); return (pp); @@ -4061,14 +3867,6 @@ try_again: VERIFY(pp->p_object); ASSERT(pp->p_vnode); ASSERT(PP_ISAGED(pp) == 0); -#if defined(__sparc) - ASSERT(!kcage_on || - (flags & PG_NORELOC) == 0 || - PP_ISNORELOC(pp)); - if (PP_ISNORELOC(pp)) { - kcage_freemem_sub(1); - } -#endif VM_STAT_ADD(vmm_vmstats. pgmc_allocok); return (pp); } diff --git a/usr/src/cmd/csh/sh.misc.c b/usr/src/cmd/csh/sh.misc.c index 742d0532d3..8f5e087965 100644 --- a/usr/src/cmd/csh/sh.misc.c +++ b/usr/src/cmd/csh/sh.misc.c @@ -481,12 +481,6 @@ inb: xalloc_bottom = bp; return (rptr); } -#if defined(__sparc) - if (rptr > (char *)&rptr) { - /* in the stack frame */ - goto oob; - } -#endif /* * can be a memory block returned indirectly from * library functions. update bottom, and check it again. @@ -511,12 +505,6 @@ xfree(void *ptr) free(ptr); return; } -#if defined(__sparc) - if (rptr > (char *)&rptr) { - /* in the stack frame */ - return; - } -#endif xalloc_bottom = sbrk(0); if (rptr <= xalloc_bottom) { free(ptr); diff --git a/usr/src/cmd/dtrace/test/tst/common/safety/tst.vahole.d b/usr/src/cmd/dtrace/test/tst/common/safety/tst.vahole.d index 2ef40a5ac4..a285509316 100644 --- a/usr/src/cmd/dtrace/test/tst/common/safety/tst.vahole.d +++ b/usr/src/cmd/dtrace/test/tst/common/safety/tst.vahole.d @@ -38,11 +38,7 @@ fbt::: { n++; -#ifdef __sparc - trace(*(int *)0x8000000000000000 ^ rand()); -#else trace(*(int *)(`kernelbase - 1)); -#endif } dtrace:::ERROR diff --git a/usr/src/cmd/halt/halt.c b/usr/src/cmd/halt/halt.c index 43ca80fe65..64082daae1 100644 --- a/usr/src/cmd/halt/halt.c +++ b/usr/src/cmd/halt/halt.c @@ -1409,11 +1409,6 @@ main(int argc, char *argv[]) return (EINVAL); } -#if defined(__sparc) - if (fast_reboot) { - fast_reboot = 2; /* need to distinguish each case */ - } -#endif /* * If fast reboot, do some sanity check on the argument diff --git a/usr/src/cmd/mdb/common/kmdb/kaif_start.c b/usr/src/cmd/mdb/common/kmdb/kaif_start.c index 6c0fc810bb..79c7868d9e 100644 --- a/usr/src/cmd/mdb/common/kmdb/kaif_start.c +++ b/usr/src/cmd/mdb/common/kmdb/kaif_start.c @@ -42,9 +42,6 @@ #define KAIF_SLAVE_CMD_RESUME 2 #define KAIF_SLAVE_CMD_FLUSH 3 #define KAIF_SLAVE_CMD_REBOOT 4 -#if defined(__sparc) -#define KAIF_SLAVE_CMD_ACK 5 -#endif /* @@ -92,9 +89,6 @@ kaif_master_loop(kaif_cpusave_t *cpusave) { int notflushed, i; -#if defined(__sparc) - kaif_prom_rearm(); -#endif kaif_trap_set_debugger(); /* @@ -207,15 +201,6 @@ kaif_slave_loop(kaif_cpusave_t *cpusave) { int slavecmd, rv; -#if defined(__sparc) - /* - * If the user elects to drop to OBP from the debugger, some OBP - * implementations will cross-call the slaves. We have to turn - * IE back on so we can receive the cross-calls. If we don't, - * some OBP implementations will wait forever. - */ - interrupts_on(); -#endif /* Wait for duty to call */ for (;;) { @@ -244,21 +229,11 @@ kaif_slave_loop(kaif_cpusave_t *cpusave) } else if (slavecmd == KAIF_SLAVE_CMD_RESUME) { rv = KAIF_CPU_CMD_RESUME; break; -#if defined(__sparc) - } else if (slavecmd == KAIF_SLAVE_CMD_ACK) { - cpusave->krs_cpu_acked = 1; - } else if (cpusave->krs_cpu_acked && - slavecmd == KAIF_SLAVE_CMD_SPIN) { - cpusave->krs_cpu_acked = 0; -#endif } kmdb_kdi_slave_wait(); } -#if defined(__sparc) - interrupts_off(); -#endif return (rv); } @@ -305,16 +280,6 @@ kaif_main_loop(kaif_cpusave_t *cpusave) kaif_select_master(cpusave); -#ifdef __sparc - if (kaif_master_cpuid == cpusave->krs_cpu_id) { - /* - * Everyone has arrived, so we can disarm the post-PROM - * entry point. - */ - *kaif_promexitarmp = 0; - membar_producer(); - } -#endif } else if (kaif_master_cpuid == cpusave->krs_cpu_id) { cpusave->krs_cpu_state = KAIF_CPU_STATE_MASTER; } else { @@ -392,72 +357,3 @@ kaif_main_loop(kaif_cpusave_t *cpusave) } -#if defined(__sparc) - -static int slave_loop_barrier_failures = 0; /* for debug */ - -/* - * There exist a race condition observed by some - * platforms where the kmdb master cpu exits to OBP via - * prom_enter_mon (e.g. "$q" command) and then later re-enter - * kmdb (typing "go") while the slaves are still proceeding - * from the OBP idle-loop back to the kmdb slave loop. The - * problem arises when the master cpu now back in kmdb proceed - * to re-enter OBP (e.g. doing a prom_read() from the kmdb main - * loop) while the slaves are still trying to get out of (the - * previous trip in) OBP into the safety of the kmdb slave loop. - * This routine forces the slaves to explicitly acknowledge - * that they are back in the slave loop. The master cpu can - * call this routine to ensure that all slave cpus are back - * in the slave loop before proceeding. - */ -void -kaif_slave_loop_barrier(void) -{ - extern void kdi_usecwait(clock_t); - int i; - int not_acked; - int timeout_count = 0; - - kaif_start_slaves(KAIF_SLAVE_CMD_ACK); - - /* - * Wait for slave cpus to explicitly acknowledge - * that they are spinning in the slave loop. - */ - do { - not_acked = 0; - for (i = 0; i < kaif_ncpusave; i++) { - kaif_cpusave_t *save = &kaif_cpusave[i]; - - if (save->krs_cpu_state == - KAIF_CPU_STATE_SLAVE && - !save->krs_cpu_acked) { - not_acked++; - break; - } - } - - if (not_acked == 0) - break; - - /* - * Play it safe and do a timeout delay. - * We will do at most kaif_ncpusave delays before - * bailing out of this barrier. - */ - kdi_usecwait(200); - - } while (++timeout_count < kaif_ncpusave); - - if (not_acked > 0) - /* - * we cannot establish a barrier with all - * the slave cpus coming back from OBP - * Record this fact for future debugging - */ - slave_loop_barrier_failures++; - - kaif_slave_cmd = KAIF_SLAVE_CMD_SPIN; -} -#endif diff --git a/usr/src/cmd/mdb/common/kmdb/kctl/kctl_main.c b/usr/src/cmd/mdb/common/kmdb/kctl/kctl_main.c index 213ac96e2e..ddf31536a0 100644 --- a/usr/src/cmd/mdb/common/kmdb/kctl/kctl_main.c +++ b/usr/src/cmd/mdb/common/kmdb/kctl/kctl_main.c @@ -60,13 +60,8 @@ kctl_t kctl; * else was calling the kernel's copy of another prom routine, so we * grab the PROM lock ourselves before we start initialization. */ -#ifdef __sparc -#define KCTL_PROM_LOCK promif_preprom() -#define KCTL_PROM_UNLOCK promif_postprom() -#else #define KCTL_PROM_LOCK #define KCTL_PROM_UNLOCK -#endif static int kctl_init(void) diff --git a/usr/src/cmd/mdb/common/kmdb/kmdb_fault.c b/usr/src/cmd/mdb/common/kmdb/kmdb_fault.c index 4698f3cc84..36e961088c 100644 --- a/usr/src/cmd/mdb/common/kmdb/kmdb_fault.c +++ b/usr/src/cmd/mdb/common/kmdb/kmdb_fault.c @@ -77,14 +77,7 @@ kmdb_fault(kreg_t tt, kreg_t pc, kreg_t sp, int cpuid) if (mdb.m_term != NULL) { for (;;) { mdb_iob_printf(mdb.m_err, "\n%s: " -#if defined(__sparc) -#ifndef sun4v - "(o)bp, " -#endif /* sun4v */ - "(p)anic" -#else "reboo(t)" -#endif ", or (d)ebug with self? ", mdb.m_pname); mdb_iob_flush(mdb.m_err); @@ -94,12 +87,6 @@ kmdb_fault(kreg_t tt, kreg_t pc, kreg_t sp, int cpuid) mdb_iob_printf(mdb.m_err, "\n"); switch (c) { -#ifdef __sparc - case 'p': - kmdb_dpi_kernpanic(cpuid); - /*NOTREACHED*/ - continue; -#endif #ifndef sun4v case 'o': diff --git a/usr/src/cmd/mdb/common/kmdb/kmdb_kvm.c b/usr/src/cmd/mdb/common/kmdb/kmdb_kvm.c index 6092286226..c9c7576f45 100644 --- a/usr/src/cmd/mdb/common/kmdb/kmdb_kvm.c +++ b/usr/src/cmd/mdb/common/kmdb/kmdb_kvm.c @@ -1670,10 +1670,6 @@ kmt_brkpt_ctor(mdb_tgt_t *t, mdb_sespec_t *sep, void *args) ka->ka_addr = (uintptr_t)s.st_value; } -#ifdef __sparc - if (ka->ka_addr & 3) - return (set_errno(EMDB_BPALIGN)); -#endif if (mdb_vread(&instr, sizeof (instr), ka->ka_addr) != sizeof (instr)) return (-1); /* errno is set for us */ diff --git a/usr/src/cmd/mdb/common/kmdb/kmdb_main.c b/usr/src/cmd/mdb/common/kmdb/kmdb_main.c index 7cc1d3f7b0..12d86b493d 100644 --- a/usr/src/cmd/mdb/common/kmdb/kmdb_main.c +++ b/usr/src/cmd/mdb/common/kmdb/kmdb_main.c @@ -64,11 +64,7 @@ #include #include -#ifdef __sparc -#define KMDB_STACK_SIZE (384 * 1024) -#else #define KMDB_STACK_SIZE (192 * 1024) -#endif caddr_t kmdb_main_stack; size_t kmdb_main_stack_size; diff --git a/usr/src/cmd/mdb/common/kmdb/kmdb_promif.c b/usr/src/cmd/mdb/common/kmdb/kmdb_promif.c index b82ab3275e..61e86df9af 100644 --- a/usr/src/cmd/mdb/common/kmdb/kmdb_promif.c +++ b/usr/src/cmd/mdb/common/kmdb/kmdb_promif.c @@ -530,11 +530,7 @@ parse_mode_bail: return (rc); } -#ifdef __sparc -#define ATTACHED_TERM_TYPE "sun" -#else #define ATTACHED_TERM_TYPE "sun-color" -#endif static void kmdb_prom_term_init(kmdb_auxv_t *kav, kmdb_promif_t *pif) @@ -565,17 +561,6 @@ kmdb_prom_term_init(kmdb_auxv_t *kav, kmdb_promif_t *pif) } else { char *mode = kmdb_get_ttyio_mode(kav, conout); -#ifdef __sparc - /* - * Some platforms (Starfire) define a value of `ttya' for - * output-device, but neglect to provide a specific property - * with the characteristics. We'll provide a default value. - */ - if (mode == NULL && strcmp(conout, "ttya") == 0) { - (void) kmdb_parse_mode(KMDB_PROM_DEF_CONS_MODE, - &pif->pif_tios, 0); - } else -#endif { if (mode == NULL || kmdb_parse_mode(mode, &pif->pif_tios, 0) < 0) { @@ -608,17 +593,6 @@ kmdb_prom_term_init(kmdb_auxv_t *kav, kmdb_promif_t *pif) } else { char *mode = kmdb_get_ttyio_mode(kav, conin); -#ifdef __sparc - /* - * Some platforms (Starfire) define a value of `ttya' for - * input-device, but neglect to provide a specific property - * with the characteristics. We'll provide a default value. - */ - if (mode == NULL && strcmp(conin, "ttya") == 0) { - (void) kmdb_parse_mode(KMDB_PROM_DEF_CONS_MODE, - &pif->pif_tios, 1); - } else -#endif { if (mode == NULL || kmdb_parse_mode(mode, &pif->pif_tios, 1) < 0) { @@ -698,10 +672,6 @@ kmdb_prom_vtop(uintptr_t virt, physaddr_t *pap) physaddr_t pa; int rc = kmdb_kdi_vtop(virt, &pa); -#ifdef __sparc - if (rc < 0 && errno == EAGAIN) - rc = kmdb_prom_translate_virt(virt, &pa); -#endif if (rc == 0 && pap != NULL) *pap = pa; diff --git a/usr/src/cmd/mdb/common/kmdb/kmdb_promio.c b/usr/src/cmd/mdb/common/kmdb/kmdb_promio.c index e1207a2994..accec88fce 100644 --- a/usr/src/cmd/mdb/common/kmdb/kmdb_promio.c +++ b/usr/src/cmd/mdb/common/kmdb/kmdb_promio.c @@ -198,10 +198,6 @@ kmdb_promio_create(char *name) (void) strlcpy(pdp->pio_name, name, MAXPATHLEN); pdp->pio_fd = hdl; -#ifdef __sparc - pdp->pio_ti.c_oflag |= ONLCR; - pdp->pio_ti.c_iflag |= ICRNL; -#endif pdp->pio_ti.c_lflag |= ECHO; io->io_data = pdp; diff --git a/usr/src/cmd/mdb/common/kmdb/kmdb_stubs.c b/usr/src/cmd/mdb/common/kmdb/kmdb_stubs.c index 804f85aba4..39d9ffd40c 100644 --- a/usr/src/cmd/mdb/common/kmdb/kmdb_stubs.c +++ b/usr/src/cmd/mdb/common/kmdb/kmdb_stubs.c @@ -154,11 +154,6 @@ proc_str2sys(const char *buf, int *ptr) void exit(int status) { -#ifdef __sparc - extern void kmdb_prom_exit_to_mon(void) __NORETURN; - - kmdb_prom_exit_to_mon(); -#else extern void kmdb_dpi_reboot(void) __NORETURN; static int recurse = 0; @@ -174,5 +169,4 @@ exit(int status) } kmdb_dpi_reboot(); -#endif } diff --git a/usr/src/cmd/mdb/common/mdb/mdb_cmds.c b/usr/src/cmd/mdb/common/mdb/mdb_cmds.c index 1614db8e29..646f2f7b34 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_cmds.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_cmds.c @@ -75,36 +75,6 @@ #endif #include -#ifdef __sparc -#define SETHI_MASK 0xc1c00000 -#define SETHI_VALUE 0x01000000 - -#define IS_SETHI(machcode) (((machcode) & SETHI_MASK) == SETHI_VALUE) - -#define OP(machcode) ((machcode) >> 30) -#define OP3(machcode) (((machcode) >> 19) & 0x3f) -#define RD(machcode) (((machcode) >> 25) & 0x1f) -#define RS1(machcode) (((machcode) >> 14) & 0x1f) -#define I(machcode) (((machcode) >> 13) & 0x01) - -#define IMM13(machcode) ((machcode) & 0x1fff) -#define IMM22(machcode) ((machcode) & 0x3fffff) - -#define OP_ARITH_MEM_MASK 0x2 -#define OP_ARITH 0x2 -#define OP_MEM 0x3 - -#define OP3_CC_MASK 0x10 -#define OP3_COMPLEX_MASK 0x20 - -#define OP3_ADD 0x00 -#define OP3_OR 0x02 -#define OP3_XOR 0x03 - -#ifndef R_O7 -#define R_O7 0xf -#endif -#endif /* __sparc */ static mdb_tgt_addr_t write_uint8(mdb_tgt_as_t as, mdb_tgt_addr_t addr, uint64_t ull, uint_t rdback) @@ -1688,205 +1658,6 @@ cmd_showrev(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) return (showrev_sysinfo()); } -#ifdef __sparc -static void -findsym_output(uintptr_t *symlist, uintptr_t value, uintptr_t location) -{ - uintptr_t *symbolp; - - for (symbolp = symlist; *symbolp; symbolp++) - if (value == *symbolp) - mdb_printf("found %a at %a\n", value, location); -} - -/*ARGSUSED*/ -static int -findsym_cb(void *data, const GElf_Sym *sym, const char *name, - const mdb_syminfo_t *sip, const char *obj) -{ - uint32_t *text; - int len; - int i; - int j; - uint8_t rd; - uintptr_t value; - int32_t imm13; - uint8_t op; - uint8_t op3; - uintptr_t *symlist = data; - size_t size = sym->st_size; - - /* - * if the size of the symbol is 0, then this symbol must be for an - * alternate entry point or just some global label. We will, - * therefore, get back to the text that follows this symbol in - * some other symbol - */ - if (size == 0) - return (0); - - if (sym->st_shndx == SHN_UNDEF) - return (0); - - text = alloca(size); - - if (mdb_vread(text, size, sym->st_value) == -1) { - mdb_warn("failed to read text for %s", name); - return (0); - } - - len = size / 4; - for (i = 0; i < len; i++) { - if (!IS_SETHI(text[i])) - continue; - - rd = RD(text[i]); - value = IMM22(text[i]) << 10; - - /* - * see if we already have a match with just the sethi - */ - findsym_output(symlist, value, sym->st_value + i * 4); - - /* - * search from the sethi on until we hit a relevant instr - */ - for (j = i + 1; j < len; j++) { - if ((op = OP(text[j])) & OP_ARITH_MEM_MASK) { - op3 = OP3(text[j]); - - if (RS1(text[j]) != rd) - goto instr_end; - - /* - * This is a simple tool; we only deal - * with operations which take immediates - */ - if (I(text[j]) == 0) - goto instr_end; - - /* - * sign extend the immediate value - */ - imm13 = IMM13(text[j]); - imm13 <<= 19; - imm13 >>= 19; - - if (op == OP_ARITH) { - /* arithmetic operations */ - if (op3 & OP3_COMPLEX_MASK) - goto instr_end; - - switch (op3 & ~OP3_CC_MASK) { - case OP3_OR: - value |= imm13; - break; - case OP3_ADD: - value += imm13; - break; - case OP3_XOR: - value ^= imm13; - break; - default: - goto instr_end; - } - } else { - /* loads and stores */ - /* op3 == OP_MEM */ - - value += imm13; - } - - findsym_output(symlist, value, - sym->st_value + j * 4); -instr_end: - /* - * if we're clobbering rd, break - */ - if (RD(text[j]) == rd) - break; - } else if (IS_SETHI(text[j])) { - if (RD(text[j]) == rd) - break; - } else if (OP(text[j]) == 1) { - /* - * see if a call clobbers an %o or %g - */ - if (rd <= R_O7) - break; - } - } - } - - return (0); -} - -static int -cmd_findsym(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - uintptr_t *symlist; - uint_t optg = FALSE; - uint_t type; - int len, i; - - i = mdb_getopts(argc, argv, 'g', MDB_OPT_SETBITS, TRUE, &optg, NULL); - - argc -= i; - argv += i; - - len = argc + ((flags & DCMD_ADDRSPEC) ? 1 : 0) + 1; - - if (len <= 1) - return (DCMD_USAGE); - - /* - * Set up a NULL-terminated symbol list, and then iterate over the - * symbol table, scanning each function for references to these symbols. - */ - symlist = mdb_alloc(len * sizeof (uintptr_t), UM_SLEEP | UM_GC); - len = 0; - - for (i = 0; i < argc; i++, argv++) { - const char *str = argv->a_un.a_str; - uintptr_t value; - GElf_Sym sym; - - if (argv->a_type == MDB_TYPE_STRING) { - if (strchr("+-", str[0]) != NULL) - return (DCMD_USAGE); - else if (str[0] >= '0' && str[0] <= '9') - value = mdb_strtoull(str); - else if (mdb_lookup_by_name(str, &sym) != 0) { - mdb_warn("symbol '%s' not found", str); - return (DCMD_USAGE); - } else - value = sym.st_value; - } else - value = argv[i].a_un.a_val; - - if (value != NULL) - symlist[len++] = value; - } - - if (flags & DCMD_ADDRSPEC) - symlist[len++] = addr; - - symlist[len] = NULL; - - if (optg) - type = MDB_TGT_BIND_GLOBAL | MDB_TGT_TYPE_FUNC; - else - type = MDB_TGT_BIND_ANY | MDB_TGT_TYPE_FUNC; - - if (mdb_tgt_symbol_iter(mdb.m_target, MDB_TGT_OBJ_EVERY, - MDB_TGT_SYMTAB, type, findsym_cb, symlist) == -1) { - mdb_warn("failed to iterate over symbol table"); - return (DCMD_ERR); - } - - return (DCMD_OK); -} -#endif /* __sparc */ static int dis_str2addr(const char *s, uintptr_t *addr) @@ -2018,12 +1789,6 @@ cmd_dis(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) } } else { -#ifdef __sparc - if (addr & 0x3) { - mdb_warn("address is not properly aligned\n"); - return (DCMD_ERR); - } -#endif for (oaddr = mdb_dis_previns(dis, tgt, as, addr, n); oaddr < addr; oaddr = naddr) { @@ -2942,10 +2707,6 @@ const mdb_dcmd_t mdb_dcmd_builtins[] = { { "evset", "?[+/-dDestT] [-c cmd] [-n count] id ...", "set software event specifier attributes", cmd_evset, evset_help }, { "files", "[object]", "print listing of source files", cmd_files }, -#ifdef __sparc - { "findsym", "?[-g] [symbol|addr ...]", "search for symbol references " - "in all known functions", cmd_findsym, NULL }, -#endif { "formats", NULL, "list format specifiers", cmd_formats }, { "grep", "?expr", "print dot if expression is true", cmd_grep }, { "head", "-num|-n num", "limit number of elements in pipe", cmd_head, diff --git a/usr/src/cmd/mdb/common/mdb/mdb_disasm.c b/usr/src/cmd/mdb/common/mdb/mdb_disasm.c index e474b20809..d0ac41f450 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_disasm.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_disasm.c @@ -208,41 +208,9 @@ libdisasm_lookup(void *data, uint64_t addr, char *buf, size_t buflen, GElf_Sym sym; if (buf != NULL) { -#ifdef __sparc - uint32_t instr[3]; - uint32_t dtrace_id; - - /* - * On SPARC, DTrace FBT trampoline entries have a sethi/or pair - * that indicates the dtrace probe id; this may appear as the - * first two instructions or one instruction into the - * trampoline. - */ - if (mdb_vread(instr, sizeof (instr), (uintptr_t)addr) == - sizeof (instr)) { - if ((instr[0] & 0xfffc0000) == 0x11000000 && - (instr[1] & 0xffffe000) == 0x90122000) { - dtrace_id = (instr[0] << 10) | - (instr[1] & 0x1fff); - (void) mdb_snprintf(buf, sizeof (buf), "dt=%#x", - dtrace_id); - goto out; - } else if ((instr[1] & 0xfffc0000) == 0x11000000 && - (instr[2] & 0xffffe000) == 0x90122000) { - dtrace_id = (instr[1] << 10) | - (instr[2] & 0x1fff); - (void) mdb_snprintf(buf, sizeof (buf), "dt=%#x", - dtrace_id); - goto out; - } - } -#endif (void) mdb_snprintf(buf, buflen, "%a", (uintptr_t)addr); } -#ifdef __sparc -out: -#endif if (mdb_lookup_by_addr(addr, MDB_SYM_FUZZY, &c, 1, &sym) < 0) return (-1); if (start != NULL) @@ -450,61 +418,6 @@ amd64_create(mdb_disasm_t *dp) } #endif -#if defined(__sparc) -static int -sparc1_create(mdb_disasm_t *dp) -{ - return (libdisasm_create(dp, - "1", - "SPARC-v8 disassembler", - DIS_SPARC_V8)); -} - -static int -sparc2_create(mdb_disasm_t *dp) -{ - return (libdisasm_create(dp, - "2", - "SPARC-v9 disassembler", - DIS_SPARC_V9)); -} - -static int -sparc4_create(mdb_disasm_t *dp) -{ - return (libdisasm_create(dp, - "4", - "UltraSPARC1-v9 disassembler", - DIS_SPARC_V9 | DIS_SPARC_V9_SGI)); -} - -static int -sparcv8_create(mdb_disasm_t *dp) -{ - return (libdisasm_create(dp, - "v8", - "SPARC-v8 disassembler", - DIS_SPARC_V8)); -} - -static int -sparcv9_create(mdb_disasm_t *dp) -{ - return (libdisasm_create(dp, - "v9", - "SPARC-v9 disassembler", - DIS_SPARC_V9)); -} - -static int -sparcv9plus_create(mdb_disasm_t *dp) -{ - return (libdisasm_create(dp, - "v9plus", - "UltraSPARC1-v9 disassembler", - DIS_SPARC_V9 | DIS_SPARC_V9_SGI)); -} -#endif /*ARGSUSED*/ static void diff --git a/usr/src/cmd/mdb/common/mdb/mdb_kproc.c b/usr/src/cmd/mdb/common/mdb/mdb_kproc.c index 41e57b60b5..d0a5b2d962 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_kproc.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_kproc.c @@ -434,11 +434,7 @@ static const char * kp_isa(mdb_tgt_t *t) { kp_data_t *kp = t->t_data; -#ifdef __sparc - return (kp->kp_model == PR_MODEL_ILP32 ? "sparc" : "sparcv9"); -#else return (kp->kp_model == PR_MODEL_ILP32 ? "i386" : "amd64"); -#endif } static const char * diff --git a/usr/src/cmd/mdb/common/mdb/mdb_main.c b/usr/src/cmd/mdb/common/mdb/mdb_main.c index 90e048bb82..f05fd62977 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_main.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_main.c @@ -71,11 +71,7 @@ #define STACK_BIAS 0 #endif -#if defined(__sparc) -#define STACK_REGISTER SP -#else #define STACK_REGISTER REG_FP -#endif #ifdef _LP64 #define MDB_DEF_IPATH \ diff --git a/usr/src/cmd/mdb/common/mdb/mdb_proc.c b/usr/src/cmd/mdb/common/mdb/mdb_proc.c index e80710e555..285080d7ce 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_proc.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_proc.c @@ -1080,9 +1080,6 @@ pt_stack_common(uintptr_t addr, uint_t flags, int argc, if (flags & DCMD_ADDRSPEC) { bzero(&gregs, sizeof (gregs)); gregs.gregs[R_FP] = addr; -#ifdef __sparc - gregs.gregs[R_I7] = saved_pc; -#endif /* __sparc */ } else if (PTL_GETREGS(t, PTL_TID(t), gregs.gregs) != 0) { mdb_warn("failed to get current register set"); return (DCMD_ERR); @@ -3953,10 +3950,6 @@ pt_brkpt_ctor(mdb_tgt_t *t, mdb_sespec_t *sep, void *args) pta->pta_addr = (uintptr_t)s.st_value; } -#ifdef __sparc - if (pta->pta_addr & 3) - return (set_errno(EMDB_BPALIGN)); -#endif if (Paddr_to_map(t->t_pshandle, pta->pta_addr) == NULL) return (set_errno(EMDB_NOMAP)); @@ -4777,32 +4770,6 @@ pt_lwp_setregs(mdb_tgt_t *t, void *tap, mdb_tgt_tid_t tid, prgregset_t gregs) return (set_errno(EMDB_NOPROC)); } -#ifdef __sparc - -/*ARGSUSED*/ -static int -pt_lwp_getxregs(mdb_tgt_t *t, void *tap, mdb_tgt_tid_t tid, prxregset_t *xregs) -{ - if (t->t_pshandle != NULL) { - return (ptl_err(Plwp_getxregs(t->t_pshandle, - (lwpid_t)tid, xregs))); - } - return (set_errno(EMDB_NOPROC)); -} - -/*ARGSUSED*/ -static int -pt_lwp_setxregs(mdb_tgt_t *t, void *tap, mdb_tgt_tid_t tid, - const prxregset_t *xregs) -{ - if (t->t_pshandle != NULL) { - return (ptl_err(Plwp_setxregs(t->t_pshandle, - (lwpid_t)tid, xregs))); - } - return (set_errno(EMDB_NOPROC)); -} - -#endif /* __sparc */ /*ARGSUSED*/ static int @@ -4835,10 +4802,6 @@ static const pt_ptl_ops_t proc_lwp_ops = { pt_lwp_iter, pt_lwp_getregs, pt_lwp_setregs, -#ifdef __sparc - pt_lwp_getxregs, - pt_lwp_setxregs, -#endif pt_lwp_getfpregs, pt_lwp_setfpregs }; @@ -4964,52 +4927,6 @@ pt_tdb_setregs(mdb_tgt_t *t, void *tap, mdb_tgt_tid_t tid, prgregset_t gregs) return (0); } -#ifdef __sparc - -static int -pt_tdb_getxregs(mdb_tgt_t *t, void *tap, mdb_tgt_tid_t tid, prxregset_t *xregs) -{ - pt_data_t *pt = t->t_data; - - td_thrhandle_t th; - td_err_e err; - - if (t->t_pshandle == NULL) - return (set_errno(EMDB_NOPROC)); - - if ((err = pt->p_tdb_ops->td_ta_map_id2thr(tap, tid, &th)) != TD_OK) - return (set_errno(tdb_to_errno(err))); - - err = pt->p_tdb_ops->td_thr_getxregs(&th, xregs); - if (err != TD_OK && err != TD_PARTIALREG) - return (set_errno(tdb_to_errno(err))); - - return (0); -} - -static int -pt_tdb_setxregs(mdb_tgt_t *t, void *tap, mdb_tgt_tid_t tid, - const prxregset_t *xregs) -{ - pt_data_t *pt = t->t_data; - - td_thrhandle_t th; - td_err_e err; - - if (t->t_pshandle == NULL) - return (set_errno(EMDB_NOPROC)); - - if ((err = pt->p_tdb_ops->td_ta_map_id2thr(tap, tid, &th)) != TD_OK) - return (set_errno(tdb_to_errno(err))); - - err = pt->p_tdb_ops->td_thr_setxregs(&th, xregs); - if (err != TD_OK && err != TD_PARTIALREG) - return (set_errno(tdb_to_errno(err))); - - return (0); -} - -#endif /* __sparc */ static int pt_tdb_getfpregs(mdb_tgt_t *t, void *tap, mdb_tgt_tid_t tid, @@ -5062,10 +4979,6 @@ static const pt_ptl_ops_t proc_tdb_ops = { pt_tdb_iter, pt_tdb_getregs, pt_tdb_setregs, -#ifdef __sparc - pt_tdb_getxregs, - pt_tdb_setxregs, -#endif pt_tdb_getfpregs, pt_tdb_setfpregs }; diff --git a/usr/src/cmd/mdb/common/mdb/mdb_tdb.c b/usr/src/cmd/mdb/common/mdb/mdb_tdb.c index e13f05d4f1..d1a67da025 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_tdb.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_tdb.c @@ -185,17 +185,6 @@ mdb_tdb_load(const char *path) if (t->tdb_ops.td_thr_tlsbase == NULL) t->tdb_ops.td_thr_tlsbase = (td_err_e (*)())tdb_notsup; -#ifdef __sparc - t->tdb_ops.td_thr_getxregs = (td_err_e (*)()) - dlsym(hdl, "td_thr_getxregs"); - if (t->tdb_ops.td_thr_getxregs == NULL) - t->tdb_ops.td_thr_getxregs = (td_err_e (*)())tdb_notsup; - - t->tdb_ops.td_thr_setxregs = (td_err_e (*)()) - dlsym(hdl, "td_thr_setxregs"); - if (t->tdb_ops.td_thr_setxregs == NULL) - t->tdb_ops.td_thr_setxregs = (td_err_e (*)())tdb_notsup; -#endif /* __sparc */ return (&t->tdb_ops); } diff --git a/usr/src/cmd/perl/contrib/Sun/Solaris/Kstat/Kstat.xs b/usr/src/cmd/perl/contrib/Sun/Solaris/Kstat/Kstat.xs index 99556bf1c7..92bbc12bdd 100644 --- a/usr/src/cmd/perl/contrib/Sun/Solaris/Kstat/Kstat.xs +++ b/usr/src/cmd/perl/contrib/Sun/Solaris/Kstat/Kstat.xs @@ -82,12 +82,6 @@ #include /* Ultra-specific kstat includes */ -#ifdef __sparc -#include /* from /usr/platform/sun4u/include */ -#include /* from /usr/platform/sun4u/include */ -#include /* from /usr/platform/sun4u/include */ -#include /* from /usr/include */ -#endif /* * Solaris #defines SP, which conflicts with the perl definition of SP @@ -445,198 +439,27 @@ save_nfs(HV *self, kstat_t *kp, int strip_str) * Definition in /usr/platform/sun4u/include/vm/hat_sfmmu.h */ -#ifdef __sparc -static void -save_sfmmu_global_stat(HV *self, kstat_t *kp, int strip_str) -{ - struct sfmmu_global_stat *sfmmugp; - - /* PERL_ASSERT(kp->ks_ndata == 1); */ - PERL_ASSERT(kp->ks_data_size == sizeof (struct sfmmu_global_stat)); - sfmmugp = (struct sfmmu_global_stat *)(kp->ks_data); - - SAVE_INT32(self, sfmmugp, sf_tsb_exceptions); - SAVE_INT32(self, sfmmugp, sf_tsb_raise_exception); - SAVE_INT32(self, sfmmugp, sf_pagefaults); - SAVE_INT32(self, sfmmugp, sf_uhash_searches); - SAVE_INT32(self, sfmmugp, sf_uhash_links); - SAVE_INT32(self, sfmmugp, sf_khash_searches); - SAVE_INT32(self, sfmmugp, sf_khash_links); - SAVE_INT32(self, sfmmugp, sf_swapout); - SAVE_INT32(self, sfmmugp, sf_tsb_alloc); - SAVE_INT32(self, sfmmugp, sf_tsb_allocfail); - SAVE_INT32(self, sfmmugp, sf_tsb_sectsb_create); - SAVE_INT32(self, sfmmugp, sf_scd_1sttsb_alloc); - SAVE_INT32(self, sfmmugp, sf_scd_2ndtsb_alloc); - SAVE_INT32(self, sfmmugp, sf_scd_1sttsb_allocfail); - SAVE_INT32(self, sfmmugp, sf_scd_2ndtsb_allocfail); - SAVE_INT32(self, sfmmugp, sf_tteload8k); - SAVE_INT32(self, sfmmugp, sf_tteload64k); - SAVE_INT32(self, sfmmugp, sf_tteload512k); - SAVE_INT32(self, sfmmugp, sf_tteload4m); - SAVE_INT32(self, sfmmugp, sf_tteload32m); - SAVE_INT32(self, sfmmugp, sf_tteload256m); - SAVE_INT32(self, sfmmugp, sf_tsb_load8k); - SAVE_INT32(self, sfmmugp, sf_tsb_load4m); - SAVE_INT32(self, sfmmugp, sf_hblk_hit); - SAVE_INT32(self, sfmmugp, sf_hblk8_ncreate); - SAVE_INT32(self, sfmmugp, sf_hblk8_nalloc); - SAVE_INT32(self, sfmmugp, sf_hblk1_ncreate); - SAVE_INT32(self, sfmmugp, sf_hblk1_nalloc); - SAVE_INT32(self, sfmmugp, sf_hblk_slab_cnt); - SAVE_INT32(self, sfmmugp, sf_hblk_reserve_cnt); - SAVE_INT32(self, sfmmugp, sf_hblk_recurse_cnt); - SAVE_INT32(self, sfmmugp, sf_hblk_reserve_hit); - SAVE_INT32(self, sfmmugp, sf_get_free_success); - SAVE_INT32(self, sfmmugp, sf_get_free_throttle); - SAVE_INT32(self, sfmmugp, sf_get_free_fail); - SAVE_INT32(self, sfmmugp, sf_put_free_success); - SAVE_INT32(self, sfmmugp, sf_put_free_fail); - SAVE_INT32(self, sfmmugp, sf_pgcolor_conflict); - SAVE_INT32(self, sfmmugp, sf_uncache_conflict); - SAVE_INT32(self, sfmmugp, sf_unload_conflict); - SAVE_INT32(self, sfmmugp, sf_ism_uncache); - SAVE_INT32(self, sfmmugp, sf_ism_recache); - SAVE_INT32(self, sfmmugp, sf_recache); - SAVE_INT32(self, sfmmugp, sf_steal_count); - SAVE_INT32(self, sfmmugp, sf_pagesync); - SAVE_INT32(self, sfmmugp, sf_clrwrt); - SAVE_INT32(self, sfmmugp, sf_pagesync_invalid); - SAVE_INT32(self, sfmmugp, sf_kernel_xcalls); - SAVE_INT32(self, sfmmugp, sf_user_xcalls); - SAVE_INT32(self, sfmmugp, sf_tsb_grow); - SAVE_INT32(self, sfmmugp, sf_tsb_shrink); - SAVE_INT32(self, sfmmugp, sf_tsb_resize_failures); - SAVE_INT32(self, sfmmugp, sf_tsb_reloc); - SAVE_INT32(self, sfmmugp, sf_user_vtop); - SAVE_INT32(self, sfmmugp, sf_ctx_inv); - SAVE_INT32(self, sfmmugp, sf_tlb_reprog_pgsz); - SAVE_INT32(self, sfmmugp, sf_region_remap_demap); - SAVE_INT32(self, sfmmugp, sf_create_scd); - SAVE_INT32(self, sfmmugp, sf_join_scd); - SAVE_INT32(self, sfmmugp, sf_leave_scd); - SAVE_INT32(self, sfmmugp, sf_destroy_scd); -} -#endif /* * Definition in /usr/platform/sun4u/include/vm/hat_sfmmu.h */ -#ifdef __sparc -static void -save_sfmmu_tsbsize_stat(HV *self, kstat_t *kp, int strip_str) -{ - struct sfmmu_tsbsize_stat *sfmmutp; - - /* PERL_ASSERT(kp->ks_ndata == 1); */ - PERL_ASSERT(kp->ks_data_size == sizeof (struct sfmmu_tsbsize_stat)); - sfmmutp = (struct sfmmu_tsbsize_stat *)(kp->ks_data); - - SAVE_INT32(self, sfmmutp, sf_tsbsz_8k); - SAVE_INT32(self, sfmmutp, sf_tsbsz_16k); - SAVE_INT32(self, sfmmutp, sf_tsbsz_32k); - SAVE_INT32(self, sfmmutp, sf_tsbsz_64k); - SAVE_INT32(self, sfmmutp, sf_tsbsz_128k); - SAVE_INT32(self, sfmmutp, sf_tsbsz_256k); - SAVE_INT32(self, sfmmutp, sf_tsbsz_512k); - SAVE_INT32(self, sfmmutp, sf_tsbsz_1m); - SAVE_INT32(self, sfmmutp, sf_tsbsz_2m); - SAVE_INT32(self, sfmmutp, sf_tsbsz_4m); -} -#endif /* * Definition in /usr/platform/sun4u/include/sys/simmstat.h */ -#ifdef __sparc -static void -save_simmstat(HV *self, kstat_t *kp, int strip_str) -{ - uchar_t *simmstatp; - SV *list; - int i; - - /* PERL_ASSERT(kp->ks_ndata == 1); */ - PERL_ASSERT(kp->ks_data_size == sizeof (uchar_t) * SIMM_COUNT); - - list = newSVpv("", 0); - for (i = 0, simmstatp = (uchar_t *)(kp->ks_data); - i < SIMM_COUNT - 1; i++, simmstatp++) { - sv_catpvf(list, "%d,", *simmstatp); - } - sv_catpvf(list, "%d", *simmstatp); - hv_store(self, "status", 6, list, 0); -} -#endif /* * Used by save_temperature to make CSV lists from arrays of * short temperature values */ -#ifdef __sparc -static SV * -short_array_to_SV(short *shortp, int len) -{ - SV *list; - - list = newSVpv("", 0); - for (; len > 1; len--, shortp++) { - sv_catpvf(list, "%d,", *shortp); - } - sv_catpvf(list, "%d", *shortp); - return (list); -} - -/* - * Definition in /usr/platform/sun4u/include/sys/fhc.h - */ - -static void -save_temperature(HV *self, kstat_t *kp, int strip_str) -{ - struct temp_stats *tempsp; - - /* PERL_ASSERT(kp->ks_ndata == 1); */ - PERL_ASSERT(kp->ks_data_size == sizeof (struct temp_stats)); - tempsp = (struct temp_stats *)(kp->ks_data); - - SAVE_UINT32(self, tempsp, index); - hv_store(self, "l1", 2, short_array_to_SV(tempsp->l1, L1_SZ), 0); - hv_store(self, "l2", 2, short_array_to_SV(tempsp->l2, L2_SZ), 0); - hv_store(self, "l3", 2, short_array_to_SV(tempsp->l3, L3_SZ), 0); - hv_store(self, "l4", 2, short_array_to_SV(tempsp->l4, L4_SZ), 0); - hv_store(self, "l5", 2, short_array_to_SV(tempsp->l5, L5_SZ), 0); - SAVE_INT32(self, tempsp, max); - SAVE_INT32(self, tempsp, min); - SAVE_INT32(self, tempsp, state); - SAVE_INT32(self, tempsp, temp_cnt); - SAVE_INT32(self, tempsp, shutdown_cnt); - SAVE_INT32(self, tempsp, version); - SAVE_INT32(self, tempsp, trend); - SAVE_INT32(self, tempsp, override); -} -#endif /* * Not actually defined anywhere - just a short. Yuck. */ -#ifdef __sparc -static void -save_temp_over(HV *self, kstat_t *kp, int strip_str) -{ - short *shortp; - - /* PERL_ASSERT(kp->ks_ndata == 1); */ - PERL_ASSERT(kp->ks_data_size == sizeof (short)); - - shortp = (short *)(kp->ks_data); - hv_store(self, "override", 8, newSViv(*shortp), 0); -} -#endif /* * Defined in /usr/platform/sun4u/include/sys/sysctrl.h @@ -644,70 +467,11 @@ save_temp_over(HV *self, kstat_t *kp, int strip_str) * enumerating *some* of the array indexes.) */ -#ifdef __sparc -static void -save_ps_shadow(HV *self, kstat_t *kp, int strip_str) -{ - uchar_t *ucharp; - - /* PERL_ASSERT(kp->ks_ndata == 1); */ - PERL_ASSERT(kp->ks_data_size == SYS_PS_COUNT); - - ucharp = (uchar_t *)(kp->ks_data); - hv_store(self, "core_0", 6, newSViv(*ucharp++), 0); - hv_store(self, "core_1", 6, newSViv(*ucharp++), 0); - hv_store(self, "core_2", 6, newSViv(*ucharp++), 0); - hv_store(self, "core_3", 6, newSViv(*ucharp++), 0); - hv_store(self, "core_4", 6, newSViv(*ucharp++), 0); - hv_store(self, "core_5", 6, newSViv(*ucharp++), 0); - hv_store(self, "core_6", 6, newSViv(*ucharp++), 0); - hv_store(self, "core_7", 6, newSViv(*ucharp++), 0); - hv_store(self, "pps_0", 5, newSViv(*ucharp++), 0); - hv_store(self, "clk_33", 6, newSViv(*ucharp++), 0); - hv_store(self, "clk_50", 6, newSViv(*ucharp++), 0); - hv_store(self, "v5_p", 4, newSViv(*ucharp++), 0); - hv_store(self, "v12_p", 5, newSViv(*ucharp++), 0); - hv_store(self, "v5_aux", 6, newSViv(*ucharp++), 0); - hv_store(self, "v5_p_pch", 8, newSViv(*ucharp++), 0); - hv_store(self, "v12_p_pch", 9, newSViv(*ucharp++), 0); - hv_store(self, "v3_pch", 6, newSViv(*ucharp++), 0); - hv_store(self, "v5_pch", 6, newSViv(*ucharp++), 0); - hv_store(self, "p_fan", 5, newSViv(*ucharp++), 0); -} -#endif /* * Definition in /usr/platform/sun4u/include/sys/fhc.h */ -#ifdef __sparc -static void -save_fault_list(HV *self, kstat_t *kp, int strip_str) -{ - struct ft_list *faultp; - int i; - char name[KSTAT_STRLEN + 7]; /* room for 999999 faults */ - - /* PERL_ASSERT(kp->ks_ndata == 1); */ - /* PERL_ASSERT(kp->ks_data_size == sizeof (struct ft_list)); */ - - for (i = 1, faultp = (struct ft_list *)(kp->ks_data); - i <= 999999 && i <= kp->ks_data_size / sizeof (struct ft_list); - i++, faultp++) { - (void) snprintf(name, sizeof (name), "unit_%d", i); - hv_store(self, name, strlen(name), newSViv(faultp->unit), 0); - (void) snprintf(name, sizeof (name), "type_%d", i); - hv_store(self, name, strlen(name), newSViv(faultp->type), 0); - (void) snprintf(name, sizeof (name), "fclass_%d", i); - hv_store(self, name, strlen(name), newSViv(faultp->fclass), 0); - (void) snprintf(name, sizeof (name), "create_time_%d", i); - hv_store(self, name, strlen(name), - NEW_UV(faultp->create_time), 0); - (void) snprintf(name, sizeof (name), "msg_%d", i); - hv_store(self, name, strlen(name), newSVpv(faultp->msg, 0), 0); - } -} -#endif /* * We need to be able to find the function corresponding to a particular raw @@ -741,17 +505,6 @@ build_raw_kstat_lookup() SAVE_FNP(raw_kstat_lookup, save_sysinfo, "unix:sysinfo"); SAVE_FNP(raw_kstat_lookup, save_vminfo, "unix:vminfo"); SAVE_FNP(raw_kstat_lookup, save_nfs, "nfs:mntinfo"); -#ifdef __sparc - SAVE_FNP(raw_kstat_lookup, save_sfmmu_global_stat, - "unix:sfmmu_global_stat"); - SAVE_FNP(raw_kstat_lookup, save_sfmmu_tsbsize_stat, - "unix:sfmmu_tsbsize_stat"); - SAVE_FNP(raw_kstat_lookup, save_simmstat, "unix:simm-status"); - SAVE_FNP(raw_kstat_lookup, save_temperature, "unix:temperature"); - SAVE_FNP(raw_kstat_lookup, save_temp_over, "unix:temperature override"); - SAVE_FNP(raw_kstat_lookup, save_ps_shadow, "unix:ps_shadow"); - SAVE_FNP(raw_kstat_lookup, save_fault_list, "unix:fault_list"); -#endif } /* diff --git a/usr/src/cmd/power/handlers.c b/usr/src/cmd/power/handlers.c index ed21caada6..faf55ec557 100644 --- a/usr/src/cmd/power/handlers.c +++ b/usr/src/cmd/power/handlers.c @@ -456,17 +456,6 @@ autopm(void) /* * for "default" behavior, do not enable autopm if not ESTAR_V3 */ -#if defined(__sparc) - if (!bp->isdef || (estar_vers == ESTAR_V3)) { - if (ioctl(pm_fd, bp->cmd, NULL) == -1 && errno != bp->Errno) { - mesg(MERR, "autopm %s failed, %s\n", - behavior, strerror(errno)); - return (NOUP); - } - } - (void) strcpy(new_cc.apm_behavior, behavior); - return (OKUP); -#endif #if defined(__x86) if (!bp->isdef) { if (ioctl(pm_fd, bp->cmd, NULL) == -1 && errno != bp->Errno) { diff --git a/usr/src/cmd/prtconf/prt_xxx.c b/usr/src/cmd/prtconf/prt_xxx.c index a2e78787bd..f8d270aa1b 100644 --- a/usr/src/cmd/prtconf/prt_xxx.c +++ b/usr/src/cmd/prtconf/prt_xxx.c @@ -61,11 +61,7 @@ static struct di_priv_format ppd_format[] = { * of nexus drivers. Note that obio driver * went away with sun4m. */ -#ifdef __sparc - "central dma ebus fhc isa pci rootnex", -#else "central dma ebus fhc isa pci pci_pci rootnex", -#endif /* __sparc */ sizeof (struct ddi_parent_private_data), sizeof (struct regspec), /* first pointer */ diff --git a/usr/src/cmd/ptools/pflags/pflags.c b/usr/src/cmd/ptools/pflags/pflags.c index da3e812b5c..ef0d7ba2d2 100644 --- a/usr/src/cmd/ptools/pflags/pflags.c +++ b/usr/src/cmd/ptools/pflags/pflags.c @@ -505,19 +505,6 @@ prwhat(int why, int what) return (str); } -#if defined(__sparc) -static const char * const regname[NPRGREG] = { - " %g0", " %g1", " %g2", " %g3", " %g4", " %g5", " %g6", " %g7", - " %o0", " %o1", " %o2", " %o3", " %o4", " %o5", " %sp", " %o7", - " %l0", " %l1", " %l2", " %l3", " %l4", " %l5", " %l6", " %l7", - " %i0", " %i1", " %i2", " %i3", " %i4", " %i5", " %fp", " %i7", -#ifdef __sparcv9 - "%ccr", " %pc", "%npc", " %y", "%asi", "%fprs" -#else - "%psr", " %pc", "%npc", " %y", "%wim", "%tbr" -#endif -}; -#endif /* __sparc */ #if defined(__amd64) static const char * const regname[NPRGREG] = { diff --git a/usr/src/cmd/sgs/elfedit/common/elfedit.c b/usr/src/cmd/sgs/elfedit/common/elfedit.c index 1798454c26..8a65584197 100644 --- a/usr/src/cmd/sgs/elfedit/common/elfedit.c +++ b/usr/src/cmd/sgs/elfedit/common/elfedit.c @@ -153,15 +153,6 @@ STATE_T state; * isa_I_str - For 64-bit programs, the same as isa_i_str. For * 32-bit programs, an empty string. */ -#ifdef __sparc -#ifdef __sparcv9 -static const char *isa_i_str = MSG_ORIG(MSG_ISA_SPARC_64); -static const char *isa_I_str = MSG_ORIG(MSG_ISA_SPARC_64); -#else -static const char *isa_i_str = MSG_ORIG(MSG_ISA_SPARC_32); -static const char *isa_I_str = MSG_ORIG(MSG_STR_EMPTY); -#endif -#endif #ifdef __i386 static const char *isa_i_str = MSG_ORIG(MSG_ISA_X86_32); diff --git a/usr/src/cmd/sgs/elfedit/common/elfedit.msg b/usr/src/cmd/sgs/elfedit/common/elfedit.msg index 2ce14c9c49..ef7144e5f7 100644 --- a/usr/src/cmd/sgs/elfedit/common/elfedit.msg +++ b/usr/src/cmd/sgs/elfedit/common/elfedit.msg @@ -614,8 +614,6 @@ # ISA strings. These could be separated into separate message modules # on a per-platform basis if their size became large, but this is probably # cheaper for this small set of strings. -@ MSG_ISA_SPARC_32 "sparc" -@ MSG_ISA_SPARC_64 "sparcv9" @ MSG_ISA_X86_32 "i386" @ MSG_ISA_X86_64 "amd64" diff --git a/usr/src/cmd/sgs/link_audit/common/truss.c b/usr/src/cmd/sgs/link_audit/common/truss.c index 6e8a1ca1e1..f72c26191b 100644 --- a/usr/src/cmd/sgs/link_audit/common/truss.c +++ b/usr/src/cmd/sgs/link_audit/common/truss.c @@ -59,12 +59,6 @@ static sigset_t iset; * should be considered. */ static char *spec_sym[] = { -#if defined(__sparc) - ".stret1", - ".stret2", - ".stret4", - ".stret8", -#endif "__getcontext", "_getcontext", "_getsp", diff --git a/usr/src/cmd/stat/kstat/kstat.c b/usr/src/cmd/stat/kstat/kstat.c index 0237e97f31..34059f2f0f 100644 --- a/usr/src/cmd/stat/kstat/kstat.c +++ b/usr/src/cmd/stat/kstat/kstat.c @@ -1229,265 +1229,12 @@ save_nfs(kstat_t *kp, ks_instance_t *ksi) SAVE_STRING(ksi, mntinfo, mik_curserver); } -#ifdef __sparc -static void -save_sfmmu_global_stat(kstat_t *kp, ks_instance_t *ksi) -{ - struct sfmmu_global_stat *sfmmug = - (struct sfmmu_global_stat *)(kp->ks_data); - - assert(kp->ks_data_size == sizeof (struct sfmmu_global_stat)); - - SAVE_INT32(ksi, sfmmug, sf_tsb_exceptions); - SAVE_INT32(ksi, sfmmug, sf_tsb_raise_exception); - SAVE_INT32(ksi, sfmmug, sf_pagefaults); - SAVE_INT32(ksi, sfmmug, sf_uhash_searches); - SAVE_INT32(ksi, sfmmug, sf_uhash_links); - SAVE_INT32(ksi, sfmmug, sf_khash_searches); - SAVE_INT32(ksi, sfmmug, sf_khash_links); - SAVE_INT32(ksi, sfmmug, sf_swapout); - SAVE_INT32(ksi, sfmmug, sf_tsb_alloc); - SAVE_INT32(ksi, sfmmug, sf_tsb_allocfail); - SAVE_INT32(ksi, sfmmug, sf_tsb_sectsb_create); - SAVE_INT32(ksi, sfmmug, sf_scd_1sttsb_alloc); - SAVE_INT32(ksi, sfmmug, sf_scd_2ndtsb_alloc); - SAVE_INT32(ksi, sfmmug, sf_scd_1sttsb_allocfail); - SAVE_INT32(ksi, sfmmug, sf_scd_2ndtsb_allocfail); - SAVE_INT32(ksi, sfmmug, sf_tteload8k); - SAVE_INT32(ksi, sfmmug, sf_tteload64k); - SAVE_INT32(ksi, sfmmug, sf_tteload512k); - SAVE_INT32(ksi, sfmmug, sf_tteload4m); - SAVE_INT32(ksi, sfmmug, sf_tteload32m); - SAVE_INT32(ksi, sfmmug, sf_tteload256m); - SAVE_INT32(ksi, sfmmug, sf_tsb_load8k); - SAVE_INT32(ksi, sfmmug, sf_tsb_load4m); - SAVE_INT32(ksi, sfmmug, sf_hblk_hit); - SAVE_INT32(ksi, sfmmug, sf_hblk8_ncreate); - SAVE_INT32(ksi, sfmmug, sf_hblk8_nalloc); - SAVE_INT32(ksi, sfmmug, sf_hblk1_ncreate); - SAVE_INT32(ksi, sfmmug, sf_hblk1_nalloc); - SAVE_INT32(ksi, sfmmug, sf_hblk_slab_cnt); - SAVE_INT32(ksi, sfmmug, sf_hblk_reserve_cnt); - SAVE_INT32(ksi, sfmmug, sf_hblk_recurse_cnt); - SAVE_INT32(ksi, sfmmug, sf_hblk_reserve_hit); - SAVE_INT32(ksi, sfmmug, sf_get_free_success); - SAVE_INT32(ksi, sfmmug, sf_get_free_throttle); - SAVE_INT32(ksi, sfmmug, sf_get_free_fail); - SAVE_INT32(ksi, sfmmug, sf_put_free_success); - SAVE_INT32(ksi, sfmmug, sf_put_free_fail); - SAVE_INT32(ksi, sfmmug, sf_pgcolor_conflict); - SAVE_INT32(ksi, sfmmug, sf_uncache_conflict); - SAVE_INT32(ksi, sfmmug, sf_unload_conflict); - SAVE_INT32(ksi, sfmmug, sf_ism_uncache); - SAVE_INT32(ksi, sfmmug, sf_ism_recache); - SAVE_INT32(ksi, sfmmug, sf_recache); - SAVE_INT32(ksi, sfmmug, sf_steal_count); - SAVE_INT32(ksi, sfmmug, sf_pagesync); - SAVE_INT32(ksi, sfmmug, sf_clrwrt); - SAVE_INT32(ksi, sfmmug, sf_pagesync_invalid); - SAVE_INT32(ksi, sfmmug, sf_kernel_xcalls); - SAVE_INT32(ksi, sfmmug, sf_user_xcalls); - SAVE_INT32(ksi, sfmmug, sf_tsb_grow); - SAVE_INT32(ksi, sfmmug, sf_tsb_shrink); - SAVE_INT32(ksi, sfmmug, sf_tsb_resize_failures); - SAVE_INT32(ksi, sfmmug, sf_tsb_reloc); - SAVE_INT32(ksi, sfmmug, sf_user_vtop); - SAVE_INT32(ksi, sfmmug, sf_ctx_inv); - SAVE_INT32(ksi, sfmmug, sf_tlb_reprog_pgsz); - SAVE_INT32(ksi, sfmmug, sf_region_remap_demap); - SAVE_INT32(ksi, sfmmug, sf_create_scd); - SAVE_INT32(ksi, sfmmug, sf_join_scd); - SAVE_INT32(ksi, sfmmug, sf_leave_scd); - SAVE_INT32(ksi, sfmmug, sf_destroy_scd); -} -#endif - -#ifdef __sparc -static void -save_sfmmu_tsbsize_stat(kstat_t *kp, ks_instance_t *ksi) -{ - struct sfmmu_tsbsize_stat *sfmmut; - - assert(kp->ks_data_size == sizeof (struct sfmmu_tsbsize_stat)); - sfmmut = (struct sfmmu_tsbsize_stat *)(kp->ks_data); - - SAVE_INT32(ksi, sfmmut, sf_tsbsz_8k); - SAVE_INT32(ksi, sfmmut, sf_tsbsz_16k); - SAVE_INT32(ksi, sfmmut, sf_tsbsz_32k); - SAVE_INT32(ksi, sfmmut, sf_tsbsz_64k); - SAVE_INT32(ksi, sfmmut, sf_tsbsz_128k); - SAVE_INT32(ksi, sfmmut, sf_tsbsz_256k); - SAVE_INT32(ksi, sfmmut, sf_tsbsz_512k); - SAVE_INT32(ksi, sfmmut, sf_tsbsz_1m); - SAVE_INT32(ksi, sfmmut, sf_tsbsz_2m); - SAVE_INT32(ksi, sfmmut, sf_tsbsz_4m); -} -#endif - -#ifdef __sparc -static void -save_simmstat(kstat_t *kp, ks_instance_t *ksi) -{ - uchar_t *simmstat; - char *simm_buf; - char *list = NULL; - int i; - - assert(kp->ks_data_size == sizeof (uchar_t) * SIMM_COUNT); - - for (i = 0, simmstat = (uchar_t *)(kp->ks_data); i < SIMM_COUNT - 1; - i++, simmstat++) { - if (list == NULL) { - (void) asprintf(&simm_buf, "%d,", *simmstat); - } else { - (void) asprintf(&simm_buf, "%s%d,", list, *simmstat); - free(list); - } - list = simm_buf; - } - - (void) asprintf(&simm_buf, "%s%d", list, *simmstat); - SAVE_STRING_X(ksi, "status", simm_buf); - free(list); - free(simm_buf); -} -#endif - -#ifdef __sparc -/* - * Helper function for save_temperature(). - */ -static char * -short_array_to_string(short *shortp, int len) -{ - char *list = NULL; - char *list_buf; - - for (; len > 1; len--, shortp++) { - if (list == NULL) { - (void) asprintf(&list_buf, "%hd,", *shortp); - } else { - (void) asprintf(&list_buf, "%s%hd,", list, *shortp); - free(list); - } - list = list_buf; - } - - (void) asprintf(&list_buf, "%s%hd", list, *shortp); - free(list); - return (list_buf); -} - -static void -save_temperature(kstat_t *kp, ks_instance_t *ksi) -{ - struct temp_stats *temps = (struct temp_stats *)(kp->ks_data); - char *buf; - - assert(kp->ks_data_size == sizeof (struct temp_stats)); - SAVE_UINT32(ksi, temps, index); - - buf = short_array_to_string(temps->l1, L1_SZ); - SAVE_STRING_X(ksi, "l1", buf); - free(buf); - - buf = short_array_to_string(temps->l2, L2_SZ); - SAVE_STRING_X(ksi, "l2", buf); - free(buf); - - buf = short_array_to_string(temps->l3, L3_SZ); - SAVE_STRING_X(ksi, "l3", buf); - free(buf); - - buf = short_array_to_string(temps->l4, L4_SZ); - SAVE_STRING_X(ksi, "l4", buf); - free(buf); - - buf = short_array_to_string(temps->l5, L5_SZ); - SAVE_STRING_X(ksi, "l5", buf); - free(buf); - - SAVE_INT32(ksi, temps, max); - SAVE_INT32(ksi, temps, min); - SAVE_INT32(ksi, temps, state); - SAVE_INT32(ksi, temps, temp_cnt); - SAVE_INT32(ksi, temps, shutdown_cnt); - SAVE_INT32(ksi, temps, version); - SAVE_INT32(ksi, temps, trend); - SAVE_INT32(ksi, temps, override); -} -#endif -#ifdef __sparc -static void -save_temp_over(kstat_t *kp, ks_instance_t *ksi) -{ - short *sh = (short *)(kp->ks_data); - char *value; - assert(kp->ks_data_size == sizeof (short)); - (void) asprintf(&value, "%hu", *sh); - SAVE_STRING_X(ksi, "override", value); - free(value); -} -#endif -#ifdef __sparc -static void -save_ps_shadow(kstat_t *kp, ks_instance_t *ksi) -{ - uchar_t *uchar = (uchar_t *)(kp->ks_data); - - assert(kp->ks_data_size == SYS_PS_COUNT); - - SAVE_CHAR_X(ksi, "core_0", *uchar++); - SAVE_CHAR_X(ksi, "core_1", *uchar++); - SAVE_CHAR_X(ksi, "core_2", *uchar++); - SAVE_CHAR_X(ksi, "core_3", *uchar++); - SAVE_CHAR_X(ksi, "core_4", *uchar++); - SAVE_CHAR_X(ksi, "core_5", *uchar++); - SAVE_CHAR_X(ksi, "core_6", *uchar++); - SAVE_CHAR_X(ksi, "core_7", *uchar++); - SAVE_CHAR_X(ksi, "pps_0", *uchar++); - SAVE_CHAR_X(ksi, "clk_33", *uchar++); - SAVE_CHAR_X(ksi, "clk_50", *uchar++); - SAVE_CHAR_X(ksi, "v5_p", *uchar++); - SAVE_CHAR_X(ksi, "v12_p", *uchar++); - SAVE_CHAR_X(ksi, "v5_aux", *uchar++); - SAVE_CHAR_X(ksi, "v5_p_pch", *uchar++); - SAVE_CHAR_X(ksi, "v12_p_pch", *uchar++); - SAVE_CHAR_X(ksi, "v3_pch", *uchar++); - SAVE_CHAR_X(ksi, "v5_pch", *uchar++); - SAVE_CHAR_X(ksi, "p_fan", *uchar++); -} -#endif -#ifdef __sparc -static void -save_fault_list(kstat_t *kp, ks_instance_t *ksi) -{ - struct ft_list *fault; - char name[KSTAT_STRLEN + 7]; - int i; - - for (i = 1, fault = (struct ft_list *)(kp->ks_data); - i <= 999999 && i <= kp->ks_data_size / sizeof (struct ft_list); - i++, fault++) { - (void) snprintf(name, sizeof (name), "unit_%d", i); - SAVE_INT32_X(ksi, name, fault->unit); - (void) snprintf(name, sizeof (name), "type_%d", i); - SAVE_INT32_X(ksi, name, fault->type); - (void) snprintf(name, sizeof (name), "fclass_%d", i); - SAVE_INT32_X(ksi, name, fault->fclass); - (void) snprintf(name, sizeof (name), "create_time_%d", i); - SAVE_HRTIME_X(ksi, name, fault->create_time); - (void) snprintf(name, sizeof (name), "msg_%d", i); - SAVE_STRING_X(ksi, name, fault->msg); - } -} -#endif static void save_named(kstat_t *kp, ks_instance_t *ksi) diff --git a/usr/src/cmd/truss/fcall.c b/usr/src/cmd/truss/fcall.c index 36c22aa25c..867ee672e7 100644 --- a/usr/src/cmd/truss/fcall.c +++ b/usr/src/cmd/truss/fcall.c @@ -1657,84 +1657,6 @@ thr_stack_traps(const td_thrhandle_t *Thp, void *cd) return (interrupt | sigusr1); } -#if defined(__sparc) - -uintptr_t -previous_fp(uintptr_t sp, uintptr_t *rpc) -{ - uintptr_t fp = 0; - uintptr_t pc = 0; - -#ifdef _LP64 - if (data_model == PR_MODEL_LP64) { - struct rwindow64 rwin; - if (Pread(Proc, &rwin, sizeof (rwin), sp + STACK_BIAS) - == sizeof (rwin)) { - fp = (uintptr_t)rwin.rw_fp; - pc = (uintptr_t)rwin.rw_rtn; - } - if (fp != 0 && - Pread(Proc, &rwin, sizeof (rwin), fp + STACK_BIAS) - != sizeof (rwin)) - fp = pc = 0; - } else { - struct rwindow32 rwin; -#else /* _LP64 */ - struct rwindow rwin; -#endif /* _LP64 */ - if (Pread(Proc, &rwin, sizeof (rwin), sp) == sizeof (rwin)) { - fp = (uint32_t)rwin.rw_fp; - pc = (uint32_t)rwin.rw_rtn; - } - if (fp != 0 && - Pread(Proc, &rwin, sizeof (rwin), fp) != sizeof (rwin)) - fp = pc = 0; -#ifdef _LP64 - } -#endif - if (rpc) - *rpc = pc; - return (fp); -} - -/* ARGSUSED */ -uintptr_t -get_return_address(uintptr_t *psp) -{ - instr_t inst; - private_t *pri = get_private(); - const lwpstatus_t *Lsp = pri->lwpstat; - uintptr_t rpc; - - rpc = (uintptr_t)Lsp->pr_reg[R_O7] + 8; - if (data_model != PR_MODEL_LP64) - rpc = (uint32_t)rpc; - - /* check for structure return (bletch!) */ - if (Pread(Proc, &inst, sizeof (inst), rpc) == sizeof (inst) && - inst < 0x1000) - rpc += sizeof (instr_t); - - return (rpc); -} - -int -get_arguments(long *argp) -{ - private_t *pri = get_private(); - const lwpstatus_t *Lsp = pri->lwpstat; - int i; - - if (data_model != PR_MODEL_LP64) - for (i = 0; i < 4; i++) - argp[i] = (uint_t)Lsp->pr_reg[R_O0+i]; - else - for (i = 0; i < 4; i++) - argp[i] = (long)Lsp->pr_reg[R_O0+i]; - return (4); -} - -#endif /* __sparc */ #if defined(__i386) || defined(__amd64) diff --git a/usr/src/cmd/truss/print.c b/usr/src/cmd/truss/print.c index 009a9c998e..c5b835543c 100644 --- a/usr/src/cmd/truss/print.c +++ b/usr/src/cmd/truss/print.c @@ -2065,78 +2065,6 @@ prt_utt(private_t *pri, int raw, long val) { const char *s = NULL; -#ifdef __sparc - if (!raw) { - switch (val) { - case UT_INSTRUCTION_DISABLED: - s = "UT_INSTRUCTION_DISABLED"; break; - case UT_INSTRUCTION_ERROR: - s = "UT_INSTRUCTION_ERROR"; break; - case UT_INSTRUCTION_PROTECTION: - s = "UT_INSTRUCTION_PROTECTION"; break; - case UT_ILLTRAP_INSTRUCTION: - s = "UT_ILLTRAP_INSTRUCTION"; break; - case UT_ILLEGAL_INSTRUCTION: - s = "UT_ILLEGAL_INSTRUCTION"; break; - case UT_PRIVILEGED_OPCODE: - s = "UT_PRIVILEGED_OPCODE"; break; - case UT_FP_DISABLED: - s = "UT_FP_DISABLED"; break; - case UT_FP_EXCEPTION_IEEE_754: - s = "UT_FP_EXCEPTION_IEEE_754"; break; - case UT_FP_EXCEPTION_OTHER: - s = "UT_FP_EXCEPTION_OTHER"; break; - case UT_TAG_OVERFLOW: - s = "UT_TAG_OVERFLOW"; break; - case UT_DIVISION_BY_ZERO: - s = "UT_DIVISION_BY_ZERO"; break; - case UT_DATA_EXCEPTION: - s = "UT_DATA_EXCEPTION"; break; - case UT_DATA_ERROR: - s = "UT_DATA_ERROR"; break; - case UT_DATA_PROTECTION: - s = "UT_DATA_PROTECTION"; break; - case UT_MEM_ADDRESS_NOT_ALIGNED: - s = "UT_MEM_ADDRESS_NOT_ALIGNED"; break; - case UT_PRIVILEGED_ACTION: - s = "UT_PRIVILEGED_ACTION"; break; - case UT_ASYNC_DATA_ERROR: - s = "UT_ASYNC_DATA_ERROR"; break; - case UT_TRAP_INSTRUCTION_16: - s = "UT_TRAP_INSTRUCTION_16"; break; - case UT_TRAP_INSTRUCTION_17: - s = "UT_TRAP_INSTRUCTION_17"; break; - case UT_TRAP_INSTRUCTION_18: - s = "UT_TRAP_INSTRUCTION_18"; break; - case UT_TRAP_INSTRUCTION_19: - s = "UT_TRAP_INSTRUCTION_19"; break; - case UT_TRAP_INSTRUCTION_20: - s = "UT_TRAP_INSTRUCTION_20"; break; - case UT_TRAP_INSTRUCTION_21: - s = "UT_TRAP_INSTRUCTION_21"; break; - case UT_TRAP_INSTRUCTION_22: - s = "UT_TRAP_INSTRUCTION_22"; break; - case UT_TRAP_INSTRUCTION_23: - s = "UT_TRAP_INSTRUCTION_23"; break; - case UT_TRAP_INSTRUCTION_24: - s = "UT_TRAP_INSTRUCTION_24"; break; - case UT_TRAP_INSTRUCTION_25: - s = "UT_TRAP_INSTRUCTION_25"; break; - case UT_TRAP_INSTRUCTION_26: - s = "UT_TRAP_INSTRUCTION_26"; break; - case UT_TRAP_INSTRUCTION_27: - s = "UT_TRAP_INSTRUCTION_27"; break; - case UT_TRAP_INSTRUCTION_28: - s = "UT_TRAP_INSTRUCTION_28"; break; - case UT_TRAP_INSTRUCTION_29: - s = "UT_TRAP_INSTRUCTION_29"; break; - case UT_TRAP_INSTRUCTION_30: - s = "UT_TRAP_INSTRUCTION_30"; break; - case UT_TRAP_INSTRUCTION_31: - s = "UT_TRAP_INSTRUCTION_31"; break; - } - } -#endif /* __sparc */ if (s == NULL) prt_dec(pri, 0, val); diff --git a/usr/src/common/crypto/sha1/sha1.c b/usr/src/common/crypto/sha1/sha1.c index 4a64eb2b8c..941400273a 100644 --- a/usr/src/common/crypto/sha1/sha1.c +++ b/usr/src/common/crypto/sha1/sha1.c @@ -1015,21 +1015,10 @@ Encode(uint8_t *_RESTRICT_KYWD output, const uint32_t *_RESTRICT_KYWD input, { size_t i, j; -#if defined(__sparc) - if (IS_P2ALIGNED(output, sizeof (uint32_t))) { - for (i = 0, j = 0; j < len; i++, j += 4) { - /* LINTED E_BAD_PTR_CAST_ALIGN */ - *((uint32_t *)(output + j)) = input[i]; - } - } else { -#endif /* little endian -- will work on big endian, but slowly */ for (i = 0, j = 0; j < len; i++, j += 4) { output[j] = (input[i] >> 24) & 0xff; output[j + 1] = (input[i] >> 16) & 0xff; output[j + 2] = (input[i] >> 8) & 0xff; output[j + 3] = input[i] & 0xff; } -#if defined(__sparc) - } -#endif } diff --git a/usr/src/common/crypto/sha2/sha2.c b/usr/src/common/crypto/sha2/sha2.c index 56ac1ffcd9..66389c0704 100644 --- a/usr/src/common/crypto/sha2/sha2.c +++ b/usr/src/common/crypto/sha2/sha2.c @@ -627,23 +627,12 @@ Encode(uint8_t *_RESTRICT_KYWD output, uint32_t *_RESTRICT_KYWD input, { size_t i, j; -#if defined(__sparc) - if (IS_P2ALIGNED(output, sizeof (uint32_t))) { - for (i = 0, j = 0; j < len; i++, j += 4) { - /* LINTED E_BAD_PTR_CAST_ALIGN */ - *((uint32_t *)(output + j)) = input[i]; - } - } else { -#endif /* little endian -- will work on big endian, but slowly */ for (i = 0, j = 0; j < len; i++, j += 4) { output[j] = (input[i] >> 24) & 0xff; output[j + 1] = (input[i] >> 16) & 0xff; output[j + 2] = (input[i] >> 8) & 0xff; output[j + 3] = input[i] & 0xff; } -#if defined(__sparc) - } -#endif } static void @@ -652,14 +641,6 @@ Encode64(uint8_t *_RESTRICT_KYWD output, uint64_t *_RESTRICT_KYWD input, { size_t i, j; -#if defined(__sparc) - if (IS_P2ALIGNED(output, sizeof (uint64_t))) { - for (i = 0, j = 0; j < len; i++, j += 8) { - /* LINTED E_BAD_PTR_CAST_ALIGN */ - *((uint64_t *)(output + j)) = input[i]; - } - } else { -#endif /* little endian -- will work on big endian, but slowly */ for (i = 0, j = 0; j < len; i++, j += 8) { output[j] = (input[i] >> 56) & 0xff; @@ -671,9 +652,6 @@ Encode64(uint8_t *_RESTRICT_KYWD output, uint64_t *_RESTRICT_KYWD input, output[j + 6] = (input[i] >> 8) & 0xff; output[j + 7] = input[i] & 0xff; } -#if defined(__sparc) - } -#endif } diff --git a/usr/src/common/ficl/loader.c b/usr/src/common/ficl/loader.c index 054beba91a..ce4a835fc2 100644 --- a/usr/src/common/ficl/loader.c +++ b/usr/src/common/ficl/loader.c @@ -1152,8 +1152,4 @@ ficlSystemCompilePlatform(ficlSystem *pSys) ficlDictionarySetConstant(env, "arch-i386", FICL_TRUE); ficlDictionarySetConstant(env, "arch-sparc", FICL_FALSE); #endif -#ifdef __sparc - ficlDictionarySetConstant(env, "arch-i386", FICL_FALSE); - ficlDictionarySetConstant(env, "arch-sparc", FICL_TRUE); -#endif } diff --git a/usr/src/common/ficl/softcore/lz4.c b/usr/src/common/ficl/softcore/lz4.c index abff0700ed..800402897f 100644 --- a/usr/src/common/ficl/softcore/lz4.c +++ b/usr/src/common/ficl/softcore/lz4.c @@ -220,9 +220,6 @@ lz4_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n) #define LZ4_FORCE_UNALIGNED_ACCESS 1 #endif -#ifdef __sparc -#define LZ4_FORCE_SW_BITCOUNT -#endif /* * Compiler Options diff --git a/usr/src/lib/libc/port/gen/walkstack.c b/usr/src/lib/libc/port/gen/walkstack.c index 02afc8f214..de8cc3f6e6 100644 --- a/usr/src/lib/libc/port/gen/walkstack.c +++ b/usr/src/lib/libc/port/gen/walkstack.c @@ -193,9 +193,6 @@ walkcontext(const ucontext_t *uptr, int (*operate_func)(uintptr_t, int, void *), int fd; int sig; -#if defined(__sparc) - int signo = 0; -#endif struct frame *savefp; uintptr_t savepc; @@ -225,15 +222,6 @@ walkcontext(const ucontext_t *uptr, int (*operate_func)(uintptr_t, int, void *), * perturb its registers, we can then read sig out of arg0 * when the saved pc is inside this function. */ -#if defined(__sparc) - - uintptr_t special_pc = NULL; - int special_size = 0; - - extern void thr_sighndlrinfo(void (**func)(), int *funcsize); - - thr_sighndlrinfo((void (**)())&special_pc, &special_size); -#endif /* sparc */ if ((fd = open("/proc/self/as", O_RDONLY)) < 0) @@ -272,17 +260,6 @@ walkcontext(const ucontext_t *uptr, int (*operate_func)(uintptr_t, int, void *), sig = *((int *)(savefp + 1)); #endif -#if defined(__sparc) - /* - * In the case of threads, since there are multiple - * complex routines between kernel and user handler, - * we need to figure out where we can read signal from - * using thr_sighndlrinfo - which we've already done - * for this signal, since it appeared on the stack - * before the signal frame.... sigh. - */ - sig = signo; /* already read - see below */ -#endif /* * this is the special signal frame, so cons up * the saved fp & pc to pass to user's function @@ -296,16 +273,6 @@ walkcontext(const ucontext_t *uptr, int (*operate_func)(uintptr_t, int, void *), oldctx = oldctx->uc_link; /* handle nested signals */ } -#if defined(__sparc) - - /* - * lookahead code to find right spot to read signo from... - */ - - if (savepc >= special_pc && savepc < - (special_pc + special_size)) - signo = fp->fr_arg[0]; -#endif /* * call user-supplied function and quit if non-zero return. diff --git a/usr/src/lib/libc/port/threads/thr.c b/usr/src/lib/libc/port/threads/thr.c index cafc4f6486..b251b5a866 100644 --- a/usr/src/lib/libc/port/threads/thr.c +++ b/usr/src/lib/libc/port/threads/thr.c @@ -634,18 +634,6 @@ _thrp_create(void *stk, size_t stksize, void *(*func)(void *), void *arg, /* debugger support */ ulwp->ul_usropts = flags; -#ifdef __sparc - /* - * We cache several instructions in the thread structure for use - * by the fasttrap DTrace provider. When changing this, read the - * comment in fasttrap.h for the all the other places that must - * be changed. - */ - ulwp->ul_dsave = 0x9de04000; /* save %g1, %g0, %sp */ - ulwp->ul_drestore = 0x81e80000; /* restore %g0, %g0, %g0 */ - ulwp->ul_dftret = 0x91d0203a; /* ta 0x3a */ - ulwp->ul_dreturn = 0x81ca0000; /* return %o0 */ -#endif ulwp->ul_startpc = func; ulwp->ul_startarg = arg; @@ -1325,18 +1313,6 @@ libc_init(void) (self->ul_sigmask.__sigbits[2] ^ uc.uc_sigmask.__sigbits[2]) | (self->ul_sigmask.__sigbits[3] ^ uc.uc_sigmask.__sigbits[3])); -#ifdef __sparc - /* - * We cache several instructions in the thread structure for use - * by the fasttrap DTrace provider. When changing this, read the - * comment in fasttrap.h for the all the other places that must - * be changed. - */ - self->ul_dsave = 0x9de04000; /* save %g1, %g0, %sp */ - self->ul_drestore = 0x81e80000; /* restore %g0, %g0, %g0 */ - self->ul_dftret = 0x91d0203a; /* ta 0x3a */ - self->ul_dreturn = 0x81ca0000; /* return %o0 */ -#endif self->ul_stktop = (uintptr_t)uc.uc_stack.ss_sp + uc.uc_stack.ss_size; (void) getrlimit(RLIMIT_STACK, &rl); diff --git a/usr/src/lib/libc_db/common/thread_db.c b/usr/src/lib/libc_db/common/thread_db.c index 652b70d080..a7189cbdd2 100644 --- a/usr/src/lib/libc_db/common/thread_db.c +++ b/usr/src/lib/libc_db/common/thread_db.c @@ -1988,26 +1988,7 @@ __td_thr_setfpregs(td_thrhandle_t *th_p, const prfpregset_t *fpregset) td_err_e __td_thr_getxregsize(td_thrhandle_t *th_p, int *xregsize) { -#if defined(__sparc) - struct ps_prochandle *ph_p; - td_err_e return_val; - - if ((ph_p = ph_lock_th(th_p, &return_val)) == NULL) - return (return_val); - if (ps_pstop(ph_p) != PS_OK) { - ph_unlock(th_p->th_ta_p); - return (TD_DBERR); - } - - if (ps_lgetxregsize(ph_p, thr_to_lwpid(th_p), xregsize) != PS_OK) - return_val = TD_DBERR; - - (void) ps_pcontinue(ph_p); - ph_unlock(th_p->th_ta_p); - return (return_val); -#else /* __sparc */ return (TD_NOXREGS); -#endif /* __sparc */ } /* @@ -2018,26 +1999,7 @@ __td_thr_getxregsize(td_thrhandle_t *th_p, int *xregsize) td_err_e __td_thr_getxregs(td_thrhandle_t *th_p, void *xregset) { -#if defined(__sparc) - struct ps_prochandle *ph_p; - td_err_e return_val; - - if ((ph_p = ph_lock_th(th_p, &return_val)) == NULL) - return (return_val); - if (ps_pstop(ph_p) != PS_OK) { - ph_unlock(th_p->th_ta_p); - return (TD_DBERR); - } - - if (ps_lgetxregs(ph_p, thr_to_lwpid(th_p), (caddr_t)xregset) != PS_OK) - return_val = TD_DBERR; - - (void) ps_pcontinue(ph_p); - ph_unlock(th_p->th_ta_p); - return (return_val); -#else /* __sparc */ return (TD_NOXREGS); -#endif /* __sparc */ } /* @@ -2048,26 +2010,7 @@ __td_thr_getxregs(td_thrhandle_t *th_p, void *xregset) td_err_e __td_thr_setxregs(td_thrhandle_t *th_p, const void *xregset) { -#if defined(__sparc) - struct ps_prochandle *ph_p; - td_err_e return_val; - - if ((ph_p = ph_lock_th(th_p, &return_val)) == NULL) - return (return_val); - if (ps_pstop(ph_p) != PS_OK) { - ph_unlock(th_p->th_ta_p); - return (TD_DBERR); - } - - if (ps_lsetxregs(ph_p, thr_to_lwpid(th_p), (caddr_t)xregset) != PS_OK) - return_val = TD_DBERR; - - (void) ps_pcontinue(ph_p); - ph_unlock(th_p->th_ta_p); - return (return_val); -#else /* __sparc */ return (TD_NOXREGS); -#endif /* __sparc */ } struct searcher { diff --git a/usr/src/lib/libcpc/common/obsoleted.c b/usr/src/lib/libcpc/common/obsoleted.c index 7c6d3b805e..e528b409d9 100644 --- a/usr/src/lib/libcpc/common/obsoleted.c +++ b/usr/src/lib/libcpc/common/obsoleted.c @@ -51,11 +51,7 @@ cpc_t *__cpc = NULL; mutex_t __cpc_lock; /* protects __cpc handle */ int __cpc_v1_cpuver; /* CPU version in use by CPCv1 client */ -#ifdef __sparc -uint64_t __cpc_v1_pcr; /* last bound %pcr value */ -#else uint32_t __cpc_v1_pes[2]; /* last bound %pes values */ -#endif /* __sparc */ int __cpc_init(void) @@ -99,12 +95,8 @@ cpc_bind_event(cpc_event_t *this, int flags) * to fake that behavior for CPCv1 clients. */ __cpc_v1_cpuver = this->ce_cpuver; -#ifdef __sparc - __cpc_v1_pcr = this->ce_pcr; -#else __cpc_v1_pes[0] = this->ce_pes[0]; __cpc_v1_pes[1] = this->ce_pes[1]; -#endif /* __sparc */ if ((set = __cpc_eventtoset(__cpc, this, flags)) == NULL) { errno = EINVAL; @@ -131,12 +123,8 @@ int cpc_take_sample(cpc_event_t *this) { this->ce_cpuver = __cpc_v1_cpuver; -#ifdef __sparc - this->ce_pcr = __cpc_v1_pcr; -#else this->ce_pes[0] = __cpc_v1_pes[0]; this->ce_pes[1] = __cpc_v1_pes[1]; -#endif /* __sparc */ return (syscall(SYS_cpc, CPC_SAMPLE, -1, this->ce_pic, &this->ce_hrt, &CPC_TICKREG(this), 0)); diff --git a/usr/src/lib/libdevinfo/devfsinfo.c b/usr/src/lib/libdevinfo/devfsinfo.c index 96071cff86..efec48c694 100644 --- a/usr/src/lib/libdevinfo/devfsinfo.c +++ b/usr/src/lib/libdevinfo/devfsinfo.c @@ -764,7 +764,6 @@ get_boot_dev_var(struct openpromio *opp) return (0); } -#ifndef __sparc /* * Just return error from it, at least for now. * This is part of private interface, no consumers on gate. @@ -774,7 +773,6 @@ find_x86_boot_device(struct openpromio *opp) { return (DEVFS_ERR); } -#endif /* ndef __sparc */ /* * retrieve the list of entries in the boot-device configuration diff --git a/usr/src/lib/libdevinfo/devfsmap.c b/usr/src/lib/libdevinfo/devfsmap.c index daf6cb6bb1..375027a3f5 100644 --- a/usr/src/lib/libdevinfo/devfsmap.c +++ b/usr/src/lib/libdevinfo/devfsmap.c @@ -37,10 +37,6 @@ #include #include #include -#ifdef __sparc -#include -#include -#endif /* __sparc */ #include "libdevinfo.h" #include "device_info.h" #include @@ -403,1127 +399,6 @@ digit: return (token); } -#ifdef __sparc - -static void -free_confent(struct conf_entry *confent) -{ - free(confent->name); - free(confent->parent); - free(confent->class); - free(confent->unit_address); - free(confent); -} - -static void -free_confent_list(struct conf_entry *confent_list) -{ - struct conf_entry *confent, *next; - - for (confent = confent_list; confent != NULL; confent = next) { - next = confent->next; - free_confent(confent); - } -} - -/* - * Parse the next entry from the driver.conf file and return in the form of - * a pointer to the conf_entry. - */ -static struct conf_entry * -parse_conf_entry(struct conf_file *filep, char *tokbuf, size_t linesize) -{ - char *prop_name, *string; - token_t token; - struct conf_entry *confent; - conf_state_t state; - int failed = 1; - - if ((confent = calloc(1, sizeof (*confent))) == NULL) - return (NULL); - - confent->port = -1; - confent->mpxio_disable = -1; - - state = begin; - token = T_NAME; - prop_name = NULL; - string = NULL; - do { - switch (token) { - case T_NAME: - switch (state) { - case prop_equals_string: - case prop_equals_integer: - case begin: - state = prop; - if ((prop_name = strdup(tokbuf)) == NULL) - goto bad; - break; - default: - file_err(filep, tok_err, tokbuf); - } - break; - case T_EQUALS: - switch (state) { - case prop: - state = prop_equals; - break; - default: - file_err(filep, tok_err, tokbuf); - } - break; - case T_STRING: - switch (state) { - case prop_equals: - if ((string = strdup(tokbuf)) == NULL) - goto bad; - - state = begin; - if (strcmp(prop_name, "PARENT") == 0 || - strcmp(prop_name, "parent") == 0) { - if (confent->parent) { - file_err(filep, - "'parent' property already specified\n"); - goto bad; - } - confent->parent = string; - } else if (strcmp(prop_name, "NAME") == 0 || - strcmp(prop_name, "name") == 0) { - if (confent->name) { - file_err(filep, - "'name' property already specified\n"); - goto bad; - } - confent->name = string; - } else if (strcmp(prop_name, "CLASS") == 0 || - strcmp(prop_name, "class") == 0) { - if (confent->class) { - file_err(filep, - "'class' property already specified\n"); - goto bad; - } - confent->class = string; - } else if (strcmp(prop_name, "unit-address") - == 0) { - if (confent->unit_address) { - file_err(filep, - "'unit-address' property already specified\n"); - goto bad; - } - confent->unit_address = string; - } else if (strcmp(prop_name, "mpxio-disable") - == 0) { - if (confent->mpxio_disable != -1) { - file_err(filep, - "'mpxio-disable' property already specified\n"); - goto bad; - } - if (strcmp(string, "yes") == 0) - confent->mpxio_disable = 1; - else if (strcmp(string, "no") == 0) - confent->mpxio_disable = 0; - else { - file_err(filep, - "'mpxio-disable' property setting is invalid. " - "The value must be either \"yes\" or \"no\"\n"); - goto bad; - } - free(string); - } else { - free(string); - state = prop_equals_string; - } - string = NULL; - free(prop_name); - prop_name = NULL; - break; - - case prop_equals_string_comma: - state = prop_equals_string; - break; - default: - file_err(filep, tok_err, tokbuf); - } - break; - case T_HEXVAL: - case T_DECVAL: - switch (state) { - case prop_equals: - if (strcmp(prop_name, "port") == 0) { - if (confent->port != -1) { - file_err(filep, - "'port' property already specified\n"); - goto bad; - } - confent->port = - (int)strtol(tokbuf, NULL, 0); - state = begin; - } else - state = prop_equals_integer; - free(prop_name); - prop_name = NULL; - break; - - case prop_equals_integer_comma: - state = prop_equals_integer; - break; - default: - file_err(filep, tok_err, tokbuf); - } - break; - case T_COMMA: - switch (state) { - case prop_equals_string: - state = prop_equals_string_comma; - break; - case prop_equals_integer: - state = prop_equals_integer_comma; - break; - default: - file_err(filep, tok_err, tokbuf); - } - break; - case T_NEWLINE: - filep->linenum++; - break; - case T_POUND: - find_eol(filep->fp); - break; - case T_EOF: - file_err(filep, "Unexpected EOF\n"); - goto bad; - default: - file_err(filep, tok_err, tokbuf); - goto bad; - } - } while ((token = lex(filep, tokbuf, linesize)) != T_SEMICOLON); - - failed = 0; - -bad: - free(prop_name); - free(string); - if (failed == 1) { - free_confent(confent); - return (NULL); - } - return (confent); -} - -/* - * Parse all entries with mpxio-disable property in the given driver.conf - * file. - * - * fname driver.conf file name - * confent_list on return *confent_list will contain the list of - * driver.conf file entries with mpxio-disable property. - * mpxio_disable on return *mpxio_disable is set to the setting of the - * driver global mpxio-dissable property as follows. - * 0 if driver mpxio-disable="no" - * 1 if driver mpxio-disable="yes" - * -1 if driver mpxio-disable property isn't specified. - */ -static void -parse_conf_file(char *fname, struct conf_entry **confent_list, - int *mpxio_disable) -{ - struct conf_entry *confent, *tail = NULL; - token_t token; - struct conf_file file; - char tokval[MAX_TOKEN_SIZE]; - - *confent_list = NULL; - *mpxio_disable = -1; - if ((file.fp = fopen(fname, "r")) == NULL) - return; - - file.filename = fname; - file.linenum = 1; - - while ((token = lex(&file, tokval, MAX_TOKEN_SIZE)) != T_EOF) { - switch (token) { - case T_POUND: - /* - * Skip comments. - */ - find_eol(file.fp); - break; - case T_NAME: - if ((confent = parse_conf_entry(&file, tokval, - MAX_TOKEN_SIZE)) == NULL) - break; - /* - * No name indicates global property. - * Make sure parent and class not NULL. - */ - if (confent->name == NULL) { - if (confent->parent || - confent->class) { - file_err(&file, - "missing name attribute\n"); - } else if (confent->mpxio_disable != -1) { - if (*mpxio_disable == -1) - *mpxio_disable = - confent->mpxio_disable; - else - file_err(&file, - "'mpxio-disable' property already specified\n"); - } - free_confent(confent); - break; - } - - /* - * This is a node spec, either parent or class - * must be specified. - */ - if (confent->parent == NULL && confent->class == NULL) { - file_err(&file, - "missing parent or class attribute\n"); - free_confent(confent); - break; - } - - /* only need entries with mpxio_disable property */ - if (confent->mpxio_disable == -1) { - free_confent(confent); - break; - } - - if (tail) - tail->next = confent; - else - *confent_list = confent; - tail = confent; - break; - - case T_NEWLINE: - file.linenum++; - break; - default: - break; - } - } - - (void) fclose(file.fp); -} - -/* - * Return the driver class of the given driver_name. - * The memory for the driver class is allocated by this function and the - * caller must free it. - */ -static char * -get_driver_class(char *rootdir, char *driver_name) -{ - FILE *fp; - char buf[BUFSIZE]; - char driver[BUFSIZE]; - char class_name[BUFSIZE]; - - logdmsg(("get_driver_class: rootdir = %s, driver name = %s\n", - rootdir, driver_name)); - - (void) snprintf(buf, sizeof (buf), "%s%s", rootdir, DRIVER_CLASSES); - - if ((fp = fopen(buf, "r")) == NULL) { - logdmsg(("get_driver_class: failed to open %s: %s\n", - buf, strerror(errno))); - return (NULL); - } - - while (fgets(buf, sizeof (buf), fp) != NULL) { - /* LINTED - unbounded string specifier */ - if ((sscanf(buf, "%s %s", driver, class_name) == 2) && - driver[0] != '#' && strcmp(driver, driver_name) == 0) { - logdmsg(("get_driver_class: driver class = %s\n", - class_name)); - (void) fclose(fp); - return (strdup(class_name)); - } - } - - (void) fclose(fp); - return (NULL); -} - -static int -lookup_in_confent_list(struct conf_entry *confent_list, - int match_class, char *parent, char *unit_addr, int port) -{ - struct conf_entry *confent; - char *par; - - logdmsg(("lookup_in_confent_list: %s = \"%s\", unit_addr = \"%s\", " - "port = %d\n", (match_class) ? "class" : "parent", parent, - STRVAL(unit_addr), port)); - - for (confent = confent_list; confent != NULL; confent = confent->next) { - par = (match_class) ? confent->class : confent->parent; - if (unit_addr) { - if (confent->unit_address != NULL && - strcmp(confent->unit_address, unit_addr) == 0 && - par != NULL && strcmp(par, parent) == 0) - return (confent->mpxio_disable); - } else { - if (confent->port == port && - par != NULL && strcmp(par, parent) == 0) - return (confent->mpxio_disable); - } - } - return (-1); -} - -/* - * lookup mpxio-disabled property setting for the given path in the given - * driver.conf file. Match the entries from most specific to least specific. - * - * conf_file the path name of either fp.conf, qlc.conf or scsi_vhci.conf - * path /devices node path without the /devices prefix. - * If the conf_file is fp.conf, path must be a fp node path - * if the conf_file is qlc.conf, path must be a qlc node path. - * if the conf_file is scsi_vhci.conf, path must be NULL. - * ex: /pci@8,600000/SUNW,qlc@4/fp@0,0 - * /pci@8,600000/SUNW,qlc@4 - * - * returns: - * 0 if mpxio-disable="no" - * 1 if mpxio-disable="yes" - * -1 if mpxio-disable property isn't specified. - */ -static int -lookup_in_conf_file(char *rootdir, char *conf_file, char *path) -{ - struct conf_entry *confent_list = NULL; - int mpxio_disable; - di_node_t par_node = DI_NODE_NIL; - char *node_name = NULL, *node_addr = NULL; - char *unit_addr = NULL; - int port = -1; - char *par_node_name = NULL, *par_node_addr = NULL; - char *par_binding_name = NULL, *par_driver_name = NULL; - char *par_driver_class = NULL, *par_node_name_addr; - int rv = -1; - char buf[MAXPATHLEN]; - - logdmsg(("lookup_in_conf_file: rootdir = \"%s\", conf_file = \"%s\", " - "path = \"%s\"\n", rootdir, conf_file, STRVAL(path))); - - (void) snprintf(buf, MAXPATHLEN, "%s%s", rootdir, conf_file); - parse_conf_file(buf, &confent_list, &mpxio_disable); -#ifdef DEBUG - log_confent_list(buf, confent_list, mpxio_disable); -#endif - - /* if path is NULL, return driver global mpxio-disable setting */ - if (path == NULL) { - rv = mpxio_disable; - goto done; - } - - if ((node_name = strrchr(path, '/')) == NULL) - goto done; - - *node_name = '\0'; - node_name++; - - if ((node_addr = strchr(node_name, '@')) == NULL) - goto done; - - *node_addr = '\0'; - node_addr++; - - if (strcmp(node_name, "fp") == 0) { - /* get port number; encoded in the node addr as a hex number */ - port = (int)strtol(node_addr, NULL, 16); - } else - unit_addr = node_addr; - - /* - * Match from most specific to least specific; - * first, start the lookup based on full path. - */ - if ((rv = lookup_in_confent_list(confent_list, 0, path, - unit_addr, port)) != -1) - goto done; - - /* lookup nodename@address */ - if ((par_node_name_addr = strrchr(path, '/')) != NULL) { - par_node_name_addr++; - if ((rv = lookup_in_confent_list(confent_list, 0, - par_node_name_addr, unit_addr, port)) != -1) - goto done; - } - - /* di_init() doesn't work when 0 is passed in flags */ - par_node = di_init(path, DINFOMINOR); - if (par_node != DI_NODE_NIL) { - par_node_name = di_node_name(par_node); - par_node_addr = di_bus_addr(par_node); - par_binding_name = di_binding_name(par_node); - par_driver_name = di_driver_name(par_node); - } - - logdmsg(("par_node_name = %s\n", STRVAL(par_node_name))); - logdmsg(("par_node_addr = %s\n", STRVAL(par_node_addr))); - logdmsg(("par_binding_name = %s\n", STRVAL(par_binding_name))); - logdmsg(("par_driver_name = %s\n", STRVAL(par_driver_name))); - - /* lookup bindingname@address */ - if (par_binding_name != NULL && par_binding_name != par_node_name && - par_node_addr != NULL) { - (void) snprintf(buf, sizeof (buf), "%s@%s", par_binding_name, - par_node_addr); - if ((rv = lookup_in_confent_list(confent_list, 0, - buf, unit_addr, port)) != -1) - goto done; - } - - /* lookup binding name */ - if (par_binding_name != NULL) { - if ((rv = lookup_in_confent_list(confent_list, 0, - par_binding_name, unit_addr, port)) != -1) - goto done; - } - - if (par_driver_name != NULL) { - /* lookup driver name */ - if ((rv = lookup_in_confent_list(confent_list, 0, - par_driver_name, unit_addr, port)) != -1) - goto done; - - /* finally, lookup class name */ - par_driver_class = get_driver_class(rootdir, par_driver_name); - if (par_driver_class != NULL) { - if ((rv = lookup_in_confent_list(confent_list, 1, - par_driver_class, unit_addr, port)) != -1) - goto done; - } - } - - /* - * no match so far; - * use the driver global mpxio-disable setting if exists. - */ - rv = mpxio_disable; - -done: - if (node_name != NULL) - *(node_name - 1) = '/'; - if (node_addr != NULL) - *(node_addr - 1) = '@'; - free(par_driver_class); - if (confent_list != NULL) - free_confent_list(confent_list); - if (par_node != DI_NODE_NIL) - di_fini(par_node); - - return (rv); -} - -/* - * Given client_name return whether it is a phci or vhci based name. - * client_name is /devices name of a client without the /devices prefix. - * - * client_name Return value - * .../fp@xxx/ssd@yyy CLIENT_TYPE_PHCI - * .../scsi_vhci/ssd@yyy CLIENT_TYPE_VHCI - * other CLIENT_TYPE_UNKNOWN - */ -static client_type_t -client_name_type(char *client_name) -{ - client_type_t client_type; - char *p1, *p2; - - logdmsg(("client_name_type: client_name = %s\n", client_name)); - - if (strncmp(client_name, SLASH_SCSI_VHCI, - sizeof (SLASH_SCSI_VHCI) - 1) == 0) - return (CLIENT_TYPE_VHCI); - - if (*client_name != '/') - return (CLIENT_TYPE_UNKNOWN); - - if ((p1 = strrchr(client_name, '/')) == NULL) - return (CLIENT_TYPE_UNKNOWN); - - *p1 = '\0'; - - if ((p2 = strrchr(client_name, '/')) != NULL && - strncmp(p2, SLASH_FP_AT, sizeof (SLASH_FP_AT) - 1) == 0) - client_type = CLIENT_TYPE_PHCI; - else - client_type = CLIENT_TYPE_UNKNOWN; - - *p1 = '/'; - return (client_type); -} - -/* - * Compare controller name portion of dev1 and dev2. - * - * rootdir root directory of the target environment - * dev1 can be either a /dev link or /devices name in the target - * environemnt - * dev2 /devices name of a device without the /devices prefix - * - * Returns: - * 0 if controller names match - * 1 if controller names don't match - * -1 an error occurred. - */ -static int -compare_controller(char *rootdir, char *dev1, char *dev2) -{ - int linksize; - char *p1, *p; - char physdev1[MAXPATHLEN]; - char buf[MAXPATHLEN]; - - logdmsg(("compare_controller: rootdir = %s, dev1 = %s, dev2 = %s\n", - rootdir, dev1, dev2)); - - if (strncmp(dev1, SLASH_DEV_SLASH, sizeof (SLASH_DEV_SLASH) - 1) - == 0) { - (void) snprintf(buf, MAXPATHLEN, "%s%s", rootdir, dev1); - if ((linksize = readlink(buf, physdev1, MAXPATHLEN)) > 0 && - linksize < (MAXPATHLEN - 1)) { - physdev1[linksize] = '\0'; - logdmsg(("compare_controller: physdev1 = %s\n", - physdev1)); - } else - return (-1); - } else - (void) strlcpy(physdev1, dev1, MAXPATHLEN); - - if ((p1 = strstr(physdev1, SLASH_DEVICES)) == NULL) - return (-1); - - p1 += sizeof (SLASH_DEVICES) - 1; - /* strip the device portion */ - if ((p = strrchr(p1, '/')) == NULL) - return (-1); - *p = '\0'; - - if ((p = strrchr(dev2, '/')) == NULL) - return (-1); - *p = '\0'; - - logdmsg(("compare_controller: path1 = %s, path2 = %s\n", - p1, dev2)); - if (strcmp(p1, dev2) == 0) { - *p = '/'; - return (0); - } else { - *p = '/'; - return (1); - } -} - -/* - * Check if the specified device path is on the root controller. - * - * rootdir root directory of the target environment - * path /devices name of a device without the /devices prefix - * - * Returns - * 1 if the path is on the root controller - * 0 if the path is not on the root controller - * -1 if an error occurs - */ -static int -is_root_controller(char *rootdir, char *path) -{ - FILE *fp; - char *tmpfile; - int rv = -1; - struct vfstab vfsent; - char buf[MAXPATHLEN]; - char ctd[MAXNAMELEN + 1]; - - logdmsg(("is_root_controller: rootdir = %s, path = %s\n", rootdir, - path)); - - (void) snprintf(buf, MAXPATHLEN, "%s%s", rootdir, VFSTAB); - - if ((fp = fopen(buf, "r")) == NULL) { - logdmsg(("is_root_controller: failed to open %s: %s\n", - buf, strerror(errno))); - return (-1); - } - - if (getvfsfile(fp, &vfsent, "/") != 0) { - logdmsg(("is_root_controller: getvfsfile: failed to read " - "vfstab entry for mount point \"/\": %s\n", - strerror(errno))); - (void) fclose(fp); - return (-1); - } - (void) fclose(fp); - - /* check if the root is an svm metadisk */ - if (strncmp(vfsent.vfs_special, META_DEV, sizeof (META_DEV) - 1) != 0) { - if (compare_controller(rootdir, vfsent.vfs_special, path) == 0) - return (1); - else - return (0); - } - - /* Don't use /var/run as it is not mounted in miniroot */ - if ((tmpfile = tempnam("/tmp", "diirc")) == NULL) { - logdmsg(("is_root_controller: tempnam: failed: %s\n", - strerror(errno))); - return (-1); - } - - /* get metadisk components using metastat command */ - (void) snprintf(buf, MAXPATHLEN, - "/usr/sbin/metastat -p %s 2>/dev/null | " - "/usr/bin/grep ' 1 1 ' | " - "/usr/bin/sed -e 's/^.* 1 1 //' | " - "/usr/bin/cut -f1 -d ' ' > %s", - vfsent.vfs_special + sizeof (META_DEV) - 1, tmpfile); - - logdmsg(("is_root_controller: command = %s\n", buf)); - fp = NULL; - if (system(buf) == 0 && (fp = fopen(tmpfile, "r")) != NULL) { - while (fscanf(fp, "%" VAL2STR(MAXNAMELEN) "s", ctd) == 1) { - (void) snprintf(buf, MAXPATHLEN, "/dev/dsk/%s", ctd); - if (compare_controller(rootdir, buf, path) == 0) { - rv = 1; - goto out; - } - } - rv = 0; - } - -out: - if (fp) - (void) fclose(fp); - (void) unlink(tmpfile); - free(tmpfile); - return (rv); -} - -static int -file_exists(char *rootdir, char *path) -{ - struct stat stbuf; - char fullpath[MAXPATHLEN]; - int x; - - (void) snprintf(fullpath, MAXPATHLEN, "%s%s", rootdir, path); - - x = stat(fullpath, &stbuf); - logdmsg(("file_exists: %s: %s\n", fullpath, (x == 0) ? "yes" : "no")); - if (x == 0) - return (1); - else - return (0); -} - -/* - * Check if mpxio is enabled or disabled on the specified device path. - * Looks through the .conf files to determine the mpxio setting. - * - * rootdir root directory of the target environment - * path /devices name of a device without the /devices prefix and - * minor name component. - * - * Returns - * 1 if mpxio is disabled - * 0 if mpxio is enabled - * -1 if an error occurs - */ -static int -is_mpxio_disabled(char *rootdir, char *path) -{ - int mpxio_disable; - char *p; - int check_root_controller; - - logdmsg(("is_mpxio_disabled: rootdir = %s, path = %s\n", - rootdir, path)); - - if (file_exists(rootdir, SCSI_VHCI_CONF) == 0) { - /* - * scsi_vhci.conf doesn't exist: - * if upgrading from a pre solaris 9 release. or - * if this function is called during fresh or flash install - * prior to installing scsi_vhci.conf file. - */ - if (file_exists(rootdir, "/kernel/drv")) - /* upgrading from pre solaris 9 */ - return (1); - else - /* fresh or flash install */ - return (0); - } - - mpxio_disable = lookup_in_conf_file(rootdir, SCSI_VHCI_CONF, NULL); - - /* - * scsi_vhci.conf contains mpxio-disable property only in s9 and - * s8+sfkpatch. This property is no longer present from s10 onwards. - */ - if (mpxio_disable == 1) { - /* upgrading from s8 or s9 with mpxio globally disabled */ - return (1); - } else if (mpxio_disable == 0) { - /* upgrading from s8 or s9 with mpxio globally enabled */ - check_root_controller = 1; - } else { - /* - * We are looking at the s10 version of the file. This is - * the case if this function is called after installing the - * new scsi_vhci.conf file. - */ - check_root_controller = 0; - } - - if ((mpxio_disable = lookup_in_conf_file(rootdir, FP_CONF, path)) - != -1) - return (mpxio_disable); - - if ((p = strrchr(path, '/')) == NULL) - return (-1); - - *p = '\0'; - if ((mpxio_disable = lookup_in_conf_file(rootdir, QLC_CONF, path)) - != -1) { - *p = '/'; - return (mpxio_disable); - } - *p = '/'; - - /* - * mpxio-disable setting is not found in the .conf files. - * The default is to enable mpxio, except if the path is on the root - * controller. - * - * In s8 and s9 mpxio is not supported on the root controller. - * NWS supplies a patch to enable root controller support in s8 and s9. - * If the system had the patch installed, the fp.conf file would have - * explicit "mpxio-disable=no" for the root controller. So we would - * have found the mpxio-disable setting when we looked up this property - * in the fp.conf file. - */ - if (check_root_controller) { - mpxio_disable = is_root_controller(rootdir, path); - logdmsg(("is_mpxio_disabled: is_root_controller returned %d\n", - mpxio_disable)); - } else - mpxio_disable = 0; - - return (mpxio_disable); -} - -static int -vhci_ctl(sv_iocdata_t *iocp, int cmd) -{ - int fd, rv; - - if ((fd = open(VHCI_CTL_NODE, O_RDWR)) < 0) - return (-1); - rv = ioctl(fd, cmd, iocp); - (void) close(fd); - return (rv); -} - -/* - * Convert a phci client name to vhci client name. - * - * phci_name phci client /devices name without the /devices prefix and - * minor name component. - * ex: /pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w2100002037cd9f72,0 - * - * Returns on success, vhci client name is returned. The memory for - * the vhci name is allocated by this function and the caller - * must free it. - * on failure, NULL is returned. - */ -static char * -phci_to_vhci(char *phci_name) -{ - sv_iocdata_t ioc; - char *slash, *addr, *retp; - char vhci_name_buf[MAXPATHLEN]; - char phci_name_buf[MAXPATHLEN]; - char addr_buf[MAXNAMELEN]; - - logdmsg(("phci_to_vhci: pchi_name = %s\n", phci_name)); - (void) strlcpy(phci_name_buf, phci_name, MAXPATHLEN); - - if ((slash = strrchr(phci_name_buf, '/')) == NULL || - (addr = strchr(slash, '@')) == NULL) - return (NULL); - - *slash = '\0'; - addr++; - (void) strlcpy(addr_buf, addr, MAXNAMELEN); - - bzero(&ioc, sizeof (sv_iocdata_t)); - ioc.client = vhci_name_buf; - ioc.phci = phci_name_buf; - ioc.addr = addr_buf; - if (vhci_ctl(&ioc, SCSI_VHCI_GET_CLIENT_NAME) != 0) { - logdmsg(("phci_to_vhci: vhci_ctl failed: %s\n", - strerror(errno))); - return (NULL); - } - - retp = strdup(vhci_name_buf); - logdmsg(("phci_to_vhci: vhci name = %s\n", STRVAL(retp))); - return (retp); -} - -static int -add_to_phci_list(char **phci_list, sv_path_info_t *pi, int npaths, int state, - char *node_name) -{ - int rv = 0; - char name[MAXPATHLEN]; - - while (npaths--) { - if (state == pi->ret_state) { - (void) snprintf(name, MAXPATHLEN, "%s/%s@%s", - pi->device.ret_phci, node_name, pi->ret_addr); - if ((*phci_list = strdup(name)) == NULL) - return (-1); - phci_list++; - rv++; - } - pi++; - } - - return (rv); -} - -static void -free_pathlist(char **pathlist) -{ - char **p; - - if (pathlist != NULL) { - for (p = pathlist; *p != NULL; p++) - free(*p); - free(pathlist); - } -} - - -/* - * Convert a vhci client name to phci client names. - * - * vhci_name vhci client /devices name without the /devices prefix and - * minor name component. - * num_paths On return, *num_paths is set to the number paths in the - * returned path list. - * - * Returns NULL terminated path list containing phci client paths is - * returned on success. The memory for the path list is - * allocated by this function and the caller must free it by - * calling free_pathlist(). - * NULL is returned on failure. - */ -static char ** -vhci_to_phci(char *vhci_name, int *num_paths) -{ - sv_iocdata_t ioc; - uint_t npaths; - int n; - char **phci_list = NULL; - char *node_name, *at; - char vhci_name_buf[MAXPATHLEN]; - - logdmsg(("vhci_to_phci: vchi_name = %s\n", vhci_name)); - - *num_paths = 0; - (void) strlcpy(vhci_name_buf, vhci_name, MAXPATHLEN); - - /* first get the number paths */ - bzero(&ioc, sizeof (sv_iocdata_t)); - ioc.client = vhci_name_buf; - ioc.ret_elem = &npaths; - if (vhci_ctl(&ioc, SCSI_VHCI_GET_CLIENT_MULTIPATH_INFO) != 0 || - npaths == 0) { - logdmsg(("vhci_to_phci: vhci_ctl failed to get npaths: %s\n", - strerror(errno))); - return (NULL); - } - - /* now allocate memory for the path information and get all paths */ - bzero(&ioc, sizeof (sv_iocdata_t)); - ioc.client = vhci_name_buf; - ioc.buf_elem = npaths; - ioc.ret_elem = &npaths; - if ((ioc.ret_buf = (sv_path_info_t *)calloc(npaths, - sizeof (sv_path_info_t))) == NULL) - return (NULL); - if (vhci_ctl(&ioc, SCSI_VHCI_GET_CLIENT_MULTIPATH_INFO) != 0 || - npaths == 0) { - logdmsg(("vhci_to_phci: vhci_ctl failed: %s\n", - strerror(errno))); - goto out; - } - - if (ioc.buf_elem < npaths) - npaths = ioc.buf_elem; - - if ((node_name = strrchr(vhci_name_buf, '/')) == NULL || - (at = strchr(node_name, '@')) == NULL) - goto out; - - node_name++; - *at = '\0'; - - /* allocate one more (than npaths) for the terminating NULL pointer */ - if ((phci_list = calloc(npaths + 1, sizeof (char *))) == NULL) - goto out; - - /* - * add only online paths as non-online paths may not be accessible - * in the target environment. - */ - if ((n = add_to_phci_list(phci_list, ioc.ret_buf, npaths, - MDI_PATHINFO_STATE_ONLINE, node_name)) <= 0) - goto out; - - free(ioc.ret_buf); - *num_paths = n; - -#ifdef DEBUG - logdmsg(("vhci_to_phci: phci list:\n")); - log_pathlist(phci_list); -#endif - return (phci_list); - -out: - free(ioc.ret_buf); - if (phci_list) - free_pathlist(phci_list); - return (NULL); -} - -/* - * build list of paths accessible from the target environment - */ -static int -build_pathlist(char *rootdir, char *vhcipath, char **pathlist, int npaths) -{ - int mpxio_disabled; - int i, j; - char *vpath = NULL; - - for (i = 0; i < npaths; i++) { - mpxio_disabled = is_mpxio_disabled(rootdir, pathlist[i]); - logdmsg(("build_pathlist: mpxio_disabled = %d " - "on path %s\n", mpxio_disabled, pathlist[i])); - if (mpxio_disabled == -1) - return (-1); - if (mpxio_disabled == 0) { - /* - * mpxio is enabled on this phci path. - * So use vhci path instead of phci path. - */ - if (vpath == NULL) { - if ((vpath = strdup(vhcipath)) == NULL) - return (-1); - free(pathlist[i]); - /* keep vhci path at beginning of the list */ - for (j = i; j > 0; j--) - pathlist[j] = pathlist[j - 1]; - pathlist[0] = vpath; - } else { - free(pathlist[i]); - npaths--; - for (j = i; j < npaths; j++) - pathlist[j] = pathlist[j + 1]; - pathlist[npaths] = NULL; - /* compensate for i++ in the for loop */ - i--; - } - } - } - -#ifdef DEBUG - logdmsg(("build_pathlist: returning npaths = %d, pathlist:\n", npaths)); - log_pathlist(pathlist); -#endif - return (npaths); -} - -/* - * Check if the specified device is refenced in the vfstab file. - * Return 1 if referenced, 0 if not. - * - * rootdir root directory of the target environment - * nodepath /devices path of a device in the target environment without - * the /devices prefix and minor component. - */ -static int -is_dev_in_vfstab(char *rootdir, char *nodepath) -{ - FILE *fp; - int linksize; - struct vfstab vfsent; - char *abspath, *minor; - char physpath[MAXPATHLEN]; - char buf[MAXPATHLEN]; - - logdmsg(("is_dev_in_vfstab: rootdir = %s, nodepath = %s\n", - rootdir, nodepath)); - - (void) snprintf(buf, sizeof (buf), "%s%s", rootdir, VFSTAB); - - if ((fp = fopen(buf, "r")) == NULL) - return (0); - - /* - * read device specials from vfstab and compare names at physical - * node path level. - */ - while (getvfsent(fp, &vfsent) == 0) { - if (strncmp(vfsent.vfs_special, SLASH_DEV_SLASH, - sizeof (SLASH_DEV_SLASH) - 1) == 0) { - (void) snprintf(buf, MAXPATHLEN, "%s%s", - rootdir, vfsent.vfs_special); - if ((linksize = readlink(buf, physpath, - MAXPATHLEN)) > 0 && linksize < (MAXPATHLEN - 1)) { - physpath[linksize] = '\0'; - if ((abspath = strstr(physpath, - SLASH_DEVICES_SLASH)) == NULL) - continue; - } else - continue; - } else if (strncmp(vfsent.vfs_special, SLASH_DEVICES_SLASH, - sizeof (SLASH_DEVICES_SLASH) - 1) == 0) { - (void) strlcpy(physpath, vfsent.vfs_special, - MAXPATHLEN); - abspath = physpath; - } else - continue; - - /* point to / after /devices */ - abspath += sizeof (SLASH_DEVICES_SLASH) - 2; - /* strip minor component */ - if ((minor = strrchr(abspath, ':')) != NULL) - *minor = '\0'; - - if (strcmp(nodepath, abspath) == 0) { - (void) fclose(fp); - logdmsg(("is_dev_in_vfstab: returning 1\n")); - return (1); - } - } - - (void) fclose(fp); - return (0); -} - -#endif /* __sparc */ static int devlink_callback(di_devlink_t devlink, void *argp) @@ -1738,32 +613,6 @@ devfs_target2install(const char *rootdir, const char *devname, char *buf, MAXPATHLEN) != 0) return (-1); -#ifdef __sparc - if (client_name_type(physpath) == CLIENT_TYPE_PHCI) { - char *mapped_node_path, *minor; - char minorbuf[MAXNAMELEN]; - - /* strip minor component if present */ - if ((minor = strrchr(physpath, ':')) != NULL) { - *minor = '\0'; - minor++; - (void) strlcpy(minorbuf, minor, MAXNAMELEN); - } - if ((mapped_node_path = phci_to_vhci(physpath)) != NULL) { - if (minor) - (void) snprintf(physpath, MAXPATHLEN, - "%s:%s", mapped_node_path, minorbuf); - else - (void) strlcpy(physpath, mapped_node_path, - MAXPATHLEN); - free(mapped_node_path); - logdmsg(("devfs_target2install: mapped physpath: %s\n", - physpath)); - - } else if (minor) - *(minor - 1) = ':'; - } -#endif /* __sparc */ return (get_install_devlink(physpath, buf, bufsz)); } @@ -1798,52 +647,6 @@ devfs_install2target(const char *rootdir, const char *devname, char *buf, if (devname2physpath("", (char *)devname, physpath, MAXPATHLEN) != 0) return (-1); -#ifdef __sparc - if (client_name_type(physpath) == CLIENT_TYPE_VHCI) { - char **pathlist; - int npaths, i, j; - char *minor; - char minorbuf[MAXNAMELEN]; - - /* strip minor component if present */ - if ((minor = strrchr(physpath, ':')) != NULL) { - *minor = '\0'; - minor++; - (void) strlcpy(minorbuf, minor, MAXNAMELEN); - } - - if ((pathlist = vhci_to_phci(physpath, &npaths)) == NULL) - return (-1); - - if ((npaths = build_pathlist((char *)rootdir, physpath, - pathlist, npaths)) <= 0) { - free_pathlist(pathlist); - return (-1); - } - - /* - * in case of more than one path, try to use the path - * referenced in the vfstab file, otherwise use the first path. - */ - j = 0; - if (npaths > 1) { - for (i = 0; i < npaths; i++) { - if (is_dev_in_vfstab((char *)rootdir, - pathlist[i])) { - j = i; - break; - } - } - } - - if (minor) - (void) snprintf(physpath, MAXPATHLEN, - "%s:%s", pathlist[j], minorbuf); - else - (void) strlcpy(physpath, pathlist[j], MAXPATHLEN); - free_pathlist(pathlist); - } -#endif /* __sparc */ return (get_target_devlink((char *)rootdir, physpath, buf, bufsz)); } diff --git a/usr/src/lib/libdtrace/common/dt_link.c b/usr/src/lib/libdtrace/common/dt_link.c index e910ac3ff1..0c7937460f 100644 --- a/usr/src/lib/libdtrace/common/dt_link.c +++ b/usr/src/lib/libdtrace/common/dt_link.c @@ -69,11 +69,7 @@ static const char DTRACE_SHSTRTAB32[] = "\0" ".SUNW_dof\0" /* 11 */ ".strtab\0" /* 21 */ ".symtab\0" /* 29 */ -#ifdef __sparc -".rela.SUNW_dof"; /* 37 */ -#else ".rel.SUNW_dof"; /* 37 */ -#endif static const char DTRACE_SHSTRTAB64[] = "\0" ".shstrtab\0" /* 1 */ @@ -93,11 +89,7 @@ typedef struct dt_link_pair { typedef struct dof_elf32 { uint32_t de_nrel; /* relocation count */ -#ifdef __sparc - Elf32_Rela *de_rel; /* array of relocations for sparc */ -#else Elf32_Rel *de_rel; /* array of relocations for x86 */ -#endif uint32_t de_nsym; /* symbol count */ Elf32_Sym *de_sym; /* array of symbols */ uint32_t de_strlen; /* size of of string table */ @@ -117,11 +109,7 @@ prepare_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, dof_elf32_t *dep) uint32_t count = 0; size_t base; Elf32_Sym *sym; -#ifdef __sparc - Elf32_Rela *rel; -#else Elf32_Rel *rel; -#endif /*LINTED*/ dofs = (dof_sec_t *)((char *)dof + dof->dofh_secoff); @@ -551,11 +539,7 @@ dump_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, int fd) shp = &elf_file.shdr[ESHDR_REL]; shp->sh_name = 37; /* DTRACE_SHSTRTAB32[37] = ".rel.SUNW_dof" */ shp->sh_flags = SHF_ALLOC; -#ifdef __sparc - shp->sh_type = SHT_RELA; -#else shp->sh_type = SHT_REL; -#endif shp->sh_entsize = sizeof (de.de_rel[0]); shp->sh_link = ESHDR_SYMTAB; shp->sh_info = ESHDR_DOF; diff --git a/usr/src/lib/libdtrace/common/dt_open.c b/usr/src/lib/libdtrace/common/dt_open.c index 9b02b08f58..e62fac204c 100644 --- a/usr/src/lib/libdtrace/common/dt_open.c +++ b/usr/src/lib/libdtrace/common/dt_open.c @@ -1007,18 +1007,6 @@ alloc: else if (flags & DTRACE_O_ILP32) dtp->dt_conf.dtc_ctfmodel = CTF_MODEL_ILP32; -#ifdef __sparc - /* - * On SPARC systems, __sparc is always defined for - * and __sparcv9 is defined if we are doing a 64-bit compile. - */ - if (dt_cpp_add_arg(dtp, "-D__sparc") == NULL) - return (set_open_errno(dtp, errp, EDT_NOMEM)); - - if (dtp->dt_conf.dtc_ctfmodel == CTF_MODEL_LP64 && - dt_cpp_add_arg(dtp, "-D__sparcv9") == NULL) - return (set_open_errno(dtp, errp, EDT_NOMEM)); -#endif #ifdef __x86 /* diff --git a/usr/src/lib/libkvm/common/test.c b/usr/src/lib/libkvm/common/test.c index 973c647d5b..8ee3adcb5a 100644 --- a/usr/src/lib/libkvm/common/test.c +++ b/usr/src/lib/libkvm/common/test.c @@ -42,11 +42,7 @@ #include #include -#ifdef __sparc -#include /* for STACK_BIAS */ -#else #define STACK_BIAS 0 -#endif kvm_t *cookie; diff --git a/usr/src/lib/libm/common/Q/expm1l.c b/usr/src/lib/libm/common/Q/expm1l.c index dabc257f47..5eab3f954a 100644 --- a/usr/src/lib/libm/common/Q/expm1l.c +++ b/usr/src/lib/libm/common/Q/expm1l.c @@ -29,9 +29,7 @@ #pragma weak __expm1l = expm1l -#if !defined(__sparc) #error Unsupported architecture -#endif /* * expm1l(x) diff --git a/usr/src/cmd/dtrace/test/tst/common/safety/tst.vahole.d b/usr/src/lib/libm/common/Q/powl.c similarity index 65% copy from usr/src/cmd/dtrace/test/tst/common/safety/tst.vahole.d copy to usr/src/lib/libm/common/Q/powl.c index 2ef40a5ac4..90f4546403 100644 --- a/usr/src/cmd/dtrace/test/tst/common/safety/tst.vahole.d +++ b/usr/src/lib/libm/common/Q/powl.c @@ -1,5 +1,3 @@ -#!/usr/sbin/dtrace -Cs - /* * CDDL HEADER START * @@ -22,48 +20,17 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. */ - -#pragma ident "%Z%%M% %I% %E% SMI" - /* - * We set our buffer size absurdly low to prevent a flood of errors that we - * don't care about. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ -#pragma D option bufsize=16 -#pragma D option bufpolicy=ring - -fbt::: -{ - n++; -#ifdef __sparc - trace(*(int *)0x8000000000000000 ^ rand()); -#else - trace(*(int *)(`kernelbase - 1)); -#endif -} - -dtrace:::ERROR -{ - err++; -} -tick-1sec -/sec++ == 10/ -{ - exit(2); -} +#pragma weak __powl = powl -END -/n == 0 || err == 0/ -{ - exit(1); -} +#include "libm.h" +#include "xpg6.h" /* __xpg6 */ +#define _C99SUSv3_pow _C99SUSv3_pow_treats_Inf_as_an_even_int -END -/n != 0 && err != 0/ -{ - exit(0); -} +#error Unsupported Architecture diff --git a/usr/src/cmd/dtrace/test/tst/common/safety/tst.vahole.d b/usr/src/lib/libm/common/m9x/__fex_sparc.c similarity index 65% copy from usr/src/cmd/dtrace/test/tst/common/safety/tst.vahole.d copy to usr/src/lib/libm/common/m9x/__fex_sparc.c index 2ef40a5ac4..c625f173ba 100644 --- a/usr/src/cmd/dtrace/test/tst/common/safety/tst.vahole.d +++ b/usr/src/lib/libm/common/m9x/__fex_sparc.c @@ -1,5 +1,3 @@ -#!/usr/sbin/dtrace -Cs - /* * CDDL HEADER START * @@ -22,48 +20,10 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. */ - -#pragma ident "%Z%%M% %I% %E% SMI" - /* - * We set our buffer size absurdly low to prevent a flood of errors that we - * don't care about. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ -#pragma D option bufsize=16 -#pragma D option bufpolicy=ring - -fbt::: -{ - n++; -#ifdef __sparc - trace(*(int *)0x8000000000000000 ^ rand()); -#else - trace(*(int *)(`kernelbase - 1)); -#endif -} - -dtrace:::ERROR -{ - err++; -} - -tick-1sec -/sec++ == 10/ -{ - exit(2); -} - -END -/n == 0 || err == 0/ -{ - exit(1); -} -END -/n != 0 && err != 0/ -{ - exit(0); -} diff --git a/usr/src/lib/libm/common/m9x/remquol.c b/usr/src/lib/libm/common/m9x/remquol.c index d24719720d..a22d7c628e 100644 --- a/usr/src/lib/libm/common/m9x/remquol.c +++ b/usr/src/lib/libm/common/m9x/remquol.c @@ -42,14 +42,7 @@ static const int static const long double zero = 0.0L, one = 1.0L; /* INDENT ON */ -#if defined(__sparc) -#define __H0(x) ((int *) &x)[0] -#define __H1(x) ((int *) &x)[1] -#define __H2(x) ((int *) &x)[2] -#define __H3(x) ((int *) &x)[3] -#else #error Unsupported architecture -#endif /* * On entrance: *quo is initialized to 0, x finite and y non-zero & ordered diff --git a/usr/src/lib/libmvec/common/__vexpf.c b/usr/src/lib/libmvec/common/__vexpf.c index 9e340bba68..7474c2b29b 100644 --- a/usr/src/lib/libmvec/common/__vexpf.c +++ b/usr/src/lib/libmvec/common/__vexpf.c @@ -177,35 +177,6 @@ static const float extreme[2] = { 1.0e30f, 1.0e-30f }; *y = (float) (x##N * *(double *)&lres##N); \ y += stridey -#ifdef __sparc - -#define PREPROCESS(N, index, label) \ - xi = *(int *)x; \ - ax = xi & ~0x80000000; \ - fx = *x; \ - x += stridex; \ - if (ax >= 0x42aeac50) /* log(2^126) = 87.3365... */ \ - { \ - sign = (unsigned)xi >> 31; \ - if (ax >= 0x7f800000) /* |x| = inf or nan */ \ - { \ - if (ax > 0x7f800000) /* nan */ \ - { \ - y[index] = fx * fx; \ - goto label; \ - } \ - y[index] = (sign) ? 0.0f : fx; \ - goto label; \ - } \ - if (sign || ax > 0x42b17218) { \ - fx = extreme[sign]; \ - y[index] = fx * fx; \ - goto label; \ - } \ - } \ - x##N = fx - -#else #define PREPROCESS(N, index, label) \ xi = *(int *)x; \ @@ -231,7 +202,6 @@ static const float extreme[2] = { 1.0e30f, 1.0e-30f }; } \ x##N = fx -#endif void __vexpf(int n, float * restrict x, int stridex, float * restrict y, diff --git a/usr/src/lib/libproc/common/Pcore.c b/usr/src/lib/libproc/common/Pcore.c index fb9cf81148..369575c23e 100644 --- a/usr/src/lib/libproc/common/Pcore.c +++ b/usr/src/lib/libproc/common/Pcore.c @@ -217,11 +217,6 @@ Pfini_core(struct ps_prochandle *P, void *data) for (i = 0; i < core->core_nlwp; i++, lwp = nlwp) { nlwp = list_next(lwp); -#ifdef __sparc - free(lwp->lwp_gwins); - free(lwp->lwp_xregs); - free(lwp->lwp_asrs); -#endif free(lwp); } @@ -1040,93 +1035,6 @@ note_auxv(struct ps_prochandle *P, size_t nbytes) return (0); } -#ifdef __sparc -static int -note_xreg(struct ps_prochandle *P, size_t nbytes) -{ - core_info_t *core = P->data; - lwp_info_t *lwp = core->core_lwp; - size_t xbytes = sizeof (prxregset_t); - prxregset_t *xregs; - - if (lwp == NULL || lwp->lwp_xregs != NULL || nbytes < xbytes) - return (0); /* No lwp yet, already seen, or bad size */ - - if ((xregs = malloc(xbytes)) == NULL) - return (-1); - - if (read(P->asfd, xregs, xbytes) != xbytes) { - dprintf("Pgrab_core: failed to read NT_PRXREG\n"); - free(xregs); - return (-1); - } - - lwp->lwp_xregs = xregs; - return (0); -} - -static int -note_gwindows(struct ps_prochandle *P, size_t nbytes) -{ - core_info_t *core = P->data; - lwp_info_t *lwp = core->core_lwp; - - if (lwp == NULL || lwp->lwp_gwins != NULL || nbytes == 0) - return (0); /* No lwp yet or already seen or no data */ - - if ((lwp->lwp_gwins = malloc(sizeof (gwindows_t))) == NULL) - return (-1); - - /* - * Since the amount of gwindows data varies with how many windows were - * actually saved, we just read up to the minimum of the note size - * and the size of the gwindows_t type. It doesn't matter if the read - * fails since we have to zero out gwindows first anyway. - */ -#ifdef _LP64 - if (core->core_dmodel == PR_MODEL_ILP32) { - gwindows32_t g32; - - (void) memset(&g32, 0, sizeof (g32)); - (void) read(P->asfd, &g32, MIN(nbytes, sizeof (g32))); - gwindows_32_to_n(&g32, lwp->lwp_gwins); - - } else { -#endif - (void) memset(lwp->lwp_gwins, 0, sizeof (gwindows_t)); - (void) read(P->asfd, lwp->lwp_gwins, - MIN(nbytes, sizeof (gwindows_t))); -#ifdef _LP64 - } -#endif - return (0); -} - -#ifdef __sparcv9 -static int -note_asrs(struct ps_prochandle *P, size_t nbytes) -{ - core_info_t *core = P->data; - lwp_info_t *lwp = core->core_lwp; - int64_t *asrs; - - if (lwp == NULL || lwp->lwp_asrs != NULL || nbytes < sizeof (asrset_t)) - return (0); /* No lwp yet, already seen, or bad size */ - - if ((asrs = malloc(sizeof (asrset_t))) == NULL) - return (-1); - - if (read(P->asfd, asrs, sizeof (asrset_t)) != sizeof (asrset_t)) { - dprintf("Pgrab_core: failed to read NT_ASRS\n"); - free(asrs); - return (-1); - } - - lwp->lwp_asrs = asrs; - return (0); -} -#endif /* __sparcv9 */ -#endif /* __sparc */ static int note_spymaster(struct ps_prochandle *P, size_t nbytes) @@ -1185,24 +1093,11 @@ static int (*nhdlrs[])(struct ps_prochandle *, size_t) = { #else note_notsup, /* 3 NT_PRPSINFO (old) */ #endif -#ifdef __sparc - note_xreg, /* 4 NT_PRXREG */ -#else note_notsup, /* 4 NT_PRXREG */ -#endif note_platform, /* 5 NT_PLATFORM */ note_auxv, /* 6 NT_AUXV */ -#ifdef __sparc - note_gwindows, /* 7 NT_GWINDOWS */ -#ifdef __sparcv9 - note_asrs, /* 8 NT_ASRS */ -#else - note_notsup, /* 8 NT_ASRS */ -#endif -#else note_notsup, /* 7 NT_GWINDOWS */ note_notsup, /* 8 NT_ASRS */ -#endif #ifdef __x86 note_ldt, /* 9 NT_LDT */ #else diff --git a/usr/src/lib/libproc/common/Psymtab_machelf32.c b/usr/src/lib/libproc/common/Psymtab_machelf32.c index d9964ff5f4..2342182a92 100644 --- a/usr/src/lib/libproc/common/Psymtab_machelf32.c +++ b/usr/src/lib/libproc/common/Psymtab_machelf32.c @@ -194,9 +194,6 @@ static char shstr[] = * This is the smallest number of PLT relocation entries allowed in a proper * .plt section. */ -#ifdef __sparc -#define PLTREL_MIN_ENTRIES 4 /* SPARC psABI 3.0 and SCD 2.4 */ -#else #ifdef __lint /* * On x86, lint would complain about unsigned comparison with @@ -207,7 +204,6 @@ static char shstr[] = #else #define PLTREL_MIN_ENTRIES 0 #endif -#endif #ifdef _ELF64 Elf * @@ -434,10 +430,6 @@ fake_elf32(struct ps_prochandle *P, file_info_t *fptr, uintptr_t addr, * we can calculate the size of the plt. */ pltsz = (pltentries + M_PLT_XNumber) * M_PLT_ENTSIZE; -#if defined(__sparc) - /* The sparc PLT always has a (delay slot) nop at the end */ - pltsz += 4; -#endif /* __sparc */ size += sizeof (Shdr); size += roundup(pltsz, SH_ADDRALIGN); @@ -673,14 +665,6 @@ done_with_plt: } } -#if defined(__sparc) - if (sym.st_value != d[DI_PLTGOT]->d_un.d_ptr) { - dprintf("warning: DI_PLTGOT (%lx) doesn't match " - ".plt symbol pointer (%lx)", - (long)d[DI_PLTGOT]->d_un.d_ptr, - (long)sym.st_value); - } -#endif /* __sparc */ if (ndx == 0) { dprintf( diff --git a/usr/src/psm/stand/boot/common/heap_kmem.c b/usr/src/psm/stand/boot/common/heap_kmem.c index f7b717f412..a3149f7875 100644 --- a/usr/src/psm/stand/boot/common/heap_kmem.c +++ b/usr/src/psm/stand/boot/common/heap_kmem.c @@ -128,9 +128,6 @@ void freehdr(Freehdr p); void delete(Freehdr *p); static void check_need_to_free(void); extern caddr_t resalloc(enum RESOURCES, size_t, caddr_t, int); -#ifdef __sparc -extern void resalloc_init(void); -#endif extern int splnet(void); extern int splimp(void); extern void splx(int); @@ -172,9 +169,6 @@ kmem_init(void) printf("kmem_init entered\n"); #endif -#ifdef __sparc - resalloc_init(); -#endif kmem_info.free_root = NIL; kmem_info.free_hdr_list = NULL; @@ -775,11 +769,7 @@ again: static bool morecore(size_t nbytes) { -#ifdef __sparc - enum RESOURCES type = RES_BOOTSCRATCH_NOFAIL; -#else enum RESOURCES type = RES_BOOTSCRATCH; -#endif Dblk p; #ifdef DEBUG printf("morecore(nbytes 0x%lx)\n", nbytes); diff --git a/usr/src/stand/lib/inet/dhcpv4.c b/usr/src/stand/lib/inet/dhcpv4.c index 557d277ec1..89ba033b61 100644 --- a/usr/src/stand/lib/inet/dhcpv4.c +++ b/usr/src/stand/lib/inet/dhcpv4.c @@ -1057,10 +1057,6 @@ create_bootpresponse_bprop(PKT_LIST *pl) bootp_response = NULL; } -#if defined(__sparc) - prom_create_encoded_prop("bootp-response", pl->pkt, pl->len, - ENCODE_BYTES); -#endif /* __sparc */ } /* diff --git a/usr/src/uts/common/conf/param.c b/usr/src/uts/common/conf/param.c index 7f6d19ef0a..c9c7796307 100644 --- a/usr/src/uts/common/conf/param.c +++ b/usr/src/uts/common/conf/param.c @@ -248,9 +248,6 @@ void (*init_tbl[])(void) = { }; -#if defined(__sparc) - extern void siron_mp_init(); -#endif /* * Any per cpu resources should be initialized via @@ -259,9 +256,6 @@ void (*init_tbl[])(void) = { void (*mp_init_tbl[])(void) = { ftrace_init, cyclic_mp_init, -#if defined(__sparc) - siron_mp_init, -#endif clock_tick_mp_init, cu_init, callout_mp_init, @@ -547,12 +541,6 @@ param_calc(int platform_max_nprocs) * Note: 2^20 is a meg; shifting right by (20 - PAGESHIFT) * converts pages to megs without integer overflow. */ -#if defined(__sparc) - if (physmem > original_physmem) { - physmem = original_physmem; - cmn_err(CE_NOTE, "physmem limited to %ld", physmem); - } -#endif if (maxusers == 0) { pgcnt_t physmegs = physmem >> (20 - PAGESHIFT); pgcnt_t virtmegs = vmem_size(heap_arena, VMEM_FREE) >> 20; diff --git a/usr/src/uts/common/dtrace/fasttrap.c b/usr/src/uts/common/dtrace/fasttrap.c index 074f066b52..a22a0c14bd 100644 --- a/usr/src/uts/common/dtrace/fasttrap.c +++ b/usr/src/uts/common/dtrace/fasttrap.c @@ -1863,11 +1863,7 @@ fasttrap_meta_create_probe(void *arg, void *parg, pp->ftp_tps[i].fit_tp = tp; pp->ftp_tps[i].fit_id.fti_probe = pp; -#ifdef __sparc - pp->ftp_tps[i].fit_id.fti_ptype = DTFTP_POST_OFFSETS; -#else pp->ftp_tps[i].fit_id.fti_ptype = DTFTP_OFFSETS; -#endif } /* diff --git a/usr/src/uts/common/exec/elf/elf_notes.c b/usr/src/uts/common/exec/elf/elf_notes.c index 600ae82000..66ebd89a02 100644 --- a/usr/src/uts/common/exec/elf/elf_notes.c +++ b/usr/src/uts/common/exec/elf/elf_notes.c @@ -139,29 +139,6 @@ setup_note_header(Phdr *v, proc_t *p) v[0].p_filesz += nlwp * sizeof (Note) + nlwp * roundup(size, sizeof (Word)); -#if defined(__sparc) - /* - * Figure out the number and sizes of register windows. - */ - { - kthread_t *t = p->p_tlist; - do { - if ((size = prnwindows(ttolwp(t))) != 0) { - size = sizeof (gwindows_t) - - (SPARC_MAXREGWINDOW - size) * - sizeof (struct rwindow); - v[0].p_filesz += sizeof (Note) + - roundup(size, sizeof (Word)); - } - } while ((t = t->t_forw) != p->p_tlist); - } - /* - * Space for the Ancillary State Registers. - */ - if (p->p_model == DATAMODEL_LP64) - v[0].p_filesz += nlwp * sizeof (Note) - + nlwp * roundup(sizeof (asrset_t), sizeof (Word)); -#endif /* __sparc */ } int @@ -173,10 +150,6 @@ write_elfnotes(proc_t *p, int sig, vnode_t *vp, offset_t offset, pstatus_t pstatus; lwpsinfo_t lwpsinfo; lwpstatus_t lwpstatus; -#if defined(__sparc) - gwindows_t gwindows; - asrset_t asrset; -#endif /* __sparc */ char xregs[1]; aux_entry_t auxv[__KERN_NAUXV_IMPL]; prcred_t pcred; @@ -510,37 +483,6 @@ write_elfnotes(proc_t *p, int sig, vnode_t *vp, offset_t offset, if (error) goto done; -#if defined(__sparc) - /* - * Unspilled SPARC register windows. - */ - { - size_t size = prnwindows(lwp); - - if (size != 0) { - size = sizeof (gwindows_t) - - (SPARC_MAXREGWINDOW - size) * - sizeof (struct rwindow); - prgetwindows(lwp, &bigwad->gwindows); - error = elfnote(vp, &offset, NT_GWINDOWS, - size, (caddr_t)&bigwad->gwindows, - rlimit, credp); - if (error) - goto done; - } - } - /* - * Ancillary State Registers. - */ - if (p->p_model == DATAMODEL_LP64) { - prgetasregs(lwp, bigwad->asrset); - error = elfnote(vp, &offset, NT_ASRS, - sizeof (asrset_t), (caddr_t)bigwad->asrset, - rlimit, credp); - if (error) - goto done; - } -#endif /* __sparc */ if (xregsize) { prgetprxregs(lwp, bigwad->xregs); diff --git a/usr/src/uts/common/exec/elf/old_notes.c b/usr/src/uts/common/exec/elf/old_notes.c index 16cf8a5302..59e71b45cf 100644 --- a/usr/src/uts/common/exec/elf/old_notes.c +++ b/usr/src/uts/common/exec/elf/old_notes.c @@ -80,23 +80,6 @@ setup_old_note_header(Phdr *v, proc_t *p) v[0].p_filesz += nlwp * sizeof (Note) + nlwp * roundup(size, sizeof (Word)); -#if defined(__sparc) - /* - * Figure out the number and sizes of register windows. - */ - { - kthread_t *t = p->p_tlist; - do { - if ((size = prnwindows(ttolwp(t))) != 0) { - size = sizeof (gwindows_t) - - (SPARC_MAXREGWINDOW - size) * - sizeof (struct rwindow); - v[0].p_filesz += sizeof (Note) + - roundup(size, sizeof (Word)); - } - } while ((t = t->t_forw) != p->p_tlist); - } -#endif /* __sparc */ } int @@ -107,9 +90,6 @@ write_old_elfnotes(proc_t *p, int sig, vnode_t *vp, offset_t offset, prpsinfo_t psinfo; prstatus_t prstat; prfpregset_t fpregs; -#if defined(__sparc) - gwindows_t gwindows; -#endif /* __sparc */ char xregs[1]; aux_entry_t auxv[__KERN_NAUXV_IMPL]; } *bigwad; @@ -203,26 +183,6 @@ write_old_elfnotes(proc_t *p, int sig, vnode_t *vp, offset_t offset, goto done; } -#if defined(__sparc) - /* - * Unspilled SPARC register windows. - */ - { - size_t size = prnwindows(lwp); - - if (size != 0) { - size = sizeof (gwindows_t) - - (SPARC_MAXREGWINDOW - size) * - sizeof (struct rwindow); - prgetwindows(lwp, &bigwad->gwindows); - error = elfnote(vp, &offset, NT_GWINDOWS, - size, (caddr_t)&bigwad->gwindows, - rlimit, credp); - if (error) - goto done; - } - } -#endif /* __sparc */ if (xregsize) { prgetprxregs(lwp, bigwad->xregs); diff --git a/usr/src/uts/common/io/audio/ac97/ac97.c b/usr/src/uts/common/io/audio/ac97/ac97.c index 4693daa67c..5c5fb0a50b 100644 --- a/usr/src/uts/common/io/audio/ac97/ac97.c +++ b/usr/src/uts/common/io/audio/ac97/ac97.c @@ -1659,16 +1659,11 @@ ac97_alloc(dev_info_t *dip, ac97_rd_t rd, ac97_wr_t wr, void *priv) * property. (Generally on SPARC, we enable by default. On * other systems we do not.) */ -#ifdef __sparc - ac->flags |= AC97_FLAG_SPEAKER_OK; - PROP_FLAG(AC97_PROP_SPEAKER, AC97_FLAG_SPEAKER, 1); -#else if (ddi_prop_exists(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, AC97_PROP_SPEAKER)) { ac->flags |= AC97_FLAG_SPEAKER_OK; PROP_FLAG(AC97_PROP_SPEAKER, AC97_FLAG_SPEAKER, 0); } -#endif /* * Enable microphone boost (20dB normally) by default? diff --git a/usr/src/uts/common/io/audio/drv/audio1575/audio1575.c b/usr/src/uts/common/io/audio/drv/audio1575/audio1575.c index 1688bbfe72..31260bfcb4 100644 --- a/usr/src/uts/common/io/audio/drv/audio1575/audio1575.c +++ b/usr/src/uts/common/io/audio/drv/audio1575/audio1575.c @@ -1076,10 +1076,6 @@ audio1575_chip_init(audio1575_state_t *statep) uint32_t intrsr; int i; int j; -#ifdef __sparc - uint8_t clk_detect; - ddi_acc_handle_t pcih; -#endif clock_t ticks; /* @@ -1173,22 +1169,6 @@ audio1575_chip_init(audio1575_state_t *statep) return (DDI_FAILURE); } -#ifdef __sparc - /* Magic code from ULi to Turn on the AC_LINK clock */ - pcih = statep->pcih; - pci_config_put8(pcih, M1575_PCIACD_REG, 0); - pci_config_put8(pcih, M1575_PCIACD_REG, 4); - pci_config_put8(pcih, M1575_PCIACD_REG, 0); - (void) pci_config_get8(pcih, M1575_PCIACD_REG); - pci_config_put8(pcih, M1575_PCIACD_REG, 2); - pci_config_put8(pcih, M1575_PCIACD_REG, 0); - clk_detect = pci_config_get8(pcih, M1575_PCIACD_REG); - - if (clk_detect != 1) { - audio_dev_warn(statep->adev, "No AC97 Clock Detected"); - return (DDI_FAILURE); - } -#endif /* Magic code from Uli to Init FIFO1 and FIFO2 */ PUT32(M1575_FIFOCR1_REG, 0x81818181); diff --git a/usr/src/uts/common/io/bofi.c b/usr/src/uts/common/io/bofi.c index 18379c96d2..986127b174 100644 --- a/usr/src/uts/common/io/bofi.c +++ b/usr/src/uts/common/io/bofi.c @@ -3145,10 +3145,7 @@ bofi_map(dev_info_t *dip, dev_info_t *rdip, ap->ahi_rep_put32 = bofi_rep_wr32; ap->ahi_rep_put64 = bofi_rep_wr64; ap->ahi_fault_check = bofi_check_acc_hdl; -#if defined(__sparc) -#else ap->ahi_acc_attr &= ~DDI_ACCATTR_DIRECT; -#endif /* * stick in a pointer to our shadow handle */ diff --git a/usr/src/uts/common/io/bscbus.c b/usr/src/uts/common/io/bscbus.c index 5fb0cebd8d..8b64a9807b 100644 --- a/usr/src/uts/common/io/bscbus.c +++ b/usr/src/uts/common/io/bscbus.c @@ -40,10 +40,6 @@ #include #include -#if defined(__sparc) -#include -#include -#endif #include #include @@ -2321,12 +2317,8 @@ static int bscbus_intr_op(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t op, ddi_intr_handle_impl_t *hdlp, void *result) { -#if defined(__sparc) - return (i_ddi_intr_ops(dip, rdip, op, hdlp, result)); -#else _NOTE(ARGUNUSED(dip, rdip, op, hdlp, result)) return (DDI_FAILURE); -#endif } /* diff --git a/usr/src/uts/common/io/bscv.c b/usr/src/uts/common/io/bscv.c index 30968d917f..7690641330 100644 --- a/usr/src/uts/common/io/bscv.c +++ b/usr/src/uts/common/io/bscv.c @@ -192,19 +192,6 @@ static void bscv_setup_events(bscv_soft_state_t *); static void bscv_trace(bscv_soft_state_t *, char, const char *, const char *, ...) __GNU_UNUSED; -#ifdef __sparc -static void bscv_idi_init(); -static void bscv_idi_fini(); -static void bscv_idi_new_instance(dev_info_t *dip); -static void bscv_idi_clear_err(); -void bscv_idi_set(struct bscv_idi_info info); -static boolean_t bscv_idi_err(); -static boolean_t bscv_nodename_set(struct bscv_idi_info info); -static boolean_t bscv_sig_set(struct bscv_idi_info info); -static boolean_t bscv_wdog_pat(struct bscv_idi_info info); -static boolean_t bscv_wdog_cfg(struct bscv_idi_info info); -static void bscv_write_sig(bscv_soft_state_t *ssp, bscv_sig_t s); -#endif /* __sparc */ static void bscv_setup_watchdog(bscv_soft_state_t *ssp); static void bscv_write_wdog_cfg(bscv_soft_state_t *, @@ -234,17 +221,6 @@ static int watchdog_activated; static uint_t bscv_watchdog_timeout_seconds; #endif /* __i386 || __amd64 */ -#ifdef __sparc -struct bscv_idi_callout bscv_idi_callout_table[] = { - {BSCV_IDI_NODENAME, &bscv_nodename_set }, - {BSCV_IDI_SIG, &bscv_sig_set }, - {BSCV_IDI_WDOG_PAT, &bscv_wdog_pat }, - {BSCV_IDI_WDOG_CFG, &bscv_wdog_cfg }, - {BSCV_IDI_NULL, NULL } -}; - -static struct bscv_idi_callout_mgr bscv_idi_mgr; -#endif /* __sparc */ /* * Local Definitions @@ -434,9 +410,6 @@ _init(void) ddi_soft_state_fini(&bscv_statep); } -#ifdef __sparc - if (e == 0) bscv_idi_init(); -#endif /* __sparc */ return (e); } @@ -470,9 +443,6 @@ _fini(void) return (e); } -#ifdef __sparc - bscv_idi_fini(); -#endif /* __sparc */ ddi_soft_state_fini(&bscv_statep); return (e); @@ -519,72 +489,6 @@ bscv_getinfo(dev_info_t *dip, ddi_info_cmd_t cmd, void *arg, void **result) return (error); } -#ifdef __sparc -void -bscv_idi_init() -{ - bscv_idi_mgr.valid_inst = (uint32_t)~0; /* No valid instances */ - bscv_idi_mgr.tbl = bscv_idi_callout_table; - bscv_idi_mgr.errs = 0; - - /* - * Now that all fields are initialized, set the magic flag. This is - * a kind of integrity check for the data structure. - */ - bscv_idi_mgr.magic = BSCV_IDI_CALLOUT_MAGIC; -} - -static void -bscv_idi_clear_err() -{ - ASSERT(bscv_idi_mgr.magic == BSCV_IDI_CALLOUT_MAGIC); - - bscv_idi_mgr.errs = 0; -} - -/* - * function - bscv_idi_err - * description - error messaging service which throttles the number of error - * messages to avoid overflowing storage - * inputs - none - * returns - boolean to indicate whether a message should be reported - * side-effects - updates the error number counter - */ -static boolean_t -bscv_idi_err() -{ - ASSERT(bscv_idi_mgr.magic == BSCV_IDI_CALLOUT_MAGIC); - - bscv_idi_mgr.errs++; - - if (bscv_idi_mgr.errs++ < BSCV_IDI_ERR_MSG_THRESHOLD) - return (B_TRUE); - - return (B_FALSE); -} - -void -bscv_idi_new_instance(dev_info_t *dip) -{ - ASSERT(bscv_idi_mgr.magic == BSCV_IDI_CALLOUT_MAGIC); - - /* - * We don't care how many instances we have, or their value, so long - * as we have at least one valid value. This is so service routines - * can get any required locks via a soft state pointer. - */ - if (bscv_idi_mgr.valid_inst == (uint32_t)~0) { - bscv_idi_mgr.valid_inst = ddi_get_instance(dip); - } -} - -void -bscv_idi_fini() -{ - bscv_idi_mgr.valid_inst = (uint32_t)~0; /* No valid instances */ - bscv_idi_mgr.tbl = NULL; -} -#endif /* __sparc */ /* * function - bscv_attach @@ -674,14 +578,6 @@ bscv_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) return (DDI_FAILURE); } -#ifdef __sparc - /* - * At this point the inter-driver-interface is made available. - * The IDI uses the event thread service which - * bscv_attach_common() sets up. - */ - bscv_idi_new_instance(dip); -#endif /* __sparc */ bscv_exit(ssp); @@ -5050,10 +4946,6 @@ bscv_attach_common(bscv_soft_state_t *ssp) if (ssp->progress & BSCV_WDOG_CFG) bscv_setup_watchdog(ssp); -#ifdef __sparc - if (ssp->progress & BSCV_SIG_SENT) - bscv_write_sig(ssp, ssp->last_sig); -#endif /* __sparc */ return (DDI_SUCCESS); } @@ -5331,130 +5223,6 @@ static int bscv_probe_check(bscv_soft_state_t *ssp) return ((ssp->prog_mode_only == B_FALSE) ? DDI_SUCCESS : DDI_FAILURE); } -#ifdef __sparc -/* - * function - bscv_idi_set - * description - bscv inter driver interface set function - * inputs - structure which defines type of service required and data - * ouputs - none - * - * This is the Entry Point function for the platmod driver. It works out which - * X Bus channel ought to deliver the service requested. - */ -void -bscv_idi_set(struct bscv_idi_info info) -{ - struct bscv_idi_callout *tbl; - boolean_t retval; - - ASSERT(bscv_idi_mgr.magic == BSCV_IDI_CALLOUT_MAGIC); - - if (bscv_idi_mgr.tbl == NULL) { - if (bscv_idi_err()) - cmn_err(CE_WARN, "!bscv_idi_set : cannot find " - "bscv_callout_table"); - return; - } else if (bscv_idi_mgr.valid_inst == (uint32_t)~0) { - if (bscv_idi_err()) - /* - * This error message can appear in the context of - * another driver, say platmod or todblade. We want - * to clearly indicate the culprit driver so put in - * the driver name. - */ - cmn_err(CE_WARN, "!bscv_idi_set : no valid " - "driver instance of " - MYNAME); - return; - } - - tbl = bscv_idi_mgr.tbl; - - while (tbl->type != BSCV_IDI_NULL) { - if (tbl->type == info.type) { - /* - * We service the request with a valid instance number - * for the driver. - */ - retval = ((tbl->fn) (info)); - - /* - * If the request was serviced, clear any accumulated - * error counters so future warnings will be reported if - * seen. - */ - if (retval == B_TRUE) - bscv_idi_clear_err(); - return; - } else { - tbl++; - } - } - - if (bscv_idi_err()) - cmn_err(CE_WARN, "!bscv_idi_set : cannot match info.type %d", - info.type); -} - -/* - * function - bscv_nodename_set - * description - notify the event thread that a nodename change has occurred. - * inputs - data from client driver - * outputs - none. - * side-effects - the event thread will schedule an update to the lom firmware. - */ -/*ARGSUSED*/ -static boolean_t -bscv_nodename_set(struct bscv_idi_info info) -{ - bscv_soft_state_t *ssp; - - ssp = ddi_get_soft_state(bscv_statep, bscv_idi_mgr.valid_inst); - - if (ssp == NULL) { - if (bscv_idi_err()) - cmn_err(CE_WARN, "!blade_nodename_set: cannot get ssp"); - return (B_FALSE); - } - - /* Get a lock on the SSP, notify our change, then exit */ - mutex_enter(&ssp->task_mu); - ssp->nodename_change = B_TRUE; - cv_signal(&ssp->task_cv); - mutex_exit(&ssp->task_mu); - - return (B_TRUE); -} - -/* - * function - bscv_sig_set - * description - write a signature - * inputs - data from client driver - * outputs - none. - */ -static boolean_t -bscv_sig_set(struct bscv_idi_info info) -{ - bscv_soft_state_t *ssp; - bscv_sig_t sig; - - ssp = ddi_get_soft_state(bscv_statep, bscv_idi_mgr.valid_inst); - - if (ssp == NULL) { - if (bscv_idi_err()) - cmn_err(CE_WARN, "!blade_nodename_set: cannot get ssp"); - return (B_FALSE); - } - - /* Service the request */ - bcopy(info.data, &sig, sizeof (sig)); - bscv_enter(ssp); - bscv_write_sig(ssp, sig); - bscv_exit(ssp); - - return (B_TRUE); -} -#endif /* __sparc */ static void bscv_wdog_do_pat(bscv_soft_state_t *ssp) @@ -5487,83 +5255,6 @@ bscv_wdog_do_pat(bscv_soft_state_t *ssp) pat); } -#ifdef __sparc -/* - * function - bscv_wdog_pat - * description - pat the watchdog - * inputs - data from client driver - * outputs - none. - */ -/*ARGSUSED*/ -static boolean_t -bscv_wdog_pat(struct bscv_idi_info info) -{ - /* - * This function remembers if it has ever been called with the - * configure option set. - */ - bscv_soft_state_t *ssp; - - ssp = ddi_get_soft_state(bscv_statep, bscv_idi_mgr.valid_inst); - - if (ssp == NULL) { - if (bscv_idi_err()) - cmn_err(CE_WARN, "!bscv_wdog_pat: cannot get ssp"); - return (B_FALSE); - } else if (ssp->nchannels == 0) { - /* Didn't manage to map handles so ddi_{get,put}* broken */ - if (bscv_idi_err()) - cmn_err(CE_WARN, "!bscv_wdog_pat: handle not mapped"); - return (B_FALSE); - } - - bscv_wdog_do_pat(ssp); - return (B_TRUE); -} - -/* - * function - bscv_wdog_cfg - * description - configure the watchdog - * inputs - data from client driver - * outputs - none. - */ -static boolean_t -bscv_wdog_cfg(struct bscv_idi_info info) -{ - bscv_soft_state_t *ssp; - - ssp = ddi_get_soft_state(bscv_statep, bscv_idi_mgr.valid_inst); - - if (ssp == NULL) { - if (bscv_idi_err()) - cmn_err(CE_WARN, "!bscv_wdog_cfg: cannot get ssp"); - return (B_FALSE); - } else if (ssp->nchannels == 0) { - /* Didn't manage to map handles so ddi_{get,put}* broken */ - if (bscv_idi_err()) - cmn_err(CE_WARN, "!bscv_wdog_cfg: handle not mapped"); - return (B_FALSE); - } - - if (sizeof (bscv_wdog_t) != info.size) { - BSCV_TRACE(ssp, 'W', "bscv_wdog_set", "data passed in is size" - " %d instead of %d", info.size, - sizeof (bscv_wdog_t)); - return (B_FALSE); - } - - BSCV_TRACE(ssp, 'W', "bscv_wdog_cfg", "enable_wdog %s, " - "wdog_timeout_s %d, reset_system_on_timeout %s", - ((bscv_wdog_t *)info.data)->enable_wdog ? "enabled" : "disabled", - ((bscv_wdog_t *)info.data)->wdog_timeout_s, - ((bscv_wdog_t *)info.data)->reset_system_on_timeout ? "yes" : "no"); - bscv_write_wdog_cfg(ssp, - ((bscv_wdog_t *)info.data)->wdog_timeout_s, - ((bscv_wdog_t *)info.data)->enable_wdog, - ((bscv_wdog_t *)info.data)->reset_system_on_timeout); - return (B_TRUE); -} -#endif /* __sparc */ static void bscv_write_wdog_cfg(bscv_soft_state_t *ssp, @@ -5620,9 +5311,6 @@ static void bscv_setup_watchdog(bscv_soft_state_t *ssp) { uint8_t set = 0; uint8_t clear = 0; -#ifdef __sparc - extern int watchdog_activated; -#endif /* __sparc */ ASSERT(bscv_held(ssp)); @@ -6157,55 +5845,6 @@ bscv_setup_events(bscv_soft_state_t *ssp) bits2set, bits2clear); } -#ifdef __sparc -/* - * function - bscv_write_sig - * description - write out a signature, taking care to deal with any strange - * values for CPU ID - * inputs - soft state ptr, signature - * outputs - none - */ -static void -bscv_write_sig(bscv_soft_state_t *ssp, bscv_sig_t s) -{ - ASSERT(bscv_held(ssp)); - - /* Upload the signature */ - bscv_put32(ssp, chan_cpusig, - BSCVA(EBUS_CMD_SPACE_CPUSIG, EBUS_IDX11_CPU_SIG_MSB), - s.sig_info.signature); - - /* - * We always write the CPU ID last because this tells the firmware - * that the signature is fully uploaded and therefore to consume the - * data. This is required since the signature is > 1 byte in size - * and we transmit data in single bytes. - */ - if (s.cpu == ~0) { - /* ~0 means the signature applies to any CPU. */ - bscv_put8(ssp, chan_cpusig, - BSCVA(EBUS_CMD_SPACE_CPUSIG, EBUS_IDX11_CPU_ID), - EBUS_ANY_CPU_ID); - } else { - if (s.cpu > 255) { - /* - * The CPU ID supplied is unexpectedly large. Lets - * just use the bottom bits, in case other high order - * bits are being used for special meaning. - */ - cmn_err(CE_WARN, "CPU Signature ID 0x%x > 255", s.cpu); - s.cpu %= 256; - cmn_err(CE_CONT, "using ID 0x%x instead ", s.cpu); - } - bscv_put8(ssp, chan_cpusig, - BSCVA(EBUS_CMD_SPACE_CPUSIG, EBUS_IDX11_CPU_ID), - (uint8_t)s.cpu); - } - - ssp->last_sig = s; - ssp->progress |= BSCV_SIG_SENT; -} -#endif /* __sparc */ #if defined(__i386) || defined(__amd64) diff --git a/usr/src/uts/common/io/cmlb.c b/usr/src/uts/common/io/cmlb.c index 9d9851b6ba..dcb7ce062f 100644 --- a/usr/src/uts/common/io/cmlb.c +++ b/usr/src/uts/common/io/cmlb.c @@ -3020,14 +3020,6 @@ cmlb_uselabel(struct cmlb_lun *cl, struct dk_label *labp, int flags) /* Validate the magic number of the label. */ if (labp->dkl_magic != DKL_MAGIC) { -#if defined(__sparc) - if (!ISREMOVABLE(cl) && !ISHOTPLUGGABLE(cl)) { - if (!(flags & CMLB_SILENT)) - cmlb_log(CMLB_DEVINFO(cl), CMLB_LABEL(cl), - CE_WARN, - "Corrupt label; wrong magic number\n"); - } -#endif return (CMLB_LABEL_IS_INVALID); } diff --git a/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_api.c b/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_api.c index bb1ff93c63..df7ee802b0 100644 --- a/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_api.c +++ b/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_api.c @@ -2591,7 +2591,6 @@ ql_init_pkt(opaque_t fca_handle, fc_packet_t *pkt, int sleep) sp->ha = ha; sp->magic_number = QL_FCA_BRAND; sp->sg_dma.dma_handle = NULL; -#ifndef __sparc if (CFG_IST(ha, CFG_CTRL_8021)) { /* Setup DMA for scatter gather list. */ sp->sg_dma.size = sizeof (cmd6_2400_dma_t); @@ -2602,7 +2601,6 @@ ql_init_pkt(opaque_t fca_handle, fc_packet_t *pkt, int sleep) rval = FC_NOMEM; } } -#endif /* __sparc */ QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance); @@ -2902,22 +2900,6 @@ ql_get_cap(opaque_t fca_handle, char *cap, void *ptr) } else if (strcmp(cap, FC_CAP_NOSTREAM_ON_UNALIGN_BUF) == 0) { dev_info_t *psydip = NULL; -#ifdef __sparc - /* - * Disable streaming for certain 2 chip adapters - * below Psycho to handle Psycho byte hole issue. - */ - if ((CFG_IST(ha, CFG_MULTI_CHIP_ADAPTER)) && - (!CFG_IST(ha, CFG_SBUS_CARD))) { - for (psydip = ddi_get_parent(ha->dip); psydip; - psydip = ddi_get_parent(psydip)) { - if (strcmp(ddi_driver_name(psydip), - "pcipsy") == 0) { - break; - } - } - } -#endif /* __sparc */ if (psydip) { *rptr = (uint32_t)FC_NO_STREAMING; @@ -3287,21 +3269,6 @@ ql_ub_alloc(opaque_t fca_handle, uint64_t tokens[], uint32_t size, rval = FC_FAILURE; } else { if (type == FC_TYPE_IS8802_SNAP) { -#ifdef __sparc - if (ql_get_dma_mem(ha, - &sp->ub_buffer, size, - BIG_ENDIAN_DMA, - QL_DMA_DATA_ALIGN) != QL_SUCCESS) { - rval = FC_FAILURE; - kmem_free(ubp, - sizeof (fc_unsol_buf_t)); - kmem_free(sp, - sizeof (ql_srb_t)); - } else { - bufp = sp->ub_buffer.bp; - sp->ub_size = size; - } -#else if (ql_get_dma_mem(ha, &sp->ub_buffer, size, LITTLE_ENDIAN_DMA, @@ -3315,7 +3282,6 @@ ql_ub_alloc(opaque_t fca_handle, uint64_t tokens[], uint32_t size, bufp = sp->ub_buffer.bp; sp->ub_size = size; } -#endif } else { bufp = kmem_zalloc(size, KM_SLEEP); if (bufp == NULL) { @@ -16580,17 +16546,6 @@ ql_setup_msix(ql_adapter_state_t *ha) * duplicate the rest of the intr's * ddi_intr_dup_handler() isn't working on x86 just yet... */ -#ifdef __sparc - for (i = actual; i < hwvect; i++) { - if ((ret = ddi_intr_dup_handler(ha->htable[0], (int)i, - &ha->htable[i])) != DDI_SUCCESS) { - EL(ha, "failed, intr_dup#=%xh, act=%xh, ret=%xh\n", - i, actual, ret); - ql_release_intr(ha); - return (ret); - } - } -#endif /* Setup mutexes */ if ((ret = ql_init_mutex(ha)) != DDI_SUCCESS) { diff --git a/usr/src/uts/common/io/hme/hme.c b/usr/src/uts/common/io/hme/hme.c index fb54312995..e0770b2120 100644 --- a/usr/src/uts/common/io/hme/hme.c +++ b/usr/src/uts/common/io/hme/hme.c @@ -3602,33 +3602,7 @@ hme_setup_mac_address(struct hme *hmep, dev_info_t *dip) kmem_free(prop, prop_len); } -#ifdef __sparc - /* - * On sparc, we might be able to use the mac address from the - * system. However, on all other systems, we need to use the - * address from the PROM. - */ - if (ddi_getlongprop(DDI_DEV_T_ANY, dip, 0, "local-mac-address?", - (caddr_t)&prop, &prop_len) == DDI_PROP_SUCCESS) { - if ((strncmp("true", prop, prop_len) == 0) && - (hmep->hme_addrflags & HME_FACTADDR_PRESENT)) { - hmep->hme_addrflags |= HME_FACTADDR_USE; - ether_bcopy(&hmep->hme_factaddr, &hmep->hme_ouraddr); - kmem_free(prop, prop_len); - HME_FAULT_MSG1(hmep, SEVERITY_NONE, DISPLAY_MSG, - "Using local MAC address"); - return; - } - kmem_free(prop, prop_len); - } - - /* - * Get the system ethernet address. - */ - (void) localetheraddr(NULL, &hmep->hme_ouraddr); -#else ether_bcopy(&hmep->hme_factaddr, &hmep->hme_ouraddr); -#endif } /* ARGSUSED */ diff --git a/usr/src/uts/common/io/hotplug/pcihp/pcihp.c b/usr/src/uts/common/io/hotplug/pcihp/pcihp.c index d84b72c7cb..bdeb9778e0 100644 --- a/usr/src/uts/common/io/hotplug/pcihp/pcihp.c +++ b/usr/src/uts/common/io/hotplug/pcihp/pcihp.c @@ -4024,18 +4024,5 @@ skip: static int pcihp_indirect_map(dev_info_t *dip) { -#if defined(__sparc) - int rc = DDI_FAILURE; - - if (ddi_prop_get_int(DDI_DEV_T_ANY, ddi_get_parent(dip), 0, - PCI_DEV_CONF_MAP_PROP, DDI_FAILURE) != DDI_FAILURE) - rc = DDI_SUCCESS; - else - if (ddi_prop_get_int(DDI_DEV_T_ANY, ddi_get_parent(dip), - 0, PCI_BUS_CONF_MAP_PROP, DDI_FAILURE) != DDI_FAILURE) - rc = DDI_SUCCESS; - return (rc); -#else return (DDI_SUCCESS); -#endif } diff --git a/usr/src/uts/common/io/i8042.c b/usr/src/uts/common/io/i8042.c index 5e483d07ed..be1d74de82 100644 --- a/usr/src/uts/common/io/i8042.c +++ b/usr/src/uts/common/io/i8042.c @@ -44,11 +44,7 @@ * soft interrupt user impacts the performance of all existing soft interrupt * users. This is not the case on SPARC, however. */ -#ifdef __sparc -#define USE_SOFT_INTRS -#else #undef USE_SOFT_INTRS -#endif /* * The command bytes are different for x86 and for SPARC because on x86, @@ -173,9 +169,6 @@ struct i8042 { #define I8042_INIT_MUTEXES 0x00000004 #define I8042_INIT_INTRS_ENABLED 0x00000010 uint_t intrs_added; -#ifdef __sparc - timeout_id_t timeout_id; -#endif /* * glock is 1 if any child has the [put8] exclusive-access lock * glock_cv is associated with the condition `glock == 0' @@ -228,35 +221,6 @@ struct i8042 { #define USECS_PER_WAIT 10 -#ifdef __sparc - -#define PLATFORM_MATCH(s) (strncmp(ddi_get_name(ddi_root_node()), \ - (s), strlen(s)) == 0) - -/* - * On some older SPARC platforms that have problems with the - * interrupt line attached to the PS/2 keyboard/mouse, it - * may be necessary to change the operating mode of the nexus - * to a polling-based (instead of interrupt-based) method. - * this variable is present to enable a worst-case workaround so - * owners of these systems can still retain a working keyboard. - * - * The `i8042_polled_mode' variable can be used to force polled - * mode for platforms that have this issue, but for which - * automatic relief is not implemented. - * - * In the off chance that one of the platforms is misidentified - * as requiried polling mode, `i8042_force_interrupt_mode' can - * be set to force the nexus to use interrupts. - */ -#define I8042_MIN_POLL_INTERVAL 1000 /* usecs */ -int i8042_poll_interval = 8000; /* usecs */ -int i8042_fast_poll_interval; /* usecs */ -int i8042_slow_poll_interval; /* usecs */ - -boolean_t i8042_polled_mode = B_FALSE; -boolean_t i8042_force_interrupt_mode = B_FALSE; -#endif /* __sparc */ int max_wait_iterations = MAX_WAIT_ITERATIONS; @@ -283,10 +247,6 @@ static int i8042_bus_config(dev_info_t *, uint_t, ddi_bus_config_op_t, void *, dev_info_t **); static int i8042_bus_unconfig(dev_info_t *, uint_t, ddi_bus_config_op_t, void *); -#ifdef __sparc -static int i8042_build_interrupts_property(dev_info_t *dip); -static boolean_t i8042_is_polling_platform(void); -#endif /* * bus ops and dev ops structures: @@ -460,12 +420,6 @@ i8042_cleanup(struct i8042 *global) mutex_exit(&global->i8042_mutex); } -#ifdef __sparc - /* If there may be an outstanding timeout, cancel it */ - if (global->timeout_id != 0) { - (void) untimeout(global->timeout_id); - } -#endif /* Stop the controller from generating interrupts */ if (global->init_state & I8042_INIT_INTRS_ENABLED) @@ -573,9 +527,6 @@ i8042_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) DDI_STRICTORDER_ACC, }; struct i8042 *global; -#ifdef __sparc - int interval; -#endif switch (cmd) { case DDI_RESUME: @@ -616,42 +567,11 @@ i8042_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) if (ddi_dev_nintrs(dip, &global->nintrs) == DDI_FAILURE) goto fail; -#ifdef __sparc - if ((i8042_polled_mode || i8042_is_polling_platform()) && - !i8042_force_interrupt_mode) { - /* - * If we're on a platform that has known - * interrupt issues with the keyboard/mouse, - * use polled mode. - */ - i8042_polled_mode = B_TRUE; - global->nintrs = 0; - } else if (global->nintrs == 0) { - /* - * If there are no interrupts on the i8042 node, - * we may be on a brain-dead platform that only - * has interrupts properties on i8042's children - * (e.g. some UltraII-based boards) - * In this case, scan first-level children, and - * build a list of interrupts that each child uses, - * then create an `interrupts' property on the nexus node - * that contains the interrupts used by all children - */ - if (i8042_build_interrupts_property(dip) == DDI_FAILURE || - ddi_dev_nintrs(dip, &global->nintrs) == DDI_FAILURE || - global->nintrs == 0) { - cmn_err(CE_WARN, "i8042#%d: No interrupts defined!", - ddi_get_instance(global->dip)); - goto fail; - } - } -#else if (global->nintrs == 0) { cmn_err(CE_WARN, "i8042#%d: No interrupts defined!", ddi_get_instance(global->dip)); goto fail; } -#endif if (global->nintrs > MAX_INTERRUPTS) global->nintrs = MAX_INTERRUPTS; @@ -758,23 +678,6 @@ i8042_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) i8042_write_command_byte(global, I8042_CMD_ENABLE_ALL); global->init_state |= I8042_INIT_INTRS_ENABLED; -#ifdef __sparc - if (i8042_polled_mode) { - /* - * Do not allow anyone to set the polling interval - * to an interval more frequent than I8042_MIN_POLL_INTERVAL -- - * it could hose the system. - */ - interval = i8042_poll_interval; - if (interval < I8042_MIN_POLL_INTERVAL) - interval = I8042_MIN_POLL_INTERVAL; - i8042_fast_poll_interval = interval; - i8042_slow_poll_interval = interval << 3; - - global->timeout_id = timeout(i8042_timeout, global, - drv_usectohz(i8042_slow_poll_interval)); - } -#endif return (DDI_SUCCESS); @@ -799,10 +702,6 @@ i8042_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) * the keyboard can be used to bring the system out of * suspend. */ -#ifdef __sparc - /* Disable interrupts and controller devices before suspend */ - i8042_write_command_byte(global, I8042_CMD_DISABLE_ALL); -#endif return (DDI_SUCCESS); case DDI_DETACH: @@ -956,44 +855,6 @@ i8042_map( } } -#ifdef __sparc -static void -i8042_timeout(void *arg) -{ - struct i8042 *i8042_p = (struct i8042 *)arg; - int interval; - - /* - * Allow the polling speed to be changed on the fly -- - * catch it here and update the intervals used. - */ - if (i8042_fast_poll_interval != i8042_poll_interval) { - interval = i8042_poll_interval; - if (interval < I8042_MIN_POLL_INTERVAL) - interval = I8042_MIN_POLL_INTERVAL; - i8042_fast_poll_interval = interval; - i8042_slow_poll_interval = interval << 3; - } - - /* - * If the ISR returned true, start polling at a faster rate to - * increate responsiveness. Once the keyboard or mouse go idle, - * the ISR will return UNCLAIMED, and we'll go back to the slower - * polling rate. This gives some positive hysteresis (but not - * negative, since we go back to the slower polling interval after - * only one UNCLAIMED). This has shown to be responsive enough, - * even for fast typers. - */ - interval = (i8042_intr((caddr_t)i8042_p) == DDI_INTR_CLAIMED) ? - i8042_fast_poll_interval : i8042_slow_poll_interval; - - if (i8042_polled_mode) - i8042_p->timeout_id = timeout(i8042_timeout, arg, - drv_usectohz(interval)); - else - i8042_p->timeout_id = 0; -} -#endif /* * i8042 hardware interrupt routine. Called for both main and aux port @@ -1624,63 +1485,3 @@ i8042_bus_unconfig(dev_info_t *parent, uint_t flags, return (ndi_busop_bus_unconfig(parent, flags | NDI_UNCONFIG, op, arg)); } -#ifdef __sparc -static int -i8042_build_interrupts_property(dev_info_t *dip) -{ - dev_info_t *child = ddi_get_child(dip); - uint_t nintr; - int *intrs = NULL; - int interrupts[MAX_INTERRUPTS]; - int i = 0; - - /* Walk the children of this node, scanning for interrupts properties */ - while (child != NULL && i < MAX_INTERRUPTS) { - - if (ddi_prop_lookup_int_array(DDI_DEV_T_ANY, child, - DDI_PROP_DONTPASS, "interrupts", &intrs, &nintr) - == DDI_PROP_SUCCESS && intrs != NULL) { - - while (nintr > 0 && i < MAX_INTERRUPTS) { - interrupts[i++] = intrs[--nintr]; - } - ddi_prop_free(intrs); - } - - child = ddi_get_next_sibling(child); - } - - if (ddi_prop_update_int_array(DDI_DEV_T_NONE, dip, "interrupts", - interrupts, i) != DDI_PROP_SUCCESS) { - - return (DDI_FAILURE); - } - - /* - * Oh, the humanity. On the platforms on which we need to - * synthesize an interrupts property, we ALSO need to update the - * device_type property, and set it to "serial" in order for the - * correct interrupt PIL to be chosen by the framework. - */ - if (ddi_prop_update_string(DDI_DEV_T_NONE, dip, "device_type", "serial") - != DDI_PROP_SUCCESS) { - - return (DDI_FAILURE); - } - - return (DDI_SUCCESS); -} - -static boolean_t -i8042_is_polling_platform(void) -{ - /* - * Returns true if this platform is one of the platforms - * that has interrupt issues with the PS/2 keyboard/mouse. - */ - if (PLATFORM_MATCH("SUNW,UltraAX-")) - return (B_TRUE); - else - return (B_FALSE); -} -#endif diff --git a/usr/src/uts/common/io/ib/adapters/hermon/hermon.c b/usr/src/uts/common/io/ib/adapters/hermon/hermon.c index 794c785f31..28e7a9c2c4 100644 --- a/usr/src/uts/common/io/ib/adapters/hermon/hermon.c +++ b/usr/src/uts/common/io/ib/adapters/hermon/hermon.c @@ -882,10 +882,6 @@ hermon_dma_alloc(hermon_state_t *state, hermon_dma_info_t *dma_info, int status; hermon_dma_attr_init(state, &dma_attr); -#ifdef __sparc - if (state->hs_cfg_profile->cp_iommu_bypass == HERMON_BINDMEM_BYPASS) - dma_attr.dma_attr_flags = DDI_DMA_FORCE_PHYSICAL; -#endif /* Allocate a DMA handle */ status = ddi_dma_alloc_handle(state->hs_dip, &dma_attr, DDI_DMA_SLEEP, diff --git a/usr/src/uts/common/io/ib/adapters/hermon/hermon_cfg.c b/usr/src/uts/common/io/ib/adapters/hermon/hermon_cfg.c index 3f7df30be7..3883bb566a 100644 --- a/usr/src/uts/common/io/ib/adapters/hermon/hermon_cfg.c +++ b/usr/src/uts/common/io/ib/adapters/hermon/hermon_cfg.c @@ -191,10 +191,6 @@ uint32_t hermon_qp_ackreq_freq = HERMON_QP_ACKREQ_FREQ; static void hermon_cfg_wqe_sizes(hermon_state_t *state, hermon_cfg_profile_t *cp); -#ifdef __sparc -static void hermon_check_iommu_bypass(hermon_state_t *state, - hermon_cfg_profile_t *cp); -#endif /* * hermon_cfg_profile_init_phase1() @@ -246,15 +242,7 @@ hermon_cfg_profile_init_phase1(hermon_state_t *state) * Set IOMMU bypass or not. Ensure consistency of flags with * architecture type. */ -#ifdef __sparc - if (hermon_iommu_bypass == 1) { - hermon_check_iommu_bypass(state, cp); - } else { - cp->cp_iommu_bypass = HERMON_BINDMEM_NORMAL; - } -#else cp->cp_iommu_bypass = HERMON_BINDMEM_NORMAL; -#endif /* Attach the configuration profile to Hermon softstate */ state->hs_cfg_profile = cp; @@ -460,75 +448,3 @@ hermon_cfg_wqe_sizes(hermon_state_t *state, hermon_cfg_profile_t *cp) cp->cp_srq_max_sgl = hermon_srq_max_sgl; } -#ifdef __sparc -/* - * hermon_check_iommu_bypass() - * Context: Only called from attach() path context - * XXX This is a DMA allocation routine outside the normal - * path. FMA hardening will not like this. - */ -static void -hermon_check_iommu_bypass(hermon_state_t *state, hermon_cfg_profile_t *cp) -{ - ddi_dma_handle_t dmahdl; - ddi_dma_attr_t dma_attr; - int status; - ddi_acc_handle_t acc_hdl; - caddr_t kaddr; - size_t actual_len; - ddi_dma_cookie_t cookie; - uint_t cookiecnt; - - hermon_dma_attr_init(state, &dma_attr); - - /* Try mapping for IOMMU bypass (Force Physical) */ - dma_attr.dma_attr_flags = DDI_DMA_FORCE_PHYSICAL | - DDI_DMA_RELAXED_ORDERING; - - /* - * Call ddi_dma_alloc_handle(). If this returns DDI_DMA_BADATTR then - * it is not possible to use IOMMU bypass with our PCI bridge parent. - * Since the function we are in can only be called if iommu bypass was - * requested in the config profile, we configure for bypass if the - * ddi_dma_alloc_handle() was successful. Otherwise, we configure - * for non-bypass (ie: normal) mapping. - */ - status = ddi_dma_alloc_handle(state->hs_dip, &dma_attr, - DDI_DMA_SLEEP, NULL, &dmahdl); - if (status == DDI_DMA_BADATTR) { - cp->cp_iommu_bypass = HERMON_BINDMEM_NORMAL; - return; - } else if (status != DDI_SUCCESS) { /* failed somehow */ - hermon_kernel_data_ro = HERMON_RO_DISABLED; - hermon_user_data_ro = HERMON_RO_DISABLED; - cp->cp_iommu_bypass = HERMON_BINDMEM_BYPASS; - return; - } else { - cp->cp_iommu_bypass = HERMON_BINDMEM_BYPASS; - } - - status = ddi_dma_mem_alloc(dmahdl, 256, - &state->hs_reg_accattr, DDI_DMA_CONSISTENT, - DDI_DMA_SLEEP, NULL, (caddr_t *)&kaddr, &actual_len, &acc_hdl); - - if (status != DDI_SUCCESS) { /* failed somehow */ - hermon_kernel_data_ro = HERMON_RO_DISABLED; - hermon_user_data_ro = HERMON_RO_DISABLED; - ddi_dma_free_handle(&dmahdl); - return; - } - - status = ddi_dma_addr_bind_handle(dmahdl, NULL, kaddr, actual_len, - DDI_DMA_RDWR, DDI_DMA_SLEEP, NULL, &cookie, &cookiecnt); - - if (status == DDI_DMA_MAPPED) { - (void) ddi_dma_unbind_handle(dmahdl); - } else { - hermon_kernel_data_ro = HERMON_RO_DISABLED; - hermon_user_data_ro = HERMON_RO_DISABLED; - } - - ddi_dma_mem_free(&acc_hdl); - ddi_dma_free_handle(&dmahdl); -} -#endif diff --git a/usr/src/uts/common/io/ib/adapters/hermon/hermon_ci.c b/usr/src/uts/common/io/ib/adapters/hermon/hermon_ci.c index f9284151a4..d48373d214 100644 --- a/usr/src/uts/common/io/ib/adapters/hermon/hermon_ci.c +++ b/usr/src/uts/common/io/ib/adapters/hermon/hermon_ci.c @@ -2087,13 +2087,6 @@ hermon_map_mem_area_fmr(ibc_hca_hdl_t hca, ibt_va_attr_t *va_attrs, if (ma_hdl == NULL) { return (IBT_INSUFF_RESOURCE); } -#ifdef __sparc - if (state->hs_cfg_profile->cp_iommu_bypass == HERMON_BINDMEM_BYPASS) - dma_attr.dma_attr_flags = DDI_DMA_FORCE_PHYSICAL; - - if (hermon_kernel_data_ro == HERMON_RO_ENABLED) - dma_attr.dma_attr_flags |= DDI_DMA_RELAXED_ORDERING; -#endif _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*ma_hdl)) status = ddi_dma_alloc_handle(state->hs_dip, &dma_attr, @@ -2218,13 +2211,6 @@ hermon_ci_map_mem_area(ibc_hca_hdl_t hca, ibt_va_attr_t *va_attrs, if (!(state->hs_ibtfinfo.hca_attr->hca_flags2 & IBT_HCA2_MEM_MGT_EXT)) return (IBT_NOT_SUPPORTED); hermon_dma_attr_init(state, &dma_attr); -#ifdef __sparc - if (state->hs_cfg_profile->cp_iommu_bypass == HERMON_BINDMEM_BYPASS) - dma_attr.dma_attr_flags = DDI_DMA_FORCE_PHYSICAL; - - if (hermon_kernel_data_ro == HERMON_RO_ENABLED) - dma_attr.dma_attr_flags |= DDI_DMA_RELAXED_ORDERING; -#endif if (va_attrs->va_flags & IBT_VA_NOSLEEP) { kmflag = KM_NOSLEEP; callback = DDI_DMA_DONTWAIT; @@ -2448,13 +2434,6 @@ hermon_ci_map_mem_iov(ibc_hca_hdl_t hca, ibt_iov_attr_t *iov_attr, state = (hermon_state_t *)hca; hermon_dma_attr_init(state, &dma_attr); -#ifdef __sparc - if (state->hs_cfg_profile->cp_iommu_bypass == HERMON_BINDMEM_BYPASS) - dma_attr.dma_attr_flags = DDI_DMA_FORCE_PHYSICAL; - - if (hermon_kernel_data_ro == HERMON_RO_ENABLED) - dma_attr.dma_attr_flags |= DDI_DMA_RELAXED_ORDERING; -#endif nds = 0; max_nds = iov_attr->iov_wr_nds; diff --git a/usr/src/uts/common/io/ib/adapters/hermon/hermon_misc.c b/usr/src/uts/common/io/ib/adapters/hermon/hermon_misc.c index 2085a1ebb4..082fd365a2 100644 --- a/usr/src/uts/common/io/ib/adapters/hermon/hermon_misc.c +++ b/usr/src/uts/common/io/ib/adapters/hermon/hermon_misc.c @@ -96,10 +96,6 @@ hermon_dbr_new_user_page(hermon_state_t *state, uint_t index, pagesize, B_WRITE, 0, 0, NULL, DDI_UMEM_SLEEP); hermon_dma_attr_init(state, &dma_attr); -#ifdef __sparc - if (state->hs_cfg_profile->cp_iommu_bypass == HERMON_BINDMEM_BYPASS) - dma_attr.dma_attr_flags = DDI_DMA_FORCE_PHYSICAL; -#endif status = ddi_dma_alloc_handle(state->hs_dip, &dma_attr, DDI_DMA_SLEEP, NULL, &pagep->upg_dmahdl); if (status != DDI_SUCCESS) { @@ -286,10 +282,6 @@ hermon_dbr_page_alloc(hermon_state_t *state, hermon_dbr_info_t **dinfo) hermon_dma_attr_init(state, &dma_attr); dma_attr.dma_attr_align = pagesize; dma_attr.dma_attr_sgllen = 1; /* make sure only one cookie */ -#ifdef __sparc - if (state->hs_cfg_profile->cp_iommu_bypass == HERMON_BINDMEM_BYPASS) - dma_attr.dma_attr_flags = DDI_DMA_FORCE_PHYSICAL; -#endif status = ddi_dma_alloc_handle(state->hs_dip, &dma_attr, DDI_DMA_SLEEP, NULL, &dma_hdl); @@ -2413,11 +2405,6 @@ hermon_queue_alloc(hermon_state_t *state, hermon_qalloc_info_t *qa_info, */ hermon_dma_attr_init(state, &dma_attr); dma_attr.dma_attr_align = qa_info->qa_bind_align; -#ifdef __sparc - if (state->hs_cfg_profile->cp_iommu_bypass == HERMON_BINDMEM_BYPASS) { - dma_attr.dma_attr_flags = DDI_DMA_FORCE_PHYSICAL; - } -#endif /* Allocate a DMA handle */ status = ddi_dma_alloc_handle(state->hs_dip, &dma_attr, callback, NULL, diff --git a/usr/src/uts/common/io/ib/adapters/hermon/hermon_mr.c b/usr/src/uts/common/io/ib/adapters/hermon/hermon_mr.c index 709403564c..9a027811ac 100644 --- a/usr/src/uts/common/io/ib/adapters/hermon/hermon_mr.c +++ b/usr/src/uts/common/io/ib/adapters/hermon/hermon_mr.c @@ -3116,11 +3116,6 @@ hermon_mr_mem_bind(hermon_state_t *state, hermon_bind_info_t *bind, */ if (dmahdl == NULL) { hermon_dma_attr_init(state, &dma_attr); -#ifdef __sparc - if (bind->bi_bypass == HERMON_BINDMEM_BYPASS) { - dma_attr.dma_attr_flags = DDI_DMA_FORCE_PHYSICAL; - } -#endif /* set RO if needed - tunable set and 'is_buffer' is non-0 */ if (is_buffer) { diff --git a/usr/src/uts/common/io/ib/adapters/tavor/tavor_cfg.c b/usr/src/uts/common/io/ib/adapters/tavor/tavor_cfg.c index 73ffec621c..67efb2cf58 100644 --- a/usr/src/uts/common/io/ib/adapters/tavor/tavor_cfg.c +++ b/usr/src/uts/common/io/ib/adapters/tavor/tavor_cfg.c @@ -218,18 +218,11 @@ uint32_t tavor_qp_ackreq_freq = TAVOR_QP_ACKREQ_FREQ; * initialized. The format for this variable is the same as the corresponding * field in the "PCI-X Command Register". */ -#ifdef __sparc -/* - * Default SPARC platforms to be 1 outstanding PCI read. - */ -int tavor_max_out_splt_trans = 0; -#else /* * Default non-SPARC platforms to be the default as set in tavor firmware * number of outstanding PCI reads. */ int tavor_max_out_splt_trans = -1; -#endif /* * This is a patchable variable that determines the default value for the @@ -240,20 +233,11 @@ int tavor_max_out_splt_trans = -1; * initialized. The format for this variable is the same as the corresponding * field in the "PCI-X Command Register". */ -#ifdef __sparc -/* - * Default SPARC platforms to be 512B read. - */ -int tavor_max_mem_rd_byte_cnt = 0; -static void tavor_check_iommu_bypass(tavor_state_t *state, - tavor_cfg_profile_t *cp); -#else /* * Default non-SPARC platforms to be the default as set in tavor firmware. * */ int tavor_max_mem_rd_byte_cnt = -1; -#endif static void tavor_cfg_wqe_sizes(tavor_cfg_profile_t *cp); static void tavor_cfg_prop_lookup(tavor_state_t *state, @@ -356,17 +340,7 @@ tavor_cfg_profile_init_phase1(tavor_state_t *state) * with both architecture type and other configuration flags. */ if (tavor_streaming_consistent == 0) { -#ifdef __sparc - cp->cp_streaming_consistent = DDI_DMA_STREAMING; - - /* Can't do both "streaming" and IOMMU bypass */ - if (tavor_iommu_bypass != 0) { - kmem_free(cp, sizeof (tavor_cfg_profile_t)); - return (DDI_FAILURE); - } -#else cp->cp_streaming_consistent = DDI_DMA_CONSISTENT; -#endif } else { cp->cp_streaming_consistent = DDI_DMA_CONSISTENT; } @@ -574,17 +548,8 @@ tavor_cfg_profile_init_phase2(tavor_state_t *state) * Set IOMMU bypass or not. Ensure consistency of flags with * architecture type. */ -#ifdef __sparc - if (tavor_iommu_bypass == 1) { - tavor_check_iommu_bypass(state, cp); - } else { - cp->cp_iommu_bypass = TAVOR_BINDMEM_NORMAL; - cp->cp_disable_streaming_on_bypass = 0; - } -#else cp->cp_iommu_bypass = TAVOR_BINDMEM_NORMAL; cp->cp_disable_streaming_on_bypass = 0; -#endif /* Set whether QP WQEs will be in DDR or not */ cp->cp_qp_wq_inddr = (tavor_qp_wq_inddr == 0) ? TAVOR_QUEUE_LOCATION_NORMAL : TAVOR_QUEUE_LOCATION_INDDR; @@ -756,45 +721,3 @@ tavor_cfg_prop_lookup(tavor_state_t *state, tavor_cfg_profile_t *cp) } } -#ifdef __sparc -/* - * tavor_check_iommu_bypass() - * Context: Only called from attach() path context - */ -static void -tavor_check_iommu_bypass(tavor_state_t *state, tavor_cfg_profile_t *cp) -{ - ddi_dma_handle_t dmahdl; - ddi_dma_attr_t dma_attr; - int status; - - tavor_dma_attr_init(&dma_attr); - - /* Try mapping for IOMMU bypass (Force Physical) */ - dma_attr.dma_attr_flags = DDI_DMA_FORCE_PHYSICAL; - - /* - * Call ddi_dma_alloc_handle(). If this returns DDI_DMA_BADATTR then - * it is not possible to use IOMMU bypass with our PCI bridge parent. - * For example, certain versions of Tomatillo do not support IOMMU - * bypass. Since the function we are in can only be called if iommu - * bypass was requested in the config profile, we configure for bypass - * if the ddi_dma_alloc_handle() was successful. Otherwise, we - * configure for non-bypass (ie: normal) mapping. - */ - status = ddi_dma_alloc_handle(state->ts_dip, &dma_attr, - DDI_DMA_SLEEP, NULL, &dmahdl); - if (status == DDI_DMA_BADATTR) { - cp->cp_iommu_bypass = TAVOR_BINDMEM_NORMAL; - cp->cp_disable_streaming_on_bypass = 0; - } else { - cp->cp_iommu_bypass = TAVOR_BINDMEM_BYPASS; - cp->cp_disable_streaming_on_bypass = - tavor_disable_streaming_on_bypass; - - if (status == DDI_SUCCESS) { - ddi_dma_free_handle(&dmahdl); - } - } -} -#endif diff --git a/usr/src/uts/common/io/ib/adapters/tavor/tavor_ci.c b/usr/src/uts/common/io/ib/adapters/tavor/tavor_ci.c index b7be753c5e..595769848b 100644 --- a/usr/src/uts/common/io/ib/adapters/tavor/tavor_ci.c +++ b/usr/src/uts/common/io/ib/adapters/tavor/tavor_ci.c @@ -2592,10 +2592,6 @@ tavor_ci_map_mem_iov(ibc_hca_hdl_t hca, ibt_iov_attr_t *iov_attr, state = (tavor_state_t *)hca; tavor_dma_attr_init(&dma_attr); -#ifdef __sparc - if (state->ts_cfg_profile->cp_iommu_bypass == TAVOR_BINDMEM_BYPASS) - dma_attr.dma_attr_flags = DDI_DMA_FORCE_PHYSICAL; -#endif nds = 0; max_nds = iov_attr->iov_wr_nds; diff --git a/usr/src/uts/common/io/ib/adapters/tavor/tavor_mr.c b/usr/src/uts/common/io/ib/adapters/tavor/tavor_mr.c index fb83c1c57f..244c780beb 100644 --- a/usr/src/uts/common/io/ib/adapters/tavor/tavor_mr.c +++ b/usr/src/uts/common/io/ib/adapters/tavor/tavor_mr.c @@ -2339,26 +2339,6 @@ tavor_mr_mem_bind(tavor_state_t *state, tavor_bind_info_t *bind, */ if (dmahdl == NULL) { tavor_dma_attr_init(&dma_attr); -#ifdef __sparc - /* - * First, disable streaming and switch to consistent if - * configured to do so and IOMMU BYPASS is enabled. - */ - if (state->ts_cfg_profile->cp_disable_streaming_on_bypass && - dma_xfer_mode == DDI_DMA_STREAMING && - bind->bi_bypass == TAVOR_BINDMEM_BYPASS) { - dma_xfer_mode = DDI_DMA_CONSISTENT; - } - - /* - * Then, if streaming is still specified, then "bypass" is not - * allowed. - */ - if ((dma_xfer_mode == DDI_DMA_CONSISTENT) && - (bind->bi_bypass == TAVOR_BINDMEM_BYPASS)) { - dma_attr.dma_attr_flags = DDI_DMA_FORCE_PHYSICAL; - } -#endif /* Allocate a DMA handle for the binding */ status = ddi_dma_alloc_handle(state->ts_dip, &dma_attr, callback, NULL, &bind->bi_dmahdl); diff --git a/usr/src/uts/common/io/kb8042/at_keyprocess.c b/usr/src/uts/common/io/kb8042/at_keyprocess.c index 43e356a4a2..3a9a9b223f 100644 --- a/usr/src/uts/common/io/kb8042/at_keyprocess.c +++ b/usr/src/uts/common/io/kb8042/at_keyprocess.c @@ -390,11 +390,7 @@ static const unsigned char keytab_base_set2[] = { /* scan state keycap */ /* 00 */ INVALID, /* 01 */ KEY(120), /* F9 */ -#if defined(__sparc) -/* 02 */ KEY(K8042_STOP), /* STOP */ -#else /* 02 */ INVALID, /* F7? Old code says so but manual doesn't */ -#endif /* 03 */ KEY(116), /* F5 */ /* 04 */ KEY(114), /* F3 */ /* 05 */ KEY(112), /* F1 */ diff --git a/usr/src/uts/common/io/kb8042/kb8042.c b/usr/src/uts/common/io/kb8042/kb8042.c index 0e6ce5097a..f1a7894785 100644 --- a/usr/src/uts/common/io/kb8042/kb8042.c +++ b/usr/src/uts/common/io/kb8042/kb8042.c @@ -104,15 +104,6 @@ static kbtrans_key_t keytab_pc2usb[KBTRANS_KEYNUMS_MAX] = { /* 248 */ 0, 0, 0, 0 }; -#ifdef __sparc -#define USECS_PER_WAIT 100 -#define MAX_WAIT_USECS 100000 /* in usecs = 100 ms */ -#define MIN_DELAY_USECS USECS_PER_WAIT - -boolean_t kb8042_warn_unknown_scanset = B_TRUE; -int kb8042_default_scanset = 2; - -#endif #define MAX_KB8042_WAIT_MAX_MS 500 /* 500ms total */ #define MAX_KB8042_RETRIES 5 @@ -260,141 +251,6 @@ _info(struct modinfo *modinfop) return (mod_info(&modlinkage, modinfop)); } -#ifdef __sparc -static boolean_t -kb8042_is_input_avail(struct kb8042 *kb8042, int timeout_usec, boolean_t polled) -{ - int i; - int port = (polled == B_TRUE) ? I8042_POLL_INPUT_AVAIL : - I8042_INT_INPUT_AVAIL; - int reps = timeout_usec / USECS_PER_WAIT; - - for (i = 0; i < reps; i++) { - if (ddi_get8(kb8042->handle, kb8042->addr + port) != 0) - return (B_TRUE); - - if (i < (reps - 1)) - drv_usecwait(USECS_PER_WAIT); - } - return (B_FALSE); -} - -static void -kb8042_clear_input_buffer(struct kb8042 *kb8042, boolean_t polled) -{ - int port = (polled == B_TRUE) ? I8042_POLL_INPUT_DATA : - I8042_INT_INPUT_DATA; - - while (kb8042_is_input_avail(kb8042, MIN_DELAY_USECS, polled)) { - (void) ddi_get8(kb8042->handle, kb8042->addr + port); - } -} - -/* - * kb8042_send_and_expect does all its I/O via polling interfaces - */ -static boolean_t -kb8042_send_and_expect(struct kb8042 *kb8042, uint8_t send, uint8_t expect, - int timeout, int *error, uint8_t *got) -{ - uint8_t datab; - int err; - boolean_t rval; - - ddi_put8(kb8042->handle, - kb8042->addr + I8042_POLL_OUTPUT_DATA, send); - - if (kb8042_is_input_avail(kb8042, timeout, B_TRUE)) { - err = 0; - datab = ddi_get8(kb8042->handle, - kb8042->addr + I8042_POLL_INPUT_DATA); - rval = ((datab == expect) ? B_TRUE : B_FALSE); - } else { - err = EAGAIN; - rval = B_FALSE; - } - - if (error != NULL) - *error = err; - if (got != NULL) - *got = datab; - return (rval); -} - -static const char * -kb8042_error_string(int errcode) -{ - switch (errcode) { - case EAGAIN: - return ("Timed out"); - default: - return ("Unknown error"); - } -} - -/* - * kb8042_read_scanset works properly because it is called before ddi_add_intr - * (if it is called after ddi_add_intr, i8042_intr would call kb8042_intr - * instead of just storing the data that comes in from the keyboard, which - * would prevent the code here from getting it.) - */ -static int -kb8042_read_scanset(struct kb8042 *kb8042) -{ - int scanset = -1; - int err; - uint8_t got; - - kb8042_clear_input_buffer(kb8042, B_TRUE); - - /* - * Send a "change scan code set" command to the keyboard. - * It should respond with an ACK. - */ - if (kb8042_send_and_expect(kb8042, KB_SET_SCAN, KB_ACK, MAX_WAIT_USECS, - &err, &got) != B_TRUE) { - goto fail_read_scanset; - } - - /* - * Send a 0. The keyboard should ACK the 0, then it should send the - * scan code set in use. - */ - if (kb8042_send_and_expect(kb8042, 0, KB_ACK, MAX_WAIT_USECS, &err, - &got) != B_TRUE) { - goto fail_read_scanset; - } - - /* - * The next input byte from the keyboard should be the scan code - * set in use, though some keyboards like to send a few more acks - * just for fun, so blow past those to get the keyboard scan code. - */ - while (kb8042_is_input_avail(kb8042, MAX_WAIT_USECS, B_TRUE) && - (scanset = ddi_get8(kb8042->handle, - kb8042->addr + I8042_POLL_INPUT_DATA)) == KB_ACK) - ; - -#ifdef DEBUG - cmn_err(CE_NOTE, "!Scan code set from keyboard is `%d'.", - scanset); -#endif - - return (scanset); - -fail_read_scanset: -#ifdef DEBUG - if (err == 0) - cmn_err(CE_NOTE, "Could not read current scan set from " - "keyboard: %s. (Expected 0x%x, but got 0x%x).", - kb8042_error_string(err), KB_ACK, got); - else - cmn_err(CE_NOTE, "Could not read current scan set from " - "keyboard: %s.", kb8042_error_string(err)); -#endif - return (-1); -} -#endif static int kb8042_attach(dev_info_t *devi, ddi_attach_cmd_t cmd) @@ -480,33 +336,8 @@ kb8042_attach(dev_info_t *devi, ddi_attach_cmd_t cmd) kb8042_init(kb8042, B_FALSE); -#ifdef __sparc - /* Detect the scan code set currently in use */ - scanset = kb8042_read_scanset(kb8042); - - if (scanset < 0 && kb8042_warn_unknown_scanset) { - - cmn_err(CE_WARN, "Cannot determine keyboard scan code set "); - cmn_err(CE_CONT, "(is the keyboard plugged in?). "); - cmn_err(CE_CONT, "Defaulting to scan code set %d. If the " - "keyboard does not ", kb8042_default_scanset); - cmn_err(CE_CONT, "work properly, add " - "`set kb8042:kb8042_default_scanset=%d' to /etc/system ", - (kb8042_default_scanset == 1) ? 2 : 1); - cmn_err(CE_CONT, "(via network or with a USB keyboard) and " - "restart the system. If you "); - cmn_err(CE_CONT, "do not want to see this message in the " - "future, add "); - cmn_err(CE_CONT, "`set kb8042:kb8042_warn_unknown_scanset=0' " - "to /etc/system.\n"); - - /* Use the default scan code set. */ - scanset = kb8042_default_scanset; - } -#else /* x86 systems use scan code set 1 -- no detection required */ scanset = 1; -#endif if (KeyboardConvertScan_init(kb8042, scanset) != DDI_SUCCESS) { cmn_err(CE_WARN, "Cannot initialize keyboard scan converter: " "Unknown scan code set `%d'.", scanset); diff --git a/usr/src/uts/common/io/kbd.c b/usr/src/uts/common/io/kbd.c index 79c9555a0c..c26c441df4 100644 --- a/usr/src/uts/common/io/kbd.c +++ b/usr/src/uts/common/io/kbd.c @@ -1553,69 +1553,10 @@ kbdinput(register struct kbddata *kbdd, register unsigned key) switch (k->k_state) { -#if defined(__sparc) - normalstate: - k->k_state = NORMAL; - /* FALLTHRU */ -#endif case NORMAL: -#if defined(__sparc) - if (k->k_curkeyboard) { - if (key == k->k_curkeyboard->k_abort1) { - k->k_state = ABORT1; - break; - } - if ((key == k->k_curkeyboard->k_newabort1) || - (key == k->k_curkeyboard->k_newabort1a)) { - k->k_state = NEWABORT1; - kbdd->shiftkey = key; - } - } -#endif kbduse(kbdd, key); break; -#if defined(__sparc) - case ABORT1: - if (k->k_curkeyboard) { - /* - * Only recognize this as an abort sequence if - * the "hardware" console is set to be this device. - */ - if (key == k->k_curkeyboard->k_abort2 && - rconsvp == wsconsvp) { - DELAY(100000); - abort_sequence_enter(NULL); - k->k_state = NORMAL; - kbduse(kbdd, IDLEKEY); /* fake */ - return; - } else { - kbduse(kbdd, k->k_curkeyboard->k_abort1); - goto normalstate; - } - } - break; - case NEWABORT1: - if (k->k_curkeyboard) { - /* - * Only recognize this as an abort sequence if - * the "hardware" console is set to be this device. - */ - if (key == k->k_curkeyboard->k_newabort2 && - rconsvp == wsconsvp) { - DELAY(100000); - abort_sequence_enter(NULL); - k->k_state = NORMAL; - kbdd->shiftkey |= RELEASED; - kbduse(kbdd, kbdd->shiftkey); - kbduse(kbdd, IDLEKEY); /* fake */ - return; - } else { - goto normalstate; - } - } - break; -#endif case COMPOSE1: case COMPOSE2: diff --git a/usr/src/uts/common/io/kbtrans/usb_keytables.c b/usr/src/uts/common/io/kbtrans/usb_keytables.c index c1ef072e7e..553fb7c059 100644 --- a/usr/src/uts/common/io/kbtrans/usb_keytables.c +++ b/usr/src/uts/common/io/kbtrans/usb_keytables.c @@ -422,11 +422,7 @@ static struct keyboard kbtrans_usb_keyindex = { 0x0000, /* Shift bits which stay on with idle keyboard */ 0x0000, /* Bucky bits which stay on with idle keyboard */ 120, -#if defined(__sparc) - 0, /* no alternate abort key F1 on sparc */ -#else 58, /* alternate abort key F1 */ -#endif 4, CAPSMASK|NUMLOCKMASK, /* Shift bits which toggle on down event */ NULL, /* Exception table */ diff --git a/usr/src/uts/common/io/ldterm.c b/usr/src/uts/common/io/ldterm.c index e4af8a070c..70ccb6ae79 100644 --- a/usr/src/uts/common/io/ldterm.c +++ b/usr/src/uts/common/io/ldterm.c @@ -3969,7 +3969,6 @@ outofbufs: } -#if !defined(__sparc) int movtuc(size_t size, unsigned char *from, unsigned char *origto, unsigned char *table) @@ -3983,7 +3982,6 @@ movtuc(size_t size, unsigned char *from, unsigned char *origto, } return (to - origto); } -#endif static void ldterm_flush_output(uchar_t c, queue_t *q, ldtermstd_state_t *tp) diff --git a/usr/src/uts/common/io/mem.c b/usr/src/uts/common/io/mem.c index ef8d5e2802..97f1a19af7 100644 --- a/usr/src/uts/common/io/mem.c +++ b/usr/src/uts/common/io/mem.c @@ -348,15 +348,9 @@ mmpagelock(struct as *as, caddr_t va) return (i); } -#ifdef __sparc - -#define NEED_LOCK_KVADDR(kva) mmpagelock(&kas, kva) - -#else /* __i386, __amd64 */ #define NEED_LOCK_KVADDR(va) 0 -#endif /* __sparc */ /*ARGSUSED3*/ static int @@ -639,134 +633,6 @@ mmioctl_page_retire(int cmd, intptr_t data) return (EINVAL); } -#ifdef __sparc -/* - * Given a syndrome, syndrome type, and address return the - * associated memory name in the provided data buffer. - */ -static int -mmioctl_get_mem_name(intptr_t data) -{ - mem_name_t mem_name; - void *buf; - size_t bufsize; - int len, err; - - if ((bufsize = cpu_get_name_bufsize()) == 0) - return (ENOTSUP); - - if ((err = mm_read_mem_name(data, &mem_name)) < 0) - return (err); - - buf = kmem_alloc(bufsize, KM_SLEEP); - - /* - * Call into cpu specific code to do the lookup. - */ - if ((err = cpu_get_mem_name(mem_name.m_synd, mem_name.m_type, - mem_name.m_addr, buf, bufsize, &len)) != 0) { - kmem_free(buf, bufsize); - return (err); - } - - if (len >= mem_name.m_namelen) { - kmem_free(buf, bufsize); - return (ENOSPC); - } - - if (copyoutstr(buf, (char *)mem_name.m_name, - mem_name.m_namelen, NULL) != 0) { - kmem_free(buf, bufsize); - return (EFAULT); - } - - kmem_free(buf, bufsize); - return (0); -} - -/* - * Given a syndrome and address return information about the associated memory. - */ -static int -mmioctl_get_mem_info(intptr_t data) -{ - mem_info_t mem_info; - int err; - - if (copyin((void *)data, &mem_info, sizeof (mem_info_t))) - return (EFAULT); - - if ((err = cpu_get_mem_info(mem_info.m_synd, mem_info.m_addr, - &mem_info.m_mem_size, &mem_info.m_seg_size, &mem_info.m_bank_size, - &mem_info.m_segments, &mem_info.m_banks, &mem_info.m_mcid)) != 0) - return (err); - - if (copyout(&mem_info, (void *)data, sizeof (mem_info_t)) != 0) - return (EFAULT); - - return (0); -} - -/* - * Given a memory name, return its associated serial id - */ -static int -mmioctl_get_mem_sid(intptr_t data) -{ - mem_name_t mem_name; - void *buf; - void *name; - size_t name_len; - size_t bufsize; - int len, err; - - if ((bufsize = cpu_get_name_bufsize()) == 0) - return (ENOTSUP); - - if ((err = mm_read_mem_name(data, &mem_name)) < 0) - return (err); - - buf = kmem_alloc(bufsize, KM_SLEEP); - - if (mem_name.m_namelen > 1024) - mem_name.m_namelen = 1024; /* cap at 1024 bytes */ - - name = kmem_alloc(mem_name.m_namelen, KM_SLEEP); - - if ((err = copyinstr((char *)mem_name.m_name, (char *)name, - mem_name.m_namelen, &name_len)) != 0) { - kmem_free(buf, bufsize); - kmem_free(name, mem_name.m_namelen); - return (err); - } - - /* - * Call into cpu specific code to do the lookup. - */ - if ((err = cpu_get_mem_sid(name, buf, bufsize, &len)) != 0) { - kmem_free(buf, bufsize); - kmem_free(name, mem_name.m_namelen); - return (err); - } - - if (len > mem_name.m_sidlen) { - kmem_free(buf, bufsize); - kmem_free(name, mem_name.m_namelen); - return (ENAMETOOLONG); - } - - if (copyoutstr(buf, (char *)mem_name.m_sid, - mem_name.m_sidlen, NULL) != 0) { - kmem_free(buf, bufsize); - kmem_free(name, mem_name.m_namelen); - return (EFAULT); - } - - kmem_free(buf, bufsize); - kmem_free(name, mem_name.m_namelen); - return (0); -} -#endif /* __sparc */ /* * Private ioctls for @@ -794,21 +660,10 @@ mmioctl(dev_t dev, int cmd, intptr_t data, int flag, cred_t *cred, int *rvalp) case MEM_PAGE_RETIRE_TEST: return (mmioctl_page_retire(cmd, data)); -#ifdef __sparc - case MEM_NAME: - return (mmioctl_get_mem_name(data)); - - case MEM_INFO: - return (mmioctl_get_mem_info(data)); - - case MEM_SID: - return (mmioctl_get_mem_sid(data)); -#else case MEM_NAME: case MEM_INFO: case MEM_SID: return (ENOTSUP); -#endif /* __sparc */ } return (ENXIO); } diff --git a/usr/src/uts/common/io/mr_sas/mr_sas.c b/usr/src/uts/common/io/mr_sas/mr_sas.c index f7641c6414..049772110f 100644 --- a/usr/src/uts/common/io/mr_sas/mr_sas.c +++ b/usr/src/uts/common/io/mr_sas/mr_sas.c @@ -116,11 +116,7 @@ static volatile int debug_consecutive_timeout_after_ocr_g = 0; /* Local static prototypes. */ static int mrsas_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **); static int mrsas_attach(dev_info_t *, ddi_attach_cmd_t); -#ifdef __sparc -static int mrsas_reset(dev_info_t *, ddi_reset_cmd_t); -#else static int mrsas_quiesce(dev_info_t *); -#endif static int mrsas_detach(dev_info_t *, ddi_detach_cmd_t); static int mrsas_open(dev_t *, int, int, cred_t *); static int mrsas_close(dev_t, int, int, cred_t *); @@ -289,19 +285,11 @@ static struct dev_ops mrsas_ops = { nulldev, /* probe */ mrsas_attach, /* attach */ mrsas_detach, /* detach */ -#ifdef __sparc - mrsas_reset, /* reset */ -#else /* __sparc */ nodev, -#endif /* __sparc */ &mrsas_cb_ops, /* char/block ops */ NULL, /* bus ops */ NULL, /* power */ -#ifdef __sparc - ddi_quiesce_not_needed -#else /* __sparc */ mrsas_quiesce /* quiesce */ -#endif /* __sparc */ }; static struct modldrv modldrv = { @@ -1486,44 +1474,6 @@ mrsas_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp, * * * ************************************************************************** * */ -#ifdef __sparc -/* - * reset - TBD - * @dip: - * @cmd: - * - * TBD - */ -/*ARGSUSED*/ -static int -mrsas_reset(dev_info_t *dip, ddi_reset_cmd_t cmd) -{ - int instance_no; - - struct mrsas_instance *instance; - - instance_no = ddi_get_instance(dip); - instance = (struct mrsas_instance *)ddi_get_soft_state - (mrsas_state, instance_no); - - con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__)); - - if (!instance) { - con_log(CL_ANN, (CE_WARN, "mr_sas:%d could not get adapter " - "in reset", instance_no)); - return (DDI_FAILURE); - } - - instance->func_ptr->disable_intr(instance); - - con_log(CL_ANN1, (CE_CONT, "flushing cache for instance %d", - instance_no)); - - flush_cache(instance); - - return (DDI_SUCCESS); -} -#else /* __sparc */ /*ARGSUSED*/ static int mrsas_quiesce(dev_info_t *dip) @@ -1578,7 +1528,6 @@ mrsas_quiesce(dev_info_t *dip) } return (DDI_SUCCESS); } -#endif /* __sparc */ /* * ************************************************************************** * diff --git a/usr/src/uts/common/io/openprom.c b/usr/src/uts/common/io/openprom.c index 3406567e02..ee36de4aec 100644 --- a/usr/src/uts/common/io/openprom.c +++ b/usr/src/uts/common/io/openprom.c @@ -319,29 +319,6 @@ opromclose(dev_t dev, int flag, int otype, cred_t *cred_p) return (0); } -#ifdef __sparc -static int -get_bootpath_prop(char *bootpath) -{ - if (root_is_ramdisk) { - if (BOP_GETPROP(bootops, "bootarchive", bootpath) == -1) - return (-1); - (void) strlcat(bootpath, ":a", BO_MAXOBJNAME); - } else { - if ((BOP_GETPROP(bootops, "bootpath", bootpath) == -1) || - strlen(bootpath) == 0) { - if (BOP_GETPROP(bootops, - "boot-path", bootpath) == -1) - return (-1); - } - if (memcmp(bootpath, BP_ISCSI_DISK, - strlen(BP_ISCSI_DISK)) == 0) { - get_iscsi_bootpath_vhci(bootpath); - } - } - return (0); -} -#endif struct opromioctl_args { struct oprom_state *st; diff --git a/usr/src/uts/common/io/pciex/pcie.c b/usr/src/uts/common/io/pciex/pcie.c index b451671041..b5c537beda 100644 --- a/usr/src/uts/common/io/pciex/pcie.c +++ b/usr/src/uts/common/io/pciex/pcie.c @@ -243,11 +243,6 @@ pcie_init(dev_info_t *dip, caddr_t arg) PCIE_DBG("%s%d: Failed setting hotplug framework\n", ddi_driver_name(dip), ddi_get_instance(dip)); -#if defined(__sparc) - ddi_remove_minor_node(dip, "devctl"); - - return (ret); -#endif /* defined(__sparc) */ } return (DDI_SUCCESS); diff --git a/usr/src/uts/common/io/power.c b/usr/src/uts/common/io/power.c index cd6c1d6d07..f227264f0d 100644 --- a/usr/src/uts/common/io/power.c +++ b/usr/src/uts/common/io/power.c @@ -60,9 +60,6 @@ #include #include -#if defined(__sparc) -#include -#endif #ifdef ACPI_POWER_BUTTON diff --git a/usr/src/uts/common/io/scsi/adapters/mpt_sas/mptsas.c b/usr/src/uts/common/io/scsi/adapters/mpt_sas/mptsas.c index 0e2574b3ba..97c047b9d2 100644 --- a/usr/src/uts/common/io/scsi/adapters/mpt_sas/mptsas.c +++ b/usr/src/uts/common/io/scsi/adapters/mpt_sas/mptsas.c @@ -124,11 +124,7 @@ static int mptsas_power(dev_info_t *dip, int component, int level); */ static int mptsas_ioctl(dev_t dev, int cmd, intptr_t data, int mode, cred_t *credp, int *rval); -#ifdef __sparc -static int mptsas_reset(dev_info_t *devi, ddi_reset_cmd_t cmd); -#else /* __sparc */ static int mptsas_quiesce(dev_info_t *devi); -#endif /* __sparc */ /* * Resource initilaization for hardware @@ -540,19 +536,11 @@ static struct dev_ops mptsas_ops = { nulldev, /* probe */ mptsas_attach, /* attach */ mptsas_detach, /* detach */ -#ifdef __sparc - mptsas_reset, -#else nodev, /* reset */ -#endif /* __sparc */ &mptsas_cb_ops, /* driver operations */ NULL, /* bus operations */ mptsas_power, /* power management */ -#ifdef __sparc - ddi_quiesce_not_needed -#else mptsas_quiesce /* quiesce */ -#endif /* __sparc */ }; @@ -1754,36 +1742,6 @@ mptsas_suspend(dev_info_t *devi) return (DDI_SUCCESS); } -#ifdef __sparc -/*ARGSUSED*/ -static int -mptsas_reset(dev_info_t *devi, ddi_reset_cmd_t cmd) -{ - mptsas_t *mpt; - scsi_hba_tran_t *tran; - - /* - * If this call is for iport, just return. - */ - if (scsi_hba_iport_unit_address(devi)) - return (DDI_SUCCESS); - - if ((tran = ddi_get_driver_private(devi)) == NULL) - return (DDI_SUCCESS); - - if ((mpt = TRAN2MPT(tran)) == NULL) - return (DDI_SUCCESS); - - /* - * Send RAID action system shutdown to sync IR. Disable HBA - * interrupts in hardware first. - */ - MPTSAS_DISABLE_INTR(mpt); - mptsas_raid_action_system_shutdown(mpt); - - return (DDI_SUCCESS); -} -#else /* __sparc */ /* * quiesce(9E) entry point. * @@ -1819,7 +1777,6 @@ mptsas_quiesce(dev_info_t *devi) return (DDI_SUCCESS); } -#endif /* __sparc */ /* * detach(9E). Remove all device allocations and system resources; diff --git a/usr/src/uts/common/io/scsi/impl/scsi_resource.c b/usr/src/uts/common/io/scsi/impl/scsi_resource.c index cd58cd1981..db331bea67 100644 --- a/usr/src/uts/common/io/scsi/impl/scsi_resource.c +++ b/usr/src/uts/common/io/scsi/impl/scsi_resource.c @@ -430,18 +430,6 @@ scsi_init_cache_pkt(struct scsi_address *ap, struct scsi_pkt *in_pktp, if (flags & PKT_DMA_PARTIAL) dma_flags |= DDI_DMA_PARTIAL; -#if defined(__sparc) - /* - * workaround for byte hole issue on psycho and - * schizo pre 2.1 - */ - if ((bp->b_flags & B_READ) && ((bp->b_flags & - (B_PAGEIO|B_REMAPPED)) != B_PAGEIO) && - (((uintptr_t)bp->b_un.b_addr & 0x7) || - ((uintptr_t)bp->b_bcount & 0x7))) { - dma_flags |= DDI_DMA_CONSISTENT; - } -#endif if (!scsi_dma_buf_bind_attr(pktw, bp, dma_flags, callback, callback_arg)) { return (NULL); diff --git a/usr/src/uts/common/io/scsi/targets/st.c b/usr/src/uts/common/io/scsi/targets/st.c index 0325f89020..58c535b550 100644 --- a/usr/src/uts/common/io/scsi/targets/st.c +++ b/usr/src/uts/common/io/scsi/targets/st.c @@ -787,10 +787,8 @@ st_probe(dev_info_t *devi) struct scsi_device *devp; int rval; -#if !defined(__sparc) char *tape_prop; int tape_prop_len; -#endif ST_ENTR(devi, st_probe); @@ -799,7 +797,6 @@ st_probe(dev_info_t *devi) return (DDI_PROBE_DONTCARE); } -#if !defined(__sparc) /* * Since some x86 HBAs have devnodes that look like SCSI as * far as we can tell but aren't really SCSI (DADK, like mlx) @@ -815,7 +812,6 @@ st_probe(dev_info_t *devi) return (DDI_PROBE_FAILURE); } kmem_free(tape_prop, tape_prop_len); -#endif devp = ddi_get_driver_private(devi); instance = ddi_get_instance(devi); diff --git a/usr/src/uts/common/io/stream.c b/usr/src/uts/common/io/stream.c index b236e36046..a76f1315d5 100644 --- a/usr/src/uts/common/io/stream.c +++ b/usr/src/uts/common/io/stream.c @@ -4034,11 +4034,7 @@ isuioq(queue_t *q) return (STREAM(q)->sd_struiowrq == q); } -#if defined(__sparc) -int disable_putlocks = 0; -#else int disable_putlocks = 1; -#endif /* * called by create_putlock. diff --git a/usr/src/uts/common/io/usb/hcd/ehci/ehci.c b/usr/src/uts/common/io/usb/hcd/ehci/ehci.c index 6a841f6e30..2d934eb255 100644 --- a/usr/src/uts/common/io/usb/hcd/ehci/ehci.c +++ b/usr/src/uts/common/io/usb/hcd/ehci/ehci.c @@ -423,17 +423,6 @@ ehci_detach(dev_info_t *dip, static int ehci_reset(dev_info_t *dip, ddi_reset_cmd_t cmd) { -#if defined(__sparc) - /* - * Don't reset the host controller on SPARC, for OBP needs Solaris - * to continue to provide keyboard support after shutdown of SPARC, - * or the keyboard connected to a USB 2.0 port will not work after - * that. The incomplete reset problem on Toshiba Tecra laptop is - * specific to Tecra laptop or BIOS, not present on SPARC. The SPARC - * OBP guarantees good reset behavior during startup. - */ - return (DDI_SUCCESS); -#else ehci_state_t *ehcip = ehci_obtain_state(dip); mutex_enter(&ehcip->ehci_int_mutex); @@ -469,7 +458,6 @@ ehci_reset(dev_info_t *dip, ddi_reset_cmd_t cmd) mutex_exit(&ehcip->ehci_int_mutex); return (DDI_SUCCESS); -#endif } /* diff --git a/usr/src/uts/common/io/usb/hcd/ehci/ehci_polled.c b/usr/src/uts/common/io/usb/hcd/ehci/ehci_polled.c index 5c41cd5b4e..9d2c4767a0 100644 --- a/usr/src/uts/common/io/usb/hcd/ehci/ehci_polled.c +++ b/usr/src/uts/common/io/usb/hcd/ehci/ehci_polled.c @@ -42,9 +42,7 @@ #include #include -#ifndef __sparc extern void invalidate_cache(); -#endif /* * Internal Function Prototypes @@ -599,11 +597,7 @@ ehci_hcdi_polled_write(usb_console_info_impl_t *info, uchar_t *buf, while (!((Get_OpReg(ehci_status)) & (EHCI_INTR_USB |EHCI_INTR_FRAME_LIST_ROLLOVER | EHCI_INTR_USB_ERROR))) { -#ifndef __sparc invalidate_cache(); -#else - ; -#endif } intr = (Get_OpReg(ehci_status)) & diff --git a/usr/src/uts/common/io/usb/hcd/openhci/ohci.c b/usr/src/uts/common/io/usb/hcd/openhci/ohci.c index 8f8d37b064..09b77af4f0 100644 --- a/usr/src/uts/common/io/usb/hcd/openhci/ohci.c +++ b/usr/src/uts/common/io/usb/hcd/openhci/ohci.c @@ -11288,13 +11288,6 @@ ohci_print_td( * * define as a wrapper for sparc, or warlock will complain. */ -#ifdef __sparc -int -ohci_quiesce(dev_info_t *dip) -{ - return (ddi_quiesce_not_supported(dip)); -} -#else int ohci_quiesce(dev_info_t *dip) { @@ -11353,4 +11346,3 @@ ohci_quiesce(dev_info_t *dip) _NOTE(COMPETING_THREADS_NOW); return (DDI_SUCCESS); } -#endif /* __sparc */ diff --git a/usr/src/uts/common/io/usb/hcd/uhci/uhci.c b/usr/src/uts/common/io/usb/hcd/uhci/uhci.c index d3961b6266..823c7dd0aa 100644 --- a/usr/src/uts/common/io/usb/hcd/uhci/uhci.c +++ b/usr/src/uts/common/io/usb/hcd/uhci/uhci.c @@ -415,13 +415,11 @@ skip_intr: goto fail; } -#ifndef __sparc /* * On NCR system, the driver seen failure of some commands * while booting. This delay mysteriously solved the problem. */ ddi_sleep(uhci_attach_wait); -#endif /* * Create another timeout handler to check whether any diff --git a/usr/src/uts/common/io/usb/hcd/uhci/uhcipolled.c b/usr/src/uts/common/io/usb/hcd/uhci/uhcipolled.c index 0c7d2eb928..5c93b56050 100644 --- a/usr/src/uts/common/io/usb/hcd/uhci/uhcipolled.c +++ b/usr/src/uts/common/io/usb/hcd/uhci/uhcipolled.c @@ -30,9 +30,7 @@ #include #include -#ifndef __sparc extern void invalidate_cache(); -#endif /* * Internal Function Prototypes */ @@ -223,9 +221,7 @@ uhci_hcdi_polled_read(usb_console_info_impl_t *info, uint_t *num_characters) } _NOTE(NO_COMPETING_THREADS_NOW); -#ifndef __sparc invalidate_cache(); -#endif td = uhci_polledp->uhci_polled_td; @@ -441,11 +437,7 @@ uhci_hcdi_polled_write(usb_console_info_impl_t *info, uchar_t *buf, /* wait for xfer to finish */ while (GetTD_status(uhcip, td) & UHCI_TD_ACTIVE) -#ifndef __sparc invalidate_cache(); -#else - ; -#endif *num_characters_written = GetTD_alen(uhcip, td) + 1; /* Now, remove the endpoint from the lattice */ diff --git a/usr/src/uts/common/io/xge/drv/xge.c b/usr/src/uts/common/io/xge/drv/xge.c index 6ee52f4262..a7c81fa99c 100644 --- a/usr/src/uts/common/io/xge/drv/xge.c +++ b/usr/src/uts/common/io/xge/drv/xge.c @@ -282,9 +282,6 @@ xge_ring_config(dev_info_t *dev_info, xge_hal_device_config_t *device_config, if (!device_config->ring.queue[index].configured) return; -#if defined(__sparc) - device_config->ring.queue[index].no_snoop_bits = 1; -#endif (void) xge_os_snprintf(msg, MSG_SIZE, "ring%d_max", index); device_config->ring.queue[index].max = @@ -429,9 +426,6 @@ xge_fifo_config(dev_info_t *dev_info, xge_hal_device_config_t *device_config, if (!device_config->fifo.queue[index].configured) return; -#if defined(__sparc) - device_config->fifo.queue[index].no_snoop_bits = 1; -#endif (void) xge_os_snprintf(msg, MSG_SIZE, "fifo%d_max", index); device_config->fifo.queue[index].max = ddi_prop_get_int(DDI_DEV_T_ANY, diff --git a/usr/src/uts/common/io/xge/drv/xgell.c b/usr/src/uts/common/io/xge/drv/xgell.c index 720e95b065..6793c8fa36 100644 --- a/usr/src/uts/common/io/xge/drv/xgell.c +++ b/usr/src/uts/common/io/xge/drv/xgell.c @@ -54,11 +54,7 @@ static struct ddi_dma_attr tx_dma_attr = { 0x0ULL, /* dma_attr_addr_lo */ 0xFFFFFFFFFFFFFFFFULL, /* dma_attr_addr_hi */ 0xFFFFFFFFFFFFFFFFULL, /* dma_attr_count_max */ -#if defined(__sparc) - 0x2000, /* dma_attr_align */ -#else 0x1000, /* dma_attr_align */ -#endif 0xFC00FC, /* dma_attr_burstsizes */ 0x1, /* dma_attr_minxfer */ 0xFFFFFFFFFFFFFFFFULL, /* dma_attr_maxxfer */ @@ -77,11 +73,7 @@ static struct ddi_dma_attr hal_dma_attr = { 0x0ULL, /* dma_attr_addr_lo */ 0xFFFFFFFFFFFFFFFFULL, /* dma_attr_addr_hi */ 0xFFFFFFFFFFFFFFFFULL, /* dma_attr_count_max */ -#if defined(__sparc) - 0x2000, /* dma_attr_align */ -#else 0x1000, /* dma_attr_align */ -#endif 0xFC00FC, /* dma_attr_burstsizes */ 0x1, /* dma_attr_minxfer */ 0xFFFFFFFFFFFFFFFFULL, /* dma_attr_maxxfer */ diff --git a/usr/src/uts/common/tnf/tnf_trace.c b/usr/src/uts/common/tnf/tnf_trace.c index 352fc8156a..e6c4d8a084 100644 --- a/usr/src/uts/common/tnf/tnf_trace.c +++ b/usr/src/uts/common/tnf/tnf_trace.c @@ -222,48 +222,6 @@ tnf_opaque_array_1(tnf_ops_t *ops, tnf_opaque_t *opaques, return (tnf_ref32(ops, (tnf_record_p) bufhdr, reference)); } -#ifdef __sparc - -tnf_reference_t -tnf_opaque32_array_1(tnf_ops_t *ops, tnf_uint32_t *opaques, - tnf_record_p reference, tnf_tag_data_t *tag_data) -{ - tnf_record_p tag_index; - size_t record_size; - tnf_uint32_t *tmp; - tnf_uint32_t *ref_p; - tnf_array_header_t *bufhdr; - - tag_index = tag_data->tag_index ? tag_data->tag_index : - tag_data->tag_desc(ops, tag_data); - - if (!opaques) - return (TNF_NULL); - - record_size = sizeof (*bufhdr); - tmp = opaques; - while (*tmp++) - record_size += sizeof (*ref_p); - - ALLOC2(ops, record_size, bufhdr, ops->mode); - - ASSIGN(bufhdr, tag, tag_index); - /* LINTED assignment of 64-bit integer to 32-bit integer */ - ASSIGN(bufhdr, self_size, record_size); - - tmp = opaques; - /* LINTED pointer cast may result in improper alignment */ - ref_p = (tnf_uint32_t *)((char *)bufhdr + sizeof (*bufhdr)); - while (*tmp) { - *ref_p = tnf_uint32(ops, *tmp, (tnf_reference_t *)ref_p); - tmp++; - ref_p++; - } - - return (tnf_ref32(ops, (tnf_record_p) bufhdr, reference)); -} - -#endif /* __sparc */ /* * Tag initializer -- 2.11.4.GIT