Imported Upstream version 3.12
[debian/elilo] / ia64 / system.c
index 388d435cb72b7e1cf3f788e43221c37e88558348..2530a3b513544af00cf436ff21f177327a07ddd7 100644 (file)
@@ -39,7 +39,7 @@ extern loader_ops_t plain_loader, gzip_loader;
  * IA-64 specific boot paramters initialization routine
  */
 INTN
-sysdeps_create_boot_params(boot_params_t *bp, CHAR8 *cmdline, memdesc_t *initrd, UINTN *cookie)
+sysdeps_create_boot_params(boot_params_t *bp, CHAR8 *cmdline, memdesc_t *initrd, memdesc_t *vmcode, UINTN *cookie)
 {
        UINTN cols, rows;
        SIMPLE_TEXT_OUTPUT_INTERFACE *conout;
@@ -55,7 +55,7 @@ sysdeps_create_boot_params(boot_params_t *bp, CHAR8 *cmdline, memdesc_t *initrd,
 
        if (get_memmap(&mdesc) == -1) return -1;
 
-       DBG_PRT((L"Got memory map @ 0x%lx (%d bytes)", mdesc.md, mdesc.map_size));
+       DBG_PRT((L"Got memory map @ 0x%lx (%d bytes) with key %d", mdesc.md, mdesc.map_size, mdesc.cookie));
 
        bp->efi_systab          = (UINTN)systab;
        bp->efi_memmap          = (UINTN)mdesc.md;
@@ -64,7 +64,12 @@ sysdeps_create_boot_params(boot_params_t *bp, CHAR8 *cmdline, memdesc_t *initrd,
        bp->efi_memdesc_version = mdesc.desc_version;
        bp->command_line        = (UINTN)cmdline;
        bp->initrd_start        = (UINTN) initrd->start_addr;
-       bp->initrd_size         = initrd->pgcnt << EFI_PAGE_SHIFT;
+       bp->initrd_size         = initrd->size;
+       DBG_PRT((L"Got initrd @ 0x%lx (%d bytes)", initrd->start_addr, initrd->size));
+
+       bp->vmcode_start        = (UINTN) vmcode->start_addr;
+       bp->vmcode_size         = vmcode->size;
+       DBG_PRT((L"Got vmcode @ 0x%lx (%d bytes)", vmcode->start_addr, vmcode->size));
 
        /* fetch console parameters: */
        conout = systab->ConOut;
@@ -135,3 +140,20 @@ sysdeps_initrd_get_addr(kdesc_t *kd, memdesc_t *imem)
        return 0;
 }
 
+/* Flush data cache [addr; addr + len], and sync with icache.  */
+void
+flush_dcache (CHAR8 *addr, UINT64 len)
+{
+       /* Cache line length is at least 32.  */
+       UINT64 a = (UINT64)addr & ~0x1f;
+
+       DBG_PRT((L"Flush 0x%lx-", a));
+
+       /* Flush data.  */
+       for (len = (len + 31) & ~0x1f; len > 0; len -= 0x20, a += 0x20)
+               asm volatile ("fc %0" : : "r" (a));
+       /* Sync and serialize.  Maybe extra.  */
+       asm volatile (";; sync.i;; srlz.i;;");
+
+       DBG_PRT((L"0x%lx\n", a));
+}