1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 * Copyright 2026 Oxide Computer Company 25 */ 26 27 #ifndef _SYS_MEMLIST_H 28 #define _SYS_MEMLIST_H 29 30 /* 31 * Common memlist format, exported by boot. 32 */ 33 34 #include <sys/types.h> 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 /* 41 * Boot programs of version 4 and greater pass a linked list 42 * of struct memlist to the kernel. 43 */ 44 typedef struct memlist { 45 uint64_t ml_address; /* starting address of memory segment */ 46 uint64_t ml_size; /* size of same */ 47 struct memlist *ml_next; /* link to next list element */ 48 struct memlist *ml_prev; /* link to previous list element */ 49 } memlist_t; 50 51 struct memlist_pool; 52 typedef struct memlist_pool memlist_pool_t; 53 54 extern int address_in_memlist(struct memlist *, uint64_t, size_t); 55 extern size_t memlist_count(const struct memlist *); 56 57 /* 58 * phys_install is the pointer to the physical installed memory list 59 * which may change when memory is added or deleted. The functions 60 * memlist_read_lock() and memlist_read_unlock() should be used 61 * to protect reading this list. 62 */ 63 extern struct memlist *phys_install; 64 65 #if defined(__x86) 66 /* 67 * bios reserved memory 68 */ 69 extern struct memlist *bios_rsvd; 70 #endif 71 72 extern pgcnt_t num_phys_pages(); 73 74 #ifdef __cplusplus 75 } 76 #endif 77 78 #endif /* _SYS_MEMLIST_H */ 79