62 #include <linux/kernel.h>
63 #include <linux/module.h>
64 #include <linux/string.h>
70 #include <asm/processor.h>
77 #define WIDE_FIRMWARE 0x1
78 #define NARROW_FIRMWARE 0x2
97 long real64_call(
unsigned long function, ...);
102 # define MEM_PDC (unsigned long)(PAGE0->mem_pdc_hi) << 32 | PAGE0->mem_pdc
103 # define mem_pdc_call(args...) unlikely(parisc_narrow_firmware) ? real32_call(MEM_PDC, args) : real64_call(MEM_PDC, args)
105 # define MEM_PDC (unsigned long)PAGE0->mem_pdc
106 # define mem_pdc_call(args...) real32_call(MEM_PDC, args)
117 static unsigned long f_extend(
unsigned long address)
120 if(
unlikely(parisc_narrow_firmware)) {
121 if((address & 0xff000000) == 0xf0000000)
122 return 0xf0f0f0f000000000
UL | (
u32)address;
124 if((address & 0xf0000000) == 0xf0000000)
139 static void convert_to_wide(
unsigned long *
addr)
143 unsigned int *
p = (
unsigned int *)addr;
145 if(
unlikely(parisc_narrow_firmware)) {
146 for(i = 31; i >= 0; --
i)
158 __pa(pdc_result), 0);
159 convert_to_wide(pdc_result);
160 if (pdc_result[0] != NARROW_FIRMWARE)
161 parisc_narrow_firmware = 0;
175 spin_unlock_irqrestore(&pdc_lock, flags);
196 if (spin_is_locked(&pdc_lock))
197 spin_unlock(&pdc_lock);
217 spin_unlock_irqrestore(&pdc_lock, flags);
243 spin_unlock_irqrestore(&pdc_lock, flags);
265 spin_unlock_irqrestore(&pdc_lock, flags);
282 spin_unlock_irqrestore(&pdc_lock, flags);
299 spin_unlock_irqrestore(&pdc_lock, flags);
332 spin_unlock_irqrestore(&pdc_lock, flags);
349 void *iodc_data,
unsigned int iodc_data_size)
360 spin_unlock_irqrestore(&pdc_lock, flags);
387 spin_unlock_irqrestore(&pdc_lock, flags);
403 long mod_index,
long addr_index)
410 mod_index, addr_index);
413 spin_unlock_irqrestore(&pdc_lock, flags);
434 spin_unlock_irqrestore(&pdc_lock, flags);
462 spin_unlock_irqrestore(&pdc_lock, flags);
486 spin_unlock_irqrestore(&pdc_lock, flags);
508 spin_unlock_irqrestore(&pdc_lock, flags);
534 spin_unlock_irqrestore(&pdc_lock, flags);
554 spin_unlock_irqrestore(&pdc_lock, flags);
575 spin_unlock_irqrestore(&pdc_lock, flags);
595 spin_unlock_irqrestore(&pdc_lock, flags);
626 spin_unlock_irqrestore(&pdc_lock, flags);
653 spin_unlock_irqrestore(&pdc_lock, flags);
679 spin_unlock_irqrestore(&pdc_lock, flags);
705 spin_unlock_irqrestore(&pdc_lock, flags);
728 spin_unlock_irqrestore(&pdc_lock, flags);
747 spin_unlock_irqrestore(&pdc_lock, flags);
766 spin_unlock_irqrestore(&pdc_lock, flags);
794 #define IS_SPROCKETS() (strlen(boot_cpu_data.pdc.sys_model_name) == 14 && \
795 strncmp(boot_cpu_data.pdc.sys_model_name, "9000/785", 8) == 0)
813 case 1: initiator->
factor = 50;
break;
814 case 2: initiator->
factor = 25;
break;
815 case 5: initiator->
factor = 12;
break;
816 case 25: initiator->
factor = 10;
break;
817 case 20: initiator->
factor = 12;
break;
818 case 40: initiator->
factor = 10;
break;
819 default: initiator->
factor = -1;
break;
826 initiator->
width = -1;
827 initiator->
mode = -1;
831 spin_unlock_irqrestore(&pdc_lock, flags);
833 return (retval >=
PDC_OK);
857 spin_unlock_irqrestore(&pdc_lock, flags);
876 BUG_ON((
unsigned long)tbl & 0x7);
882 spin_unlock_irqrestore(&pdc_lock, flags);
897 unsigned int pdc_pci_config_read(
void *
hpa,
unsigned long cfg_addr)
906 __pa(pdc_result), hpa, cfg_addr&~3
UL, 4
UL);
907 spin_unlock_irqrestore(&pdc_lock, flags);
909 return retval ? ~0 : (
unsigned int) pdc_result[0];
921 void pdc_pci_config_write(
void *hpa,
unsigned long cfg_addr,
unsigned int val)
929 __pa(pdc_result), hpa,
930 cfg_addr&~3
UL, 4
UL, (
unsigned long) val);
931 spin_unlock_irqrestore(&pdc_lock, flags);
952 spin_unlock_irqrestore(&pdc_lock, flags);
972 spin_unlock_irqrestore(&pdc_lock, flags);
979 int pdc_mem_mem_table(
struct pdc_memory_table_raddr *
r_addr,
980 struct pdc_memory_table *tbl,
unsigned long entries)
987 convert_to_wide(pdc_result);
988 memcpy(r_addr, pdc_result,
sizeof(*r_addr));
989 memcpy(tbl, pdc_result2, entries *
sizeof(*tbl));
990 spin_unlock_irqrestore(&pdc_lock, flags);
1003 unsigned long flags;
1008 spin_unlock_irqrestore(&pdc_lock, flags);
1021 unsigned long flags;
1025 spin_unlock_irqrestore(&pdc_lock, flags);
1039 unsigned long flags;
1041 *power_reg = (
unsigned long) (-1);
1049 spin_unlock_irqrestore(&pdc_lock, flags);
1068 unsigned long flags;
1072 spin_unlock_irqrestore(&pdc_lock, flags);
1084 unsigned long flags;
1088 spin_unlock_irqrestore(&pdc_lock, flags);
1102 unsigned long flags;
1106 spin_unlock_irqrestore(&pdc_lock, flags);
1126 unsigned long flags;
1128 for (i = 0; i <
count;) {
1131 iodc_dbuf[i+0] =
'\r';
1132 iodc_dbuf[i+1] =
'\n';
1136 iodc_dbuf[
i] = str[
i];
1147 __pa(iodc_retbuf), 0,
__pa(iodc_dbuf), i, 0);
1148 spin_unlock_irqrestore(&pdc_lock, flags);
1163 unsigned long flags;
1166 if (!
PAGE0->mem_kbd.iodc_io)
1174 __pa(iodc_retbuf), 0,
__pa(iodc_dbuf), 1, 0);
1177 status = *iodc_retbuf;
1178 spin_unlock_irqrestore(&pdc_lock, flags);
1187 unsigned long inptr,
unsigned long outputr,
1188 unsigned long glob_cfg)
1191 unsigned long irqflags;
1194 retval =
real32_call(func, flags, inptr, outputr, glob_cfg);
1195 spin_unlock_irqrestore(&pdc_lock, irqflags);
1212 unsigned long flags;
1216 memcpy(cell_info, pdc_result,
sizeof(*cell_info));
1217 spin_unlock_irqrestore(&pdc_lock, flags);
1234 unsigned long view_type,
void *mem_addr)
1237 unsigned long flags;
1247 spin_unlock_irqrestore(&pdc_lock, flags);
1262 unsigned long flags;
1266 __pa(&pdc_result), hpa);
1267 memcpy(cpu_info, pdc_result,
sizeof(*cpu_info));
1268 spin_unlock_irqrestore(&pdc_lock, flags);
1284 unsigned long flags;
1288 __pa(pdc_result), cell_num);
1290 spin_unlock_irqrestore(&pdc_lock, flags);
1305 unsigned long flags;
1309 __pa(r_addr), cell_num);
1310 spin_unlock_irqrestore(&pdc_lock, flags);
1324 unsigned long count,
unsigned long offset)
1327 unsigned long flags;
1331 __pa(pdc_result2), count, offset);
1333 memcpy(mem_addr, pdc_result2, *actual_len);
1334 spin_unlock_irqrestore(&pdc_lock, flags);
1349 unsigned long flags;
1353 __pa(pdc_result), pci_addr, pci_size);
1359 spin_unlock_irqrestore(&pdc_lock, flags);
1375 unsigned long flags;
1379 pci_addr, pci_size, val);
1380 spin_unlock_irqrestore(&pdc_lock, flags);
1418 extern unsigned long real32_call_asm(
unsigned int *,
1423 real_stack.
arg0 =
va_arg(args,
unsigned int);
1424 real_stack.
arg1 =
va_arg(args,
unsigned int);
1425 real_stack.
arg2 =
va_arg(args,
unsigned int);
1426 real_stack.
arg3 =
va_arg(args,
unsigned int);
1427 real_stack.
arg4 =
va_arg(args,
unsigned int);
1428 real_stack.
arg5 =
va_arg(args,
unsigned int);
1429 real_stack.
arg6 =
va_arg(args,
unsigned int);
1430 real_stack.
arg7 =
va_arg(args,
unsigned int);
1431 real_stack.
arg8 =
va_arg(args,
unsigned int);
1432 real_stack.
arg9 =
va_arg(args,
unsigned int);
1439 return real32_call_asm(&real_stack.
sp, &real_stack.
arg0, fn);
1456 unsigned long arg10;
1457 unsigned long arg11;
1458 unsigned long arg12;
1459 unsigned long arg13;
1460 unsigned long frame_marker[2];
1465 long real64_call(
unsigned long fn, ...)
1468 extern struct wide_stack real64_stack;
1469 extern unsigned long real64_call_asm(
unsigned long *,
1474 real64_stack.arg0 =
va_arg(args,
unsigned long);
1475 real64_stack.arg1 =
va_arg(args,
unsigned long);
1476 real64_stack.arg2 =
va_arg(args,
unsigned long);
1477 real64_stack.arg3 =
va_arg(args,
unsigned long);
1478 real64_stack.arg4 =
va_arg(args,
unsigned long);
1479 real64_stack.arg5 =
va_arg(args,
unsigned long);
1480 real64_stack.arg6 =
va_arg(args,
unsigned long);
1481 real64_stack.arg7 =
va_arg(args,
unsigned long);
1482 real64_stack.arg8 =
va_arg(args,
unsigned long);
1483 real64_stack.arg9 =
va_arg(args,
unsigned long);
1484 real64_stack.arg10 =
va_arg(args,
unsigned long);
1485 real64_stack.arg11 =
va_arg(args,
unsigned long);
1486 real64_stack.arg12 =
va_arg(args,
unsigned long);
1487 real64_stack.arg13 =
va_arg(args,
unsigned long);
1490 return real64_call_asm(&real64_stack.sp, &real64_stack.arg0, fn);