home .. forth .. colorforth mail list archive ..

Re: [colorforth] Where to find AGP details


Here is another snippet on PCI details - from a
tutorial
that Ray and I are working on.

A Tutorial on the PCI block 46
___________________{{_________

The pci bus is the one that most other PCI devices hang
from:  graphics, souncard, ethernet, usb, etc.  The PCI
ADDRESS system is a bit confusing at first, but Chuck's
code is elegantly simple.  Also, he has set it out
better in his original CF of 2001 than in his later
release of 2005.  Accordingly, we shall start with
block 46 of CF01 and show how this explains some things
in CF05.    

Firstly, to address any pci device, one has to WRITE
its
REGISTER ADDRESS into pci bus port  CF8  then  R/W data
to/from that device register via pci bus port  CFC

By register address we mean the address (on the bus) of
any one of the 64 (or 256?) registers which belong to
(are bound to) a particular pci device.  So Chuck, in
CF01, defines the word  ADD  (for pci ADDress)

            : ADD  CF8 a!  CFC a! ;  

which loads the COLORFORTH address register (a!) with
the PCI bus addresses  cf8  and  cfc.
    
Now suppose we wish to query one of a particular
device's registers (say the one at regaddr) and read
its data.  CF01 has the word  Q  (for Query); it adds a
1 to the msb of regadr then puts the resultant 4byte
regadr into cf8 and fetches the 4byte regdata from cfc

        regaddr-- : Q  80000000 +  ADD 4@ ;  --regdata

Now, as a dangerous tutorial exercise, we can define
our own word  P  to write our data to a device register

regdata regadr--  : P  80000000 +  ADD 4! ;  
 
Now that we know about CFO1, we can appreciate what is
happening on block 46 of CF05.  Firstly, regaddr has
been redefined as a 4byte address 8regaddr so its msb
is already set.  Accordingly Q has been redefined as
PCI  which does the same query job

        8regaddr--  <PCI>   --regdata

But where is this new word  PCI  defined? Unfortunately
not in block 46; it must have been written somewhere
else in assembly code - a retrograde step from CF01.
On the other hand CF05 has a new word  PCI!  which does
the same put job as our  P  above

   regdata 8regaddr--  : PCI!  pci drop 4! ;    

The reason why PCI is predefined in assembly in CF05
might be that CF05 begins with a new block 20 for USB
which needs PCI - but CF words for PCI will only come
later, in block 46.

Incidentally the word "k" in CF05 46, which is supposed
to find 
all the PCI devices, does not find the USB controller
on
my new 
Intel board.  This is because CF05 has been set to
search in steps 
of 800h (like CF01); I soon found this USB controller
by
searching 
upwards in steps of 200, and adjusted the address "USB"
in block 
46 accordingly.  But there was no difficulty with
finding the AGP 
video card on my old ASUS P2 with "k", and its
registers
with "ok" after putting the right address into the
variable "AGP".  Nor was there much problem adjusting
for the nVidia Force video card in my new Intel board. 
Once the address had been found (by Linux) I added the
following word to block 30:  

   : display 40000000 3e8 ! ;  display 

I guess CF address 3E8 must hold the display address, in
Josh's CF05 image that I use. 

Hope it helps - anyway, got that off my chest, 

Nick


Quoting Jason Kemp <jason.kemp@xxxxxxxxxxxxxxxx>:

>... " Good morning all,
>... " 
>... " I am trying to understand a little about how the
>... " AGP works.  How are the 
>... " AGP memory addresses determined?  0x0f0000000 is
>... " for a fujitsu, 
>... " 0xE8000000 seems to work on my ATI with Josh
>... " Grams's 2005 source. Can 
>... " anyone please point me to a datasheet or article
>... " that explains AGP 
>... " configuration, or is this more a BIOS set-up
>... " thing?  It appears that ATI 
>... " don't give away any technical info.  I've found
>... " 
>... "
http://download.intel.com/design/chipsets/datashts/25302704.pdf
>... " but this 
>... " doesn't shed much light (may be I have to spend
>... " more time on that though?)
>... " 
>... " Thanks,
>... " Jason
>... " 
>... " 


---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com