Subject: Re: Kernel only sees 1 SATA channel out of 4 - nv520 chip
To: None <ks@ub.uni-mainz.de>
From: Art Lemasters <develunix@gmail.com>
List: current-users
Date: 01/12/2008 18:59:17
Kurt Schreiner wrote:

> On an older Sun Ultra 40 (Not the M2 Variant) I have to apply the
> following "patch" (or call it hack ;-) to get all SATA-drives working.
> Maybe this could help on your machine, too?
> 
> Kurt

   Thank you, Kurt! The code hints could be very helpful and will help me
to know where in the source tree to look. As mentioned before, I haven't
done pure C or devices, but it wouldn't hurt to learn a little more.

Art

>  cvs diff -u viaide.c
> Index: viaide.c
> ===================================================================
> RCS file: /cvsroot/src/sys/dev/pci/viaide.c,v
> retrieving revision 1.50
> diff -u -r1.50 viaide.c
> --- viaide.c    20 Dec 2007 22:24:40 -0000      1.50
> +++ viaide.c    12 Jan 2008 08:51:08 -0000
> @@ -799,6 +799,21 @@
>         pciide_mapreg_dma(sc, pa);
>         aprint_verbose("\n");
> 
> +       /*
> +        * enable memory-space access. sometimes memory space is
> +        * _not_ enabled so "just do it" to get things going!
> +        */
> +       {
> +       pcireg_t csr;
> +       if (pa->pa_memt) {
> +           pa->pa_flags |= PCI_FLAGS_MEM_ENABLED;
> +           sc->sc_ba5_st = pa->pa_memt;
> +       }
> +       csr = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
> +       pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
> +           csr | PCI_COMMAND_MEM_ENABLE);
> +       }
> +
>         if (sc->sc_dma_ok) {
>                 sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_UDMA | ATAC_CAP_DMA;
>                 sc->sc_wdcdev.irqack = pciide_irqack;
> 
>