17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5fea9cb91Slq * Common Development and Distribution License (the "License"). 6fea9cb91Slq * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 21fea9cb91Slq 227c478bd9Sstevel@tonic-gate /* 236cefaae1SJack Meng * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate /* 287c478bd9Sstevel@tonic-gate * The intent of this file is to contain any data that must remain 297c478bd9Sstevel@tonic-gate * resident in the kernel. 307c478bd9Sstevel@tonic-gate * 317c478bd9Sstevel@tonic-gate * space_store(), space_fetch(), and space_free() have been added to 327c478bd9Sstevel@tonic-gate * easily store and retrieve kernel resident data. 337c478bd9Sstevel@tonic-gate * These functions are recommended rather than adding new variables to 347c478bd9Sstevel@tonic-gate * this file. 357c478bd9Sstevel@tonic-gate * 367c478bd9Sstevel@tonic-gate * Note that it's possible for name collisions to occur. In order to 377c478bd9Sstevel@tonic-gate * prevent collisions, it's recommended that the convention in 387c478bd9Sstevel@tonic-gate * PSARC/1997/389 be used. If a collision occurs, then space_store will 397c478bd9Sstevel@tonic-gate * fail. 407c478bd9Sstevel@tonic-gate */ 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate #include <sys/types.h> 437c478bd9Sstevel@tonic-gate #include <sys/param.h> 447c478bd9Sstevel@tonic-gate #include <sys/var.h> 457c478bd9Sstevel@tonic-gate #include <sys/proc.h> 467c478bd9Sstevel@tonic-gate #include <sys/signal.h> 477c478bd9Sstevel@tonic-gate #include <sys/utsname.h> 487c478bd9Sstevel@tonic-gate #include <sys/buf.h> 497c478bd9Sstevel@tonic-gate #include <sys/cred.h> 507c478bd9Sstevel@tonic-gate #include <sys/vfs.h> 517c478bd9Sstevel@tonic-gate #include <sys/vnode.h> 527c478bd9Sstevel@tonic-gate #include <sys/sysinfo.h> 537c478bd9Sstevel@tonic-gate #include <sys/t_lock.h> 547c478bd9Sstevel@tonic-gate #include <sys/vmem.h> 557c478bd9Sstevel@tonic-gate #include <sys/modhash.h> 567c478bd9Sstevel@tonic-gate #include <sys/cmn_err.h> 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate #include <sys/strredir.h> 597c478bd9Sstevel@tonic-gate #include <sys/kbio.h> 60fea9cb91Slq #include <sys/consdev.h> 61fea9cb91Slq #include <sys/wscons.h> 626cefaae1SJack Meng #include <sys/bootprops.h> 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate struct buf bfreelist; /* Head of the free list of buffers */ 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate sysinfo_t sysinfo; 677c478bd9Sstevel@tonic-gate vminfo_t vminfo; /* VM stats protected by sysinfolock mutex */ 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate #ifdef lint 707c478bd9Sstevel@tonic-gate int __lintzero; /* Alway zero for shutting up lint */ 717c478bd9Sstevel@tonic-gate #endif 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate /* 747c478bd9Sstevel@tonic-gate * The following describe the physical memory configuration. 757c478bd9Sstevel@tonic-gate * 767c478bd9Sstevel@tonic-gate * physmem - The amount of physical memory configured 777c478bd9Sstevel@tonic-gate * in pages. ptob(physmem) is the amount 787c478bd9Sstevel@tonic-gate * of physical memory in bytes. Defined in 797c478bd9Sstevel@tonic-gate * .../os/startup.c. 807c478bd9Sstevel@tonic-gate * 817c478bd9Sstevel@tonic-gate * physmax - The highest numbered physical page in memory. 827c478bd9Sstevel@tonic-gate * 837c478bd9Sstevel@tonic-gate * maxmem - Maximum available memory, in pages. Defined 847c478bd9Sstevel@tonic-gate * in main.c. 857c478bd9Sstevel@tonic-gate * 867c478bd9Sstevel@tonic-gate * physinstalled 877c478bd9Sstevel@tonic-gate * - Pages of physical memory installed; 887c478bd9Sstevel@tonic-gate * includes use by PROM/boot not counted in 897c478bd9Sstevel@tonic-gate * physmem. 907c478bd9Sstevel@tonic-gate */ 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate pfn_t physmax; 937c478bd9Sstevel@tonic-gate pgcnt_t physinstalled; 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate struct var v; 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate #include <sys/systm.h> 987c478bd9Sstevel@tonic-gate #include <sys/conf.h> 997c478bd9Sstevel@tonic-gate #include <sys/kmem.h> 1007c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h> 1017c478bd9Sstevel@tonic-gate #include <sys/bootconf.h> 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate /* 1047c478bd9Sstevel@tonic-gate * Data from swapgeneric.c that must be resident. 1057c478bd9Sstevel@tonic-gate */ 1067c478bd9Sstevel@tonic-gate struct vnode *rootvp; /* vnode of the root device */ 1077c478bd9Sstevel@tonic-gate dev_t rootdev; /* dev_t of the root device */ 108986fd29aSsetje boolean_t root_is_svm; /* root is a mirrored device flag */ 109986fd29aSsetje boolean_t root_is_ramdisk; /* root is ramdisk */ 110986fd29aSsetje uint32_t ramdisk_size; /* (KB) currently set only for sparc netboots */ 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate /* 113986fd29aSsetje * dhcp 1147c478bd9Sstevel@tonic-gate */ 1157c478bd9Sstevel@tonic-gate #include <sys/socket.h> 1167c478bd9Sstevel@tonic-gate #include <sys/errno.h> 1177c478bd9Sstevel@tonic-gate #include <sys/sockio.h> 1187c478bd9Sstevel@tonic-gate #include <sys/stream.h> 1197c478bd9Sstevel@tonic-gate #include <sys/stropts.h> 1207c478bd9Sstevel@tonic-gate #include <sys/dlpi.h> 1217c478bd9Sstevel@tonic-gate #include <net/if.h> 122986fd29aSsetje 123986fd29aSsetje int netboot; 124986fd29aSsetje int obpdebug; 125986fd29aSsetje char *dhcack; /* dhcp response packet */ 126986fd29aSsetje int dhcacklen; 127986fd29aSsetje char *netdev_path; /* Used to cache the netdev_path handed up by boot */ 128986fd29aSsetje char dhcifname[IFNAMSIZ]; 129986fd29aSsetje 130986fd29aSsetje /* 131986fd29aSsetje * Data from arp.c that must be resident. 132986fd29aSsetje */ 1337c478bd9Sstevel@tonic-gate #include <net/if_arp.h> 1347c478bd9Sstevel@tonic-gate #include <netinet/in.h> 1357c478bd9Sstevel@tonic-gate #include <netinet/in_var.h> 1367c478bd9Sstevel@tonic-gate #include <netinet/if_ether.h> 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate ether_addr_t etherbroadcastaddr = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 1397c478bd9Sstevel@tonic-gate 140986fd29aSsetje 1417c478bd9Sstevel@tonic-gate /* 1427c478bd9Sstevel@tonic-gate * Data from timod that must be resident 1437c478bd9Sstevel@tonic-gate */ 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gate /* 1467c478bd9Sstevel@tonic-gate * state transition table for TI interface 1477c478bd9Sstevel@tonic-gate */ 1487c478bd9Sstevel@tonic-gate #include <sys/tihdr.h> 1497c478bd9Sstevel@tonic-gate 1507c478bd9Sstevel@tonic-gate #define nr 127 /* not reachable */ 1517c478bd9Sstevel@tonic-gate 1527c478bd9Sstevel@tonic-gate char ti_statetbl[TE_NOEVENTS][TS_NOSTATES] = { 1537c478bd9Sstevel@tonic-gate /* STATES */ 1547c478bd9Sstevel@tonic-gate /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ 1557c478bd9Sstevel@tonic-gate 1567c478bd9Sstevel@tonic-gate { 1, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1577c478bd9Sstevel@tonic-gate {nr, nr, nr, 2, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1587c478bd9Sstevel@tonic-gate {nr, nr, nr, 4, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1597c478bd9Sstevel@tonic-gate {nr, 3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1607c478bd9Sstevel@tonic-gate {nr, nr, nr, nr, 3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1617c478bd9Sstevel@tonic-gate {nr, 0, 3, nr, 3, 3, nr, nr, 7, nr, nr, nr, 6, 7, 9, 10, 11}, 1627c478bd9Sstevel@tonic-gate {nr, nr, 0, nr, nr, 6, nr, nr, nr, nr, nr, nr, 3, nr, 3, 3, 3}, 1637c478bd9Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, 9, nr, nr, nr, nr, 3, nr, nr, nr}, 1647c478bd9Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, 3, nr, nr, nr, nr, 3, nr, nr, nr}, 1657c478bd9Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, 7, nr, nr, nr, nr, 7, nr, nr, nr}, 1667c478bd9Sstevel@tonic-gate {nr, nr, nr, 5, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1677c478bd9Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, 8, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1687c478bd9Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, 12, 13, nr, 14, 15, 16, nr, nr, nr, nr, nr}, 1697c478bd9Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, nr, 9, nr, 11, nr, nr, nr, nr, nr}, 1707c478bd9Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, nr, 9, nr, 11, nr, nr, nr, nr, nr}, 1717c478bd9Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, nr, 10, nr, 3, nr, nr, nr, nr, nr}, 1727c478bd9Sstevel@tonic-gate {nr, nr, nr, 7, nr, nr, nr, 7, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1737c478bd9Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, 9, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1747c478bd9Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, nr, 9, 10, nr, nr, nr, nr, nr, nr}, 1757c478bd9Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, nr, 9, 10, nr, nr, nr, nr, nr, nr}, 1767c478bd9Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, nr, 11, 3, nr, nr, nr, nr, nr, nr}, 1777c478bd9Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, 3, nr, nr, 3, 3, 3, nr, nr, nr, nr, nr}, 1787c478bd9Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, 3, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1797c478bd9Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, 7, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1807c478bd9Sstevel@tonic-gate {nr, nr, nr, 9, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1817c478bd9Sstevel@tonic-gate {nr, nr, nr, 3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1827c478bd9Sstevel@tonic-gate {nr, nr, nr, 3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1837c478bd9Sstevel@tonic-gate {nr, nr, nr, 3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 1847c478bd9Sstevel@tonic-gate }; 1857c478bd9Sstevel@tonic-gate 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate #include <sys/tty.h> 1887c478bd9Sstevel@tonic-gate #include <sys/ptyvar.h> 1897c478bd9Sstevel@tonic-gate 1907c478bd9Sstevel@tonic-gate static void store_fetch_initspace(); 1917c478bd9Sstevel@tonic-gate 1927c478bd9Sstevel@tonic-gate /* 1937c478bd9Sstevel@tonic-gate * Allocate tunable structures at runtime. 1947c478bd9Sstevel@tonic-gate */ 1957c478bd9Sstevel@tonic-gate void 1967c478bd9Sstevel@tonic-gate space_init(void) 1977c478bd9Sstevel@tonic-gate { 1987c478bd9Sstevel@tonic-gate pty_initspace(); 1997c478bd9Sstevel@tonic-gate store_fetch_initspace(); 2007c478bd9Sstevel@tonic-gate } 2017c478bd9Sstevel@tonic-gate 2027c478bd9Sstevel@tonic-gate int ts_dispatch_extended = -1; /* set in ts_getdptbl or set_platform_default */ 2037c478bd9Sstevel@tonic-gate 2047c478bd9Sstevel@tonic-gate /* 2057c478bd9Sstevel@tonic-gate * Previously defined in consmsconf.c ... 2067c478bd9Sstevel@tonic-gate */ 2077c478bd9Sstevel@tonic-gate dev_t kbddev = NODEV; 2087c478bd9Sstevel@tonic-gate dev_t mousedev = NODEV; 2097c478bd9Sstevel@tonic-gate dev_t stdindev = NODEV; 2107c478bd9Sstevel@tonic-gate struct vnode *wsconsvp; 2117c478bd9Sstevel@tonic-gate 2127c478bd9Sstevel@tonic-gate dev_t fbdev = NODEV; 2137c478bd9Sstevel@tonic-gate struct vnode *fbvp; 2147c478bd9Sstevel@tonic-gate dev_info_t *fbdip; 2157c478bd9Sstevel@tonic-gate 2167c478bd9Sstevel@tonic-gate /* 2177c478bd9Sstevel@tonic-gate * moved from cons.c because they must be resident in the kernel. 2187c478bd9Sstevel@tonic-gate */ 2197c478bd9Sstevel@tonic-gate vnode_t *rconsvp; 2207c478bd9Sstevel@tonic-gate dev_t rconsdev; 2217c478bd9Sstevel@tonic-gate dev_t uconsdev = NODEV; 2227c478bd9Sstevel@tonic-gate 223fea9cb91Slq /* 224fea9cb91Slq * Flag whether console fb output is using PROM/PROM emulation 225fea9cb91Slq * terminal emulator, or is using the kernel terminal emulator. 226fea9cb91Slq */ 227fea9cb91Slq int consmode = CONS_FW; 228fea9cb91Slq 229fea9cb91Slq /* 230fea9cb91Slq * The following allows systems to disable use of the kernel 231fea9cb91Slq * terminal emulator (retreat to PROM terminal emulator if there 232fea9cb91Slq * is PROM). 233fea9cb91Slq */ 234fea9cb91Slq int cons_tem_disable; 235fea9cb91Slq 2367c478bd9Sstevel@tonic-gate /* 2377c478bd9Sstevel@tonic-gate * consconfig() in autoconf.c sets this; it's the vnode of the distinguished 2387c478bd9Sstevel@tonic-gate * keyboard/frame buffer combination, aka the workstation console. 2397c478bd9Sstevel@tonic-gate */ 2407c478bd9Sstevel@tonic-gate vnode_t *rwsconsvp; 2417c478bd9Sstevel@tonic-gate dev_t rwsconsdev; 2427c478bd9Sstevel@tonic-gate 2437c478bd9Sstevel@tonic-gate /* 2447c478bd9Sstevel@tonic-gate * Platform console abort policy. 2457c478bd9Sstevel@tonic-gate * Platforms may override the default software policy, if such hardware 2467c478bd9Sstevel@tonic-gate * (e.g. keyswitches with a secure position) exists. 2477c478bd9Sstevel@tonic-gate */ 2487c478bd9Sstevel@tonic-gate int abort_enable = KIOCABORTENABLE; 2497c478bd9Sstevel@tonic-gate 2507c478bd9Sstevel@tonic-gate /* from cpc.c */ 2517c478bd9Sstevel@tonic-gate uint_t kcpc_key; /* TSD key for CPU performance counter context */ 2527c478bd9Sstevel@tonic-gate 2537c478bd9Sstevel@tonic-gate /* 2547c478bd9Sstevel@tonic-gate * storing and retrieving data by string key 2557c478bd9Sstevel@tonic-gate * 2567c478bd9Sstevel@tonic-gate * this mechanism allows a consumer to store and retrieve by name a pointer 2577c478bd9Sstevel@tonic-gate * to some space maintained by the consumer. 2587c478bd9Sstevel@tonic-gate * For example, a driver or module may want to have persistent data 2597c478bd9Sstevel@tonic-gate * over unloading/loading cycles. The pointer is typically to some 2607c478bd9Sstevel@tonic-gate * kmem_alloced space and it should not be pointing to data that will 2617c478bd9Sstevel@tonic-gate * be destroyed when the module is unloaded. 2627c478bd9Sstevel@tonic-gate */ 2637c478bd9Sstevel@tonic-gate static mod_hash_t *space_hash; 2647c478bd9Sstevel@tonic-gate static char *space_hash_name = "space_hash"; 2657c478bd9Sstevel@tonic-gate static size_t space_hash_nchains = 8; 2667c478bd9Sstevel@tonic-gate 2677c478bd9Sstevel@tonic-gate static void 2687c478bd9Sstevel@tonic-gate store_fetch_initspace() 2697c478bd9Sstevel@tonic-gate { 2707c478bd9Sstevel@tonic-gate space_hash = mod_hash_create_strhash(space_hash_name, 271986fd29aSsetje space_hash_nchains, mod_hash_null_valdtor); 2727c478bd9Sstevel@tonic-gate ASSERT(space_hash); 2737c478bd9Sstevel@tonic-gate } 2747c478bd9Sstevel@tonic-gate 2757c478bd9Sstevel@tonic-gate int 2767c478bd9Sstevel@tonic-gate space_store(char *key, uintptr_t ptr) 2777c478bd9Sstevel@tonic-gate { 2787c478bd9Sstevel@tonic-gate char *s; 2797c478bd9Sstevel@tonic-gate int rval; 2807c478bd9Sstevel@tonic-gate size_t l; 2817c478bd9Sstevel@tonic-gate 2827c478bd9Sstevel@tonic-gate /* some sanity checks first */ 2837c478bd9Sstevel@tonic-gate if (key == NULL) { 2847c478bd9Sstevel@tonic-gate return (-1); 2857c478bd9Sstevel@tonic-gate } 2867c478bd9Sstevel@tonic-gate l = (size_t)strlen(key); 2877c478bd9Sstevel@tonic-gate if (l == 0) { 2887c478bd9Sstevel@tonic-gate return (-1); 2897c478bd9Sstevel@tonic-gate } 2907c478bd9Sstevel@tonic-gate 2917c478bd9Sstevel@tonic-gate /* increment for null terminator */ 2927c478bd9Sstevel@tonic-gate l++; 2937c478bd9Sstevel@tonic-gate 2947c478bd9Sstevel@tonic-gate /* alloc space for the string, mod_hash_insert will deallocate */ 2957c478bd9Sstevel@tonic-gate s = kmem_alloc(l, KM_SLEEP); 2967c478bd9Sstevel@tonic-gate bcopy(key, s, l); 2977c478bd9Sstevel@tonic-gate 2987c478bd9Sstevel@tonic-gate rval = mod_hash_insert(space_hash, 299986fd29aSsetje (mod_hash_key_t)s, (mod_hash_val_t)ptr); 3007c478bd9Sstevel@tonic-gate 3017c478bd9Sstevel@tonic-gate switch (rval) { 3027c478bd9Sstevel@tonic-gate case 0: 3037c478bd9Sstevel@tonic-gate break; 3047c478bd9Sstevel@tonic-gate #ifdef DEBUG 3057c478bd9Sstevel@tonic-gate case MH_ERR_DUPLICATE: 3067c478bd9Sstevel@tonic-gate cmn_err(CE_WARN, "space_store: duplicate key %s", key); 3077c478bd9Sstevel@tonic-gate rval = -1; 3087c478bd9Sstevel@tonic-gate break; 3097c478bd9Sstevel@tonic-gate case MH_ERR_NOMEM: 3107c478bd9Sstevel@tonic-gate cmn_err(CE_WARN, "space_store: no mem for key %s", key); 3117c478bd9Sstevel@tonic-gate rval = -1; 3127c478bd9Sstevel@tonic-gate break; 3137c478bd9Sstevel@tonic-gate default: 3147c478bd9Sstevel@tonic-gate cmn_err(CE_WARN, "space_store: unspecified error for key %s", 3157c478bd9Sstevel@tonic-gate key); 3167c478bd9Sstevel@tonic-gate rval = -1; 3177c478bd9Sstevel@tonic-gate break; 3187c478bd9Sstevel@tonic-gate #else 3197c478bd9Sstevel@tonic-gate default: 3207c478bd9Sstevel@tonic-gate rval = -1; 3217c478bd9Sstevel@tonic-gate break; 3227c478bd9Sstevel@tonic-gate #endif 3237c478bd9Sstevel@tonic-gate } 3247c478bd9Sstevel@tonic-gate 3257c478bd9Sstevel@tonic-gate return (rval); 3267c478bd9Sstevel@tonic-gate } 3277c478bd9Sstevel@tonic-gate 3287c478bd9Sstevel@tonic-gate uintptr_t 3297c478bd9Sstevel@tonic-gate space_fetch(char *key) 3307c478bd9Sstevel@tonic-gate { 3317c478bd9Sstevel@tonic-gate uintptr_t ptr = 0; 3327c478bd9Sstevel@tonic-gate mod_hash_val_t val; 3337c478bd9Sstevel@tonic-gate int rval; 3347c478bd9Sstevel@tonic-gate 3357c478bd9Sstevel@tonic-gate if (key) { 3367c478bd9Sstevel@tonic-gate rval = mod_hash_find(space_hash, (mod_hash_key_t)key, &val); 3377c478bd9Sstevel@tonic-gate if (rval == 0) { 3387c478bd9Sstevel@tonic-gate ptr = (uintptr_t)val; 3397c478bd9Sstevel@tonic-gate } 3407c478bd9Sstevel@tonic-gate } 3417c478bd9Sstevel@tonic-gate 3427c478bd9Sstevel@tonic-gate return (ptr); 3437c478bd9Sstevel@tonic-gate } 3447c478bd9Sstevel@tonic-gate 3457c478bd9Sstevel@tonic-gate void 3467c478bd9Sstevel@tonic-gate space_free(char *key) 3477c478bd9Sstevel@tonic-gate { 3487c478bd9Sstevel@tonic-gate if (key) { 3497c478bd9Sstevel@tonic-gate (void) mod_hash_destroy(space_hash, (mod_hash_key_t)key); 3507c478bd9Sstevel@tonic-gate } 3517c478bd9Sstevel@tonic-gate } 3527c478bd9Sstevel@tonic-gate 3537c478bd9Sstevel@tonic-gate /* 3547c478bd9Sstevel@tonic-gate * Support for CRC32. At present all calculations are done in simple 3557c478bd9Sstevel@tonic-gate * macros, so all we need is somewhere to declare the global lookup table. 3567c478bd9Sstevel@tonic-gate */ 3577c478bd9Sstevel@tonic-gate 3587c478bd9Sstevel@tonic-gate #include <sys/crc32.h> 3597c478bd9Sstevel@tonic-gate 3607c478bd9Sstevel@tonic-gate const uint32_t crc32_table[256] = { CRC32_TABLE }; 3614b46d1efSkrgopi 3624b46d1efSkrgopi /* 363*da14cebeSEric Cheng * We need to fanout load from NIC which can overwhelm a single CPU. 364*da14cebeSEric Cheng * This becomes especially important on systems having slow CPUs 365*da14cebeSEric Cheng * (sun4v architecture). mac_soft_ring_enable is false on all 366*da14cebeSEric Cheng * systems except sun4v. On sun4v, they get enabled by default (see 367*da14cebeSEric Cheng * sun4v/os/mach_startup.c). 3684b46d1efSkrgopi */ 369*da14cebeSEric Cheng boolean_t mac_soft_ring_enable = B_FALSE; 3706cefaae1SJack Meng 3716cefaae1SJack Meng /* 3726cefaae1SJack Meng * Global iscsi boot prop 3736cefaae1SJack Meng */ 3746cefaae1SJack Meng ib_boot_prop_t *iscsiboot_prop = NULL; 375