memlist.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/sysmacros.h>
#include <sys/archsystm.h>
#include <sys/machsystm.h>
#include <sys/ucontext.h>
#include <sys/privregs.h>
#include <vm/seg_kmem.h>
#include <sys/tuneable.h>
#include <sys/bootconf.h>
#include <sys/memlist_plat.h>
#include <sys/systeminfo.h>
/*
* Count the number of available pages and the number of
* chunks in the list of available memory.
*/
void
int *memblocks)
{
size_t i;
*npages = 0;
*memblocks = 0;
for (i = 0; i < nelems; i += 2) {
(*memblocks)++;
}
}
{
pgcnt_t allocpages = 0;
uint_t hole_allocated = 0;
uint_t i;
/*
* Notes:
*
* represented by [spec_hole_start, spec_hole_end);
* pre-allocation is done to make this range unavailable
* for any allocation.
*
* (2) OBP on starcat always pre-allocates the hole similar to
*
* (3) OBP on serengeti does _not_ pre-allocate the hole.
*
* (4) OBP ignores Spitfire Errata #21; i.e. it does _not_
* fill up or pre-allocate an additional 4GB on both sides
* of the hole.
*
* (5) kernel virtual range [spec_hole_start, spec_hole_end)
* is _not_ used on any platform including those with
* UltraSPARC III where there is no hole.
*
* Algorithm:
*
* Check if range [spec_hole_start, spec_hole_end) is
* pre-allocated by OBP; if so, subtract that range from
* allocpages.
*/
hole_allocated = 1;
}
if (hole_allocated)
return (allocpages);
}
/*
* Returns the max contiguous physical memory present in the
* memlist "physavail".
*/
{
}
return (max_size);
}
/*
* Copy boot's physavail list deducting memory at "start"
* for "size" bytes.
*/
int
{
int deducted = 0;
size_t i;
for (i = 0; i < nelems; i += 2) {
/* deducted range in this chunk */
deducted = 1;
/* abuts start of chunk */
/* is equal to the chunk */
continue;
/* abuts end of chunk */
} else {
/* in the middle of the chunk */
dst++;
} else {
dst++;
prev++;
}
}
dst++;
} else {
dst++;
prev++;
}
} else {
dst++;
} else {
dst++;
prev++;
}
}
}
return (deducted);
}
struct vnode prom_ppages;
/*
* Find the pages allocated by the prom by diffing the original
* phys_avail list and the current list. In the difference, the
* pages not locked belong to the PROM. (The kernel has already locked
* and removed all the pages it has allocated from the freelist, this
* routine removes the remaining "free" pages that really belong to the
* PROM and hashs them in on the 'prom_pages' vnode.)
*/
void
{
extern int kcage_on;
continue;
}
/*
* Loop through the old list looking to
* see if each page is still in the new one.
* If a page is not in the new list then we
* check to see if it locked permanently.
* If so, the kernel allocated and owns it.
* If not, then the prom must own it. We
* remove any pages found to owned by the prom
* from the freelist.
*/
continue;
/*
* must break up any large pages that may have
* constituent pages being utilized for
* BOP_ALLOC()'s. page_reclaim() can't handle
* large pages.
*/
/*
* Ahhh yes, a prom page,
* suck it off the freelist,
* lock it, and hashin on prom_pages vp.
*/
/*
* XXX vnode offsets on the prom_ppages vnode
* are page numbers (gack) for >32 bit
* physical memory machines.
*/
if (kcage_on) {
}
}
}
}
}
/*
* Find the page number of the highest installed physical
* page and the number of pages installed (one cannot be
* calculated from the other because memory isn't necessarily
* contiguous).
*/
void
{
size_t i;
for (i = 0; i < nelems; i += 2) {
}
}
/*
* Copy a memory list. Used in startup() to copy boot's
* memory lists to the kernel.
*/
void
{
size_t i;
for (i = 0; i < nelems; i += 2) {
dst++;
} else {
dst++;
prev++;
}
}
}
static struct bootmem_props {
char *name;
} bootmem_props[] = {
{ "phys-installed", NULL, 0, 0 },
{ "phys-avail", NULL, 0, 0 },
{ "virt-avail", NULL, 0, 0 },
};
#define PHYSINSTALLED 0
#define PHYSAVAIL 1
#define VIRTAVAIL 2
void
{
int align = BO_ALIGN_L3;
if (len == 0) {
panic("cannot get length of \"%s\" property",
}
continue;
/* need to allocate more */
}
panic("cannot allocate %d bytes for \"%s\" property",
}
/*
* take the most current snapshot we can by calling mem-update
*/
/* did the sizes change? */
/* ick. Free them all and try again */
}
goto tryagain;
}
}
/* now we can retrieve the properties */
panic("cannot retrieve \"%s\" property",
}
}
}
/*
* Find the page number of the highest installed physical
* page and the number of pages installed (one cannot be
* calculated from the other because memory isn't necessarily
* contiguous).
*/
void
{
}
}