All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Acpica-20030619 and "-g" option
@ 2003-07-01 10:34 Hrvoje Habjanic
  0 siblings, 0 replies; 3+ messages in thread
From: Hrvoje Habjanic @ 2003-07-01 10:34 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

[-- Attachment #1: Type: text/plain, Size: 468 bytes --]


Well, hello again ... ;-)


After few hours of grep/vi/grep , i've finally made this to work (that is, 
./iasl -g to dump DSDT tables).

Looking at it now, it seems very easy - mmap-ing memory was the most trickier 
part because of page aligement ....

Patch is attached ... it will work on x86 (32bit) - for others - i'm not 
shure.

And another thing. It currently dumps ONLY DSDT table, but, i think it could 
be nice to dump all tables ... maybe later.


Hrvoje


[-- Attachment #2: acpica-unix-20030619.diff --]
[-- Type: text/x-diff, Size: 8297 bytes --]

diff -Nru acpica-unix-20030619/common/adisasm.c acpica-unix-20030619.ok/common/adisasm.c
--- acpica-unix-20030619/common/adisasm.c	2003-06-20 02:30:28.000000000 +0200
+++ acpica-unix-20030619.ok/common/adisasm.c	2003-07-01 12:06:02.000000000 +0200
@@ -123,6 +123,7 @@
 #include "acdispat.h"
 #include "acnamesp.h"
 #include "acapps.h"
+#include "actables.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -865,24 +866,74 @@
     ACPI_TABLE_HEADER       *NewTable;
     UINT32                  NumTables;
     UINT32                  PointerSize;
+    ACPI_POINTER            RsdpAddress;
 
+    ACPI_FUNCTION_TRACE ("AdGetLocalTables");
+    memset(&TableHeader,0,sizeof(ACPI_TABLE_HEADER));
 
-    if (GetAllTables)
+
+    /* Get the RSDP */
+
+    Status = AcpiOsGetRootPointer (ACPI_LOGICAL_ADDRESSING,
+                    &RsdpAddress);
+    if (ACPI_FAILURE (Status))
+    {
+        ACPI_REPORT_ERROR (("AcpiLoadTables: Could not get RSDP, %s\n",
+                        AcpiFormatException (Status)));
+        return_ACPI_STATUS (Status);
+    }
+
+    /* Map and validate the RSDP */
+
+    AcpiGbl_TableFlags = RsdpAddress.PointerType;
+    if(RsdpAddress.Pointer.Logical==NULL)
+    {
+        ACPI_STRNCPY (TableHeader.Signature, "RSDP", 4);
+       	Status = AcpiOsTableOverride (&TableHeader, &NewTable);
+	if (ACPI_FAILURE (Status) || NewTable == NULL)
+	{
+        	ACPI_REPORT_ERROR (("AcpiLoadTables: Could not load RSDP: %s\n",
+                        	AcpiFormatException (Status)));
+        	return_ACPI_STATUS (Status);
+	}
+	RsdpAddress.Pointer.Logical=NewTable;
+    }
+
+    Status = AcpiTbVerifyRsdp (&RsdpAddress);
+    if (ACPI_FAILURE (Status))
+    {
+        ACPI_REPORT_ERROR (("AcpiLoadTables: RSDP Failed validation: %s\n",
+                        AcpiFormatException (Status)));
+        return_ACPI_STATUS (Status);
+    }
+
+    /* Get the RSDT via the RSDP */
+
+    Status = AcpiTbGetTableRsdt ();
+    if (ACPI_FAILURE (Status))
     {
         ACPI_STRNCPY (TableHeader.Signature, "RSDT", 4);
-        AcpiOsTableOverride (&TableHeader, &NewTable);
+       	Status = AcpiOsTableOverride (&TableHeader, &NewTable);
+	if (ACPI_FAILURE (Status) || NewTable == NULL)
+	{
+        	ACPI_REPORT_ERROR (("AcpiLoadTables: Could not load RSDT: %s\n",
+                        	AcpiFormatException (Status)));
+        	return_ACPI_STATUS (Status);
+	}
+    }
 
-#if ACPI_MACHINE_WIDTH != 64
+    /* Now get the tables needed by this subsystem (FADT, DSDT, etc.) */
 
-        if (!ACPI_STRNCMP (NewTable->Signature, "RSDT", 4))
-        {
+    Status = AcpiTbGetRequiredTables ();
+    if (ACPI_FAILURE (Status))
+    {
+
+
+#if ACPI_MACHINE_WIDTH != 64
             PointerSize = sizeof (UINT32);
-        }
-        else
-#endif
-        {
+#else
             PointerSize = sizeof (UINT64);
-        }
+#endif
 
         /*
          * Determine the number of tables pointed to by the RSDT/XSDT.
@@ -890,14 +941,20 @@
          * pointers contained within the RSDT/XSDT.  The size of the pointers
          * is architecture-dependent.
          */
-        NumTables = (NewTable->Length - sizeof (ACPI_TABLE_HEADER)) / PointerSize;
-        AcpiOsPrintf ("There are %d tables defined in the %4.4s\n\n",
-            NumTables, NewTable->Signature);
+	if(NewTable)
+	{
+        	NumTables = (NewTable->Length - sizeof (ACPI_TABLE_HEADER)) / PointerSize;
+        	AcpiOsPrintf ("There are %d tables defined in the %4.4s\n\n",
+        	    NumTables, NewTable->Signature);
+	}
 
         /* Get the FADT */
 
         ACPI_STRNCPY (TableHeader.Signature, "FADT", 4);
-        AcpiOsTableOverride (&TableHeader, &NewTable);
+	Status = AcpiTbFindTable(TableHeader.Signature,"\0","\0",&TableHeader);
+	if (ACPI_FAILURE(Status))
+        	AcpiOsTableOverride (&TableHeader, &NewTable);
+
         if (NewTable)
         {
             AcpiGbl_FADT = (void *) NewTable;
@@ -917,23 +974,26 @@
                 "FACS", AcpiGbl_FADT->Header.OemTableId);
         }
         AcpiOsPrintf ("\n");
-    }
 
     /* Always get the DSDT */
 
     ACPI_STRNCPY (TableHeader.Signature, DSDT_SIG, 4);
