diff options
author | Kenji Aoyama <aoyama@cvs.openbsd.org> | 2022-05-19 12:56:00 +0000 |
---|---|---|
committer | Kenji Aoyama <aoyama@cvs.openbsd.org> | 2022-05-19 12:56:00 +0000 |
commit | 7f5b69cbdbefb69b9fe3b609156985756375cc3d (patch) | |
tree | 3cb8063d1d6c5317e7fbd25c9db692f38f637b18 /sys/arch/luna88k | |
parent | bc2cbea453e7e23342bafa05f87ba94de9f058f1 (diff) |
Now MULTIPROCESSOR kernel boots with CPU modules installed in
arbitrary slots.
Plamen Mihaylov's LUNA-88K2 originally has 2 CPU modules in slot #0
and #2, but MULTIPROCESSOR kernel panics because they are not placed
in contiguous slots. This diff fixes it.
Original diff from miod@, tested by Plamen Mihaylov and me.
Diffstat (limited to 'sys/arch/luna88k')
-rw-r--r-- | sys/arch/luna88k/luna88k/m8820x.c | 68 |
1 files changed, 42 insertions, 26 deletions
diff --git a/sys/arch/luna88k/luna88k/m8820x.c b/sys/arch/luna88k/luna88k/m8820x.c index 3b6d10b6b6d..7b1f50f60c4 100644 --- a/sys/arch/luna88k/luna88k/m8820x.c +++ b/sys/arch/luna88k/luna88k/m8820x.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m8820x.c,v 1.17 2022/03/05 06:59:12 aoyama Exp $ */ +/* $OpenBSD: m8820x.c,v 1.18 2022/05/19 12:55:59 aoyama Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. * @@ -93,41 +93,57 @@ #include <machine/m8820x.h> /* - * This routine sets up the CPU/CMMU configuration. + * Probe a pair of CMMU addresses to discover the presence of a CPU slot. */ -void -m8820x_setup_board_config() +int +m8820x_probe_cmmus(uint32_t icmmu, uint32_t dcmmu) { - struct m8820x_cmmu *cmmu; - u_int num; - - m8820x_cmmu[0].cmmu_regs = (void *)CMMU_I0; - m8820x_cmmu[1].cmmu_regs = (void *)CMMU_D0; - m8820x_cmmu[2].cmmu_regs = (void *)CMMU_I1; - m8820x_cmmu[3].cmmu_regs = (void *)CMMU_D1; - m8820x_cmmu[4].cmmu_regs = (void *)CMMU_I2; - m8820x_cmmu[5].cmmu_regs = (void *)CMMU_D2; - m8820x_cmmu[6].cmmu_regs = (void *)CMMU_I3; - m8820x_cmmu[7].cmmu_regs = (void *)CMMU_D3; - /* - * Probe CMMU address to discover which CPU slots are populated. * On the luna88k, badaddr() returns 'good' on unpopulated slots, * so we check the CMMU type value for each CMMU register address. */ - cmmu = m8820x_cmmu; + int type; + volatile uint32_t* icmmuregs = (volatile uint32_t *)icmmu; + volatile uint32_t* dcmmuregs = (volatile uint32_t *)dcmmu; - for (num = 0; num < 8; num++) { - volatile unsigned *cr = m8820x_cmmu[num].cmmu_regs; - int type; + type = CMMU_TYPE(icmmuregs[CMMU_IDR]); + if (type != M88200_ID && type != M88204_ID) + return 0; - type = CMMU_TYPE(cr[CMMU_IDR]); - if (type != M88200_ID && type != M88204_ID) - break; + type = CMMU_TYPE(dcmmuregs[CMMU_IDR]); + if (type != M88200_ID && type != M88204_ID) + return 0; + + return 1; +} + +/* + * This routine sets up the CPU/CMMU configuration. + */ +void +m8820x_setup_board_config() +{ + u_int pos = 0; + + if (m8820x_probe_cmmus(CMMU_I0, CMMU_D0) != 0) { + m8820x_cmmu[pos++].cmmu_regs = (void *)CMMU_I0; + m8820x_cmmu[pos++].cmmu_regs = (void *)CMMU_D0; + } + if (m8820x_probe_cmmus(CMMU_I1, CMMU_D1) != 0) { + m8820x_cmmu[pos++].cmmu_regs = (void *)CMMU_I1; + m8820x_cmmu[pos++].cmmu_regs = (void *)CMMU_D1; + } + if (m8820x_probe_cmmus(CMMU_I2, CMMU_D2) != 0) { + m8820x_cmmu[pos++].cmmu_regs = (void *)CMMU_I2; + m8820x_cmmu[pos++].cmmu_regs = (void *)CMMU_D2; + } + if (m8820x_probe_cmmus(CMMU_I3, CMMU_D3) != 0) { + m8820x_cmmu[pos++].cmmu_regs = (void *)CMMU_I3; + m8820x_cmmu[pos++].cmmu_regs = (void *)CMMU_D3; } - ncpusfound = num >> 1; - max_cmmus = ncpusfound << 1; + ncpusfound = pos >> 1; + max_cmmus = pos; cmmu_shift = 1; /* fixed 2:1 configuration */ #ifdef M8820X_DEBUG |