From: kettenis Date: Sat, 22 Sep 2018 17:41:52 +0000 (+0000) Subject: Remap the UEFI buffer early such that we can use a write combining mapping X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=78d4b260dfb12054ff815d8f68c72a954e36a727;p=openbsd Remap the UEFI buffer early such that we can use a write combining mapping which speeds things up considerably compared to an uncached mapping. ok deraadt@ --- diff --git a/sys/arch/amd64/amd64/efifb.c b/sys/arch/amd64/amd64/efifb.c index 3a2ed3625fc..255b8f7760d 100644 --- a/sys/arch/amd64/amd64/efifb.c +++ b/sys/arch/amd64/amd64/efifb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efifb.c,v 1.17 2018/07/12 12:47:57 fcambus Exp $ */ +/* $OpenBSD: efifb.c,v 1.18 2018/09/22 17:41:52 kettenis Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko @@ -215,11 +215,6 @@ efifb_attach(struct device *parent, struct device *self, void *aux) ccol = ri->ri_ccol; crow = ri->ri_crow; - if (bus_space_map(iot, fb->paddr, fb->psize, - BUS_SPACE_MAP_PREFETCHABLE | BUS_SPACE_MAP_LINEAR, - &ioh) == 0) - ri->ri_origbits = bus_space_vaddr(iot, ioh); - efifb_rasops_preinit(fb); ri->ri_flg &= ~RI_CLEAR; ri->ri_flg |= RI_VCONS | RI_WRONLY; @@ -428,6 +423,7 @@ efifb_efiinfo_init(struct efifb *fb) fb->psize = bios_efiinfo->fb_height * bios_efiinfo->fb_pixpsl * (fb->depth / 8); } + void efifb_cnattach_common(void) { @@ -452,6 +448,28 @@ efifb_cnattach_common(void) wsdisplay_cnattach(&efifb_std_descr, ri, 0, 0, defattr); } +void +efifb_cnremap(void) +{ + struct efifb *fb = &efifb_console; + struct rasops_info *ri = &fb->rinfo; + bus_space_tag_t iot = X86_BUS_SPACE_MEM; + bus_space_handle_t ioh; + + if (fb->paddr == 0) + return; + + if (_bus_space_map(iot, fb->paddr, fb->psize, + BUS_SPACE_MAP_PREFETCHABLE | BUS_SPACE_MAP_LINEAR, &ioh) == 0) + ri->ri_origbits = bus_space_vaddr(iot, ioh); + + efifb_rasops_preinit(fb); + ri->ri_flg &= ~RI_CLEAR; + ri->ri_flg |= RI_CENTER | RI_WRONLY; + + rasops_init(ri, efifb_std_descr.nrows, efifb_std_descr.ncols); +} + int efifb_is_console(struct pci_attach_args *pa) { diff --git a/sys/arch/amd64/amd64/mainbus.c b/sys/arch/amd64/amd64/mainbus.c index 2f0a74f51d2..f4fb3ec02fd 100644 --- a/sys/arch/amd64/amd64/mainbus.c +++ b/sys/arch/amd64/amd64/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.44 2018/07/13 08:30:34 sf Exp $ */ +/* $OpenBSD: mainbus.c,v 1.45 2018/09/22 17:41:52 kettenis Exp $ */ /* $NetBSD: mainbus.c,v 1.1 2003/04/26 18:39:29 fvdl Exp $ */ /* @@ -171,6 +171,10 @@ mainbus_attach(struct device *parent, struct device *self, void *aux) pvbus_identify(); #endif +#if NEFIFB > 0 + efifb_cnremap(); +#endif + #if NBIOS > 0 { mba.mba_bios.ba_name = "bios"; diff --git a/sys/arch/amd64/include/efifbvar.h b/sys/arch/amd64/include/efifbvar.h index 558199631b6..a900cd0238d 100644 --- a/sys/arch/amd64/include/efifbvar.h +++ b/sys/arch/amd64/include/efifbvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: efifbvar.h,v 1.7 2018/04/25 00:46:28 jsg Exp $ */ +/* $OpenBSD: efifbvar.h,v 1.8 2018/09/22 17:41:52 kettenis Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko @@ -26,6 +26,7 @@ struct efifb_attach_args { struct pci_attach_args; int efifb_cnattach(void); +void efifb_cnremap(void); int efifb_is_console(struct pci_attach_args *); void efifb_cndetach(void); void efifb_cnreattach(void);