OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 6:15 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Questions about PCI configuration space register writing
PostPosted: Sun Oct 18, 2020 2:07 pm 
Offline
Member
Member

Joined: Mon Sep 07, 2020 5:50 pm
Posts: 46
I've been working on adding a pci driver to my OS, and I've been following the guide here https://wiki.osdev.org/PCI, and I don't see anywhere in the guide where it says how to write to one of these registers? My guess is that you'd write to the config address register and then write to the config data register, but I'm not sure, and I don't know where to find the information on how to write to one of these registers.


Top
 Profile  
 
 Post subject: Re: Questions about PCI configuration space register writing
PostPosted: Sun Oct 18, 2020 3:31 pm 
Offline
Member
Member

Joined: Sun Aug 23, 2020 4:35 pm
Posts: 148
abstractmath wrote:
My guess is that you'd write to the config address register and then write to the config data register
If I understand you correctly, you are correct.

Writing a PCI register is very similar to reading it.
For reading it you do:
Code:
outl(0xCF8,pci_address);
inl(0xCFC);

For writing, you do:
Code:
outl(0xCF8,pci_address);
outl(0xCFC,value_to_write);

Note that you do have to do some bit shifting, etc, to read/write single bytes.
(Here's my code for writing a PCI byte)

_________________
My OS: TritiumOS
https://github.com/foliagecanine/tritium-os
void warranty(laptop_t laptop) { if (laptop.broken) return laptop; }
I don't get it: Why's the warranty void?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot], SemrushBot [Bot] and 158 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group