Subject: Cardbus SIL3112 Sata Driver Development: Request for Help
To: None <tech-kern@netbsd.org>
From: Phil Quinton <pquinton@softhome.net>
List: tech-kern
Date: 09/19/2005 10:54:36
Hi,

 OK, looking into writing a driver for my Silicon Image 3112 Cardbus 
SATA card... I'm trying to base it on the current satalink driver.

This is the first driver I've actually attempted, ever, and the first 
time I've coded anything for NetBSD... so please don't assume that I 
know anything....

OK..

After trawling through the interfaces in the dev/cardbus directory I've 
come across my first problem...

In the *_cardbus_attach() functions, the drivers tend to setup the 
cardbus card... and at the end call the *_attach() function of a driver 
in the dev/ic directory. This dev/ic driver usually takes one 
parameter... which is the relevant softc struct. The satalink driver, 
however, hasn't been written like this.

The dev/pci/satalink driver's attach() function seems very simple, it 
looks like this:

static void
satalink_attach(struct device *parent, struct device *self, void *aux)
{
	struct pci_attach_args *pa = aux;
	struct pciide_softc *sc = (struct pciide_softc *)self;

	pciide_common_attach(sc, pa,
	    pciide_lookup_product(pa->pa_id, pciide_satalink_products));
}

Question 1: How do I get the relavent *aux to pass to 
pciide_common_attach in my cardbus driver, since the *aux that passed to 
the cardbus interface is cast as cardbus_attach_args?

or am I barking up the wrong tree?

Thanks in advance,
Phil.