serengeti.c revision e12a8a13c5492eeed938960ff7c68a46f982288b
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * CDDL HEADER START
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file are subject to the terms of the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Common Development and Distribution License (the "License").
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You may not use this file except in compliance with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing permissions
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL HEADER in each
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If applicable, add the following below this CDDL HEADER, with the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * fields enclosed by brackets "[]" replaced with your own identifying
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * information: Portions Copyright [yyyy] [name of copyright owner]
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * CDDL HEADER END
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Use is subject to license terms.
fd21d481e26774c37a197c7cc8ab56096a21e7aaPhill Cunnington#pragma ident "%Z%%M% %I% %E% SMI"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterstatic int sg_debug = 0;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterint (*p2get_mem_unum)(int, uint64_t, char *, int, int *);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/* local functions */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterstatic void cpu_sgn_update(ushort_t sgn, uchar_t state,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Local data.
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamford * iosram_write_ptr is a pointer to iosram_write(). Because of
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * kernel dynamic linking, we can't get to the function by name,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * but we can look up its address, and store it in this variable
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * We include the extern for iosram_write() here not because we call
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * it, but to force compilation errors if its prototype doesn't
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * match the prototype of iosram_write_ptr.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The same issues apply to iosram_read() and iosram_read_ptr.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterextern int iosram_write (int, uint32_t, caddr_t, uint32_t);
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamfordstatic int (*iosram_write_ptr)(int, uint32_t, caddr_t, uint32_t) = NULL;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterextern int iosram_read (int, uint32_t, caddr_t, uint32_t);
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamfordstatic int (*iosram_read_ptr)(int, uint32_t, caddr_t, uint32_t) = NULL;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Variable to indicate if the date should be obtained from the SC or not.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterint todsg_use_sc = FALSE; /* set the false at the beginning */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Preallocation of spare tsb's for DR
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * We don't allocate spares for Wildcat since TSBs should come
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * out of memory local to the node.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterint serengeti_tsb_spares = (SG_MAX_IO_BDS * SG_SCHIZO_PER_IO_BD *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * sg_max_ncpus is the maximum number of CPUs supported on Serengeti.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * sg_max_ncpus is set to be smaller than NCPU to reduce the amount of
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * memory the logs take up until we have a dynamic log memory allocation
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterint sg_max_ncpus = (24 * 2); /* (max # of processors * # of cores/proc) */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * variables to control mailbox message timeouts.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * These can be patched via /etc/system or mdb.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterint sbbc_mbox_default_timeout = MBOX_DEFAULT_TIMEOUT;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/* cached 'chosen' node_id */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterstatic void (*sg_ecc_taskq_func)(sbbc_ecc_mbox_t *) = NULL;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterstatic int (*sg_ecc_mbox_func)(sbbc_ecc_mbox_t *) = NULL;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Table that maps memory slices to a specific memnode.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterplat_dimm_sid_board_t domain_dimm_sids[SG_MAX_CPU_BDS];
fd21d481e26774c37a197c7cc8ab56096a21e7aaPhill Cunnington return (MIN(serengeti_tsb_spares, MAX_UPA));
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell#endif /* DEBUG */
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell /* tod_module_name should be set to "todsg" from OBP property */
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott if (tod_module_name && (strcmp(tod_module_name, todsg_name) == 0))
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell#endif /* DEBUG */
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell /* Serengeti does not support forthdebug */
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell * Some DR operations require the system to be sync paused.
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * Sync pause on Serengeti could potentially take up to 4
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * seconds to complete depending on the load on the SC. To
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * avoid send_mond panics during such operations, we need to
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * increase xc_tick_limit to a larger value on Serengeti by
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * setting xc_tick_limit_scale to 5.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster cmn_err(CE_NOTE, "pcihp driver failed to load");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster int (*serengeti_cpu_poweron)(struct cpu *) = NULL;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster (int (*)(struct cpu *))modgetsymvalue("sbdp_cpu_poweron", 0);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster int (*serengeti_cpu_poweroff)(struct cpu *) = NULL;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster (int (*)(struct cpu *))modgetsymvalue("sbdp_cpu_poweroff", 0);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/* Preferred minimum cage size (expressed in pages)... for DR */
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott MAX(serengeti_minimum_cage_size, total_pages / 256);
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott preferred_cage_size = serengeti_cage_size_limit;
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * Post copies obp into the lowest slice. This requires the
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * cage to grow upwards
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott /* Only note when the cage is off since it should always be on. */
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott cmn_err(CE_NOTE, "!DR Kernel Cage is DISABLED");
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott#define ALIGN(x, a) ((a) == 0 ? (uint64_t)(x) : \
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott (((uint64_t)(x) + (uint64_t)(a) - 1l) & ~((uint64_t)(a) - 1l)))
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshottupdate_mem_bounds(int brd, uint64_t base, uint64_t sz)
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * First see if this board already has a memnode associated
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * with it. If not, see if this slice has a memnode. This
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamford * covers the cases where a single slice covers multiple
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * boards (cross-board interleaving) and where a single
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * board has multiple slices (1+GB DIMMs).
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ((mnode = plat_lgrphand_to_mem_node(brd)) == -1) {
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott if ((mnode = slice_to_memnode[PA_2_SLICE(base)]) == -1)
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott plat_assign_lgrphand_to_mem_node(brd, mnode);
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * Align base at 16GB boundary
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott base = ALIGN(base, (1ul << PA_SLICE_SHIFT));
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * Dynamically detect memory slices in the system by decoding
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * the cpu memory decoder registers at boot time.
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott if ((prom_getprop(nodeid, "portid", (caddr_t)&portid) < 0) ||
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Decode the board number from the MC portid
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The "reg" property returns 4 32-bit values. The first two are
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamford * combined to form a 64-bit address. The second two are for a
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * 64-bit size, but we don't actually need to look at that value.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster prom_printf("Warning: malformed 'reg' property\n");
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamford if (prom_getprop(nodeid, "reg", (caddr_t)regs) < 0)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Figure out whether the memory controller we are examining
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * belongs to this CPU or a different one.
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell for (i = 0; i < SG_MAX_BANKS_PER_MC; i++) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If the memory controller is local to this CPU, we use
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * the special ASI to read the decode registers.
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * Otherwise, we load the values from a magic address in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * I/O space.
bcb85423bc6855cb1c7accc69fa051e1771c000aMark de Reeper mc_decode[i] = lddmcdecode(mask & MC_OFFSET_MASK);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The memory decode register is a bitmask field,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * so we can decode that into both a base and
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * This routine is run midway through the boot process. By the time we get
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * here, we know about all the active CPU boards in the system, and we have
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * extracted information about each board's memory from the memory
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * controllers. We have also figured out which ranges of memory will be
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell * assigned to which memnodes, so we walk the slice table to build the table
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of memnodes.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/* ARGSUSED */
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnellplat_build_mem_nodes(u_longlong_t *list, size_t nelems)
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell mem_node_physalign = (1ull << PA_SLICE_SHIFT);
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell for (slice = 0; slice < SG_MAX_SLICE; slice++) {
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell basepfn = (uint64_t)slice << PFN_SLICE_SHIFT;
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell mem_node_add_slice(basepfn, basepfn + npgs - 1);
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell * Serengeti support for lgroups.
d28c31c7d0cf9ac19eaf07942956e707222fb5ebPeter Major * On Serengeti, an lgroup platform handle == board number.
d28c31c7d0cf9ac19eaf07942956e707222fb5ebPeter Major * Mappings between lgroup handles and memnodes are managed
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * in addition to mappings between memory slices and memnodes
d28c31c7d0cf9ac19eaf07942956e707222fb5ebPeter Major * to support cross-board interleaving as well as multiple
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell * slices per board (e.g. >1GB DIMMs). The initial mapping
9709ff1b979ab7830f3e00b809f1157554566ed3Steve Ferris * of memnodes to lgroup handles is determined at boot time.
d28c31c7d0cf9ac19eaf07942956e707222fb5ebPeter Major * A DR addition of memory adds a new mapping. A DR copy-rename
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell * swaps mappings.
9709ff1b979ab7830f3e00b809f1157554566ed3Steve Ferris * Macro for extracting the board number from the CPU id
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Return the platform handle for the lgroup containing the given CPU
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * For Serengeti, lgroup platform handle == board number
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Platform specific lgroup initialization
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Initialize lookup tables to invalid values so we catch
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * any illegal use of them.
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamford for (i = 0; i < SG_MAX_SLICE; i++) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Set tuneables for Serengeti architecture
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * lgrp_expand_proc_thresh is the minimum load on the lgroups
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * this process is currently running on before considering
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamford * expanding threads to another lgroup.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * lgrp_expand_proc_diff determines how much less the remote lgroup
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * must be loaded before expanding to it.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Bandwidth is maximized on Serengeti by spreading load across
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * the machine. The impact to inter-thread communication isn't
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * too costly since remote latencies are relatively low. These
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * values equate to one CPU's load and so attempt to spread the
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamford * load out across as many lgroups as possible one CPU at a time.
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamford lgrp_expand_proc_thresh = LGRP_LOADAVG_THREAD_MAX;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster lgrp_expand_proc_diff = LGRP_LOADAVG_THREAD_MAX;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Platform notification of lgroup (re)configuration changes
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterplat_lgrp_config(lgrp_config_flag_t evt, uintptr_t arg)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster update_mem_bounds(umb->u_board, umb->u_base, umb->u_len);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /* We don't have to do anything */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * During a DR copy-rename operation, all of the memory
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * on one board is moved to another board -- but the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * addresses/pfns and memnodes don't change. This means
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * the memory has changed locations without changing identity.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Source is where we are copying from and target is where we
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * are copying to. After source memnode is copied to target
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * memnode, the physical addresses of the target memnode are
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * renamed to match what the source memnode had. Then target
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * memnode can be removed and source memnode can take its
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * To do this, swap the lgroup handle to memnode mappings for
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * the boards, so target lgroup will have source memnode and
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * source lgroup will have empty target memnode which is where
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * its memory will go (if any is added to it later).
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Then source memnode needs to be removed from its lgroup
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * and added to the target lgroup where the memory was living
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * but under a different name/memnode. The memory was in the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * target memnode and now lives in the source memnode with
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * different physical addresses even though it is the same
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster plat_assign_lgrphand_to_mem_node(thand, snode);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster plat_assign_lgrphand_to_mem_node(shand, tnode);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Remove source memnode of copy rename from its lgroup
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * and add it to its new target lgroup
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster lgrp_config(LGRP_CONFIG_MEM_RENAME, (uintptr_t)snode,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Return latency between "from" and "to" lgroups
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * This latency number can only be used for relative comparison
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * between lgroups on the running system, cannot be used across platforms,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * and may not reflect the actual latency. It is platform and implementation
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * specific, so platform gets to decide its value. It would be nice if the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * number was at least proportional to make comparisons more meaningful though.
fd21d481e26774c37a197c7cc8ab56096a21e7aaPhill Cunnington * NOTE: The numbers below are supposed to be load latencies for uncached
fd21d481e26774c37a197c7cc8ab56096a21e7aaPhill Cunnington * memory divided by 10.
fd21d481e26774c37a197c7cc8ab56096a21e7aaPhill Cunningtonplat_lgrp_latency(lgrp_handle_t from, lgrp_handle_t to)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Return min remote latency when there are more than two lgroups
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (root and child) and getting latency between two different lgroups
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * or root is involved
87d68743726585ee101ba2e7be2cf06cd34ebb80Neil Madden from == LGRP_DEFAULT_HANDLE || to == LGRP_DEFAULT_HANDLE))
87d68743726585ee101ba2e7be2cf06cd34ebb80Neil Madden return (28);
87d68743726585ee101ba2e7be2cf06cd34ebb80Neil Madden return (23);
87d68743726585ee101ba2e7be2cf06cd34ebb80Neil Madden/* ARGSUSED */
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamford * Find dip for chosen IOSRAM
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * find the /chosen SBBC node, prom interface will handle errors
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * get the 'iosram' property from the /chosen node
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (prom_getprop(nodeid, IOSRAM_CHOSEN_PROP, (caddr_t)&tunnel) <= 0) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SBBC_ERR(CE_PANIC, "No iosram property found! \n");
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott if (prom_phandle_to_path((phandle_t)tunnel, master_sbbc,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster sizeof (master_sbbc)) < 0) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SBBC_ERR1(CE_PANIC, "prom_phandle_to_path(%d) failed\n",
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * load and attach the sgsbbc driver.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * This will also attach all the sgsbbc driver instances
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (i_ddi_attach_hw_nodes("sgsbbc") != DDI_SUCCESS) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /* translate a path name to a dev_info_t */
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamford if ((dip == NULL) || (ddi_get_nodeid(dip) != tunnel)) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster cmn_err(CE_PANIC, "i_ddi_path_to_devi(%x) failed for SBBC\n",
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /* make sure devi_ref is ZERO */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster DCMNERR(CE_CONT, "Chosen IOSRAM is at %s \n", master_sbbc);
e2c8a434054afd7228765bdfb72df3c6117be3b8David Luna * Load and attach the mc-us3 memory driver.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (i_ddi_attach_hw_nodes("mc-us3") != DDI_SUCCESS)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster (void) ddi_hold_driver(ddi_name_to_major("mc-us3"));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Initialize the chosen IOSRAM before its clients
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * are loaded.
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * Ideally, we'd do this in set_platform_defaults(), but
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * at that point it's too early to look up symbols.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster iosram_write_ptr = (int (*)(int, uint32_t, caddr_t, uint32_t))
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster DCMNERR(CE_WARN, "load_platform_defaults: iosram_write()"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster " not found; signatures will not be updated\n");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The iosram read ptr is only needed if we can actually
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * write CPU signatures, so only bother setting it if we
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * set a valid write pointer, above.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster iosram_read_ptr = (int (*)(int, uint32_t, caddr_t, uint32_t))
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster DCMNERR(CE_WARN, "load_platform_defaults: iosram_read()"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster " not found\n");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Set todsg_use_sc to TRUE so that we will be getting date
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * from the SC.
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamford * Now is a good time to activate hardware watchdog (if one exists).
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell ret = tod_ops.tod_set_watchdog_timer(watchdog_timeout_seconds);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Load and attach the schizo pci bus nexus driver.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (i_ddi_attach_hw_nodes("pcisch") != DDI_SUCCESS)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * No platform drivers on this platform
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return (SG_MAX_CMPS_PER_BD); /* each CPU die has a memory controller */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Our nodename has been set, pass it along to the SC.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster int (*sg_mbox)(sbbc_msg_t *, sbbc_msg_t *, time_t) = NULL;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * find the symbol for the mailbox routine
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster sg_mbox = (int (*)(sbbc_msg_t *, sbbc_msg_t *, time_t))
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster modgetsymvalue("sbbc_mbox_request_response", 0);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster cmn_err(CE_NOTE, "!plat_nodename_set: sg_mbox not found\n");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * construct the message telling the SC our nodename
f79113ae65937c28690ec71f68f54f862b758baePhill Cunnington (void) strcpy(nni.nodename, utsname.nodename);
f79113ae65937c28690ec71f68f54f862b758baePhill Cunnington nni.namelen = (int32_t)strlen(nni.nodename);
f79113ae65937c28690ec71f68f54f862b758baePhill Cunnington req.msg_type.sub_type = INFO_MBOX_NODENAME;
f79113ae65937c28690ec71f68f54f862b758baePhill Cunnington req.msg_len = (int)(nni.namelen + sizeof (nni.namelen));
f79113ae65937c28690ec71f68f54f862b758baePhill Cunnington * initialize the response back from the SC
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott resp.msg_type.sub_type = INFO_MBOX_NODENAME;
bcb85423bc6855cb1c7accc69fa051e1771c000aMark de Reeper * ship it and check for success
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster rv = (sg_mbox)(&req, &resp, sbbc_mbox_default_timeout);
9709ff1b979ab7830f3e00b809f1157554566ed3Steve Ferris cmn_err(CE_NOTE, "!plat_nodename_set: sg_mbox retval %d\n", rv);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster cmn_err(CE_NOTE, "!plat_nodename_set: msg_status %d\n",
bcb85423bc6855cb1c7accc69fa051e1771c000aMark de Reeper DCMNERR(CE_NOTE, "!plat_nodename_set was successful\n");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * It is necessary to exchange the capability bitmap
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * with SC before sending any ecc error information and
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell * indictment. We are calling the plat_ecc_capability_send()
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell * here just after sending the nodename successfully.
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell DCMNERR(CE_NOTE, "!plat_ecc_capability_send was"
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell " successful\n");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * flag to allow users switch between using OBP's
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * prom_get_unum() and mc-us3 driver's p2get_mem_unum()
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (for main memory errors only).
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Debugging flag: set to 1 to call into obp for get_unum, or set it to 0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * to call into the unum cache system. This is the E$ equivalent of
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * sg_use_prom_get_unum.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/* used for logging ECC errors to the SC */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * plat_get_mem_unum() generates a string identifying either the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * memory or E$ DIMM(s) during error logging. Depending on whether
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * the error is E$ or memory related, the appropriate support
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * routine is called to assist in the string generation.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * - For main memory errors we can use the mc-us3 drivers p2getunum()
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (or prom_get_unum() for debugging purposes).
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * - For E$ errors we call sg_get_ecacheunum() to generate the unum (or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * prom_serengeti_get_ecacheunum() for debugging purposes).
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostersg_prom_get_unum(int synd_code, uint64_t paddr, char *buf, int buflen,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ((prom_get_unum(synd_code, (unsigned long long)paddr,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterplat_get_mem_unum(int synd_code, uint64_t flt_addr, int flt_bus_id,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster int flt_in_memory, ushort_t flt_status, char *buf, int buflen, int *lenp)
56ed5bbb263838f338eb8afc978091c01a4f2a2bjeff.schenk * unum_func will either point to the memory drivers p2get_mem_unum()
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * or to prom_get_unum() for memory errors.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster int (*unum_func)(int synd_code, uint64_t paddr, char *buf,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * check if it's a Memory or an Ecache error.
6f6d45938671719a3c22abd091398ec1cfcf7788Peter Major * It's a main memory error.
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamford * For debugging we allow the user to switch between
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * using OBP's get_unum and the memory driver's get_unum
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamford * so we create a pointer to the functions and switch
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * depending on the sg_use_prom_get_unum flag.
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamford DCMNERR(CE_NOTE, "Using prom_get_unum from OBP");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return (unum_func(synd_code, P2ALIGN(flt_addr, 8),
6f6d45938671719a3c22abd091398ec1cfcf7788Peter Major * It's an E$ error.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * We call to OBP to handle this.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "Using prom_serengeti_get_ecacheunum from OBP");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster P2ALIGN(flt_addr, 8), buf, buflen, lenp) != 0) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return (sg_get_ecacheunum(flt_bus_id, flt_addr,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * This platform hook gets called from mc_add_mem_unum_label() in the mc-us3
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * driver giving each platform the opportunity to add platform
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * specific label information to the unum for ECC error logging purposes.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterplat_add_mem_unum_label(char *unum, int mcid, int bank, int dimm)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The mc-us3 driver deals with logical banks but for unum
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * purposes we need to use physical banks so that the correct
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * dimm can be physically located. Logical banks 0 and 2
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * make up physical bank 0. Logical banks 1 and 3 make up
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * physical bank 1. Here we do the necessary conversion.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterplat_get_cpu_unum(int cpuid, char *buf, int buflen, int *lenp)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * We log all ECC events to the SC so we send a mailbox
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * message to the SC passing it the relevant data.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * ECC mailbox messages are sent via a taskq mechanism to
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * prevent impaired system performance during ECC floods.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Indictments have already passed through a taskq, so they
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * are not queued here.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterplat_send_ecc_mailbox_msg(plat_ecc_message_type_t msg_type, void *datap)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster sg_ecc_taskq_func = (void (*)(sbbc_ecc_mbox_t *))
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster modgetsymvalue("sbbc_mbox_queue_ecc_event", 0);
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell cmn_err(CE_NOTE, "!plat_send_ecc_mailbox_msg: "
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "sbbc_mbox_queue_ecc_event not found");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster sg_ecc_mbox_func = (int (*)(sbbc_ecc_mbox_t *))
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster cmn_err(CE_NOTE, "!plat_send_ecc_mailbox_msg: "
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott "sbbc_mbox_ecc_output not found");
d0da70ccbba38b773e7a7cc71bc124b06206d201Robert Wapshott * Initialize the request and response structures
d0da70ccbba38b773e7a7cc71bc124b06206d201Robert Wapshott msg_size = sizeof (plat_ecc_indictment_data_t);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster msg_size = sizeof (plat_ecc_indictment2_data_t);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster strlen(utsname.release) + strlen(utsname.version) + 2;
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell msg_size = sizeof (plat_dimm_sid_request_data_t);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster msgp = (sbbc_ecc_mbox_t *)kmem_zalloc(sizeof (sbbc_ecc_mbox_t),
d0da70ccbba38b773e7a7cc71bc124b06206d201Robert Wapshott cmn_err(CE_NOTE, "!plat_send_ecc_mailbox_msg: "
d0da70ccbba38b773e7a7cc71bc124b06206d201Robert Wapshott "unable to allocate sbbc_ecc_mbox");
d0da70ccbba38b773e7a7cc71bc124b06206d201Robert Wapshott msgp->ecc_req.msg_type.sub_type = msg_subtype;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster msgp->ecc_req.msg_buf = (caddr_t)kmem_zalloc(msg_size, sleep_flag);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster cmn_err(CE_NOTE, "!plat_send_ecc_mailbox_msg: "
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "unable to allocate request msg_buf");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster kmem_free((void *)msgp, sizeof (sbbc_ecc_mbox_t));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster bcopy(datap, (void *)msgp->ecc_req.msg_buf, msg_size);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * initialize the response back from the SC
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster msgp->ecc_resp.msg_type.sub_type = msg_subtype;
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * For Error Messages, we go through a taskq.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Queue up the message for processing
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamford * For indictment and capability messages, we've already gone
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamford * through the taskq, so we can call the mailbox routine
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * directly. Find the symbol for the routine that sends
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * the mailbox msg
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster msgp->ecc_resp.msg_buf = (caddr_t)kmem_zalloc(msg_size,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /* FALLTHRU */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster msgp->ecc_resp.msg_len = sizeof (plat_dimm_sid_board_data_t);
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott msgp->ecc_resp.msg_buf = (caddr_t)kmem_zalloc(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster sizeof (plat_dimm_sid_board_data_t), sleep_flag);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * m is redundant on serengeti as the multiplier is always 4
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * board number for a given proc
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercpu_sgn_update(ushort_t sig, uchar_t state, uchar_t sub_state, int cpuid)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster uint32_t signature = CPU_SIG_BLD(sig, state, sub_state);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If the IOSRAM write pointer isn't set, we won't be able
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * to write signatures to ANYTHING, so we may as well just
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * write out an error message (if desired) and exit this
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * routine now...
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "cpu_sgn_update: iosram_write() not found;"
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott " cannot write signature 0x%x for CPU(s) or domain\n",
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Differentiate a panic reboot from a non-panic reboot in the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * setting of the substate of the signature.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If the new substate is REBOOT and we're rebooting due to a panic,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * then set the new substate to a special value indicating a panic
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * reboot, SIGSUBST_PANIC_REBOOT.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * A panic reboot is detected by a current (previous) domain signature
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott * state of SIGST_EXIT, and a new signature substate of SIGSUBST_REBOOT.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The domain signature state SIGST_EXIT is used as the panic flow
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * progresses.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * At the end of the panic flow, the reboot occurs but we should now
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * one that was involuntary, something that may be quite useful to know
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * at OBP level.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "cpu_sgn_update: iosram_read() not found;"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster " could not check current domain signature\n");
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott (char *)¤t_sgn, sizeof (current_sgn));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * cpuid == -1 indicates that the operation applies to all cpus.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SG_SGNBLK_CPUSIG_OFFSET(cpuid), (char *)&signature,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster for (i = 0; i < NCPU; i++) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SG_SGNBLK_CPUSIG_OFFSET(i), (char *)&signature,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (state == SIGST_OFFLINE || state == SIGST_DETACHED) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SG_SGNBLK_DOMAINSIG_OFFSET, (char *)&signature,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * A routine to convert a number (represented as a string) to
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * the integer value it represents.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster#define isspace(c) ((c) == ' ' || (c) == '\t' || (c) == '\n')
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (!isdigit(c = *p)) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster switch (c) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /* FALLTHROUGH */
87d68743726585ee101ba2e7be2cf06cd34ebb80Neil Madden n *= 10; /* two steps to avoid unnecessary overflow */
87d68743726585ee101ba2e7be2cf06cd34ebb80Neil Madden n += '0' - c; /* accum neg to avoid surprises at MAX */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return (neg ? n : -n);
int plen;
sg_prom_sb_dr_check(void)
int rv;
prom_res = 0;
return (prom_res);
sg_prom_cpci_dr_check(void)
return (sg_prom_sb_dr_check());
sg_system_claim(void)
sg_system_release(void)
sg_console_claim(void)
sg_console_release(void)