pda.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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Starfire Post Descriptor Array (post2obp) management.
*/
#include <sys/dditypes.h>
#include <vm/seg_kmem.h>
#include <sys/machsystm.h>
#include <sys/starfire.h>
#include <sys/cpu_sgnblk_defs.h>
extern cpu_sgnblk_t *cpu_sgnblkp[];
extern uint64_t mc_get_mem_alignment();
typedef struct {
int p2o_cpuid;
} p2o_info_t;
/*
* PDA management routines. Should ultimately be made
* accessible to other Starfire subsystems, but for
* now we'll leave it here.
*/
pda_open()
{
return (NULL);
}
return ((pda_handle_t)NULL);
} else {
return ((pda_handle_t)pip);
}
}
void
{
return;
}
int
{
return (0);
else
return (1);
}
void *
{
}
{
int c;
if (boardnum == -1)
/*
* Put on MC alignment.
*/
npages = 0;
>> (PAGESHIFT - BDA_PAGESHIFT);
>> (PAGESHIFT - BDA_PAGESHIFT);
continue;
}
return (npages);
}
void
{
int c, nchunks;
for (c = 0; c < nchunks; c++) {
int cend;
break;
}
}
nchunks++;
}
void
{
npages = 0;
for (c = 0; c < o_nchunks; c++) {
if (p_npgs == 0)
continue;
continue;
}
/*
* Entire chunk goes away.
*/
} else {
}
} else {
}
} else {
} else {
/*
* Ugh, got to split a
* memchunk, we're going to
* need an extra one. It's
* gotten from the end.
*/
endp++;
n_nchunks++;
}
}
if (p_npgs == 0)
n_nchunks--;
}
/*
* There is a possibility we created holes in the memchunk list
* due to memchunks that went away. Before we can sort and
* coalesce we need to "pull up" the end of the memchunk list
* and get rid of any holes.
* endp = points to the last empty memchunk entry.
*/
register MemChunk_t *mmp;
continue;
mp--;
endp--;
}
}
/*
* Synchonize all memory attributes (currently just MC ADRs [aka ASR])
* with PDA representative values for the given board. A board value
* of (-1) indicates all boards.
*/
/*ARGSUSED*/
void
{
register int b;
for (b = 0; b < MAX_SYSBDS; b++) {
continue;
if (pda_board_present(ph, b)) {
}
if (board == b)
break;
}
}
void
{
if (amask)
if (dmask)
}
int
{
return (0);
}
/*
* Post2obp support functions below here. Internal to PDA module.
*
* p2o_update_checksum
*
* Calculate checksum for post2obp structure and insert it so
* when POST reads it he'll be happy.
*/
static void
{
}
static uint_t
{
int i, nchunks;
p2o_size = sizeof (post2obp_info_t)
csum = 0;
return (-csum);
}
/*
* Sort the mchunk list in ascending order based on the
* Memc_StartAddress field.
*
* disclosure: This is based on the qsort() library routine.
*/
static void
{
int nchunks;
/* ala qsort() */
j = lo;
}
if (j != (char *)base) {
for (i = (char *)base,
/* CSTYLED */
i < hi;) {
c = *j;
*j++ = *i;
*i++ = c;
}
}
/* CSTYLED */
do {
hi -= sizeof (MemChunk_t);
/* CSTYLED */
c = *lo;
for (i = j = lo;
(j -= sizeof (MemChunk_t)) >= hi;
i = j) {
*i = *j;
}
*i = c;
}
}
}
}
static void
{
MemChunk_t *mc;
int nchunks, new_nchunks;
/*
* if (nsize < overlap) then
* next entry fits within the current
* entry so no need to update size.
*/
}
new_nchunks--;
}
}
npages = 0;
for (i = 0; i < new_nchunks; i++)
}
/*
* Mapin the the cpu's post2obp structure.
*/
static post2obp_info_t *
cpu_p2o_mapin(int cpuid)
{
/*
* Construct the physical base address of the bbsram
* in PSI space associated with this cpu in question.
*/
if (cpu_p2o_offset == 0) {
"cpu_p2o_mapin:%d: sigb_postconfig == NULL\n",
cpuid);
return (NULL);
}
/*
* cpu_p2o_physaddr = Beginning of page containing p2o.
* cpu_p2o_offset = Offset within page where p2o starts.
*/
/*
* Map in the post2obp structure.
*/
}
static void
{
if (cpu_p2o_offset == 0) {
"cpu_p2o_mapout:%d: sigb_postconfig == NULL\n",
cpuid);
return;
}
if (cvaddr & MMU_PAGEOFFSET) {
"cpu_p2o_mapout:%d: cvaddr (0x%x) not on page "
"boundary\n",
return;
}
}