Author: laurent Date: 2009-03-08 02:03:17 +0100 (Sun, 08 Mar 2009) New Revision: 465
Modified: openbios-devel/arch/ppc/qemu/init.c openbios-devel/drivers/macio.c openbios-devel/include/openbios/drivers.h Log: Author: Alexander Graf alex@csgraf.de
Expose NVRAM compatibility
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 Signed-off-by: Laurent Vivier Laurent@vivier.eu
Modified: openbios-devel/arch/ppc/qemu/init.c =================================================================== --- openbios-devel/arch/ppc/qemu/init.c 2009-03-08 00:54:06 UTC (rev 464) +++ openbios-devel/arch/ppc/qemu/init.c 2009-03-08 01:03:17 UTC (rev 465) @@ -75,6 +75,11 @@ 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,
Modified: openbios-devel/drivers/macio.c =================================================================== --- openbios-devel/drivers/macio.c 2009-03-08 00:54:06 UTC (rev 464) +++ openbios-devel/drivers/macio.c 2009-03-08 01:03:17 UTC (rev 465) @@ -71,6 +71,7 @@ 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);
Modified: openbios-devel/include/openbios/drivers.h =================================================================== --- openbios-devel/include/openbios/drivers.h 2009-03-08 00:54:06 UTC (rev 464) +++ openbios-devel/include/openbios/drivers.h 2009-03-08 01:03:17 UTC (rev 465) @@ -22,6 +22,7 @@ #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 @@ { 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 */