How to program the DMA controller for sending/receiving data to/from a PCI device?
-
https://wiki.osdev.org/PCI has some details and links. Beyond that, this question isn't at all specific about what you're trying to do or what you already have working. – Peter Cordes Aug 20 '21 at 17:57
-
I'm trying to write a driver for the pci but I don't know where to start of course I've heard of finding devices connected to the bus and pci enumeration but I just don't know how to start. Understand that I just need to know where to start from. I've read that article so many times and there's almost no difference between reading a documentation and reading the stupid article. – Richard-- Aug 20 '21 at 20:40
-
@At2005 - your edit is an improvement to this question, but it's not suitable for reopening in its current state. It's now asking for links to guides/tutorials, i.e. off-site resources, which is one of the standard close reasons. That's something to avoid in future edits, especially If you're going to check the "nominate for reopening" box. Even with a rephrase to avoid that (my edit), it's kind of too broad and open-ended, and it would probably still be best to leave it closed. – Peter Cordes Oct 11 '21 at 03:22
1 Answers
I understand that I need to work with it so that I can use the DMA
There is no "PCI DMA".
PCI is a bus (a set of wires) using a specific low-level protocol (electrical signals); which provides a standardized method of detecting/identifying attached devices ("PCI configuration space"), determining which resources they use (IRQs, IO ports, memory mapped IO areas) and configuring those resources.
Devices do whatever they're designed to do (which may include DMA engines and/or bus mastering capabilities for some devices); but that all depends on the device and not the PCI bus.
(I heard that the ISA DMA is a slow sh*t so I won't use it
If you're writing a device driver for an old/legacy/ISA device that can support ISA DMA (e.g. floppy drive controller) the only choice you have is whether to use ISA DMA or not use any DMA at all (and waste a huge amount of CPU time waiting for a slow device). Note that these old devices are slow, so a "slow" ISA DMA controller is fast enough for them anyway.
Please I need a detailed outline for the implementation of the PCI stuff.
The main thing a "PCI driver" would do is enumerate the PCI bus/buses to find out which devices are plugged into them, and determine the resources (IRQs, IO ports, memory mapped IO areas) each device uses. A PCI driver might also support hot-plug (not recommended for beginners), and (depending on OS design) might also be responsible for finding/starting the device drivers for whatever devices it finds.
This is all relatively well covered by https://wiki.osdev.org/PCI . There isn't much/anything else involved (unless you're thinking about a specific device that happens to be attached to PCI).

- 328,167
- 45
- 605
- 847

- 35,656
- 2
- 39
- 66