* [U-Boot-Users] [PATCH 2/4 V2] PPC: Change lib_ppc/bat_rw.c to use high bats
@ 2008-05-09 0:02 Becky.bruce at freescale.com
2008-05-09 15:28 ` Scott Wood
0 siblings, 1 reply; 9+ messages in thread
From: Becky.bruce at freescale.com @ 2008-05-09 0:02 UTC (permalink / raw)
To: u-boot
From: Becky Bruce <becky.bruce@freescale.com>
Currently, this code only deals with BATs 0-3, which makes
it useless on systems that support BATs 4-7. Add the
support for these registers.
Signed-off-by: Becky Bruce <Becky.bruce@freescale.com>
---
include/asm-ppc/mmu.h | 4 ++
lib_ppc/bat_rw.c | 134 ++++++++++++++++++++++++++++++++++---------------
2 files changed, 97 insertions(+), 41 deletions(-)
diff --git a/include/asm-ppc/mmu.h b/include/asm-ppc/mmu.h
index 49d6860..f836270 100644
--- a/include/asm-ppc/mmu.h
+++ b/include/asm-ppc/mmu.h
@@ -141,6 +141,10 @@ extern void _tlbia(void); /* invalidate all TLB entries */
typedef enum {
IBAT0 = 0, IBAT1, IBAT2, IBAT3,
DBAT0, DBAT1, DBAT2, DBAT3
+#ifdef CONFIG_HIGH_BATS
+ , IBAT4, IBAT5, IBAT6, IBAT7,
+ DBAT4, DBAT5, DBAT6, DBAT7
+#endif
} ppc_bat_t;
extern int read_bat(ppc_bat_t bat, unsigned long *upper, unsigned long *lower);
diff --git a/lib_ppc/bat_rw.c b/lib_ppc/bat_rw.c
index 912efa7..6288164 100644
--- a/lib_ppc/bat_rw.c
+++ b/lib_ppc/bat_rw.c
@@ -28,47 +28,73 @@
int write_bat (ppc_bat_t bat, unsigned long upper, unsigned long lower)
{
- switch (bat) {
+ switch(bat) {
+ case DBAT0:
+ mtspr (DBAT0L, lower);
+ mtspr (DBAT0U, upper);
+ break;
case IBAT0:
mtspr (IBAT0L, lower);
mtspr (IBAT0U, upper);
break;
-
+ case DBAT1:
+ mtspr (DBAT1L, lower);
+ mtspr (DBAT1U, upper);
+ break;
case IBAT1:
mtspr (IBAT1L, lower);
mtspr (IBAT1U, upper);
break;
-
+ case DBAT2:
+ mtspr (DBAT2L, lower);
+ mtspr (DBAT2U, upper);
+ break;
case IBAT2:
mtspr (IBAT2L, lower);
mtspr (IBAT2U, upper);
break;
-
+ case DBAT3:
+ mtspr (DBAT3L, lower);
+ mtspr (DBAT3U, upper);
+ break;
case IBAT3:
mtspr (IBAT3L, lower);
mtspr (IBAT3U, upper);
break;
-
- case DBAT0:
- mtspr (DBAT0L, lower);
- mtspr (DBAT0U, upper);
+#ifdef CONFIG_HIGH_BATS
+ case DBAT4:
+ mtspr (DBAT4L, lower);
+ mtspr (DBAT3U, upper);
break;
-
- case DBAT1:
- mtspr (DBAT1L, lower);
- mtspr (DBAT1U, upper);
+ case IBAT4:
+ mtspr (IBAT4L, lower);
+ mtspr (IBAT4U, upper);
break;
-
- case DBAT2:
- mtspr (DBAT2L, lower);
- mtspr (DBAT2U, upper);
+ case DBAT5:
+ mtspr (DBAT5L, lower);
+ mtspr (DBAT5U, upper);
break;
-
- case DBAT3:
- mtspr (DBAT3L, lower);
- mtspr (DBAT3U, upper);
+ case IBAT5:
+ mtspr (IBAT5L, lower);
+ mtspr (IBAT5U, upper);
break;
-
+ case DBAT6:
+ mtspr (DBAT6L, lower);
+ mtspr (DBAT6U, upper);
+ break;
+ case IBAT6:
+ mtspr (IBAT6L, lower);
+ mtspr (IBAT6U, upper);
+ break;
+ case DBAT7:
+ mtspr (DBAT7L, lower);
+ mtspr (DBAT7U, upper);
+ break;
+ case IBAT7:
+ mtspr (IBAT7L, lower);
+ mtspr (IBAT7U, upper);
+ break;
+#endif
default:
return (-1);
}
@@ -82,46 +108,72 @@ int read_bat (ppc_bat_t bat, unsigned long *upper, unsigned long *lower)
unsigned long register l;
switch (bat) {
+ case DBAT0:
+ l = mfspr (DBAT0L);
+ u = mfspr (DBAT0U);
+ break;
case IBAT0:
l = mfspr (IBAT0L);
u = mfspr (IBAT0U);
break;
-
+ case DBAT1:
+ l = mfspr (DBAT1L);
+ u = mfspr (DBAT1U);
+ break;
case IBAT1:
l = mfspr (IBAT1L);
u = mfspr (IBAT1U);
break;
-
+ case DBAT2:
+ l = mfspr (DBAT2L);
+ u = mfspr (DBAT2U);
+ break;
case IBAT2:
l = mfspr (IBAT2L);
u = mfspr (IBAT2U);
break;
-
+ case DBAT3:
+ l = mfspr (DBAT3L);
+ u = mfspr (DBAT3U);
+ break;
case IBAT3:
l = mfspr (IBAT3L);
u = mfspr (IBAT3U);
break;
-
- case DBAT0:
- l = mfspr (DBAT0L);
- u = mfspr (DBAT0U);
+#ifdef CONFIG_HIGH_BATS
+ case DBAT4:
+ l = mfspr (DBAT4L);
+ u = mfspr (DBAT4U);
break;
-
- case DBAT1:
- l = mfspr (DBAT1L);
- u = mfspr (DBAT1U);
+ case IBAT4:
+ l = mfspr (IBAT4L);
+ u = mfspr (IBAT4U);
break;
-
- case DBAT2:
- l = mfspr (DBAT2L);
- u = mfspr (DBAT2U);
+ case DBAT5:
+ l = mfspr (DBAT5L);
+ u = mfspr (DBAT5U);
break;
-
- case DBAT3:
- l = mfspr (DBAT3L);
- u = mfspr (DBAT3U);
+ case IBAT5:
+ l = mfspr (IBAT5L);
+ u = mfspr (IBAT5U);
break;
-
+ case DBAT6:
+ l = mfspr (DBAT6L);
+ u = mfspr (DBAT6U);
+ break;
+ case IBAT6:
+ l = mfspr (IBAT6L);
+ u = mfspr (IBAT6U);
+ break;
+ case DBAT7:
+ l = mfspr (DBAT7L);
+ u = mfspr (DBAT7U);
+ break;
+ case IBAT7:
+ l = mfspr (IBAT7L);
+ u = mfspr (IBAT7U);
+ break;
+#endif
default:
return (-1);
}
--
1.5.4.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [U-Boot-Users] [PATCH 2/4 V2] PPC: Change lib_ppc/bat_rw.c to use high bats
2008-05-09 0:02 [U-Boot-Users] [PATCH 2/4 V2] PPC: Change lib_ppc/bat_rw.c to use high bats Becky.bruce at freescale.com
@ 2008-05-09 15:28 ` Scott Wood
2008-05-09 18:41 ` Becky Bruce
0 siblings, 1 reply; 9+ messages in thread
From: Scott Wood @ 2008-05-09 15:28 UTC (permalink / raw)
To: u-boot
On Thu, May 08, 2008 at 07:02:23PM -0500, Becky.bruce at freescale.com wrote:
> diff --git a/include/asm-ppc/mmu.h b/include/asm-ppc/mmu.h
> index 49d6860..f836270 100644
> --- a/include/asm-ppc/mmu.h
> +++ b/include/asm-ppc/mmu.h
> @@ -141,6 +141,10 @@ extern void _tlbia(void); /* invalidate all TLB entries */
> typedef enum {
> IBAT0 = 0, IBAT1, IBAT2, IBAT3,
> DBAT0, DBAT1, DBAT2, DBAT3
> +#ifdef CONFIG_HIGH_BATS
> + , IBAT4, IBAT5, IBAT6, IBAT7,
> + DBAT4, DBAT5, DBAT6, DBAT7
> +#endif
C allows trailing commas on such lists; no need to move it inside the
ifdef.
-Scott
^ permalink raw reply [flat|nested] 9+ messages in thread* [U-Boot-Users] [PATCH 2/4 V2] PPC: Change lib_ppc/bat_rw.c to use high bats
2008-05-09 15:28 ` Scott Wood
@ 2008-05-09 18:41 ` Becky Bruce
2008-05-09 18:45 ` Jerry Van Baren
2008-05-09 23:07 ` Wolfgang Denk
0 siblings, 2 replies; 9+ messages in thread
From: Becky Bruce @ 2008-05-09 18:41 UTC (permalink / raw)
To: u-boot
On May 9, 2008, at 10:28 AM, Scott Wood wrote:
> On Thu, May 08, 2008 at 07:02:23PM -0500, Becky.bruce at freescale.com
> wrote:
>> diff --git a/include/asm-ppc/mmu.h b/include/asm-ppc/mmu.h
>> index 49d6860..f836270 100644
>> --- a/include/asm-ppc/mmu.h
>> +++ b/include/asm-ppc/mmu.h
>> @@ -141,6 +141,10 @@ extern void _tlbia(void); /* invalidate all
>> TLB entries */
>> typedef enum {
>> IBAT0 = 0, IBAT1, IBAT2, IBAT3,
>> DBAT0, DBAT1, DBAT2, DBAT3
>> +#ifdef CONFIG_HIGH_BATS
>> + , IBAT4, IBAT5, IBAT6, IBAT7,
>> + DBAT4, DBAT5, DBAT6, DBAT7
>> +#endif
>
> C allows trailing commas on such lists; no need to move it inside the
> ifdef.
Dangling commas bother me in the extreme. If this is the concensus,
I'll move it, but I prefer it where it is.
-B
^ permalink raw reply [flat|nested] 9+ messages in thread* [U-Boot-Users] [PATCH 2/4 V2] PPC: Change lib_ppc/bat_rw.c to use high bats
2008-05-09 18:41 ` Becky Bruce
@ 2008-05-09 18:45 ` Jerry Van Baren
2008-05-09 19:14 ` Jean-Christophe PLAGNIOL-VILLARD
2008-05-09 19:28 ` Stefan Roese
2008-05-09 23:07 ` Wolfgang Denk
1 sibling, 2 replies; 9+ messages in thread
From: Jerry Van Baren @ 2008-05-09 18:45 UTC (permalink / raw)
To: u-boot
Becky Bruce wrote:
> On May 9, 2008, at 10:28 AM, Scott Wood wrote:
>> On Thu, May 08, 2008 at 07:02:23PM -0500, Becky.bruce at freescale.com
>> wrote:
>>> diff --git a/include/asm-ppc/mmu.h b/include/asm-ppc/mmu.h
>>> index 49d6860..f836270 100644
>>> --- a/include/asm-ppc/mmu.h
>>> +++ b/include/asm-ppc/mmu.h
>>> @@ -141,6 +141,10 @@ extern void _tlbia(void); /* invalidate all
>>> TLB entries */
>>> typedef enum {
>>> IBAT0 = 0, IBAT1, IBAT2, IBAT3,
>>> DBAT0, DBAT1, DBAT2, DBAT3
>>> +#ifdef CONFIG_HIGH_BATS
>>> + , IBAT4, IBAT5, IBAT6, IBAT7,
>>> + DBAT4, DBAT5, DBAT6, DBAT7
>>> +#endif
>> C allows trailing commas on such lists; no need to move it inside the
>> ifdef.
>
> Dangling commas bother me in the extreme. If this is the concensus,
> I'll move it, but I prefer it where it is.
>
> -B
+1 for moving. Dangling commas is the second best thing in C. ;-)
Best regards,
gvb
^ permalink raw reply [flat|nested] 9+ messages in thread* [U-Boot-Users] [PATCH 2/4 V2] PPC: Change lib_ppc/bat_rw.c to use high bats
2008-05-09 18:45 ` Jerry Van Baren
@ 2008-05-09 19:14 ` Jean-Christophe PLAGNIOL-VILLARD
2008-05-09 19:38 ` Becky Bruce
2008-05-09 19:28 ` Stefan Roese
1 sibling, 1 reply; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-05-09 19:14 UTC (permalink / raw)
To: u-boot
On 14:45 Fri 09 May , Jerry Van Baren wrote:
> Becky Bruce wrote:
> > On May 9, 2008, at 10:28 AM, Scott Wood wrote:
> >> On Thu, May 08, 2008 at 07:02:23PM -0500, Becky.bruce at freescale.com
> >> wrote:
> >>> diff --git a/include/asm-ppc/mmu.h b/include/asm-ppc/mmu.h
> >>> index 49d6860..f836270 100644
> >>> --- a/include/asm-ppc/mmu.h
> >>> +++ b/include/asm-ppc/mmu.h
> >>> @@ -141,6 +141,10 @@ extern void _tlbia(void); /* invalidate all
> >>> TLB entries */
> >>> typedef enum {
> >>> IBAT0 = 0, IBAT1, IBAT2, IBAT3,
> >>> DBAT0, DBAT1, DBAT2, DBAT3
> >>> +#ifdef CONFIG_HIGH_BATS
> >>> + , IBAT4, IBAT5, IBAT6, IBAT7,
> >>> + DBAT4, DBAT5, DBAT6, DBAT7
> >>> +#endif
> >> C allows trailing commas on such lists; no need to move it inside the
> >> ifdef.
> >
> > Dangling commas bother me in the extreme. If this is the concensus,
> > I'll move it, but I prefer it where it is.
> >
> > -B
>
> +1 for moving. Dangling commas is the second best thing in C. ;-)
+1 for moving. Dangling commas is the second best thing in C. ;-)
Best Regards,
J.
^ permalink raw reply [flat|nested] 9+ messages in thread* [U-Boot-Users] [PATCH 2/4 V2] PPC: Change lib_ppc/bat_rw.c to use high bats
2008-05-09 19:14 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2008-05-09 19:38 ` Becky Bruce
0 siblings, 0 replies; 9+ messages in thread
From: Becky Bruce @ 2008-05-09 19:38 UTC (permalink / raw)
To: u-boot
On May 9, 2008, at 2:14 PM, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 14:45 Fri 09 May , Jerry Van Baren wrote:
>> Becky Bruce wrote:
>>> On May 9, 2008, at 10:28 AM, Scott Wood wrote:
>>>> On Thu, May 08, 2008 at 07:02:23PM -0500, Becky.bruce at freescale.com
>>>> wrote:
>>>>> diff --git a/include/asm-ppc/mmu.h b/include/asm-ppc/mmu.h
>>>>> index 49d6860..f836270 100644
>>>>> --- a/include/asm-ppc/mmu.h
>>>>> +++ b/include/asm-ppc/mmu.h
>>>>> @@ -141,6 +141,10 @@ extern void _tlbia(void); /* invalidate all
>>>>> TLB entries */
>>>>> typedef enum {
>>>>> IBAT0 = 0, IBAT1, IBAT2, IBAT3,
>>>>> DBAT0, DBAT1, DBAT2, DBAT3
>>>>> +#ifdef CONFIG_HIGH_BATS
>>>>> + , IBAT4, IBAT5, IBAT6, IBAT7,
>>>>> + DBAT4, DBAT5, DBAT6, DBAT7
>>>>> +#endif
>>>> C allows trailing commas on such lists; no need to move it inside
>>>> the
>>>> ifdef.
>>>
>>> Dangling commas bother me in the extreme. If this is the concensus,
>>> I'll move it, but I prefer it where it is.
>>>
>>> -B
>>
>> +1 for moving. Dangling commas is the second best thing in C. ;-)
> +1 for moving. Dangling commas is the second best thing in C. ;-)
>
I also want to know what's the first best thing! I have to guess that
the dangling comma is really the fifteenth-best thing, or
something..... but I don't want this thread to degenerate into a holy
war.
Ayway, point taken, and I'll move it. But I don't have to like it :)
Cheers,
B
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot-Users] [PATCH 2/4 V2] PPC: Change lib_ppc/bat_rw.c to use high bats
2008-05-09 18:45 ` Jerry Van Baren
2008-05-09 19:14 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2008-05-09 19:28 ` Stefan Roese
2008-05-09 19:39 ` Jerry Van Baren
1 sibling, 1 reply; 9+ messages in thread
From: Stefan Roese @ 2008-05-09 19:28 UTC (permalink / raw)
To: u-boot
On Friday 09 May 2008, Jerry Van Baren wrote:
> >> C allows trailing commas on such lists; no need to move it inside the
> >> ifdef.
> >
> > Dangling commas bother me in the extreme. If this is the concensus,
> > I'll move it, but I prefer it where it is.
> >
> > -B
>
> +1 for moving. Dangling commas is the second best thing in C. ;-)
Now I'm curious. :) And what's supposed to be "the best thing in C"?
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot-Users] [PATCH 2/4 V2] PPC: Change lib_ppc/bat_rw.c to use high bats
2008-05-09 19:28 ` Stefan Roese
@ 2008-05-09 19:39 ` Jerry Van Baren
0 siblings, 0 replies; 9+ messages in thread
From: Jerry Van Baren @ 2008-05-09 19:39 UTC (permalink / raw)
To: u-boot
Stefan Roese wrote:
> On Friday 09 May 2008, Jerry Van Baren wrote:
>>>> C allows trailing commas on such lists; no need to move it inside the
>>>> ifdef.
>>> Dangling commas bother me in the extreme. If this is the concensus,
>>> I'll move it, but I prefer it where it is.
>>>
>>> -B
>> +1 for moving. Dangling commas is the second best thing in C. ;-)
>
> Now I'm curious. :) And what's supposed to be "the best thing in C"?
>
> Best regards,
> Stefan
I figured everybody has a favorite feature of C, so by claiming *second
best*, I wouldn't have to argue with everybody that it was the best. :-D
Great conversation starter too, I use it in the bar all the time. ;-)
As Calvin says, "I try to make everyone's day a little more surreal."
The Essential Calvin and Hobbes, p152-3
<http://www.calvin-and-hobbes.org/information/quotes>
gvb
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot-Users] [PATCH 2/4 V2] PPC: Change lib_ppc/bat_rw.c to use high bats
2008-05-09 18:41 ` Becky Bruce
2008-05-09 18:45 ` Jerry Van Baren
@ 2008-05-09 23:07 ` Wolfgang Denk
1 sibling, 0 replies; 9+ messages in thread
From: Wolfgang Denk @ 2008-05-09 23:07 UTC (permalink / raw)
To: u-boot
In message <6514CE95-5C25-4C36-88DA-63E03DE87024@freescale.com> you wrote:
>
> >> TLB entries */
> >> typedef enum {
> >> IBAT0 = 0, IBAT1, IBAT2, IBAT3,
> >> DBAT0, DBAT1, DBAT2, DBAT3
> >> +#ifdef CONFIG_HIGH_BATS
> >> + , IBAT4, IBAT5, IBAT6, IBAT7,
> >> + DBAT4, DBAT5, DBAT6, DBAT7
> >> +#endif
> >
> > C allows trailing commas on such lists; no need to move it inside the
> > ifdef.
>
> Dangling commas bother me in the extreme. If this is the concensus,
> I'll move it, but I prefer it where it is.
Please move it. As is it looks irregular and ugly to me.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Q: What do you get when you cross an ethernet with an income statement?
A: A local area networth.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-05-09 23:07 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-09 0:02 [U-Boot-Users] [PATCH 2/4 V2] PPC: Change lib_ppc/bat_rw.c to use high bats Becky.bruce at freescale.com
2008-05-09 15:28 ` Scott Wood
2008-05-09 18:41 ` Becky Bruce
2008-05-09 18:45 ` Jerry Van Baren
2008-05-09 19:14 ` Jean-Christophe PLAGNIOL-VILLARD
2008-05-09 19:38 ` Becky Bruce
2008-05-09 19:28 ` Stefan Roese
2008-05-09 19:39 ` Jerry Van Baren
2008-05-09 23:07 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox