git: 71378e0ffa84 - stable/14 - bhyve: Move some more amd64-specific drivers to their own subdir

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Wed, 11 Oct 2023 13:25:02 UTC
The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=71378e0ffa84b5777aeda7da15dfca2c56125bf2

commit 71378e0ffa84b5777aeda7da15dfca2c56125bf2
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-10-04 16:20:57 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-10-11 13:21:52 +0000

    bhyve: Move some more amd64-specific drivers to their own subdir
    
    No functional change intended.
    
    Reviewed by:    corvink, jhb, emaste
    MFC after:      1 week
    Sponsored by:   Innovate UK
    Differential Revision:  https://reviews.freebsd.org/D40551
    
    (cherry picked from commit f927afc1a6fe8257e28d79e8bb77305c2958724a)
---
 usr.sbin/bhyve/Makefile               |  6 ------
 usr.sbin/bhyve/amd64/Makefile.inc     |  7 +++++++
 usr.sbin/bhyve/{ => amd64}/atkbdc.c   |  0
 usr.sbin/bhyve/{ => amd64}/atkbdc.h   |  0
 usr.sbin/bhyve/{ => amd64}/post.c     |  0
 usr.sbin/bhyve/{ => amd64}/ps2kbd.c   |  0
 usr.sbin/bhyve/{ => amd64}/ps2kbd.h   |  0
 usr.sbin/bhyve/{ => amd64}/ps2mouse.c |  0
 usr.sbin/bhyve/{ => amd64}/ps2mouse.h |  0
 usr.sbin/bhyve/bhyverun.c             |  6 +++++-
 usr.sbin/bhyve/snapshot.c             | 15 +++++++++++++--
 11 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile
index 794bfbe4c8a3..86039a8c45da 100644
--- a/usr.sbin/bhyve/Makefile
+++ b/usr.sbin/bhyve/Makefile
@@ -17,7 +17,6 @@ BHYVE_SYSDIR?=${SRCTOP}
 SRCS=	\
 	acpi.c			\
 	acpi_device.c		\
-	atkbdc.c		\
 	audio.c			\
 	basl.c			\
 	bhyvegc.c		\
@@ -63,9 +62,6 @@ SRCS=	\
 	pci_xhci.c		\
 	pctestdev.c		\
 	pm.c			\
-	post.c			\
-	ps2kbd.c		\
-	ps2mouse.c		\
 	qemu_fwcfg.c		\
 	qemu_loader.c		\
 	rfb.c			\
@@ -138,6 +134,4 @@ NO_WTHREAD_SAFETY=
 
 NO_WCAST_ALIGN=
 
-SUBDIR=	kbdlayout
-
 .include <bsd.prog.mk>
diff --git a/usr.sbin/bhyve/amd64/Makefile.inc b/usr.sbin/bhyve/amd64/Makefile.inc
index 62de5f211a23..c52219cb8dd1 100644
--- a/usr.sbin/bhyve/amd64/Makefile.inc
+++ b/usr.sbin/bhyve/amd64/Makefile.inc
@@ -1,6 +1,13 @@
 SRCS+=	\
+	atkbdc.c	\
 	fwctl.c		\
+	post.c		\
+	ps2kbd.c	\
+	ps2mouse.c	\
 	task_switch.c
 
+
 .PATH:  ${BHYVE_SYSDIR}/sys/amd64/vmm
 SRCS+=	vmm_instruction_emul.c
+
+SUBDIR+=	kbdlayout
diff --git a/usr.sbin/bhyve/atkbdc.c b/usr.sbin/bhyve/amd64/atkbdc.c
similarity index 100%
rename from usr.sbin/bhyve/atkbdc.c
rename to usr.sbin/bhyve/amd64/atkbdc.c
diff --git a/usr.sbin/bhyve/atkbdc.h b/usr.sbin/bhyve/amd64/atkbdc.h
similarity index 100%
rename from usr.sbin/bhyve/atkbdc.h
rename to usr.sbin/bhyve/amd64/atkbdc.h
diff --git a/usr.sbin/bhyve/post.c b/usr.sbin/bhyve/amd64/post.c
similarity index 100%
rename from usr.sbin/bhyve/post.c
rename to usr.sbin/bhyve/amd64/post.c
diff --git a/usr.sbin/bhyve/ps2kbd.c b/usr.sbin/bhyve/amd64/ps2kbd.c
similarity index 100%
rename from usr.sbin/bhyve/ps2kbd.c
rename to usr.sbin/bhyve/amd64/ps2kbd.c
diff --git a/usr.sbin/bhyve/ps2kbd.h b/usr.sbin/bhyve/amd64/ps2kbd.h
similarity index 100%
rename from usr.sbin/bhyve/ps2kbd.h
rename to usr.sbin/bhyve/amd64/ps2kbd.h
diff --git a/usr.sbin/bhyve/ps2mouse.c b/usr.sbin/bhyve/amd64/ps2mouse.c
similarity index 100%
rename from usr.sbin/bhyve/ps2mouse.c
rename to usr.sbin/bhyve/amd64/ps2mouse.c
diff --git a/usr.sbin/bhyve/ps2mouse.h b/usr.sbin/bhyve/amd64/ps2mouse.h
similarity index 100%
rename from usr.sbin/bhyve/ps2mouse.h
rename to usr.sbin/bhyve/amd64/ps2mouse.h
diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c
index 229527e580d5..6bebfddc3985 100644
--- a/usr.sbin/bhyve/bhyverun.c
+++ b/usr.sbin/bhyve/bhyverun.c
@@ -82,7 +82,9 @@
 
 #include "bhyverun.h"
 #include "acpi.h"
-#include "atkbdc.h"
+#ifdef __amd64__
+#include "amd64/atkbdc.h"
+#endif
 #include "bootrom.h"
 #include "config.h"
 #include "inout.h"
@@ -1450,7 +1452,9 @@ main(int argc, char *argv[])
 	init_inout();
 	kernemu_dev_init();
 	init_bootrom(ctx);
+#ifdef __amd64__
 	atkbdc_init(ctx);
+#endif
 	pci_irq_init(ctx);
 	ioapic_init(ctx);
 
diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c
index 7d8959756757..593930c7f8a3 100644
--- a/usr.sbin/bhyve/snapshot.c
+++ b/usr.sbin/bhyve/snapshot.c
@@ -75,7 +75,9 @@
 
 #include "bhyverun.h"
 #include "acpi.h"
-#include "atkbdc.h"
+#ifdef __amd64__
+#include "amd64/atkbdc.h"
+#endif
 #include "debug.h"
 #include "inout.h"
 #include "ipc.h"
@@ -892,7 +894,12 @@ vm_restore_devices(struct restore_state *rstate)
 			return (ret);
 	}
 
-	return (vm_restore_device(rstate, atkbdc_snapshot, "atkbdc", NULL));
+#ifdef __amd64__
+	ret = vm_restore_device(rstate, atkbdc_snapshot, "atkbdc", NULL);
+#else
+	ret = 0;
+#endif
+	return (ret);
 }
 
 int
@@ -1131,8 +1138,12 @@ vm_snapshot_devices(int data_fd, xo_handle_t *xop)
 			goto snapshot_err;
 	}
 
+#ifdef __amd64__
 	ret = vm_snapshot_device(atkbdc_snapshot, "atkbdc", NULL,
 	    data_fd, xop, meta, &offset);
+#else
+	ret = 0;
+#endif
 
 	xo_close_list_h(xop, JSON_DEV_ARR_KEY);