summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/stand/libsa
diff options
context:
space:
mode:
authorMike Larkin <mlarkin@cvs.openbsd.org>2019-05-10 21:20:44 +0000
committerMike Larkin <mlarkin@cvs.openbsd.org>2019-05-10 21:20:44 +0000
commitbe40943e85fe72cff42f31b282b50e1064e8991d (patch)
tree40d876748ec22c22429e7d0ad91ffb453db0324d /sys/arch/amd64/stand/libsa
parent14fcb546000dd1e37cbded6f1b2bdda94d7073d4 (diff)
Disentangle #ifdef EFIBOOT.
Separate out files used by both BIOS and EFI boot modes. These files had many #ifdef EFIBOOT code paths that make it difficult to move forward with changes needed to support random base VA linked kernels. ok deraadt@
Diffstat (limited to 'sys/arch/amd64/stand/libsa')
-rw-r--r--sys/arch/amd64/stand/libsa/cmd_i386.c21
-rw-r--r--sys/arch/amd64/stand/libsa/dev_i386.c23
-rw-r--r--sys/arch/amd64/stand/libsa/diskprobe.c84
-rw-r--r--sys/arch/amd64/stand/libsa/exec_i386.c48
-rw-r--r--sys/arch/amd64/stand/libsa/machdep.c10
-rw-r--r--sys/arch/amd64/stand/libsa/memprobe.c5
6 files changed, 7 insertions, 184 deletions
diff --git a/sys/arch/amd64/stand/libsa/cmd_i386.c b/sys/arch/amd64/stand/libsa/cmd_i386.c
index 7be66cc234c..1f928af37f7 100644
--- a/sys/arch/amd64/stand/libsa/cmd_i386.c
+++ b/sys/arch/amd64/stand/libsa/cmd_i386.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd_i386.c,v 1.13 2019/03/15 06:53:37 jsg Exp $ */
+/* $OpenBSD: cmd_i386.c,v 1.14 2019/05/10 21:20:43 mlarkin Exp $ */
/*
* Copyright (c) 1997-1999 Michael Shalayeff
@@ -37,11 +37,6 @@
#include "libsa.h"
#include <cmd.h>
-#ifdef EFIBOOT
-#include "efiboot.h"
-#include "efidev.h"
-#endif
-
extern const char version[];
int Xboot(void);
@@ -54,18 +49,10 @@ int Xregs(void);
int bootbuf(void *, int);
const struct cmd_table cmd_machine[] = {
-#ifndef EFIBOOT
{ "boot", CMDT_CMD, Xboot },
-#endif
{ "comaddr", CMDT_CMD, Xcomaddr },
{ "diskinfo", CMDT_CMD, Xdiskinfo },
{ "memory", CMDT_CMD, Xmemory },
-#ifdef EFIBOOT
- { "video", CMDT_CMD, Xvideo_efi },
- { "gop", CMDT_CMD, Xgop_efi },
- { "exit", CMDT_CMD, Xexit_efi },
- { "poweroff", CMDT_CMD, Xpoweroff_efi },
-#endif
#ifdef DEBUG
{ "regs", CMDT_CMD, Xregs },
#endif
@@ -75,11 +62,7 @@ const struct cmd_table cmd_machine[] = {
int
Xdiskinfo(void)
{
-#ifndef EFIBOOT
dump_diskinfo();
-#else
- efi_dump_diskinfo();
-#endif
return 0;
}
@@ -92,7 +75,6 @@ Xregs(void)
}
#endif
-#ifndef EFIBOOT
int
Xboot(void)
{
@@ -155,7 +137,6 @@ bad:
printf("Invalid device!\n");
return 0;
}
-#endif
int
Xmemory(void)
diff --git a/sys/arch/amd64/stand/libsa/dev_i386.c b/sys/arch/amd64/stand/libsa/dev_i386.c
index 47f1c8b9dee..218b550814f 100644
--- a/sys/arch/amd64/stand/libsa/dev_i386.c
+++ b/sys/arch/amd64/stand/libsa/dev_i386.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev_i386.c,v 1.22 2019/04/25 20:19:30 naddy Exp $ */
+/* $OpenBSD: dev_i386.c,v 1.23 2019/05/10 21:20:43 mlarkin Exp $ */
/*
* Copyright (c) 1996-1999 Michael Shalayeff
@@ -78,16 +78,6 @@ devopen(struct open_file *f, const char *fname, char **file)
#endif
if ((rc = (*dp->dv_open)(f, file)) == 0) {
f->f_dev = dp;
-#ifdef EFIBOOT
- if (strcmp("TFTP", dp->dv_name) != 0) {
- /*
- * Clear bootmac, to signal that we loaded
- * this file from a non-network device.
- */
- extern char *bootmac;
- bootmac = NULL;
- }
-#endif
return 0;
}
#ifdef DEBUG
@@ -118,17 +108,6 @@ devboot(dev_t bootdev, char *p)
int sr_boot_vol = -1;
int part_type = FS_UNUSED;
-#ifdef EFIBOOT
- if (!bootdev) {
- *p++ = 't';
- *p++ = 'f';
- *p++ = 't';
- *p++ = 'p';
- *p = '\0';
- return;
- }
-#endif
-
#ifdef SOFTRAID
/*
* Determine the partition type for the 'a' partition of the
diff --git a/sys/arch/amd64/stand/libsa/diskprobe.c b/sys/arch/amd64/stand/libsa/diskprobe.c
index 1d3351768fa..10bd0fb4167 100644
--- a/sys/arch/amd64/stand/libsa/diskprobe.c
+++ b/sys/arch/amd64/stand/libsa/diskprobe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diskprobe.c,v 1.23 2018/06/18 15:37:48 krw Exp $ */
+/* $OpenBSD: diskprobe.c,v 1.24 2019/05/10 21:20:43 mlarkin Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -47,9 +47,6 @@
#ifdef SOFTRAID
#include "softraid_amd64.h"
#endif
-#ifdef EFIBOOT
-#include "efidev.h"
-#endif
#define MAX_CKSUMLEN MAXBSIZE / DEV_BSIZE /* Max # of blks to cksum */
@@ -68,7 +65,6 @@ extern int debug;
extern int bios_bootdev;
extern int bios_cddev;
-#ifndef EFIBOOT
static void
diskinfo_init(struct diskinfo *dip)
{
@@ -180,77 +176,6 @@ hardprobe(void)
TAILQ_INSERT_TAIL(&disklist, dip, list);
}
}
-#endif
-
-#ifdef EFIBOOT
-static void
-efi_hardprobe(void)
-{
- int n;
- struct diskinfo *dip, *dipt;
- u_int bsdunit, type = 0;
- u_int scsi= 0, ide = 0, atapi = 0;
- extern struct disklist_lh
- efi_disklist;
-
- n = 0;
- TAILQ_FOREACH_SAFE(dip, &efi_disklist, list, dipt) {
- TAILQ_REMOVE(&efi_disklist, dip, list);
- n = scsi + ide;
-
- /* Try to find the label, to figure out device type */
- if ((efi_getdisklabel(dip->efi_info, &dip->disklabel))) {
- type = 0;
- printf(" hd%d*", n);
- bsdunit = ide++;
- } else {
- /* Best guess */
- switch (dip->disklabel.d_type) {
- case DTYPE_SCSI:
- type = 4;
- bsdunit = scsi++;
- dip->bios_info.flags |= BDI_GOODLABEL;
- break;
-
- case DTYPE_ESDI:
- case DTYPE_ST506:
- type = 0;
- bsdunit = ide++;
- dip->bios_info.flags |= BDI_GOODLABEL;
- break;
-
- case DTYPE_ATAPI:
- type = 6;
- n = atapi;
- bsdunit = atapi++;
- dip->bios_info.flags |= BDI_GOODLABEL
- | BDI_EL_TORITO;
- break;
-
- default:
- dip->bios_info.flags |= BDI_BADLABEL;
- type = 0; /* XXX Suggest IDE */
- bsdunit = ide++;
- }
- printf(" %cd%d", (type == 6)? 'c' : 'h', n);
- }
- if (type != 6)
- dip->bios_info.bios_number = 0x80 | n;
- else
- dip->bios_info.bios_number = 0xe0 | n;
-
- dip->bios_info.checksum = 0; /* just in case */
- /* Fill out best we can */
- dip->bsddev = dip->bios_info.bsd_dev =
- MAKEBOOTDEV(type, 0, 0, bsdunit, RAW_PART);
- check_hibernate(dip);
-
- /* Add to queue of disks */
- TAILQ_INSERT_TAIL(&disklist, dip, list);
- n++;
- }
-}
-#endif
/* Probe for all BIOS supported disks */
u_int32_t bios_cksumlen;
@@ -266,7 +191,6 @@ diskprobe(void)
/* Init stuff */
TAILQ_INIT(&disklist);
-#ifndef EFIBOOT
/* Do probes */
floppyprobe();
#ifdef BIOS_DEBUG
@@ -274,9 +198,6 @@ diskprobe(void)
printf(";");
#endif
hardprobe();
-#else
- efi_hardprobe();
-#endif
#ifdef SOFTRAID
srprobe();
@@ -305,7 +226,6 @@ diskprobe(void)
bios_diskinfo);
}
-#ifndef EFIBOOT
void
cdprobe(void)
{
@@ -375,8 +295,6 @@ cdprobe(void)
/* Add to queue of disks */
TAILQ_INSERT_TAIL(&disklist, dip, list);
}
-#endif
-
/* Find info on given BIOS disk */
struct diskinfo *
diff --git a/sys/arch/amd64/stand/libsa/exec_i386.c b/sys/arch/amd64/stand/libsa/exec_i386.c
index 9ee32ac6443..4b6aed12123 100644
--- a/sys/arch/amd64/stand/libsa/exec_i386.c
+++ b/sys/arch/amd64/stand/libsa/exec_i386.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_i386.c,v 1.28 2019/04/20 23:00:07 deraadt Exp $ */
+/* $OpenBSD: exec_i386.c,v 1.29 2019/05/10 21:20:43 mlarkin Exp $ */
/*
* Copyright (c) 1997-1998 Michael Shalayeff
@@ -46,10 +46,6 @@
#include "softraid_amd64.h"
#endif
-#ifdef EFIBOOT
-#include "efiboot.h"
-#endif
-
typedef void (*startfuncp)(int, int, int, int, int, int, int, int)
__attribute__ ((noreturn));
@@ -78,16 +74,6 @@ run_loadfile(uint64_t *marks, int howto)
bios_bootsr_t bootsr;
struct sr_boot_volume *bv;
#endif
-#ifdef EFIBOOT
- int i;
- u_long delta;
- extern u_long efi_loadaddr;
-
- if ((av = alloc(ac)) == NULL)
- panic("alloc for bootarg");
- efi_makebootargs();
- delta = DEFAULT_KERNEL_ADDRESS - efi_loadaddr;
-#endif
if (sa_cleanup != NULL)
(*sa_cleanup)();
@@ -126,48 +112,18 @@ run_loadfile(uint64_t *marks, int howto)
#endif
entry = marks[MARK_ENTRY] & 0x0fffffff;
-#ifdef EFIBOOT
- entry += delta;
-#endif
printf("entry point at 0x%lx\n", entry);
-#ifdef EFIBOOT
- /* Sync the memory map and call ExitBootServices() */
- efi_cleanup();
-#endif
/* Pass memory map to the kernel */
mem_pass();
- /*
- * This code may be used both for 64bit and 32bit. Make sure the
- * bootarg is always 32bit, even on amd64.
- */
-#ifdef __amd64__
- makebootargs32(av, &ac);
-#else
makebootargs(av, &ac);
-#endif
-
-#ifdef EFIBOOT
- /*
- * Move the loaded kernel image to the usual place after calling
- * ExitBootServices().
- */
- memmove((void *)marks[MARK_START] + delta, (void *)marks[MARK_START],
- marks[MARK_END] - marks[MARK_START]);
- for (i = 0; i < MARK_MAX; i++)
- marks[i] += delta;
-#endif
-#ifdef __amd64__
- (*run_i386)((u_long)run_i386, entry, howto, bootdev, BOOTARG_APIVER,
- marks[MARK_END], extmem, cnvmem, ac, (intptr_t)av);
-#else
/* stack and the gung is ok at this point, so, no need for asm setup */
(*(startfuncp)entry)(howto, bootdev, BOOTARG_APIVER, marks[MARK_END],
extmem, cnvmem, ac, (int)av);
-#endif
+
/* not reached */
}
diff --git a/sys/arch/amd64/stand/libsa/machdep.c b/sys/arch/amd64/stand/libsa/machdep.c
index 246cda51cd8..22d9499c049 100644
--- a/sys/arch/amd64/stand/libsa/machdep.c
+++ b/sys/arch/amd64/stand/libsa/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.7 2018/07/11 14:48:40 mlarkin Exp $ */
+/* $OpenBSD: machdep.c,v 1.8 2019/05/10 21:20:43 mlarkin Exp $ */
/*
* Copyright (c) 2004 Tom Cosgrove
@@ -34,10 +34,6 @@
#include <machine/specialreg.h>
#include <machine/vmmvar.h>
-#ifdef EFIBOOT
-#include "efiboot.h"
-#endif
-
volatile struct BIOS_regs BIOS_regs;
#if defined(DEBUG)
@@ -93,9 +89,5 @@ int
check_skip_conf(void)
{
/* Return non-zero (skip boot.conf) if Control "shift" key down */
-#ifndef EFIBOOT
return (pc_getshifts(0) & 0x04);
-#else
- return (efi_cons_getshifts(0) & 0x04);
-#endif
}
diff --git a/sys/arch/amd64/stand/libsa/memprobe.c b/sys/arch/amd64/stand/libsa/memprobe.c
index 302eea718b0..67ff6cee00b 100644
--- a/sys/arch/amd64/stand/libsa/memprobe.c
+++ b/sys/arch/amd64/stand/libsa/memprobe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: memprobe.c,v 1.17 2016/06/10 18:36:06 jcs Exp $ */
+/* $OpenBSD: memprobe.c,v 1.18 2019/05/10 21:20:43 mlarkin Exp $ */
/*
* Copyright (c) 1997-1999 Michael Shalayeff
@@ -37,7 +37,6 @@
u_int cnvmem, extmem; /* XXX - compatibility */
bios_memmap_t bios_memmap[64]; /* This is easier */
-#ifndef EFIBOOT
/*
* Check gateA20
*
@@ -146,7 +145,6 @@ bios_int12(bios_memmap_t *mp)
return ++mp;
}
-
/*
* addrprobe(kloc): Probe memory at address kloc * 1024.
*
@@ -311,7 +309,6 @@ memprobe(void)
/* Check if gate A20 is on */
printf("a20=o%s] ", checkA20()? "n" : "ff!");
}
-#endif
void
dump_biosmem(bios_memmap_t *tm)