9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] questions on sis630 driver...
@ 2002-08-02 12:40 paurea
  2002-08-02 23:03 ` paurea
  0 siblings, 1 reply; 4+ messages in thread
From: paurea @ 2002-08-02 12:40 UTC (permalink / raw)
  To: 9fans

I continue trying to write the sis630 driver and have a lot of questions.
Forgive me if they are really naive, it is the first time I try to write a
driver... I am still fighting with aux/vga.
The questions are on how should I map and use fb memory and mmio.
I have finally understand that the mmio ports and the address of the video
memory are configured using some PCI configuration registers.

I don't have a pnp bios. I don't know what plan9 pnp capabilities are
(haven't found anything by browsing the source). Anyway I have found
that the BAR registers of the card are set to zero. This gets me to my two
questions.

1) Which addresses do I choose for the framebuffer and the mmio registers?.
I have to set the card's register to them... (can I use segattach for that?)

2) After choosing the addresses and setting the card to them, how do I
   access them?. I have been looking to the vgaxio function and
   haven't been able to understand how does it know where the
   registers are mapped...  Do I have to write to the PCI register the
   absolute address and use myself the address minus 0x80000000 for
   the pointers?. How does vgaxio know what the base address is?

TIA
--
                 Saludos, Gorka

"Curiosity sKilled the cat"


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] questions on sis630 driver...
  2002-08-02 12:40 [9fans] questions on sis630 driver paurea
@ 2002-08-02 23:03 ` paurea
  0 siblings, 0 replies; 4+ messages in thread
From: paurea @ 2002-08-02 23:03 UTC (permalink / raw)
  To: 9fans

I wrote the mail without enough sleep, so I suppose didn't make much sense.
Sorry for that.


paurea@gsyc.escet.urjc.es writes:

>I don't have a pnp bios. I don't know what plan9 pnp capabilities are
>(haven't found anything by browsing the source). Anyway I have found
>that the BAR registers of the card are set to zero. This gets me to my two
>questions.

 > 1) Which addresses do I choose for the framebuffer and the mmio registers?.
 > I have to set the card's register to them... (can I use segattach for that?)

I meant do I use segattach or some other way to get a segment to select the
addresses for  mmio?. (and for the framebuffer upamalloc?)


 >
 > 2) After choosing the addresses and setting the card to them, how do I
 >    access them?. I have been looking to the vgaxio function and
 >    haven't been able to understand how does it know where the
 >    registers are mapped...  Do I have to write to the PCI register the
 >    absolute address and use myself the address minus 0x80000000 for
 >    the pointers?. How does vgaxio know what the base address is?
 >


I think I have understand all this, I was just in a confused state of
mind when I wrote this... aux/vga is in user-space and so the pointers
start in zero.  In the kernel they start on 0x80000000. vgaxio uses
ports and so isn't in any place in memory, it just uses inport and
outport. To the PCI registers I write physical addresses. Is this all
correct?.

Thanks a lot.
--
                 Saludos,
                         Gorka

"Curiosity sKilled the cat"


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] questions on sis630 driver...
  2002-08-03  0:28 Russ Cox
@ 2002-08-03  1:40 ` paurea
  0 siblings, 0 replies; 4+ messages in thread
From: paurea @ 2002-08-03  1:40 UTC (permalink / raw)
  To: 9fans

Russ Cox writes:
 > Most of the cards get their addresses configured by the
 > PCI BIOS at boot time, so you just have to read the addresses
 > out of the card, upamalloc, and addvgaseg.  Look at the vgat2r4.c
 > driver for a good simple example.  The linear function takes care
 > of this.
 >

The addresses should be written on the BAR registers shouldn't they?
Shouldn't I  be able to read them from the pcidev->mem[i].address without
doing anything. They are all zero...
--
                 Saludos,
                         Gorka

"Curiosity sKilled the cat"


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] questions on sis630 driver...
@ 2002-08-03  0:28 Russ Cox
  2002-08-03  1:40 ` paurea
  0 siblings, 1 reply; 4+ messages in thread
From: Russ Cox @ 2002-08-03  0:28 UTC (permalink / raw)
  To: 9fans

Look at any of the other vga drivers.  You have to allocate
yourself some physical addresses with upamalloc.  Then you
set up the segment structures so that user programs can
call segattach.  Addvgaseg will do the grungy work for you.

Most of the cards get their addresses configured by the
PCI BIOS at boot time, so you just have to read the addresses
out of the card, upamalloc, and addvgaseg.  Look at the vgat2r4.c
driver for a good simple example.  The linear function takes care
of this.

If the SiS card doesn't have its own video memory and you need
to give it normal memory, you might want to look at the vgai81x.c
driver for an example.

/sys/src/cmd/aux/vga/notes.txt has some notes about writing
VGA drivers.  I posted them to 9fans a while ago too.  I just
put notes.txt out; the next scan will find it.

Russ


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-08-03  1:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-02 12:40 [9fans] questions on sis630 driver paurea
2002-08-02 23:03 ` paurea
2002-08-03  0:28 Russ Cox
2002-08-03  1:40 ` paurea

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).