Subject: Re: viaenv0 on ASUS A7Pro
To: Johan Danielsson <joda@pdc.kth.se>
From: Steven M. Bellovin <smb@research.att.com>
List: port-i386
Date: 11/29/2002 13:35:07
In message <xofof8rrtd0.fsf@blubb.pdc.kth.se>, Johan Danielsson writes:
>"Steven M. Bellovin" <smb@research.att.com> writes:
>
>> How do I assign it the necessary I/O space?
>
>I'm sure someone will point out why this untested code will not
>work. :-)
>
>/Johan
>
>--- viaenv.c	2002/10/02 16:51:59	1.9
>+++ viaenv.c	2002/11/15 10:56:41
>@@ -280,13 +280,27 @@
> 
> 	iobase = pci_conf_read(va->va_pc, va->va_tag, va->va_offset);
> 	control = pci_conf_read(va->va_pc, va->va_tag, va->va_offset + 4);
>-	if ((iobase & 0xff80) == 0 || (control & 1) == 0) {
>-		printf(": disabled\n");
>+	sc->sc_iot = va->va_iot;
>+	if ((iobase & 0xff80) == 0) {
>+		bus_addr_t addr;
>+		if(bus_space_alloc(sc->sc_iot, 0, 0xffff, 128, 128, 0, 0,
>+				   &addr, &sc->sc_ioh) != 0) {
>+			printf(": failed to allocate memory region\n");
> 		return;
> 	}
>-	sc->sc_iot = va->va_iot;
>-	if (bus_space_map(sc->sc_iot, iobase & 0xff80, 128, 0, &sc->sc_ioh)) {
>+		DPRINTF((": I/O address is %x\n", iobase));
>+		DPRINTF(("%s", sc->sc_dev.dv_xname));
>+		pci_conf_write(va->va_pc, va->va_tag, va->va_offset, addr);
>+	} else {
>+		if (bus_space_map(sc->sc_iot, iobase & 0xff80, 128, 0, 
>+				  &sc->sc_ioh)) {
> 		printf(": failed to map i/o\n");
>+			return;
>+		}
>+	}
>+	if ((control & 1) == 0) {
>+		pci_conf_write(va->va_pc, va->va_tag, va->va_offset + 4, 
>+			       control | 1);
> 		return;
> 	}
> 	printf("\n");
>
>
>

I get "isa_dmainit: unable to map DMA controller #2".  (This is with
-current of 27 November.)  Also, when trying to print out the status 
for viaenv0, right after the "0" it prints a line about the CardBus 
bridge not being configured, with no intervening newline.  It then 
prints that text again, this time on a new line.  So some pointer in 
that routine would appear to be wrong.

		--Steve Bellovin, http://www.research.att.com/~smb (me)
		http://www.wilyhacker.com ("Firewalls" book)