aboutsummaryrefslogtreecommitdiff
path: root/include/pool.h
diff options
context:
space:
mode:
authorAlistair Popple <alistair@popple.id.au>2014-10-20 11:42:54 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2014-10-22 18:00:10 +1100
commitcf6f4e8912d29fb89ce85c84834607065ad595a5 (patch)
tree4649ba458e1a9e1726135304ac135320b612d268 /include/pool.h
parentde6c2a5ad4baf0a45e72ba82d3ba87446e68768c (diff)
downloadskiboot-cf6f4e8912d29fb89ce85c84834607065ad595a5.zip
skiboot-cf6f4e8912d29fb89ce85c84834607065ad595a5.tar.gz
skiboot-cf6f4e8912d29fb89ce85c84834607065ad595a5.tar.bz2
fsp/elog: Create a logging frontend
In order to support fsp-less machines we need to be able to log errors using a BMC or some other mechanism. Currently the error logging code is tightly coupled to the platform making it difficult to add different platforms. This patch factors out the generic parts of the error logging code in preparation for adding different logging backends. It also adds a generic mechanism for pre-allocating a specific number of objects. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'include/pool.h')
-rw-r--r--include/pool.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/pool.h b/include/pool.h
new file mode 100644
index 0000000..89ef967
--- /dev/null
+++ b/include/pool.h
@@ -0,0 +1,21 @@
+#ifndef __POOL_H
+#define __POOL_H
+
+#include <ccan/list/list.h>
+#include <stddef.h>
+
+struct pool {
+ void *buf;
+ size_t obj_size;
+ struct list_head free_list;
+ int free_count;
+ int reserved;
+};
+
+enum pool_priority {POOL_NORMAL, POOL_HIGH};
+
+void* pool_get(struct pool *pool, enum pool_priority priority);
+void pool_free_object(struct pool *pool, void *obj);
+int pool_init(struct pool *pool, size_t obj_size, int count, int reserved);
+
+#endif /* __POOL_H */