summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/initrd.h
blob: 50788597bb8c9c555789665f408795187a96a59e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef _IPXE_INITRD_H
#define _IPXE_INITRD_H

/** @file
 *
 * Initial ramdisk (initrd) reshuffling
 *
 */

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
FILE_SECBOOT ( PERMITTED );

#include <stdint.h>
#include <ipxe/memmap.h>

/** Initial ramdisk chunk alignment */
#define INITRD_ALIGN 4096

extern void initrd_reshuffle ( void );
extern int initrd_region ( size_t len, struct memmap_region *region );
extern size_t initrd_load_all ( void *address );

/**
 * Align initrd length
 *
 * @v len		Length
 * @ret len		Aligned length
 */
static inline __attribute__ (( always_inline )) size_t
initrd_align ( size_t len ) {

	return ( ( len + INITRD_ALIGN - 1 ) & ~( INITRD_ALIGN - 1 ) );
}

/**
 * Get required length for initrds
 *
 * @ret len		Required length
 */
static inline __attribute__ (( always_inline )) size_t
initrd_len ( void ) {

	return initrd_load_all ( NULL );
}

#endif /* _IPXE_INITRD_H */