Secondary VGA card booting

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
LowRider

Secondary VGA card booting

Post by LowRider »

Hi,

I don't know if this is the right place to ask, but I'm having a little trouble writing a linux application. I need to write a kind of "driver" for a secondary VGA card (simple PCI nVidia GeForce FX5200).

The code works perfectly, there's just one problem. I can't get the VGA card to startup without using Xwindows. According to several online sources, I need to run some code that's inside the VGA BIOS. (and using X is not an option, it's supposed to be an X).

But it's the second card in the system, so I don't know what to do?

Since you people all seem to be experts concerning all that hardware stuff, I was wondering, can anyone help me?

Thanks!

Nicolas
PS: I'm new here, I've seen some great stuff on this board, makes me want to write my own OS :)
User avatar
Candy
Member
Member
Posts: 3883
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Secondary VGA card booting

Post by Candy »

afaik you need to boot up the VGA bios on the other board. That has the problems that

1. it's a second board, so you have the problem that it might initialize as first. Make it 100% clear that it's the second.
2. You still need to boot it in 16-bit mode. Linux is (afaik) 32-bit, so you need a vm86 task (dosemu-ish) to start it.

After that, it would listen and be addressible the normal way.

All afaik && iirc, so comments are more than welcome.
LowRider

Re:Secondary VGA card booting

Post by LowRider »

Candy wrote: afaik you need to boot up the VGA bios on the other board. That has the problems that

1. it's a second board, so you have the problem that it might initialize as first. Make it 100% clear that it's the second.
2. You still need to boot it in 16-bit mode. Linux is (afaik) 32-bit, so you need a vm86 task (dosemu-ish) to start it.

After that, it would listen and be addressible the normal way.

All afaik && iirc, so comments are more than welcome.
Well, that's exactly what the int10 module does (I think), so you do remember correctly. But now the biggest question: how?

I already understood I have to run `int $0x80' (113) to put the cpu in vm86 mode. But then what? Where is that BIOS located? How can I find out? how can I run the code and how can I make sure it doesn't initialize as first?

btw: Any books/docs you can recommend concerning this subject?

PS: thanks for the fast reply.

Nicolas.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Secondary VGA card booting

Post by Pype.Clicker »

you may need to retrieve PCI configuration information for your card (esp. its boot rom address) ... and can't tell for sure if it will work as i expect it to work, nor if can be done at userlevel in linux, though.

What about having the nvidia driver loaded and trying talking to that ?
LowRider

Re:Secondary VGA card booting

Post by LowRider »

Pype.Clicker wrote: you may need to retrieve PCI configuration information for your card (esp. its boot rom address)
Is that the field at location 0x30 of the PCI config header?
(http://www.acm.uiuc.edu/sigops/roll_your_own/7.c.0.html)
It shows as all 0's when I do `hexdump /proc/bus/pci/00/0d.0'
Looky:

[tt]c3p0:~ # hexdump /proc/bus/pci/00/0d.0
0000000 10de 0322 0006 02b0 00a1 0300 2000 0000
0000010 0000 f500 0008 e800 0000 0000 0000 0000
0000020 0000 0000 0000 0000 0000 0000 0000 0000
0000030 0000 0000 0060 0000 0000 0000 010b 0105
0000040 0000 0000 0002 0030 0217 1f00 0000 0000
0000050 0000 0000 0001 0000 d6ce 0023 000f 0000
0000060 0001 0002 0000 0000 0000 0000 0000 0000
0000070 0000 0000 0000 0000 0000 0000 0000 0000
*
0000100[/tt]

Pype.Clicker wrote: What about having the nvidia driver loaded and trying talking to that ?
Well, the general idea is this: we're implementing a video-codec in hardware (FPGA), it's a PCI board and we want it to do direct communication with the VGA card. So programming the modes of the VGA card is all up to the FPGA.

Why, you may ask? Well, it's all part of a bigger plan. A kind of "let's-put-this-in-a-cell-phone-running-on-linux" thing. X is not wanted, as is the nVidia driver.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Secondary VGA card booting

Post by Pype.Clicker »

so iiuc, your magic-fpga-thing is on a PCI board which has to talk to another PCI board (e.g. the VGA1 card) and send it images to be displayed ? ... while VGA0 remains the card that the 'development platform' uses, right ?

just wondering ...

wouldn't it be easier to have the FPGA connected to a VGA-output and having it generating its own VGA (or digital video of some sort) signals rather than expecting a VGA card to do that for you ?
LowRider

Re:Secondary VGA card booting

Post by LowRider »

Pype.Clicker wrote: so iiuc, your magic-fpga-thing is on a PCI board which has to talk to another PCI board (e.g. the VGA1 card) and send it images to be displayed ? ... while VGA0 remains the card that the 'development platform' uses, right ?
Not only that, it must also control the video mode (res., pixdepth, freq., etc.)
Pype.Clicker wrote:just wondering ...

