Skip to contentSkip to conversation

A few bugfixes

DISCUSSION epicom 1 participant 1 message Nov 2, 2000

lore
Share & tools
lore

epicom

author
#0 lore raw

I have found several bugs in versions 2.4.0-test*, I don't know if they
exist
in 2.2.* versions, but it is posible.

1- file arch/ppc/mm/fault.c, function va_to_phys:

Quoted 1 line
Quoted 1 line

return(((unsigned long)(pte_val(*pte)) & PAGE_MASK) | (address &

~(PAGE_MASK-1)));

^^^^^^^^^^^^^

(PAGE_MASK-1) is buggy, it must be only PAGE_MASK to works correctly:
Perhaps the autor of this line was thinking in: (PAGE_SIZE-1)

Quoted 1 line
Quoted 1 line

return(((unsigned long)(pte_val(*pte)) & PAGE_MASK) | (address &

~PAGE_MASK));

^^^^^^^^^

2- file arch/ppc/8xx_io/commproc.c, function m8xx_cpm_setbrg:

The formula to calculate the value for registers BRGC (Baud Rate Generators) is incorrect:

Quoted 1 line
Quoted 1 line

*bp = ((BRG_UART_CLK / rate) << 1) | CPM_BRG_EN;

                           ^^^^

reading motorola data books we can found that that formula must be:

Quoted 1 line
Quoted 1 line

*bp = ((BRG_UART_CLK / rate - 1) << 1) | CPM_BRG_EN;

                           ^^^^^^^^

At low baudrates the differential is not significant, but I must use an UART at 220.300Hz

You can read the chapter 20.4.3 in the MPC850 user's manual, chapter 21.4.3 in MPC860 user's manual, or chapter 16.3 in MPC8260 user's manual.

3- file arch/ppc/mm/init.c, function free_initrd_mem:

the code for that funcion is:

Quoted 7 lines
Quoted 7 lines
 for (; start < end; start += PAGE_SIZE) {
     ClearPageReserved(virt_to_page(start));
     set_page_count(virt_to_page(start), 1);
     free_page(start);
     totalram_pages++;

}
printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);

The problem is tha when the prink function is executed, the value for 'start' variable has been changed in the for-loop. The printk must be executed before of the loop, or, to do the next one:

Quoted 9 lines
Quoted 9 lines

unsigned long initrd_size= 0;

 for (; start < end; start += PAGE_SIZE) {
     ClearPageReserved(virt_to_page(start));
     set_page_count(virt_to_page(start), 1);
     free_page(start);
     totalram_pages++;
     initrd_size+= PAGE_SIZE;

}
printk ("Freeing initrd memory: %ldk freed\n", initrd_size >> 10);

The result, store in 'initrd_size' is more real that (end-start).

In the wish to have been useful to improve the PPC port of the linux kernel:

Luis Recuerda,

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/