aboutsummaryrefslogtreecommitdiff
path: root/payloads/libpayload/include/libpayload.h
diff options
context:
space:
mode:
authorJordan Crouse <jordan.crouse@amd.com>2008-05-07 20:34:02 +0000
committerJordan Crouse <jordan.crouse@amd.com>2008-05-07 20:34:02 +0000
commit681ec27e2c64763bba02ef816d41b6b366559f03 (patch)
treef943180f77f85b553e7e47791c06deaf44f184d3 /payloads/libpayload/include/libpayload.h
parent35993a231ecb4957d18719801cc4519b1df80d70 (diff)
libpayload: Add LAR walking support
Add suport for walking LARs. These try to emulate the f* functions from POSIX, though they are obviously different in their behavior. Signed-off-by: Jordan Crouse <jordan.crouse@amd.com> Acked-by: Myles Watson <mylesgw@gmail.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3288 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'payloads/libpayload/include/libpayload.h')
-rw-r--r--payloads/libpayload/include/libpayload.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h
index 5bafb305ef..be4d2a7ba3 100644
--- a/payloads/libpayload/include/libpayload.h
+++ b/payloads/libpayload/include/libpayload.h
@@ -36,6 +36,7 @@
#include <arch/io.h>
#include <sysinfo.h>
#include <stdarg.h>
+#include <lar.h>
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
@@ -207,6 +208,55 @@ struct timeval {
int gettimeofday(struct timeval *tv, void *tz);
+/* libc/lar.c */
+
+struct LAR {
+ void * start;
+ int cindex;
+ int count;
+ int alloc;
+ int eof;
+ void **headers;
+};
+
+struct larent {
+ u8 name[LAR_MAX_PATHLEN];
+};
+
+struct larstat {
+ u32 len;
+ u32 reallen;
+ u32 checksum;
+ u32 compchecksum;
+ u32 offset;
+ u32 compression;
+ u64 entry;
+ u64 loadaddress;
+};
+
+struct LFILE {
+ struct LAR *lar;
+ struct lar_header *header;
+ u32 size;
+ void *start;
+ u32 offset;
+};
+
+struct LAR *openlar(void *addr);
+int closelar(struct LAR *lar);
+struct larent *readlar(struct LAR *lar);
+void rewindlar(struct LAR *lar);
+int larstat(struct LAR *lar, const char *path, struct larstat *buf);
+struct LFILE * lfopen(struct LAR *lar, const char *filename);
+int lfread(void *ptr, size_t size, size_t nmemb, struct LFILE *stream);
+
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+
+int lfseek(struct LFILE *stream, long offset, int whence);
+int lfclose(struct LFILE *file);
+
/* i386/coreboot.c */
int get_coreboot_info(struct sysinfo_t *info);