Port-cats archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Adding flag to disable native mode on aceride




On Aug 30, 2007, at 2:18 PM, Chris Gilbert wrote:

Manuel Bouyer wrote:
On Thu, Aug 30, 2007 at 11:18:22PM +0900, Izumi Tsutsui wrote:
chris%dokein.co.uk@localhost wrote:
Does this look ok? I'd like to check in the chage in then next couple
of days.
If the flag is cats specific, it's better to use proplib(3)
to specify such quirks rather than config flags,
as iyonix/autoconf.c, sgimips/autoconf.c etc. do
for their onboard PCI devices.

Yes, this looks better to me as well


Ok, attached is the diff using proplib instead of flags. Does this look ok?

Thanks,
Chris
Index: arch/cats/cats/autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/arch/cats/cats/autoconf.c,v
retrieving revision 1.11.6.1
diff -u -p -r1.11.6.1 autoconf.c
--- arch/cats/cats/autoconf.c   11 Aug 2007 21:14:52 -0000      1.11.6.1
+++ arch/cats/cats/autoconf.c   30 Aug 2007 21:08:56 -0000
@@ -152,5 +150,18 @@ cpu_configure(void)
void
device_register(struct device *dev, void *aux)
{
+       if (device_is_a(dev, "aceride"))
+       {

you should consult the actual PCI bus/device/function numbers, the way other platforms fix-up MI drivers for MD quirks.

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


+               prop_bool_t force_compat_mode;
+
+               force_compat_mode = prop_bool_create(true);
+
+               if (prop_dictionary_set(device_properties(dev),
+                                       "force-compat-mode",
+                                       force_compat_mode) == false)
+                       printf("WARNING: unable to set force-compat-mode "
+                                       "property for %s\n", dev->dv_xname);
+               prop_object_release(force_compat_mode);
+       }
}
/* 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   30 Aug 2007 21:08:56 -0000
@@ -167,7 +167,30 @@ 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
+                */
+               prop_bool_t pn;
+               pn = prop_dictionary_get(
+                               
device_properties(&sc->sc_wdcdev.sc_atac.atac_dev),
+                               "force-compat-mode");
+               if (pn != NULL) {
+                       KASSERT(prop_object_type(pn) == PROP_TYPE_BOOL);
+                       if (prop_bool_true(pn))
+                       {
+                               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,
            PCI_CLASS_REG));

-- thorpej




Home | Main Index | Thread Index | Old Index