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>



git-svn-id: svn://coreboot.org/openbios/openbios-devel@465 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Alexander Graf
2009-03-08 01:03:17 +00:00
committed by Laurent Vivier
parent 5973871ed2
commit 4578c8ae20
3 changed files with 12 additions and 0 deletions

View File

@@ -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,

View File

@@ -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);

View File

@@ -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 */