Subject: Re: x11, keycodes, GL...
To: None <timo.schoeler@macfinity.net>
From: Michael <macallan18@earthlink.net>
List: port-macppc
Date: 11/14/2004 18:08:41
Hello,

> yes, as i said in the lines above, there is a difference in the signals 
> the gfx card pumps to the monitor after leaving X...
I remember you saying that the old Xserver leaves the console unusable - how unusable? No video signal at all? All screwed up? I've seen something that could be similar to what you got with my Xserver on my Voodoo3 ( eg. very high frequencies ) when the Xserver couldn't access the VGA registers.
What's the exact difference? Both mess up the video signal but in a different way?

> > I'm afraid I can't do a lot without a radeon.
> 
> where are you located? maybe we can provide you a gfx card (will do 
> *any* type of radeon?)...
I'm in Florida, I thought about getting a PCish PCI Radeon myself ( CompUSA sells them pretty cheap right now ) and try to change the firmware but a search on the net showed quite discouraging results ( apparently the PC Radeons don't have enough flash memory to hold the Mac firmware )
As far as I know any Radeon would do ( as long as it's PCI - my S900 has no AGP ) since they all seem to use the same XFree driver and the handling of the VGA registers shouldn't have changed.
What does <scanpci -v> say about the card?

> please notify me when this lil proggie exists -- i am very willing to 
> test and get this stuff running ;)
Try this:
#include <sys/types.h>
#include <sys/ioctl.h>
#include <powerpc/pio.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <dev/pci/pciio.h>
#include <signal.h>

void usage()
{
	puts("usage: io_dump <addr_in_hex>");
	exit(1);
}

int main(int argc, char *argv[])
{
	int mem,i,j,pci;
	char *map;
	uint32_t reg, addr=0;
	uint8_t *regs;
	uint8_t w;
	unsigned char b1,b2;
	
	if (argc!=2)
	{
		usage();
	}
	if(sscanf(argv[1],"%x",&addr)==1)
	{
		printf("dumping from %04x\n",addr);
		if(mem=open("/dev/ttyE0",O_RDONLY))
		{
			regs=mmap(NULL,0x10000,PROT_READ,MAP_SHARED,mem,0xf0000000);
			if(regs!=(void *)0xffffffff)
			{
				for(i=0;i<0x100;i+=16)
				{
					printf("%04x ",addr+i);
					for(j=0;j<16;j+=1)
					{
						w=in8(&regs[addr+i+j]);
						printf("%02x ",w);
					}
					printf("\n");
				}
				munmap(regs,0x10000);
			} else
				puts("couldn't mmap()");
			close(mem);
		} else
			puts("couldn't open console");
		return 0;
	} else
	{
		usage();
	}		
}

save this as io_dump.c and compile it with
gcc -o io_dump io_dump.c

Run it with a 16bit address as parameter ( in hex ), it will dump 256 bytes as hexdump from (IO_Base)+address. If you get a bus error then you didn't hit any register.
Your XFree86 log said
(II) RADEON(0): vgaHWGetIOBase: hwp->IOBase is 0x03b0, hwp->PIOOffset is 0x0000
so please try io_dump 300, if you get a bus error try io_dump 3b0. If you still get a bus error then the Xserver probably can't access the VGA registers either. In this case look at the output of scanpci -v - it /should/ report an IO resource for the Radeon - like this:
  BASE2     0x00001001  addr 0x00001000  I/O
In this case try io_dump 1000 ( BASEn may vary - I don't know if it's BASE2 on all VGA-compatible graphics cards but there should be an IO resource )
If you get a bus error after a few lines of hex dump - don't worry, that's ok. In this case post whatever it said - it just tried to read after the end of the register block. But if you still don't get any useful output, even when entering an IO address reported by scanpci then the kernel patch doesn't work for some reason.
In case you're wondering - this little thing shouldn't be able to mess up anything, all it does is reading and everything is open()ed/mmap()ed read-only.
It doesn't need to be run as root or from any specific terminal, it will work fine from an xterm ( although scanpci must run as root )

good luck
Michael