wouldn't it be easier to have the FPGA connected to a VGA-output and having it generating its own VGA (or digital video of some sort) signals rather than expecting a VGA card to do that for you ?
That's also what I told them. But the techies want it this way, so this way I have to force it ::)
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:Secondary VGA card booting

Post by Brendan »

Hi,
LowRider wrote:
Pype.Clicker wrote: so iiuc, your magic-fpga-thing is on a PCI board which has to talk to another PCI board (e.g. the VGA1 card) and send it images to be displayed ? ... while VGA0 remains the card that the 'development platform' uses, right ?
Not only that, it must also control the video mode (res., pixdepth, freq., etc.)
You're screwed - NVidea don't let anyone have any direct hardware programming information (trade secrets, blah, blah, etc).

Don't use NVidea unless they are willing to provide enough information to make it possible (or unless your company is willing to pay NVidea a huge wad of cash to write the video code for you).

Does it absolutely have to be an NVidea card?


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
LowRider

Re:Secondary VGA card booting

Post by LowRider »

Brendan wrote:You're screwed - NVidea don't let anyone have any direct hardware programming information (trade secrets, blah, blah, etc).

Don't use NVidea unless they are willing to provide enough information to make it possible (or unless your company is willing to pay NVidea a huge wad of cash to write the video code for you).

Does it absolutely have to be an NVidea card?


Cheers,
Brendan
Well, actually, that's not the problem, as I said already: that part of the program is all done. I've been able to implement a great deal of the Xfree ``nv'' driver and it works like a charm. Also the ``svgalib'' code helped me a lot. So once the card boots up using the X `int10' module, we're good to go.

Now all I need is to eliminate the use of X to boot the card.

*sigh*

I'm reading ``Understanding the linux kernel'' as we speak. I'm ordering a PCI book from Amazon and I downloaded the Intel docs.

Guess I'll just have to read the stuff you guys read huh?
Unless someone would have a solution, that is ;)

Biggest problem is that I've been given only 6 weeks to do this, and they expect it to work. (I'm not a hardware programmer)
Curufir

Re:Secondary VGA card booting

Post by Curufir »

LowRider wrote: Now all I need is to eliminate the use of X to boot the card.
Is there some reason you can't write an nvidia module for the kernel framebuffer?
LowRider

Re:Secondary VGA card booting

Post by LowRider »

Curufir wrote: Is there some reason you can't write an nvidia module for the kernel framebuffer?
Yes there is, they want it user-space.
If I have to go kernel-space for that vm86 stuff, they'll probably want 2 applications: one in user-space and one in kernel-space (for the bootup).

They're some very stuborn people (now let's hope they don't read this...) :o
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Secondary VGA card booting

Post by Pype.Clicker »

so what about enabling nvidia framebuffer (or whatever framebuffer needed) in the 'setup kernel-mode stuff" and then mmap some /dev/fb2 (or something) from the userapp to send images there ?
LowRider

Re:Secondary VGA card booting

Post by LowRider »

Pype.Clicker wrote: so what about enabling nvidia framebuffer (or whatever framebuffer needed) in the 'setup kernel-mode stuff" and then mmap some /dev/fb2 (or something) from the userapp to send images there ?
I would still need to boot the card, would I not?
Curufir

Re:Secondary VGA card booting

Post by Curufir »

Hmm. Well I haven't dug too deeply, but I don't think the X nv driver actually uses the int10 code at all. It's all dealt with using hardware ports as far as I can see.

The sticking point outside the driver (For initialisation) seems to be where the PCI memory gets mmaped (/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c). My guess would be that this is why you currently need X to initialise the card. Somehow you're going to have to deal with this mapping stuff yourself.
LowRider

Re:Secondary VGA card booting

Post by LowRider »

Curufir wrote: Hmm. Well I haven't dug too deeply, but I don't think the X nv driver actually uses the int10 code at all. It's all dealt with using hardware ports as far as I can see.

The sticking point outside the driver (For initialisation) seems to be where the PCI memory gets mmaped (/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c). My guess would be that this is why you currently need X to initialise the card. Somehow you're going to have to deal with this mapping stuff yourself.
Well, the second include in the file ``nv_driver.c'' is this one:

#include "xf86int10.h"

it gets called here:
[tt]
if (xf86LoadSubModule(pScrn, "int10"))
   xf86LoaderReqSymLists(int10Symbols, NULL);
[/tt]

(function NVPreInit, same file)
So it loads the `int10' module, which boots the card.

The PCI memory gets mapped and is only used for setting the card's resolution etc. and writing the images.

And that's also my question. I have the `driver' stuff, all I'm lacking is the `int10' functionality.
Post Reply