help with host controller for ata
Justin T. Gibbs
gibbs at scsiguy.com
Sun Jun 22 20:13:07 PDT 2003
> I don't know if this is the correct list for this but here goes...
FreeBSD quesitons or hackers would have been more appropriate.
> I 'wish' to be able to "controll" the IDE host adapter for a computer
> experiment I am working on. My only reference so far is Hanz-Peter
> Messmer's book The Indispensable Hardware Handbook or something like that.
> (Hey, go easy on me, the book is at the other end of the room.)
> He mentions addresses and registers for AT, which is informative. He also
> has source code, which unfortunately is writen in Microsoft C. I prefer
> FreeBSD over Microsoft. So I am trying to figure out how to write a
> similar program on a FreeBSD system.
> Problems I am having:
> I found cpufunc.h, which provides inb(port) and outb(port) but when I
> include that file and try to compile I get about 7 pages of errors and
> warnings. I am under the impression I did not use the correct command
> line arguments to gcc (or cc, or CC). Anyone know what they might be
> for "general" (systems?) programming like I am trying?
Your problems with cpufunc.h are probably due to missing one or more
of the header file prerequisites for cpufunc.h. What other header files
did you include? sys/types.h is certainly a must.
> So, I decide I can perform a simple test with assembly language and move
> on. HAA! First I had no assembler, which I first found to be as, then
> found today that nasm is better for me. I haven't tried it yet. I know
> there is a way to use assembly instructions in a C program but no good
> references on syntax for gcc. Anyone know where a good syntax guide and
> rules for assembly through C with gcc?
info gcc. Look under the inline assembly instructions. I would use
the assembler that comes with the system over nasm since the included
assembler is known to work.
> Is the kern file subr_bus.c the only implementation of the functions in
> bus_private.h? If not, where can I find examples?
Examples of what? Do you understand what subr_bus.c is used for?
It doesn't seem relevant to what you want to do.
> What's the difference between an interrupt and a signal?
> Convention for registering an interrupt routine? Include files for that?
> Compiler command line arguments needed?
Interrupts are generated by hardware. Signals are generated by software.
The semantics of the two are quite different. I suggest you get an
operating system primer at your local book store which will explain
this and much more to you. "The Design and Implementaiton of the
4.4BSD Operating System" is quite good for this.
> How come there are no devices for pci0, and atapci0 in the /dev directory?
Because they are unnecessary.
> If I wanted to use ioctl functions on pci0 or atapci0 how do I go about
> doing that? Is it recommeded?
Meaning you want to implement ioctls for these two devices? What ioctls
would you create for a pci bus bridge, or the pci attachment for an
ata controller that aren't already exposed through pciconf and
atacontrol? Have you looked at how these programs work?
More information about the aic7xxx