-BUILD_NUM = 1078
+BUILD_NUM = 1080
#include <common.h>
#include <modules.h>
+#define USE_EDI 0
+#define USE_UDI 1
+
// === PROTOTYPES ===
int Modules_LoadBuiltins();
int Module_LoadMem(void *Buffer, Uint Length, char *ArgString);
int Module_IsLoaded(char *Name);
// === IMPORTS ===
+#if USE_UDI
+extern int UDI_LoadDriver(void *Base);
+#endif
extern void StartupPrint(char *Str);
extern tModule gKernelModules[];
extern void gKernelModulesEnd;
}
#endif
+ #if USE_UDI
+ if( Binary_FindSymbol(base, "udi_init_info", NULL ) == 0 )
+ {
+ Binary_Relocate(base); // Relocate
+ return UDI_LoadDriver( base ); // And intialise
+ }
+ #endif
+
// Unknown module type?, return error
Binary_Unload(base);
#if USE_EDI
if(!sArg1) goto read2eol;
Module_LoadFile(sArg1, ""); //!\todo Use the rest of the line as the argument string
}
- // - Load Module
+ // - Load Module (UDI)
+ else if(strncmp("udimod ", fData+i, 6) == 0) {
+ //char *tmp;
+ i += 7;
+ i += System_Int_GetString(fData+i, &sArg1);
+ if(!sArg1) goto read2eol;
+ Module_LoadFile(sArg1, "");
+ }
+ // - Load Module (EDI)
else if(strncmp("edimod ", fData+i, 6) == 0) {
i += 7;
i += System_Int_GetString(fData+i, &sArg1);
FILESYSTEMS = fat
DRIVERS = ata_x86
-MODULES = FS_Ext2 FDD NE2000 BochsGA
+MODULES = UDI FS_Ext2 FDD NE2000 BochsGA
#DISTROOT = /mnt/AcessHDD/Acess2
#DISTROOT = ~/Projects/Acess2/Filesystem
--- /dev/null
+#
+#
+
+CPPFLAGS = -I./include
+OBJ = main.o
+NAME = UDI
+
+-include ../Makefile.tpl
--- /dev/null
+/*
+ * Acess2 UDI Support
+ * _udi/meta_gio.h
+ * - General IO Metalanguage
+ */
+#ifndef _UDI_META_GIO_H_
+#define _UDI_META_GIO_H_
+
+typedef struct {
+ udi_channel_event_ind_op_t *channel_event_ind_op ;
+ udi_gio_bind_ack_op_t *gio_bind_ack_op ;
+ udi_gio_unbind_ack_op_t *gio_unbind_ack_op ;
+ udi_gio_xfer_ack_op_t *gio_xfer_ack_op ;
+ udi_gio_xfer_nak_op_t *gio_xfer_nak_op ;
+ udi_gio_event_ind_op_t *gio_event_ind_op ;
+} udi_gio_client_ops_t;
+
+typedef struct {
+ udi_channel_event_ind_op_t *channel_event_ind_op ;
+ udi_gio_bind_req_op_t *gio_bind_req_op ;
+ udi_gio_unbind_req_op_t *gio_unbind_req_op ;
+ udi_gio_xfer_req_op_t *gio_xfer_req_op ;
+ udi_gio_event_res_op_t *gio_event_res_op ;
+} udi_gio_provider_ops_t ;
+
+#endif
--- /dev/null
+/*
+ * Acess2 UDI Support
+ * _udi/meta_mgmt.h
+ * - Mangement Metalanguage
+ */
+#ifndef _UDI_META_MGMT_H_
+#define _UDI_META_MGMT_H_
+
+typedef struct {
+ udi_cb_t gcb;
+} udi_mgmt_cb_t;
+
+
+typedef struct {
+ udi_cb_t gcb;
+ udi_trevent_t trace_mask;
+ udi_index_t meta_idx;
+} udi_usage_cb_t;
+
+
+typedef struct {
+ udi_cb_t gcb;
+ udi_ubit32_t child_ID;
+ void *child_data;
+ udi_instance_attr_list_t *attr_list;
+ udi_ubit8_t attr_valid_length;
+ const udi_filter_element_t *filter_list;
+ udi_ubit8_t filter_list_length;
+ udi_ubit8_t parent_ID;
+} udi_enumerate_cb_t;
+
+
+typedef void udi_usage_ind_op_t(udi_usage_cb_t *, udi_ubit8_t);
+typedef void udi_enumerate_req_op_t(udi_enumerate_cb_t *, udi_ubit8_t);
+typedef void udi_devmgmt_req_op_t(udi_mgmt_cb_t *, udi_ubit8_t);
+typedef void udi_final_cleanup_req_op_t(udi_mgmt_cb_t *);
+
+typedef const struct {
+ udi_usage_ind_op_t *usage_ind_op;
+ udi_enumerate_req_op_t *enumerate_req_op;
+ udi_devmgmt_req_op_t *devmgmt_req_op;
+ udi_final_cleanup_req_op_t *final_cleanup_req_op;
+} udi_mgmt_ops_t;
+
+#endif
--- /dev/null
+#ifndef _UDI_VALUES_H_
+#define _UDI_VALUES_H_
+
+typedef udi_ubit8_t udi_instance_attr_type_t;
+/* Instance Attribute Types */
+#define UDI_ATTR_NONE 0
+#define UDI_ATTR_STRING 1
+#define UDI_ATTR_ARRAY8 2
+#define UDI_ATTR_UBIT32 3
+#define UDI_ATTR_BOOLEAN 4
+#define UDI_ATTR_FILE 5
+
+#endif
--- /dev/null
+/*
+ * Acess2 UDI Support
+ * udi.h
+ */
+#ifndef _UDI_H_
+#define _UDI_H_
+
+#include <udi_arch.h>
+
+typedef void udi_op_t(void);
+
+typedef udi_op_t const *udi_ops_vector_t;
+
+typedef const udi_ubit8_t udi_layout_t;
+
+typedef udi_ubit32_t udi_trevent_t;
+
+#include <_udi/values.h>
+
+typedef struct {
+ udi_channel_t channel;
+ void *context;
+ void *scratch;
+ void *initiator_context;
+ udi_origin_t origin;
+} udi_cb_t;
+
+/**
+ * \name Attributes
+ * \{
+ */
+#define UDI_MAX_ATTR_NAMELEN 32
+#define UDI_MAX_ATTR_SIZE 64
+typedef struct {
+ char attr_name[UDI_MAX_ATTR_NAMELEN];
+ udi_ubit8_t attr_value[UDI_MAX_ATTR_SIZE];
+ udi_ubit8_t attr_length;
+ udi_instance_attr_type_t attr_type;
+} udi_instance_attr_list_t;
+
+typedef struct {
+ char attr_name[UDI_MAX_ATTR_NAMELEN];
+ udi_ubit8_t attr_min[UDI_MAX_ATTR_SIZE];
+ udi_ubit8_t attr_min_len;
+ udi_ubit8_t attr_max[UDI_MAX_ATTR_SIZE];
+ udi_ubit8_t attr_max_len;
+ udi_instance_attr_type_t attr_type;
+ udi_ubit32_t attr_stride;
+} udi_filter_element_t;
+/**
+ * \}
+ */
+
+
+
+#include <_udi/meta_mgmt.h>
+
+/**
+ */
+typedef const struct {
+ udi_index_t cb_idx;
+ udi_size_t scratch_requirement;
+} udi_gcb_init_t;
+
+/**
+ */
+typedef const struct {
+ udi_index_t ops_idx;
+ udi_index_t cb_idx;
+} udi_cb_select_t;
+
+/**
+ */
+typedef const struct {
+ udi_index_t cb_idx;
+ udi_index_t meta_idx;
+ udi_index_t meta_cb_num;
+ udi_size_t scratch_requirement;
+ udi_size_t inline_size;
+ udi_layout_t *inline_layout;
+} udi_cb_init_t;
+
+/**
+ * The \a udi_ops_init_t structure contains information the environment
+ * needs to subsequently create channel endpoints for a particular type of ops
+ * vector and control block usage. This structure is part of \a udi_init_info.
+ */
+typedef const struct {
+ udi_index_t ops_idx; //!< Non Zero driver assigned number
+ udi_index_t meta_idx; //!< Metalanguage Selector
+ udi_index_t meta_ops_num; //!< Metalanguage Operation
+ udi_size_t chan_context_size;
+ udi_ops_vector_t *ops_vector; //!< Array of function pointers
+ const udi_ubit8_t *op_flags;
+} udi_ops_init_t;
+
+/**
+ */
+typedef const struct {
+ udi_index_t region_idx;
+ udi_size_t rdata_size;
+} udi_secondary_init_t;
+
+
+/**
+ */
+typedef const struct {
+ udi_mgmt_ops_t *mgmt_ops;
+ const udi_ubit8_t *mgmt_op_flags;
+ udi_size_t mgmt_scratch_requirement;
+ udi_ubit8_t enumeration_attr_list_length;
+ udi_size_t rdata_size;
+ udi_size_t child_data_size;
+ udi_ubit8_t per_parent_paths;
+} udi_primary_init_t;
+
+/**
+ */
+typedef const struct {
+ udi_primary_init_t *primary_init_info;
+ udi_secondary_init_t *secondary_init_list; //!< Array
+ udi_ops_init_t *ops_init_list;
+ udi_cb_init_t *cb_init_list;
+ udi_gcb_init_t *gcb_init_list;
+ udi_cb_select_t *cb_select_list;
+} udi_init_t;
+
+
+//
+// == Regions ==
+//
+
+/**
+ * udi_limits_t reflects implementation-dependent system limits, such as
+ * memory allocation and timer resolution limits, for a particular region. These
+ * limits may vary from region to region, but will remain constant for the life of
+ * a region.
+ */
+typedef struct {
+ udi_size_t max_legal_alloc;
+ udi_size_t max_safe_alloc;
+ udi_size_t max_trace_log_formatted_len;
+ udi_size_t max_instance_attr_len;
+ udi_ubit32_t min_curtime_res;
+ udi_ubit32_t min_timer_res;
+} udi_limits_t;
+
+/**
+The \a udi_init_context_t structure is stored at the front of the region
+data area of each newly created region, providing initial data that a driver will
+need to begin executing in the region. A pointer to this structure (and therefore
+the region data area as a whole) is made available to the driver as the initial
+channel context for its first channel.
+ */
+typedef struct {
+ udi_index_t region_idx;
+ udi_limits_t limits;
+} udi_init_context_t;
+
+typedef struct {
+ void *rdata;
+} udi_chan_context_t;
+
+#endif
--- /dev/null
+/*
+ * Acess2 UDI Support
+ * - Architecture Dependent Definitions
+ */
+#ifndef _UDI_ARCH_H_
+#define _UDI_ARCH_H_
+
+//#if ARCH == x86
+typedef char udi_sbit8_t; /* signed 8-bit: -2^7..2^7-1 */
+typedef short udi_sbit16_t; /* signed 16-bit: -2^15..2^15-1 */
+typedef long udi_sbit32_t; /* signed 32-bit: -2^31..2^31-1 */
+typedef unsigned char udi_ubit8_t; /* unsigned 8-bit: 0..2^8-1 */
+typedef unsigned short udi_ubit16_t; /* unsigned 16-bit: 0..2^16-1 */
+typedef unsigned long udi_ubit32_t; /* unsigned 32-bit: 0..2^32-1 */
+typedef udi_ubit8_t udi_boolean_t; /* 0=False; 1..255=True */
+
+
+typedef unsigned int udi_size_t; /* buffer size (equiv to size_t) */
+typedef unsigned int udi_index_t; /* zero-based index type */
+
+typedef void* udi_channel_t; /* UDI_NULL_CHANNEL */
+typedef void* udi_buf_path_t; /* UDI_NULL_BUF_PATH */
+typedef void* udi_origin_t; /* UDI_NULL_ORIGIN */
+
+typedef void* udi_timestamp_t;
+//#endif
+
+#endif
--- /dev/null
+/*
+ * Acess2 UDI Layer
+ */
+#define DEBUG 0
+#define VERSION ((0<<8)|1)
+#include <common.h>
+#include <modules.h>
+#include <udi.h>
+
+// === PROTOTYPES ===
+ int UDI_Install(char **Arguments);
+ int UDI_LoadDriver(void *Base);
+
+// === GLOBALS ===
+MODULE_DEFINE(0, VERSION, UDI, UDI_Install, NULL, NULL);
+
+// === CODE ===
+/**
+ * \fn int UDI_Install(char **Arguments)
+ * \brief Stub intialisation routine
+ */
+int UDI_Install(char **Arguments)
+{
+ return 1;
+}
+
+/**
+ * \fn int UDI_LoadDriver(void *Base)
+ */
+int UDI_LoadDriver(void *Base)
+{
+ udi_init_t *info;
+ int i, j;
+ if( Binary_FindSymbol(Base, "udi_init_info", (Uint*)&info) == 0) {
+ Binary_Unload(Base);
+ return 0;
+ }
+
+ Log("primary_init_info = %p", info->primary_init_info);
+ Log("secondary_init_list = %p", info->secondary_init_list);
+ Log("ops_init_list = %p", info->ops_init_list);
+
+ for( i = 0; info->ops_init_list[i].ops_idx; i++ )
+ {
+ Log("info->ops_init_list[%i] = {", i);
+ Log(" .ops_idx = %i", info->ops_init_list[i].ops_idx);
+ Log(" .meta_idx = %i", info->ops_init_list[i].meta_idx);
+ Log(" .meta_ops_num = %i", info->ops_init_list[i].meta_ops_num);
+ Log(" .chan_context_size = %i", info->ops_init_list[i].chan_context_size);
+ Log(" .ops_vector = {");
+ for( j = 0; info->ops_init_list[i].ops_vector; j++ )
+ {
+ Log("%i: %p()", j, info->ops_init_list[i].ops_vector);
+ }
+ Log(" }");
+ Log(" .op_flags = %p", info->ops_init_list[i].op_flags);
+ Log("}");
+ }
+
+ return 0;
+}