/*
* 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
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/sysmacros.h>
#include <sys/archsystm.h>
#include <sys/machparam.h>
#include <sys/machsystm.h>
#include <sys/machthread.h>
#include <sys/elf_SPARC.h>
#include <vm/hat_sfmmu.h>
#include <vm/seg_kmem.h>
#include <sys/cheetahregs.h>
#include <sys/us3_module.h>
#include <sys/dditypes.h>
#include <sys/prom_debug.h>
#include <sys/prom_plat.h>
#include <sys/cpu_module.h>
#include <sys/sysmacros.h>
#include <sys/platform_module.h>
#include <sys/machtrap.h>
#include <sys/bootconf.h>
#ifdef CHEETAHPLUS_ERRATUM_25
#endif /* CHEETAHPLUS_ERRATUM_25 */
/*
* Note that 'Cheetah PRM' refers to:
* SPARC V9 JPS1 Implementation Supplement: Sun UltraSPARC-III
*/
/*
* Setup trap handlers.
*/
void
cpu_init_trap(void)
{
}
static int
{
int value;
case sizeof (int):
break;
default:
break;
}
return (value);
}
/*
* Set the magic constants of the implementation.
*/
/*ARGSUSED*/
void
{
int i, a;
static struct {
char *name;
int *var;
int defval;
} prop[] = {
};
i = 0; a = vac_size;
while (a >>= 1)
++i;
vac_shift = i;
vac = 1;
/*
* Cheetah's large page support has problems with large numbers of
* large pages, so just disable large pages out-of-the-box.
* Note that the other defaults are set in sun4u/vm/mach_vm_dep.c.
*/
}
void
{
#if (NCPU > IDSR_BN_SETS)
int index = 0;
int ncpuids = 0;
#endif
#ifdef CHEETAHPLUS_ERRATUM_25
int recovered = 0;
int cpuid;
#endif
#if (NCPU <= IDSR_BN_SETS)
for (i = 0; i < NCPU; i++)
if (CPU_IN_SET(set, i)) {
CPUSET_DEL(set, i);
if (CPUSET_ISNULL(set))
break;
}
#else
for (i = 0; i < NCPU; i++)
if (CPU_IN_SET(set, i)) {
ncpuids++;
/*
* Ship only to the first (IDSR_BN_SETS) CPUs. If we
* find we have shipped to more than (IDSR_BN_SETS)
* CPUs, set "index" to the highest numbered CPU in
* the set so we can ship to other CPUs a bit later on.
*/
if (shipped < IDSR_BN_SETS) {
CPUSET_DEL(set, i);
if (CPUSET_ISNULL(set))
break;
} else
index = (int)i;
}
#endif
for (;;) {
#if (NCPU <= IDSR_BN_SETS)
if (idsr == 0)
break;
#else
break;
#endif
/*
* If there is a big jump between the current tick
* count and lasttick, we have probably hit a break
* point. Adjust endtick accordingly to avoid panic.
*/
if (panic_quiesce)
return;
#ifdef CHEETAHPLUS_ERRATUM_25
cpuid = -1;
for (i = 0; i < IDSR_BN_SETS; i++) {
if (idsr & (IDSR_NACK_BIT(i) |
IDSR_BUSY_BIT(i))) {
break;
}
}
recovered == 0) {
if (mondo_recover(cpuid, i)) {
/*
* We claimed the whole memory or
* full scan is disabled.
*/
recovered++;
}
/*
* Recheck idsr
*/
continue;
} else
#endif /* CHEETAHPLUS_ERRATUM_25 */
{
"[%d NACK %d BUSY]\nIDSR 0x%"
for (i = 0; i < IDSR_BN_SETS; i++) {
if (idsr & (IDSR_NACK_BIT(i) |
IDSR_BUSY_BIT(i))) {
cpuids[i]);
}
}
}
}
#if (NCPU > IDSR_BN_SETS)
if (cpus_left) {
do {
/*
* Sequence through and ship to the
* remainder of the CPUs in the system
* (e.g. other than the first
* (IDSR_BN_SETS)) in reverse order.
*/
i = IDSR_BUSY_IDX(lo);
shipped++;
/*
* If we've processed all the CPUs,
* exit the loop now and save
* instructions.
*/
break;
break;
}
} while (cpus_left);
#ifdef CHEETAHPLUS_ERRATUM_25
/*
* Clear recovered because we are sending to
* a new set of targets.
*/
recovered = 0;
#endif
continue;
}
}
#endif
if (curbusy) {
busy++;
continue;
}
#ifdef SEND_MONDO_STATS
{
if (n < 8192)
x_nack_stimes[n >> 7]++;
}
#endif
;
do {
i = IDSR_NACK_IDX(lo);
} while (curnack);
nack++;
busy = 0;
}
#ifdef SEND_MONDO_STATS
{
if (n < 8192)
x_set_stimes[n >> 7]++;
else
}
x_set_cpus[shipped]++;
#endif
}
/*
* Handles error logging for implementation specific error types.
*/
/*ARGSUSED*/
int
{
/* There aren't any error types which are specific to cheetah only */
return (CH_ASYNC_LOG_UNKNOWN);
}
/*
* Figure out if Ecache is direct-mapped (Cheetah or Cheetah+ with Ecache
* control ECCR_ASSOC bit off or 2-way (Cheetah+ with ECCR_ASSOC on).
* We need to do this on the fly because we may have mixed Cheetah+'s with
* both direct and 2-way Ecaches.
*/
int
cpu_ecache_nway(void)
{
return (CH_ECACHE_NWAY);
}
/*
* Note that these are entered into the table: Fatal Errors (PERR, IERR,
* Afar overwrite policy is:
* UCU,UCC > UE,EDU,WDU,CPU > CE,EDC,EMC,WDC,CPC > TO,BERR
*/
/* Fatal Errors */
"PERR Fatal",
"IERR Fatal",
"ISAP Fatal",
"EMU Fatal",
"Orphaned UCU",
"Orphaned UCC",
/* UCU, UCC */
"UCU",
"UCC",
/* UE, EDU:ST, EDU:BLD, WDU, CPU */
"Uncorrectable system bus (UE)",
"EDU:ST",
"EDU:BLD",
"WDU",
"CPU",
/* CE, EDC, EMC, WDC, CPC */
"Corrected system bus (CE)",
"EDC",
"EMC",
"WDC",
"CPC",
/* TO, BERR */
"Timeout (TO)",
"Bus Error (BERR)",
/* IVU, IVC */
"IVU",
"IVC",
0, NULL, 0, 0,
NULL,
};
/*
* Prioritized list of Error bits for AFAR overwrite.
* See Cheetah PRM P.6.1
* Class 4: UCC, UCU
* Class 3: UE, EDU, EMU, WDU, CPU
* Class 2: CE, EDC, EMC, WDC, CPC
* Class 1: TO, BERR
*/
0
};
/*
* Prioritized list of Error bits for ESYND overwrite.
* See Cheetah PRM P.6.2
* Class 2: UE, IVU, EDU, WDU, UCU, CPU
* Class 1: CE, IVC, EDC, WDC, UCC, CPC
*/
0
};
/*
* Prioritized list of Error bits for MSYND overwrite.
* See Cheetah PRM P.6.3
* Class 2: EMU
* Class 1: EMC
*/
0
};
/*
* change cpu speed bits -- new speed will be normal-speed/divisor.
*
* The Jalapeno memory controllers are required to drain outstanding
* memory transactions within 32 JBus clocks in order to be ready
* to enter Estar mode. In some corner cases however, that time
* fell short.
*
* A safe software solution is to force MCU to act like in Estar mode,
* then delay 1us (in ppm code) prior to assert J_CHNG_L signal.
* To reverse the effect, upon exiting Estar, software restores the
* MCU to its original state.
*/
/* ARGSUSED1 */
void
{
continue;
reg = get_safari_config();
divisor);
return;
}
/*
* We will reach here only if OBP and kernel don't agree on
* the speeds supported by the CPU.
*/
}
/*
* Cpu private initialization. This includes allocating the cpu_private
* data structure, initializing it, and initializing the scrubber for this
* cpu. This function calls cpu_init_ecache_scrub_dr to init the scrubber.
* We use kmem_cache_create for the cheetah private data structure because
* it needs to be allocated on a PAGESIZE (8192) byte boundary.
*/
void
{
int i;
/* LINTED: E_TRUE_LOGICAL_EXPR */
/*
* Running with a Cheetah+, Jaguar, or Panther on a Cheetah CPU
* machine is not a supported configuration. Attempting to do so
* may result in unpredictable failures (e.g. running Cheetah+
* CPUs with Cheetah E$ disp flush) so don't allow it.
*
* This is just defensive code since this configuration mismatch
* should have been caught prior to OS execution.
*/
}
/*
* If the ch_private_cache has not been created, create it.
*/
if (ch_private_cache == NULL) {
}
for (i = 0; i < CH_ERR_TL1_TLMAX; i++)
}
/*
* Clear the error state registers for this CPU.
* For Cheetah, just clear the AFSR
*/
void
{
}
/*
* For Cheetah, the error recovery code uses an alternate flush area in the
* TL>0 fast ECC handler. ecache_tl1_flushaddr is the physical address of
* this exclusive displacement flush area.
*/
/*
* Allocate and initialize the exclusive displacement flush area.
*/
{
/*
* Allocate the physical memory for the exclusive flush area
*
* Need to allocate an exclusive flush area that is twice the
* largest supported E$ size, physically contiguous, and
* aligned on twice the largest E$ size boundary.
*
* Memory allocated via prom_alloc is included in the "cage"
* from the DR perspective and due to this, its physical
* address will never change and the memory will not be
* removed.
*
* prom_alloc takes 3 arguments: bootops, virtual address hint,
* size of the area to allocate, and alignment of the area to
* allocate. It returns zero if the allocation fails, or the
* virtual address for a successful allocation. Memory prom_alloc'd
* is physically contiguous.
*/
if ((ecache_tl1_virtaddr =
/*
* get the physical address of the exclusive flush area
*/
} else {
}
return (tmp_alloc_base);
}
/*
* Update cpu_offline_set so the scrubber knows which cpus are offline
*/
/*ARGSUSED*/
int
{
switch (what) {
case CPU_ON:
case CPU_INIT:
break;
case CPU_OFF:
break;
default:
break;
}
return (0);
}