Subject: Re: pb2400 xfree86 works
To: None <port-macppc@netbsd.org>
From: Miles Nordin <carton@Ivy.NET>
List: port-macppc
Date: 04/03/2005 03:58:09
--pgp-sign-Multipart_Sun_Apr__3_03:58:08_2005-1
Content-Type: text/plain; charset=US-ASCII

>>>>> "m" == Michael  <macallan18@earthlink.net> writes:

     m> The kernel changes are short and simple ( can't post a real
     m> patch because my console stuff differs a lot from the official

yes, it worked.  Also it works in securelevel 1.  Below is the patch
for 2.0.  Along with it I used your binary X server at

http://macallam.homeunix.org:6704/stuff/BSD/XFree86_server_macppc.tar.bz2

and I had to use these options in XF86Config:

Section "InputDevice"
    Identifier  "Keyboard1"
    Driver      "Keyboard"

    Option "Protocol" "wskbd"
    Option "Device" "/dev/wskbd0"
[...]
EndSection

Section "Device"
[...]
    Option      "NoInt10" "true"
    Option      "NoAccel" "true"
    Option      "SwCursor" "true"
EndSection

Without NoInt10, it wouldn't start.  Without NoAccel, I got mirror
image letters, like the letter f with the hook at the top facing left
instead of right.  Without SwCursor I got a garbled cursor.

The advantage over Xmacppc is, i have XRENDER and all the other
extensions, some antialiased fonts, and 16bpp.  The disadvantage is,
garbled screen after exiting X.

PB2400 is much better now.  Thanks!

Index: ofb.c
===================================================================
RCS file: /scratch/cvsroot/netbsd/src/sys/arch/macppc/dev/ofb.c,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 ofb.c
--- ofb.c	12 Dec 2003 11:33:32 -0000	1.1.1.5
+++ ofb.c	3 Apr 2005 00:30:38 -0000
@@ -181,6 +181,7 @@
 
 	sc->sc_pc = pa->pa_pc;
 	sc->sc_pcitag = pa->pa_tag;
+	sc->sc_iot = pa->pa_iot; /* allow mmap()ing IO space */
 
 	/* XXX */
 	if (OF_getprop(node, "assigned-addresses", sc->sc_addrs,
@@ -386,12 +387,26 @@
 	struct ofb_devconfig *dc = sc->sc_dc;
 	struct rasops_info *ri = &dc->dc_ri;
 	u_int32_t *ap = sc->sc_addrs;
-	paddr_t pa;
+	paddr_t pa, io;
 	int i;
 
 	if (offset >=0 && offset < (ri->ri_stride * ri->ri_height))
 		return dc->dc_paddr + offset;
 
+	/* allow to map our IO space... */
+	io=(sc->sc_iot & MACPPC_BUS_ADDR_MASK);	
+	if ((offset >= 0xf0000000) && (offset<(0xf0800000)))	/* 23 bit Macintosh IO space */
+	{
+		return io+(offset-0xf0000000);
+	}
+
+#ifdef OFB_FAKE_VGA_FB
+	/* somewhat frivolous - fake the VGA framebuffer so vgahw actually does something
+	    halfway useful when mapping 0xa0000 */
+	if((offset>=0xa0000) && (offset<0xc0000))
+		return dc->dc_paddr + offset - 0xa0000;
+#endif
+
 	pa = offset;
 	for (i = 0; i < 6; i++) {
 		switch (ap[0] & OFW_PCI_PHYS_HI_SPACEMASK) {
Index: ofbvar.h
===================================================================
RCS file: /scratch/cvsroot/netbsd/src/sys/arch/macppc/dev/ofbvar.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 ofbvar.h
--- ofbvar.h	10 Dec 2002 22:01:35 -0000	1.1.1.2
+++ ofbvar.h	2 Apr 2005 22:14:12 -0000
@@ -39,6 +39,7 @@
 
 	pci_chipset_tag_t sc_pc;
 	pcitag_t sc_pcitag;
+        bus_space_tag_t sc_iot;
 
 	struct ofb_devconfig *sc_dc;	/* device configuration */
 	int nscreens;

--pgp-sign-Multipart_Sun_Apr__3_03:58:08_2005-1
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)

iQCVAwUAQk+iEYnCBbTaW/4dAQJF6AQAmRTj3LRhNiGDjUicWAeRiq5a8QGgjwBC
5BkJo7ObMlTjVEADcO8fpk075bKFumYhQL28K9lGqXlguGqHM6eL9rKy69sduD33
QIxB/KfF1L/VRy6XGdu61cIQm2q2KsL2ja5ldbLRysYI+M34CtYzbJ5bw+g+Q6k5
n/vCploY8ds=
=IzWD
-----END PGP SIGNATURE-----

--pgp-sign-Multipart_Sun_Apr__3_03:58:08_2005-1--