Port-macppc archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: machfb (sort of) working on Mach64 GX
I've adapted your patch to -current (machfb.c r1.63) in case your
findings might get the RagePro in the original iMac 233Mhz G3 to
work.
There was some rearrangement so the "last" patch actually came earlier.
The patched "machfb.c" compiles. I hope I can test it this afternoon,
otherwise it will be next week before I can test it.
--
|/"\ John D. Baker, KN5UKS NetBSD Darwin/MacOS X
|\ / jdbaker[snail]mylinuxisp[flyspeck]com OpenBSD FreeBSD
| X No HTML/proprietary data in email. BSD just sits there and works!
|/ \ GPGkeyID: D703 4A7E 479F 63F8 D3F4 BD99 9572 8F23 E4AD 1645
Index: dev/pci/machfb.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/machfb.c,v
retrieving revision 1.63
diff -u -r1.63 machfb.c
--- dev/pci/machfb.c 22 Jan 2011 15:14:28 -0000 1.63
+++ dev/pci/machfb.c 28 Apr 2011 12:13:22 -0000
@@ -193,6 +193,8 @@
{ PCI_PRODUCT_ATI_RAGE_LT_PRO, 230000 },
{ PCI_PRODUCT_ATI_RAGE_LT, 230000 },
{ PCI_PRODUCT_ATI_RAGE_LT_PRO_PCI, 230000 },
+ { PCI_PRODUCT_ATI_MACH64_GX, 135000 },
+ { PCI_PRODUCT_ATI_MACH64_CX, 135000 },
{ PCI_PRODUCT_ATI_MACH64_VT, 170000 },
{ PCI_PRODUCT_ATI_MACH64_VTB, 200000 },
{ PCI_PRODUCT_ATI_MACH64_VT4, 230000 }
@@ -201,6 +203,12 @@
static int mach64_chip_id, mach64_chip_rev;
static struct videomode default_mode = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
+static const char *mach64_gx_memtype_names[] = {
+ "DRAM", "VRAM", "VRAM", "DRAM",
+ "DRAM", "VRAM", "VRAM", "(unknown type)"
+};
+
+
static const char *mach64_memtype_names[] = {
"(N/A)", "DRAM", "EDO DRAM", "EDO DRAM", "SDRAM", "SGRAM", "WRAM",
"(unknown type)"
@@ -507,7 +515,9 @@
prop_data_t edid_data;
const struct videomode *mode = NULL;
char devinfo[256];
- int bar, id;
+ int bar, id, expected_id;
+ int is_gx;
+ const char **memtype_names;
struct wsemuldisplaydev_attach_args aa;
long defattr;
int setmode, width, height;
@@ -566,6 +576,14 @@
}
sc->sc_aperture = (void *)bus_space_vaddr(sc->sc_memt, sc->sc_memh);
+ /* If the BAR was never mapped, fix it up in MMIO. */
+ if(!sc->sc_regsize)
+ {
+ sc->sc_regsize = MACH64_REG_SIZE;
+ sc->sc_regbase = sc->sc_aperbase + MACH64_REG_OFF;
+ sc->sc_regphys = sc->sc_aperphys + MACH64_REG_OFF;
+ }
+
sc->sc_regt = sc->sc_memt;
bus_space_subregion(sc->sc_regt, sc->sc_memh, MACH64_REG_OFF,
sc->sc_regsize, &sc->sc_regh);
@@ -608,19 +626,37 @@
printf("mode: %s\n", mode->name);
}
}
- if (mach64_chip_id == PCI_PRODUCT_ATI_MACH64_CT ||
- ((mach64_chip_id == PCI_PRODUCT_ATI_MACH64_VT ||
- mach64_chip_id == PCI_PRODUCT_ATI_RAGE_II) &&
- (mach64_chip_rev & 0x07) == 0))
- sc->has_dsp = 0;
- else
- sc->has_dsp = 1;
+ is_gx = 0;
+ switch(mach64_chip_id)
+ {
+ case PCI_PRODUCT_ATI_MACH64_GX:
+ case PCI_PRODUCT_ATI_MACH64_CX:
+ is_gx = 1;
+ case PCI_PRODUCT_ATI_MACH64_CT:
+ sc->has_dsp = 0;
+ break;
+ case PCI_PRODUCT_ATI_MACH64_VT:
+ case PCI_PRODUCT_ATI_RAGE_II:
+ if((mach64_chip_rev & 0x07) == 0)
+ {
+ sc->has_dsp = 0;
+ break;
+ }
+ /* Otherwise fall through. */
+ default:
+ sc->has_dsp = 1;
+ }
+
+ memtype_names = is_gx ? mach64_gx_memtype_names : mach64_memtype_names;
sc->memsize = mach64_get_memsize(sc);
if (sc->memsize == 8192)
/* The last page is used as register aperture. */
sc->memsize -= 4;
- sc->memtype = regr(sc, CONFIG_STAT0) & 0x07;
+ if(is_gx)
+ sc->memtype = (regr(sc, CONFIG_STAT0) >> 3) & 0x07;
+ else
+ sc->memtype = regr(sc, CONFIG_STAT0) & 0x07;
/* XXX is there any way to calculate reference frequency from
known values? */
@@ -649,14 +685,27 @@
aprint_normal_dev(sc->sc_dev,
"%ld KB %s %d.%d MHz, maximum RAMDAC clock %d MHz\n",
(u_long)sc->memsize,
- mach64_memtype_names[sc->memtype],
+ memtype_names[sc->memtype],
sc->mem_freq / 1000, sc->mem_freq % 1000,
sc->ramdac_freq / 1000);
id = regr(sc, CONFIG_CHIP_ID) & 0xffff;
- if (id != mach64_chip_id) {
+ switch(mach64_chip_id)
+ {
+ case PCI_PRODUCT_ATI_MACH64_GX:
+ expected_id = 0x00d7;
+ break;
+ case PCI_PRODUCT_ATI_MACH64_CX:
+ expected_id = 0x0057;
+ break;
+ default:
+ /* Most chip IDs match their PCI product ID. */
+ expected_id = mach64_chip_id;
+ }
+
+ if (id != expected_id) {
aprint_error_dev(sc->sc_dev,
- "chip ID mismatch, 0x%x != 0x%x\n", id, mach64_chip_id);
+ "chip ID mismatch, 0x%x != 0x%x\n", id, expected_id);
return;
}
@@ -732,6 +781,8 @@
machfb_blank(sc, 0); /* unblank the screen */
if (sc->sc_console) {
+ struct mach64_crtcregs crtc;
+
vcons_init_screen(&sc->vd, &mach64_console_screen, 1,
&defattr);
mach64_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC;
@@ -741,6 +792,11 @@
mach64_defaultscreen.capabilities = ri->ri_caps;
mach64_defaultscreen.nrows = ri->ri_rows;
mach64_defaultscreen.ncols = ri->ri_cols;
+
+ /* Set the mode. */
+ if (!mach64_calc_crtcregs(sc, &crtc, &default_mode))
+ mach64_set_crtcregs(sc, &crtc);
+
wsdisplay_cnattach(&mach64_defaultscreen, ri, 0, 0, defattr);
vcons_replay_msgbuf(&mach64_console_screen);
} else {
Home |
Main Index |
Thread Index |
Old Index