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
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
12
13#include <stdint.h>
14#include <ipxe/memmap.h>
15
16/** Initial ramdisk chunk alignment */
17#define INITRD_ALIGN 4096
18
19extern void initrd_reshuffle ( void );
20extern int initrd_region ( size_t len, struct memmap_region *region );
21extern size_t initrd_load_all ( void *address );
22
23/**
24 * Align initrd length
25 *
26 * @v len Length
27 * @ret len Aligned length
28 */
29static inline __attribute__ (( always_inline )) size_t
30initrd_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 */
40static inline __attribute__ (( always_inline )) size_t
41initrd_len ( void ) {
42
43 return initrd_load_all ( NULL );
44}
45
46#endif /* _IPXE_INITRD_H */
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
ring len
Length.
Definition dwmac.h:226
uint64_t address
Base address.
Definition ena.h:13
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
#define __attribute__(x)
Definition compiler.h:10
System memory map.
int initrd_region(size_t len, struct memmap_region *region)
Calculate post-reshuffle initrd load region.
Definition initrd.c:354
static size_t initrd_len(void)
Get required length for initrds.
Definition initrd.h:41
void initrd_reshuffle(void)
Reshuffle initrds into desired order at top of memory.
Definition initrd.c:229
#define INITRD_ALIGN
Initial ramdisk chunk alignment.
Definition initrd.h:17
size_t initrd_load_all(void *address)
Load all initrds.
Definition initrd.c:317
static size_t initrd_align(size_t len)
Align initrd length.
Definition initrd.h:30
A memory region descriptor.
Definition memmap.h:49