git: ae4067ce9414 - stable/13 - efifb,vbefb: implement vd_fini

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Fri, 14 Jan 2022 16:10:40 UTC
The branch stable/13 has been updated by manu:

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

commit ae4067ce94146c6d4031b6a233389e5f553f4141
Author:     Greg V <greg@unrelenting.technology>
AuthorDate: 2021-03-30 15:46:17 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-01-14 15:55:23 +0000

    efifb,vbefb: implement vd_fini
    
    This removes the pmap entry when switching away to e.g. drm fb.
    
    Differential Revision:  https://reviews.freebsd.org/D29020
    MFC After:      1 month
    
    (cherry picked from commit 8ebda6e44bb6ac9113e2a7fe65889811d894dd63)
---
 sys/dev/vt/hw/efifb/efifb.c | 11 +++++++++++
 sys/dev/vt/hw/vbefb/vbefb.c | 11 +++++++++++
 2 files changed, 22 insertions(+)

diff --git a/sys/dev/vt/hw/efifb/efifb.c b/sys/dev/vt/hw/efifb/efifb.c
index 3e1a793eee77..04d844cd9b70 100644
--- a/sys/dev/vt/hw/efifb/efifb.c
+++ b/sys/dev/vt/hw/efifb/efifb.c
@@ -50,12 +50,14 @@ __FBSDID("$FreeBSD$");
 #include <dev/vt/colors/vt_termcolors.h>
 
 static vd_init_t vt_efifb_init;
+static vd_fini_t vt_efifb_fini;
 static vd_probe_t vt_efifb_probe;
 
 static struct vt_driver vt_efifb_driver = {
 	.vd_name = "efifb",
 	.vd_probe = vt_efifb_probe,
 	.vd_init = vt_efifb_init,
+	.vd_fini = vt_efifb_fini,
 	.vd_blank = vt_fb_blank,
 	.vd_bitblt_text = vt_fb_bitblt_text,
 	.vd_invalidate_text = vt_fb_invalidate_text,
@@ -146,3 +148,12 @@ vt_efifb_init(struct vt_device *vd)
 
 	return (CN_INTERNAL);
 }
+
+static void
+vt_efifb_fini(struct vt_device *vd, void *softc)
+{
+	struct fb_info	*info = softc;
+
+	vt_fb_fini(vd, softc);
+	pmap_unmapdev(info->fb_vbase, info->fb_size);
+}
diff --git a/sys/dev/vt/hw/vbefb/vbefb.c b/sys/dev/vt/hw/vbefb/vbefb.c
index c8789e3bddac..85f594e4ed21 100644
--- a/sys/dev/vt/hw/vbefb/vbefb.c
+++ b/sys/dev/vt/hw/vbefb/vbefb.c
@@ -50,12 +50,14 @@ __FBSDID("$FreeBSD$");
 #include <dev/vt/colors/vt_termcolors.h>
 
 static vd_init_t vt_vbefb_init;
+static vd_fini_t vt_vbefb_fini;
 static vd_probe_t vt_vbefb_probe;
 
 static struct vt_driver vt_vbefb_driver = {
 	.vd_name = "vbefb",
 	.vd_probe = vt_vbefb_probe,
 	.vd_init = vt_vbefb_init,
+	.vd_fini = vt_vbefb_fini,
 	.vd_blank = vt_fb_blank,
 	.vd_bitblt_text = vt_fb_bitblt_text,
 	.vd_invalidate_text = vt_fb_invalidate_text,
@@ -151,3 +153,12 @@ vt_vbefb_init(struct vt_device *vd)
 
 	return (CN_INTERNAL);
 }
+
+static void
+vt_vbefb_fini(struct vt_device *vd, void *softc)
+{
+	struct fb_info	*info = softc;
+
+	vt_fb_fini(vd, softc);
+	pmap_unmapdev(info->fb_vbase, info->fb_size);
+}