memlist.c revision 986fd29a0dc13f7608ef7f508f6e700bd7bc2720
/*
* 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/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>
#include <sys/prom_plat.h>
{
return (npages);
}
{
pgcnt_t allocpages = 0;
uint_t hole_allocated = 0;
uint_t i;
for (i = 0; i < nelems - 1; 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);
}
struct vnode prom_ppages;
static void
{
void kphysm_add();
}
static void
{
extern int kcage_on;
/*
* must break up any large pages that may have
* constituent pages being utilized for
* prom_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.
*/
/*
* vnode offsets on the prom_ppages vnode
* are page numbers (gack) for >32 bit
* physical memory machines.
*/
if (kcage_on) {
}
}
}
}
void
{
/*
* find diff item which may overlap with proto item
* if none, apply func to all of proto item
*/
continue;
}
continue;
}
/*
* here p_base < d_end
* there are 5 cases
*/
/*
* d_end
* d_base
* p_end
* p_base
*
* apply func to all of proto item
*/
continue;
}
/*
* ...
* d_base
* p_base
*
* normalize by applying func from p_base to d_base
*/
/*
* d_end
* p_end
* d_base
* p_base
*
* -or-
*
* d_end
* p_end
* p_base
* d_base
*
* any non-overlapping ranges applied above,
* so just continue
*/
continue;
}
/*
* p_end
* d_end
* d_base
* p_base
*
* -or-
*
* p_end
* d_end
* p_base
* d_base
*
* Find overlapping d_base..d_end ranges, and apply func
* where no overlap occurs. Stop when d_base is above
* p_end
*/
break;
} else
}
}
}
void
{
/*
* Find pages allocated via prom by looking for
* pages on orig, but no on new.
*/
/*
* Find pages free'd via prom by looking for
* pages on new, but not on orig.
*/
}
/*
* 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;
}
}
/*
* Copy a memory list. Used in startup() to copy boot's
* memory lists to the kernel.
*/
void
{
size_t i;
dst++;
} else {
dst++;
prev++;
}
}
}
static struct bootmem_props {
} bootmem_props[3];
#define PHYSINSTALLED 0
#define PHYSAVAIL 1
#define VIRTAVAIL 2
/*
* Comapct contiguous memory list elements
*/
static void
{
int i = 0, j;
for (;;) {
} else
i++;
break;
}
}
/*
* Sort prom memory lists into ascending order
*/
static void
{
int i, j, min;
struct prom_memlist temp;
min = i;
min = j;
}
if (i != min) {
/* Swap pmp[i] and pmp[min] */
}
}
}
static int max_bootlist_sz;
void
init_boot_memlists(void)
{
char *start;
struct bootmem_props *tmp;
/*
* These lists can get fragmented as the prom allocates
* memory, so generously round up.
*/
size *= 4;
/*
* Get physinstalled
*/
if (len == 0)
panic("no \"reg\" in /memory");
/*
* Start out giving each half of available space
*/
}
void
{
plen = prom_phys_avail_len();
if (plen == 0)
panic("no \"available\" in /memory");
vlen = prom_virt_avail_len();
if (vlen == 0)
panic("no \"available\" in /virtual-memory");
panic("ran out of prom_memlist space");
/*
* re-adjust ptrs if needed
*/
/* move virt avail up */
/* move virt avail down */
}
/* now we can retrieve the properties */
/* .. and sort them */
}
/*
* 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
{
}
}