Module Name:    src
Committed By:   manu
Date:           Fri Oct 18 01:00:25 UTC 2019

Modified Files:
        src/sys/arch/i386/i386: machdep.c
        src/sys/arch/i386/pci: piixpcib.c

Log Message:
Make sure no bioscall is issued when booting off UEFI system


To generate a diff of this commit:
cvs rdiff -u -r1.821 -r1.822 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/i386/pci/piixpcib.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.821 src/sys/arch/i386/i386/machdep.c:1.822
--- src/sys/arch/i386/i386/machdep.c:1.821	Sat Oct 12 06:31:03 2019
+++ src/sys/arch/i386/i386/machdep.c	Fri Oct 18 01:00:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.821 2019/10/12 06:31:03 maxv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.822 2019/10/18 01:00:24 manu Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009, 2017
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.821 2019/10/12 06:31:03 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.822 2019/10/18 01:00:24 manu Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_freebsd.h"
@@ -119,6 +119,8 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 
 #include <sys/sysctl.h>
 
+#include <x86/efi.h>
+
 #include <machine/cpu.h>
 #include <machine/cpufunc.h>
 #include <machine/cpuvar.h>
@@ -1368,10 +1370,15 @@ init386(paddr_t first_avail)
 	init386_ksyms();
 
 #if NMCA > 0
-	/* check for MCA bus, needed to be done before ISA stuff - if
+	/* 
+	 * check for MCA bus, needed to be done before ISA stuff - if
 	 * MCA is detected, ISA needs to use level triggered interrupts
-	 * by default */
-	mca_busprobe();
+	 * by default
+	 * And we do not search for MCA using bioscall() on EFI systems
+	 * that lacks it (they lack MCA too, anyway).
+	 */
+	if (lookup_bootinfo(BTINFO_EFI) == NULL)
+		mca_busprobe();
 #endif
 
 #ifdef XENPV

Index: src/sys/arch/i386/pci/piixpcib.c
diff -u src/sys/arch/i386/pci/piixpcib.c:1.22 src/sys/arch/i386/pci/piixpcib.c:1.23
--- src/sys/arch/i386/pci/piixpcib.c:1.22	Mon Jul 11 11:31:49 2016
+++ src/sys/arch/i386/pci/piixpcib.c	Fri Oct 18 01:00:25 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpcib.c,v 1.22 2016/07/11 11:31:49 msaitoh Exp $ */
+/* $NetBSD: piixpcib.c,v 1.23 2019/10/18 01:00:25 manu Exp $ */
 
 /*-
  * Copyright (c) 2004, 2006 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: piixpcib.c,v 1.22 2016/07/11 11:31:49 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: piixpcib.c,v 1.23 2019/10/18 01:00:25 manu Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -195,6 +195,12 @@ piixpcib_int15_gsic_call(int *sig, int *
 {
 	struct bioscallregs regs;
 
+	/* No bioscall with EFI */
+	if (lookup_bootinfo(BTINFO_EFI) != NULL) {
+		*sig = *smicmd = *cmd = *smidata = *flags = -1;
+		return;
+	}
+		
 	memset(&regs, 0, sizeof(struct bioscallregs));
 	regs.EAX = 0x0000e980;	/* IST support */
 	regs.EDX = PIIXPCIB_GSIC;

Reply via email to