From: Zang Roy-r61911 <tie-fei.zang@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH 00/07 v2]: Add mpc7448hpc2 (Taiga) board support
Date: 04 Dec 2006 10:04:13 +0800 [thread overview]
Message-ID: <1165197852.28151.38.camel@localhost.localdomain> (raw)
In-Reply-To: <20061201143152.9F8E4352621@atlas.denx.de>
Dear Wolfgang
On Fri, 2006-12-01 at 22:31, Wolfgang Denk wrote:
> In message <1164960567.6742.25.camel@localhost.localdomain> you wrote:
> >
> > index d92f142..8a4d141 100644
> > --- a/lib_ppc/extable.c
> > +++ b/lib_ppc/extable.c
> > @@ -50,15 +50,29 @@ search_one_table(const struct exception_
> > const struct exception_table_entry *last,
> > unsigned long value)
> > {
> > + DECLARE_GLOBAL_DATA_PTR;
> > +
> > while (first <= last) {
> > const struct exception_table_entry *mid;
> > long diff;
> >
> > mid = (last - first) / 2 + first;
> > - diff = mid->insn - value;
> > - if (diff == 0)
> > - return mid->fixup;
> > - else if (diff < 0)
> > + if (mid > CFG_MONITOR_BASE) {
> > + /* exception occurs in FLASH, before u-boot
> relocation.
> > + * No relocation offset is needed.
> > + */
> > + diff = mid->insn - value;
> > + if (diff == 0)
> > + return mid->fixup;
> > + } else {
> > + /* exception occurs in RAM, after u-boot relocation.
> > + * A relocation offset should be added.
> > + */
> > + diff = (mid->insn + gd->reloc_off) - value;
> > + if (diff == 0)
> > + return (mid->fixup + gd->reloc_off);
> > + }
> > + if (diff < 0)
> > first = mid+1;
> > else
> > last = mid-1;
>
> The problem I see with this code is that it is based on the
> assumption that CFG_MONITOR_BASE is greater than any RAM address.
> While this is always true so far, I would rather not rely on this.
I would not rely on this either, if there is a better way :-). Anyway,
it's better than a define. In future, there might be a board whose
exception code will occur in both RAM and Flash. A fixed macro define
can not deal with this condition, although, I do not see this kind of
ppc board in u-boot tree until now.
>
> And I still don't understand why this change is necessary, and/or if
> this is the right fix. If a fix is needed, then probably the values
> of "value" is wrong in the first place, so the fix should be in the
> calling routine.
>
"The "value" is the address of exception occurring. For mpc7448hpc2
board, a tsi108/9 bridge is used. There is a hardware chip errata, when
the tsi108 pci controller has a config read operation. This operation
will induce a processor exception.
The following code does a pci config dword read.
+unsigned int __get_pci_config_dword (u32 addr)
+{
+ unsigned int retval;
+
+ __asm__ __volatile__ (" lwbrx %0,0,%1\n"
+ "1: eieio\n"
+ "2:\n"
+ ".section .fixup,\"ax\"\n"
+ "3: li %0,-1\n"
+ " b 2b\n"
+ ".section __ex_table,\"a\"\n"
+ " .align 2\n"
+ " .long 1b,3b\n"
+ ".text":"=r"(retval):"r"(addr));
+
+ return (retval);
+}
A exception will occur at address "1" ("value"), when the code executes
in RAM (after relocation). While the address 1b and 3b are assigned when
u-boot compiling. 1b and 3b are located in Flash. If the exception
occurs in Flash, everything will be OK. While, for pci config read
occurs in RAM, if I do not consider the reloc_off, I can not find the
__ex_table.
Do you think it is reasonable for the code to jump back to flash to
execute? This might ensure the exception occurring address locates in
FlASH.
I can see the mechanism to deal with exception in u-boot is just similar
to kernel, while kernel does not has such relocation. The same code is
OK in kernel. For u-boot, we should consider this issue, although there
is no other ppc board encounter this.
thanks!
Roy
next prev parent reply other threads:[~2006-12-04 2:04 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-11 10:44 [U-Boot-Users] [PATCH 00/07 v2]: Add mpc7448hpc2 (Taiga) board support Zang Roy-r61911
2006-10-30 7:11 ` [U-Boot-Users] [PATCH 00/07 v2]: Add mpc7448hpc2 (Taiga) boardsupport Zang Roy-r61911
2006-10-30 9:01 ` Wolfgang Denk
2006-10-30 9:23 ` Zang Roy-r61911
2006-11-03 4:54 ` Zang Roy-r61911
2006-11-07 2:32 ` [U-Boot-Users] [PATCH 00/07 v2]: Add mpc7448hpc2(Taiga) board support Zang Roy-r61911
2006-11-13 4:02 ` [U-Boot-Users] [PATCH 00/07 v2]: Add mpc7448hpc2 (Taiga) boardsupport Zang Roy-r61911
2006-11-13 6:12 ` Jaksa David
2006-11-13 6:36 ` Zang Roy-r61911
2006-11-27 2:12 ` [U-Boot-Users] [PATCH 00/07 v2]: Add mpc7448hpc2 (Taiga) board support Zang Roy-r61911
2006-11-27 15:49 ` Wolfgang Denk
2006-11-28 1:51 ` Zang Roy-r61911
2006-12-01 2:31 ` Zang Roy-r61911
2006-12-01 8:59 ` Wolfgang Denk
2006-12-01 11:23 ` Zang Roy-r61911
2006-12-01 8:09 ` Zang Roy-r61911
2006-12-01 14:31 ` Wolfgang Denk
2006-12-04 2:04 ` Zang Roy-r61911 [this message]
2006-12-05 2:31 ` Zang Roy-r61911
2006-12-06 5:32 ` Jaksa David
2006-12-08 15:51 ` Zang Roy-r61911
2006-12-14 4:50 ` Zang Roy-r61911
2006-12-20 2:25 ` Jaksa David
2006-12-22 8:36 ` Zang Roy-r61911
2006-12-22 10:02 ` Wolfgang Denk
2006-12-23 11:59 ` Zang Roy-r61911
2007-01-08 2:13 ` Zang Roy-r61911
2007-01-15 2:43 ` Zang Roy-r61911
2007-01-15 21:21 ` Wolfgang Denk
2007-01-23 1:58 ` Zang Roy-r61911
2007-01-29 1:50 ` Zang Roy-r61911
2007-02-12 3:24 ` Zang Roy-r61911
2007-03-08 10:45 ` Wolfgang Denk
2007-03-09 2:03 ` Zang Roy-r61911
2007-03-09 7:40 ` Wolfgang Denk
2007-04-06 1:22 ` Zang Roy-r61911
2007-04-11 23:25 ` Zang Roy-r61911
2007-04-18 15:33 ` Wolfgang Denk
2007-04-18 23:44 ` Zang Roy-r61911
2006-11-02 9:27 ` [U-Boot-Users] [PATCH 00/10 v3]: " Zang Roy-r61911
-- strict thread matches above, loose matches on Subject: below --
2006-11-08 8:10 [U-Boot-Users] [PATCH 00/07 v2]: Add mpc7448hpc2(Taiga)board support Ch.Vict
2006-11-08 8:31 ` Zang Roy-r61911
2006-11-08 8:53 ` Ch.Vict
2006-11-10 7:37 ` Ch.Vict
2006-11-10 7:45 ` [U-Boot-Users] [PATCH 00/07 v2]: Add mpc7448hpc2(Taiga) board support Zang Roy-r61911
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=1165197852.28151.38.camel@localhost.localdomain \
--to=tie-fei.zang@freescale.com \
--cc=u-boot@lists.denx.de \
/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