Skip to contentSkip to conversation

prep: Remove some clearly wrong assumptions

PATCH In review Hervé Poussineau 2 participants 7 messages Apr 1, 2014 – Apr 2, 2014

lore
Share & tools
lore
#0 lore raw

cover prep: Remove some clearly wrong assumptions

Hi,

These two patches remove some bugs for a PReP firmware. Note that first patch is very PReP-oriented, and breaks OHW compatibility with other QEMU emulations (oldworld and newworld machines).
Patches to remove corresponding hacks on QEMU side will be sent shortly.

Hervé

Hervé Poussineau (2):
ohw: correctly program BAR addresses of PCI devices
ohw: let the right reset entry point 0xfff00100 jump to the currently

    wrong entry point (0xfffffffc)
 src/pci.c     |    9 +++++++--
 src/vectors.S |    7 ++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/2 ohw: correctly program BAR addresses of PCI devices

Note that offsets are PReP ones, so this breaks compatibility with hardware which has different values.

---
 src/pci.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
src/pci.c +7 -2
index 38aad27..7c0ebad 100644
@@ -1723,8 +1723,13 @@ static inline void pci_update_device (pci_bridge_t *bridge,
                 addr = 0x30; /* PCI ROM */
             else
                 addr = 0x10 + (i * sizeof(uint32_t));
-            pci_config_writel(bridge, device->bus, device->devfn,
-                              addr, device->regions[i]);
+            if (device->regions[i] & 0x00000001) {
+                pci_config_writel(bridge, device->bus, device->devfn,
+                                  addr, device->regions[i] - 0x80000000);
+            } else {
+                pci_config_writel(bridge, device->bus, device->devfn,
+                                  addr, device->regions[i] - 0xc0000000);
+            }
         }
     }
 }
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/2 ohw: let the right reset entry point 0xfff00100 jump to the currently wrong entry point (0xfffffffc)

In reply to Hervé Poussineau

This is easier to do this than to copy the code from the wrong entry point to the right entry point.

---
 src/vectors.S |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
src/vectors.S +6 -1
index 691d568..05cd1d9 100644
@@ -121,7 +121,12 @@ excp_##entry##:                                           ; \
 
         /* Exception vectors */
         /* Reset exception */
-        EXCP_BUG(0100)                                    ;
+.org 0x0100
+excp_0100:
+        lis r3,0
+        addi r3,r3,-4
+        mtlr r3
+        blr
 
         /* Machine check exception */
         EXCP_BUG(0200)                                    ;
Signature · 1 line
1.7.10.4
#3 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH for-2.0 2/2] ohw: let the right reset entry point 0xfff00100 jump to the currently wrong entry point (0xfffffffc)

Quoted 16 lines

Am 01.04.2014 um 23:18 schrieb Hervé Poussineau <[email protected]>:

This is easier to do this than to copy the code from the wrong entry point to the right entry point.

---
src/vectors.S | 7 ++++++-

1 file changed, 6 insertions(+), 1 deletion(-)
src/vectors.S +0 -0
index 691d568..05cd1d9 100644

src/vectors.S excp_##entry##: ; \ · line 129

Quoted 10 lines
src/vectors.S +6 -1
@@ -121,7 +121,12 @@ excp_##entry##:                                           ; \
 
        /* Exception vectors */
        /* Reset exception */
-        EXCP_BUG(0100)                                    ;
+.org 0x0100
+excp_0100:
+        lis r3,0
+        addi r3,r3,-4
+        mtlr r3
+        blr

Doesn't ba -4 work?

Alex

Quoted 7 lines
src/vectors.S +0 -0
        /* Machine check exception */
        EXCP_BUG(0200)                                    ;
Signature · 1 line
1.7.10.4
#4 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH for-2.0 2/2] ohw: let the right reset entry point 0xfff00100 jump to the currently wrong entry point (0xfffffffc)

Quoted 17 lines · Alexander Graf
Quoted 17 lines

