Subject: Re: viaenv0 on ASUS A7Pro
To: Steven M. Bellovin <smb@research.att.com>
From: Johan Danielsson <joda@pdc.kth.se>
List: port-i386
Date: 11/15/2002 11:59:39
"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");