All the code in OpenBIOS runs in 32 bits, which is fine. Now, when an interrupt arrives, the 970 CPU automatically sets the MSR_SF bit, making us run in 64 bit mode.
That breaks address calculation, because 'lis' and 'ba' get sign extended.
In order to circumvent that mess, let's just go back to 32 bit mode whenever we get an interrupt.
Signed-off-by: Alexander Graf alex@csgraf.de --- arch/ppc/qemu/start.S | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/ppc/qemu/start.S b/arch/ppc/qemu/start.S index 857885a..66df9a2 100644 --- a/arch/ppc/qemu/start.S +++ b/arch/ppc/qemu/start.S @@ -34,6 +34,9 @@
#define EXCEPTION_PREAMBLE_TEMPLATE \ mtsprg1 r1 ; /* scratch */ \ + mfmsr r1 ; /* unset MSR_SF */ \ + clrlwi r1,r1,0 ; \ + mtmsr r1 ; \ mfsprg0 r1 ; /* exception stack in sprg0 */ \ .ifc ULONG_SIZE, 8 ; \ addi r1,r1,-(40 * ULONG_SIZE) ; /* push exception frame */ \
Linux requires the NVRAM to expose a 'nvram,flash' compatibility in the device tree. Let's expose it so it's happy.
Signed-off-by: Alexander Graf alex@csgraf.de --- drivers/macio.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/macio.c b/drivers/macio.c index e150a18..86824aa 100644 --- a/drivers/macio.c +++ b/drivers/macio.c @@ -71,6 +71,7 @@ void macio_nvram_init(const char *path, uint32_t addr) props[1] = __cpu_to_be32(nvram_size); set_property(dnode, "reg", (char *)&props, sizeof(props)); set_property(dnode, "device_type", "nvram", 6); + set_property(dnode, "compatible", "nvram,flash", 12);
chosen = find_dev("/chosen"); push_str(buf);
Linux tries to detect which PCI controller it's supposed to work with. On PPC32 there is fallback code that doesn't get compiled with CONFIG_PPC64, so we really have to expose a controller or we don't have pci config space accessor functions.
Let's expose a un3-agp if we have a mac99 model, as that's what is supposed to be in there anyways.
Signed-off-by: Alexander Graf alex@csgraf.de --- arch/ppc/qemu/init.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/arch/ppc/qemu/init.c b/arch/ppc/qemu/init.c index 9b7bdab..f53cdc7 100644 --- a/arch/ppc/qemu/init.c +++ b/arch/ppc/qemu/init.c @@ -561,6 +561,17 @@ arch_of_init( void ) push_str("system-id"); fword("property");
+ /* pci info */ + + if (machine_id == ARCH_MAC99) { + push_str("/pci"); + fword("find-device"); + push_str("u3-agp"); + fword("encode-string"); + push_str("compatible"); + fword("property"); + } + /* memory info */
push_str("/memory");
Le 5 mars 09 à 22:24, Alexander Graf a écrit :
Linux requires the NVRAM to expose a 'nvram,flash' compatibility in the device tree. Let's expose it so it's happy.
Signed-off-by: Alexander Graf alex@csgraf.de
drivers/macio.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/macio.c b/drivers/macio.c index e150a18..86824aa 100644 --- a/drivers/macio.c +++ b/drivers/macio.c @@ -71,6 +71,7 @@ void macio_nvram_init(const char *path, uint32_t addr) props[1] = __cpu_to_be32(nvram_size); set_property(dnode, "reg", (char *)&props, sizeof(props)); set_property(dnode, "device_type", "nvram", 6);
- set_property(dnode, "compatible", "nvram,flash", 12);
This breaks oldworld nvram support, could you use something like:
NEWWORLD(set_property(dnode, "compatible", "nvram,flash", 12)); OLDWORLD(set_property(dnode, "compatible", "nvram", 6));
(OLDWORLD() already exists, you have to define NEWWORLD())
chosen = find_dev("/chosen"); push_str(buf); -- 1.6.0.2
-- OpenBIOS http://openbios.org/ Mailinglist: http://lists.openbios.org/mailman/listinfo Free your System - May the Forth be with you
Laurent Vivier wrote:
Le 5 mars 09 à 22:24, Alexander Graf a écrit :
Linux requires the NVRAM to expose a 'nvram,flash' compatibility in the device tree. Let's expose it so it's happy.
Signed-off-by: Alexander Graf alex@csgraf.de
drivers/macio.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/macio.c b/drivers/macio.c index e150a18..86824aa 100644 --- a/drivers/macio.c +++ b/drivers/macio.c @@ -71,6 +71,7 @@ void macio_nvram_init(const char *path, uint32_t addr) props[1] = __cpu_to_be32(nvram_size); set_property(dnode, "reg", (char *)&props, sizeof(props)); set_property(dnode, "device_type", "nvram", 6);
- set_property(dnode, "compatible", "nvram,flash", 12);
This breaks oldworld nvram support, could you use something like:
NEWWORLD(set_property(dnode, "compatible", "nvram,flash", 12)); OLDWORLD(set_property(dnode, "compatible", "nvram", 6));
(OLDWORLD() already exists, you have to define NEWWORLD())
I'm not sure about the OLDWORLD part, as things work for me there, so I just made it NEWWORLD only.
Alex