39 #define UNOWHERE ( ~UNULL ) 54 unsigned int new_pages, old_pages;
68 &phys_addr ) ) != 0 ) {
70 DBG (
"EFI could not allocate %d pages: %s\n",
77 &new_size,
sizeof ( new_size ) );
78 DBG (
"EFI allocated %d pages at %llx\n",
79 new_pages, phys_addr );
87 if ( old_ptr && ( old_ptr !=
UNOWHERE ) ) {
89 sizeof ( old_size ) );
91 ( (old_size < new_size) ? old_size : new_size ));
94 if ( ( efirc = bs->
FreePages ( phys_addr, old_pages ) ) != 0 ){
96 DBG (
"EFI could not free %d pages at %llx: %s\n",
102 DBG (
"EFI freed %d pages at %llx\n", old_pages, phys_addr );
#define UNOWHERE
Equivalent of NOWHERE for user pointers.
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
struct arbelprm_rc_send_wqe rc
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
static __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
unsigned long user_to_phys(userptr_t userptr, off_t offset)
Convert user pointer to physical address.
userptr_t phys_to_user(unsigned long phys_addr)
Convert physical address to user pointer.
UINT64 EFI_PHYSICAL_ADDRESS
64-bit physical memory address.
PROVIDE_UMALLOC(efi, urealloc, efi_urealloc)
uint32_t userptr_t
A pointer to a user buffer.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
userptr_t urealloc(userptr_t userptr, size_t new_size)
Reallocate external memory.
char * strerror(int errno)
Retrieve string representation of error number.
static __always_inline void copy_to_user(userptr_t dest, off_t dest_off, const void *src, size_t len)
Copy data to user buffer.
#define EFI_SIZE_TO_PAGES(Size)
Macro that converts a size, in bytes, to a number of EFI_PAGESs.
static userptr_t efi_urealloc(userptr_t old_ptr, size_t new_size)
Reallocate external memory.
EFI_ALLOCATE_PAGES AllocatePages
#define UNULL
Equivalent of NULL for user pointers.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
Allocate any available range of pages that satisfies the request.
EFI_SYSTEM_TABLE * efi_systab
The data portions of a loaded Boot Serves Driver, and the default data allocation type used by a Boot...
#define DBG(...)
Print a debugging message.
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.