summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authordgilbert <dgilbert@us.ibm.com>2011-07-28 16:42:28 -0500
committerDouglas R. Gilbert <dgilbert@us.ibm.com>2011-08-17 14:22:39 -0500
commitc56648379cde6ea3bcfac07923bb560734c6e16f (patch)
tree81ee3d5abaa130d0f1e36e038c3a344e11f55ce0 /src/include
parent20b03fdaeb7414fdf9d43634976ca1ab5fbac7f1 (diff)
downloadtalos-hostboot-c56648379cde6ea3bcfac07923bb560734c6e16f.tar.gz
talos-hostboot-c56648379cde6ea3bcfac07923bb560734c6e16f.zip
Virtual File System module load and unload
Change-Id: Iaa6a256a8a15ac48bfba5bc1cab292c5ac246166 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/253 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/arch/ppc.H7
-rw-r--r--src/include/sys/mm.h10
-rw-r--r--src/include/sys/vfs.h38
-rw-r--r--src/include/usr/hbotcompid.H10
-rw-r--r--src/include/usr/initservice/initsvcreasoncodes.H1
-rw-r--r--src/include/usr/vfs/vfs.H41
-rw-r--r--src/include/usr/vfs/vfs_reasoncodes.H22
-rw-r--r--src/include/util/align.H3
8 files changed, 127 insertions, 5 deletions
diff --git a/src/include/arch/ppc.H b/src/include/arch/ppc.H
index bed75b258..212f32d1f 100644
--- a/src/include/arch/ppc.H
+++ b/src/include/arch/ppc.H
@@ -210,6 +210,13 @@ inline void dcbf(void* _ptr)
}
ALWAYS_INLINE
+inline void dcbst(void* _ptr)
+{
+ register void* ptr = _ptr;
+ asm volatile("dcbst 0, %0" : : "b" (ptr) : "memory");
+}
+
+ALWAYS_INLINE
inline void dcbz(void* _ptr)
{
register void* ptr = _ptr;
diff --git a/src/include/sys/mm.h b/src/include/sys/mm.h
index 4719ff7df..71e41d24c 100644
--- a/src/include/sys/mm.h
+++ b/src/include/sys/mm.h
@@ -2,6 +2,7 @@
#define __SYS_MM_H
#include <stdint.h>
+#include <limits.h>
#include <sys/msg.h>
#ifdef __cplusplus
@@ -24,4 +25,13 @@ int mm_alloc_block(msg_q_t mq,void* va,uint64_t size);
}
#endif
+/** @fs mm_icache_invalidate()
+ * @brief Invalidate the ICACHE for the given memory
+ *
+ * @param[in] i_addr - Destination address
+ * @param[in] i_cpu_word_count - number of CPU_WORDs (uint64_t)
+ */
+void mm_icache_invalidate(void * i_addr, size_t i_cpu_word_count);
+
+
#endif
diff --git a/src/include/sys/vfs.h b/src/include/sys/vfs.h
index 5c28e29b8..27337f469 100644
--- a/src/include/sys/vfs.h
+++ b/src/include/sys/vfs.h
@@ -2,12 +2,20 @@
#define __SYS_VFS_H
#include <stdint.h>
+// NOTE!. This file is included by linker.C and can't include non standard header files
+#ifndef LINKER_C
+// other includes not visable to the linker
+#include <sys/task.h>
+#endif
// make TODO VFS_MODULE_MAX equal to the actual number of modules in the base image (+ 2?)
#define VFS_MODULE_MAX 64
// Extended use 4 4k pages
+// Extended Module Virtual address at 1GB
+#define VFS_EXTENDED_MODULE_VADDR (1 * 1024 * 1024 * 1024)
+#define VFS_EXTENDED_MODULE_TABLE_ADDRESS (VFS_EXTENDED_MODULE_VADDR)
+#define VFS_EXTENDED_MODULE_TABLE_OFFSET 0
#define VFS_EXTENDED_MODULE_MAX 128
-#define VFS_EXTENDED_MODULE_TABLE_ADDRESS 0x0000000040000000UL
#define VFS_MODULE_NAME_MAX 64
#define VFS_SYMBOL_INIT _init
#define VFS_SYMBOL_START _start
@@ -32,12 +40,15 @@ extern const char* VFS_ROOT;
extern const char* VFS_ROOT_BIN;
extern const char* VFS_ROOT_DATA;
extern const char* VFS_ROOT_MSG;
+extern const char* VFS_MSG;
enum VfsMessages
{
- VFS_MSG_REGISTER_MSGQ,
- VFS_MSG_RESOLVE_MSGQ,
- VFS_MSG_EXEC,
+ VFS_MSG_REGISTER_MSGQ, //!< Message to VFS_ROOT to register a message queue
+ VFS_MSG_RESOLVE_MSGQ, //!< Message to VFS_ROOT to find a message queue
+ VFS_MSG_EXEC, //!< Message to VFS_ROOT execute a module
+ VFS_MSG_LOAD, //!< Message to VFS_MSG to load a module
+ VFS_MSG_UNLOAD, //!< Message to VFS_MSG to unload a module
};
struct VfsSystemModule
@@ -52,10 +63,29 @@ struct VfsSystemModule
};
extern VfsSystemModule VFS_MODULES[VFS_MODULE_MAX];
+
extern uint64_t VFS_LAST_ADDRESS;
#ifdef __cplusplus
}
#endif
+#ifndef LINKER_C
+/**
+ * Find the VfsSystemModule data for the given module name
+ * @param[in] i_table VFS module table
+ * @param[in] i_name name of module to find
+ * @return VfsSystemModule ptr to data | NULL if not found
+ */
+VfsSystemModule * vfs_find_module(VfsSystemModule * i_table, const char * i_name);
+
+/**
+ * Call the module start routine
+ * @param[in] i_module VfsSystemModule data for the module
+ * @param[in] i_param parameter to pass to task_create() for this module
+ * @return tid_t of started task | -1 if i_module is NULL | -2 if there is no start()
+ */
+tid_t vfs_exec(VfsSystemModule * i_module, void* i_param);
+#endif
+
#endif
diff --git a/src/include/usr/hbotcompid.H b/src/include/usr/hbotcompid.H
index f39479148..fb75595e3 100644
--- a/src/include/usr/hbotcompid.H
+++ b/src/include/usr/hbotcompid.H
@@ -60,7 +60,7 @@ const char SCOM_COMP_NAME[] = "scom";
//@{
const compId_t XSCOM_COMP_ID = 0x0400;
const char XSCOM_COMP_NAME[] = "xscom";
-
+//@}
/** @name INITSERVICE
* Initialization Service component
*/
@@ -85,4 +85,12 @@ const compId_t I2C_COMP_ID = 0x0700;
const char I2C_COMP_NAME[] = "i2c";
//@}
+/** @name VFS
+ * Virtual File System component
+ */
+//@{
+const compId_t VFS_COMP_ID = 0x0800;
+const char VFS_COMP_NAME[] = "vfs";
+//@}
+
#endif
diff --git a/src/include/usr/initservice/initsvcreasoncodes.H b/src/include/usr/initservice/initsvcreasoncodes.H
index 83d1c9f28..9d5484e42 100644
--- a/src/include/usr/initservice/initsvcreasoncodes.H
+++ b/src/include/usr/initservice/initsvcreasoncodes.H
@@ -45,6 +45,7 @@ enum InitServiceModuleID
VERIFY_ERRL_IDEC_ERRL_ID,
DISABLE_WATCHDOG_ERRL_ID,
EXECUTE_ISTEPS_ERRL_ID,
+ START_VFS_ERRL_ID,
ISTEP_1_ERRL_ID,
ISTEP_2_ERRL_ID,
diff --git a/src/include/usr/vfs/vfs.H b/src/include/usr/vfs/vfs.H
new file mode 100644
index 000000000..bffbddaa0
--- /dev/null
+++ b/src/include/usr/vfs/vfs.H
@@ -0,0 +1,41 @@
+#ifndef __USR_VFS_H
+#define __USR_VFS_H
+
+#include <errl/errlentry.H>
+#include <sys/vfs.h>
+
+namespace VFS
+{
+ /**
+ * Load or unload a module from the extended image.
+ * @param[in] i_module Module name
+ * @param[in] i_msgtype [VFS_MSG_LOAD | VFS_MSG_UNLOAD]
+ * @return errlHandl_t on error
+ */
+ errlHndl_t module_load_unload(const char * i_module, VfsMessages i_msgtype);
+
+ /**
+ * Loads a module from the extended image and initializes it
+ * @param[in] i_module Module name
+ * @return errlHndl_t on error
+ */
+ ALWAYS_INLINE
+ inline errlHndl_t module_load(const char * i_module)
+ {
+ return VFS::module_load_unload(i_module,VFS_MSG_LOAD);
+ }
+
+ /**
+ * Destroys and unloads module.
+ * @param[in] i_module Module name
+ * @return errlHndl_t on error
+ */
+ ALWAYS_INLINE
+ inline errlHndl_t module_unload(const char * i_module)
+ {
+ return VFS::module_load_unload(i_module, VFS_MSG_UNLOAD);
+ }
+
+};
+
+#endif
diff --git a/src/include/usr/vfs/vfs_reasoncodes.H b/src/include/usr/vfs/vfs_reasoncodes.H
new file mode 100644
index 000000000..eed6c5ad5
--- /dev/null
+++ b/src/include/usr/vfs/vfs_reasoncodes.H
@@ -0,0 +1,22 @@
+#ifndef VFS_REASONCODES_H
+#define VFS_REASONCODES_H
+
+#include <hbotcompid.H>
+
+namespace VFS
+{
+ enum VfsModuleID
+ {
+ UNDEFINED_MODULE_ERRL_ID = 0,
+ VFS_MODULE_ID,
+ };
+
+ enum VfsReasonCode
+ {
+ VFS_LOAD_FAILED = VFS_COMP_ID | 0x01,
+ VFS_UNLOAD_FAILED = VFS_COMP_ID | 0x02,
+ VFS_ALLOC_VMEM_FAILED = VFS_COMP_ID | 0x03,
+ };
+};
+
+#endif
diff --git a/src/include/util/align.H b/src/include/util/align.H
index 3edbff09a..d95cdae0f 100644
--- a/src/include/util/align.H
+++ b/src/include/util/align.H
@@ -1,6 +1,9 @@
#ifndef __UTIL_ALIGN_H
#define __UTIL_ALIGN_H
+#include <limits.h>
+
#define ALIGN_4(u) ((u + 0x3ull) & ~0x3ull)
+#define ALIGN_PAGE(u) ((u + (PAGESIZE-1)) & ~(PAGESIZE-1))
#endif
OpenPOWER on IntegriCloud