All of lore.kernel.org
 help / color / mirror / Atom feed
* 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; 6+ 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] 6+ messages in thread

* Re: [PATCH] Acpica-20030619 and "-g" option
       [not found] ` <F760B14C9561B941B89469F59BA3A847E9701F-sBd4vmA9Se4Lll3ZsUKC9FDQ4js95KgL@public.gmane.org>
@ 2003-07-15  7:50   ` Hrvoje Habjanic
  2003-07-20 17:17   ` [PATCH] acpica-20030714 and "-g" Hrvoje Habjanic
  1 sibling, 0 replies; 6+ 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] 6+ messages in thread

* [PATCH] acpica-20030714 and "-g"
       [not found] ` <F760B14C9561B941B89469F59BA3A847E9701F-sBd4vmA9Se4Lll3ZsUKC9FDQ4js95KgL@public.gmane.org>
  2003-07-15  7:50   ` Hrvoje Habjanic
@ 2003-07-20 17:17   ` Hrvoje Habjanic
       [not found]     ` <200307201917.44668.hrvoje.habjanic-+VD6v/bdhRf0NTdHYsHBKg@public.gmane.org>
  1 sibling, 1 reply; 6+ messages in thread
From: Hrvoje Habjanic @ 2003-07-20 17:17 UTC (permalink / raw)
  To: Grover, Andrew, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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


Hi all!

As you all noticed, "-g" isn't working in latest acpica release. I've managed 
to fix that.

BUT - it can be fixed in two ways:

1. (which i preffer) Using built-in acpi helper functions (tables/* directory)
 - advantages - hopefully, in this way you know what to expect when you 
"unleash" these functions/subs in real kernel on real machine
- disadvantages - everything stays complicated ;-)

2. to copy/paste all important things to osunixxf.c
 - advantages - all important parts in one place
 - disadvantages - code in osunixxf.c and tables/* CAN get out-of-sync, and 
maintaining is more complicated

So, i've decided to go with (1).

Changed files:
common/adisasm.c
compiler/aslstubs.c
compiler/Makefile
osunixxf.c

Changes in adisasm.c are from replacing AcpiOverrideTable*. 

(Andy, i know that it would be "nicer" to put everything in osunixxf.c, but 
use of AcpiOverrideTable is, among other things, causing circular calling. It 
becomes quite complicated to write "clean" code. I think that suggested 
modifications are minimal, and they make disassembler work more like some 
kernel based on this code.)

Still, there is room for improvements, so ....

And another note; currently SSDT tables ONLY get saved, and not disassembled. 
It would be nice to get them disassembled (maybe someone with more knowledge 
of this code/parsing ...)

Hrvoje

p.s. Sorry on bad english... >:-)

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

diff -Nru acpica-unix-20030714/common/adisasm.c acpica-unix-20030714.new/common/adisasm.c
--- acpica-unix-20030714/common/adisasm.c	2003-07-14 22:09:45.000000000 +0200
+++ acpica-unix-20030714.new/common/adisasm.c	2003-07-20 18:52:24.000000000 +0200
@@ -861,33 +861,15 @@
     BOOLEAN                 GetAllTables)
 {
     ACPI_STATUS             Status;
-    ACPI_TABLE_HEADER       TableHeader;
-    ACPI_TABLE_HEADER       *NewTable;
-    UINT32                  NumTables;
-    UINT32                  PointerSize;
+    ACPI_TABLE_DESC         Table;
+    ACPI_TABLE_HEADER       NewTable;
 
 
     if (GetAllTables)
     {
-        ACPI_STRNCPY (TableHeader.Signature, "RSDT", 4);
-        AcpiOsTableOverride (&TableHeader, &NewTable);
-        if (!NewTable)
-        {
-            fprintf (stderr, "Could not obtain RSDT\n");
-            return AE_NO_ACPI_TABLES;
-        }
-
-#if ACPI_MACHINE_WIDTH != 64
-
-        if (!ACPI_STRNCMP (NewTable->Signature, "RSDT", 4))
-        {
-            PointerSize = sizeof (UINT32);
-        }
-        else
-#endif
-        {
-            PointerSize = sizeof (UINT64);
-        }
+        Status = AcpiLoadTables();
+        if (ACPI_FAILURE (Status) != AE_SUPPORT)
+            return Status;
 
         /*
          * Determine the number of tables pointed to by the RSDT/XSDT.
@@ -895,43 +877,29 @@
          * 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);
+        AcpiOsPrintf ("There are %d tables defined in the RDST\n\n",AcpiGbl_RsdtTableCount);
 
         /* Get the FADT */
 
-        ACPI_STRNCPY (TableHeader.Signature, "FADT", 4);
-        AcpiOsTableOverride (&TableHeader, &NewTable);
-        if (NewTable)
+        if(AcpiGbl_FADT)
         {
-            AcpiGbl_FADT = (void *) NewTable;
-            AdWriteTable (NewTable, NewTable->Length,
-                "FADT", NewTable->OemTableId);
+            AdWriteTable (&(AcpiGbl_FADT->Header), AcpiGbl_FADT->Header.Length,
+                "FADT", AcpiGbl_FADT->Header.OemTableId);
         }
-        AcpiOsPrintf ("\n");
 
         /* Get the FACS */
 
-        ACPI_STRNCPY (TableHeader.Signature, "FACS", 4);
-        AcpiOsTableOverride (&TableHeader, &NewTable);
-        if (NewTable)
+        if(AcpiGbl_FACS)
         {
-            AcpiGbl_FACS = (void *) NewTable;
-            AdWriteTable (NewTable, AcpiGbl_FACS->Length,
+            AdWriteTable ((void *)AcpiGbl_FACS, AcpiGbl_FACS->Length,
                 "FACS", AcpiGbl_FADT->Header.OemTableId);
         }
-        AcpiOsPrintf ("\n");
     }
 
     /* Always get the DSDT */
 
-    ACPI_STRNCPY (TableHeader.Signature, DSDT_SIG, 4);
-    AcpiOsTableOverride (&TableHeader, &NewTable);
-    if (NewTable)
+    if(AcpiGbl_DSDT)
     {
-        Status = AE_OK;
-        AcpiGbl_DSDT = NewTable;
         AdWriteTable (AcpiGbl_DSDT, AcpiGbl_DSDT->Length,
             "DSDT", AcpiGbl_DSDT->OemTableId);
     }
@@ -945,16 +913,30 @@
 
     /* Get all SSDTs */
 
-    ACPI_STRNCPY (TableHeader.Signature, SSDT_SIG, 4);
-    Status = AcpiOsTableOverride (&TableHeader, &NewTable);
-    if (NewTable)
-    {
-        while (NewTable)
-        {
-            Status = AcpiOsTableOverride (&TableHeader, &NewTable);
+    Table.Pointer = &NewTable;
+    ACPI_STRNCPY (Table.Pointer->Signature, SSDT_SIG, 4);
+    Status = AcpiTbMatchSignature(Table.Pointer->Signature,&Table,ACPI_TABLE_PRIMARY);
+    if(!ACPI_FAILURE (Status))
+    {
+        ACPI_TABLE_LIST *ListHead;
+        ACPI_NATIVE_UINT i;
+        ACPI_TABLE_DESC *TableDesc;
+
+        ListHead = &AcpiGbl_TableLists[Table.Type];
+        if(ListHead->Count)
+        {
+            AcpiOsPrintf ("There are %d SSDT tables defined in the RDST\n\n",ListHead->Count);
+            TableDesc = ListHead->Next;
+            for(i=0; i < ListHead->Count ; i++)
+            {
+                AdWriteTable (TableDesc->Pointer, TableDesc->Length,
+                "SSDT", TableDesc->Pointer->OemTableId);
+                TableDesc = TableDesc->Next;
+            }
         }
     }
 
+
 #ifdef _HPET
     AfGetHpet ();
 #endif
diff -Nru acpica-unix-20030714/compiler/aslstubs.c acpica-unix-20030714.new/compiler/aslstubs.c
--- acpica-unix-20030714/compiler/aslstubs.c	2003-07-14 22:09:48.000000000 +0200
+++ acpica-unix-20030714.new/compiler/aslstubs.c	2003-07-20 18:28:33.000000000 +0200
@@ -255,11 +255,16 @@
 }
 
 ACPI_STATUS
-AcpiTbFindTable (
-    char                    *Signature,
-    char                    *OemId,
-    char                    *OemTableId,
-    ACPI_TABLE_HEADER       **TablePtr)
+AcpiNsLoadNamespace (
+    void)
+{
+    return (AE_SUPPORT);
+}
+
+ACPI_STATUS
+AcpiNsLoadTable (
+    ACPI_TABLE_DESC         *TableDesc,
+    ACPI_NAMESPACE_NODE     *Node)
 {
     return (AE_SUPPORT);
 }
diff -Nru acpica-unix-20030714/compiler/Makefile acpica-unix-20030714.new/compiler/Makefile
--- acpica-unix-20030714/compiler/Makefile	2003-07-14 22:09:48.000000000 +0200
+++ acpica-unix-20030714.new/compiler/Makefile	2003-07-20 18:28:33.000000000 +0200
@@ -73,7 +73,13 @@
 	../disassembler/dmwalk.c \
 	../tables/tbinstal.c \
 	../tables/tbutils.c \
-	../osunixxf.c
+	../osunixxf.c \
+	../tables/tbxfroot.c \
+	../tables/tbrsdt.c \
+	../tables/tbget.c \
+	../tables/tbconvrt.c \
+	../tables/tbxface.c \
+	../tables/tbgetall.c
 
 NOMAN=	YES
 CFLAGS+= -Wall -O2 -Wstrict-prototypes -D_LINUX -D_ACPI_ASL_COMPILER -I../include 
diff -Nru acpica-unix-20030714/osunixxf.c acpica-unix-20030714.new/osunixxf.c
--- acpica-unix-20030714/osunixxf.c	2003-07-14 22:10:02.000000000 +0200
+++ acpica-unix-20030714.new/osunixxf.c	2003-07-20 18:28:33.000000000 +0200
@@ -124,11 +124,16 @@
 #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 "acpi.h"
 #include "amlcode.h"
 #include "acparser.h"
 #include "acdebug.h"
+#include "actables.h"
 
 #define _COMPONENT          ACPI_OS_SERVICES
         ACPI_MODULE_NAME    ("osunixxf")
@@ -136,6 +141,7 @@
 
 extern FILE                    *AcpiGbl_DebugFile;
 FILE                           *AcpiGbl_OutputFile;
+int                            AcpiGbl_Memory=-1;
 
 
 /******************************************************************************
@@ -155,6 +161,10 @@
 {
     AcpiGbl_OutputFile = stdout;
 
+    AcpiGbl_Memory=open("/dev/mem", O_RDONLY);
+    if(AcpiGbl_Memory==-1)
+        return AE_NOT_FOUND;
+
     return AE_OK;
 }
 
@@ -162,6 +172,7 @@
 ACPI_STATUS
 AcpiOsTerminate (void)
 {
+    close(AcpiGbl_Memory);
     return AE_OK;
 }
 
@@ -184,7 +195,11 @@
     UINT32                  Flags,
     ACPI_POINTER           *Address)
 {
+    ACPI_STATUS Status;
 
+    Status = AcpiFindRootPointer( Flags, Address );
+    if(ACPI_FAILURE (Status))
+        return (AE_NOT_FOUND);
     return (AE_OK);
 }
 
@@ -243,9 +258,11 @@
         return (AE_BAD_PARAMETER);
     }
 
-    /* TODO: Add table-getting code here */
     *NewTable = NULL;
-    return (AE_NO_ACPI_TABLES);
+
+//    return (AE_NO_ACPI_TABLES);
+
+    return (AE_OK);
 }
 
 
@@ -456,7 +473,24 @@
     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;
+
+    if(my_where != where )
+      *there += (UINT32)(where-my_where);
 
     return AE_OK;
 }
@@ -481,7 +515,7 @@
     void                    *where,
     UINT32                  length)
 {
-
+    munmap(where,length);
     return;
 }
 

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

* Re: [PATCH] acpica-20030714 and "-g"
       [not found]     ` <200307201917.44668.hrvoje.habjanic-+VD6v/bdhRf0NTdHYsHBKg@public.gmane.org>
