Subject: port-mac68k/4352: video base address wrong for grf_iv on Quadra 630, 575
To: None <gnats-bugs@gnats.netbsd.org>
From: None <camk@telecom.ksu.edu>
List: netbsd-bugs
Date: 10/26/1997 00:40:33
>Number:         4352
>Category:       port-mac68k
>Synopsis:       Video Base for Q630 needs changed to 0xf9000000
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 26 01:35:02 1997
>Last-Modified:
>Originator:     Kelly Campbell
>Organization:
Kansas State University Telecommunications
>Release:        Oct 24, 1997
>Environment:
Apple Quadra 630, NetBSD 1.3_ALPHA, X11R6
System: NetBSD qrapper 1.3_ALPHA NetBSD 1.3_ALPHA (QRAPPER) #5: Sat Oct 25 14:49:39 CDT 1997 camk@qrapper:/opt/src/sys/arch/mac68k/compile/QRAPPER mac68k


>Description:
	The video base for the Quadra 630 and 575 is set wrong in the
	current sources
>How-To-Repeat:
	grf0 doesn't probe at boot time.
>Fix:
	Patches for mac68k/mac68k/machdep.c & mac68k/dev/grf_iv.c:
*** machdep.c+  Thu Oct 23 06:44:05 1997
--- machdep.c   Sat Oct 25 13:05:09 1997
***************
*** 2012,2018 ****
        {MACH_MACQ605_33, "Quadra", " 605/33 ", MACH_CLASSQ, &romvecs[9]},
        {MACH_MACC610, "Centris", " 610 ", MACH_CLASSQ, &romvecs[6]},
        {MACH_MACQ610, "Quadra", " 610 ", MACH_CLASSQ, &romvecs[6]},
!       {MACH_MACQ630, "Quadra", " 630 ", MACH_CLASSQ, &romvecs[13]},
        {MACH_MACC660AV, "Centris", " 660AV ", MACH_CLASSAV, &romvecs[7]},
        {MACH_MACQ840AV, "Quadra", " 840AV ", MACH_CLASSAV, &romvecs[7]},
  
--- 2012,2018 ----
        {MACH_MACQ605_33, "Quadra", " 605/33 ", MACH_CLASSQ, &romvecs[9]},
        {MACH_MACC610, "Centris", " 610 ", MACH_CLASSQ, &romvecs[6]},
        {MACH_MACQ610, "Quadra", " 610 ", MACH_CLASSQ, &romvecs[6]},
!       {MACH_MACQ630, "Quadra", " 630 ", MACH_CLASSQ2, &romvecs[13]},
        {MACH_MACC660AV, "Centris", " 660AV ", MACH_CLASSAV, &romvecs[7]},
        {MACH_MACQ840AV, "Quadra", " 840AV ", MACH_CLASSAV, &romvecs[7]},
  
*** grf_iv.c+   Thu Oct  9 18:27:44 1997
--- grf_iv.c    Sat Oct 25 13:14:59 1997
***************
*** 73,78 ****
--- 73,79 ----
  };
  
  #define QUADRA_DAFB_BASE      0xF9800000
+ #define QUADRA_DAFB_BASE_2    0xF9000000
  #define CIVIC_CONTROL_BASE    0x50036000
  
  static int
***************
*** 84,92 ****
--- 85,100 ----
        struct obio_attach_args *oa = (struct obio_attach_args *)aux;
        bus_space_handle_t bsh;
        int found, sense;
+       int base = 0;
  
        found = 1;
  
+       if (current_mac_model->class == MACH_CLASSQ) {
+               base = QUADRA_DAFB_BASE;
+       }
+       else if (current_mac_model->class == MACH_CLASSQ2) {
+               base = QUADRA_DAFB_BASE_2;
+       }
          switch (current_mac_model->class) {
        case MACH_CLASSQ:
        case MACH_CLASSQ2:
***************
*** 95,106 ****
                 * access the memory.
                 */
  
!               if (bus_space_map(oa->oa_tag, QUADRA_DAFB_BASE, 0x1000,
                                        0, &bsh)) {
                        panic("failed to map space for DAFB regs.\n");
                }
  
                if (bus_probe(oa->oa_tag, bsh, 0x1C, 4) == 0) {
                        bus_space_unmap(oa->oa_tag, bsh, 0x1000);
                        found = 0;
                        goto nodafb;
--- 103,115 ----
                 * access the memory.
                 */
  
!               if (bus_space_map(oa->oa_tag, base, 0x1000,
                                        0, &bsh)) {
                        panic("failed to map space for DAFB regs.\n");
                }
  
                if (bus_probe(oa->oa_tag, bsh, 0x1C, 4) == 0) {
+ printf("bus_probe for grf failed\n");
                        bus_space_unmap(oa->oa_tag, bsh, 0x1000);
                        found = 0;
                        goto nodafb;
***************
*** 108,115 ****
  
                sense = (bus_space_read_4(oa->oa_tag, bsh, 0x1C) & 7);
  
!               if (sense == 0)
                        found = 0;
  
                /* Set "Turbo SCSI" configuration to default */
                bus_space_write_4(oa->oa_tag, bsh, 0x24, 0x1d1); /* ch0 */
--- 117,126 ----
  
                sense = (bus_space_read_4(oa->oa_tag, bsh, 0x1C) & 7);
  
!               if (sense == 0) {
! printf("bus_space_read sense wrong. sense = %d\n",sense);
                        found = 0;
+               }
  
                /* Set "Turbo SCSI" configuration to default */
                bus_space_write_4(oa->oa_tag, bsh, 0x24, 0x1d1); /* ch0 */
***************
*** 157,172 ****
        struct obio_attach_args *oa = (struct obio_attach_args *)aux;
        struct grfbus_softc *sc;
        struct grfmode *gm;
  
        sc = (struct grfbus_softc *)self;
  
        sc->card_id = 0;
! 
          switch (current_mac_model->class) {
          case MACH_CLASSQ:
          case MACH_CLASSQ2:
                sc->sc_tag = oa->oa_tag;
!               if (bus_space_map(sc->sc_tag, QUADRA_DAFB_BASE, 0x1000,
                                        0, &sc->sc_regh)) {
                        panic("failed to map space for DAFB regs.\n");
                }
--- 168,190 ----
        struct obio_attach_args *oa = (struct obio_attach_args *)aux;
        struct grfbus_softc *sc;
        struct grfmode *gm;
+       int base = 0;
  
        sc = (struct grfbus_softc *)self;
  
        sc->card_id = 0;
!       
!       if (current_mac_model->class == MACH_CLASSQ) {
!               base = QUADRA_DAFB_BASE;
!       }
!       else if (current_mac_model->class == MACH_CLASSQ2) {
!               base = QUADRA_DAFB_BASE_2;
!       }
          switch (current_mac_model->class) {
          case MACH_CLASSQ:
          case MACH_CLASSQ2:
                sc->sc_tag = oa->oa_tag;
!               if (bus_space_map(sc->sc_tag, base, 0x1000,
                                        0, &sc->sc_regh)) {
                        panic("failed to map space for DAFB regs.\n");
                }


>Audit-Trail:
>Unformatted: