/** * mips_rio_init - Do MIPS RIO init * * Calls platform-specific RIO init code and then calls * rio_init_mports() to initialize any master ports that * have been registered with the RIO subsystem. */ static int __init mips_rio_init(void) { printk(KERN_INFO "RIO: RapidIO init\n"); /* Platform specific initialization */ platform_rio_init(); /* Enumerate all registered ports */ rio_init_mports(); return 0; }
/***************************************************************************** * c_entry: this is our main() function, called from boot_prot.S * * RETURNS: None */ __attribute__((regparm(0))) void c_entry (void) { xTaskHandle xHandle; UINT8 i=0,bFlag = 0; UINT16 port, baud = 0; NV_RW_Data nvdata; #ifdef INCLUDE_DEBUG_VGA char achBuffer[80]; #endif #if 0 /* Not used, HAL no longer present */ /* * Register the local service provider now, as code will be using BIT * services for PCI accesses. */ cctRegisterServiceProvider (cctServiceProvider); #endif /* * Key sub-system initialisation */ sysMmuInitialize (); /* Initialise the local page table management */ sysInitMalloc (K_HEAP, U_HEAP); /* Initialise the heap management */ #ifdef INCLUDE_EXCEPTION_DEBUG dbgInstallExceptionHandlers(); #endif #ifdef INCLUDE_DBGLOG dbgLogInit(); #endif /*Initialise the mutexes so that we can start using the public functions*/ for(i=0; i < MAX_CUTEBIT_MUTEX; i++) { globalMutexPool[i]=xSemaphoreCreateMutex(); if( globalMutexPool[i] == NULL ) { /*We should not get here, die...*/ while(1); } } /* * Search and parse BIOS_INFO and EXTENDED_INFO structures */ board_service(SERVICE__BRD_GET_BIOS_INFO, NULL, &dBiosInfo_addr); board_service(SERVICE__BRD_GET_EXTENDED_INFO, NULL, NULL); /* * Open/close the debug channel and sign-on - we can't use vDebugWrite() this * early, so make direct calls to sysDebug... */ if(bStartupDebugMode()) { sysDebugWriteString ("\n[Debugging Enabled]\n"); if(sysIsDebugopen()) { if(board_service(SERVICE__BRD_GET_FORCE_DEBUG_OFF, NULL, NULL) == E__OK) { sysDebugWriteString ("[Debugging Forced Off]\n"); sysDebugClose(); } } } else if( board_service(SERVICE__BRD_GET_FORCE_DEBUG_ON, NULL, NULL) == E__OK ) { sysDebugWriteString ("[Debugging Forced On]\n"); bForceStartupDebugMode(); sysDebugOpen(); } sysDebugFlush (); #ifdef INCLUDE_DEBUG_VGA vgaDisplayInit(); vgaSetCursor( CURSOR_OFF ); #endif sysDebugWriteString ("Starting HW Initialization\n"); board_service(SERVICE__BRD_HARDWARE_INIT, NULL, NULL); /* board-specific H/W initialisation */ if(board_service(SERVICE__BRD_GET_CONSOLE_PORT, NULL, &port) == E__OK) { baud = bGetBaudRate(); //baud = 0; //hard coded by Rajan. Need to remove after debug sysSccInit (port, baud); #ifdef INCLUDE_DEBUG_VGA sprintf( achBuffer, "Console open, port: 0x%x baud: %u\n", port, baud ); vgaPutsXY( 0, startLine++, achBuffer ); #endif } if(board_service(SERVICE__BRD_GET_DEBUG_PORT, NULL, &port) == E__OK) { //#ifdef commented by Rajan. Need to uncomment after debug //#ifdef INCLUDE_DEBUG_PORT_INIT baud = bGetBaudRate(); baud = 0; //hard coded by Rajan. Need to remove after debug sysSccInit (port, baud); //#endif #ifdef INCLUDE_DEBUG_VGA sprintf( achBuffer, "Debug %s, port: 0x%x baud: %u\n", (sysIsDebugopen()? "open":"closed"), port, baud ); vgaPutsXY( 0, startLine++, achBuffer ); #endif } #ifdef INCLUDE_MAIN_DEBUG { UINT32 temp = 0; board_service(SERVICE__BRD_GET_MAX_DRAM_BELOW_4GB, NULL, &temp); DBLOG( "Max DRAM below 4GB: 0x%08x\n", temp ); } #endif #if defined(MAKE_CUTE) || defined (MAKE_BIT_CUTE) #if defined(VPX) vpxPreInit(); #endif #if defined(CPCI) board_service(SERVICE__BRD_CHECK_CPCI_IS_SYSCON,NULL,&bFlag); cpciPreInit(bFlag); #endif board_service(SERVICE__BRD_CONFIGURE_VXS_NT_PORTS, NULL, NULL); #endif #if defined (SRIO) sysDebugWriteString ("Initializing: SRIO\n"); for (i = 1 ; i < MAX_TSI721_DEVS; i++) { srioPreInit (i); } #endif #ifndef CPCI if (!bFlag) vDelay(2000);// delay added, so pmc160 will show up! #endif sysDebugWriteString ("Initializing: PCI\n"); sysPciInitialize (); /* (re)scan PCI and allocate resources */ sysDebugWriteString ("Rajan--> Step1\n"); #if defined(MAKE_CUTE) || defined (MAKE_BIT_CUTE) #if defined (VME) && defined (INCLUDE_LWIP_SMC) // pci bus enumeration must have been run InitialiseVMEDevice(); #endif #endif sysDebugWriteString ("Rajan--> Step2\n"); #ifdef INCLUDE_DEBUG_VGA vgaPutsXY( 0, startLine, "FreeRTOS starting....\n\n" ); startLine += 2; #endif board_service(SERVICE__BRD_POST_SCAN_INIT, NULL, NULL); // post scan H/W initialisations board_service(SERVICE__BRD_ENABLE_SMIC_LPC_IOWINDOW, NULL, NULL); /* board-specific smic Initialization */ /* * Having got this far, clear the load error that we've been holding in CMOS */ nvdata.dNvToken = NV__TEST_NUMBER; nvdata.dData = 0; board_service(SERVICE__BRD_NV_WRITE, NULL, &nvdata); nvdata.dNvToken = NV__ERROR_CODE; nvdata.dData = E__BOARD_HANG; board_service(SERVICE__BRD_NV_WRITE, NULL, &nvdata); #ifdef INCLUDE_MAIN_DEBUG DBLOG( "CUTE/BIT Kernel heap: 0x%08x-0x%08x\n", (UINT32)K_HEAP, ((UINT32)K_HEAP + HEAP_SIZE - 1) ); DBLOG( "CUTE/BIT User heap : 0x%08x-0x%08x\n", (UINT32)U_HEAP, ((UINT32)U_HEAP + HEAP_SIZE - 1) ); xPortGetFreeHeapSize(); #endif /* Initialise task data */ vTaskDataInit( bCpuCount ); /* Initialise PCI shared interrupt handling */ pciIntInit(); #ifdef INCLUDE_MAIN_DEBUG pciListDevs( 0 ); #endif /* Create and start the network */ sysDebugWriteString ("Initializing: Network\n"); networkInit(); #if defined(SRIO) sysDebugWriteString ("Initializing: TSI721\n"); for (i = 1 ; i < MAX_TSI721_DEVS; i++) { tsi721_init(i); } rio_init_mports(); #endif // some boards may not reset the RTC cleanly board_service(SERVICE__BRD_INIT_RTC, NULL, NULL); #ifdef INCLUDE_DEMO_TASKS randMutex = xSemaphoreCreateMutex(); if (randMutex == NULL) { sysDebugWriteString ("Error - Failed to create rand mutex\n"); } else { for (i = 0; i < bCpuConfigured; i++) { tParam[i].taskNum = i + 1; sprintf( tParam[i].taskName, "Demo%u", tParam[i].taskNum ); xTaskCreate( i, vTaskCodePeriodic, tParam[i].taskName, mainDEMO_STACK_SIZE, &tParam[i], mainDEMO_TASK_PRIORITY, &xHandle ); } tParam[i].taskNum = i + 1; sprintf( tParam[i].taskName, "BKGRD" ); xTaskCreate( 0, vTaskCodeBackground, tParam[i].taskName, mainDEMO_STACK_SIZE, &tParam[i], mainDEMO_TASK_PRIORITY+1, &xHandle ); } #endif sysDebugWriteString ("Creating CUTE task\n"); xTaskCreate( 0, startCuteBit, "CuteBitTask", mainCUTEBIT_TASK_STACKSIZE, NULL, mainCUTEBIT_TASK_PRIORITY, &xHandle ); #ifdef INCLUDE_MAIN_DEBUG sysDebugWriteString ("\n[Starting FreeRtos Scheduler]\n"); sysDebugFlush (); #endif sysInvalidateTLB(); /* Start the FreeRTOS Scheduler, does not return */ vTaskStartScheduler(); } /* c_entry () */