@ 2003-07-26 17:38       ` Sérgio Monteiro Basto
  2003-09-23  5:29       ` Sérgio Monteiro Basto
  1 sibling, 0 replies; 6+ messages in thread
From: Sérgio Monteiro Basto @ 2003-07-26 17:38 UTC (permalink / raw)
  To: Hrvoje Habjanic; +Cc: Andrew Grover, acpi-devel

Hi I test this patch and works pretty well, and option -g produced this
files :
SSDT_POWERNOW.dat
FADT_.dat
FACS_.dat
dsdt_EAGLES.dsl
DSDT_EAGLES.dat


On Sun, 2003-07-20 at 18:17, Hrvoje Habjanic wrote:
> 
> Hi all!
> 
> As you all noticed, "-g" isn't working in latest acpica release. I've managed 
> to fix that.
> 
> (Andy, i know that it would be "nicer" to put everything in osunixxf.c, but 
> use of AcpiOverrideTable is, among other things, causing circular calling. It 
> becomes quite complicated to write "clean" code. I think that suggested 
> modifications are minimal, and they make disassembler work more like some 
> kernel based on this code.)
> 
> Still, there is room for improvements, so ....
> 
> And another note; currently SSDT tables ONLY get saved, and not disassembled. 
> It would be nice to get them disassembled (maybe someone with more knowledge 
> of this code/parsing ...)

