From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3D8A7C9D.2090102@powell.name> From: Richard Powell User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827 MIME-Version: 1.0 To: 9fans <9fans@cse.psu.edu> References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: [9fans] HPT-370 ATA-100 chip (was: Hardware detection problems) Date: Thu, 19 Sep 2002 18:40:45 -0700 Topicbox-Message-UUID: f0591596-eaca-11e9-9e20-41e7f4b1d025 jmk@plan9.bell-labs.com wrote: > The code hooks are all there for additional controllers > (devata.c:/^atalegacy). > Some glue needs to be added to devsd.c:/^sdreset. > > > ------------------------------------------------------------------------ > > Subject: > Re: [9fans] Hardware detection problems > From: > "Russ Cox" > Date: > Sun, 15 Sep 2002 22:56:22 -0400 > To: > 9fans@cse.psu.edu > > > If you know the ports and interrupts, > it might suffice just to add the appropriate > probes. > > Russ Thanks for all the help. I finally figured some things out an made some progress. I can now detect all four IDE ports and boot directly from sdE0. I've include a context diff of the changes I made to 9/pc/sdata.c. I also made similar changes to 9/boot/sdata.c for 9load. Is there a preferred format for patches? Notes: - The debug code was commented out because the two IDE ports on the chip share the same IRQ (11). That caused a flood of Inil20+ messages when I had a disk on each port. Next time, I'll change it to a different symbol. - I'm not sure about setting pi to 0x85 vs. 0x5, but it doesn't seem to hurt. diff -c sdata.c.org sdata.c ------------------------------ cut here ----------------------- *** sdata.c.org Thu Sep 19 00:19:00 2002 --- sdata.c Thu Sep 19 00:19:00 2002 *************** *** 1557,1564 **** --- 1557,1566 ---- status = inb(cmdport+Status); if((drive = ctlr->curdrive) == nil){ iunlock(ctlr); + /* if((DEBUG & DbgDEBUG) && ctlr->command != Cedd) print("Inil%2.2uX+", ctlr->command); + */ return; } *************** *** 1671,1676 **** --- 1673,1682 ---- * 2) put 0 in the programming interface byte (probably * as a consequence of 1) above). */ + + print("PCI: ccrb %02x ccru %02x ccrp %04x did %04x vid %04x\n", + p->ccrb, p->ccru, p->ccrp, p->did, p->vid); + if(p->ccrb != 0x01 || (p->ccru != 0x01 && p->ccru != 0x80)) continue; pi = p->ccrp; *************** *** 1707,1712 **** --- 1713,1721 ---- * Bugfix code here... */ break; + case (0x0004<<16)|0x1103: /* HighPoint HPT-370 */ + pi = 0x85; + break; case (0x0646<<16)|0x1095: /* CMD 646 */ case (0x0571<<16)|0x1106: /* VIA 82C686 */ case (0x0211<<16)|0x1166: /* ServerWorks IB6566 */ *************** *** 1716,1727 **** case (0x7111<<16)|0x8086: /* 82371[AE]B (PIIX4[E]) */ break; } - for(channel = 0; channel < 2; channel++){ if(pi & (1<<(2*channel))){ sdev = ataprobe(p->mem[0+2*channel].bar & ~0x01, p->mem[1+2*channel].bar & ~0x01, p->intl); if(sdev == nil) continue; --- 1725,1736 ---- case (0x7111<<16)|0x8086: /* 82371[AE]B (PIIX4[E]) */ break; } for(channel = 0; channel < 2; channel++){ if(pi & (1<<(2*channel))){ sdev = ataprobe(p->mem[0+2*channel].bar & ~0x01, p->mem[1+2*channel].bar & ~0x01, p->intl); + print("Probed: %d sdev %x\n", channel, (int)sdev); if(sdev == nil) continue; ---------------------------- end of diff -------------------------