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.
I been trying to enable DMA on qemu. I have ran the device enumeration to find out that BAR4 is 0. This means that base address is 0 for the DMA bus master. However after checking status I get zero. I am not sure if this an error or I am using the wrong BAR4. Below is how I tried accessing the status:
0 does not sound like a valid base address. I expect there is something wrong in your enumeration code. Have you tried dumping the whole config space to the screen to sanity check that the other fields make sense?
madanra wrote:0 does not sound like a valid base address. I expect there is something wrong in your enumeration code. Have you tried dumping the whole config space to the screen to sanity check that the other fields make sense?
I have used below code to enumerate all devices in configuration space. The value I got for device was:
0x1237
0x7000
0xb8
0x100e
vendor:
0x8086
0x8086
0x1013
0x8086
Command:
0x103
0x103
0x103
0x103
I believe that the command field is suppose to indicate whether there is a bus master on bit 2 (first is bit 0).
However, bit 2 is 0 so does that mean there is no bus master?
I suggest you start with reading the PCI page thoroughly. Your code is broken to the point where it misses the actual disk controller. (hint: it's at function > 0)
"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 ]
Combuster wrote:I suggest you start with reading the PCI page thoroughly. Your code is broken to the point where it misses the actual disk controller. (hint: it's at function > 0)
I have added an extra for loop that loops through all possible function values (0 - 7), I was able to discover the below devices and parameters:
According to the link you provided, it says a class of 0x1 and subclass id of 0x20 should indicate the ATA controller (single DMA). However, the values above doesn't seem to have such values. Also the cmd values doesn't seem to indicate that a bus master exist...
According to PCI database, device 0x7010 is a IDE controller. The header type of this device is 0x0. BAR4 is also 0xC041.
So I have tried extracting the actually address according to the PCI article. The value I got was 0x3010. Next, I tried reading the status but to no avail I get 0xff which I think isn't correct.