summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorszhou <none@none>2006-10-05 11:31:43 -0700
committerszhou <none@none>2006-10-05 11:31:43 -0700
commitf2be51489e45daeb2c91d227fa1691c74cc3ea97 (patch)
tree3b385a81fc80fd9d9e0549aac3c4da9c5f3ec0af /usr/src
parentccbf80fa3b6bf6b986dca9037e5ad9d6c9f9fa65 (diff)
downloadillumos-joyent-f2be51489e45daeb2c91d227fa1691c74cc3ea97.tar.gz
PSARC 2006/340 Solaris Boot Support for EFI and LinuxBIOS
6434157 libefi sometimes gets the wrong gpt partition location 6475349 Boot Support for EFI and LinuxBIOS
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/libefi/common/rdwr_efi.c26
-rw-r--r--usr/src/psm/stand/boot/i386/common/bios.c23
-rw-r--r--usr/src/psm/stand/boot/i386/common/boot_plat.c10
-rw-r--r--usr/src/psm/stand/boot/i386/common/bootflags.c16
-rw-r--r--usr/src/psm/stand/boot/i386/common/bootprop.c95
-rw-r--r--usr/src/psm/stand/boot/i386/common/bootprop.h8
-rw-r--r--usr/src/psm/stand/boot/i386/common/console.c37
-rw-r--r--usr/src/psm/stand/boot/i386/common/multiboot.c9
-rw-r--r--usr/src/psm/stand/boot/i386/common/multiboot.h9
-rw-r--r--usr/src/psm/stand/boot/i386/common/util.h8
-rw-r--r--usr/src/psm/stand/boot/i386/i86pc/asm.s10
-rw-r--r--usr/src/tools/scripts/bfu.sh2
-rw-r--r--usr/src/uts/common/sys/efi_partition.h11
-rw-r--r--usr/src/uts/i86pc/io/acpica/acpica.c4
-rw-r--r--usr/src/uts/i86pc/io/acpica/osl.c14
-rw-r--r--usr/src/uts/i86pc/os/machdep.c2
-rw-r--r--usr/src/uts/intel/ia32/ml/i86_subr.s7
-rw-r--r--usr/src/uts/intel/sys/archsystm.h1
18 files changed, 203 insertions, 89 deletions
diff --git a/usr/src/lib/libefi/common/rdwr_efi.c b/usr/src/lib/libefi/common/rdwr_efi.c
index 0ca4445b71..d366be1448 100644
--- a/usr/src/lib/libefi/common/rdwr_efi.c
+++ b/usr/src/lib/libefi/common/rdwr_efi.c
@@ -66,7 +66,9 @@ static struct uuid_to_ptag {
{ EFI_DELL_RAID },
{ EFI_DELL_SWAP },
{ EFI_DELL_LVM },
- { EFI_DELL_RESV }
+ { EFI_DELL_RESV },
+ { EFI_AAPL_HFS },
+ { EFI_AAPL_UFS }
};
/*
@@ -437,9 +439,9 @@ efi_read(int fd, struct dk_gpt *vtoc)
return (rval);
}
- /* partitions start in the next block */
/* LINTED -- always longlong aligned */
- efi_parts = (efi_gpe_t *)(((char *)efi) + disk_info.dki_lbsize);
+ efi_parts = (efi_gpe_t *)(((char *)efi) +
+ LE_64(efi->efi_gpt_PartitionEntryLBA) * disk_info.dki_lbsize);
/*
* Assemble this into a "dk_gpt" struct for easier
@@ -583,7 +585,10 @@ check_input(struct dk_gpt *vtoc)
return (VT_EINVAL);
}
if (vtoc->efi_parts[i].p_tag == V_UNASSIGNED) {
- continue;
+ if (uuid_is_null((uchar_t *)&vtoc->efi_parts[i].p_guid))
+ continue;
+ /* we have encountered an unknown uuid */
+ vtoc->efi_parts[i].p_tag = 0xff;
}
if (vtoc->efi_parts[i].p_tag == V_RESERVED) {
if (resv_part != -1) {
@@ -739,8 +744,21 @@ efi_write(int fd, struct dk_gpt *vtoc)
UUID_LE_CONVERT(
efi_parts[i].efi_gpe_PartitionTypeGUID,
conversion_array[j].uuid);
+ break;
}
}
+
+ if (j == sizeof (conversion_array) / sizeof (struct uuid_to_ptag)) {
+ /*
+ * If we didn't have a matching uuid match, bail here.
+ * Don't write a label with unknown uuid.
+ */
+ if (efi_debug)
+ (void) fprintf(stderr, "Unknown uuid for p_tag %d\n",
+ vtoc->efi_parts[i].p_tag);
+ return (VT_EINVAL);
+ }
+
efi_parts[i].efi_gpe_StartingLBA =
LE_64(vtoc->efi_parts[i].p_start);
efi_parts[i].efi_gpe_EndingLBA =
diff --git a/usr/src/psm/stand/boot/i386/common/bios.c b/usr/src/psm/stand/boot/i386/common/bios.c
index da918e4032..e80d0ad55d 100644
--- a/usr/src/psm/stand/boot/i386/common/bios.c
+++ b/usr/src/psm/stand/boot/i386/common/bios.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -43,6 +42,8 @@
#define PCI_BIOS_PRESENT 0x1
#define dprintf if (debug & D_BIOS) printf
+int bios_free; /* i.e. no BIOS */
+
extern int openfile(char *, char *);
int (*bios_doint)(int, struct int_pb *);
@@ -61,6 +62,15 @@ pci_check_bios(void)
dprintf("ic.dx = 0x%x\r\n", (int)ic.dx);
}
+/* dummy bios routine when no BIOS is present */
+/*ARGSUSED*/
+static int
+bios_doint_none(int a, struct int_pb *p)
+{
+ dprintf("bios_doint_none: fail 0x%x\n", a);
+ return (PS_C);
+}
+
void
init_biosprog()
{
@@ -68,6 +78,11 @@ init_biosprog()
char *buf = (char *)0x2000;
ssize_t count;
+ if (bios_free) {
+ bios_doint = bios_doint_none;
+ return;
+ }
+
/* read biosint program to pfn 2 */
fd = openfile("biosint", NULL);
if (fd == -1) {
diff --git a/usr/src/psm/stand/boot/i386/common/boot_plat.c b/usr/src/psm/stand/boot/i386/common/boot_plat.c
index 14dea10f6f..3de61380da 100644
--- a/usr/src/psm/stand/boot/i386/common/boot_plat.c
+++ b/usr/src/psm/stand/boot/i386/common/boot_plat.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -145,6 +144,7 @@ setup_aux(void)
void
panic(const char *fmt, ...)
{
+ extern int efi_boot;
va_list adx;
/* turn on output */
@@ -156,6 +156,8 @@ panic(const char *fmt, ...)
printf("Press any key to reboot\n");
(void) getchar();
printf("rebooting...\n");
+ if (efi_boot)
+ efi_reset();
reset();
}
diff --git a/usr/src/psm/stand/boot/i386/common/bootflags.c b/usr/src/psm/stand/boot/i386/common/bootflags.c
index a244801b47..26bd0de1b8 100644
--- a/usr/src/psm/stand/boot/i386/common/bootflags.c
+++ b/usr/src/psm/stand/boot/i386/common/bootflags.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -138,13 +137,20 @@ get_bootargs(char *args, int grub)
args = "";
}
- params.gos_opts = "CD:Vadvk";
+ params.gos_opts = "CD:ELVadvk";
params.gos_strp = args;
getoptstr_init(&params);
while ((c = getoptstr(&params)) != -1) {
+ extern int bios_free, efi_boot;
extern void check_iopath(void);
switch (c) {
+ case 'E': /* booted from EFI */
+ efi_boot = 1;
+ /*FALLTHRU*/
+ case 'L': /* linuxbios -- no bios */
+ bios_free = 1;
+ break;
case 'V': /* Undocumented. */
verbosemode = 1;
break;
diff --git a/usr/src/psm/stand/boot/i386/common/bootprop.c b/usr/src/psm/stand/boot/i386/common/bootprop.c
index 61189ff1a8..466f27338b 100644
--- a/usr/src/psm/stand/boot/i386/common/bootprop.c
+++ b/usr/src/psm/stand/boot/i386/common/bootprop.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -33,6 +32,9 @@
#include "debug.h"
#include "multiboot.h"
+int efi_boot; /* booted from EFI firmware */
+extern int bios_free; /* firmware is not bios */
+
extern void install_memlistptrs();
#define dprintf if (debug & D_BPROP) printf
@@ -182,9 +184,7 @@ setup_bootprop(void)
extern char bootprop[], bootargs[];
extern char *bootprog;
extern uint64_t ramdisk_start, ramdisk_end;
- extern multiboot_info_t *mbi;
char *name, *val, *cp;
- int netboot = 0;
int stdout_val = 0; /* for a dummy property */
if (verbosemode)
@@ -241,6 +241,34 @@ setup_bootprop(void)
(void) bsetprop(NULL, "mfg-name", "i86pc", sizeof ("i86pc"));
(void) bsetprop(NULL, "impl-arch-name", "i86pc", sizeof ("i86pc"));
+ /* dummy properties needed by Install miniroot */
+ (void) bsetprop(NULL,
+ "stdout", &stdout_val, sizeof (stdout_val));
+}
+
+void
+setup_bootdev_props(void)
+{
+ extern multiboot_info_t *mbi;
+ int netboot = 0;
+
+ if (verbosemode)
+ printf("setup boot device properties.\n");
+
+ /* If booted from EFI, setup acpi-root-tab and efi-systab */
+ if (efi_boot) {
+ (void) bsetprop(NULL, "acpi-root-tab",
+ (char *)&mbi->acpi_root_tab,
+ sizeof (mbi->acpi_root_tab));
+ (void) bsetprop(NULL, "efi-systab", (char *)&mbi->efi_systab,
+ sizeof (mbi->efi_systab));
+ }
+
+ if (bios_free) {
+ (void) bsetprop(NULL, "bios-free", "tree", sizeof ("true"));
+ return;
+ }
+
/* figure out the boot device */
if (MB_CHECK_FLAG(mbi->flags, 2)) {
char str[3];
@@ -258,38 +286,35 @@ setup_bootprop(void)
* the dhcp ack. This is not multiboot compliant and
* requires special pxegrub!
*/
- if (netboot) {
- if (verbosemode)
- printf("booting from network\n");
-
- if (mbi->drives_length == 0) {
- if (verbosemode) {
- printf("no network info, "
- "need a GRUB with Solaris enhancements\n");
- }
- } else {
- struct sol_netinfo *sip =
- (struct sol_netinfo *)mbi->drives_addr;
- switch (sip->sn_infotype) {
- case SN_TYPE_BOOTP:
- (void) bsetprop(NULL, BP_BOOTP_RESPONSE,
- (void *)mbi->drives_addr,
- mbi->drives_length);
- break;
- case SN_TYPE_RARP:
- setup_rarp_props(sip);
- break;
- default:
- printf("invalid network info: type %d\n",
- sip->sn_infotype);
- break;
- };
+ if (!netboot)
+ return;
+
+ if (verbosemode)
+ printf("booting from network\n");
+
+ if (mbi->drives_length == 0) {
+ if (verbosemode) {
+ printf("no network info, "
+ "need a GRUB with Solaris enhancements\n");
}
+ } else {
+ struct sol_netinfo *sip =
+ (struct sol_netinfo *)mbi->drives_addr;
+ switch (sip->sn_infotype) {
+ case SN_TYPE_BOOTP:
+ (void) bsetprop(NULL, BP_BOOTP_RESPONSE,
+ (void *)mbi->drives_addr,
+ mbi->drives_length);
+ break;
+ case SN_TYPE_RARP:
+ setup_rarp_props(sip);
+ break;
+ default:
+ printf("invalid network info: type %d\n",
+ sip->sn_infotype);
+ break;
+ };
}
-
- /* dummy properties needed by Install miniroot */
- (void) bsetprop(NULL,
- "stdout", &stdout_val, sizeof (stdout_val));
}
#define BUFLEN 64
diff --git a/usr/src/psm/stand/boot/i386/common/bootprop.h b/usr/src/psm/stand/boot/i386/common/bootprop.h
index 004c8049d0..7c25e8e69d 100644
--- a/usr/src/psm/stand/boot/i386/common/bootprop.h
+++ b/usr/src/psm/stand/boot/i386/common/bootprop.h
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -59,6 +58,7 @@ extern int bgetprop(struct bootops *, char *, void *);
extern int bsetprop(struct bootops *, char *, void *, int);
extern char *bnextprop(struct bootops *, char *);
+extern void setup_bootdev_props(void);
extern void setup_bootprop(void);
extern void get_grub_bootargs(char *);
extern void get_eeprom_bootargs(char *);
diff --git a/usr/src/psm/stand/boot/i386/common/console.c b/usr/src/psm/stand/boot/i386/common/console.c
index 06a9a778c4..d6c40a83df 100644
--- a/usr/src/psm/stand/boot/i386/common/console.c
+++ b/usr/src/psm/stand/boot/i386/common/console.c
@@ -125,6 +125,7 @@ static int port;
static void
serial_init(void)
{
+ extern int bios_free;
extern void mdelay();
/* initialize only once */
@@ -137,7 +138,8 @@ serial_init(void)
* is enabled, but we can't really tell without working
* through a scary Microsoft license.
*/
- mdelay(2000);
+ if (!bios_free)
+ mdelay(2000);
switch (console) {
case CONS_TTYA:
@@ -370,18 +372,25 @@ console_init(char *bootstr)
/* both "graphics" and "text" mean "detect graphics mode" now */
if (cons) {
- if (strncmp(cons, "ttya", 4) == 0)
+ if (strncmp(cons, "ttya", 4) == 0) {
console = CONS_TTYA;
- else if (strncmp(cons, "ttyb", 4) == 0)
+ cons = "ttya";
+ } else if (strncmp(cons, "ttyb", 4) == 0) {
console = CONS_TTYB;
- else if (strncmp(cons, "graphics", 9) == 0)
+ cons = "ttyb";
+ } else if (strncmp(cons, "graphics", 9) == 0) {
console = CONS_SCREEN_TEXT;
- else if (strncmp(cons, "text", 4) == 0)
+ cons = "graphics";
+ } else if (strncmp(cons, "text", 4) == 0) {
console = CONS_SCREEN_TEXT;
- else if (strncmp(cons, "screen", 6) == 0)
+ cons = "text";
+ } else if (strncmp(cons, "screen", 6) == 0) {
console = CONS_SCREEN_TEXT;
- else if (strncmp(cons, "usb-serial", 10) == 0)
+ cons = "text";
+ } else if (strncmp(cons, "usb-serial", 10) == 0) {
console = CONS_USBSER;
+ cons = "usb-serial";
+ }
}
/*
@@ -395,9 +404,9 @@ console_init(char *bootstr)
switch (console) {
case CONS_TTYA:
case CONS_TTYB:
+ case CONS_USBSER:
/* leave initialization till later, when we know tty mode */
break;
- case CONS_USBSER: /* try screen for now */
case CONS_SCREEN_TEXT:
default:
clear_screen();
@@ -463,8 +472,8 @@ console_init2(char *inputdev, char *outputdev, char *consoledev)
serial_init();
}
break;
- case CONS_USBSER: /* see comments in _doputchar() */
- /*FALLTHRU*/
+ case CONS_USBSER:
+ break;
case CONS_SCREEN_TEXT:
if (console_state != CONS_SCREEN_TEXT) {
clear_screen();
@@ -545,13 +554,11 @@ _doputchar(int c)
return;
case CONS_USBSER:
/*
- * usbser_putchar() only prints to memory buffer, so
- * nothing is visible. We fall through to print to
- * screen as well. This continues until kernel consconfig(),
- * after which putchar() is no longer called.
+ * usbser_putchar() prints to memory buffer.
+ * The buffer is displayed after consconfig().
*/
usbser_putchar(c);
- /*FALLTHRU*/
+ return;
case CONS_SCREEN_TEXT:
screen_putchar(c);
return;
diff --git a/usr/src/psm/stand/boot/i386/common/multiboot.c b/usr/src/psm/stand/boot/i386/common/multiboot.c
index f12035e31f..79bacf01ba 100644
--- a/usr/src/psm/stand/boot/i386/common/multiboot.c
+++ b/usr/src/psm/stand/boot/i386/common/multiboot.c
@@ -80,7 +80,6 @@ char *console_prop = NULL;
extern uint_t bpd_loc;
extern char *bootfile;
extern char *module_path;
-extern int boot_verbose;
int is_amd64;
#ifdef BOOTAMD64
@@ -119,8 +118,10 @@ main(ulong_t magic, ulong_t addr, ulong_t header)
get_grub_bootargs(grub_bootstr); /* get grub cmd options */
if (debug & D_MBINFO)
print_mbinfo();
+ setup_bootdev_props(); /* boot device related props */
setup_bootops(); /* 32-bit memory ops and lists */
init_paging(); /* turn on paging to before loading kernel */
+ mbi = NULL; /* can't access multiboot info from now on */
if (mountroot("boot") != 0) { /* mount the ramdisk */
panic("cannot mount boot archive\n");
@@ -228,6 +229,12 @@ print_mbinfo(void)
/* flags */
printf("flags = 0x%x\n", (unsigned)mbi->flags);
+ if (MB_CHECK_FLAG(mbi->flags, 9))
+ printf("boot loader: %s\n", (char *)mbi->boot_loader_name);
+
+ if (MB_CHECK_FLAG(mbi->flags, 2))
+ printf("command line: %s\n", (char *)mbi->cmdline);
+
/* memory range */
if (MB_CHECK_FLAG(mbi->flags, 0))
printf("mem_lower = %uKB, mem_upper = %uKB\n",
diff --git a/usr/src/psm/stand/boot/i386/common/multiboot.h b/usr/src/psm/stand/boot/i386/common/multiboot.h
index 2b2b1d01cf..7674c16faf 100644
--- a/usr/src/psm/stand/boot/i386/common/multiboot.h
+++ b/usr/src/psm/stand/boot/i386/common/multiboot.h
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -115,6 +114,8 @@ typedef struct multiboot_info {
ushort_t vbe_interface_seg;
ushort_t vbe_interface_off;
ushort_t vbe_interface_len;
+ ulong_t efi_systab;
+ ulong_t acpi_root_tab;
} multiboot_info_t;
/* The module structure. */
diff --git a/usr/src/psm/stand/boot/i386/common/util.h b/usr/src/psm/stand/boot/i386/common/util.h
index 06d44fde2b..0aa18da2a6 100644
--- a/usr/src/psm/stand/boot/i386/common/util.h
+++ b/usr/src/psm/stand/boot/i386/common/util.h
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -63,6 +62,7 @@ extern int close(int);
extern void printf(const char *, ...);
extern void reset(void) __NORETURN;
+extern void efi_reset(void) __NORETURN;
extern void prom_panic(char *fmt) __NORETURN;
extern void panic(const char *fmt, ...) __NORETURN;
diff --git a/usr/src/psm/stand/boot/i386/i86pc/asm.s b/usr/src/psm/stand/boot/i386/i86pc/asm.s
index e963a71ec0..27dbb67aac 100644
--- a/usr/src/psm/stand/boot/i386/i86pc/asm.s
+++ b/usr/src/psm/stand/boot/i386/i86pc/asm.s
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -19,7 +18,7 @@
*
* CDDL HEADER END
*/
-/* Copyright 2005 Sun Microsystems, Inc. All rights reserved. */
+/* Copyright 2006 Sun Microsystems, Inc. All rights reserved. */
/* Use is subject to license terms. */
#if defined(lint)
@@ -38,6 +37,7 @@ void halt(char *msg) { printf("%s", msg); }
/*ARGSUSED*/
void exitto(int (*entrypoint)()) {}
void reset(void) {}
+void efi_reset(void) {}
/* lint for inline functions in i86.il */
/*ARGSUSED*/
@@ -299,6 +299,7 @@ donetable:
/ port 0xcf9 failed also. Last-ditch effort is to
/ triple-fault the CPU.
/
+ ENTRY(efi_reset)
movw $0, IDTlimit / generate faulty table
lidt IDTptr / load faulty table
int $10 / trigger an interrupt
@@ -306,6 +307,7 @@ donetable:
cli
hlt / Wait forever
/*NOTREACHED*/
+ SET_SIZE(efi_reset)
SET_SIZE(reset)
ENTRY(_cmntrap)
diff --git a/usr/src/tools/scripts/bfu.sh b/usr/src/tools/scripts/bfu.sh
index 8c97cd0017..1bd2408409 100644
--- a/usr/src/tools/scripts/bfu.sh
+++ b/usr/src/tools/scripts/bfu.sh
@@ -2117,7 +2117,7 @@ if [[ $target_isa = i386 && -f $cpiodir/i86pc.root$ZFIX ]] && \
grep multiboot >/dev/null 2>&1 ; then
multiboot_archives=yes
prtconf -v | grep biosdev >/dev/null 2>&1
- if [ $? -ne 0 ]; then
+ if [ $? -ne 0 ] && [ ! -f $rootprefix/platform/i86pc/multiboot ]; then
echo "biosdev cannot be run on this machine."
echo "Transitioning from classic to multiboot requires a"
echo "bootconf which is compatible with biosdev."
diff --git a/usr/src/uts/common/sys/efi_partition.h b/usr/src/uts/common/sys/efi_partition.h
index 984ff2aba5..c028671d8e 100644
--- a/usr/src/uts/common/sys/efi_partition.h
+++ b/usr/src/uts/common/sys/efi_partition.h
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -133,6 +132,10 @@ typedef struct efi_gpe_Attrs {
{ 0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28 } }
#define EFI_DELL_RESV { 0x8da63339, 0x0007, 0x60c0, 0xc4, 0x36, \
{ 0x08, 0x3a, 0xc8, 0x23, 0x09, 0x08 } }
+#define EFI_AAPL_HFS { 0x48465300, 0x0000, 0x11aa, 0xaa, 0x11, \
+ { 0x00, 0x30, 0x65, 0x43, 0xec, 0xac } }
+#define EFI_AAPL_UFS { 0x55465300, 0x0000, 0x11aa, 0xaa, 0x11, \
+ { 0x00, 0x30, 0x65, 0x43, 0xec, 0xac } }
#define EFI_MIN_ARRAY_SIZE (16 * 1024)
diff --git a/usr/src/uts/i86pc/io/acpica/acpica.c b/usr/src/uts/i86pc/io/acpica/acpica.c
index b9b641f798..a1d10cb5ae 100644
--- a/usr/src/uts/i86pc/io/acpica/acpica.c
+++ b/usr/src/uts/i86pc/io/acpica/acpica.c
@@ -188,6 +188,10 @@ acpica_check_bios_date(int yy, int mm, int dd)
char *datep;
int bios_year, bios_month, bios_day;
+ /* If firmware has no bios, skip the check */
+ if (ddi_prop_exists(DDI_DEV_T_ANY, ddi_root_node(), 0, "bios-free"))
+ return (TRUE);
+
/*
* PC BIOSes contain a string in the form of
* "mm/dd/yy" at absolute address 0xffff5,
diff --git a/usr/src/uts/i86pc/io/acpica/osl.c b/usr/src/uts/i86pc/io/acpica/osl.c
index d26cd667f2..205e7a0ea9 100644
--- a/usr/src/uts/i86pc/io/acpica/osl.c
+++ b/usr/src/uts/i86pc/io/acpica/osl.c
@@ -166,6 +166,20 @@ AcpiOsTerminate(void)
ACPI_STATUS
AcpiOsGetRootPointer(UINT32 Flags, ACPI_POINTER *Address)
{
+ uint_t acpi_root_tab;
+
+ /*
+ * For EFI firmware, the root pointer is defined in EFI systab.
+ * The boot code process the table and put the physical address
+ * in the acpi-root-tab property.
+ */
+ acpi_root_tab = ddi_prop_get_int(DDI_DEV_T_ANY, ddi_root_node(), 0,
+ "acpi-root-tab", 0);
+ if (acpi_root_tab != 0) {
+ Address->PointerType = ACPI_PHYSICAL_POINTER;
+ Address->Pointer.Physical = acpi_root_tab;
+ return (AE_OK);
+ }
return (AcpiFindRootPointer(Flags, Address));
}
diff --git a/usr/src/uts/i86pc/os/machdep.c b/usr/src/uts/i86pc/os/machdep.c
index a98e153653..32b6af7497 100644
--- a/usr/src/uts/i86pc/os/machdep.c
+++ b/usr/src/uts/i86pc/os/machdep.c
@@ -340,6 +340,8 @@ reset(void)
*bios_memchk = 0x1234; /* bios memory check disable */
}
+ if (ddi_prop_exists(DDI_DEV_T_ANY, ddi_root_node(), 0, "efi-systab"))
+ efi_reset();
pc_reset();
/*NOTREACHED*/
}
diff --git a/usr/src/uts/intel/ia32/ml/i86_subr.s b/usr/src/uts/intel/ia32/ml/i86_subr.s
index cf35165f76..34ff0a9163 100644
--- a/usr/src/uts/intel/ia32/ml/i86_subr.s
+++ b/usr/src/uts/intel/ia32/ml/i86_subr.s
@@ -1434,6 +1434,10 @@ void
pc_reset(void)
{}
+void
+efi_reset(void)
+{}
+
#else /* __lint */
ENTRY(wait_500ms)
@@ -1533,7 +1537,9 @@ pc_reset(void)
/
/ port 0xcf9 failed also. Last-ditch effort is to
/ triple-fault the CPU.
+ / Also, use triple fault for EFI firmware
/
+ ENTRY(efi_reset)
#if defined(__amd64)
pushq $0x0
pushq $0x0 / IDT base of 0, limit of 0 + 2 unused bytes
@@ -1548,6 +1554,7 @@ pc_reset(void)
cli
hlt / Wait forever
/*NOTREACHED*/
+ SET_SIZE(efi_reset)
SET_SIZE(pc_reset)
#endif /* __lint */
diff --git a/usr/src/uts/intel/sys/archsystm.h b/usr/src/uts/intel/sys/archsystm.h
index 07adccd582..1eed79d0ae 100644
--- a/usr/src/uts/intel/sys/archsystm.h
+++ b/usr/src/uts/intel/sys/archsystm.h
@@ -93,6 +93,7 @@ extern void outw(int port, uint16_t value);
extern void outl(int port, uint32_t value);
extern void pc_reset(void) __NORETURN;
+extern void efi_reset(void) __NORETURN;
extern void reset(void) __NORETURN;
extern int goany(void);