Subject: pciide split
To: None <tech-kern@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 09/25/2003 19:44:23
Hi,
as I already mentioned, I'd like to split pciide.c in per-controller
drivers. The reason is that it's large, and can only grow as new
controllers comes out. This would allow more fine-grained control
on what code is inclued in the kenrnel (for example, an alpha or sparc64
is very unlikely to use the piix code).

I did the split, but I can't show code for now because I have pending
copyright issue I'll look at this week-end. I'm still sending this because
I just posted a mail about atabus, and I'd like to get both in the tree at the
same time (because both require kernel config file change, no need to ask
users to update their kernel config file twice).

I now have a pciide_common.c which has most of the pciide_* functions
of the current pciide.c. Then the controller-specific functions are
in 12 drivers:
acardide*       at pci? dev ? function ?        # Acard IDE controllers
aceride*        at pci? dev ? function ?        # Acer Lab IDE controllers
cmdide*         at pci? dev ? function ?        # CMD tech IDE controllers
cypide*         at pci? dev ? function ?        # Cypress IDE controllers
hptide*         at pci? dev ? function ?        # Triones/HighPoint IDE controllers
optiide*        at pci? dev ? function ?        # Opti IDE controllers
piixide*        at pci? dev ? function ?        # Intel IDE controllers
pdcide*         at pci? dev ? function ?        # Promise IDE controllers
siside*         at pci? dev ? function ?        # SiS IDE controllers
slide*          at pci? dev ? function ?        # Symphony Labs IDE controllers
swide*          at pci? dev ? function ?        # ServerWorks IDE controllers
viaide*         at pci? dev ? function ?        # VIA/AMD/Nvidia IDE controllers
pciide*         at pci? dev ? function ? flags 0x0000   # GENERIC pciide driver

pciide is a catch-all driver, which gets attached if nothing better matches.
viaide also handle AMD and Nvidia, because these are really clones of
the VIA Apollo, I merged support for these in the VIA driver.

The size of a GENERIC kernel including all these drivers hasn't changed much,
it has shrunk a bit on i386:
text    data    bss     dec     hex     filename
6023835 131460  406076  6561371 641e5b  netbsd-nosplit
6025839 133028  406076  6564943 642c4f  netbsd-split

open issues are:
- names of the drivers :)
- should we have separate drivers for SATA ?
  Right now, we have sata in compat mode only, so it really doesn't take much
  space and doesn't qualify for separate drivers. Also, there is a promise
  device which has both SATA and parallel ATA.
My opinion on this is that for now we can keep SATA and parallel ATA in the
same drivers. we can split them later if needed.

-
Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
     NetBSD: 24 ans d'experience feront toujours la difference
--