enum pci

Programming, for all ages and all languages.
Post Reply
a5498828
Member
Member
Posts: 99
Joined: Thu Aug 12, 2010 7:25 am

enum pci

Post by a5498828 »

i would like to write something to show what peripherals are installed.
i think the best start would be pci...

how can i read pci peripherals, like linux lspci does?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: enum pci

Post by Combuster »

STFW (yes, you deserve to be told so)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
a5498828
Member
Member
Posts: 99
Joined: Thu Aug 12, 2010 7:25 am

Re: enum pci

Post by a5498828 »

ok i understand how does it work, but i lack terms like whats pci device, what can i read about it, and why.
whats bus number/device number/enable bit/etc, they dont explain it. and i read that this will also read pcie and agp buses. not good source, really, at least not for beginners.
User avatar
gravaera
Member
Member
Posts: 737
Joined: Tue Jun 02, 2009 4:35 pm
Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.

Re: enum pci

Post by gravaera »

Gee...

Well you see, kernel development isn't meant for people who don't know what a bus is...
It's also not meant for someone who isn't intelligent enough to guess what an "enable" bit does either.

I don't think you understand what "beginner" is in the context of kernel development: "beginner" in general programming terms is someone who doesn't know programming at all. That's fine: go learn programming. "Beginner" in the context of kernel development is not someone who doesn't know about computer theory 101, and doesn't know about the basic components of a computer, motherboard, basic processor theory, data structures, etc.

When it comes to kernel development, "beginner" takes on a new meaning and requires a higher bar for basic skills and knowledge. Go and lift yourself to the prerequisite bar and then I guarantee, that article will make perfect sense.
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
a5498828
Member
Member
Posts: 99
Joined: Thu Aug 12, 2010 7:25 am

Re: enum pci

Post by a5498828 »

I prefer to be sure instead of guessing.
Documentation is not clear and ambiguous = it suck.

function number = device can support diffrent functionality on low level
bus number = i can have more than 1 pci bus? wtf.
device number = device on bus id
register number = this is actual pci (device ?) data
enable bit = wtf



I dont know what is a bus. so i ask questions and search for answers to change it.
For me bus is a device wich is used to comunicate with devices attached to it. it is given irq, pio/mmio mapping to interface with cpu. and that is all, i dont know any details yet.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: enum pci

Post by Solar »

Then please go back and read gravaera's post again.

Then check out PCI, and go from there. (Hint: There are links at the bottom of that page.)
Every good solution is obvious once you've found it.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: enum pci

Post by JamesM »

a5498828 wrote:I prefer to be sure instead of guessing.
Always a good plan.
Documentation is not clear and ambiguous = it suck.
The documentation is perfectly clear. If you choose only to use the aggregated, tutorial-ised version on osdev.org, obviously it is not perfect. Instead, why not use the PCI spec on which the osdev.org wiki is based?
function number = device can support diffrent functionality on low level
Some devices are multi-function.
bus number = i can have more than 1 pci bus? wtf.
Yes, of course you can. Have you never heard of a PCI-PCI bridge?
device number = device on bus id
Bang on, here.
register number = this is actual pci (device ?) data
Each device exposes a number of registers that can be used to query both the device itself and its memory-mappings.
enable bit = wtf
What the hell do you *think* an "enable bit" does? It enabled the device, dumbass.
I dont know what is a bus. so i ask questions and search for answers to change it.
For me bus is a device wich is used to comunicate with devices attached to it. it is given irq, pio/mmio mapping to interface with cpu. and that is all, i dont know any details yet.
[/quote]

Google it. Why would you try and start writing a device driver for a bus when you don't know what a bus is?
Post Reply