55 struct image *highest;
65 ( ( highest ==
NULL ) ||
67 highest->
data ) > 0 ) ) ) {
78 DBGC ( &
images,
"INITRD squashing %s [%#08lx,%#08lx)->" 79 "[%#08lx,%#08lx)\n", highest->
name,
85 highest->
data = current;
94 DBGC ( &
images,
"INITRD copying %s [%#08lx,%#08lx)->" 95 "[%#08lx,%#08lx)\n", initrd->
name,
102 initrd->
data = current;
123 DBGC ( &
images,
"INITRD swapping %s [%#08lx,%#08lx)<->[%#08lx,%#08lx) " 134 while ( len < high->
len ) {
137 frag_len = (
high->len -
len );
138 if ( frag_len > free_len )
187 if (
high->data == adjacent ) {
203 struct image *initrd;
211 DBGC ( &
images,
"INITRD %s at [%#08lx,%#08lx)\n",
242 DBGC ( &
images,
"INITRD region [%#08lx,%#08lx)\n",
281 return ( (
len < available ) ? 0 : -
ENOBUFS );
static void initrd_swap(struct image *low, struct image *high, userptr_t free, size_t free_len)
Swap position of two adjacent initrds.
static int initrd_swap_any(userptr_t free, size_t free_len)
Swap position of any two adjacent initrds not currently in the correct order.
uint32_t low
Low 16 bits of address.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
userptr_t data
Raw file image.
userptr_t initrd_bottom
Minimum address available for initrd.
unsigned long user_to_phys(userptr_t userptr, off_t offset)
Convert user pointer to physical address.
#define INITRD_MIN_FREE_LEN
Minimum free space required to reshuffle initrds.
void initrd_reshuffle(userptr_t bottom)
Reshuffle initrds into desired order at top of memory.
static userptr_t bottom
Bottom of heap (current lowest allocated block)
struct startup_fn startup_initrd __startup_fn(STARTUP_LATE)
initrd startup function
Access to external ("user") memory.
#define STARTUP_LATE
Late startup.
off_t userptr_sub(userptr_t userptr, userptr_t subtrahend)
Subtract user pointers.
A startup/shutdown function.
userptr_t userptr_add(userptr_t userptr, off_t offset)
Add offset to user pointer.
userptr_t initrd_top
Maximum address available for initrd.
uint32_t userptr_t
A pointer to a user buffer.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static void initrd_dump(void)
Dump initrd locations (for debug)
uint32_t high
High 32 bits of address.
#define for_each_image(image)
Iterate over all registered images.
static void(* free)(struct refcnt *refcnt))
size_t len
Length of raw file image.
static userptr_t top
Top of heap.
struct list_head images
List of registered images.
static void initrd_startup(void)
initrd startup function
Initial ramdisk (initrd) reshuffling.
#define INITRD_ALIGN
Alignment for CPIO archives within an initrd.
static userptr_t initrd_squash_high(userptr_t top)
Squash initrds as high as possible in memory.
#define ENOBUFS
No buffer space available.
int initrd_reshuffle_check(size_t len, userptr_t bottom)
Check that there is enough space to reshuffle initrds.
void * user_to_virt(userptr_t userptr, off_t offset)
Convert user pointer to virtual address.
size_t largest_memblock(userptr_t *start)
Find largest usable memory region.
void memmove_user(userptr_t dest, off_t dest_off, userptr_t src, off_t src_off, size_t len)
Copy data between user buffers, allowing for overlap.
#define NULL
NULL pointer (VOID *)
void memcpy_user(userptr_t dest, off_t dest_off, userptr_t src, off_t src_off, size_t len)
Copy data between user buffers.