Linux requires the NVRAM to expose a 'nvram,flash' compatibility in the device tree. Let's expose it so it's happy.
v2 adds a NEWWORLD macro to protect nvram,flash getting exposed in oldworld macs.
Signed-off-by: Alexander Graf alex@csgraf.de --- arch/ppc/qemu/init.c | 5 +++++ drivers/macio.c | 1 + include/openbios/drivers.h | 6 ++++++ 3 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/arch/ppc/qemu/init.c b/arch/ppc/qemu/init.c index 9b7bdab..c81f0be 100644 --- a/arch/ppc/qemu/init.c +++ b/arch/ppc/qemu/init.c @@ -75,6 +75,11 @@ int is_oldworld(void) return machine_id == ARCH_HEATHROW; }
+int is_newworld(void) +{ + return machine_id == ARCH_MAC99; +} + static const pci_arch_t known_arch[] = { [ARCH_PREP] = { "PREP", PCI_VENDOR_ID_MOTOROLA, PCI_DEVICE_ID_MOTOROLA_RAVEN, diff --git a/drivers/macio.c b/drivers/macio.c index e150a18..d6b2a33 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); + NEWWORLD(set_property(dnode, "compatible", "nvram,flash", 12));
chosen = find_dev("/chosen"); push_str(buf); diff --git a/include/openbios/drivers.h b/include/openbios/drivers.h index 459c5a1..30f11a6 100644 --- a/include/openbios/drivers.h +++ b/include/openbios/drivers.h @@ -22,6 +22,7 @@ int ob_pci_init(void); #ifdef CONFIG_PPC extern int is_apple(void); extern int is_oldworld(void); +extern int is_newworld(void); #else static inline int is_apple(void) { @@ -31,9 +32,14 @@ static inline int is_oldworld(void) { return 0; } +static inline int is_newworld(void) +{ + return 0; +} #endif #define AAPL(_cmd) do { if (is_apple()) _cmd; } while(0) #define OLDWORLD(_cmd) do { if (is_oldworld()) _cmd; } while(0) +#define NEWWORLD(_cmd) do { if (is_newworld()) _cmd; } while(0) #endif #ifdef CONFIG_DRIVER_SBUS /* drivers/sbus.c */