NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/53126: uefi boot breaks graphics



The following reply was made to PR port-amd64/53126; it has been noted by GNATS.

From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/53126: uefi boot breaks graphics
Date: Thu, 23 Feb 2023 21:35:36 +0000

 This is a multi-part message in MIME format.
 --=_17Wymd7lPaKOmlAiVMiz9N/EY5eA0fm1
 
 Sorry, that patch won't do anything.  Can you see if this one does?
 Even less committable as is but worth testing.
 
 --=_17Wymd7lPaKOmlAiVMiz9N/EY5eA0fm1
 Content-Type: text/plain; charset="ISO-8859-1"; name="nvgenfbcons"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment; filename="nvgenfbcons.patch"
 
 From 057cead7430f2dd53a72354f7de0089e1b67c764 Mon Sep 17 00:00:00 2001
 From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
 Date: Thu, 23 Feb 2023 21:26:00 +0000
 Subject: [PATCH] WIP: Hack genfb framebuffer sharing between consinit and
  nouveau.
 
 PR kern/53126
 ---
  sys/arch/x86/x86/genfb_machdep.c              |  7 +++++
  .../bsd/drm2/dist/drm/nouveau/nouveau_nvif.c  | 26 +++++++++++++++++++
  2 files changed, 33 insertions(+)
 
 diff --git a/sys/arch/x86/x86/genfb_machdep.c b/sys/arch/x86/x86/genfb_mach=
 dep.c
 index 8384b00f4a5f..2ef9020cff83 100644
 --- a/sys/arch/x86/x86/genfb_machdep.c
 +++ b/sys/arch/x86/x86/genfb_machdep.c
 @@ -96,6 +96,10 @@ x86_genfb_ddb_trap_callback(int where)
  	}
  }
 =20
 +bus_addr_t x86_genfb_fb_addr;
 +bus_size_t x86_genfb_fb_size;
 +bus_space_handle_t x86_genfb_fb_handle;
 +
  int
  x86_genfb_init(void)
  {
 @@ -130,6 +134,9 @@ x86_genfb_init(void)
  		aprint_error("x86_genfb_cnattach: couldn't get fb vaddr\n");
  		return 0;
  	}
 +	x86_genfb_fb_addr =3D fbinfo->physaddr;
 +	x86_genfb_fb_size =3D fbinfo->height * fbinfo->stride;
 +	x86_genfb_fb_handle =3D h;
 =20
  #if NACPICA > 0
  	acpi_md_vesa_modenum =3D fbinfo->vbemode;
 diff --git a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nvif.c b/sys/ex=
 ternal/bsd/drm2/dist/drm/nouveau/nouveau_nvif.c
 index d7946dbbfd25..80758695e692 100644
 --- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nvif.c
 +++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nvif.c
 @@ -53,6 +53,32 @@ nvkm_client_map(void *priv, bus_space_tag_t tag, u64 bus=
 addr, u32 size,
  	struct nvkm_client *client =3D nvxx_client(priv);
  	int ret;
 =20
 +	extern bus_space_tag_t x86_bus_space_mem;
 +	extern bus_addr_t x86_genfb_fb_addr;
 +	extern bus_size_t x86_genfb_fb_size;
 +	extern bus_space_handle_t x86_genfb_fb_handle;
 +
 +	if (tag =3D=3D x86_bus_space_mem &&
 +	    x86_genfb_fb_addr <=3D busaddr &&
 +	    busaddr - x86_genfb_fb_addr <=3D x86_genfb_fb_size) {
 +		const bus_size_t offset =3D busaddr - x86_genfb_fb_addr;
 +		if (size > x86_genfb_fb_size - offset) {
 +			DRM_ERROR("Invalid fb access\n");
 +			return -EFAULT;
 +		}
 +		ret =3D -bus_space_subregion(x86_bus_space_mem,
 +		    x86_genfb_fb_handle, offset, size, handlep);
 +		if (ret)
 +			return ret;
 +		printf("%s: loaned [%"PRIxBUSADDR",%"PRIxBUSADDR")"
 +		    " to nouveau from [%"PRIxBUSADDR",%"PRIxBUSADDR")"
 +		    " genfb console\n", __func__,
 +		    (bus_addr_t)busaddr, (bus_addr_t)busaddr + size,
 +		    x86_genfb_fb_addr, x86_genfb_fb_size);
 +		*ptrp =3D bus_space_vaddr(tag, *handlep);
 +		return 0;
 +	}
 +
  	if (tag =3D=3D client->mmiot &&
  	    client->mmioaddr <=3D busaddr &&
  	    busaddr - client->mmioaddr <=3D client->mmiosz) {
 
 --=_17Wymd7lPaKOmlAiVMiz9N/EY5eA0fm1--
 


Home | Main Index | Thread Index | Old Index