niagara.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/archsystm.h>
#include <sys/machparam.h>
#include <sys/machsystm.h>
#include <sys/elf_SPARC.h>
#include <vm/hat_sfmmu.h>
#include <sys/dditypes.h>
#include <sys/cpu_module.h>
#include <sys/prom_debug.h>
#include <sys/prom_plat.h>
#include <sys/sysmacros.h>
#include <sys/machtrap.h>
#include <sys/simulate.h>
/*
* Maximum number of contexts
*/
#ifdef NIAGARA_ERRATUM_39
extern int niagara_erratum_39;
/* Niagara CPU version register */
#define VER_MASK_MAJOR_SHIFT 28
#define VER_MASK_MAJOR_MASK 0xf
#endif /* NIAGARA_ERRATUM_39 */
void
cpu_setup(void)
{
extern int at_flags;
extern int disable_delay_tlb_flush, delay_tlb_flush;
extern int mmu_exported_pagesize_mask;
extern int get_cpu_pagesizes(void);
extern int cpc_has_overflow_intr;
#ifdef NIAGARA_ERRATUM_39
/*
* Get CPU version and enable Niagara erratum 39 workaround only
* on Niagara 1.x part. This workaround can also be enabled via
*/
niagara_erratum_39 = 1;
#endif
/* XXXQ */
/*
* Use the maximum number of contexts available for Spitfire unless
* it has been tuned for debugging.
* We are checking against 0 here since this value can be patched
* will be patched too late and thus cause the system to panic.
*/
if (nctxs == 0)
if (use_page_coloring) {
do_pg_coloring = 1;
if (use_virtual_coloring)
do_virtual_coloring = 1;
}
/*
* Initalize supported page sizes information before the PD.
* If no information is available, then initialize the
* mmu_exported_pagesize_mask to a reasonable value for that processor.
*/
if (mmu_exported_pagesize_mask <= 0) {
}
/*
* Tune pp_slots to use up to 1/8th of the tlb entries.
*/
/*
* Block stores invalidate all pages of the d$ so pagecopy
* et. al. do not need virtual translations with virtual
* coloring taken into consideration.
*/
isa_list =
"sparcv9 sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 "
"sparc sparcv9+vis sparcv9+vis2 sparcv8plus+vis sparcv8plus+vis2";
/*
* On Spitfire, there's a hole in the address space
* that we must never map (the hardware only support 44-bits of
* virtual address). Later CPUs are expected to have wider
* supported address ranges.
*
* See address map on p23 of the UltraSPARC 1 user's manual.
*/
/* XXXQ get from machine description */
/*
* The kpm mapping window.
* kpm_size:
* The size of a single kpm range.
* The overall size will be: kpm_size * vac_colors.
* kpm_vbase:
* The virtual start address of the kpm range within the kernel
* virtual address space. kpm_vbase has to be kpm_size aligned.
*/
kpm_size_shift = 41;
/*
* The traptrace code uses either %tick or %stick for
* timestamping. We have %stick so we can use it.
*/
traptrace_use_stick = 1;
/*
* sun4v provides demap_all
*/
if (!disable_delay_tlb_flush)
delay_tlb_flush = 1;
/*
* Niagara has a performance counter overflow interrupt
*/
}
/*
* Set the magic constants of the implementation.
*/
void
{
int i, a;
/*
* The assumption here is that fillsysinfo will eventually
* have code to fill this info in from the PD.
* We hard code this for niagara now.
* Once the PD access library is done this code
* might need to be changed to get the info from the PD
*/
if (cpunode->ecache_size == 0)
if (cpunode->ecache_linesize == 0)
if (cpunode->ecache_associativity == 0)
if (ecache_setsize == 0)
if (ecache_alignsize == 0)
i = 0; a = vac_size;
while (a >>= 1)
++i;
vac_shift = i;
vac = 0;
}
static int niagara_cpucnt;
void
{
extern int niagara_kstat_init(void);
if (niagara_cpucnt++ == 0) {
(void) niagara_kstat_init();
}
}
void
{
extern int niagara_kstat_fini(void);
if (--niagara_cpucnt == 0) {
(void) niagara_kstat_fini();
}
}
/*
* On Niagara, any flush will cause all preceding stores to be
* synchronized wrt the i$, regardless of address or ASI. In fact,
* the address is ignored, so we always flush address 0.
*/
void
{
doflush(0);
}
#define IS_FLOAT(i) (((i) & 0x1000000) != 0)
#define IS_IBIT_SET(x) (x & 0x2000)
int
{
char *badaddr;
int instr;
if (IS_IBIT_SET(instr)) {
} else {
}
return (-1);
}
case SIMU_RETRY:
break; /* regs are already set up */
/*NOTREACHED*/
case SIMU_SUCCESS:
/*
* skip the successfully
* simulated instruction
*/
break;
/*NOTREACHED*/
case SIMU_FAULT:
break;
case SIMU_DZERO:
break;
case SIMU_UNALIGN:
break;
case SIMU_ILLEGAL:
default:
(op3 == IOP_V8_STDFA)))
else
break;
}
return (0);
}