iPXE
initrd.h
Go to the documentation of this file.
1 #ifndef _IPXE_INITRD_H
2 #define _IPXE_INITRD_H
3 
4 /** @file
5  *
6  * Initial ramdisk (initrd) reshuffling
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <stdint.h>
13 #include <ipxe/memmap.h>
14 
15 /** Initial ramdisk chunk alignment */
16 #define INITRD_ALIGN 4096
17 
18 extern void initrd_reshuffle ( void );
19 extern int initrd_region ( size_t len, struct memmap_region *region );
20 extern size_t initrd_load_all ( void *address );
21 
22 /**
23  * Align initrd length
24  *
25  * @v len Length
26  * @ret len Aligned length
27  */
28 static inline __attribute__ (( always_inline )) size_t
29 initrd_align ( size_t len ) {
30 
31  return ( ( len + INITRD_ALIGN - 1 ) & ~( INITRD_ALIGN - 1 ) );
32 }
33 
34 /**
35  * Get required length for initrds
36  *
37  * @ret len Required length
38  */
39 static inline __attribute__ (( always_inline )) size_t
40 initrd_len ( void ) {
41 
42  return initrd_load_all ( NULL );
43 }
44 
45 #endif /* _IPXE_INITRD_H */
#define __attribute__(x)
Definition: compiler.h:10
uint64_t address
Base address.
Definition: ena.h:24
static size_t initrd_align(size_t len)
Align initrd length.
Definition: initrd.h:29
#define INITRD_ALIGN
Initial ramdisk chunk alignment.
Definition: initrd.h:16
int initrd_region(size_t len, struct memmap_region *region)
Calculate post-reshuffle initrd load region.
Definition: initrd.c:354
ring len
Length.
Definition: dwmac.h:231
void initrd_reshuffle(void)
Reshuffle initrds into desired order at top of memory.
Definition: initrd.c:229
static size_t initrd_len(void)
Get required length for initrds.
Definition: initrd.h:40
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
size_t initrd_load_all(void *address)
Load all initrds.
Definition: initrd.c:317
A memory region descriptor.
Definition: memmap.h:48
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
System memory map.