//------------------------------------------------------------------------------ // Part callout ErrlUserDetailsCallout::ErrlUserDetailsCallout( const void *i_pTargetData, uint32_t i_targetDataLength, const HWAS::partTypeEnum i_partType, const HWAS::callOutPriority i_priority, const HWAS::DeconfigEnum i_deconfigState, const HWAS::GARD_ErrorType i_gardErrorType) { TRACDCOMP(g_trac_errl, "PartCallout entry"); // Set up ErrlUserDetails instance variables iv_CompId = ERRL_COMP_ID; iv_Version = 1; iv_SubSection = ERRL_UDT_CALLOUT; uint32_t pDataLength = sizeof(HWAS::callout_ud_t) + i_targetDataLength; HWAS::callout_ud_t *pData; pData = reinterpret_cast<HWAS::callout_ud_t *> (reallocUsrBuf(pDataLength)); pData->type = HWAS::PART_CALLOUT; pData->partType = i_partType; pData->priority = i_priority; pData->partDeconfigState = i_deconfigState; pData->partGardErrorType = i_gardErrorType; memcpy(pData + 1, i_pTargetData, i_targetDataLength); TRACDCOMP(g_trac_errl, "PartCallout exit; pDataLength %d", pDataLength); } // Part callout
//------------------------------------------------------------------------------ // Hardware callout ErrlUserDetailsCallout::ErrlUserDetailsCallout( const void *i_pTargetData, uint32_t i_targetDataLength, const HWAS::callOutPriority i_priority, const HWAS::DeconfigEnum i_deconfigState, const HWAS::GARD_ErrorType i_gardErrorType) { TRACDCOMP(g_trac_errl, "HWCallout entry"); // Set up ErrlUserDetails instance variables iv_CompId = ERRL_COMP_ID; iv_Version = 1; iv_SubSection = ERRL_UDT_CALLOUT; //iv_merge = false; // use the default of false uint32_t pDataLength = sizeof(HWAS::callout_ud_t) + i_targetDataLength; HWAS::callout_ud_t *pData; pData = reinterpret_cast<HWAS::callout_ud_t *> (reallocUsrBuf(pDataLength)); pData->type = HWAS::HW_CALLOUT; pData->priority = i_priority; #ifndef __HOSTBOOT_RUNTIME pData->cpuid = task_getcpuid(); #else pData->cpuid = (uint32_t)(-1); #endif pData->deconfigState = i_deconfigState; pData->gardErrorType = i_gardErrorType; memcpy(pData + 1, i_pTargetData, i_targetDataLength); TRACDCOMP(g_trac_errl, "HWCallout exit; pDataLength %d", pDataLength); } // Hardware callout
//------------------------------------------------------------------------------ // Bus callout ErrlUserDetailsCallout::ErrlUserDetailsCallout( const void *i_pTarget1Data, uint32_t i_target1DataLength, const void *i_pTarget2Data, uint32_t i_target2DataLength, const HWAS::busTypeEnum i_busType, const HWAS::callOutPriority i_priority) { TRACDCOMP(g_trac_errl, "BusCallout entry"); // Set up ErrlUserDetails instance variables iv_CompId = ERRL_COMP_ID; iv_Version = 1; iv_SubSection = ERRL_UDT_CALLOUT; uint32_t pDataLength = sizeof(HWAS::callout_ud_t) + i_target1DataLength + i_target2DataLength; HWAS::callout_ud_t *pData; pData = reinterpret_cast<HWAS::callout_ud_t *> (reallocUsrBuf(pDataLength)); pData->type = HWAS::BUS_CALLOUT; pData->busType = i_busType; pData->priority = i_priority; char * l_ptr = (char *)(++pData); memcpy(l_ptr, i_pTarget1Data, i_target1DataLength); memcpy(l_ptr + i_target1DataLength, i_pTarget2Data, i_target2DataLength); TRACDCOMP(g_trac_errl, "BusCallout exit; pDataLength %d", pDataLength); } // Bus callout
//------------------------------------------------------------------------------ // Operation //------------------------------------------------------------------------------ UdOperation::UdOperation( TARGETING::Target* i_target, uint64_t i_address, bool i_readNotWrite ) { // Set up Ud instance variables iv_CompId = FSI_COMP_ID; iv_Version = 1; iv_SubSection = FSI_UDT_OPERATION; //***** Memory Layout ***** // 4 bytes : Target HUID // 8 bytes : FSI Address // 1 byte : 1=read, 0=write char * l_pBuf = reinterpret_cast<char *>( reallocUsrBuf(sizeof(uint32_t) +sizeof(uint64_t) +sizeof(uint8_t) )); uint32_t tmp32 = TARGETING::get_huid(i_target); memcpy(l_pBuf, &tmp32, sizeof(tmp32)); l_pBuf += sizeof(tmp32); memcpy(l_pBuf, &i_address, sizeof(i_address)); l_pBuf += sizeof(i_address); uint8_t tmp8 = i_readNotWrite; memcpy(l_pBuf, &tmp8, sizeof(tmp8)); l_pBuf += sizeof(tmp8); }
//------------------------------------------------------------------------------ // PibInfo //------------------------------------------------------------------------------ UdPibInfo::UdPibInfo( uint8_t i_pibErr ) { // Set up Ud instance variables iv_CompId = SCOM_COMP_ID; iv_Version = 1; iv_SubSection = SCOM_UDT_PIB; iv_pib_err = i_pibErr; //***** Memory Layout ***** // 1 byte : PIB auto l_pBuf = reallocUsrBuf(sizeof(uint8_t)); memcpy(l_pBuf, &i_pibErr, sizeof(i_pibErr)); }
//------------------------------------------------------------------------------ // VPD //------------------------------------------------------------------------------ UdVpdParms::UdVpdParms( TARGETING::Target * i_target, uint64_t i_buflen, uint64_t i_record, uint64_t i_keyword, bool read_notWrite ) { // Set up Ud instance variables iv_CompId =VPD_COMP_ID; iv_Version = 1; iv_SubSection = VPD_UDT_PARAMETERS; //***** Memory Layout ***** // 1 byte : Read / Not-Write // 4 bytes : Target HUID // 8 bytes : Length of In/Out Buffer // 8 bytes : Record // 8 bytes : Keyword char * l_pBuf = reinterpret_cast<char *>( reallocUsrBuf(sizeof(uint8_t) +sizeof(uint32_t) +sizeof(uint64_t)*3)); uint32_t tmp64 = 0; uint16_t tmp32 = 0; uint8_t tmp8 = 0; tmp8 = read_notWrite; memcpy(l_pBuf, &tmp8, sizeof(tmp8)); l_pBuf += sizeof(tmp8); tmp32 = TARGETING::get_huid(i_target); memcpy(l_pBuf, &tmp32, sizeof(tmp32)); l_pBuf += sizeof(tmp32); tmp64 = i_buflen; memcpy(l_pBuf, &tmp64, sizeof(tmp64)); l_pBuf += sizeof(tmp64); tmp64 = i_record; memcpy(l_pBuf, &tmp64, sizeof(tmp64)); l_pBuf += sizeof(tmp64); tmp64 = i_keyword; memcpy(l_pBuf, &tmp64, sizeof(tmp64)); l_pBuf += sizeof(tmp64); }
void ErrlUserDetailsPrintk::_capturePrintk(size_t i_size) { // Determine existing size of printk buffer. size_t printkSize = strnlen(kernel_printk_buffer, Console::BUFFER_SIZE); i_size = std::min(i_size, printkSize); // Copy trailing i_size to UD buffer. uint8_t* buffer = reallocUsrBuf(i_size); memcpy(buffer, &kernel_printk_buffer[printkSize - i_size], i_size); // Set up ErrlUserDetails instance variables. iv_CompId = ERRL_COMP_ID; iv_Version = 1; iv_SubSection = ERRL_UDT_PRINTK; }
//------------------------------------------------------------------------------ // Sensor callout ErrlUserDetailsCallout::ErrlUserDetailsCallout(const uint32_t i_sensorID, const HWAS::sensorTypeEnum i_sensorType, const HWAS::callOutPriority i_priority) { TRACDCOMP(g_trac_errl, "Sensor Callout"); // Set up ErrlUserDetails instance variables iv_CompId = ERRL_COMP_ID; iv_Version = 1; iv_SubSection = ERRL_UDT_CALLOUT; HWAS::callout_ud_t *pData; pData = reinterpret_cast<HWAS::callout_ud_t *> (reallocUsrBuf(sizeof(HWAS::callout_ud_t))); pData->type = HWAS::SENSOR_CALLOUT; pData->priority = i_priority; pData->sensorId = i_sensorID; pData->sensorType = i_sensorType; TRACDCOMP(g_trac_errl, "Sensor Callout exit"); } // Sensor callout
//------------------------------------------------------------------------------ // Procedure callout ErrlUserDetailsCallout::ErrlUserDetailsCallout( const HWAS::epubProcedureID i_procedure, const HWAS::callOutPriority i_priority) { TRACDCOMP(g_trac_errl, "Procedure Callout"); // Set up ErrlUserDetails instance variables iv_CompId = ERRL_COMP_ID; iv_Version = 1; iv_SubSection = ERRL_UDT_CALLOUT; //iv_merge = false; // use the default of false HWAS::callout_ud_t *pData; pData = reinterpret_cast<HWAS::callout_ud_t *> (reallocUsrBuf(sizeof(HWAS::callout_ud_t))); pData->type = HWAS::PROCEDURE_CALLOUT; pData->procedure = i_procedure; pData->priority = i_priority; TRACDCOMP(g_trac_errl, "Procedure Callout exit"); } // Procedure callout
//------------------------------------------------------------------------------ // I2C User Details //------------------------------------------------------------------------------ UdI2CParms::UdI2CParms( uint8_t i_opType, TARGETING::Target * i_target, uint64_t i_buflen, int64_t i_accessType, misc_args_t i_args ) { // Set up Ud instance variables iv_CompId = I2C_COMP_ID; iv_Version = 1; iv_SubSection = I2C_UDT_PARAMETERS; //***** Memory Layout ***** // 1 byte : Op Type Description // 1 byte : Op Type (DeviceFW::OperationType) // 4 bytes : Target HUID // 8 bytes : Length of In/Out Buffer // 8 bytes : Access Type (DeviceFW::AccessType) // 1 byte : Port // 1 byte : Engine // 8 bytes : Device Address // 1 byte : Flag: skip_mode_setup; // 1 byte : Flag: with_stop; // 1 byte : Flag: read_not_write; // 8 bytes : Bus Speed (kbits/sec) // 2 bytes : Bit Rate Divisor // 8 bytes : Timeout Interval // 8 bytes : Timeout Count; char * l_pBuf = reinterpret_cast<char *>( reallocUsrBuf(sizeof(uint8_t)*2 +sizeof(uint32_t) +sizeof(uint64_t)*2 +sizeof(uint8_t)*2 +sizeof(uint64_t) +sizeof(uint8_t)*3 +sizeof(uint64_t) +sizeof(uint16_t) +sizeof(uint64_t)*2 ) ); uint64_t tmp64 = 0; uint32_t tmp32 = 0; uint16_t tmp16 = 0; uint8_t tmp8 = 0; if( i_opType == DeviceFW::READ ) { tmp8 = 0; } else if( i_opType == DeviceFW::WRITE ) { tmp8 = 1; } else { tmp8 = 2; } memcpy(l_pBuf, &tmp8, sizeof(tmp8)); l_pBuf += sizeof(tmp8); tmp8 = i_opType; memcpy(l_pBuf, &tmp8, sizeof(tmp8)); l_pBuf += sizeof(tmp8); tmp32 = TARGETING::get_huid(i_target); memcpy(l_pBuf, &tmp32, sizeof(tmp32)); l_pBuf += sizeof(tmp32); tmp64 = i_buflen; memcpy(l_pBuf, &tmp64, sizeof(tmp64)); l_pBuf += sizeof(tmp64); tmp64 = i_accessType; memcpy(l_pBuf, &tmp64, sizeof(tmp64)); l_pBuf += sizeof(tmp64); tmp8 = i_args.port; memcpy(l_pBuf, &tmp8, sizeof(tmp8)); l_pBuf += sizeof(tmp8); tmp8 = i_args.engine; memcpy(l_pBuf, &tmp8, sizeof(tmp8)); l_pBuf += sizeof(tmp8); tmp64 = i_args.devAddr; memcpy(l_pBuf, &tmp64, sizeof(tmp64)); l_pBuf += sizeof(tmp64); tmp8 = i_args.skip_mode_setup; memcpy(l_pBuf, &tmp8, sizeof(tmp8)); l_pBuf += sizeof(tmp8); tmp8 = i_args.with_stop; memcpy(l_pBuf, &tmp8, sizeof(tmp8)); l_pBuf += sizeof(tmp8); tmp8 = i_args.read_not_write; memcpy(l_pBuf, &tmp8, sizeof(tmp8)); l_pBuf += sizeof(tmp8); tmp64 = i_args.bus_speed; memcpy(l_pBuf, &tmp64, sizeof(tmp64)); l_pBuf += sizeof(tmp64); tmp16 = i_args.bit_rate_divisor; memcpy(l_pBuf, &tmp16, sizeof(tmp16)); l_pBuf += sizeof(tmp16); tmp64 = i_args.polling_interval_ns; memcpy(l_pBuf, &tmp64, sizeof(tmp64)); l_pBuf += sizeof(tmp64); tmp64 = i_args.timeout_count; memcpy(l_pBuf, &tmp64, sizeof(tmp64)); l_pBuf += sizeof(tmp64); }
//------------------------------------------------------------------------------ // EEPROM User Details //------------------------------------------------------------------------------ UdEepromParms::UdEepromParms( uint8_t i_opType, TARGETING::Target * i_target, uint64_t i_buflen, eeprom_addr_t i_i2cInfo ) { // Set up Ud instance variables iv_CompId = EEPROM_COMP_ID; iv_Version = 2; iv_SubSection = EEPROM_UDT_PARAMETERS; //***** Memory Layout ***** // 1 byte : Op Type Description // 1 byte : Op Type (DeviceFW::OperationType) // 4 bytes : Target HUID // 8 bytes : Length of In/Out Buffer // 8 bytes : Chip // 8 bytes : Offset // 8 bytes : Port // 8 bytes : Engine // 8 bytes : Device Address // 1 byte : Address Size // 8 bytes : Write Page Size // 8 bytes : Device Size (in KB) // 8 bytes : Chip Count // 8 bytes : Write Cycle Time char * l_pBuf = reinterpret_cast<char *>( reallocUsrBuf(sizeof(uint8_t)*2 +sizeof(uint32_t) +sizeof(uint64_t)*6 +sizeof(uint8_t) +sizeof(uint64_t)*4 )); uint64_t tmp64 = 0; uint32_t tmp32 = 0; uint8_t tmp8 = 0; if( i_opType == DeviceFW::READ ) { tmp8 = 0; } else if( i_opType == DeviceFW::WRITE ) { tmp8 = 1; } else { tmp8 = 2; } memcpy(l_pBuf, &tmp8, sizeof(tmp8)); l_pBuf += sizeof(tmp8); tmp8 = i_opType; memcpy(l_pBuf, &tmp8, sizeof(tmp8)); l_pBuf += sizeof(tmp8); tmp32 = TARGETING::get_huid(i_target); memcpy(l_pBuf, &tmp32, sizeof(tmp32)); l_pBuf += sizeof(tmp32); tmp64 = i_buflen; memcpy(l_pBuf, &tmp64, sizeof(tmp64)); l_pBuf += sizeof(tmp64); tmp64 = i_i2cInfo.chip; memcpy(l_pBuf, &tmp64, sizeof(tmp64)); l_pBuf += sizeof(tmp64); tmp64 = i_i2cInfo.offset; memcpy(l_pBuf, &tmp64, sizeof(tmp64)); l_pBuf += sizeof(tmp64); tmp64 = i_i2cInfo.port; memcpy(l_pBuf, &tmp64, sizeof(tmp64)); l_pBuf += sizeof(tmp64); tmp64 = i_i2cInfo.engine; memcpy(l_pBuf, &tmp64, sizeof(tmp64)); l_pBuf += sizeof(tmp64); tmp64 = i_i2cInfo.devAddr; memcpy(l_pBuf, &tmp64, sizeof(tmp64)); l_pBuf += sizeof(tmp64); tmp8 = static_cast<uint8_t>(i_i2cInfo.addrSize); memcpy(l_pBuf, &tmp8, sizeof(tmp8)); l_pBuf += sizeof(tmp8); tmp64 = i_i2cInfo.writePageSize; memcpy(l_pBuf, &tmp64, sizeof(tmp64)); l_pBuf += sizeof(tmp64); tmp64 = i_i2cInfo.devSize_KB; memcpy(l_pBuf, &tmp64, sizeof(tmp64)); l_pBuf += sizeof(tmp64); tmp64 = i_i2cInfo.chipCount; memcpy(l_pBuf, &tmp64, sizeof(tmp64)); l_pBuf += sizeof(tmp64); tmp64 = i_i2cInfo.writeCycleTime; memcpy(l_pBuf, &tmp64, sizeof(tmp64)); l_pBuf += sizeof(tmp64); }
//------------------------------------------------------------------------------ // Presence //------------------------------------------------------------------------------ UdPresence::UdPresence( TARGETING::Target* i_target ) { // Set up Ud instance variables iv_CompId = FSI_COMP_ID; iv_Version = 1; iv_SubSection = FSI_UDT_PRESENCE; FsiDD& fsidd = Singleton<FsiDD>::instance(); FsiDD::FsiChipInfo_t l_chip_info = fsidd.getFsiInfo(i_target); uint64_t l_slaveIndex = fsidd.getSlaveEnableIndex(l_chip_info.master, l_chip_info.type); //***** Memory Layout ***** // 4 bytes : Slave HUID // 4 bytes : Master HUID // 1 byte : FSI_MASTER_TYPE // 1 byte : port // 1 byte : cascade // 2 bytes : flags // 4 bytes : linkid (node+proc+type+port) // 2 bytes : Size of iv_slaves[] // 8 bytes : slave enable Index // X bytes : iv_slaves[] char * l_pBuf = reinterpret_cast<char *>( reallocUsrBuf(sizeof(uint32_t)*2 +sizeof(uint8_t)*3 +sizeof(uint16_t) +sizeof(uint32_t) +sizeof(uint16_t) +sizeof(uint64_t) +sizeof(fsidd.iv_slaves))); uint32_t tmp32 = 0; uint16_t tmp16 = 0; uint8_t tmp8 = 0; tmp32 = TARGETING::get_huid(l_chip_info.slave); memcpy(l_pBuf, &tmp32, sizeof(tmp32)); l_pBuf += sizeof(tmp32); tmp32 = TARGETING::get_huid(l_chip_info.master); memcpy(l_pBuf, &tmp32, sizeof(tmp32)); l_pBuf += sizeof(tmp32); tmp8 = l_chip_info.type; memcpy(l_pBuf, &tmp8, sizeof(tmp8)); l_pBuf += sizeof(tmp8); tmp8 = l_chip_info.port; memcpy(l_pBuf, &tmp8, sizeof(tmp8)); l_pBuf += sizeof(tmp8); tmp8 = l_chip_info.cascade; memcpy(l_pBuf, &tmp8, sizeof(tmp8)); l_pBuf += sizeof(tmp8); tmp16 = l_chip_info.flags; memcpy(l_pBuf, &tmp16, sizeof(tmp16)); l_pBuf += sizeof(tmp16); tmp32 = l_chip_info.linkid.id; memcpy(l_pBuf, &tmp32, sizeof(tmp32)); l_pBuf += sizeof(tmp32); tmp16 = sizeof(fsidd.iv_slaves); memcpy(l_pBuf, &tmp16, sizeof(tmp16)); l_pBuf += sizeof(tmp16); memcpy(l_pBuf, &l_slaveIndex, sizeof(l_slaveIndex)); l_pBuf += sizeof(l_slaveIndex); memcpy(l_pBuf, fsidd.iv_slaves, sizeof(fsidd.iv_slaves)); l_pBuf += sizeof(fsidd.iv_slaves); }