/** * @brief Constructor */ IpmiSEL::IpmiSEL(void) :iv_msgQ(msg_q_create()) { IPMI_TRAC(ENTER_MRK "IpmiSEL ctor"); barrier_init(&iv_sync_start, 2); task_create(&IpmiSEL::start, this); barrier_wait(&iv_sync_start); }
errlHndl_t syncAllAttributesFromFsp() { TARG_INF( ENTER_MRK "syncAllAttributesFromFsp" ); errlHndl_t l_errl = NULL; do{ // If no SP Base Services then skip attribute sync if( !INITSERVICE::spBaseServicesEnabled() ) { TARG_INF( "SP Base Services not enabled, skipping attribute sync" ); break; } if (!SECUREBOOT::allowAttrOverrides()) { TARG_INF("syncAllAttributesFromFsp(): skipping since " "attribute overrides are not allowed and we don't " "trust the FSP"); break; } // create Hostboot message queue msg_q_t l_pHbMsgQ = msg_q_create(); // register Hostboot message queue with mailbox to receive messages l_errl = MBOX::msgq_register(MBOX::HB_ATTR_SYNC_MSGQ, l_pHbMsgQ); if (l_errl) { TARG_ERR( "Error registering the Hostboot message queue with " "mailbox service." ); break; } // these are the sections we want to sync SECTION_TYPE section_type[] ={SECTION_TYPE_PNOR_RW, SECTION_TYPE_HEAP_PNOR_INIT, SECTION_TYPE_HEAP_ZERO_INIT}; size_t section_count = sizeof(section_type)/sizeof(section_type[0]); TARG_DBG( "section count = %d", section_count ); // pull all attributes from FSP AttributeSync l_Sync; for(uint8_t i = 0; i < section_count; i++) { TARG_INF( "syncing section type = %d", section_type[i] ); l_errl = l_Sync.syncSectionFromFsp( section_type[i], l_pHbMsgQ ); if (l_errl) { break; } } // unregister the Hosboot message queue from the mailbox service. MBOX::msgq_unregister(MBOX::HB_ATTR_SYNC_MSGQ); } while (0); // Zero ATTR_RECONFIGURE_LOOP to avoid TI TARGETING::Target* l_pTopLevel = NULL; TARGETING::targetService().getTopLevelTarget(l_pTopLevel); l_pTopLevel->setAttr<TARGETING::ATTR_RECONFIGURE_LOOP>(0); TARG_INF( EXIT_MRK "syncAllAttributesFromFsp" ); return l_errl; }
/** * @brief Initialize the daemon */ void PnorRP::initDaemon() { TRACUCOMP(g_trac_pnor, "PnorRP::initDaemon> " ); errlHndl_t l_errhdl = NULL; do { // read the TOC in the PNOR to compute the sections l_errhdl = readTOC(); if( l_errhdl ) { break; } // create a message queue iv_msgQ = msg_q_create(); // create a Block, passing in the message queue int rc = mm_alloc_block( iv_msgQ, (void*) BASE_VADDR, TOTAL_SIZE ); if( rc ) { TRACFCOMP( g_trac_pnor, "PnorRP::initDaemon> Error from mm_alloc_block : rc=%d", rc ); /*@ * @errortype * @moduleid PNOR::MOD_PNORRP_INITDAEMON * @reasoncode PNOR::RC_EXTERNAL_ERROR * @userdata1 Requested Address * @userdata2 rc from mm_alloc_block * @devdesc PnorRP::initDaemon> Error from mm_alloc_block * @custdesc A problem occurred while accessing the boot flash. */ l_errhdl = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE, PNOR::MOD_PNORRP_INITDAEMON, PNOR::RC_EXTERNAL_ERROR, TO_UINT64(BASE_VADDR), TO_UINT64(rc), true /*Add HB SW Callout*/); l_errhdl->collectTrace(PNOR_COMP_NAME); break; } //Register this memory range to be FLUSHed during a shutdown. INITSERVICE::registerBlock(reinterpret_cast<void*>(BASE_VADDR), TOTAL_SIZE,PNOR_PRIORITY); // Need to set permissions to R/W rc = mm_set_permission((void*) BASE_VADDR,TOTAL_SIZE, WRITABLE | WRITE_TRACKED); // start task to wait on the queue task_create( wait_for_message, NULL ); } while(0); if( l_errhdl ) { iv_startupRC = l_errhdl->reasonCode(); errlCommit(l_errhdl,PNOR_COMP_ID); } // call ErrlManager function - tell him that PNOR is ready! ERRORLOG::ErrlManager::errlResourceReady(ERRORLOG::PNOR); TRACUCOMP(g_trac_pnor, "< PnorRP::initDaemon" ); }
errlHndl_t Service::start() { errlHndl_t err = NULL; bool cleanStartup = false; ATTN_SLOW("starting..."); mutex_lock(&iv_mutex); do { if(!iv_intrTaskQ) { // register msg q with interrupt // service for attention type interrupts msg_q_t q = msg_q_create(); err = configureInterrupts(q, UP); if(err) { msg_q_destroy(q); break; } iv_intrTaskQ = q; } if(!startIntrTask()) { break; } if(!startPrdTask()) { break; } cleanStartup = true; } while(0); tid_t prd = iv_prdTask, intr = iv_intrTask; mutex_unlock(&iv_mutex); if(!cleanStartup) { errlHndl_t err2 = stop(); if(err2) { errlCommit(err2, ATTN_COMP_ID); } } else { ATTN_SLOW("..startup complete, intr: %d, prd: %d", intr, prd); } return err; }