In the never ending story of "encoding of diag instructions is hard, let's go shopping" (as shown by at least rev 1.65, 1.66 and 1.189 of hppa locore.S), the following diff attempts to clean and fix things for good: - macros get a cpu-family suffix, since encoding differ accross processor families. - source of the information, when known, is mentioned. - two unused routines get removed.
This does not change anything in the object code, as the remaining wrong encodings were only used in pbtlb_l which has not been used for ages. Index: hppa/locore.S =================================================================== RCS file: /OpenBSD/src/sys/arch/hppa/hppa/locore.S,v retrieving revision 1.199 diff -u -p -r1.199 locore.S --- hppa/locore.S 16 Jul 2017 22:47:37 -0000 1.199 +++ hppa/locore.S 15 Nov 2018 20:25:21 -0000 @@ -76,16 +76,23 @@ #include "assym.h" /* - * hv-specific instructions + * hw-specific instructions */ -#define DR_PAGE0 .word 0x14001200 -#define DR_PAGE1 .word 0x14001240 -#define MTCPU_T(x,t) .word 0x14001600 | ((t) << 21) | ((x) << 16) -#define MFCPU_T(r,x) .word 0x14001a00 | ((r) << 21) | ((x) << 16) -#define MTCPU_C(x,t) .word 0x14000240 | ((t) << 21) | ((x) << 16) -#define MFCPU_C(r,x) .word 0x14000600 | ((r) << 21) | ((x) << 16) -#define MFCPU_U(r,x) .word 0x140008a0 | ((r) << 21) | ((x)) -#define MTCPU_U(x,r) .word 0x14001840 | ((r) << 21) | ((x) << 16) + +/* source: mklinux cache.s */ +#define MFCPU_C_PCXST(r,x) .word 0x14001a00 | ((r) << 21) | ((x) << 16) +#define MTCPU_PCXST(x,r) .word 0x14001600 | ((r) << 21) | ((x) << 16) + +/* source: PCXL and PCXL2 ERS */ +/* Use MFCPU_C for DR0-8; MFCPU_T for DR25,27,28,29 */ +#define MFCPU_C_PCXL(r,x) .word 0x14000600 | ((r) << 21) | ((x) << 16) +#define MFCPU_T_PCXL(r,x) .word 0x14001800 | ((r) << 21) | ((x)) +#define MTCPU_PCXL(x,r) .word 0x14000240 | ((r) << 21) | ((x) << 16) +#define DR_PAGE0_PCXL .word 0x14000e00 +#define DR_PAGE1_PCXL .word 0x14000e40 + +#define MFCPU_PCXU(r,x) .word 0x140008a0 | ((r) << 21) | ((x)) +#define MTCPU_PCXU(x,r) .word 0x14001840 | ((r) << 21) | ((x) << 16) .import $global$, data .import pdc, data @@ -1646,8 +1653,8 @@ EXIT(TLABEL(all)) */ LEAF_ENTRY(desidhash_s) sync - MFCPU_T(DR_CPUCFG,22) /* t1 */ - MFCPU_T(DR_CPUCFG,22) + MFCPU_C_PCXST(DR_CPUCFG,22) /* t1 */ + MFCPU_C_PCXST(DR_CPUCFG,22) nop nop depi 0, DR0_PCXS_DHE, 3, t1 /* 3: DR0_PCXS_DOMAIN|DR0_PCXS_IHE */ @@ -1656,8 +1663,8 @@ LEAF_ENTRY(desidhash_s) depi 0, DR0_PCXS_DHPMC, 1, t1 depi 0, DR0_PCXS_ILPMC, 1, t1 sync - MTCPU_T(22,DR_CPUCFG) - MTCPU_T(22,DR_CPUCFG) + MTCPU_PCXST(22,DR_CPUCFG) + MTCPU_PCXST(22,DR_CPUCFG) nop nop bv 0(rp) @@ -1671,8 +1678,8 @@ EXIT(desidhash_s) */ LEAF_ENTRY(desidhash_t) sync - MFCPU_T(DR_CPUCFG,22) /* t1 */ - MFCPU_T(DR_CPUCFG,22) + MFCPU_C_PCXST(DR_CPUCFG,22) /* t1 */ + MFCPU_C_PCXST(DR_CPUCFG,22) nop nop depi 0, DR0_PCXT_IHE, 1, t1 @@ -1681,8 +1688,8 @@ LEAF_ENTRY(desidhash_t) depi 0, DR0_PCXT_DHPMC, 1, t1 depi 0, DR0_PCXT_ILPMC, 1, t1 sync - MTCPU_T(22,DR_CPUCFG) - MTCPU_T(22,DR_CPUCFG) + MTCPU_PCXST(22,DR_CPUCFG) + MTCPU_PCXST(22,DR_CPUCFG) nop nop bv 0(rp) @@ -1697,7 +1704,7 @@ LEAF_ENTRY(eaio_l2) ldil L%eaio_l2_mask, t2 ldw R%eaio_l2_mask(t2), t1 or t1, arg0, t1 - MTCPU_C(22, DR0_PCXL2_ACCEL_IO) + MTCPU_PCXL(22, DR0_PCXL2_ACCEL_IO) nop nop bv 0(rp) @@ -1719,54 +1726,11 @@ LEAF_ENTRY(ibtlb_l) mtsm t4 EXIT(ibtlb_l) -/* hpti_l(addr,size) */ -LEAF_ENTRY(hpti_l) - ldo -1(arg1), arg1 - depi 0, 31, 12, arg1 - ldi 0x1c0, t1 /* cache size assumed 128k XXX */ - or arg0, t1, arg0 - sync - MTCPU_C(26,DR0_PCXL2_HTLB_ADDR) - MTCPU_C(25,DR0_PCXL2_HTLB_CFG) - nop - nop - bv,n r0(rp) - nop -EXIT(hpti_l) - -/* - * int - * pbtlb_l(int i) - */ -LEAF_ENTRY(pbtlb_l) - ; DR_PAGE0 - rsm (PSL_R|PSL_I), t4 - nop ! nop ! nop ! nop - ldil L%0xc041, t1 - ldo R%0xc041(t1), t1 - dep arg0, 30, 3, t1 - sync - MTCPU_T(22,DR_DTLB) /* t1 */ - nop - nop - mtsp r0, sr1 - idtlba r0,(sr1,r0) - idtlbp r0,(sr1,r0) - zdepi -1, 18, 1, t1 - nop - sync - MTCPU_T(22,DR_DTLB) - nop - nop - bv 0(rp) - mtsm t4 -EXIT(pbtlb_l) - /* * int desidhash_l(void) */ LEAF_ENTRY(desidhash_l) - MFCPU_C(DR_CPUCFG,22) /* t1 */ + MFCPU_C_PCXL(DR_CPUCFG,22) /* t1 */ nop nop depi 0, DR0_PCXL_L2IHASH_EN, 2, t1 /* 2: DR0_PCXL_L2DHASH_EN */ @@ -1779,7 +1743,7 @@ LEAF_ENTRY(desidhash_l) depi 0, DR0_PCXL_L1IHPMC, 1, t1 depi 0, DR0_PCXL_L2PARERR, 4, t1 sync - MTCPU_C(22,DR_CPUCFG) + MTCPU_PCXL(22,DR_CPUCFG) nop nop bv 0(rp) @@ -1791,9 +1755,9 @@ EXIT(desidhash_l) #if defined(HP8000_CPU) || defined(HP8200_CPU) || defined(HP8500_CPU) .level 2.0w LEAF_ENTRY(desidhash_u) - MFCPU_U(2,28) + MFCPU_PCXU(2,28) depdi 0, 54, 1, r28 - MTCPU_U(28,2) + MTCPU_PCXU(28,2) bv r0(rp) copy r0, ret0 /* XXX dunno how to get chip rev */ EXIT(desidhash_u) Index: hppa/machdep.c =================================================================== RCS file: /OpenBSD/src/sys/arch/hppa/hppa/machdep.c,v retrieving revision 1.254 diff -u -p -r1.254 machdep.c --- hppa/machdep.c 20 Jul 2018 01:30:30 -0000 1.254 +++ hppa/machdep.c 15 Nov 2018 20:25:21 -0000 @@ -191,8 +191,6 @@ int ibtlb_g(int i, pa_space_t sp, vaddr_ vsize_t sz, u_int prot); int pbtlb_g(int i); int pbtlb_u(int i); -int hpti_l(vaddr_t, vsize_t); -int hpti_u(vaddr_t, vsize_t); int hpti_g(vaddr_t, vsize_t); int desidhash_s(void); int desidhash_t(void);