summaryrefslogtreecommitdiff
path: root/sys/include
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-09-06 16:48:27 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2013-09-06 16:48:27 +0200
commit9add5b765f713b78b77736214b17da9d90645a01 (patch)
treeb0b34ee3d5a38eeedb715835aec11106fc79fbd4 /sys/include
parent95fac5e87304a50f7e93de94f0f682ec06565006 (diff)
libaml: new io interface, add amlnew()/amltake()/amldrop(), late binding names, FindSetLeftBit/FindSetRightBit
new io interface was added. user defines amlmapio() and amlunmapio() functions that will fill out Amlio structure with function pointers to read/write routines for a particular region. amlnew() function added allowing the creation of aml objects like buffers or packages. these can be passed to amleval() with b, p or * format. amltake()/amldrop() exclude an aml object from garbage collection. on load, names are not always resolvable until the whole table is loaded. for this, we create n objects that are just name strings. after load, we recursively traverse the namespace and resolve them (see fixnames()). the FindSetLeftBit and FindSetRightBit opcodes got implemened.
Diffstat (limited to 'sys/include')
-rw-r--r--sys/include/aml.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/sys/include/aml.h b/sys/include/aml.h
index e1cd9c335..915e1e4e2 100644
--- a/sys/include/aml.h
+++ b/sys/include/aml.h
@@ -4,6 +4,7 @@
/*
* b uchar* buffer amllen() returns number of bytes
* s char* string amllen() is strlen()
+ * n char* undefined name amllen() is strlen()
* i uvlong* integer
* p void** package amllen() is # of elements
* r void* region
@@ -17,6 +18,8 @@ void* amlval(void *);
uvlong amlint(void *);
int amllen(void *);
+void* amlnew(char tag, int len);
+
void amlinit(void);
void amlexit(void);
@@ -25,6 +28,12 @@ void* amlwalk(void *dot, char *name);
int amleval(void *dot, char *fmt, ...);
void amlenum(void *dot, char *seg, int (*proc)(void *, void *), void *arg);
+/*
+ * exclude from garbage collection
+ */
+void amltake(void *);
+void amldrop(void *);
+
void* amlroot;
int amldebug;
@@ -34,3 +43,31 @@ int amldebug;
/* to be provided by operating system */
extern void* amlalloc(int);
extern void amlfree(void*);
+
+enum {
+ MemSpace = 0x00,
+ IoSpace = 0x01,
+ PcicfgSpace = 0x02,
+ EbctlSpace = 0x03,
+ SmbusSpace = 0x04,
+ CmosSpace = 0x05,
+ PcibarSpace = 0x06,
+ IpmiSpace = 0x07,
+};
+
+typedef struct Amlio Amlio;
+struct Amlio
+{
+ int space;
+ uvlong off;
+ uvlong len;
+ void *name;
+ uchar *va;
+
+ void *aux;
+ int (*read)(Amlio *io, void *data, int len, int off);
+ int (*write)(Amlio *io, void *data, int len, int off);
+};
+
+extern int amlmapio(Amlio *io);
+extern void amlunmapio(Amlio *io);