9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Nigel Roles" <nigel@9fs.org>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu>
Subject: RE: [9fans] Writing device drivers
Date: Mon, 17 Apr 2006 11:01:20 +0100	[thread overview]
Message-ID: <HOEHIDJJJINMLFPOLFJCIEKIDGAA.nigel@9fs.org> (raw)
In-Reply-To: <82b49c6d64ed36c95aa6ee896541f1f5@swtch.com>

9fans-bounces+ngr=9fs.org@cse.psu.edu wrote:
>> it looks like all the code for aic-7xxx is in the linux kernel tree,
>> including an assembler.
>>
>> does anybody know what processor it uses?
>
> it probably doesn't matter.  it's unlikely that the
> microcode is written in a real processor's assembly
> language.  usually it is a virtual processor defined
> by the card.

Originally Adaptec has an on-board 8035 which presented a mailbox (aka scb
(aka Scsi Command Block)) interface to the host. You load up the command
block, enable it, and wait for an interrupt. The firmware was fixed in an
EPROM next door. This conforms to Russ'es idea that it is a virtual
processor.

Later, the firmware became downloadable to local ram in a cpu which
implemented the scbs directly, plus enough flow control to allow the
controller to manage many concurrent transfers without host intervention.
So, the aic-7xxx series are real processors (at least a real as they ever
get given that Intel processors still have microcode engines are therefore
in some senses virtual).

The story for the NCR/Symbios/LSI Logic controllers is similar; at first
they were hard-wired and the CPU did all the sequencing, then a SCSI
specific CPU was added (silicon designers would call it a programmable
sequencer) which read its instructions over the bus and gave it more offload
capability. Finally, the firmware got stored in local RAM because it ran too
slowly when competeing with the data transfers over the same bus.

SCSI processors are highly specialised, being excellent at DMA and able to
guarantee the tight bus timings, but struggling to add two numbers together.
They are a nightmare to debug because debugging usually results in the SCSI
bus timing being violated and the targets take their bats home. None of the
current cards will use general purpose processors.

It may well be practical to borrow the Linux aic firmware, but the result
will be ugly as the match between a Linux scsi driver and a Plan 9 scsi
driver is not strong. It's the usual argument I see around here; compare the
Symbios driver in Linux with that in Plan 9. If you want 90% of the
functionality for 10% of the code, learn the firmware assembler and do
something that fits the scale of Plan 9. If you just want a aic driver in
the shortest possible time, then using known good firmware will no doubt
help.

I did make a start on an aic driver with the intention of doing Plan 9
specific firmware. I ported the Linux assembler but the effort is lost in
the mists of time. It turned out that after doing the Symbios driver, I
really couldn't be arsed to fight a firmware processor again. You really
have to understand SCSI at the bus level, and to be honest having a bus
analyser to hand would be a good idea.




  reply	other threads:[~2006-04-17 10:01 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-17  0:31 erik quanstrom
2006-04-17  1:44 ` Russ Cox
2006-04-17 10:01   ` Nigel Roles [this message]
2006-04-18  1:34     ` erik quanstrom
2006-04-18 14:49       ` Nigel Roles
2006-04-18 15:42         ` jmk
2006-04-18 15:59         ` Moritz Kiese
2006-04-18 16:03           ` Nigel Roles
2006-04-18 19:15       ` Paweł Lasek
  -- strict thread matches above, loose matches on Subject: below --
2006-04-19  3:10 erik quanstrom
2006-04-19  4:02 ` jmk
2006-04-19  4:57   ` lucio
2006-04-19  6:59   ` Nigel Roles
2006-04-19 21:12   ` quanstro
2006-04-17  0:11 erik quanstrom
2006-04-17  1:24 ` Russ Cox
2006-04-16  1:02 erik quanstrom
2006-04-16  2:36 ` Anthony Sorace
2006-04-16  8:06   ` Bruce Ellis
2006-04-15 23:34 erik quanstrom
2006-04-15 23:55 ` Skip Tavakkolian
2006-04-15 15:26 erik quanstrom
2006-04-15 23:04 ` Federico Benavento
2006-04-15 23:18   ` Skip Tavakkolian
2006-04-16  0:43     ` Federico G. Benavento
2006-04-16 18:03     ` Charles Forsyth
2006-04-16 18:14       ` Bruce Ellis
2006-04-16 21:31         ` Charles Forsyth
     [not found] <8a5bd8ccbc2e53557663e2a9020fb26c@coraid.com>
     [not found] ` <820bc1260604140834v2a773ev90ff46b4e6b2427f@mail.gmail.com>
2006-04-14 15:36   ` Eric Smith
2006-04-14 19:33     ` David Leimbach
2006-04-15  4:58     ` jmk
2006-04-15 13:24       ` Eric Smith
2006-04-15 14:16         ` Anthony Sorace
2006-04-16 23:00           ` Paweł Lasek
2006-04-14  3:20 Eric Smith

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=HOEHIDJJJINMLFPOLFJCIEKIDGAA.nigel@9fs.org \
    --to=nigel@9fs.org \
    --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).