linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / arch / powerpc / platforms / powermac / nvram.c
index 692945c..3ebd045 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ *  arch/ppc/platforms/pmac_nvram.c
+ *
  *  Copyright (C) 2002 Benjamin Herrenschmidt (benh@kernel.crashing.org)
  *
  *  This program is free software; you can redistribute it and/or
@@ -8,6 +10,7 @@
  *
  *  Todo: - add support for the OF persistent properties
  */
+#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/stddef.h>
@@ -29,8 +32,6 @@
 #include <asm/machdep.h>
 #include <asm/nvram.h>
 
-#include "pmac.h"
-
 #define DEBUG
 
 #ifdef DEBUG
@@ -75,13 +76,16 @@ struct core99_header {
  * Read and write the non-volatile RAM on PowerMacs and CHRP machines.
  */
 static int nvram_naddrs;
-static volatile unsigned char __iomem *nvram_data;
+static volatile unsigned char *nvram_data;
 static int is_core_99;
 static int core99_bank = 0;
 static int nvram_partitions[3];
 // XXX Turn that into a sem
 static DEFINE_SPINLOCK(nv_lock);
 
+extern int pmac_newworld;
+extern int system_running;
+
 static int (*core99_write_bank)(int bank, u8* datas);
 static int (*core99_erase_bank)(int bank);
 
@@ -146,7 +150,7 @@ static ssize_t core99_nvram_size(void)
 }
 
 #ifdef CONFIG_PPC32
-static volatile unsigned char __iomem *nvram_addr;
+static volatile unsigned char *nvram_addr;
 static int nvram_mult;
 
 static unsigned char direct_nvram_read_byte(int addr)
@@ -195,7 +199,7 @@ static void pmu_nvram_complete(struct adb_request *req)
 static unsigned char pmu_nvram_read_byte(int addr)
 {
        struct adb_request req;
-       DECLARE_COMPLETION_ONSTACK(req_complete);
+       DECLARE_COMPLETION(req_complete); 
        
        req.arg = system_state == SYSTEM_RUNNING ? &req_complete : NULL;
        if (pmu_request(&req, pmu_nvram_complete, 3, PMU_READ_NVRAM,
@@ -211,7 +215,7 @@ static unsigned char pmu_nvram_read_byte(int addr)
 static void pmu_nvram_write_byte(int addr, unsigned char val)
 {
        struct adb_request req;
-       DECLARE_COMPLETION_ONSTACK(req_complete);
+       DECLARE_COMPLETION(req_complete); 
        
        req.arg = system_state == SYSTEM_RUNNING ? &req_complete : NULL;
        if (pmu_request(&req, pmu_nvram_complete, 4, PMU_WRITE_NVRAM,
@@ -283,7 +287,7 @@ static int sm_erase_bank(int bank)
        int stat, i;
        unsigned long timeout;
 
-       u8 __iomem *base = (u8 __iomem *)nvram_data + core99_bank*NVRAM_SIZE;
+       u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
 
                DBG("nvram: Sharp/Micron Erasing bank %d...\n", bank);
 
@@ -315,7 +319,7 @@ static int sm_write_bank(int bank, u8* datas)
        int i, stat = 0;
        unsigned long timeout;
 
-       u8 __iomem *base = (u8 __iomem *)nvram_data + core99_bank*NVRAM_SIZE;
+       u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
 
                DBG("nvram: Sharp/Micron Writing bank %d...\n", bank);
 
@@ -350,7 +354,7 @@ static int amd_erase_bank(int bank)
        int i, stat = 0;
        unsigned long timeout;
 
-       u8 __iomem *base = (u8 __iomem *)nvram_data + core99_bank*NVRAM_SIZE;
+       u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
 
                DBG("nvram: AMD Erasing bank %d...\n", bank);
 
@@ -397,7 +401,7 @@ static int amd_write_bank(int bank, u8* datas)
        int i, stat = 0;
        unsigned long timeout;
 
-       u8 __iomem *base = (u8 __iomem *)nvram_data + core99_bank*NVRAM_SIZE;
+       u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
 
                DBG("nvram: AMD Writing bank %d...\n", bank);
 
@@ -595,7 +599,7 @@ int __init pmac_nvram_init(void)
        }
 
 #ifdef CONFIG_PPC32
-       if (machine_is(chrp) && nvram_naddrs == 1) {
+       if (_machine == _MACH_chrp && nvram_naddrs == 1) {
                nvram_data = ioremap(r1.start, s1);
                nvram_mult = 1;
                ppc_md.nvram_read_val   = direct_nvram_read_byte;