4.1. Memory probing, RTC and decrementors

Now that the console was working, we could see the real problems. The system wasn't booting yet. Since we were working with C code, we traced the code, and found that a function called sdram_size() wasn't completing correctly. The function probed a register for the size of the RAM, a register our board doesn't have. We made the function return a given value of 128MB, it's an ugly hack, but our board doesn't have a way of knowing the amount of RAM.

Wwe had the same problems with a bunch of functions called todc_XXXX, mainly todc_get_rtc_time(), todc_set_rtc_time(), and time_init() since we don't have a RTC (real-time clock) chip on our board, and those functions were using it. For the time being, we made the todc_XXX function only set and get a constant date and time, since our board doesn't have a bios battery and so cannot keep time when powered off.

Once all this was done, we found todc_calibrate_descr(), which again uses the RTC chip. We had to replace that function with our own:

void calibrate_decr() {
	int freq, divisor;
	freq = bus_freq();
	divisor = 4;
	tb_ticks_per_jiffy = freq / HZ / divisor;
	tb_to_us = mulhwu_scale_factor(freq / divisor, 1000000);
}

mirror server hosted at Truenetwork, Russian Federation.