MacBookPro 5,1

Lin Ming ming.m.lin at intel.com
Fri Oct 22 02:42:39 UTC 2010


On Fri, 2010-10-22 at 04:57 +0800, Hans Petter Selasky wrote:
> On Thursday 21 October 2010 09:12:27 Lin Ming wrote:
> > On Thu, 2010-10-21 at 11:39 +0800, Lin Ming wrote:
> > > On Wed, 2010-10-20 at 16:06 +0800, Hans Petter Selasky wrote:
> > > > On Wednesday 20 October 2010 08:36:31 Lin Ming wrote:
> > > > > On Wed, 2010-10-20 at 14:34 +0800, Hans Petter Selasky wrote:
> > > > > > On Tuesday 19 October 2010 07:47:02 Lin Ming wrote:
> > > > > > > On Tue, 2010-10-19 at 04:21 +0800, Hans Petter Selasky wrote:
> > > > > > > > On Monday 18 October 2010 02:01:09 Moore, Robert wrote:
> > > > > > > > > Can you send us the acpidump for the machine?
> > > > > > > > > 
> > > > > > > > > Also, tell us which control method is failing.
> > > > > > > > > 
> > > > > > > > > Thanks
> > > > > > > > 
> > > > > > > > Hi,
> > > > > > > > 
> > > > > > > > Please find attached dump of ACPI tables.
> > > > > > > > 
> > > > > > > > It is the function AcpiRsCreateAmlResources() which writes
> > > > > > > > beyond the buffer it allocates.
> > > > > > > 
> > > > > > > Could you enable AML debug output to get more info?
> > > > > > > But I don't know how to enable it on FreeBSD.
> > > > > > > 
> > > > > > > In Linux, the AML debug output is enabled with kernel boot
> > > > > > > parameters like below.
> > > > > > > acpi.debug_layer=0xffffffff acpi.debug_level=0xffffffff
> > > > > > > 
> > > > > > > FreeBSD may have some similar boot parameters.
> > > > > > 
> > > > > > I've enabled the debug prints just around the failing function.
> > > > > > Here is the
> > > > > 
> > > > > > result:
> > > > > What's the kernel parameters are you using?
> > > > > There should be a lot of AML debug output.
> > > > 
> > > > Hi,
> > > > 
> > > > During the function call that overwrites it's buffer, there are no more
> > > > debug prints than shown in the code, even with all debug prints on.
> > > > Where should I add more debug prints?
> > > 
> > > I'm trying to reproduce this bug in the acpi simulator(acpiexec).
> > > Will get back to you.
> > 
> > Hi,
> > 
> > Could you apply below debug patch and attach the output?
> > I'll try to reproduce this bug with the output.
> > 
> > It will print something like below,
> > 
> > Passed in resource buffer length=136
> > Buffer start
> > f 0 0 0 44 0 0 0 1 0 0 0 1 0 1 0 45 ee 44 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0
> > 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 0
> > 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> > 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> > Buffer end
> > 
> > Thanks.
> 
> Here is the relevant output. First note, the buffer length is 512 and 
> (uint8_t)512 = 0, so I modified the code to print out the 512 bytes.
> 
> 
> Passed in resource buffer length=512
> Buffer start
> 0f 00 00 00 40 00 00 00 01 00 01 01 01 17 01 00 38 b0 17 03 00 ff ff ff 11 00 
> 00 00 11 00 00 00 12 00 00 00 13 00 00 00 14 00 00 00 15 00 00 00 16 00 00 00 
> 17 00 00 0
> 0 00 00 00 00 00 00 00 00 07 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 07 
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> 00 00 00 00
>  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> 00 00 00 
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> 00 00 00 0
> 0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> 00 00 00 00
>  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> 00 00 00 
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> 00 00 00 0
> 0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> 00 00 00 00
>  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> 00 00 00 
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> Buffer end

Unfortunately, I can't reproduce it in the simulator(acpiexec).

Anyway, here is the debug patch I tried and the output as below.
$acpiexec dsdt.mbp51.bin

