Subject: Re: Cardbus SATA3112 Driver development problems: HELP!!
To: None <tech-kern@netbsd.org>
From: Phil Quinton <pquinton@softhome.net>
List: tech-kern
Date: 10/26/2005 17:22:47
OK, some more info....


I've stuck some more debugging in and I've spotted something a little 
weird.

The piece of code below chucks out the following:

sii3112_drv_probe: sstatus = SStatus_DET_DEV.
satalinkcb0: port 1: scnt=0xff sn=0xff cl=0xff ch=0xff

NOTICE the values are all 0xff... somehow I don't think this is correct.

Could it be possible that the chp->cmd_iot, chp->cmd_iohs[wd_sdh] are 
mapped to the wrong place?

Any ideas?

Thanks. Phil.


The following piece of code is from if_satalink_cardbus.c (see 
pci/satalink.c) function sii3112_drv_probe:

---snip---
case SStatus_DET_DEV:
		printf("sii3112_drv_probe: sstatus = SStatus_DET_DEV.\n");
		/*
		 * XXX ATAPI detection doesn't currently work.  Don't
		 * XXX know why.  But, it's not like the standard method
		 * XXX can detect an ATAPI device connected via a SATA/PATA
		 * XXX bridge, so at least this is no worse.  --thorpej
		 */
		bus_space_write_1(chp->cmd_iot, chp->cmd_iohs[wd_sdh], 0,
		    WDSD_IBM | (0 << 4));
		delay(10);	/* 400ns delay */
		/* Save register contents. */
		scnt = bus_space_read_1(chp->cmd_iot,
				        chp->cmd_iohs[wd_seccnt], 0);
		sn = bus_space_read_1(chp->cmd_iot,
				      chp->cmd_iohs[wd_sector], 0);
		cl = bus_space_read_1(chp->cmd_iot,
				      chp->cmd_iohs[wd_cyl_lo], 0);
		ch = bus_space_read_1(chp->cmd_iot,
				      chp->cmd_iohs[wd_cyl_hi], 0);

		printf("%s: port %d: scnt=0x%x sn=0x%x cl=0x%x ch=0x%x\n",
		    sc->sc_wdcdev.sc_dev.dv_xname, chp->ch_channel,
		    scnt, sn, cl, ch);
---snip---






In article <MPG.1dc96be9a4c54ff898968e@news.gmane.org>, 
pquinton@softhome.net says...
> Hi guys...
> 
>  I'm having some problems with a driver I've bodges together, and my 
> knowledge of PCI/CARDBUS/ and the wd driver are almost non-existent.. 
> 
>  OK. I've bodged the following files:
> 
> From				To
> ----				--
> pci/pciide.c			cardbus/cardbuside.c
> pci/pciide_common.c		cardbus/cardbuside_common.c
> pci/pciidereg.h		cardbus/cardbuside_reg.h
> pci/pciidevar.h		cardbus/cardbuside_var.h
> pci/pciide_sii3112.h		cardbus/cardbuside_sii3122.h
> pci/satalink.c		cardbus/if_satalink_cardbus.c
> 
> I've added the following lines to files.cardbus:
> 
> # CARDBUS/PCI IDE controllers
> define cardbuside_common
> file dev/cardbus/cardbuside_common.c cardbuside_common
> 
> device	cardbuside {[channel = -1]}: ata, cardbuside_common
> attach	cardbuside at cardbus
> file	dev/cardbus/cardbuside.c		cardbuside
> 
> 
> # Silicon Image SATALink controllers
> device  satalinkcb {[channel = -1]}: ata, cardbuside_common
> attach  satalinkcb at cardbus with satalink_cardbus
> file    dev/cardbus/if_satalink_cardbus.c              satalink_cardbus
> 
> ---
> OK... The Problem.
> 
>  It looks like it's working... detects the chip.. detects if there is a 
> HD attached, can differentiate between which port on the card it's 
> connected too... BUT when the wd driver gets it... it detects the HD as 
> an ST506 (wd1: see below) with some seriously bogus values.. and the 
> whole thing falls over.. Any suggestions would be greatly appreciated... 
> also.. if someone could suggest the best way to debug this or have a 
> look through the code I would be more than greatful...
> 
> Thanks in advance...
> 
> Phil.
> ---
> 
> OUTPUT: Please note I've put a load of printf statements in... and 
> debugging is enabled.