niagara.c revision b02e9a2d4d2071d770e5aa9ae8f83f2bbe1f2ced
/*
* 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 2007 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>
#include <sys/niagararegs.h>
#include <sys/trapstat.h>
| (1 << TTE256M))
char cpu_module_name[] = "SUNW,UltraSPARC-T1";
/*
* Hypervisor services information for the NIAGARA CPU module
*/
static hsvc_info_t niagara_hsvc = {
};
void
cpu_setup(void)
{
extern int mmu_exported_pagesize_mask;
extern int cpc_has_overflow_intr;
int status;
char *ni_isa_set[] = {
"sparcv9+vis",
"sparcv9+vis2",
"sparcv8plus+vis",
"sparcv8plus+vis2",
};
/*
* Negotiate the API version for Niagara specific hypervisor
* services.
*/
if (status != 0) {
"group: 0x%lx major: 0x%lx minor: 0x%lx errno: %d\n",
}
/*
* The setup common to all CPU modules is done in cpu_setup_common
* routine.
*/
if (broken_md_flag) {
/*
* Turn on the missing bits supported by Niagara CPU in
* MMU pagesize mask returned by MD.
*/
} else {
if ((mmu_exported_pagesize_mask &
" does not have required sun4v page sizes"
" 8K, 64K and 4M: MD mask is 0x%x",
}
/*
* Niagara supports a 48-bit subset of the full 64-bit virtual
* address space. Virtual addresses between 0x0000800000000000
* and 0xffff.7fff.ffff.ffff inclusive lie within a "VA Hole"
* and must never be mapped. In addition, software must not use
* pages within 4GB of the VA hole as instruction pages to
* avoid problems with prefetching into the VA hole.
*/
/*
* Niagara has a performance counter overflow interrupt
*/
shctx_on = 0;
}
/*
* Set the magic constants of the implementation.
*/
void
{
/*
* The Cache node is optional in MD. Therefore in case "Cache"
* node does not exists in MD, set the default L2 cache associativity,
* size, linesize.
*/
if (cpunode->ecache_size == 0)
if (cpunode->ecache_linesize == 0)
if (cpunode->ecache_associativity == 0)
}
void
{
/*
* The cpu_ipipe and cpu_fpu fields are initialized based on
* the execution unit sharing information from the MD. They
* default to the CPU id in the absence of such information.
*/
/*
* Niagara defines the the core to be at the ipipe level
*/
/*
* Niagara systems just have one chip. Therefore, the chip id
* mpipe id are always 0.
*/
}
static int niagara_cpucnt;
void
{
extern void niagara_kstat_init(void);
}
/*ARGSUSED*/
void
{
extern void niagara_kstat_fini(void);
}
/*
* 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.
*/
/*ARGSUSED*/
void
{
doflush(0);
}
#define IS_FLOAT(i) (((i) & 0x1000000) != 0)
#define IS_IBIT_SET(x) (x & 0x2000)
int
{
char *badaddr;
int instr;
return (-1);
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);
}
/*
* Trapstat support for Niagara processor
*/
int
cpu_trapstat_conf(int cmd)
{
int status = 0;
if (niagara_hsvc_available == B_FALSE)
return (ENOTSUP);
switch (cmd) {
case CPU_TSTATCONF_INIT:
sizeof (niagara_mmustat_t));
if (cpu_tstat_va == NULL)
else {
}
break;
case CPU_TSTATCONF_FINI:
if (cpu_tstat_va) {
cpu_tstat_va = NULL;
cpu_tstat_pa = 0;
}
break;
case CPU_TSTATCONF_ENABLE:
(uint64_t *)&mmustat_pa);
break;
case CPU_TSTATCONF_DISABLE:
break;
default:
break;
}
return (status);
}
void
{
int i;
if (cpu_tstat_va == NULL)
return;
if (tstat_pgszs > NIAGARA_MMUSTAT_PGSZS)
for (i = 0; i < tstat_pgszs; i++, tstatp++) {
}
}