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 FILE_SECBOOT ( PERMITTED );
12 
13 #include <stdint.h>
14 #include <ipxe/memmap.h>
15 
16 /** Initial ramdisk chunk alignment */
17 #define INITRD_ALIGN 4096
18 
19 extern void initrd_reshuffle ( void );
20 extern int initrd_region ( size_t len, struct memmap_region *region );
21 extern size_t initrd_load_all ( void *address );
22 
23 /**
24  * Align initrd length
25  *
26  * @v len Length
27  * @ret len Aligned length
28  */
29 static inline __attribute__ (( always_inline )) size_t
30 initrd_align ( size_t len ) {
31 
32  return ( ( len + INITRD_ALIGN - 1 ) & ~( INITRD_ALIGN - 1 ) );
33 }
34 
35 /**
36  * Get required length for initrds
37  *
38  * @ret len Required length
39  */
40 static inline __attribute__ (( always_inline )) size_t
41 initrd_len ( void ) {
42 
43  return initrd_load_all ( NULL );
44 }
45 
46 #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:30
#define INITRD_ALIGN
Initial ramdisk chunk alignment.
Definition: initrd.h:17
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:41
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:49
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
System memory map.
FILE_SECBOOT(PERMITTED)