Page 2 of 2
Re: Can't find SATA controller.
Posted: Tue May 26, 2015 3:57 am
by glauxosdev
Hi,
Specifically; find all devices on the PCI bus that the OS supports (e.g. IDE controllers, USB controllers, etc) and load drivers for them, then use those drivers to find whatever devices are connected to them (e.g. disk drives, USB flash, USB sound card, etc) and load drivers for them; then use those drivers to find whatever is connected to those devices (e.g. use the USB sound card driver to determine if there's speakers/microphones connected to the USB sound card); and so on until there's nothing left to find.
Thank you, I will finally go this way.
That's not even possible with EHCI.
My code is based on TatOS, and I found this snippet from usb/initehci.s:
Code: Select all
;CONFIGFLAG
;00=port routing to classic controller
;01=port routing to EHCI controller
;note on disconnect all ports revert to ehci
STDCALL usbinitstr24,putscroll
mov esi,[EHCIOPERBASE]
mov eax,[esi+40h]
or eax,1 ;set bit0, all ports belong to EHCI
mov [esi+40h],eax
So have I misunderstood something?
Regards,
glauxosdev
Re: Can't find SATA controller.
Posted: Tue May 26, 2015 5:54 am
by Brendan
Hi,
glauxosdev wrote:That's not even possible with EHCI.
My code is based on TatOS, and I found this snippet from usb/initehci.s:
Code: Select all
;CONFIGFLAG
;00=port routing to classic controller
;01=port routing to EHCI controller
;note on disconnect all ports revert to ehci
STDCALL usbinitstr24,putscroll
mov esi,[EHCIOPERBASE]
mov eax,[esi+40h]
or eax,1 ;set bit0, all ports belong to EHCI
mov [esi+40h],eax
So have I misunderstood something?
Their "00=port routing to classic controller" is what I was talking about when I said "routed to the companion controller".
Basically, when they invented EHCI they couldn't be bothered with low speed devices, so they just glued a OHCI or UHCI chip on it and let you switch the port from one to the other. As a side-effect, it means that if you've got an old OS that doesn't support EHCI (but does support OHCI and UHCI) the BIOS can just configure it so everything goes to the companion controller and the USB devices and USB ports still work (any high speed devices would just end up using low speed instead).
Cheers,
Brendan
Re: Can't find SATA controller.
Posted: Tue May 26, 2015 8:26 am
by glauxosdev
Hi,
I tried to read the IDE wiki page, but the factual accuracy of this article is disputed, as it says. I have also taken a look at ATAPI, ATA PIO mode and some others articles.
For a start I think my code should learn to detect my hard drive. What should I read? What is your advice?
Regards,
glauxosdev
Re: Can't find SATA controller.
Posted: Tue May 26, 2015 8:30 am
by iansjack
Re: Can't find SATA controller.
Posted: Tue May 26, 2015 8:34 am
by glauxosdev
Hi,
Sorry, did you read my first sentence? I said that the factual accuracy of this article is disputed.
Regards,
glauxosdev
Re: Can't find SATA controller.
Posted: Tue May 26, 2015 9:12 am
by iansjack
For goodness sake! Don't you have enough independence of thought to read the article, try the code, read the commentary as to why it is disputed?
Re: Can't find SATA controller.
Posted: Tue May 26, 2015 9:25 am
by glauxosdev
Hi,
I have read the commentary, of course, but I don't know if there are also other things that are not correct.
Regards,
glauxosdev
Edit: I will try again after I have taken a break. By the way I have found one IDE controller.
Re: Can't find SATA controller.
Posted: Thu May 28, 2015 5:19 am
by glauxosdev
Hi,
As far as I understand it after I have found the IDE controller I have to detect devices connected to it. I don't plan to support CD disks, or more than one hard disk, so I have to find the hard disk and select it. Then I have to get its capabilities and only now read sectors from it? Or did I mess this up?
Regards,
glauxosdev
Re: Can't find SATA controller.
Posted: Thu May 28, 2015 6:36 pm
by SpyderTL
You've got it, pretty much.
You can just assume that there is a hard drive on channel 0, for now. And you can assume that it is large enough to hold your OS and anything else you'll need for quite a while.
However, at some point, you'll need to be able to enumerate the connected devices and detect their type, because the code to read from and write to a hard drive is significantly different from a CD-ROM.