> Date: Sun, 22 Aug 2021 23:18:41 -0400 > From: George Koehler <kern...@gmail.com> > > This sloppy diff enables astfb on my Talos. It works around the > firmware's wrong sc_fbaddr by mapping PCI BAR 0x10 and using it as a > framebuffer. Mark, you might make a better diff?
That doesn't work since the framebuffer may start at an offset within that BAR. At least it does on my machine. > "pcidump -v" didn't show my ast vga device until I made the missing > /dev/pci5 node. Then it showed some BARs. I tried BAR 0x10 because > its size seemed big enough for a framebuffer. I got the idea from > some code in /usr/xenocara/driver/xf86-video-ast that seemed to use > a PCI region as a framebuffer. Hmm, we probably should have MAKEDEV create more /dev/pciN nodes. > When I started xenodm, the colors were wrong. I added some code to > xf86-video-wsfb that fixed some colors, but caused emacs to crash > in a weird way. --George Yeah, the framebuffer is little-endian. Ideally we'd have an wscons ioctl that returns the actual pixel format, but you can use the WSDISPLAY_TYPE_ASTFB and check you're running on a big-endian system instead. However, it seems that some parts of X are just plain broken with the pixel format that you end up with. > Index: arch/powerpc64/dev/astfb.c > =================================================================== > RCS file: /cvs/src/sys/arch/powerpc64/dev/astfb.c,v > retrieving revision 1.3 > diff -u -p -r1.3 astfb.c > --- arch/powerpc64/dev/astfb.c 30 Oct 2020 13:36:45 -0000 1.3 > +++ arch/powerpc64/dev/astfb.c 23 Aug 2021 02:49:48 -0000 > @@ -118,8 +118,17 @@ astfb_attach(struct device *parent, stru > sc->sc_iot = pa->pa_memt; > if (bus_space_map(sc->sc_iot, sc->sc_fbaddr, sc->sc_fbsize, > BUS_SPACE_MAP_LINEAR, &sc->sc_ioh)) { > - printf(": can't map framebuffer\n"); > - return; > + bus_size_t size; > + pcireg_t maptype; > + > + maptype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, ASTFB_PCI_FB); > + if (pci_mapreg_map(pa, ASTFB_PCI_FB, maptype, > + BUS_SPACE_MAP_LINEAR, &sc->sc_iot, &sc->sc_ioh, > + &sc->sc_fbaddr, &size, 0) != 0) { > + printf(": can't map framebuffer\n"); > + return; > + } > + printf(": BAR size 0x%zx", (size_t)size); > } > > printf("\n"); >