o Introduce efimd_va2pa() to translate addresses in efi_copy{in|out}()

and efi_readin(). This removes MD code from copy.c.
o  Don't unconditionally add pal.S to SRCS. It's specific to ia64.
This commit is contained in:
Marcel Moolenaar 2004-11-28 00:30:22 +00:00
parent b81a1f533f
commit f3beed66fa
4 changed files with 31 additions and 55 deletions

View File

@ -34,5 +34,7 @@ extern EFI_RUNTIME_SERVICES *RS;
void *efi_get_table(EFI_GUID *tbl);
void efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table);
EFI_PHYSICAL_ADDRESS efimd_va2pa(EFI_VIRTUAL_ADDRESS);
EFI_STATUS main(int argc, CHAR16 *argv[]);
void exit(EFI_STATUS status);

View File

@ -2,25 +2,25 @@
.PATH: ${.CURDIR}/../../../${MACHINE_ARCH}/${MACHINE_ARCH}
LIB= efi
LIB= efi
INTERNALLIB=
SRCS= libefi.c efi_console.c time.c copy.c devicename.c module.c
SRCS+= delay.c efifs.c efinet.c elf_freebsd.c bootinfo.c pal.S
SRCS= bootinfo.c copy.c delay.c devicename.c efi_console.c efifs.c efinet.c \
elf_freebsd.c libefi.c module.c time.c
.if ${MACHINE_ARCH} == "ia64"
SRCS+= efifpswa.c
SRCS+= efifpswa.c pal.S
.endif
CFLAGS+= -I${.CURDIR}/../include
CFLAGS+= -I${.CURDIR}/../include/${MACHINE_ARCH}
CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
CFLAGS+= -I${.CURDIR}/../include
CFLAGS+= -I${.CURDIR}/../include/${MACHINE_ARCH}
CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
# Pick up the bootstrap header for some interface items
CFLAGS+= -I${.CURDIR}/../../common
CFLAGS+= -I${.CURDIR}/../../common
.if defined(BOOT_DISK_DEBUG)
# Make the disk code more talkative
.if defined(BOOT_DISK_DEBUG)
CFLAGS+= -DDISK_DEBUG
.endif

View File

@ -27,42 +27,29 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
/*
* MD primitives supporting placement of module data
*/
#include <stand.h>
#include <efi.h>
#include <efilib.h>
#include <machine/ia64_cpu.h>
#include <machine/vmparam.h>
#include <stand.h>
int
efi_copyin(void *src, vm_offset_t dest, size_t len)
efi_copyin(void *src, vm_offset_t va, size_t len)
{
EFI_PHYSICAL_ADDRESS p = IA64_RR_MASK(dest);
#if 0
BS->AllocatePages(AllocateAddress, EfiRuntimeServicesData,
len >> 12, &p);
#endif
bcopy(src, (void*) p, len);
bcopy(src, (void *)efimd_va2pa(va), len);
return (len);
}
int
efi_copyout(vm_offset_t src, void *dest, size_t len)
efi_copyout(vm_offset_t va, void *dst, size_t len)
{
bcopy((void*) IA64_RR_MASK(src), dest, len);
bcopy((void *)efimd_va2pa(va), dst, len);
return (len);
}
int
efi_readin(int fd, vm_offset_t dest, size_t len)
efi_readin(int fd, vm_offset_t va, size_t len)
{
EFI_PHYSICAL_ADDRESS p = IA64_RR_MASK(dest);
#if 0
BS->AllocatePages(AllocateAddress, EfiRuntimeServicesData,
len >> 12, &p);
#endif
return (read(fd, (void*) p, len));
return (read(fd, (void *)efimd_va2pa(va), len));
}

View File

@ -27,42 +27,29 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
/*
* MD primitives supporting placement of module data
*/
#include <stand.h>
#include <efi.h>
#include <efilib.h>
#include <machine/ia64_cpu.h>
#include <machine/vmparam.h>
#include <stand.h>
int
efi_copyin(void *src, vm_offset_t dest, size_t len)
efi_copyin(void *src, vm_offset_t va, size_t len)
{
EFI_PHYSICAL_ADDRESS p = IA64_RR_MASK(dest);
#if 0
BS->AllocatePages(AllocateAddress, EfiRuntimeServicesData,
len >> 12, &p);
#endif
bcopy(src, (void*) p, len);
bcopy(src, (void *)efimd_va2pa(va), len);
return (len);
}
int
efi_copyout(vm_offset_t src, void *dest, size_t len)
efi_copyout(vm_offset_t va, void *dst, size_t len)
{
bcopy((void*) IA64_RR_MASK(src), dest, len);
bcopy((void *)efimd_va2pa(va), dst, len);
return (len);
}
int
efi_readin(int fd, vm_offset_t dest, size_t len)
efi_readin(int fd, vm_offset_t va, size_t len)
{
EFI_PHYSICAL_ADDRESS p = IA64_RR_MASK(dest);
#if 0
BS->AllocatePages(AllocateAddress, EfiRuntimeServicesData,
len >> 12, &p);
#endif
return (read(fd, (void*) p, len));
return (read(fd, (void *)efimd_va2pa(va), len));
}