WORD GetBAR
{
...
...
...
__asm {
mov eax,addr
mov dx,0xcf8
OUT DX,EAX
mov dx,0xcfc
IN EAX,DX
MOV BAR,EAX
}
return BAR;
}
BAR = GetBAR(0,0x1f,2,0x10) & 0xfffe;
My problem is that when I try this PCI code to get BAR of HDC of other of my PCs BAR==0. Why don't work in one PC and at the two other the code above work?
You only posted a read-from-PCI function without defining proper arguments, typed it "WORD" (which implies 16 bits which is either a bug or really bad terminology, and also devitates from standards-prescribed stdint.h), and pass in some magic values which are most likely wrong because they are not the same on every computer.
Do proper PCI device detection, and please, make your code sane and legible.
"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:You only posted a read-from-PCI function without defining proper arguments, typed it "WORD" (which implies 16 bits which is either a bug or really bad terminology, and also devitates from standards-prescribed stdint.h), and pass in some magic values which are most likely wrong because they are not the same on every computer.
Do proper PCI device detection, and please, make your code sane and legible.
Combuster wrote:You only posted a read-from-PCI function without defining proper arguments, typed it "WORD" (which implies 16 bits which is either a bug or really bad terminology, and also devitates from standards-prescribed stdint.h), and pass in some magic values which are most likely wrong because they are not the same on every computer.
Do proper PCI device detection, and please, make your code sane and legible.
"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 ]
If you don't wants tio help me I've already DISCOVER anything wrong with my code. In the PC that the code don't works the bus = 0, device = 5, function = 0 but why the AHCI Controller is in other bus device and function in that PC???
We are trying to help by leading you to the answer, which it appears has now happened. That way you might actually understand what you are doing rather than just blindly following what others tell you. Unfortunately you have demonstrated, in the process, that you don't really understand the PCI bus, how to enumerate it, or why you should want to. Read the Wiki link that I gave and you may then understand more about the code that you claim to have written.
There's nothing wrong with using other people's code, as long as you understand it, but there's little point in BSing here that you wrote it yourself when you clearly didn't. People aren't going to be fooled like that.
iansjack wrote:We are trying to help by leading you to the answer, which it appears has now happened. That way you might actually understand what you are doing rather than just blindly following what others tell you. Unfortunately you have demonstrated, in the process, that you don't really understand the PCI bus, how to enumerate it, or why you should want to. Read the Wiki link that I gave and you may then understand more about the code that you claim to have written.
There's nothing wrong with using other people's code, as long as you understand it, but there's little point in BSing here that you wrote it yourself when you clearly didn't. People aren't going to be fooled like that.
Aaaaaarrrrggghhh! The only thinhg that I want know is: WHAT IS THE BUS, DEVICE, FUNCTION OF A AHCI SATA CONTROLLER??????????