> Date: Sat, 24 Jul 2010 22:50:39 +0200
> From: Mike Belopuhov <[email protected]>
> 
> Hi,
> 
> the following diff fixes a hang on boot when acpivideo(4) tries to
> evaluate _DOD method for nonexistent video device.
> 
> Long story short, there are crappy laptops out there (like Samsung Q45)
> that have modifications with advanced video cards (nVidia) and regular
> Intel ones.  To save costs [or for whatever other reasons] manufacturer
> uses the same ACPI config for both modifications.
> 
> In this case there are two acpivideo devices: NVID and GFX0 with ADRs
> Zero and 0x00020000 respectively, so it seems natural to knock out NVID
> by checking its ADR.  FWIW, Linux also checks for device presence in a
> similar manner.

I don't think this will work.  A fair number of machines have a video
card at dev 0 function 0, which would translate into _ADR being zero.

Below is a diff that I have had in my tree for a while to fix a
similar issue on my Dell laptop.  It checks whether the bus on which
the card supposedly sits really exists.

Can you check whether this fixes your problem as well?

Index: acpivideo.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/acpivideo.c,v
retrieving revision 1.5
diff -u -p -r1.5 acpivideo.c
--- acpivideo.c 4 Jun 2009 17:16:00 -0000       1.5
+++ acpivideo.c 25 Jul 2010 20:38:09 -0000
@@ -58,6 +58,8 @@ void  acpivideo_get_dod(struct acpivideo_
 int    acpi_foundvout(struct aml_node *, void *);
 int    acpivideo_print(void *, const char *);
 
+int    acpivideo_getpcibus(struct acpivideo_softc *, struct aml_node *);
+
 struct cfattach acpivideo_ca = {
        sizeof(struct acpivideo_softc), acpivideo_match, acpivideo_attach
 };
@@ -90,6 +92,9 @@ acpivideo_attach(struct device *parent, 
 
        printf(": %s\n", sc->sc_devnode->name);
 
+       if (acpivideo_getpcibus(sc, sc->sc_devnode) == -1)
+               return;
+
        aml_register_notify(sc->sc_devnode, aaa->aaa_dev,
            acpivideo_notify, sc, ACPIDEV_NOPOLL);
 
@@ -229,4 +234,12 @@ acpivideo_get_dod(struct acpivideo_softc
        DPRINTF(("\n"));
 
        aml_freevalue(&res);
+}
+
+int
+acpivideo_getpcibus(struct acpivideo_softc *sc, struct aml_node *node)
+{
+       /* Check if parent device has PCI mapping */
+       return (node->parent && node->parent->pci) ?
+               node->parent->pci->sub : -1;
 }

Reply via email to