qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ppc: Fix macio ESCC legacy mapping
@ 2016-08-02  9:22 Benjamin Herrenschmidt
  2016-08-02 23:10 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2016-08-02  9:22 UTC (permalink / raw)
  To: qemu-ppc; +Cc: Mark Cave-Ayland, david, qemu-devel, Alexander Graf

The current mapping, while correct for the base ports (which is all the
driver uses these days), is wrong for the extended registers. 

I suspect the bugs come from incorrect tables in the CHRP IO Ref document,
I have verified the new values here match Apple's MacTech.pdf.

Note: Nothing that I know of actually uses these registers so it's not a
huge deal, but this patch has the added advantage of adding comments to
document what the registers are.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
index be03926..5d57f45 100644
--- a/hw/misc/macio/macio.c
+++ b/hw/misc/macio/macio.c
@@ -89,22 +89,16 @@ static void macio_escc_legacy_setup(MacIOState *macio_state)
     MemoryRegion *bar = &macio_state->bar;
     int i;
     static const int maps[] = {
-        0x00, 0x00,
-        0x02, 0x20,
-        0x04, 0x10,
-        0x06, 0x30,
-        0x08, 0x40,
-        0x0A, 0x50,
-        0x60, 0x60,
-        0x70, 0x70,
-        0x80, 0x70,
-        0x90, 0x80,
-        0xA0, 0x90,
-        0xB0, 0xA0,
-        0xC0, 0xB0,
-        0xD0, 0xC0,
-        0xE0, 0xD0,
-        0xF0, 0xE0,
+        0x00, 0x00, /* Command B */
+        0x02, 0x20, /* Command A */
+        0x04, 0x10, /* Data B */
+        0x06, 0x30, /* Data A */
+        0x08, 0x40, /* Enhancement B */
+        0x0A, 0x50, /* Enhancement A */
+        0x80, 0x80, /* Recovery count */
+        0x90, 0x90, /* Start A */
+        0xa0, 0xa0, /* Start B */
+        0xb0, 0xb0, /* Detect AB */
     };
 
     memory_region_init(escc_legacy, OBJECT(macio_state), "escc-legacy", 256);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] ppc: Fix macio ESCC legacy mapping
  2016-08-02  9:22 [Qemu-devel] [PATCH] ppc: Fix macio ESCC legacy mapping Benjamin Herrenschmidt
@ 2016-08-02 23:10 ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2016-08-02 23:10 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: qemu-ppc, Mark Cave-Ayland, qemu-devel, Alexander Graf

[-- Attachment #1: Type: text/plain, Size: 2097 bytes --]

On Tue, Aug 02, 2016 at 07:22:43PM +1000, Benjamin Herrenschmidt wrote:
> The current mapping, while correct for the base ports (which is all the
> driver uses these days), is wrong for the extended registers. 
> 
> I suspect the bugs come from incorrect tables in the CHRP IO Ref document,
> I have verified the new values here match Apple's MacTech.pdf.
> 
> Note: Nothing that I know of actually uses these registers so it's not a
> huge deal, but this patch has the added advantage of adding comments to
> document what the registers are.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Applied to ppc-for-2.8, thanks.

> ---
> 
> diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
> index be03926..5d57f45 100644
> --- a/hw/misc/macio/macio.c
> +++ b/hw/misc/macio/macio.c
> @@ -89,22 +89,16 @@ static void macio_escc_legacy_setup(MacIOState *macio_state)
>      MemoryRegion *bar = &macio_state->bar;
>      int i;
>      static const int maps[] = {
> -        0x00, 0x00,
> -        0x02, 0x20,
> -        0x04, 0x10,
> -        0x06, 0x30,
> -        0x08, 0x40,
> -        0x0A, 0x50,
> -        0x60, 0x60,
> -        0x70, 0x70,
> -        0x80, 0x70,
> -        0x90, 0x80,
> -        0xA0, 0x90,
> -        0xB0, 0xA0,
> -        0xC0, 0xB0,
> -        0xD0, 0xC0,
> -        0xE0, 0xD0,
> -        0xF0, 0xE0,
> +        0x00, 0x00, /* Command B */
> +        0x02, 0x20, /* Command A */
> +        0x04, 0x10, /* Data B */
> +        0x06, 0x30, /* Data A */
> +        0x08, 0x40, /* Enhancement B */
> +        0x0A, 0x50, /* Enhancement A */
> +        0x80, 0x80, /* Recovery count */
> +        0x90, 0x90, /* Start A */
> +        0xa0, 0xa0, /* Start B */
> +        0xb0, 0xb0, /* Detect AB */
>      };
>  
>      memory_region_init(escc_legacy, OBJECT(macio_state), "escc-legacy", 256);
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-02 23:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-02  9:22 [Qemu-devel] [PATCH] ppc: Fix macio ESCC legacy mapping Benjamin Herrenschmidt
2016-08-02 23:10 ` David Gibson

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