svn commit: r219541 - in projects/altix/sys/boot/ia64: common efi ski

Marcel Moolenaar marcel at FreeBSD.org
Fri Mar 11 22:14:03 UTC 2011


Author: marcel
Date: Fri Mar 11 22:14:02 2011
New Revision: 219541
URL: http://svn.freebsd.org/changeset/base/219541

Log:
  Implement Pre-Boot Virtual Memory (PBVM). There's no 1-to-1 mapping
  between kernel virtual address and physical address anymore. This so
  that we can link the kernel at some virtual address without having
  to worry whether the corresponding physical memory exists and is
  available. The PBVM uses 64KB pages that are mapped to physical
  addresses using a page table. The page table is at least 1 EFI page
  in size, but can grow up to 1MB. This effectively gives us a memory
  size between 32MB and 8GB -- i.e. enough to load a DVD image if one
  wants to.
  
  The loader assigns physical memory based on the EFI memory map and
  makes sure that all physical memory is naturally aligned and a power
  of 2. At this time there's no consideration for allocating physical
  memory that is close to the BSP.
  
  The kernel is informed about the physical address of the page table
  and its size and can locate all PBVM pages through it.
  
  The loader does not wire the PBVM page table yet. Instead it wires
  all of the PBVM with a single translation. This is fine for now,
  but a follow-up commit will fix it. We cannot handle more than 32MB
  right now.
  
  Note that the loader will map as much of the loaded kernel and
  modules as possible, but it's up to the kernel to handle page faults
  for references that aren't mapped. To make that easier, the page
  table is mapped at a fixed virtual address.

Modified:
  projects/altix/sys/boot/ia64/common/bootinfo.c
  projects/altix/sys/boot/ia64/common/copy.c
  projects/altix/sys/boot/ia64/common/exec.c
  projects/altix/sys/boot/ia64/common/libia64.h
  projects/altix/sys/boot/ia64/efi/efimd.c
  projects/altix/sys/boot/ia64/ski/skimd.c

Modified: projects/altix/sys/boot/ia64/common/bootinfo.c
==============================================================================
--- projects/altix/sys/boot/ia64/common/bootinfo.c	Fri Mar 11 22:09:13 2011	(r219540)
+++ projects/altix/sys/boot/ia64/common/bootinfo.c	Fri Mar 11 22:14:02 2011	(r219541)
@@ -226,7 +226,7 @@ bi_copymodules(vm_offset_t addr)
  * - Module metadata are formatted and placed in kernel space.
  */
 int
