Subject: Re: XF430 debugging advice needed
To: Aymeric Vincent <xmimic@free.fr>
From: David Hopper <dhop@nwlink.com>
List: tech-x11
Date: 03/02/2003 17:01:03
Aymeric Vincent wrote:
> David Hopper <dhop@nwlink.com> writes:
> 
>>I've patched up alpha_video.c to build, but I've hit a snag in the new
>>scanpci code in XFree86 4.3.0 on Alpha.  Even just a nudge in the
>>right direction would be appreciated:
>>
>>Program received signal SIGSEGV, Segmentation fault.
>>0x12026a1b0 in pciReadLong (tag=0, offset=0) at Pci.c:282
>>282       if ((bus >= 0) && ((bus < pciNumBuses) || inProbe) && pciBusInfo[bus] &&
> 
> 
> Please update
> xsrc/xfree/xc/programs/Xserver/hw/xfree86/os-support/bus/netbsdPci.c
> to rev. 1.7

*Very* *very* cool, thank you.

XFree 430 now works just fine on alpha (running KDE3 on it as we speak).  I've 
attached my (NetBSD-alpha selfish) diffs to alpha_video.c to this message.  It 
would be nice if someone could look them over and make them more diplomatic. 
In particular, I had to blow away the HAS_APERTURE_DRV #ifdefs because in the 
end, I just couldn't sort out a parse error in the maze of brackets.

>  Aymeric

Thx,
Dave

--begin inserted text--

--- ./alpha_video.c	2003-03-01 21:12:14.000000000 +0000
+++ ./alpha_video.c	2003-03-02 16:47:37.000000000 +0000
@@ -205,28 +205,6 @@
  	    return;
  	devMemChecked = TRUE;

-#ifdef HAS_APERTURE_DRV
-       /* Try the aperture driver first */
-       if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0) {
-           /* Try to map a page at the VGA address */
-           base = mmap((caddr_t)0, 4096, PROT_READ|PROT_WRITE,
-                            MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE);
-
-           if (base != MAP_FAILED) {
-               munmap((caddr_t)base, 4096);
-               devMemFd = fd;
-               useDevMem = TRUE;
-               xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n",
-                       DEV_APERTURE);
-               return;
-           } else {
-               if (warn) {
-                   xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
-                           DEV_APERTURE, strerror(errno));
-               }
-           }
-       }
-#endif
         if ((fd = open(DEV_MEM, O_RDWR)) >= 0) {
  	    /* Try to map a page at the VGA address */
  	    base = mmap((caddr_t)0, 4096, PROT_READ|PROT_WRITE,
@@ -245,25 +223,12 @@
  	    }
  	}
  	if (warn) {
-#ifndef HAS_APERTURE_DRV
             xf86Msg(X_WARNING, "checkDevMem: failed to open/mmap %s (%s)\n",
                     DEV_MEM, strerror(errno));
             xf86ErrorF("\tlinear framebuffer access unavailable\n");
-#else
-#ifndef __OpenBSD__
-           xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
-               "\t(%s)\n", DEV_APERTURE, DEV_MEM, strerror(errno));
-#else /* __OpenBSD__ */
-           xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
-                   "\t(%s)\n%s", DEV_APERTURE, DEV_MEM, strerror(errno),
-                   SYSCTL_MSG);
-#endif /* __OpenBSD__ */
-	
-           xf86ErrorF("\tlinear framebuffer access unavailable\n");
  	}
  	useDevMem = FALSE;
  	return;
-#endif
  }

  void
@@ -280,11 +245,6 @@
  	    xf86Msg(X_PROBED,"Machine needs sparse mapping\n");
  	    pVidMem->mapMem = mapVidMemSparse;
  	    pVidMem->unmapMem = unmapVidMemSparse;
-	    if (axpSystem == -1)
-                axpSystem = bsdGetAXP();
-	    hae_thresh = xf86AXPParams[axpSystem].hae_thresh;
-            hae_mask = xf86AXPParams[axpSystem].hae_mask;
-            sparse_size = xf86AXPParams[axpSystem].size;
  	}
  	pVidMem->initialised = TRUE;
  }
@@ -546,8 +506,8 @@
      mem_barrier();
      Offset += (unsigned long)Base - (unsigned long)memBase;
      shift = (Offset & 0x3) << 3;
-      if (Offset >= (hae_thresh)) {
-        msb = Offset & hae_mask;
+      if (Offset >= (1UL << 24)) {
+        msb = Offset & 0xf8000000UL;
          Offset -= msb;
  	if (msb_set != msb) {
  	sethae(msb);
@@ -569,8 +529,8 @@
      mem_barrier();
      Offset += (unsigned long)Base - (unsigned long)memBase;
      shift = (Offset & 0x2) << 3;
-    if (Offset >= (hae_thresh)) {
-        msb = Offset & hae_mask;
+    if (Offset >= (1UL << 24)) {
+        msb = Offset & 0xf8000000UL;
          Offset -= msb;
        if (msb_set != msb) {
  	sethae(msb);
@@ -597,8 +557,8 @@

      write_mem_barrier();
      Offset += (unsigned long)Base - (unsigned long)memBase;
-    if (Offset >= (hae_thresh)) {
-      msb = Offset & hae_mask;
+    if (Offset >= (1UL << 24)) {
+      msb = Offset & 0xf8000000;
        Offset -= msb;
        if (msb_set != msb) {
  	sethae(msb);
@@ -616,8 +576,8 @@

      write_mem_barrier();
      Offset += (unsigned long)Base - (unsigned long)memBase;
-    if (Offset >= (hae_thresh)) {
-      msb = Offset & hae_mask;
+    if (Offset >= (1UL << 24)) {
+      msb = Offset & 0xf8000000;
        Offset -= msb;
        if (msb_set != msb) {
  	sethae(msb);
@@ -644,8 +604,8 @@
      register unsigned int b = Value & 0xffU;

      Offset += (unsigned long)Base - (unsigned long)memBase;
-    if (Offset >= (hae_thresh)) {
-      msb = Offset & hae_mask;
+    if (Offset >= (1UL << 24)) {
+      msb = Offset & 0xf8000000;
        Offset -= msb;
        if (msb_set != msb) {
  	sethae(msb);
@@ -662,8 +622,8 @@
      register unsigned int w = Value & 0xffffU;

      Offset += (unsigned long)Base - (unsigned long)memBase;
-    if (Offset >= (hae_thresh)) {
-      msb = Offset & hae_mask ;
+    if (Offset >= (1UL << 24)) {
+      msb = Offset & 0xf8000000;
        Offset -= msb;
        if (msb_set != msb) {
  	sethae(msb);

--end inserted text--