NetBSD-Bugs archive

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

Re: port-amd64/42895



The following reply was made to PR port-amd64/42895; it has been noted by GNATS.

From: Jukka Ruohonen <jruohonen%iki.fi@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: port-amd64/42895
Date: Tue, 16 Mar 2010 11:10:59 +0200

 Can you try the following patch (for -current)?
 
 It is a slight variation of the patch you already tested. As such, it is
 still very much an ugly hack.
 
 This tries to rule out the possibility that AcpiGetObjectInfo() -- called
 before any device attachments during the making of the device nodes --
 references EC's operation regions before acpiec(4) has attached.
 
 
 Index: acpi.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/acpi/acpi.c,v
 retrieving revision 1.161
 diff -u -p -r1.161 acpi.c
 --- acpi.c     16 Mar 2010 08:02:01 -0000      1.161
 +++ acpi.c     16 Mar 2010 08:58:16 -0000
 @@ -171,6 +171,7 @@ static const char * const acpi_ignored_i
        "PNP0B00",      /* AT RTC is handled internally */
        "PNP0C01",      /* No "System Board" driver */
        "PNP0C02",      /* No "PnP motherboard register resources" driver */
 +      "PNP0C09",      /* Early attach of ACPI EC */
        "PNP0C0B",      /* No need for "ACPI fan" driver */
        "PNP0C0F",      /* ACPI PCI link devices are handled internally */
        "INT0800",      /* Intel HW RNG is handled internally */
 @@ -193,6 +194,8 @@ static char acpi_supported_states[3 * 6 
   * Prototypes.
   */
  static void           acpi_build_tree(struct acpi_softc *);
 +static ACPI_STATUS    acpi_attach_ec(ACPI_HANDLE, uint32_t,
 +                                        void *, void **);
  static ACPI_STATUS    acpi_make_devnode(ACPI_HANDLE, uint32_t,
                                          void *, void **);
  
 @@ -433,8 +436,9 @@ acpi_attach(device_t parent, device_t se
  {
        struct acpi_softc *sc = device_private(self);
        struct acpibus_attach_args *aa = aux;
 -      ACPI_STATUS rv;
        ACPI_TABLE_HEADER *rsdt;
 +      ACPI_HANDLE handle;
 +      ACPI_STATUS rv;
  
        aprint_naive("\n");
        aprint_normal(": Intel ACPICA %08x\n", ACPI_CA_VERSION);
 @@ -516,8 +520,18 @@ acpi_attach(device_t parent, device_t se
                    AcpiFormatException(rv));
                return;
        }
 +
        acpi_active = 1;
  
 +      /*
 +       * Attach EC. XXX: A hack.
 +       */
 +      rv = AcpiGetHandle(ACPI_ROOT_OBJECT, "\\_SB_", &handle);
 +
 +      if (ACPI_SUCCESS(rv))
 +              (void)AcpiWalkNamespace(ACPI_TYPE_ANY, handle, 100,
 +                  acpi_attach_ec, sc, NULL);
 +
        /* Our current state is "awake". */
        sc->sc_sleepstate = ACPI_STATE_S0;
  
 @@ -858,6 +872,57 @@ acpi_rescan_capabilities(struct acpi_sof
  #undef ACPI_STA_DEV_VALID
  
  /*
 + * XXX: A hack.
 + */
 +static ACPI_STATUS
 +acpi_attach_ec(ACPI_HANDLE handle, uint32_t level,
 +    void *context, void **status)
 +{
 +      struct acpi_softc *sc = context;
 +      struct acpi_attach_args aa;
 +      struct acpi_devnode *ad;
 +      ACPI_DEVICE_INFO *devinfo;
 +      ACPI_OBJECT_TYPE type;
 +      ACPI_INTEGER hid;
 +      ACPI_STATUS rv;
 +
 +      rv = AcpiGetType(handle, &type);
 +
 +      if (ACPI_FAILURE(rv))
 +              return AE_OK;
 +
 +      if (type != ACPI_TYPE_DEVICE)
 +              return AE_OK;
 +
 +      rv = acpi_eval_integer(handle, "_HID", &hid);
 +
 +      if (hid != 0x090cd041) /* Raw EISA ID. */
 +              return AE_OK;
 +
 +      rv = AcpiGetObjectInfo(handle, &devinfo);
 +
 +      if (ACPI_FAILURE(rv))
 +              return AE_OK;
 +
 +      ad = malloc(sizeof(*ad), M_ACPI, M_NOWAIT | M_ZERO);
 +
 +      if (ad == NULL)
 +              return AE_NO_MEMORY;
 +
 +      ad->ad_parent = sc->sc_dev;
 +      ad->ad_devinfo = devinfo;
 +      ad->ad_handle = handle;
 +      ad->ad_type = type;
 +
 +      aa.aa_node = ad;
 +
 +      ad->ad_device = config_found_ia(sc->sc_dev,
 +          "acpinodebus", &aa, acpi_print);
 +
 +      return AE_ERROR;        /* Found one. */
 +}
 +
 +/*
   * acpi_make_devnode:
   *
   *    Make an ACPI devnode.
 


Home | Main Index | Thread Index | Old Index