-bi_load(struct preloaded_file *fp, uint64_t *bi_addr)
+ia64_bootinfo(struct preloaded_file *fp, struct bootinfo **res)
 {
 	struct bootinfo bi;
 	struct preloaded_file *xp;
@@ -234,7 +234,9 @@ bi_load(struct preloaded_file *fp, uint6
 	struct devdesc *rootdev;
 	char *rootdevname;
 	vm_offset_t addr, ssym, esym;
+	int error;
 
+	*res = NULL;
 	bzero(&bi, sizeof(struct bootinfo));
 	bi.bi_magic = BOOTINFO_MAGIC;
 	bi.bi_version = 1;
@@ -289,8 +291,28 @@ bi_load(struct preloaded_file *fp, uint6
 		bi.bi_envp = 0;
 	}
 
-	addr = (addr + PAGE_MASK) & ~PAGE_MASK;
+	addr = (addr + 15) & ~15;
 	bi.bi_kernend = addr;
 
-	return (ldr_bootinfo(&bi, bi_addr));
+	error = ia64_platform_bootinfo(&bi, res);
+	if (error)
+		return (error);
+
+	if (IS_LEGACY_KERNEL()) {
+		if (*res == NULL)
+			return (EDOOFUS);
+
+		bcopy(&bi, *res, sizeof(bi));
+		return (0);
+	}
+
+	bi.bi_pbvm_pgtbl = (uintptr_t)ia64_pgtbl;
+	bi.bi_pbvm_pgtblsz = ia64_pgtblsz;
+	ia64_copyin((void *)bi.bi_memmap, addr, bi.bi_memmap_size);
+	bi.bi_memmap = addr;
+	addr = (addr + bi.bi_memmap_size + 15) & ~15;
+	bi.bi_kernend = addr + sizeof(bi);	
+	ia64_copyin(&bi, addr, sizeof(bi));
+	*res = (void *)addr;
+	return (0);
 }

Modified: projects/altix/sys/boot/ia64/common/copy.c
==============================================================================
--- projects/altix/sys/boot/ia64/common/copy.c	Fri Mar 11 22:09:13 2011	(r219540)
+++ projects/altix/sys/boot/ia64/common/copy.c	Fri Mar 11 22:14:02 2011	(r219541)
@@ -32,17 +32,88 @@ __FBSDID("$FreeBSD$");
 
 #include "libia64.h"
 
+uint64_t *ia64_pgtbl;
+uint32_t ia64_pgtblsz;
+
+static int
+pgtbl_extend(u_int idx)
+{
+	uint64_t *pgtbl;
+	uint32_t pgtblsz;
+	u_int pot;
+
+	pgtblsz = (idx + 1) << 3;
+	if (pgtblsz < 4096)
+		pgtblsz = 4096;
+
+	/* Find the next higher power of 2. */
+	pgtblsz--;
+	for (pot = 1; pot < 32; pot <<= 1)
+		pgtblsz = pgtblsz | (pgtblsz >> pot);
+	pgtblsz++;
+
+	/* Allocate naturally aligned memory. */
+	pgtbl = (void *)ia64_platform_alloc(0, pgtblsz);
+	if (pgtbl == NULL)
+		return (ENOMEM);
+
+	/* Initialize new page table. */
+	if (ia64_pgtbl != NULL && ia64_pgtbl != pgtbl)
+		bcopy(ia64_pgtbl, pgtbl, ia64_pgtblsz);
+	bzero(pgtbl + (ia64_pgtblsz >> 3), pgtblsz - ia64_pgtblsz);
+
+	if (ia64_pgtbl != NULL && ia64_pgtbl != pgtbl)
+		ia64_platform_free(0, (uintptr_t)ia64_pgtbl, ia64_pgtblsz);
+
+	ia64_pgtbl = pgtbl;
+	ia64_pgtblsz = pgtblsz;
+	return (0);
+}
+
 static void *
 va2pa(vm_offset_t va, size_t *len)
 {
 	uint64_t pa;
+	u_int idx, ofs;
+	int error;
 
+	/* Backward compatibility. */
 	if (va >= IA64_RR_BASE(7)) {
 		pa = IA64_RR_MASK(va);
 		return ((void *)pa);
 	}
 
-	printf("\n%s: va=%lx, *len=%lx\n", __func__, va, *len);
+	if (va < IA64_PBVM_BASE) {
+		error = EINVAL;
+		goto fail;
+	}
+
+	idx = (va - IA64_PBVM_BASE) >> IA64_PBVM_PAGE_SHIFT;
+	if (idx >= (ia64_pgtblsz >> 3)) {
+		error = pgtbl_extend(idx);
+		if (error)
+			goto fail;
+	}
+
+	ofs = va & IA64_PBVM_PAGE_MASK;
+	pa = ia64_pgtbl[idx];
+	if (pa == 0) {
+		pa = ia64_platform_alloc(va - ofs, IA64_PBVM_PAGE_SIZE);
+		if (pa == 0) {
+			error = ENOMEM;
+			goto fail;
+		}
+		ia64_pgtbl[idx] = pa;
+	}
+	pa += ofs;
+
+	/* We can not cross page boundaries (in general). */
+	if (*len + ofs > IA64_PBVM_PAGE_SIZE)
+		*len = IA64_PBVM_PAGE_SIZE - ofs;
+
+	return ((void *)pa);
+
+ fail:
 	*len = 0;
 	return (NULL);
 }

Modified: projects/altix/sys/boot/ia64/common/exec.c
==============================================================================
--- projects/altix/sys/boot/ia64/common/exec.c	Fri Mar 11 22:09:13 2011	(r219540)
+++ projects/altix/sys/boot/ia64/common/exec.c	Fri Mar 11 22:14:02 2011	(r219541)
@@ -64,8 +64,8 @@ struct file_format *file_formats[] = {
 /*
  * Entered with psr.ic and psr.i both zero.
  */
-void
-enter_kernel(uint64_t start, uint64_t bi)
+static void
+enter_kernel(uint64_t start, struct bootinfo *bi)
 {
 
 	__asm __volatile("srlz.i;;");
@@ -84,55 +84,104 @@ enter_kernel(uint64_t start, uint64_t bi
 	/* NOTREACHED */
 }
 
-static int
-elf64_exec(struct preloaded_file *fp)
+static void
+mmu_setup_legacy(uint64_t entry)
 {
-	struct file_metadata	*md;
-	Elf_Ehdr		*hdr;
-	pt_entry_t		pte;
-	uint64_t		bi_addr;
-
-	md = file_findmetadata(fp, MODINFOMD_ELFHDR);
-	if (md == NULL)
-		return (EINVAL);
-	hdr = (Elf_Ehdr *)&(md->md_data);
-
-	bi_load(fp, &bi_addr);
-
-	printf("Entering %s at 0x%lx...\n", fp->f_name, hdr->e_entry);
-
-	ldr_enter(fp->f_name);
-
-	__asm __volatile("rsm psr.ic|psr.i;;");
-	__asm __volatile("srlz.i;;");
+	pt_entry_t pte;
 
 	/*
 	 * Region 6 is direct mapped UC and region 7 is direct mapped
 	 * WC. The details of this is controlled by the Alt {I,D}TLB
-	 * handlers. Here we just make sure that they have the largest 
+	 * handlers. Here we just make sure that they have the largest
 	 * possible page size to minimise TLB usage.
 	 */
 	ia64_set_rr(IA64_RR_BASE(6), (6 << 8) | (28 << 2));
 	ia64_set_rr(IA64_RR_BASE(7), (7 << 8) | (28 << 2));
+	__asm __volatile("srlz.i;;");
 
 	pte = PTE_PRESENT | PTE_MA_WB | PTE_ACCESSED | PTE_DIRTY |
 	    PTE_PL_KERN | PTE_AR_RWX | PTE_ED;
-	pte |= IA64_RR_MASK(hdr->e_entry) & PTE_PPN_MASK;
+	pte |= IA64_RR_MASK(entry) & PTE_PPN_MASK;
 
-	__asm __volatile("mov cr.ifa=%0" :: "r"(hdr->e_entry));
+	__asm __volatile("mov cr.ifa=%0" :: "r"(entry));
 	__asm __volatile("mov cr.itir=%0" :: "r"(28 << 2));
-	__asm __volatile("ptr.i %0,%1" :: "r"(hdr->e_entry), "r"(28<<2));
-	__asm __volatile("ptr.d %0,%1" :: "r"(hdr->e_entry), "r"(28<<2));
+	__asm __volatile("ptr.i %0,%1" :: "r"(entry), "r"(28<<2));
+	__asm __volatile("ptr.d %0,%1" :: "r"(entry), "r"(28<<2));
+	__asm __volatile("srlz.i;;");
+	__asm __volatile("itr.i itr[%0]=%1;;" :: "r"(0), "r"(pte));
+	__asm __volatile("srlz.i;;");
+	__asm __volatile("itr.d dtr[%0]=%1;;" :: "r"(0), "r"(pte));
+	__asm __volatile("srlz.i;;");
+}
+
+static void
+mmu_setup_paged(void)
+{
+	pt_entry_t pte;
+	u_int sz;
+
+	ia64_set_rr(IA64_RR_BASE(4), (4 << 8) | (IA64_PBVM_PAGE_SHIFT << 2));
+	__asm __volatile("srlz.i;;");
+
+	/*
+	 * Wire the PBVM page table.
+	 */
+
+	pte = PTE_PRESENT | PTE_MA_WB | PTE_ACCESSED | PTE_DIRTY |
+	    PTE_PL_KERN | PTE_AR_RWX | PTE_ED;
+	pte |= ia64_pgtbl[0] & PTE_PPN_MASK;
+
+	/*
+	 * Size of the translation. This should be the largest power of 2
+	 * smaller than the LVM in use.
+	 */
+	sz = 24;
+
+	__asm __volatile("mov cr.ifa=%0" :: "r"(IA64_PBVM_BASE));
+	__asm __volatile("mov cr.itir=%0" :: "r"(sz << 2));
+	__asm __volatile("ptr.i %0,%1" :: "r"(IA64_PBVM_BASE), "r"(sz << 2));
+	__asm __volatile("ptr.d %0,%1" :: "r"(IA64_PBVM_BASE), "r"(sz << 2));
 	__asm __volatile("srlz.i;;");
 	__asm __volatile("itr.i itr[%0]=%1;;" :: "r"(0), "r"(pte));
 	__asm __volatile("srlz.i;;");
 	__asm __volatile("itr.d dtr[%0]=%1;;" :: "r"(0), "r"(pte));
 	__asm __volatile("srlz.i;;");
+}
+
+static int
+elf64_exec(struct preloaded_file *fp)
+{
+	struct bootinfo *bi;
+	struct file_metadata *md;
+	Elf_Ehdr *hdr;
+	int error;
+
+	md = file_findmetadata(fp, MODINFOMD_ELFHDR);
+	if (md == NULL)
+		return (EINVAL);
+
+	error = ia64_bootinfo(fp, &bi);
+	if (error)
+		return (error);
+
+	hdr = (Elf_Ehdr *)&(md->md_data);
+	printf("Entering %s at 0x%lx...\n", fp->f_name, hdr->e_entry);
+
+	error = ia64_platform_enter(fp->f_name);
+	if (error)
+		return (error);
+
+	__asm __volatile("rsm psr.ic|psr.i;;");
+	__asm __volatile("srlz.i;;");
 
-	enter_kernel(hdr->e_entry, bi_addr);
+	if (IS_LEGACY_KERNEL())
+		mmu_setup_legacy(hdr->e_entry);
+	else
+		mmu_setup_paged();
 
+	enter_kernel(hdr->e_entry, bi);
 	/* NOTREACHED */
-	return (0);
+	return (EDOOFUS);
 }
 
 static int

Modified: projects/altix/sys/boot/ia64/common/libia64.h
==============================================================================
--- projects/altix/sys/boot/ia64/common/libia64.h	Fri Mar 11 22:09:13 2011	(r219540)
+++ projects/altix/sys/boot/ia64/common/libia64.h	Fri Mar 11 22:14:02 2011	(r219541)
@@ -31,23 +31,28 @@
 
 #include <bootstrap.h>
 #include <ia64/include/bootinfo.h>
+#include <ia64/include/vmparam.h>
 
-int bi_load(struct preloaded_file *, uint64_t *);
+#define	IS_LEGACY_KERNEL()	(ia64_pgtbl == NULL || ia64_pgtblsz == 0)
 
 /*
  * Portability functions provided by the loader
  * implementation specific to the platform.
  */
-uint64_t ldr_alloc(vm_offset_t);
-int ldr_bootinfo(struct bootinfo *, uint64_t *);
-int ldr_enter(const char *);
+vm_paddr_t ia64_platform_alloc(vm_offset_t, vm_size_t);
+void ia64_platform_free(vm_offset_t, vm_paddr_t, vm_size_t);
+int ia64_platform_bootinfo(struct bootinfo *, struct bootinfo **);
+int ia64_platform_enter(const char *);
 
 /*
  * Functions and variables provided by the ia64 common code
  * and shared by all loader implementations.
  */
+extern uint64_t *ia64_pgtbl;
+extern uint32_t ia64_pgtblsz;
 
 int ia64_autoload(void);
+int ia64_bootinfo(struct preloaded_file *, struct bootinfo **);
 
 ssize_t ia64_copyin(const void *, vm_offset_t, size_t);
 ssize_t ia64_copyout(vm_offset_t, void *, size_t);

Modified: projects/altix/sys/boot/ia64/efi/efimd.c
==============================================================================
--- projects/altix/sys/boot/ia64/efi/efimd.c	Fri Mar 11 22:09:13 2011	(r219540)
+++ projects/altix/sys/boot/ia64/efi/efimd.c	Fri Mar 11 22:14:02 2011	(r219541)
@@ -45,26 +45,147 @@ static EFI_GUID fpswa_guid = EFI_INTEL_F
 
 static EFI_GUID hcdp_guid = HCDP_TABLE_GUID;
 
+static EFI_MEMORY_DESCRIPTOR *memmap;
+static UINTN memmapsz;
 static UINTN mapkey;
+static UINTN descsz;
+static UINT32 descver;
 
-uint64_t
-ldr_alloc(vm_offset_t va)
+#define	IA64_EFI_CHUNK_SIZE	(32 * 1048576)
+static vm_paddr_t ia64_efi_chunk;
+
+#define	IA64_EFI_PGTBLSZ_MAX	1048576
+static vm_paddr_t ia64_efi_pgtbl;
+static vm_size_t ia64_efi_pgtblsz;
+
+/* Don't allocate memory below the boundary */
+#define	IA64_EFI_ALLOC_BOUNDARY	1048576
+
+static int
+ia64_efi_memmap_update(void)
+{
+	EFI_STATUS status;
+
+	if (memmap != NULL) {
+		free(memmap);
+		memmap = NULL;
+	}
+
+	memmapsz = 0;
+	BS->GetMemoryMap(&memmapsz, NULL, &mapkey, &descsz, &descver);
+	if (memmapsz == 0)
+		return (FALSE);
+	memmap = malloc(memmapsz);
+	if (memmap == NULL)
+		return (FALSE);
+
+	status = BS->GetMemoryMap(&memmapsz, memmap, &mapkey, &descsz,
+	    &descver);
+	if (EFI_ERROR(status)) {
+		free(memmap);
+		memmap = NULL;
+		return (FALSE);
+	}
+
+	return (TRUE);
+}
+
+static vm_paddr_t
+ia64_efi_alloc(vm_size_t sz)
 {
+	EFI_PHYSICAL_ADDRESS pa;
+	EFI_MEMORY_DESCRIPTOR *mm;
+	uint8_t *mmiter, *mmiterend;
+	vm_size_t memsz;
+	UINTN npgs;
+	EFI_STATUS status;
+
+	/* We can't allocate less than a page */
+	if (sz < EFI_PAGE_SIZE)
+		return (0);
+
+	/* The size must be a power of 2. */
+	if (sz & (sz - 1))
+		return (0);
+
+	if (!ia64_efi_memmap_update())
+		return (0);
+
+	mmiter = (void *)memmap;
+	mmiterend = mmiter + memmapsz;
+	for (; mmiter < mmiterend; mmiter += descsz) {
+		mm = (void *)mmiter;
+		if (mm->Type != EfiConventionalMemory)
+			continue;
+		memsz = mm->NumberOfPages * EFI_PAGE_SIZE;
+		if (mm->PhysicalStart + memsz <= IA64_EFI_ALLOC_BOUNDARY)
+			continue;
+		/*
+		 * XXX We really should make sure the memory is local to the
+		 * BSP.
+		 */
+		pa = (mm->PhysicalStart < IA64_EFI_ALLOC_BOUNDARY) ?
+		    IA64_EFI_ALLOC_BOUNDARY : mm->PhysicalStart;
+		pa  = (pa + sz - 1) & ~(sz - 1);
+		if (pa + sz > mm->PhysicalStart + memsz)
+			continue;
+
+		npgs = EFI_SIZE_TO_PAGES(sz);
+		status = BS->AllocatePages(AllocateAddress, EfiLoaderData,
+		    npgs, &pa);
+		if (!EFI_ERROR(status))
+			return (pa);
+	}
 
+	printf("%s: unable to allocate %lx bytes\n", __func__, sz);
 	return (0);
 }
 
+vm_paddr_t
+ia64_platform_alloc(vm_offset_t va, vm_size_t sz)
+{
+
+	if (va == 0) {
+		/* Page table itself. */
+		if (sz > IA64_EFI_PGTBLSZ_MAX)
+			return (0);
+		if (ia64_efi_pgtbl == 0)
+			ia64_efi_pgtbl = ia64_efi_alloc(IA64_EFI_PGTBLSZ_MAX);
+		if (ia64_efi_pgtbl != 0)
+			ia64_efi_pgtblsz = sz;
+		return (ia64_efi_pgtbl);
+	} else if (va < IA64_PBVM_BASE) {
+		/* Should not happen. */
+		return (0);
+	}
+
+	/* Loader virtual memory page. */
+	va -= IA64_PBVM_BASE;
+
+	/* Allocate a big chunk that can be wired with a single PTE. */
+	if (ia64_efi_chunk == 0)
+		ia64_efi_chunk = ia64_efi_alloc(IA64_EFI_CHUNK_SIZE);
+	if (va < IA64_EFI_CHUNK_SIZE)
+		return (ia64_efi_chunk + va);
+
+	/* Allocate a page at a time when we go beyond the chunk. */
+	return (ia64_efi_alloc(sz));
+}
+
+void
+ia64_platform_free(vm_offset_t va, vm_paddr_t pa, vm_size_t sz)
+{
+
+	BS->FreePages(pa, sz >> EFI_PAGE_SHIFT);
+}
+
 int
-ldr_bootinfo(struct bootinfo *bi, uint64_t *bi_addr)
+ia64_platform_bootinfo(struct bootinfo *bi, struct bootinfo **res)
 {
 	VOID *fpswa;
-	EFI_MEMORY_DESCRIPTOR *mm;
-	EFI_PHYSICAL_ADDRESS addr;
 	EFI_HANDLE handle;
 	EFI_STATUS status;
-	size_t bisz;
-	UINTN mmsz, pages, sz;
-	UINT32 mmver;
+	UINTN sz;
 
 	bi->bi_systab = (uint64_t)ST;
 	bi->bi_hcdp = (uint64_t)efi_get_table(&hcdp_guid);
@@ -75,55 +196,22 @@ ldr_bootinfo(struct bootinfo *bi, uint64
 		status = BS->HandleProtocol(handle, &fpswa_guid, &fpswa);
 	bi->bi_fpswa = (status == 0) ? (uint64_t)fpswa : 0;
 
-	bisz = (sizeof(struct bootinfo) + 0x0f) & ~0x0f;
-
-	/*
-	 * Allocate enough pages to hold the bootinfo block and the memory
-	 * map EFI will return to us. The memory map has an unknown size,
-	 * so we have to determine that first. Note that the AllocatePages
-	 * call can itself modify the memory map, so we have to take that
-	 * into account as well. The changes to the memory map are caused
-	 * by splitting a range of free memory into two (AFAICT), so that
-	 * one is marked as being loader data.
-	 */
-	sz = 0;
-	BS->GetMemoryMap(&sz, NULL, &mapkey, &mmsz, &mmver);
-	sz += mmsz;
-	sz = (sz + 15) & ~15;
-	pages = EFI_SIZE_TO_PAGES(sz + bisz);
-	status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData, pages,
-	    &addr);
-	if (EFI_ERROR(status)) {
-		printf("%s: AllocatePages() returned 0x%lx\n", __func__,
-		    (long)status);
+	if (!ia64_efi_memmap_update())
 		return (ENOMEM);
-	}
 
-	/*
-	 * Read the memory map and stash it after bootinfo. Align the
-	 * memory map on a 16-byte boundary (the bootinfo block is page
-	 * aligned).
-	 */
-	*bi_addr = addr;
-	mm = (void *)(addr + bisz);
-	sz = (EFI_PAGE_SIZE * pages) - bisz;
-	status = BS->GetMemoryMap(&sz, mm, &mapkey, &mmsz, &mmver);
-	if (EFI_ERROR(status)) {
-		printf("%s: GetMemoryMap() returned 0x%lx\n", __func__,
-		    (long)status);
-		return (EINVAL);
-	}
-	bi->bi_memmap = (uint64_t)mm;
-	bi->bi_memmap_size = sz;
-	bi->bi_memdesc_size = mmsz;
-	bi->bi_memdesc_version = mmver;
+	bi->bi_memmap = (uint64_t)memmap;
+	bi->bi_memmap_size = memmapsz;
+	bi->bi_memdesc_size = descsz;
+	bi->bi_memdesc_version = descver;
+
+	if (IS_LEGACY_KERNEL())
+		*res = malloc(sizeof(**res));
 
-	bcopy(bi, (void *)(*bi_addr), sizeof(*bi));
 	return (0);
 }
 
 int
-ldr_enter(const char *kernel)
+ia64_platform_enter(const char *kernel)
 {
 	EFI_STATUS status;
 

Modified: projects/altix/sys/boot/ia64/ski/skimd.c
==============================================================================
--- projects/altix/sys/boot/ia64/ski/skimd.c	Fri Mar 11 22:09:13 2011	(r219540)
+++ projects/altix/sys/boot/ia64/ski/skimd.c	Fri Mar 11 22:14:02 2011	(r219541)
@@ -33,24 +33,31 @@ __FBSDID("$FreeBSD$");
 
 #include "libski.h"
 
-#define	PHYS_START	(4L*1024*1024*1024)
-#define	PHYS_SIZE	(64L*1024*1024 - 4L*1024)
-
 extern void acpi_stub_init(void);
 extern void efi_stub_init(struct bootinfo *);
 extern void sal_stub_init(void);
 
-uint64_t
-ldr_alloc(vm_offset_t va)
+vm_paddr_t
+ia64_platform_alloc(vm_offset_t va, vm_size_t sz __unused)
 {
+	vm_paddr_t pa;
+
+	if (va == 0)
+		pa = 1024 * 1024;
+	else
+		pa = (va - IA64_PBVM_BASE) + (64 * 1024 * 1024);
 
-	if (va >= PHYS_SIZE)
-		return (0);
-	return (va + PHYS_START);
+	return (pa);
+}
+
+void
+ia64_platform_free(vm_offset_t va __unused, vm_paddr_t pa __unused,
+    vm_size_t sz __unused)
+{
 }
 
 int
-ldr_bootinfo(struct bootinfo *bi, uint64_t *bi_addr)
+ia64_platform_bootinfo(struct bootinfo *bi, struct bootinfo **res)
 {
 	static struct bootinfo bootinfo;
 
@@ -58,17 +65,16 @@ ldr_bootinfo(struct bootinfo *bi, uint64
 	sal_stub_init();
 	acpi_stub_init();
 
-	*bi_addr = (uint64_t)(&bootinfo);
-	bootinfo = *bi;
+	*res = &bootinfo;
 	return (0);
 }
 
 int
-ldr_enter(const char *kernel)
+ia64_platform_enter(const char *kernel)
 {
 
 	while (*kernel == '/')
 		kernel++;
-        ssc(0, (uint64_t)kernel, 0, 0, SSC_LOAD_SYMBOLS);
+	ssc(0, (uint64_t)kernel, 0, 0, SSC_LOAD_SYMBOLS);
 	return (0);
 }


More information about the svn-src-projects mailing list