linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "epicom" <epicom@idecnet.com>
To: <linuxppc-embedded@lists.linuxppc.org>
Subject: A few bugfixes
Date: Thu, 2 Nov 2000 15:02:14 +0100	[thread overview]
Message-ID: <001901c044d5$81a87e80$e76e61d5@InternetLink> (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:

>>  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)

>>  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:
>>  *bp = ((BRG_UART_CLK / rate) << 1) | CPM_BRG_EN;
                           ^^^^

reading motorola data books we can found that that formula must be:
>>  *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:

>>  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:

>>  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/

             reply	other threads:[~2000-11-02 14:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-02 14:02 epicom [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-11-02 18:24 A few bugfixes Ian Abbott
2000-11-03 10:20 Ian Abbott

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='001901c044d5$81a87e80$e76e61d5@InternetLink' \
    --to=epicom@idecnet.com \
    --cc=linuxppc-embedded@lists.linuxppc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).