00001
00010
00011
00012
00013
00014
00015 #ifndef __GENERIC_IO_INCLUDE_TYPES_H_
00016 #define __GENERIC_IO_INCLUDE_TYPES_H_
00017
00018
00019 #include <l4/sys/types.h>
00020 #include <l4/sys/compiler.h>
00021
00022
00048
00049 typedef struct l4io_drv
00050 {
00051 unsigned src:2;
00052 unsigned dsi:8;
00053 unsigned drv_class:8;
00054 unsigned padding:14;
00055 } l4io_drv_t;
00056
00057 #define L4IO_DRV_INVALID ((l4io_drv_t){0,0,0,0})
00059
00060
00064
00065 typedef struct l4io_res
00066 {
00067 unsigned long start;
00068 unsigned long end;
00069 unsigned long flags;
00070 } l4io_res_t;
00071
00072
00077
00078 typedef unsigned short l4io_pdev_t;
00079
00080
00085
00086 typedef struct l4io_pci_dev
00087 {
00088 unsigned char bus;
00089 unsigned char devfn;
00090 unsigned short vendor;
00091 unsigned short device;
00092 unsigned short sub_vendor;
00093 unsigned short sub_device;
00094 unsigned long dev_class;
00095
00096 unsigned long irq;
00097 #define L4IO_PCIDEV_RES 12
00098 l4io_res_t res[L4IO_PCIDEV_RES];
00099
00100
00101
00102 char name[80];
00103 char slot_name[8];
00104
00105 l4io_pdev_t handle;
00106 } l4io_pci_dev_t;
00107
00108
00110 enum
00111 {
00112 L4IO_RESOURCE_MEM, L4IO_RESOURCE_PORT, L4IO_RESOURCE_IRQ,
00113 L4IO_DEVICE_NAME_LEN = 32
00114 };
00115
00116
00118 typedef struct
00119 {
00120 unsigned long type;
00121 unsigned long start;
00122 unsigned long end;
00123 } l4io_desc_resource_t;
00124
00125
00127 typedef struct
00128 {
00129 unsigned char id[L4IO_DEVICE_NAME_LEN];
00130 unsigned char num_resources;
00131
00132 l4io_desc_resource_t resources[];
00133 } l4io_desc_device_t;
00134
00135
00136
00148
00149 struct l4io_info
00150 {
00151 union
00152 {
00153 struct
00154 {
00155 unsigned long magic;
00156 volatile unsigned long jiffies;
00157 unsigned long hz;
00158 volatile struct { long tv_sec, tv_usec; } xtime;
00159 unsigned long omega0;
00161 l4io_desc_device_t devices[];
00162 };
00163
00164 char padding[L4_PAGESIZE];
00165 };
00166 }__attribute__ ((aligned(L4_PAGESIZE)));
00167
00168 typedef struct l4io_info l4io_info_t;
00170 #define L4IO_INFO_MAGIC 0x496f6f49
00172 enum l4io_mem_flags
00173 {
00174
00175 L4IO_MEM_NONCACHED = 0,
00176 L4IO_MEM_CACHED = 1,
00177
00178
00179 L4IO_MEM_USE_MTRR = 2,
00180
00181
00182 L4IO_MEM_WRITE_COMBINED = L4IO_MEM_USE_MTRR | L4IO_MEM_CACHED,
00183 };
00184
00185
00187 L4_CV static inline l4io_desc_device_t * l4io_desc_first_device(l4io_info_t *info)
00188 {
00189 return info->devices->num_resources ? info->devices : 0;
00190 }
00191
00192
00194 L4_CV static inline l4io_desc_device_t * l4io_desc_next_device(l4io_desc_device_t *dev)
00195 {
00196 dev = (l4io_desc_device_t *) &dev->resources[dev->num_resources];
00197 return dev->num_resources ? dev : 0;
00198 }
00199
00200 #endif