Am 01.04.2014 um 23:18 schrieb Hervé Poussineau <[email protected]>:

This is easier to do this than to copy the code from the wrong entry point to the right entry point.

---
src/vectors.S | 7 ++++++-

1 file changed, 6 insertions(+), 1 deletion(-)
src/vectors.S +0 -0
index 691d568..05cd1d9 100644
@@ -121,7 +121,12 @@ excp_##entry##:                                           ; \
 
Quoted 12 lines

src/vectors.S excp_##entry##: ; \ · line 129

Quoted 9 lines
src/vectors.S +6 -1
         /* Exception vectors */
         /* Reset exception */
-        EXCP_BUG(0100)                                    ;
+.org 0x0100
+excp_0100:
+        lis r3,0
+        addi r3,r3,-4
+        mtlr r3
+        blr

Doesn't ba -4 work?

Yes, "ba -4" also works, I just tested it.

Hervé

#5 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH for-2.0 2/2] ohw: let the right reset entry point 0xfff00100 jump to the currently wrong entry point (0xfffffffc)

Quoted 34 lines

Am 02.04.2014 um 07:23 schrieb Hervé Poussineau <[email protected]>:

Quoted 17 lines · Alexander Graf
Quoted 17 lines

Am 01.04.2014 um 23:18 schrieb Hervé Poussineau <[email protected]>:

This is easier to do this than to copy the code from the wrong entry point to the right entry point.

---
src/vectors.S | 7 ++++++-

1 file changed, 6 insertions(+), 1 deletion(-)
src/vectors.S +0 -0
index 691d568..05cd1d9 100644
@@ -121,7 +121,12 @@ excp_##entry##:                                           ; \
 
Quoted 11 lines

src/vectors.S excp_##entry##: ; \ · line 129

Quoted 9 lines
src/vectors.S +6 -1
        /* Exception vectors */
        /* Reset exception */
-        EXCP_BUG(0100)                                    ;
+.org 0x0100
+excp_0100:
+        lis r3,0
+        addi r3,r3,-4
+        mtlr r3
+        blr

Doesn't ba -4 work?

Quoted 1 line

Yes, "ba -4" also works, I just tested it.

It's a lot cleaner because it doesn't modify registers. I don't think this is 2.0 material either - we're in the "critical bug fixes only" phase already, so no need to rush :).

Alex

Quoted 3 lines

Hervé

#6 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH for-2.0 2/2] ohw: let the right reset entry point 0xfff00100 jump to the currently wrong entry point (0xfffffffc)

Quoted 38 lines

Am 02.04.2014 um 07:36 schrieb Alexander Graf <[email protected]>:

Quoted 32 lines

Am 02.04.2014 um 07:23 schrieb Hervé Poussineau <[email protected]>:

Quoted 28 lines · Alexander Graf
Quoted 16 lines

Am 01.04.2014 um 23:18 schrieb Hervé Poussineau <[email protected]>:

This is easier to do this than to copy the code from the wrong entry point to the right entry point.

---
src/vectors.S | 7 ++++++-

1 file changed, 6 insertions(+), 1 deletion(-)
src/vectors.S +0 -0
index 691d568..05cd1d9 100644

src/vectors.S excp_##entry##: ; \ · line 129

Quoted 10 lines
src/vectors.S +6 -1
@@ -121,7 +121,12 @@ excp_##entry##:                                           ; \
 
       /* Exception vectors */
       /* Reset exception */
-        EXCP_BUG(0100)                                    ;
+.org 0x0100
+excp_0100:
+        lis r3,0
+        addi r3,r3,-4
+        mtlr r3
+        blr

Doesn't ba -4 work?

Quoted 3 lines
Quoted 1 line

Yes, "ba -4" also works, I just tested it.

It's a lot cleaner because it doesn't modify registers. I don't think this is 2.0 material either - we're in the "critical bug fixes only" phase already, so no need to rush :).

Oh, and writing it as ba 0xfffffffc should work as well and be even clearer :)

Alex