Page 1 of 1

PCI Bus Enumeration not returning IDE controllers

Posted: Mon Jan 28, 2013 5:09 am
by escortkeel
Hi Everyone!

I'm an avid reader of the wiki and forums but, as you can obviously tell from the numbers below my name, this is my first post. Currently I'm developing a hobby OS (as I'm sure a lot of people on here are) and it's in the early stages. And by that I mean really early stages. At the moment I'm working on reading to and writing from Drives attached to the system and I've run into a bit of trouble.

Specifically, I want to enumerate the PCI bus and get a list of all of the IDE controllers (or any Mass Storage Device controllers for that matter) which I will later talk to and retrive information from. Unfortunantly, in both bochs and qemu, as well as a test machine, my PCI code only returns info about:
  • A PCI Host bridge device
  • A PCI to ISA bridge device
  • Optionally some another ISA bridge and a Display/Multimedia/Network controller (depending on the environment)
Obviously, I don't detect any IDE devices! I have no idea why this is (after all, my OS is running off a virtual/physical CDROM)!

I'm 100% that the code works, as all of the device and vendor information is valid (I can look it up online) and the code is based off of Charlie Somerville's JSOS (which is an operating system written in JavaScript by the way).

Would anyone have any idea why this is happening? Any assistance would be greatly apprecitated.

Thanks again,
Keeley

Re: PCI Bus Enumeration not returning IDE controllers

Posted: Mon Jan 28, 2013 5:32 am
by Combuster
PCI never lists IDE devices, but only IDE controllers (or their SATA/SCSI replacements).

Depending on your system, the IDE controller may actually be an ISA device and doesn't register using the normal plug-and-play methods. If you actually have a P3 as a testbed, then the chance that your result is actually spot on in all cases is minimal, but it would at least explain the situation for your choice of emulators.

I'd normally suggest my configurator to see what your PCI/ISA configuration really looks like, but the compile farm broke (now on the todo list for this evening) and the current image might be in a less than useful state as a result - but if it works you'll at least know what you should actually expect as the result.

Bochs does have a bunch of PCI-related configuration options you can look at to change the behaviour.

Re: PCI Bus Enumeration not returning IDE controllers

Posted: Mon Jan 28, 2013 2:51 pm
by escortkeel
Thanks for getting back to me so quickly combuster. :)

I've just tried My Configurator and I get an error (attached, but I'm not sure if the screenshot is really any help to you).

While I couldn't actually get the general IO test to run, I did notice that it (the interface) had an extra PCI entry in the "Manual Configuration" section. It was listed as class code: 1, subclass: 1. :D

I'll have a look at my code again and compare it to how MOS works, and go from there.

Thanks,
Keeley

Re: PCI Bus Enumeration not returning IDE controllers

Posted: Mon Jan 28, 2013 3:26 pm
by Combuster
Well, the documentation is mostly junk, but the relevant code is at pciserv.bas.

My guess is that you're not checking for multifunction devices (and only record the first PCI device embedded in the southbridge)


---
As for the guru meditation, that's a side effect of touching nightly builds and bleeding edge development code (see, the codes are written in red :D)

Re: PCI Bus Enumeration not returning IDE controllers

Posted: Mon Jan 28, 2013 4:50 pm
by escortkeel
You would be exactly right. Where I was checking that the Header Type == 0x80, I unnecessarily right bitshifted the Header Type by 8 bits. Problem resolved.

Thanks again (again :P).

~Keeley