-    AcpiOsTableOverride (&TableHeader, &NewTable);
-    if (NewTable)
+    Status = AcpiTbFindTable(TableHeader.Signature,"\0","\0",&TableHeader);
+    if(ACPI_FAILURE(Status))
     {
-        Status = AE_OK;
-        AcpiGbl_DSDT = NewTable;
-        AdWriteTable (AcpiGbl_DSDT, AcpiGbl_DSDT->Length,
-            "DSDT", AcpiGbl_DSDT->OemTableId);
-    }
-    else
-    {
-        fprintf (stderr, "Could not obtain DSDT\n");
-        Status = AE_NO_ACPI_TABLES;
+        AcpiOsTableOverride (&TableHeader, &NewTable);
+        if (NewTable)
+        {
+            Status = AE_OK;
+            AcpiGbl_DSDT = NewTable;
+            AdWriteTable (AcpiGbl_DSDT, AcpiGbl_DSDT->Length,
+                "DSDT", AcpiGbl_DSDT->OemTableId);
+        }
+        else
+        {
+            fprintf (stderr, "Could not obtain DSDT\n");
+            Status = AE_NO_ACPI_TABLES;
+        }
     }
 
     AcpiOsPrintf ("\n");
@@ -950,6 +1010,8 @@
         }
     }
 
+    }
+
 #ifdef _HPET
     AfGetHpet ();
 #endif
diff -Nru acpica-unix-20030619/compiler/aslstubs.c acpica-unix-20030619.ok/compiler/aslstubs.c
--- acpica-unix-20030619/compiler/aslstubs.c	2003-06-20 02:30:32.000000000 +0200
+++ acpica-unix-20030619.ok/compiler/aslstubs.c	2003-06-30 17:48:18.000000000 +0200
@@ -254,13 +254,3 @@
     return (AE_SUPPORT);
 }
 
-ACPI_STATUS
-AcpiTbFindTable (
-    char                    *Signature,
-    char                    *OemId,
-    char                    *OemTableId,
-    ACPI_TABLE_HEADER       **TablePtr)
-{
-    return (AE_SUPPORT);
-}
-
diff -Nru acpica-unix-20030619/compiler/Makefile acpica-unix-20030619.ok/compiler/Makefile
--- acpica-unix-20030619/compiler/Makefile	2003-06-20 02:30:32.000000000 +0200
+++ acpica-unix-20030619.ok/compiler/Makefile	2003-07-01 12:01:50.000000000 +0200
@@ -73,10 +73,15 @@
 	../disassembler/dmwalk.c \
 	../tables/tbinstal.c \
 	../tables/tbutils.c \
+	../tables/tbxfroot.c \
+	../tables/tbget.c \
+	../tables/tbrsdt.c \
+	../tables/tbconvrt.c \
+	../tables/tbgetall.c \
 	../osunixxf.c
 
 NOMAN=	YES
-CFLAGS+= -Wall -O2 -Wstrict-prototypes -D_LINUX -D_ACPI_ASL_COMPILER -I../include 
+CFLAGS+= -g -Wall -O2 -Wstrict-prototypes -D_LINUX -D_ACPI_ASL_COMPILER -I../include 
 
 #YACC=	yacc
 YACC=	bison
diff -Nru acpica-unix-20030619/osunixxf.c acpica-unix-20030619.ok/osunixxf.c
--- acpica-unix-20030619/osunixxf.c	2003-06-20 02:30:49.000000000 +0200
+++ acpica-unix-20030619.ok/osunixxf.c	2003-07-01 12:17:31.000000000 +0200
@@ -124,6 +124,12 @@
 #include <stdarg.h>
 #include <unistd.h>
 #include <sys/time.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+
 
 #include "acpi.h"
 #include "amlcode.h"
