Subject: ide code reorganisation
To: None <tech-kern@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 06/22/2003 19:57:32
Hi,
after a lot of thoughs and try, I think I finally fond how I want to
reorganise the IDE probe/attach code.
The primary goal is to support IDE hot plug. A second one is to delay
probe/config of devices on a ata bus to interrupts (so that we can
do the resets in parallel, and use tsleep()). There will also be a per-channel
kernel thread to handle resets, to avoid having the whole box hung waiting
for a disk which isn't there any more.
For IDE hot plug, I need a way to access the ata bus (to freeze the
bus, eventually turn off the bus at controller level for those who can do
it, scan the bus, etc ...). The best way for this is to have a
controller-independant device which can do callbacks to the controller.
This is why I'd like to introduce an ata bus, children of the various
IDE controllers. We currently have a wdc_base attribute, atabus would be the
device associated with it. wd and atapibus would become childrens of atabus
(instead of the IDE controller). atactl would also get some bus commands
(like scsictl).
I think our autoconf system would allow removing atapibus in the scheme
above, and attach the atapi devices (sd, st, cd, uk) to atabus (I didn't
check it would still be possible to not include the generic atapi code
if not atapi devices are attached to the atabus, though). The problem with
this scheme is that atapibus is also a child of umass, and I think it's
desirable to keep it for this reasons (and also for consistency with scsibus).
It may also make sense, one day, to have scsictl be able to access atapibus
too (for now, the scsictl bus commands don't make sense for atapibus,
they have to be at the atabus level).
On the opposite, it doesn't make sense to insert an atabus between umass and
wd, because umass doesn't give us access to the ata bus itself.
To summarize, for now we have:
wd at wdc
wd at pciide
wd at <some machine dependant IDE controllers>
atapibus at wdc
atapibus at pciide
atapibus at <some machine dependant IDE controllers>
sd at atapibus
st at atapibus
cd at atapibus
uk at atapibus
I want to change it to:
ata at wdc
ata at pciide
ata at <some machine dependant IDE controllers>
wd at ata
atapibus at ata
sd at atapibus
st at atapibus
cd at atapibus
uk at atapibus
and add atabus devices in /dev
I started implementing this change, and the good news is that the interface
between IDE controllers and wdc_base doesn't need to be changed, just
extended. This means no changes are needed to the existing drivers are
needed (unless it has some hot-swap capabilities and we want to use it),
we just need to change the config(8) files.
Comments ?
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 24 ans d'experience feront toujours la difference
--