pci_memlist.c revision 05f867c35e2c26a9bbb8c217695d6a71dfc44f35
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* code, kernel DR, and busra stuff.
*
* NOTE: We are only using the next-> link. The prev-> link is
* not used in the implementation.
*/
#include <sys/pci_impl.h>
extern int pci_boot_debug;
void
{
while (listp) {
dprintf("(0x%x%x, 0x%x%x)",
}
}
struct memlist *
{
KM_SLEEP));
}
void
{
}
void
{
while (next) {
}
*list = 0;
}
/* insert in the order of addresses */
void
{
int merge_left, merge_right;
/* find the location in list */
}
if (merge_left && merge_right) {
return;
}
if (merge_left) {
return;
}
if (merge_right) {
return;
}
entry = memlist_alloc();
if (prev == 0) {
} else {
}
}
/*
* Delete memory chunks, assuming list sorted by address
*/
int
{
/* a remove can't be done on an empty list */
/* find the location in list */
}
dprintf("memlist_remove: addr 0x%x%x, size 0x%x%x"
" not contained in list\n",
return (-1);
}
entry = memlist_alloc();
}
/* addr == next->address */
} else {
/* the entire chunk is deleted */
if (prev == 0) {
} else {
}
}
return (0);
}
/*
* find and claim a memory chunk of given size, first fit
*/
{
/* find the chunk with sufficient size */
while (next) {
if (delta != 0)
else
break;
}
if (next == 0)
return (0); /* Not found */
if (delta)
return (paddr);
}
/*
* find and claim a memory chunk of given size, starting
* at a specified address
*/
{
/* find the chunk starting at 'address' */
}
if (next == 0)
return (0); /* Not found */
if (delta != 0)
else
return (0); /* unsufficient size */
if (delta)
return (paddr);
}
/*
* Merge memlist src into memlist dest
*/
void
{
while (head) {
}
*src = 0;
}
/*
* Make a copy of memlist
*/
struct memlist *
{
while (listp) {
if (prev)
else
}
return (head);
}
int
{
int count = 0;
while (listp) {
count++;
}
return (count);
}