Skip to content

Commit

Permalink
powerpc/nvram: Move things out of asm/nvram.h
Browse files Browse the repository at this point in the history
This moves a bunch of definitions out of asm/nvram.h to the files
that use them or just outright remove completely unused stuff.

We leave the partition signatures definitions, they will be useful

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Benjamin Herrenschmidt committed Nov 30, 2010
1 parent f2e785e commit 74d51d0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 41 deletions.
42 changes: 2 additions & 40 deletions arch/powerpc/include/asm/nvram.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,7 @@
#ifndef _ASM_POWERPC_NVRAM_H
#define _ASM_POWERPC_NVRAM_H

#include <linux/errno.h>

#define NVRW_CNT 0x20
#define NVRAM_HEADER_LEN 16 /* sizeof(struct nvram_header) */
#define NVRAM_BLOCK_LEN 16
#define NVRAM_MAX_REQ (2080/NVRAM_BLOCK_LEN)
#define NVRAM_MIN_REQ (1056/NVRAM_BLOCK_LEN)

#define NVRAM_AS0 0x74
#define NVRAM_AS1 0x75
#define NVRAM_DATA 0x77


/* RTC Offsets */

#define MOTO_RTC_SECONDS 0x1FF9
#define MOTO_RTC_MINUTES 0x1FFA
#define MOTO_RTC_HOURS 0x1FFB
#define MOTO_RTC_DAY_OF_WEEK 0x1FFC
#define MOTO_RTC_DAY_OF_MONTH 0x1FFD
#define MOTO_RTC_MONTH 0x1FFE
#define MOTO_RTC_YEAR 0x1FFF
#define MOTO_RTC_CONTROLA 0x1FF8
#define MOTO_RTC_CONTROLB 0x1FF9

/* Signatures for nvram partitions */
#define NVRAM_SIG_SP 0x02 /* support processor */
#define NVRAM_SIG_OF 0x50 /* open firmware config */
#define NVRAM_SIG_FW 0x51 /* general firmware */
Expand All @@ -49,25 +25,11 @@
#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 {
unsigned char signature;
unsigned char checksum;
unsigned short length;
char name[12];
};

#ifdef __KERNEL__

#include <linux/errno.h>
#include <linux/list.h>

struct nvram_partition {
struct list_head partition;
struct nvram_header header;
unsigned int index;
};


extern int nvram_write_error_log(char * buff, int length,
unsigned int err_type, unsigned int err_seq);
extern int nvram_read_error_log(char * buff, int length,
Expand Down
21 changes: 20 additions & 1 deletion arch/powerpc/kernel/nvram_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,25 @@

#undef DEBUG_NVRAM

#define NVRAM_HEADER_LEN 16 /* sizeof(struct nvram_header) */
#define NVRAM_BLOCK_LEN 16
#define NVRAM_MAX_REQ (2080/NVRAM_BLOCK_LEN)
#define NVRAM_MIN_REQ (1056/NVRAM_BLOCK_LEN)

/* If change this size, then change the size of NVNAME_LEN */
struct nvram_header {
unsigned char signature;
unsigned char checksum;
unsigned short length;
char name[12];
};

struct nvram_partition {
struct list_head partition;
struct nvram_header header;
unsigned int index;
};

static struct nvram_partition * nvram_part;
static long nvram_error_log_index = -1;
static long nvram_error_log_size = 0;
Expand Down Expand Up @@ -432,7 +451,7 @@ static int __init nvram_setup_partition(void)
}

/* try creating a partition with the free space we have */
rc = nvram_create_os_partition();
rc = nvram_create_partition("ppc64,linux", );
if (!rc) {
return 0;
}
Expand Down
4 changes: 4 additions & 0 deletions arch/powerpc/platforms/chrp/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@

extern spinlock_t rtc_lock;

#define NVRAM_AS0 0x74
#define NVRAM_AS1 0x75
#define NVRAM_DATA 0x77

static int nvram_as1 = NVRAM_AS1;
static int nvram_as0 = NVRAM_AS0;
static int nvram_data = NVRAM_DATA;
Expand Down
2 changes: 2 additions & 0 deletions arch/powerpc/platforms/pseries/nvram.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ static int nvram_fetch, nvram_store;
static char nvram_buf[NVRW_CNT]; /* assume this is in the first 4GB */
static DEFINE_SPINLOCK(nvram_lock);

/* Max bytes to read/write in one go */
#define NVRW_CNT 0x20

static ssize_t pSeries_nvram_read(char *buf, size_t count, loff_t *index)
{
Expand Down

0 comments on commit 74d51d0

Please sign in to comment.