aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2017-08-20 04:52:22 -0400
committerHelge Deller <deller@gmx.de>2017-08-22 10:34:35 -0400
commitf5213b2c40f5749e6b9b8f737ea946495ed0a438 (patch)
treede97da492124e3c3bc9324773efee160ac814ed3
parent2f3c7b8137ef6a3f90850d7cb5dbd05d8940403a (diff)
parisc: Make existing core files reuseable for bootloader
Signed-off-by: Helge Deller <deller@gmx.de>
-rw-r--r--arch/parisc/include/asm/page.h4
-rw-r--r--arch/parisc/include/asm/pdc.h2
-rw-r--r--arch/parisc/kernel/firmware.c15
-rw-r--r--arch/parisc/kernel/real2.S4
4 files changed, 24 insertions, 1 deletions
diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h
index 80e742a1c162..bfed09d80bae 100644
--- a/arch/parisc/include/asm/page.h
+++ b/arch/parisc/include/asm/page.h
@@ -116,11 +116,15 @@ extern int npmem_ranges;
116/* This governs the relationship between virtual and physical addresses. 116/* This governs the relationship between virtual and physical addresses.
117 * If you alter it, make sure to take care of our various fixed mapping 117 * If you alter it, make sure to take care of our various fixed mapping
118 * segments in fixmap.h */ 118 * segments in fixmap.h */
119#if defined(BOOTLOADER)
120#define __PAGE_OFFSET (0) /* bootloader uses physical addresses */
121#else
119#ifdef CONFIG_64BIT 122#ifdef CONFIG_64BIT
120#define __PAGE_OFFSET (0x40000000) /* 1GB */ 123#define __PAGE_OFFSET (0x40000000) /* 1GB */
121#else 124#else
122#define __PAGE_OFFSET (0x10000000) /* 256MB */ 125#define __PAGE_OFFSET (0x10000000) /* 256MB */
123#endif 126#endif
127#endif /* BOOTLOADER */
124 128
125#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) 129#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
126 130
diff --git a/arch/parisc/include/asm/pdc.h b/arch/parisc/include/asm/pdc.h
index 7569627a032b..26b4455baa83 100644
--- a/arch/parisc/include/asm/pdc.h
+++ b/arch/parisc/include/asm/pdc.h
@@ -5,6 +5,8 @@
5 5
6#if !defined(__ASSEMBLY__) 6#if !defined(__ASSEMBLY__)
7 7
8extern int parisc_narrow_firmware;
9
8extern int pdc_type; 10extern int pdc_type;
9extern unsigned long parisc_cell_num; /* cell number the CPU runs on (PAT) */ 11extern unsigned long parisc_cell_num; /* cell number the CPU runs on (PAT) */
10extern unsigned long parisc_cell_loc; /* cell location of CPU (PAT) */ 12extern unsigned long parisc_cell_loc; /* cell location of CPU (PAT) */
diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
index be9a2e89e90f..ab80e5c6f651 100644
--- a/arch/parisc/kernel/firmware.c
+++ b/arch/parisc/kernel/firmware.c
@@ -69,7 +69,15 @@
69#include <asm/pdcpat.h> 69#include <asm/pdcpat.h>
70#include <asm/processor.h> /* for boot_cpu_data */ 70#include <asm/processor.h> /* for boot_cpu_data */
71 71
72#if defined(BOOTLOADER)
73# undef spin_lock_irqsave
74# define spin_lock_irqsave(a, b) { b = 1; }
75# undef spin_unlock_irqrestore
76# define spin_unlock_irqrestore(a, b)
77#else
72static DEFINE_SPINLOCK(pdc_lock); 78static DEFINE_SPINLOCK(pdc_lock);
79#endif
80
73extern unsigned long pdc_result[NUM_PDC_RESULT]; 81extern unsigned long pdc_result[NUM_PDC_RESULT];
74extern unsigned long pdc_result2[NUM_PDC_RESULT]; 82extern unsigned long pdc_result2[NUM_PDC_RESULT];
75 83
@@ -186,6 +194,8 @@ void set_firmware_width(void)
186} 194}
187#endif /*CONFIG_64BIT*/ 195#endif /*CONFIG_64BIT*/
188 196
197
198#if !defined(BOOTLOADER)
189/** 199/**
190 * pdc_emergency_unlock - Unlock the linux pdc lock 200 * pdc_emergency_unlock - Unlock the linux pdc lock
191 * 201 *
@@ -1149,6 +1159,8 @@ void pdc_io_reset_devices(void)
1149 spin_unlock_irqrestore(&pdc_lock, flags); 1159 spin_unlock_irqrestore(&pdc_lock, flags);
1150} 1160}
1151 1161
1162#endif /* defined(BOOTLOADER) */
1163
1152/* locked by pdc_console_lock */ 1164/* locked by pdc_console_lock */
1153static int __attribute__((aligned(8))) iodc_retbuf[32]; 1165static int __attribute__((aligned(8))) iodc_retbuf[32];
1154static char __attribute__((aligned(64))) iodc_dbuf[4096]; 1166static char __attribute__((aligned(64))) iodc_dbuf[4096];
@@ -1193,6 +1205,7 @@ print:
1193 return i; 1205 return i;
1194} 1206}
1195 1207
1208#if !defined(BOOTLOADER)
1196/** 1209/**
1197 * pdc_iodc_getc - Read a character (non-blocking) from the PDC console. 1210 * pdc_iodc_getc - Read a character (non-blocking) from the PDC console.
1198 * 1211 *
@@ -1555,6 +1568,7 @@ int pdc_pat_mem_get_dimm_phys_location(
1555 return retval; 1568 return retval;
1556} 1569}
1557#endif /* CONFIG_64BIT */ 1570#endif /* CONFIG_64BIT */
1571#endif /* defined(BOOTLOADER) */
1558 1572
1559 1573
1560/***************** 32-bit real-mode calls ***********/ 1574/***************** 32-bit real-mode calls ***********/
@@ -1664,4 +1678,3 @@ long real64_call(unsigned long fn, ...)
1664} 1678}
1665 1679
1666#endif /* CONFIG_64BIT */ 1680#endif /* CONFIG_64BIT */
1667
diff --git a/arch/parisc/kernel/real2.S b/arch/parisc/kernel/real2.S
index 1db58e546230..cc9963421a19 100644
--- a/arch/parisc/kernel/real2.S
+++ b/arch/parisc/kernel/real2.S
@@ -162,6 +162,7 @@ ENDPROC_CFI(restore_control_regs)
162 .text 162 .text
163 .align 128 163 .align 128
164ENTRY_CFI(rfi_virt2real) 164ENTRY_CFI(rfi_virt2real)
165#if !defined(BOOTLOADER)
165 /* switch to real mode... */ 166 /* switch to real mode... */
166 rsm PSW_SM_I,%r0 167 rsm PSW_SM_I,%r0
167 load32 PA(rfi_v2r_1), %r1 168 load32 PA(rfi_v2r_1), %r1
@@ -191,6 +192,7 @@ ENTRY_CFI(rfi_virt2real)
191 nop 192 nop
192rfi_v2r_1: 193rfi_v2r_1:
193 tophys_r1 %r2 194 tophys_r1 %r2
195#endif /* defined(BOOTLOADER) */
194 bv 0(%r2) 196 bv 0(%r2)
195 nop 197 nop
196ENDPROC_CFI(rfi_virt2real) 198ENDPROC_CFI(rfi_virt2real)
@@ -198,6 +200,7 @@ ENDPROC_CFI(rfi_virt2real)
198 .text 200 .text
199 .align 128 201 .align 128
200ENTRY_CFI(rfi_real2virt) 202ENTRY_CFI(rfi_real2virt)
203#if !defined(BOOTLOADER)
201 rsm PSW_SM_I,%r0 204 rsm PSW_SM_I,%r0
202 load32 (rfi_r2v_1), %r1 205 load32 (rfi_r2v_1), %r1
203 nop 206 nop
@@ -226,6 +229,7 @@ ENTRY_CFI(rfi_real2virt)
226 nop 229 nop
227rfi_r2v_1: 230rfi_r2v_1:
228 tovirt_r1 %r2 231 tovirt_r1 %r2
232#endif /* defined(BOOTLOADER) */
229 bv 0(%r2) 233 bv 0(%r2)
230 nop 234 nop
231ENDPROC_CFI(rfi_real2virt) 235ENDPROC_CFI(rfi_real2virt)