FreeBSD Bugzilla – Attachment 178973 Details for
Bug 216123
ofwfb: r269278 broke booting on Power Mac G4
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Revert r269278, in a way that applies to CURRENT
r269278rev.patch (text/plain), 7.09 KB, created by
Tom Lane
on 2017-01-17 00:00:57 UTC
(
hide
)
Description:
Revert r269278, in a way that applies to CURRENT
Filename:
MIME Type:
Creator:
Tom Lane
Created:
2017-01-17 00:00:57 UTC
Size:
7.09 KB
patch
obsolete
>Index: sys/dev/vt/hw/ofwfb/ofwfb.c >=================================================================== >--- sys/dev/vt/hw/ofwfb/ofwfb.c (revision 269278) >+++ sys/dev/vt/hw/ofwfb/ofwfb.c (revision 269251) >@@ -52,9 +52,11 @@ > struct fb_info fb; > > phandle_t sc_node; >- ihandle_t sc_handle; > bus_space_tag_t sc_memt; > int iso_palette; >+ >+ struct ofw_pci_register sc_pciaddrs[8]; >+ int sc_num_pciaddrs; > }; > > static void ofwfb_initialize(struct vt_device *vd); >@@ -62,6 +64,7 @@ > static vd_init_t ofwfb_init; > static vd_bitblt_text_t ofwfb_bitblt_text; > static vd_bitblt_bmp_t ofwfb_bitblt_bitmap; >+static vd_fb_mmap_t ofwfb_mmap; > > static const struct vt_driver vt_ofwfb_driver = { > .vd_name = "ofwfb", >@@ -70,8 +73,7 @@ > .vd_blank = vt_fb_blank, > .vd_bitblt_text = ofwfb_bitblt_text, > .vd_bitblt_bmp = ofwfb_bitblt_bitmap, >- .vd_fb_ioctl = vt_fb_ioctl, >- .vd_fb_mmap = vt_fb_mmap, >+ .vd_fb_mmap = ofwfb_mmap, > .vd_priority = VD_PRIORITY_GENERIC+1, > }; > >@@ -280,6 +282,8 @@ > ofwfb_initialize(struct vt_device *vd) > { > struct ofwfb_softc *sc = vd->vd_softc; >+ char name[64]; >+ ihandle_t ih; > int i, err; > cell_t retval; > uint32_t oldpix; >@@ -289,6 +293,11 @@ > if (sc->fb.fb_flags & FB_FLAG_NOWRITE) > return; > >+ /* Open display device, thereby initializing it */ >+ memset(name, 0, sizeof(name)); >+ OF_package_to_path(sc->sc_node, name, sizeof(name)); >+ ih = OF_open(name); >+ > /* > * Set up the color map > */ >@@ -300,7 +309,7 @@ > 16, 255, 8, 255, 0); > > for (i = 0; i < 16; i++) { >- err = OF_call_method("color!", sc->sc_handle, 4, 1, >+ err = OF_call_method("color!", ih, 4, 1, > (cell_t)((sc->fb.fb_cmap[i] >> 16) & 0xff), > (cell_t)((sc->fb.fb_cmap[i] >> 8) & 0xff), > (cell_t)((sc->fb.fb_cmap[i] >> 0) & 0xff), >@@ -344,6 +353,7 @@ > struct ofwfb_softc *sc; > char type[64]; > phandle_t chosen; >+ ihandle_t stdout; > phandle_t node; > uint32_t depth, height, width, stride; > uint32_t fb_phys; >@@ -358,15 +368,14 @@ > vd->vd_softc = sc = &ofwfb_conssoftc; > > chosen = OF_finddevice("/chosen"); >- OF_getprop(chosen, "stdout", &sc->sc_handle, sizeof(ihandle_t)); >- node = OF_instance_to_package(sc->sc_handle); >+ OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)); >+ node = OF_instance_to_package(stdout); > if (node == -1) { > /* > * The "/chosen/stdout" does not exist try > * using "screen" directly. > */ > node = OF_finddevice("screen"); >- sc->sc_handle = OF_open("screen"); > } > OF_getprop(node, "device_type", type, sizeof(type)); > if (strcmp(type, "display") != 0) >@@ -375,13 +384,6 @@ > /* Keep track of the OF node */ > sc->sc_node = node; > >- /* >- * Try to use a 32-bit framebuffer if possible. This may be >- * unimplemented and fail. That's fine -- it just means we are >- * stuck with the defaults. >- */ >- OF_call_method("set-depth", sc->sc_handle, 1, 1, (cell_t)32, &i); >- > /* Make sure we have needed properties */ > if (OF_getproplen(node, "height") != sizeof(height) || > OF_getproplen(node, "width") != sizeof(width) || >@@ -393,7 +395,7 @@ > OF_getprop(node, "depth", &depth, sizeof(depth)); > if (depth != 8 && depth != 32) > return (CN_DEAD); >- sc->fb.fb_bpp = sc->fb.fb_depth = depth; >+ sc->fb.fb_bpp = depth; > > OF_getprop(node, "height", &height, sizeof(height)); > OF_getprop(node, "width", &width, sizeof(width)); >@@ -405,6 +407,21 @@ > sc->fb.fb_size = sc->fb.fb_height * sc->fb.fb_stride; > > /* >+ * Get the PCI addresses of the adapter, if present. The node may be the >+ * child of the PCI device: in that case, try the parent for >+ * the assigned-addresses property. >+ */ >+ len = OF_getprop(node, "assigned-addresses", sc->sc_pciaddrs, >+ sizeof(sc->sc_pciaddrs)); >+ if (len == -1) { >+ len = OF_getprop(OF_parent(node), "assigned-addresses", >+ sc->sc_pciaddrs, sizeof(sc->sc_pciaddrs)); >+ } >+ if (len == -1) >+ len = 0; >+ sc->sc_num_pciaddrs = len / sizeof(struct ofw_pci_register); >+ >+ /* > * Grab the physical address of the framebuffer, and then map it > * into our memory space. If the MMU is not yet up, it will be > * remapped for us when relocation turns on. >@@ -415,18 +432,13 @@ > > #if defined(__powerpc__) > sc->sc_memt = &bs_be_tag; >- bus_space_map(sc->sc_memt, fb_phys, sc->fb.fb_size, >+ bus_space_map(sc->sc_memt, fb_phys, height * sc->fb.fb_stride, > BUS_SPACE_MAP_PREFETCHABLE, &sc->fb.fb_vbase); > #elif defined(__sparc64__) > OF_decode_addr(node, 0, &space, &phys); > sc->sc_memt = &ofwfb_memt[0]; > sc->fb.fb_vbase = > sparc64_fake_bustag(space, fb_phys, sc->sc_memt); >- #elif defined(__arm__) >- sc->sc_memt = fdtbus_bs_tag; >- bus_space_map(sc->sc_memt, sc->fb.fb_pbase, sc->fb.fb_size, >- BUS_SPACE_MAP_PREFETCHABLE, >- (bus_space_handle_t *)&sc->fb.fb_vbase); > #else > #error Unsupported platform! > #endif >@@ -440,31 +452,14 @@ > * Linux does the same thing. > */ > >- struct ofw_pci_register pciaddrs[8]; >- int num_pciaddrs = 0; >- >- /* >- * Get the PCI addresses of the adapter, if present. The node >- * may be the child of the PCI device: in that case, try the >- * parent for the assigned-addresses property. >- */ >- len = OF_getprop(node, "assigned-addresses", pciaddrs, >- sizeof(pciaddrs)); >- if (len == -1) { >- len = OF_getprop(OF_parent(node), "assigned-addresses", >- pciaddrs, sizeof(pciaddrs)); >- } >- if (len == -1) >- len = 0; >- num_pciaddrs = len / sizeof(struct ofw_pci_register); >- >- fb_phys = num_pciaddrs; >- for (i = 0; i < num_pciaddrs; i++) { >+ fb_phys = sc->sc_num_pciaddrs; >+ for (i = 0; i < sc->sc_num_pciaddrs; i++) { > /* If it is too small, not the framebuffer */ >- if (pciaddrs[i].size_lo < sc->fb.fb_stride * height) >+ if (sc->sc_pciaddrs[i].size_lo < >+ sc->fb.fb_stride * height) > continue; > /* If it is not memory, it isn't either */ >- if (!(pciaddrs[i].phys_hi & >+ if (!(sc->sc_pciaddrs[i].phys_hi & > OFW_PCI_PHYS_HI_SPACE_MEM32)) > continue; > >@@ -472,11 +467,12 @@ > fb_phys = i; > > /* If it is prefetchable, it certainly is */ >- if (pciaddrs[i].phys_hi & OFW_PCI_PHYS_HI_PREFETCHABLE) >+ if (sc->sc_pciaddrs[i].phys_hi & >+ OFW_PCI_PHYS_HI_PREFETCHABLE) > break; > } > >- if (fb_phys == num_pciaddrs) /* No candidates found */ >+ if (fb_phys == sc->sc_num_pciaddrs) /* No candidates found */ > return (CN_DEAD); > > #if defined(__powerpc__) >@@ -501,3 +497,39 @@ > return (CN_INTERNAL); > } > >+static int >+ofwfb_mmap(struct vt_device *vd, vm_ooffset_t offset, vm_paddr_t *paddr, >+ int prot, vm_memattr_t *memattr) >+{ >+ struct ofwfb_softc *sc = vd->vd_softc; >+ int i; >+ >+ /* >+ * Make sure the requested address lies within the PCI device's >+ * assigned addrs >+ */ >+ for (i = 0; i < sc->sc_num_pciaddrs; i++) >+ if (offset >= sc->sc_pciaddrs[i].phys_lo && >+ offset < (sc->sc_pciaddrs[i].phys_lo + sc->sc_pciaddrs[i].size_lo)) >+ { >+#ifdef VM_MEMATTR_WRITE_COMBINING >+ /* >+ * If this is a prefetchable BAR, we can (and should) >+ * enable write-combining. >+ */ >+ if (sc->sc_pciaddrs[i].phys_hi & >+ OFW_PCI_PHYS_HI_PREFETCHABLE) >+ *memattr = VM_MEMATTR_WRITE_COMBINING; >+#endif >+ >+ *paddr = offset; >+ return (0); >+ } >+ >+ /* >+ * Hack for Radeon... >+ */ >+ *paddr = offset; >+ return (0); >+} >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 216123
: 178973 |
178976
|
179069