diff options
-rwxr-xr-x | src/occ_405/homer.c | 84 | ||||
-rwxr-xr-x | src/occ_405/homer.h | 6 | ||||
-rwxr-xr-x | src/occ_405/main.c | 77 |
3 files changed, 55 insertions, 112 deletions
diff --git a/src/occ_405/homer.c b/src/occ_405/homer.c index 3107006..ef06fd0 100755 --- a/src/occ_405/homer.c +++ b/src/occ_405/homer.c @@ -66,7 +66,7 @@ homer_rc_t __attribute__((optimize("O1"))) homer_hd_map_read_unmap(const homer_r #endif homer_rc_t l_rc = HOMER_SUCCESS; - occHostConfigDataArea_t *l_hdcfg_data = (occHostConfigDataArea_t *) HOMER_BASE_ADDRESS; + occHostConfigDataArea_t *l_hdcfg_data = (occHostConfigDataArea_t *) HOMER_HD_ADDRESS; // Validate the pointers if (!o_host_data || !o_ssx_rc || ((uint32_t)o_host_data % 4)) @@ -100,73 +100,33 @@ homer_rc_t __attribute__((optimize("O1"))) homer_hd_map_read_unmap(const homer_r { // Check version, if ok handle ID requested. We need to support // current version as well as older ones - if ((HOMER_VERSION_MIN > l_hdcfg_data->version) - || - (HOMER_VERSION_MAX < l_hdcfg_data->version)) + if (HOMER_VERSION_P9 != l_hdcfg_data->version) { l_rc = HOMER_UNSUPPORTED_HD_VERSION; } else { - // Version guaranteed to be within supported range - - // HOMER Version 1 support - if (HOMER_VERSION_1 == l_hdcfg_data->version) - { - switch (i_id) - { - case HOMER_VERSION: - *(uint32_t *)o_host_data = l_hdcfg_data->version; - break; - case HOMER_NEST_FREQ: - *(uint32_t *)o_host_data = l_hdcfg_data->nestFrequency; - break; - default: - l_rc = HOMER_UNKNOWN_ID; - break; - } - } - else if (HOMER_VERSION_2 == l_hdcfg_data->version) - { - switch (i_id) - { - case HOMER_VERSION: - *(uint32_t *)o_host_data = l_hdcfg_data->version; - break; - case HOMER_NEST_FREQ: - *(uint32_t *)o_host_data = l_hdcfg_data->nestFrequency; - break; - case HOMER_INT_TYPE: - *(uint32_t *)o_host_data = l_hdcfg_data->occInterruptType; - break; - default: - l_rc = HOMER_UNKNOWN_ID; - break; - } - } - else if (HOMER_VERSION_3 == l_hdcfg_data->version) + // HOMER_VERSION_P9 == l_hdcfg_data->version + switch (i_id) { - switch (i_id) - { - case HOMER_VERSION: - *(uint32_t *)o_host_data = l_hdcfg_data->version; - break; - case HOMER_NEST_FREQ: - *(uint32_t *)o_host_data = l_hdcfg_data->nestFrequency; - break; - case HOMER_INT_TYPE: - *(uint32_t *)o_host_data = l_hdcfg_data->occInterruptType; - break; - case HOMER_FIR_MASTER: - *(uint32_t *)o_host_data = l_hdcfg_data->firMaster; - break; - case HOMER_FIR_PARMS: - memcpy(o_host_data, &(l_hdcfg_data->firParms[0]), HOMER_FIR_PARM_SIZE); - break; - default: - l_rc = HOMER_UNKNOWN_ID; - break; - } + case HOMER_VERSION: + *(uint32_t *)o_host_data = l_hdcfg_data->version; + break; + case HOMER_NEST_FREQ: + *(uint32_t *)o_host_data = l_hdcfg_data->nestFrequency; + break; + case HOMER_INT_TYPE: + *(uint32_t *)o_host_data = l_hdcfg_data->occInterruptType; + break; + case HOMER_FIR_MASTER: + *(uint32_t *)o_host_data = l_hdcfg_data->firMaster; + break; + case HOMER_FIR_PARMS: + memcpy(o_host_data, &(l_hdcfg_data->firParms[0]), HOMER_FIR_PARM_SIZE); + break; + default: + l_rc = HOMER_UNKNOWN_ID; + break; } } #if PPC405_MMU_SUPPORT diff --git a/src/occ_405/homer.h b/src/occ_405/homer.h index 15ecede..e205878 100755 --- a/src/occ_405/homer.h +++ b/src/occ_405/homer.h @@ -54,11 +54,7 @@ // Version(s) of HOMER host data currently supported typedef enum homer_version { - HOMER_VERSION_MIN = 1, - HOMER_VERSION_1 = 1, - HOMER_VERSION_2 = 2, - HOMER_VERSION_3 = 3, - HOMER_VERSION_MAX = 3, + HOMER_VERSION_P9 = 0x90, } homer_version_t; // ID of host data variables diff --git a/src/occ_405/main.c b/src/occ_405/main.c index b73c7cc..75c4476 100755 --- a/src/occ_405/main.c +++ b/src/occ_405/main.c @@ -1087,18 +1087,9 @@ int main(int argc, char **argv) // Get the homer version uint32_t l_homer_version = 0; - //l_homerrc = homer_hd_map_read_unmap(HOMER_VERSION, - // &l_homer_version, - // &l_ssxrc); - - //if ((HOMER_SUCCESS != l_homerrc) && (HOMER_SSX_UNMAP_ERR != l_homerrc)) - { - // Attempt to use max version if we can't read the homer. - //l_homer_version = HOMER_VERSION_MAX; - - // For Simics, assume Homer version 2 (no FIR support) - l_homer_version = HOMER_VERSION_2; - } + l_homerrc = homer_hd_map_read_unmap(HOMER_VERSION, + &l_homer_version, + &l_ssxrc); // Get proc_pb_frequency from HOMER host data and calculate the timebase // frequency for the OCC. Pass the timebase frequency to ssx_initialize. @@ -1107,19 +1098,18 @@ int main(int argc, char **argv) // HOMER, ie. if the MRW says that proc_pb_frequency is 2400 MHz, then // pass 600000000 (600MHz) - // The offset from the start of the HOMER is 0x00100000, we will need to + // The offset from the start of the HOMER is 0x000C0000, we will need to // create a temporary mapping to this section of the HOMER with ppc405_mmu_map - // (at address 0x00000000) read the value, convert it, and then unmap. + // (at address 0x800C0000) read the value, convert it, and then unmap. // Don't do a version check before reading the nest freq, it's present in // all HOMER versions. uint32_t l_tb_freq_hz = 0; - //l_homerrc2 = homer_hd_map_read_unmap(HOMER_NEST_FREQ, - // &l_tb_freq_hz, - // &l_ssxrc2); + l_homerrc2 = homer_hd_map_read_unmap(HOMER_NEST_FREQ, + &l_tb_freq_hz, + &l_ssxrc2); - //if ((HOMER_SUCCESS == l_homerrc2) || (HOMER_SSX_UNMAP_ERR == l_homerrc2)) - if(0) + if ((HOMER_SUCCESS == l_homerrc2) || (HOMER_SSX_UNMAP_ERR == l_homerrc2)) { // Data is in Mhz upon return and needs to be converted to Hz and then // quartered. @@ -1176,35 +1166,32 @@ int main(int argc, char **argv) // nest frequency which was required above to enable SSX and tracing). CHECKPOINT(HOMER_ACCESS_INITS); - if (l_homer_version >= HOMER_VERSION_2) + // Get OCC interrupt type from HOMER host data area. This will tell OCC + // which interrupt to Host it should be using. + uint32_t l_occ_int_type = 0; + l_homerrc = homer_hd_map_read_unmap(HOMER_INT_TYPE, + &l_occ_int_type, + &l_ssxrc); + + if ((HOMER_SUCCESS == l_homerrc) || (HOMER_SSX_UNMAP_ERR == l_homerrc)) { - // Get OCC interrupt type from HOMER host data area. This will tell OCC - // which interrupt to Host it should be using. - uint32_t l_occ_int_type = 0; - //l_homerrc = homer_hd_map_read_unmap(HOMER_INT_TYPE, - // &l_occ_int_type, - // &l_ssxrc); - - //if ((HOMER_SUCCESS == l_homerrc) || (HOMER_SSX_UNMAP_ERR == l_homerrc)) - if(0) - { - G_occ_interrupt_type = (uint8_t) l_occ_int_type; - } - else - { - // For Simics we are assuming the FSP communication path as the default - G_occ_interrupt_type = FSP_SUPPORTED_OCC; - //G_occ_interrupt_type = PSIHB_INTERRUPT; - } + G_occ_interrupt_type = (uint8_t) l_occ_int_type; + } + else + { + // if HOMER host data read fails, assume the FSP communication + // path as the default + G_occ_interrupt_type = FSP_SUPPORTED_OCC; + //G_occ_interrupt_type = PSIHB_INTERRUPT; + } - MAIN_TRAC_INFO("HOMER accessed, rc=%d, host interrupt type=%d, ssx_rc=%d", - l_homerrc, l_occ_int_type, l_ssxrc); + MAIN_TRAC_INFO("HOMER accessed, rc=%d, host interrupt type=%d, ssx_rc=%d", + l_homerrc, l_occ_int_type, l_ssxrc); - // Handle any errors from the interrupt type access - homer_log_access_error(l_homerrc, - l_ssxrc, - l_occ_int_type); - } + // Handle any errors from the interrupt type access + homer_log_access_error(l_homerrc, + l_ssxrc, + l_occ_int_type); /* //TEMP -- NO FIR SUPPORT if (l_homer_version >= HOMER_VERSION_3) |