yes

> 
> Hrvoje
> 
> p.s. Sorry on bad english... >:-)
sorry on bad english too :)
> ----
> 


-- 
SérgioMB
email: sergiomb-hHo3WeeoaswVhHzd4jOs4w@public.gmane.org

Who gives me one shell, give me everything.



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01

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

* Re: [PATCH] acpica-20030714 and "-g"
       [not found]     ` <200307201917.44668.hrvoje.habjanic-+VD6v/bdhRf0NTdHYsHBKg@public.gmane.org>
  2003-07-26 17:38       ` Sérgio Monteiro Basto
@ 2003-09-23  5:29       ` Sérgio Monteiro Basto
  1 sibling, 0 replies; 6+ messages in thread
From: Sérgio Monteiro Basto @ 2003-09-23  5:29 UTC (permalink / raw)
  To: Hrvoje Habjanic; +Cc: Andrew Grover, acpi-devel

Hi Hrvoje 
Can you do the same patch for acpica-20030918 ?

at least read the RSDT ? :)

thanks 

On Sun, 2003-07-20 at 18:17, Hrvoje Habjanic wrote:
> 
> Hi all!
> 
> As you all noticed, "-g" isn't working in latest acpica release. I've managed 
> to fix that.
> 
> BUT - it can be fixed in two ways:
> 
> 1. (which i preffer) Using built-in acpi helper functions (tables/* directory)
>  - advantages - hopefully, in this way you know what to expect when you 
> "unleash" these functions/subs in real kernel on real machine
> - disadvantages - everything stays complicated ;-)
> 
> 2. to copy/paste all important things to osunixxf.c
>  - advantages - all important parts in one place
>  - disadvantages - code in osunixxf.c and tables/* CAN get out-of-sync, and 
> maintaining is more complicated
> 
> So, i've decided to go with (1).
> 
> Changed files:
> common/adisasm.c
> compiler/aslstubs.c
> compiler/Makefile
> osunixxf.c
> 
> Changes in adisasm.c are from replacing AcpiOverrideTable*. 
> 
> (Andy, i know that it would be "nicer" to put everything in osunixxf.c, but 
> use of AcpiOverrideTable is, among other things, causing circular calling. It 
> becomes quite complicated to write "clean" code. I think that suggested 
> modifications are minimal, and they make disassembler work more like some 
> kernel based on this code.)
> 
> Still, there is room for improvements, so ....
> 
> And another note; currently SSDT tables ONLY get saved, and not disassembled. 
> It would be nice to get them disassembled (maybe someone with more knowledge 
> of this code/parsing ...)
> 
> Hrvoje
> 
> p.s. Sorry on bad english... >:-)
> ----
> 


>  
-- 
SérgioMB
email: sergiomb-hHo3WeeoaswVhHzd4jOs4w@public.gmane.org

Who gives me one shell, give me everything.



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

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

* [PATCH] Acpica-20030619 and "-g" option
@ 2003-07-01 10:34 Hrvoje Habjanic
  0 siblings, 0 replies; 6+ 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] 6+ messages in thread

end of thread, other threads:[~2003-09-23  5:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-13 23:57 [PATCH] Acpica-20030619 and "-g" option Grover, Andrew
     [not found] ` <F760B14C9561B941B89469F59BA3A847E9701F-sBd4vmA9Se4Lll3ZsUKC9FDQ4js95KgL@public.gmane.org>
2003-07-15  7:50   ` Hrvoje Habjanic
2003-07-20 17:17   ` [PATCH] acpica-20030714 and "-g" Hrvoje Habjanic
     [not found]     ` <200307201917.44668.hrvoje.habjanic-+VD6v/bdhRf0NTdHYsHBKg@public.gmane.org>
2003-07-26 17:38       ` Sérgio Monteiro Basto
2003-09-23  5:29       ` Sérgio Monteiro Basto
  -- strict thread matches above, loose matches on Subject: below --
2003-07-01 10:34 [PATCH] Acpica-20030619 and "-g" option 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.