Date: Fri, 19 Dec 1997 19:12:55 -0800 From: Ted Faber <faber@ISI.EDU> To: hosokawa@ntc.keio.ac.jp (HOSOKAWA Tatsumi) Cc: nate@mt.sri.com, ambrisko@whistle.com, freebsd-mobile@FreeBSD.ORG Subject: Re: Multiple 6832's Message-ID: <199712200312.TAA26364@tnt.isi.edu> In-Reply-To: Your message of "Fri, 19 Dec 1997 10:42:42 %2B0900." <199712190142.KAA15429@afs.ntc.mita.keio.ac.jp>
next in thread | previous in thread | raw e-mail | index | archive | help
HOSOKAWA Tatsumi wrote: >In article <199712182355.PAA24716@tnt.isi.edu> >In this case, fortunately this patch will not cause any problem >because CardBus bridge is set to 0x3e0 when I configured BIOS setup, >and even if FreeBSD kernel re-initializes it from 0x3e4 to 0x3e0, >it'll safe if there's no other devices on 0x3e0 and 0x3e1. But if >there's a machine which have ISA PC-card controller at 0x3e0 and >CardBus bridge at 0x3e2, or a machine which have two CardBus bridges, >it'll be the problem. I don't know such machine, but I can't say that >such it does not (and will not) exist in the world. And worse, the pcic.c driver is hardwired to look at 0x3e0, so accessing both will require some modifications to that driver. > >I think it'll be te better way: > >if (the legacy 16bit ioadder is left uninitialized, or initialized > to odd value) { > set it to 0x3e0 + (unit number * 2); >} > >or > >if (the legacy 16bit ioadder is left uninitialized) { > set it to 0x3e0 + (unit number * 2); >} > >sp->index = legacy 16bit ioaddr; Looking for a badly initialized register is difficult. Which value is uninitialized, and which is just unusual? Other than that, I thinks this is a good idea. Here's a patch (to -current) that initializes each found 6832 to the next two ports in order starting at 03e0. Note that this also patches pcic_p.h to reduce the I/O ports mapped from 4 to 2. (A bug that HOSOKAWA-san's description pointed out to me.) I think this will be safe for multiple 6832's, but I can't test it. If you have two please test it and tell me. All of this runs fine on my machine, but give it more of a test before you commit it, because more changed. This should supercede the other patch. *** pcic_p.c.orig Thu Dec 18 15:07:59 1997 --- pcic_p.c Fri Dec 19 18:55:58 1997 *************** *** 37,42 **** --- 37,43 ---- #include <pci/pcireg.h> #include <pci/pcivar.h> #include <pci/pcic_p.h> + #include <pccard/i82365.h> #include <vm/vm.h> #include <vm/pmap.h> *************** *** 134,139 **** --- 135,155 ---- { u_long bcr; /* to set interrupts */ u_short io_port; /* the io_port to map this slot on */ + static int num6832 = 0; /* The number of 6832s initialized */ + + /* + * Some BIOS leave the legacy address uninitialized. This + * insures that the PD6832 puts itself where the driver will + * look. We assume that multiple 6832's should be laid out + * sequentially. We only initialize the first socket's legacy port, + * the other is a dummy. + */ + + io_port = PCIC_INDEX_0 + num6832 * CLPD6832_NUM_REGS; + if ( unit == 0 ) { + pci_conf_write(tag, CLPD6832_LEGACY_16BIT_IOADDR, + io_port & ~PCI_MAP_IO); + } /* * I think this should be a call to pci_map_port, but that *************** *** 169,174 **** --- 185,194 ---- bcr = pci_conf_read(tag, CLPD6832_BRIDGE_CONTROL); bcr |= (CLPD6832_BCR_ISA_IRQ|CLPD6832_BCR_MGMT_IRQ_ENA); pci_conf_write(tag, CLPD6832_BRIDGE_CONTROL, bcr); + + /* After initializing 2 sockets, the chip is fully configured */ + + if (unit == 1 ) num6832++; if (bootverbose) printf("CardBus: Legacy PC-card 16bit I/O address [0x%x]\n", *** pcic_p.h.orig Thu Dec 18 14:50:41 1997 --- pcic_p.h Fri Dec 19 18:21:49 1997 *************** *** 49,54 **** #define CLPD6832_BCR_MGMT_IRQ_ENA 0x08000000 #define CLPD6832_BCR_ISA_IRQ 0x00800000 #define CLPD6832_COMMAND_DEFAULTS 0x00000045 ! #define CLPD6832_NUM_REGS 4 /* End of CL-PD6832 defines */ --- 49,54 ---- #define CLPD6832_BCR_MGMT_IRQ_ENA 0x08000000 #define CLPD6832_BCR_ISA_IRQ 0x00800000 #define CLPD6832_COMMAND_DEFAULTS 0x00000045 ! #define CLPD6832_NUM_REGS 2 /* End of CL-PD6832 defines */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199712200312.TAA26364>