00001
00048 #ifndef IxOsServicesMemMap_H
00049 #define IxOsServicesMemMap_H
00050
00051 #include <ixp425.h>
00052 #include <IxTypes.h>
00053 #include <IxOsServicesMemAccess.h>
00054
00060
00061
00062 #define IX_OSSERV_QMGR_MAP_SIZE (0x4000)
00063 #define IX_OSSERV_EXP_REG_MAP_SIZE (0x1000)
00064 #define IX_OSSERV_UART1_MAP_SIZE (0x1000)
00065 #define IX_OSSERV_UART2_MAP_SIZE (0x1000)
00066 #define IX_OSSERV_PMU_MAP_SIZE (0x1000)
00067 #define IX_OSSERV_OSTS_MAP_SIZE (0x1000)
00068 #define IX_OSSERV_NPEA_MAP_SIZE (0x1000)
00069 #define IX_OSSERV_NPEB_MAP_SIZE (0x1000)
00070 #define IX_OSSERV_NPEC_MAP_SIZE (0x1000)
00071 #define IX_OSSERV_ETHA_MAP_SIZE (0x1000)
00072 #define IX_OSSERV_ETHB_MAP_SIZE (0x1000)
00073 #define IX_OSSERV_USB_MAP_SIZE (0x1000)
00074 #define IX_OSSERV_GPIO_MAP_SIZE (0x1000)
00075 #define IX_OSSERV_EXP_BUS_MAP_SIZE (0x08000000)
00076 #define IX_OSSERV_EXP_BUS_CS1_MAP_SIZE (0x01000000)
00077 #define IX_OSSERV_EXP_BUS_CS4_MAP_SIZE (0x01000000)
00079
00080
00081 #ifdef IX_OSSERV_LINUX_BE
00082
00083 #define IX_OSSERV_GPIO_PHYS_BASE IXP425_GPIO_BASE_PHYS
00084 #define IX_OSSERV_UART1_PHYS_BASE IXP425_UART1_BASE_PHYS
00085 #define IX_OSSERV_UART2_PHYS_BASE IXP425_UART2_BASE_PHYS
00086 #define IX_OSSERV_ETHA_PHYS_BASE IXP425_EthA_BASE_PHYS
00087 #define IX_OSSERV_ETHB_PHYS_BASE IXP425_EthB_BASE_PHYS
00088 #define IX_OSSERV_NPEA_PHYS_BASE IXP425_NPEA_BASE_PHYS
00089 #define IX_OSSERV_NPEB_PHYS_BASE IXP425_NPEB_BASE_PHYS
00090 #define IX_OSSERV_NPEC_PHYS_BASE IXP425_NPEC_BASE_PHYS
00091 #define IX_OSSERV_PERIPHERAL_PHYS_BASE IXP425_PERIPHERAL_BASE_PHYS
00092 #define IX_OSSERV_QMGR_PHYS_BASE IXP425_QMGR_BASE_PHYS
00093 #define IX_OSSERV_OSTS_PHYS_BASE IXP425_TIMER_BASE_PHYS
00094 #define IX_OSSERV_USB_PHYS_BASE IXP425_USB_BASE_PHYS
00095 #define IX_OSSERV_EXP_BUS_PHYS_BASE IXP425_EXP_BUS_BASE2_PHYS
00096 #define IX_OSSERV_EXP_BUS_BOOT_PHYS_BASE IXP425_EXP_BUS_BASE1_PHYS
00097 #define IX_OSSERV_EXP_BUS_CS1_PHYS_BASE IXP425_EXP_BUS_CS1_BASE_PHYS
00098 #define IX_OSSERV_EXP_BUS_CS4_PHYS_BASE IXP425_EXP_BUS_CS4_BASE_PHYS
00099 #define IX_OSSERV_EXP_BUS_REGS_PHYS_BASE IXP425_EXP_CFG_BASE_PHYS
00100
00101 #elif defined (IX_OSSERV_VXWORKS_LE) || defined (IX_OSSERV_VXWORKS_BE)
00102
00103 #define IX_OSSERV_GPIO_PHYS_BASE IXP425_GPIO_BASE
00104 #define IX_OSSERV_UART1_PHYS_BASE IXP425_UART1_BASE
00105 #define IX_OSSERV_UART2_PHYS_BASE IXP425_UART2_BASE
00106 #define IX_OSSERV_ETHA_PHYS_BASE IXP425_EthA_BASE
00107 #define IX_OSSERV_ETHB_PHYS_BASE IXP425_EthB_BASE
00108 #define IX_OSSERV_NPEA_PHYS_BASE IXP425_NPEA_BASE
00109 #define IX_OSSERV_NPEB_PHYS_BASE IXP425_NPEB_BASE
00110 #define IX_OSSERV_NPEC_PHYS_BASE IXP425_NPEC_BASE
00111 #define IX_OSSERV_PERIPHERAL_PHYS_BASE IXP425_PERIPHERAL_BASE
00112 #define IX_OSSERV_QMGR_PHYS_BASE IXP425_QMGR_BASE
00113 #define IX_OSSERV_OSTS_PHYS_BASE IXP425_OSTS
00114 #define IX_OSSERV_USB_PHYS_BASE IXP425_USB_BASE
00115 #define IX_OSSERV_EXP_BUS_PHYS_BASE IXP425_EXPANSION_BUS_BASE2
00116 #define IX_OSSERV_EXP_BUS_BOOT_PHYS_BASE IXP425_EXPANSION_BUS_BASE1
00117 #define IX_OSSERV_EXP_BUS_CS1_PHYS_BASE IXP425_EXPANSION_BUS_CS1_BASE
00118 #define IX_OSSERV_EXP_BUS_CS4_PHYS_BASE IXP425_EXPANSION_BUS_CS4_BASE
00119 #define IX_OSSERV_EXP_BUS_REGS_PHYS_BASE IXP425_EXP_CONFIG_BASE
00120
00121 #else
00122
00123 #error This operating system is not supported - only VxWorks and Linux are supported.
00124
00125 #endif
00126
00127
00128
00129 typedef enum
00130 {
00131 IX_STATIC_MAP = 0,
00132 IX_DYNAMIC_MAP
00133 } IxOsServMapEntryType;
00134
00135 typedef enum
00136 {
00137 IX_BE_MAP = 0x1,
00138 IX_LE_AC_MAP = 0x2,
00139 IX_LE_DC_MAP = 0x4
00140 } IxOsServMapCoherencyType;
00141
00142
00143
00144 #if defined (CSR_BE_MAPPING)
00145
00146 #define IX_COMPONENT_COHERENCY (IX_BE_MAP)
00147
00148 #elif defined (CSR_LE_ADDRESS_COHERENT_MAPPING)
00149
00150 #define IX_COMPONENT_COHERENCY (IX_LE_AC_MAP)
00151
00152 #elif defined (CSR_LE_DATA_COHERENT_MAPPING)
00153
00154 #define IX_COMPONENT_COHERENCY (IX_LE_DC_MAP)
00155
00156 #else
00157
00158 #error This component does not define a usable coherency mode in \
00159 IxOsServicesComponents.h. Either define the coherency or do not \
00160 include this file.
00161
00162 #endif
00163
00164
00165 PUBLIC void *
00166 ixOsServMemMap(UINT32 physicalAddress, UINT32 size, UINT32 coherency);
00167
00168 PUBLIC void
00169 ixOsServMemUnmap(UINT32 virtualAddress, UINT32 coherency);
00170
00171 PUBLIC UINT32
00172 ixOsServMemVirtToPhys(UINT32 virtualAddress, UINT32 coherency);
00173
00209 #define IX_OSSERV_MEM_MAP(requestedPhysicalAddress, size) \
00210 ixOsServMemMap(requestedPhysicalAddress, size, IX_COMPONENT_COHERENCY)
00211
00231 #define IX_OSSERV_MEM_UNMAP(requestedVirtualAddress) \
00232 ixOsServMemUnmap(requestedVirtualAddress, IX_COMPONENT_COHERENCY)
00233
00247 #define IX_OSSERV_MMAP_VIRT_TO_PHYS_TRANSLATION(virtualAddress) \
00248 ixOsServMemVirtToPhys(virtualAddress, IX_COMPONENT_COHERENCY)
00249
00250 typedef struct _IxOsServMemoryMap
00251 {
00252
00253
00254
00255 IxOsServMapEntryType type;
00256
00257
00258
00259 UINT32 physicalAddress;
00260
00261
00262 UINT32 size;
00263
00264
00265
00266
00267 UINT32 virtualAddress;
00268
00269
00270
00271 void (*mapFunction)(struct _IxOsServMemoryMap *map);
00272
00273
00274
00275 void (*unmapFunction)(struct _IxOsServMemoryMap *map);
00276
00277
00278
00279
00280 UINT32 refCount;
00281
00282
00283
00284
00285
00286
00287
00288 IxOsServMapCoherencyType coherency;
00289
00290
00291 char *name;
00292 } IxOsServMemoryMap;
00293
00294 #if defined (__linux)
00295
00296
00297 #include <asm/io.h>
00298 #include <linux/ioport.h>
00299 void ixOsServLinuxMemMap(IxOsServMemoryMap *map);
00300 void ixOsServLinuxMemUnmap(IxOsServMemoryMap *map);
00301
00302
00303 PUBLIC void
00304 ixOsServLinuxMemMap(IxOsServMemoryMap *map);
00305
00306 PUBLIC void
00307 ixOsServLinuxMemUnmap(IxOsServMemoryMap *map);
00308
00309 #endif
00310
00311 #ifdef IxOsServicesMem_C
00312
00313 #if defined (__linux)
00314
00315
00316
00317
00318
00319
00320
00321 IxOsServMemoryMap ixOsServGlobalMemoryMap[] =
00322 {
00323
00324 {
00325 IX_STATIC_MAP,
00326 IXP425_QMGR_BASE_PHYS,
00327 IXP425_QMGR_REGION_SIZE,
00328 IXP425_QMGR_BASE_VIRT,
00329 NULL,
00330 NULL,
00331 0,
00332 IX_BE_MAP,
00333 "qMgr"
00334 },
00335
00336
00337 {
00338 IX_STATIC_MAP,
00339 IXP425_PERIPHERAL_BASE_PHYS,
00340 IXP425_PERIPHERAL_REGION_SIZE,
00341 IXP425_PERIPHERAL_BASE_VIRT,
00342 NULL,
00343 NULL,
00344 0,
00345 IX_BE_MAP,
00346 "peripherals"
00347 },
00348
00349
00350 {
00351 IX_STATIC_MAP,
00352 IXP425_EXP_CFG_BASE_PHYS,
00353 IXP425_EXP_CFG_REGION_SIZE,
00354 IXP425_EXP_CFG_BASE_VIRT,
00355 NULL,
00356 NULL,
00357 0,
00358 IX_BE_MAP,
00359 "Exp Cfg"
00360 },
00361
00362
00363 {
00364 IX_STATIC_MAP,
00365 IXP425_PCI_CFG_BASE_PHYS,
00366 IXP425_PCI_CFG_REGION_SIZE,
00367 IXP425_PCI_CFG_BASE_VIRT,
00368 NULL,
00369 NULL,
00370 0,
00371 IX_BE_MAP,
00372 "pciConfig"
00373 },
00374
00375
00376 {
00377 IX_DYNAMIC_MAP,
00378 IXP425_EXP_BUS_BASE_PHYS,
00379 IXP425_EXP_BUS_REGION_SIZE,
00380 0,
00381 ixOsServLinuxMemMap,
00382 ixOsServLinuxMemUnmap,
00383 0,
00384 IX_BE_MAP,
00385 "Exp Bus"
00386 }
00387 };
00388
00389 #elif defined (__vxworks)
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401 IxOsServMemoryMap ixOsServGlobalMemoryMap[] =
00402 {
00403
00404 {
00405 IX_STATIC_MAP,
00406 0x00000000,
00407 0xFFFFFFFF,
00408 0x00000000,
00409 NULL,
00410 NULL,
00411 0,
00412 IX_BE_MAP | IX_LE_AC_MAP,
00413 "global"
00414 },
00415
00416
00417 {
00418 IX_STATIC_MAP,
00419 IXP425_QMGR_BASE,
00420 IXP425_QMGR_SIZE,
00421 IXP425_QMGR_LE_DC_VIRT,
00422 NULL,
00423 NULL,
00424 0,
00425 IX_LE_DC_MAP,
00426 "qMgr LE_DC"
00427 },
00428
00429
00430 {
00431 IX_STATIC_MAP,
00432 IXP425_EXP_CONFIG_BASE,
00433 IXP425_EXP_CONFIG_SIZE,
00434 IXP425_EXP_CONFIG_LE_DC_VIRT,
00435 NULL,
00436 NULL,
00437 0,
00438 IX_LE_DC_MAP,
00439 "Exp Cfg LE_DC"
00440 },
00441
00442
00443 {
00444 IX_STATIC_MAP,
00445 IXP425_PERIPHERAL_BASE,
00446 IXP425_PERIPHERAL_SIZE,
00447 IXP425_PERIPHERAL_LE_DC_VIRT,
00448 NULL,
00449 NULL,
00450 0,
00451 IX_LE_DC_MAP,
00452 "peripherals LE_DC"
00453 }
00454 };
00455
00456 #else
00457
00458 #error This operating system is not supported - only VxWorks and Linux are supported.
00459
00460 #endif
00461
00462 #define IX_OSSERV_MEM_MAP_ELEMENTS (sizeof (ixOsServGlobalMemoryMap) / sizeof (IxOsServMemoryMap))
00463
00464 #endif
00465
00466 #endif