Subject: Re: Adding flag to disable native mode on aceride
To: None <tech-kern@netbsd.org>
From: Chris Gilbert <chris@dokein.co.uk>
List: port-cats
Date: 09/23/2007 11:07:16
This is a multi-part message in MIME format.
--------------020103020308000809020200
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Jason Thorpe wrote:
>
> you should consult the actual PCI bus/device/function numbers, the way
> other platforms fix-up MI drivers for MD quirks.
Done.
> The name of the property should reflect that it's aceride-specific (and
> not have a name that ties it to the driver): ali1543-ide-force-compat-mode
Also done.
I also took note of Jachym suggestion to use
prop_dictionary_{get|set}_bool functions, rather than manipulating a
prop_bool.
Does the attached diff look ok? I'm hoping to check it in this week.
Thanks,
Chris
--------------020103020308000809020200
Content-Type: text/plain;
name="cats_able_force_native.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="cats_able_force_native.diff"
Index: arch/cats/cats/autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/arch/cats/cats/autoconf.c,v
retrieving revision 1.11
diff -u -p -r1.11 autoconf.c
--- arch/cats/cats/autoconf.c 30 Jul 2007 12:25:14 -0000 1.11
+++ arch/cats/cats/autoconf.c 23 Sep 2007 09:53:43 -0000
@@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
#include <sys/malloc.h>
#include <machine/bootconfig.h>
#include <machine/intr.h>
+#include <dev/pci/pcivar.h>
#include "isa.h"
@@ -167,5 +168,23 @@ cpu_configure(void)
void
device_register(struct device *dev, void *aux)
{
+ if (device_is_a(dev, "aceride"))
+ {
+ /* cats builtin aceride is on 0:16:0 */
+ struct pci_attach_args *pa = aux;
+ if (((pa)->pa_bus == 0
+ && (pa)->pa_device == 16
+ && (pa)->pa_function == 0))
+ {
+ if (prop_dictionary_set_bool(device_properties(dev),
+ "ali1543-ide-force-compat-mode",
+ true) == false)
+ {
+ printf("WARNING: unable to set "
+ "ali1543-ide-force-compat-mode "
+ "property for %s\n", dev->dv_xname);
+ }
+ }
+ }
}
/* End of autoconf.c */
Index: dev/pci/aceride.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/aceride.c,v
retrieving revision 1.23
diff -u -p -r1.23 aceride.c
--- dev/pci/aceride.c 9 Feb 2007 21:55:27 -0000 1.23
+++ dev/pci/aceride.c 23 Sep 2007 09:53:43 -0000
@@ -167,6 +167,27 @@ acer_chip_map(struct pciide_softc *sc, s
~ACER_CHANSTATUSREGS_RO);
cr = pci_conf_read(sc->sc_pc, sc->sc_tag, PCI_CLASS_REG);
cr |= (PCIIDE_CHANSTATUS_EN << PCI_INTERFACE_SHIFT);
+
+ {
+ /*
+ * some BIOSes (port-cats ABLE) enable native mode, but don't
+ * setup everything correctly, so allow the forcing of
+ * compat mode
+ */
+ bool force_compat_mode;
+ bool property_is_set;
+ property_is_set = prop_dictionary_get_bool(
+ device_properties(&sc->sc_wdcdev.sc_atac.atac_dev),
+ "ali1543-ide-force-compat-mode",
+ &force_compat_mode);
+ if (property_is_set && force_compat_mode)
+ {
+ cr &= ~((PCIIDE_INTERFACE_PCI(0)
+ | PCIIDE_INTERFACE_PCI(1))
+ << PCI_INTERFACE_SHIFT);
+ }
+ }
+
pci_conf_write(sc->sc_pc, sc->sc_tag, PCI_CLASS_REG, cr);
/* Don't use cr, re-read the real register content instead */
interface = PCI_INTERFACE(pci_conf_read(sc->sc_pc, sc->sc_tag,
--------------020103020308000809020200--