* AHCI: using bios after linux
@ 2007-10-12 15:40 msundius
2007-10-12 16:27 ` Alan Cox
0 siblings, 1 reply; 7+ messages in thread
From: msundius @ 2007-10-12 15:40 UTC (permalink / raw)
To: linux-ide; +Cc: msundius
--------------------------------------------------
Here is a message for you from http://web2mail.com
The easy way to read and send POP email on the web
--------------------------------------------------
My employer is using Linux as a boot-loader of sorts which eventually boots
another OS. We have some proprietary code which runs in real mode between the
time Linux runs and the next operating system is chain-booted (we use kexec
return to real mode after Linux). This proprietary code makes use of the BIOS
disk calls via int13. In short we need to the BIOS Int13 after Linux.
Our system seems to work well on most machines, however it does not work on any
machine that make use of AHCI. As soon as we make the first Int13 call after the
Linux AHCI driver has been initialized, the machine goes off into the weeds.
I been looking though your archives and reading the AHCI spec. It seems clear
that the hardware has at least some state contained within it; I'm wondering if
there is any hope of putting the chip back to a known state that the BIOS will
be able to handle.
1)In reading the AHCI spec, I notice in chapter 10.6 they talk about a bit that
when set by the OS driver, control of the AHCI hardware is irrevocably passed to
the OS, your driver does not seem to touch that bit so I'm hoping that it is
reasonable to pass back control to the BIOS by either resetting the chip or
simply placing it into a quiescent state.
2)I also have noticed that you do not do anything special when the AHCI module
is removed. That is, you simply use the ata_pci_remove_one() function instead of
one particular to the AHCI chip.
Could anyone lend some guidance as to what has to be done to put the hardware
back into a sane state for BIOS, or if there is a good reason that this is not
achievable.
Any prior work or manuals that I should rtfm or other wisdom would be greatly
appreciated.
Thank you.
Mike
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: AHCI: using bios after linux
2007-10-12 15:40 msundius
@ 2007-10-12 16:27 ` Alan Cox
0 siblings, 0 replies; 7+ messages in thread
From: Alan Cox @ 2007-10-12 16:27 UTC (permalink / raw)
To: msundius; +Cc: linux-ide, msundius
> return to real mode after Linux). This proprietary code makes use of the BIOS
> disk calls via int13. In short we need to the BIOS Int13 after Linux.
Thats tricky. Linux does preserve the BIOS page.
> I been looking though your archives and reading the AHCI spec. It seems clear
> that the hardware has at least some state contained within it; I'm wondering if
> there is any hope of putting the chip back to a known state that the BIOS will
> be able to handle.
You want the chip docs for the specific AHCI controller you need to work
with. For the Intel ones at least yo've got a chance to reconfigure them.
However you will need to know what the BIOS expects.
You may well also find that if you use a BIOS that supports AHCI (and can
set the controller to AHCI) you can use INT13 to talk to the controller
in AHCI mode.
I don't think its a good idea, and I would be tempted to try and remove
that set of calls and fire them via an application in Linux before
calling kexec, but in theory yes you can probably put the device back
into legacy mode.
Alan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: AHCI: using bios after linux
@ 2007-10-12 18:27 msundius
2007-10-12 20:57 ` Alan Cox
0 siblings, 1 reply; 7+ messages in thread
From: msundius @ 2007-10-12 18:27 UTC (permalink / raw)
To: Alan Cox; +Cc: msundius, xuxiang_ins, linux-ide
--------------------------------------------------
Here is a message for you from http://web2mail.com
The easy way to read and send POP email on the web
--------------------------------------------------
> You want the chip docs for the specific AHCI controller you need to work
> with. For the Intel ones at least yo've got a chance to reconfigure them.
> However you will need to know what the BIOS expects.
>
> You may well also find that if you use a BIOS that supports AHCI (and can
> set the controller to AHCI) you can use INT13 to talk to the controller
> in AHCI mode.
>
> I don't think its a good idea, and I would be tempted to try and remove
> that set of calls and fire them via an application in Linux before
> calling kexec, but in theory yes you can probably put the device back
> into legacy mode.
>
> Alan
>
>
Hi Alan,
Thanks for your reply. I'll just add a couple of requirements since I
didn't explain fully:
1) our goal is to use linux to do some pre Windows work and then set the
machine down right at the piont where BIOS kicks off the MBR. i.e.
we want to be somewhat invisable to the whole boot process. Thus,
we really can't eliminate the BIOS calls, as the MBR and ntloader still
rely on BIOS.
2) as we are trying to sell this, we want it to work on all (or most)machines.
so we have to support everything :]. Though, I guess Intel is a good
place to start.
3) related to #1 above, we want to be invisable. so we're not looking to
switch from AHCI (to legacy), we are looking to continue in whatever mode
the BIOS started in. Thus we just want BIOS to be able to handle int13 calls
after the Linux AHCI driver has run (this works when BIOS is setup in
legacy mode initially).
I wonder if there is a way to query the state, pre-Linux, of the AHCI hardware
so that we could put it back, post-Linux; Or if it is a matter of
putting it in a "reset" state of somesort.. I just have not gotten far enough
to understad the hardware well enough to understand what things the
BIOS might be confused about.
your suggestion of "you want the chip docs" is right on. I've seen the
ICHx data sheets, I'm wondering if there are any other docs such as app notes
or other (system) software manuals for that part? that is that the manual
that you are talking about? specifically could you point me to any other you
might know about?
Finally, I have been told that this is a bad idea before and to some extent
I agree with you. that's not really my descision tho, we're all just soldiers
in this fight arn't we :[
Thanks so much for your help.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: AHCI: using bios after linux
2007-10-12 18:27 Re: AHCI: using bios after linux msundius
@ 2007-10-12 20:57 ` Alan Cox
2007-10-12 21:02 ` Jeff Garzik
2007-10-12 21:55 ` Xiang Xu
0 siblings, 2 replies; 7+ messages in thread
From: Alan Cox @ 2007-10-12 20:57 UTC (permalink / raw)
To: msundius; +Cc: msundius, xuxiang_ins, linux-ide
> 3) related to #1 above, we want to be invisable. so we're not looking to
> switch from AHCI (to legacy), we are looking to continue in whatever mode
> the BIOS started in. Thus we just want BIOS to be able to handle int13 calls
> after the Linux AHCI driver has run (this works when BIOS is setup in
> legacy mode initially).
So load the ata_piix driver and not the AHCI one and I think it'll work
out ?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: AHCI: using bios after linux
2007-10-12 20:57 ` Alan Cox
@ 2007-10-12 21:02 ` Jeff Garzik
2007-10-12 21:55 ` Xiang Xu
1 sibling, 0 replies; 7+ messages in thread
From: Jeff Garzik @ 2007-10-12 21:02 UTC (permalink / raw)
To: Alan Cox; +Cc: msundius, msundius, xuxiang_ins, linux-ide
Alan Cox wrote:
>> 3) related to #1 above, we want to be invisable. so we're not looking to
>> switch from AHCI (to legacy), we are looking to continue in whatever mode
>> the BIOS started in. Thus we just want BIOS to be able to handle int13 calls
>> after the Linux AHCI driver has run (this works when BIOS is setup in
>> legacy mode initially).
>
> So load the ata_piix driver and not the AHCI one and I think it'll work
> out ?
Sane advice under the circumstances, I suppose.
Overall, its a repeat of a fundamental problem... we might be resetting
the HBA, restarting the port, or any number of things that the BIOS
doesn't know about.
I tend to think making such calls will largely rely on luck, without
some sort of in-kernel synchronization. Smart controllers do this sort
of stuff, but that's a different case from the one here. Here we have
competing pieces of software, each unaware of the other.
Jeff
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: AHCI: using bios after linux
2007-10-12 20:57 ` Alan Cox
2007-10-12 21:02 ` Jeff Garzik
@ 2007-10-12 21:55 ` Xiang Xu
2007-10-23 8:26 ` Tejun Heo
1 sibling, 1 reply; 7+ messages in thread
From: Xiang Xu @ 2007-10-12 21:55 UTC (permalink / raw)
To: Alan Cox, msundius; +Cc: msundius, xuxiang_ins, linux-ide
> > 3) related to #1 above, we want to be invisable.
> so we're not looking to
> > switch from AHCI (to legacy), we are looking to
> continue in whatever mode
> > the BIOS started in. Thus we just want BIOS to be
> able to handle int13 calls
> > after the Linux AHCI driver has run (this works
> when BIOS is setup in
> > legacy mode initially).
>
> So load the ata_piix driver and not the AHCI one and
> I think it'll work
> out ?
>
Just want to add some background info here, our
product will be deployed on thousands of boxes, so
it's not advisable for our product to require the
users to change the default setting of BIOS from AHCI
to Normal mode. I am just thinking wild here so please
bear with me, but I am wandering if there is a way to
load the ata_piix driver with BIOS setting to AHCI
mode? Any pointer will be greatly appreciated.
Xiang
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: AHCI: using bios after linux
2007-10-12 21:55 ` Xiang Xu
@ 2007-10-23 8:26 ` Tejun Heo
0 siblings, 0 replies; 7+ messages in thread
From: Tejun Heo @ 2007-10-23 8:26 UTC (permalink / raw)
To: Xiang Xu; +Cc: Alan Cox, msundius, msundius, linux-ide
Xiang Xu wrote:
>>> 3) related to #1 above, we want to be invisable.
>> so we're not looking to
>>> switch from AHCI (to legacy), we are looking to
>> continue in whatever mode
>>> the BIOS started in. Thus we just want BIOS to be
>> able to handle int13 calls
>>> after the Linux AHCI driver has run (this works
>> when BIOS is setup in
>>> legacy mode initially).
>> So load the ata_piix driver and not the AHCI one and
>> I think it'll work
>> out ?
>>
>
> Just want to add some background info here, our
> product will be deployed on thousands of boxes, so
> it's not advisable for our product to require the
> users to change the default setting of BIOS from AHCI
> to Normal mode. I am just thinking wild here so please
> bear with me, but I am wandering if there is a way to
> load the ata_piix driver with BIOS setting to AHCI
> mode? Any pointer will be greatly appreciated.
The only sensible way to maintain BIOS setting would be to not load
native drivers at all and make BIOS calls for disk IO (from the IO
driver, switch to real mode, make BIOS call, exit real mode, return
data). That will be extremely gloss but should be doable in principle.
You don't need high performance IO, right?
--
tejun
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-10-23 8:26 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-12 18:27 Re: AHCI: using bios after linux msundius
2007-10-12 20:57 ` Alan Cox
2007-10-12 21:02 ` Jeff Garzik
2007-10-12 21:55 ` Xiang Xu
2007-10-23 8:26 ` Tejun Heo
-- strict thread matches above, loose matches on Subject: below --
2007-10-12 15:40 msundius
2007-10-12 16:27 ` Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).