00001 /*****************************************************************************/ 00007 /*****************************************************************************/ 00008 #ifndef _L4_SYS_VHW_H 00009 #define _L4_SYS_VHW_H 00010 00011 #include <l4/sys/types.h> 00012 #include <l4/sys/kernel.h> 00013 00024 enum l4_vhw_entry_type { 00025 L4_TYPE_VHW_NONE, 00026 L4_TYPE_VHW_FRAMEBUFFER, 00027 L4_TYPE_VHW_INPUT, 00028 L4_TYPE_VHW_NET, 00029 }; 00030 00035 struct l4_vhw_entry { 00036 enum l4_vhw_entry_type type; 00037 l4_uint32_t provider_pid; 00039 l4_addr_t mem_start; 00040 l4_addr_t mem_size; 00042 l4_uint32_t irq_no; 00043 l4_uint32_t fd; 00044 }; 00045 00050 struct l4_vhw_descriptor { 00051 l4_uint32_t magic; 00052 l4_uint8_t version; 00053 l4_uint8_t count; 00054 l4_uint8_t pad1; 00055 l4_uint8_t pad2; 00057 struct l4_vhw_entry descs[]; 00058 }; 00059 00060 enum { 00061 L4_VHW_MAGIC = 0x56687765, 00062 }; 00063 00064 static inline struct l4_vhw_descriptor * 00065 l4_vhw_get(l4_kernel_info_t *kip) 00066 { 00067 struct l4_vhw_descriptor *v 00068 = (struct l4_vhw_descriptor *)(((unsigned long)kip) + kip->vhw_offset); 00069 00070 if (v->magic == L4_VHW_MAGIC) 00071 return v; 00072 00073 return NULL; 00074 } 00075 00076 static inline struct l4_vhw_entry * 00077 l4_vhw_get_entry(struct l4_vhw_descriptor *v, int entry) 00078 { 00079 return v->descs + entry; 00080 } 00081 00082 static inline struct l4_vhw_entry * 00083 l4_vhw_get_entry_type(struct l4_vhw_descriptor *v, enum l4_vhw_entry_type t) 00084 { 00085 int i; 00086 struct l4_vhw_entry *e = v->descs; 00087 00088 for (i = 0; i < v->count; i++, e++) 00089 if (e->type == t) 00090 return e; 00091 00092 return NULL; 00093 } 00094 00095 #endif /* ! _L4_SYS_VHW_H */