ppc64: Update the nvram driver to deal with PowerMac G5

This involves making the actual read/write routines be indirect
through ppc_md, and adding the various nvram partition types
used on a PowerMac.
parent d93aef75
......@@ -178,6 +178,10 @@ chrp_setup_arch(void)
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
#ifdef CONFIG_PPC_PSERIES
pSeries_nvram_init();
#endif
}
void __init
......@@ -272,9 +276,6 @@ chrp_init(unsigned long r3, unsigned long r4, unsigned long r5,
ppc_md.progress = chrp_progress;
ppc_md.nvram_read = pSeries_nvram_read;
ppc_md.nvram_write = pSeries_nvram_write;
/* Build up the firmware_features bitmask field
* using contents of device-tree/ibm,hypertas-functions.
* Ultimately this functionality may be moved into prom.c prom_init().
......
This diff is collapsed.
......@@ -40,6 +40,7 @@
#include <asm/time.h>
#include <asm/cputable.h>
#include <asm/sections.h>
#include <asm/nvram.h>
extern unsigned long klimit;
/* extern void *stab; */
......@@ -261,6 +262,8 @@ void setup_system(unsigned long r3, unsigned long r4, unsigned long r5,
void machine_restart(char *cmd)
{
if (ppc_md.nvram_sync)
ppc_md.nvram_sync();
ppc_md.restart(cmd);
}
......@@ -268,6 +271,8 @@ EXPORT_SYMBOL(machine_restart);
void machine_power_off(void)
{
if (ppc_md.nvram_sync)
ppc_md.nvram_sync();
ppc_md.power_off();
}
......@@ -275,6 +280,8 @@ EXPORT_SYMBOL(machine_power_off);
void machine_halt(void)
{
if (ppc_md.nvram_sync)
ppc_md.nvram_sync();
ppc_md.halt();
}
......
......@@ -94,6 +94,9 @@ struct machdep_calls {
ssize_t (*nvram_write)(char *buf, size_t count, loff_t *index);
ssize_t (*nvram_read)(char *buf, size_t count, loff_t *index);
ssize_t (*nvram_size)(void);
int (*nvram_sync)(void);
#ifdef CONFIG_SMP
/* functions for dealing with other cpus */
......
......@@ -38,12 +38,15 @@
#define NVRAM_SIG_OF 0x50 /* open firmware config */
#define NVRAM_SIG_FW 0x51 /* general firmware */
#define NVRAM_SIG_HW 0x52 /* hardware (VPD) */
#define NVRAM_SIG_FLIP 0x5a /* Apple flip/flop header */
#define NVRAM_SIG_APPL 0x5f /* Apple "system" (???) */
#define NVRAM_SIG_SYS 0x70 /* system env vars */
#define NVRAM_SIG_CFG 0x71 /* config data */
#define NVRAM_SIG_ELOG 0x72 /* error log */
#define NVRAM_SIG_VEND 0x7e /* vendor defined */
#define NVRAM_SIG_FREE 0x7f /* Free space */
#define NVRAM_SIG_OS 0xa0 /* OS defined */
#define NVRAM_SIG_PANIC 0xa1 /* Apple OSX "panic" */
/* If change this size, then change the size of NVNAME_LEN */
struct nvram_header {
......@@ -60,11 +63,53 @@ struct nvram_partition {
};
ssize_t pSeries_nvram_read(char *buf, size_t count, loff_t *index);
ssize_t pSeries_nvram_write(char *buf, size_t count, loff_t *index);
int nvram_write_error_log(char * buff, int length, unsigned int err_type);
int nvram_read_error_log(char * buff, int length, unsigned int * err_type);
int nvram_clear_error_log(void);
void nvram_print_partitions(char * label);
extern int nvram_write_error_log(char * buff, int length, unsigned int err_type);
extern int nvram_read_error_log(char * buff, int length, unsigned int * err_type);
extern int nvram_clear_error_log(void);
extern struct nvram_partition *nvram_find_partition(int sig, const char *name);
extern int pSeries_nvram_init(void);
extern int pmac_nvram_init(void);
/* PowerMac specific nvram stuffs */
enum {
pmac_nvram_OF, /* Open Firmware partition */
pmac_nvram_XPRAM, /* MacOS XPRAM partition */
pmac_nvram_NR /* MacOS Name Registry partition */
};
/* Return partition offset in nvram */
extern int pmac_get_partition(int partition);
/* Direct access to XPRAM on PowerMacs */
extern u8 pmac_xpram_read(int xpaddr);
extern void pmac_xpram_write(int xpaddr, u8 data);
/* Synchronize NVRAM */
extern int nvram_sync(void);
/* Some offsets in XPRAM */
#define PMAC_XPRAM_MACHINE_LOC 0xe4
#define PMAC_XPRAM_SOUND_VOLUME 0x08
/* Machine location structure in PowerMac XPRAM */
struct pmac_machine_location {
unsigned int latitude; /* 2+30 bit Fractional number */
unsigned int longitude; /* 2+30 bit Fractional number */
unsigned int delta; /* mix of GMT delta and DLS */
};
/*
* /dev/nvram ioctls
*
* Note that PMAC_NVRAM_GET_OFFSET is still supported, but is
* definitely obsolete. Do not use it if you can avoid it
*/
#define OBSOLETE_PMAC_NVRAM_GET_OFFSET \
_IOWR('p', 0x40, int)
#define IOC_NVRAM_GET_OFFSET _IOWR('p', 0x42, int) /* Get NVRAM partition offset */
#endif /* _PPC64_NVRAM_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment