9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Richard Powell <richard@powell.name>
To: 9fans <9fans@cse.psu.edu>
Subject: [9fans] HPT-370 ATA-100 chip (was: Hardware detection problems)
Date: Thu, 19 Sep 2002 18:40:45 -0700	[thread overview]
Message-ID: <3D8A7C9D.2090102@powell.name> (raw)
In-Reply-To: <abb5e32ed33127b18972f40768f1b20f@plan9.bell-labs.com>

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" <rsc@plan9.bell-labs.com>
> 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 -------------------------



  reply	other threads:[~2002-09-20  1:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-16  4:02 [9fans] Hardware detection problems jmk
2002-09-20  1:40 ` Richard Powell [this message]
2002-09-20  1:55 [9fans] HPT-370 ATA-100 chip (was: Hardware detection problems) Russ Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D8A7C9D.2090102@powell.name \
    --to=richard@powell.name \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).