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.
If these blocks are commented out I can detect all PCI devices and it works perfectly (in Bochs, anyway). The problem is that these blocks are pretty much validation - so they are necessary (especially the first block).
I don't know if this applies here but... I used to face that kind of "basic" errors because I used direct values to specify things like the GDT selectors.
But I found that one good way to finish with that kind of things, once and for all, was to use %define to have one only constant and, if I ever tried to change it, my code wouldn't suffer because it wasn't necessary anymore to modify all of the occurences, and to remember all of them in the first place.
In any case, it demonstrates once again that writing down things allows one to think about them twice and fix errors twice as fast also...
I tried going that route, and found out that Bochs does not support the PCI BIOS service. I think I tried Qemu too and it was the same situation.
Once you query for the service $PCI it will return a error meaning the service could not be found. I actually stepped through the BIOS code with Bochs and confirmed this.
Do not fear making modifications. The earlier you modify something, the easier it's going to be. The more you fear making modifications, the later you will do them, and that'll only make them more painful. Just make sure you're using some relatively decent version control system, so you can easily roll back to your starting point (or compare the old code with the new code) if your modifications don't work right away.
I'm pretty sure that kills far too many project.
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.
The last modification I made took a week to get back to a buildable system.
On the other hand, I think implementing #defines for all my segments will save me a LOT of problems later, especially since I seem to mix the code segment with the other segments a lot lately.