Module Name:    src
Committed By:   bouyer
Date:           Tue Apr 28 15:43:34 UTC 2020

Modified Files:
        src/sys/arch/x86/x86: x86_autoconf.c
        src/sys/arch/xen/xen: hypervisor.c

Log Message:
Add xbd to the list of valid disks.
Remove hardcoded root on xbd0 for Xen PVHVM, now that the x86 findroot()
knowns about xbd disks.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/x86/x86/x86_autoconf.c
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/xen/xen/hypervisor.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/x86/x86/x86_autoconf.c
diff -u src/sys/arch/x86/x86/x86_autoconf.c:1.80 src/sys/arch/x86/x86/x86_autoconf.c:1.81
--- src/sys/arch/x86/x86/x86_autoconf.c:1.80	Sat Apr 25 15:26:18 2020
+++ src/sys/arch/x86/x86/x86_autoconf.c	Tue Apr 28 15:43:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_autoconf.c,v 1.80 2020/04/25 15:26:18 bouyer Exp $	*/
+/*	$NetBSD: x86_autoconf.c,v 1.81 2020/04/28 15:43:34 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.80 2020/04/25 15:26:18 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.81 2020/04/28 15:43:34 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -99,6 +99,7 @@ is_valid_disk(device_t dv)
 		device_is_a(dv, "sd") ||
 		device_is_a(dv, "wd") ||
 		device_is_a(dv, "ld") ||
+		device_is_a(dv, "xbd") ||
 		device_is_a(dv, "ed"));
 }
 

Index: src/sys/arch/xen/xen/hypervisor.c
diff -u src/sys/arch/xen/xen/hypervisor.c:1.77 src/sys/arch/xen/xen/hypervisor.c:1.78
--- src/sys/arch/xen/xen/hypervisor.c:1.77	Tue Apr 28 13:27:29 2020
+++ src/sys/arch/xen/xen/hypervisor.c	Tue Apr 28 15:43:34 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.77 2020/04/28 13:27:29 bouyer Exp $ */
+/* $NetBSD: hypervisor.c,v 1.78 2020/04/28 15:43:34 bouyer Exp $ */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.77 2020/04/28 13:27:29 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.78 2020/04/28 15:43:34 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -499,41 +499,6 @@ hypervisor_attach(device_t parent, devic
 	const struct sysctlnode *node = NULL;
 
 #ifdef XENPVHVM
-	/*
-	 * Set the boot device to xbd0a.
-	 * We claim this is a reasonable default which is picked up
-	 * later as the rootfs device.
-	 *
-	 * We need to do this because the HVM domain loader uses the
-	 * regular BIOS based native boot(8) procedure, which sets the
-	 * boot device to the native driver/partition of whatever was
-	 * detected by the native bootloader.
-	 */
-
-	struct btinfo_rootdevice bi;
-	snprintf(bi.devname, 6, "xbd0a");
-	bi.common.type = BTINFO_ROOTDEVICE;
-	bi.common.len = sizeof(struct btinfo_rootdevice);
-
-	/* From i386/multiboot.c */
-	int i, len;
-	vaddr_t data;
-	extern struct bootinfo	bootinfo;
-	struct bootinfo *bip = (struct bootinfo *)&bootinfo;
-	len = bi.common.len;
-
-	data = (vaddr_t)&bip->bi_data;
-	for (i = 0; i < bip->bi_nentries; i++) {
-		struct btinfo_common *tmp;
-
-		tmp = (struct btinfo_common *)data;
-		data += tmp->len;
-	}
-	if (data + len < (vaddr_t)&bip->bi_data + sizeof(bip->bi_data)) {
-		memcpy((void *)data, &bi, len);
-		bip->bi_nentries++;
-	}
-
 	/* disable emulated devices */
 	if (inw(XEN_MAGIC_IOPORT) == XMI_MAGIC) {
 		outw(XEN_MAGIC_IOPORT, XMI_UNPLUG_IDE_DISKS | XMI_UNPLUG_NICS);

Reply via email to