Subject: Re: X works on Quadra 630 (and probably 575)
To: None <port-mac68k@NetBSD.ORG>
From: Geoff Roberts <gjr01@uow.edu.au>
List: port-mac68k
Date: 10/27/1997 11:27:31
Well done - I have been hanging out for X on my 630.   Does anybody have a
kernel with these changes in it?   I don't have the space yet to start
rolling my own.

Geoff

>Good News! I found the right memory addresses to make grf0 probe right on
>a Quadra 630. According to the Apple documentation for the 575, their's is
>the same.
>
>Here's the changes needed to make it work. The other Quadras that have X
>working shouldn't be broken by these changes.
>
>*** 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");
>                }
>
>
>Whoops... looks like I left a couple of debugging statements in there...
>take those out if you want.
>
>
>Kelly
> --
>,--------------------------------------------------------------.
>| Kelly A. Campbell              | Kansas State University     |
>| camk@telecom.ksu.edu           | Telecommunications          |
>| camk@ksu.edu                   | Applications Developer      |
>| http://www.spub.ksu.edu/~camk/ | http://www.telecom.ksu.edu/ |
>`--------------------------------------------------------------'