starfire.c revision d94ffb286aba68edc813c6eda61754891db7f7a1
/*
* 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/machparam.h>
#include <sys/mem_cage.h>
#include <sys/starfire.h>
#include <sys/platform_module.h>
#include <vm/hat_sfmmu.h>
#include <sys/cpu_sgnblk_defs.h>
#include <sys/kdi_impl.h>
#include <sys/clock_impl.h>
extern cpu_sgnblk_t *cpu_sgnblkp[];
/* Preallocation of spare tsb's for DR - none for now */
/* Set the maximum number of boards... for DR */
/* Maximum number of cpus per board... for DR */
int starfire_cpu_per_board = 4;
/* Maximum number of mem-units per board... for DR */
int starfire_mem_per_board = 1;
/* Maximum number of io-units (buses) per board... for DR */
int starfire_io_per_board = 2;
/* Preferred minimum cage size (expressed in pages)... for DR */
int
set_platform_max_ncpus(void)
{
if (starfire_boards < 1)
starfire_boards = 1;
return (starfire_boards * starfire_cpu_per_board);
}
void
startup_platform(void)
{
}
int
{
}
void
set_platform_defaults(void)
{
extern char *tod_module_name;
extern int ts_dispatch_extended;
char buf[20];
#ifdef DEBUG
ce_verbose_memory = 2;
ce_verbose_other = 2;
#endif
/*
* Check to see if we have the right firmware
* We simply do a prom_test to see if
* "SUNW,UE10000-prom-version" interface exist.
*/
if (prom_test("SUNW,UE10000-prom-version") != 0) {
halt("Firmware upgrade is required to boot this OS!");
} else {
/*
* Versions 5 to 50 and 150 or above can support this OS
*/
halt("Firmware upgrade is required to boot this OS!");
}
/* Set the CPU signature function pointer */
/* Set appropriate tod module for starfire */
tod_module_name = "todstarfire";
/*
* Use the alternate TS dispatch table, which is better
* tuned for large servers.
*/
ts_dispatch_extended = 1;
}
#ifdef DEBUG
#endif
void
set_platform_cage_params(void)
{
extern pgcnt_t total_pages;
extern struct memlist *phys_avail;
if (kernel_cage_enable) {
#ifdef DEBUG
#endif
/*
* Note: we are assuming that post has load the
* whole show in to the high end of memory. Having
* taken this leap, we copy the whole of phys_avail
* the glist and arrange for the cage to grow
* downward (descending pfns).
*/
}
if (kcage_on)
else
}
void
load_platform_drivers(void)
{
/* load the NGDR driver */
}
}
/*
* Starfire does not support power control of CPUs from the OS.
*/
/*ARGSUSED*/
int
{
if (starfire_cpu_poweron == NULL)
return (ENOTSUP);
else
return ((starfire_cpu_poweron)(cp));
}
/*ARGSUSED*/
int
{
if (starfire_cpu_poweroff == NULL)
return (ENOTSUP);
else
return ((starfire_cpu_poweroff)(cp));
}
void
{
*swint = 0;
}
/*
* The following our currently private to Starfire DR
*/
int
{
return (starfire_boards);
}
int
{
return (starfire_cpu_per_board);
}
int
{
return (starfire_mem_per_board);
}
int
{
return (starfire_io_per_board);
}
/*
* This index is used to associate a given pfn to a place on the freelist.
* This results in dispersing pfn assignment over all the boards in the
* system.
* Choose the index randomly to prevent clustering pages of different
* colors on the same board.
*/
void
{
int mtype;
/* for each page size */
/*
* Compute the maximum # of phys colors based on
* page size.
*/
/* for each color */
bd_cnt = 0;
bd_flags = 0;
idx++) {
}
/* find freelist */
continue;
/* acquire locks */
/*
* read freelist & sort pages by logical
* board number
*/
/* grab pages till last one. */
while (*freelist) {
/* Delete from freelist */
if (size != 0) {
} else {
}
/* detect the lbn */
/* add to bdlist[lbn] */
if (size != 0) {
} else {
page);
}
/* if lbn new */
bd_cnt++;
}
}
/*
* Make the sortlist so
* bd_cnt choices show up
*/
bds = 0;
idx++) {
}
/*
* Set random start.
*/
(void) random_idx(-color);
/*
* now rebuild the freelist by shuffling
* pages from bd lists
*/
while (bd_cnt) {
/*
* get "random" index between 0 &
* bd_cnt
*/
/* Delete from sort_list */
/* & Append to freelist */
/* Big pages use vp_add - 8k don't */
if (size != 0) {
} else {
page);
}
/* needed for indexing tmp lists */
/*
* if this was the last page on this
* list?
*/
/* have to find brd list */
/* idx is lbn? -- No! */
/* sortlist, brdlist */
/* have diff indexs */
--bd_cnt;
/*
* redo the sortlist so only
* bd_cnt choices show up
*/
bds = 0;
for (idy = 0;
idy++) {
/* CSTYLED */
}
}
}
}
}
}
}
}
/*
* If ubound > 0, will return an int between 0 & ubound
* If ubound < 0, will set "random seed"
*/
static uint_t
random_idx(int ubound)
{
static int idx = 0;
if (ubound > 0) {
return (idx);
}
return (0);
}
/*
* No platform drivers on this platform
*/
char *platform_module_list[] = {
(char *)0
};
/*ARGSUSED*/
void
{
}
/*
* Update signature block and the signature ring buffer of a given cpu_id.
*/
void
{
/*
* cpuid == -1 indicates that the operation applies to all cpus.
*/
if (cpuid < 0) {
return;
}
return;
/*
* Map new generic cpu states to older Starfire states.
*/
switch (state) {
case SIGST_OFFLINE:
break;
case SIGST_RESUME_INPROGRESS:
break;
case SIGST_QUIESCE_INPROGRESS:
break;
case SIGST_QUIESCED:
break;
case SIGST_EXIT:
switch (sub_state) {
case SIGSUBST_DEBUG:
state = SIGBST_RUN;
break;
case SIGSUBST_PANIC_CONT:
state = SIGBST_RUN;
break;
case SIGSUBST_DUMP:
state = SIGBST_EXIT;
break;
default:
break;
}
break;
default:
break;
}
/* Update the ring buffer */
}
/*
* Update signature block and the signature ring buffer of all CPUs.
*/
void
{
int i = 0;
for (i = 0; i < NCPU; i++) {
sblkp = cpu_sgnblkp[i];
(CPU_EXISTS|CPU_QUIESCED)))) {
if (sub_state == EXIT_REBOOT) {
if ((cpu_sub_state == EXIT_PANIC1) ||
(cpu_sub_state == EXIT_PANIC2))
else
}
/*
* If we get here from an OBP sync after watchdog,
* we need to retain the watchdog sync state so that
* hostmon knows what's going on. So if we're in
* watchdog we don't update the state.
*/
if (cpu_state == SIGBST_WATCHDOG_SYNC)
cpu_sub_state, i);
else if (cpu_state == SIGBST_REDMODE_SYNC)
cpu_sub_state, i);
else
}
}
}
int
cpu_sgn_exists(int cpuid)
{
}
get_cpu_sgn(int cpuid)
{
return ((ushort_t)-1);
}
get_cpu_sgn_state(int cpuid)
{
return ((uchar_t)-1);
}
/*
* KDI functions - used by the in-situ kernel debugger (kmdb) to perform
* platform-specific operations. These functions execute when the world is
* stopped, and as such cannot make any blocking calls, hold locks, etc.
* promif functions are a special case, and may be used.
*/
static void
starfire_system_claim(void)
{
}
static void
starfire_system_release(void)
{
}
void
{
}