armadaxp.c (a49d8b6ecc0323b5ee7cf68348e49cc59b40296c) | armadaxp.c (33495e5daf2760bcf739eb642d83c09706e64adc) |
---|---|
1/*- 2 * Copyright (c) 2011 Semihalf. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 136 unchanged lines hidden (view full) --- 145 uint8_t sar_cpu_freq, sar_fab_freq, array_size; 146 147 /* Get value of the SAR register and process it */ 148 sar_reg = get_sar_value(); 149 sar_cpu_freq = CPU_FREQ_FIELD(sar_reg); 150 sar_fab_freq = FAB_FREQ_FIELD(sar_reg); 151 152 /* Check if CPU frequency field has correct value */ | 1/*- 2 * Copyright (c) 2011 Semihalf. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 136 unchanged lines hidden (view full) --- 145 uint8_t sar_cpu_freq, sar_fab_freq, array_size; 146 147 /* Get value of the SAR register and process it */ 148 sar_reg = get_sar_value(); 149 sar_cpu_freq = CPU_FREQ_FIELD(sar_reg); 150 sar_fab_freq = FAB_FREQ_FIELD(sar_reg); 151 152 /* Check if CPU frequency field has correct value */ |
153 array_size = sizeof(cpu_clock_table) / sizeof(cpu_clock_table[0]); | 153 array_size = nitems(cpu_clock_table); |
154 if (sar_cpu_freq >= array_size) 155 panic("Reserved value in cpu frequency configuration field: " 156 "%d", sar_cpu_freq); 157 158 /* Check if fabric frequency field has correct value */ | 154 if (sar_cpu_freq >= array_size) 155 panic("Reserved value in cpu frequency configuration field: " 156 "%d", sar_cpu_freq); 157 158 /* Check if fabric frequency field has correct value */ |
159 array_size = sizeof(freq_conf_table) / sizeof(freq_conf_table[0]); | 159 array_size = nitems(freq_conf_table); |
160 if (sar_fab_freq >= array_size) 161 panic("Reserved value in fabric frequency configuration field: " 162 "%d", sar_fab_freq); 163 164 /* Get CPU clock frequency */ 165 freq_vco = cpu_clock_table[sar_cpu_freq] * 166 freq_conf_table[sar_fab_freq].vco_cpu; 167 --- 133 unchanged lines hidden --- | 160 if (sar_fab_freq >= array_size) 161 panic("Reserved value in fabric frequency configuration field: " 162 "%d", sar_fab_freq); 163 164 /* Get CPU clock frequency */ 165 freq_vco = cpu_clock_table[sar_cpu_freq] * 166 freq_conf_table[sar_fab_freq].vco_cpu; 167 --- 133 unchanged lines hidden --- |