@@ -136,6 +142,7 @@
 
 extern FILE                    *AcpiGbl_DebugFile;
 FILE                           *AcpiGbl_OutputFile;
+int                            AcpiGbl_Memory=-1;
 
 
 /******************************************************************************
@@ -155,6 +162,10 @@
 {
     AcpiGbl_OutputFile = stdout;
 
+    AcpiGbl_Memory=open("/dev/mem", O_RDONLY);
+    if(AcpiGbl_Memory==-1)
+        return AE_NOT_FOUND;
+
     return AE_OK;
 }
 
@@ -185,6 +196,10 @@
     ACPI_POINTER           *Address)
 {
 
+    if(ACPI_FAILURE (AcpiFindRootPointer(Flags,Address)))
+    {
+	return (AE_NOT_FOUND);
+    }
     return (AE_OK);
 }
 
@@ -455,7 +470,27 @@
     UINT32                  length,
     void                    **there)
 {
-    *there = (void *) (UINT32) where;
+    ACPI_PHYSICAL_ADDRESS my_where;
+    int my_page=getpagesize();
+    UINT32 my_length;
+
+    if(AcpiGbl_Memory==-1)
+        return AE_NOT_FOUND;
+
+    /* find page boundary */
+    my_where=(where/my_page)*my_page;
+    my_length=((length/my_page)+3)*my_page;
+
+    *there = mmap(NULL, my_length, PROT_READ, MAP_PRIVATE,AcpiGbl_Memory, my_where);
+
+    if(*there == MAP_FAILED)
+    {
+        return AE_NOT_FOUND;
+    }
+   /* *there = (void *) (UINT32) where; */
+
+    if(my_where != where )
+      *there += (UINT32)(where-my_where);
 
     return AE_OK;
 }
@@ -481,6 +516,7 @@
     UINT32                  length)
 {
 
+    munmap(where,length);
     return;
 }
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Acpica-20030619 and "-g" option
       [not found] ` <F760B14C9561B941B89469F59BA3A847E9701F-sBd4vmA9Se4Lll3ZsUKC9FDQ4js95KgL@public.gmane.org>
@ 2003-07-15  7:50   ` Hrvoje Habjanic
  0 siblings, 0 replies; 3+ messages in thread
From: Hrvoje Habjanic @ 2003-07-15  7:50 UTC (permalink / raw)
  To: Grover, Andrew, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Monday 14 July 2003 01:57, Grover, Andrew wrote:
> Hi Hrvoje,
>
> Well that's what I get for replying to 2 week old email without reading
> everything first. Glad to see you took up the challenge.
>
> However, it should be possible to add this support without modifying any
> files *except* osunixxf.c. I don't mean to be too demanding but if you
> wouldn't mind considering that approach, I'd appreciate it.
>
> Thanks -- Regards -- Andy

I could try ... should i work on 20030619 or there is a newer version?

In what state is CVS version? Stable enough? Which branch to "export"?

H.



-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] Acpica-20030619 and "-g" option
@ 2003-07-13 23:57 Grover, Andrew
       [not found] ` <F760B14C9561B941B89469F59BA3A847E9701F-sBd4vmA9Se4Lll3ZsUKC9FDQ4js95KgL@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Grover, Andrew @ 2003-07-13 23:57 UTC (permalink / raw)
  To: Hrvoje Habjanic, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Hi Hrvoje,

Well that's what I get for replying to 2 week old email without reading
everything first. Glad to see you took up the challenge.

However, it should be possible to add this support without modifying any
files *except* osunixxf.c. I don't mean to be too demanding but if you
wouldn't mind considering that approach, I'd appreciate it.

Thanks -- Regards -- Andy

> -----Original Message-----
> From: Hrvoje Habjanic [mailto:hrvoje.habjanic-+VD6v/bdhRf0NTdHYsHBKg@public.gmane.org] 
> Sent: Tuesday, July 01, 2003 3:34 AM
> To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> Subject: [ACPI] [PATCH] Acpica-20030619 and "-g" option
> 
> 
> 
> Well, hello again ... ;-)
> 
> 
> After few hours of grep/vi/grep , i've finally made this to 
> work (that is, 
> ./iasl -g to dump DSDT tables).
> 
> Looking at it now, it seems very easy - mmap-ing memory was 
> the most trickier 
> part because of page aligement ....
> 
> Patch is attached ... it will work on x86 (32bit) - for 
> others - i'm not 
> shure.
> 
> And another thing. It currently dumps ONLY DSDT table, but, i 
> think it could 
> be nice to dump all tables ... maybe later.
> 
> 
> Hrvoje
> 
> 


-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-07-15  7:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-01 10:34 [PATCH] Acpica-20030619 and "-g" option Hrvoje Habjanic
2003-07-13 23:57 Grover, Andrew
     [not found] ` <F760B14C9561B941B89469F59BA3A847E9701F-sBd4vmA9Se4Lll3ZsUKC9FDQ4js95KgL@public.gmane.org>
2003-07-15  7:50   ` Hrvoje Habjanic

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.