Set resource for \_SB_.PCI0.LNK1: success
Set resource for \_SB_.PCI0.LNK2: success
Set resource for \_SB_.PCI0.LNK3: success
Set resource for \_SB_.PCI0.LNK4: success
Set resource for \_SB_.PCI0.Z003: success
Set resource for \_SB_.PCI0.Z004: success
Set resource for \_SB_.PCI0.Z005: success
Set resource for \_SB_.PCI0.Z006: success
Set resource for \_SB_.PCI0.Z007: success
Set resource for \_SB_.PCI0.Z008: success
Set resource for \_SB_.PCI0.Z009: success
Set resource for \_SB_.PCI0.Z00A: success
Set resource for \_SB_.PCI0.Z00B: success
Set resource for \_SB_.PCI0.Z00C: success
Set resource for \_SB_.PCI0.Z00D: success
Set resource for \_SB_.PCI0.Z00E: success
Set resource for \_SB_.PCI0.Z00F: success
Set resource for \_SB_.PCI0.Z00G: success
Set resource for \_SB_.PCI0.Z00H: success
Set resource for \_SB_.PCI0.Z00I: success
Set resource for \_SB_.PCI0.Z00J: success
Set resource for \_SB_.PCI0.Z00K: success
Set resource for \_SB_.PCI0.Z00L: success
Set resource for \_SB_.PCI0.Z00M: success
Set resource for \_SB_.PCI0.Z00N: success
Set resource for \_SB_.PCI0.Z00O: success
Set resource for \_SB_.PCI0.Z00P: success
Set resource for \_SB_.PCI0.Z00Q: success
Set resource for \_SB_.PCI0.Z00R: success
Set resource for \_SB_.PCI0.Z00S: success
Set resource for \_SB_.PCI0.Z00T: success
Set resource for \_SB_.PCI0.Z00U: success
Set resource for \_SB_.PCI0.LSMB: success
Set resource for \_SB_.PCI0.LUS0: success
Set resource for \_SB_.PCI0.LUS2: success
Set resource for \_SB_.PCI0.LMAC: success
Set resource for \_SB_.PCI0.LAZA: success
Set resource for \_SB_.PCI0.LGPU: success
Set resource for \_SB_.PCI0.LPID: success
Set resource for \_SB_.PCI0.LSI0: success
Set resource for \_SB_.PCI0.LSI1: success
Set resource for \_SB_.PCI0.Z000: success
Set resource for \_SB_.PCI0.Z001: success
Set resource for \_SB_.PCI0.LPMU: success

diff --git a/source/tools/acpiexec/aeexec.c b/source/tools/acpiexec/aeexec.c
index baf1aeb..5f07412 100644
--- a/source/tools/acpiexec/aeexec.c
+++ b/source/tools/acpiexec/aeexec.c
@@ -517,6 +517,70 @@ AeHardwareInterfaces (
     AE_CHECK_OK (AcpiReadBitRegister, Status);
 }
 
+static UINT8 TestBuffer[] = {
+0x0f,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x01,0x00,0x01,0x01,0x01,0x17,0x01,0x00,0x38,0xb0,0x17,0x03,0x00,0xff,0xff,0xff,0x11,0x00,
+0x00,0x00,0x11,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x16,0x00,0x00,0x00,
+0x17,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
+};
+
+static ACPI_STATUS
+SRSTestCallback (
+    ACPI_HANDLE             ObjHandle,
+    UINT32                  NestingLevel,
+    void                    *Context,
+    void                    **ReturnValue)
+{
+	ACPI_STATUS Status;
+	ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+	ACPI_BUFFER *Buffer = (ACPI_BUFFER*)Context;     
+	ACPI_BUFFER PathBuffer = { ACPI_ALLOCATE_BUFFER, NULL };
+
+	if (!Node || strncmp(Node->Name.Ascii, "_SRS", 4) || !Node->Parent) {
+		return AE_OK;
+	}
+
+	Status = AcpiGetName(Node->Parent, ACPI_FULL_PATHNAME, &PathBuffer);
+	if (ACPI_FAILURE (Status))
+		return Status;
+	AcpiOsPrintf("Set resource for %s: ", (char*)PathBuffer.Pointer);
+
+	Status = AcpiSetCurrentResources(Node->Parent, Buffer);
+	if (ACPI_FAILURE (Status)) {
+		AcpiOsPrintf("error, status=0x%x\n", Status);
+	} else {
+		AcpiOsPrintf("success\n");
+	}
+
+	return AE_OK;
+}
+
+static void SRSTest(void)
+{
+	ACPI_BUFFER Buffer = {sizeof(TestBuffer), TestBuffer};
+	ACPI_RESOURCE *Res = (ACPI_RESOURCE*)TestBuffer;
+
+	Res->Data.ExtendedIrq.ResourceSource.StringPtr = "";
+
+	(void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+                    SRSTestCallback, NULL, (void *) &Buffer, NULL);
+}
 
 /******************************************************************************
  *
@@ -540,6 +604,8 @@ AeMiscellaneousTests (
     ACPI_STATISTICS         Stats;
 
 
+    SRSTest();
+
     AeHardwareInterfaces ();
     AeGenericRegisters ();
     AeSetupConfiguration (Ssdt3Code);




More information about the freebsd-acpi mailing list