Re: CVS commit: src/sys/arch/arm/sa11x0
On 2021/11/09 8:57, Rin Okuyama wrote: Module Name:src Committed By: rin Date: Mon Nov 8 23:57:23 UTC 2021 Modified Files: src/sys/arch/arm/sa11x0: sa11x0_irq.S Log Message: irq_entry(): Do not clobber fp (= r11), in order not to confuse DDB. (snip) XXX Rewrite this function by C. There seems no particular reason to use assembler, and no major performance regression is expected. No reason to use assembler, if converted to use arm/arm32/irq_dispatch.S. Thanks, rin
CVS commit: src/sys/arch/arm/sa11x0
Module Name:src Committed By: rin Date: Mon Nov 8 23:57:23 UTC 2021 Modified Files: src/sys/arch/arm/sa11x0: sa11x0_irq.S Log Message: irq_entry(): Do not clobber fp (= r11), in order not to confuse DDB. Use r10 instead; no need to preserve saipic_base, previous content of r10, throughout this function, except for the case of INTR_DEBUG. For INTR_DEBUG, load saipic_base to scratch register every time it becomes necessary. This is no performance penalty compared with subsequent printf() calls. XXX Rewrite this function by C. There seems no particular reason to use assembler, and no major performance regression is expected. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/sa11x0/sa11x0_irq.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/sa11x0/sa11x0_irq.S diff -u src/sys/arch/arm/sa11x0/sa11x0_irq.S:1.20 src/sys/arch/arm/sa11x0/sa11x0_irq.S:1.21 --- src/sys/arch/arm/sa11x0/sa11x0_irq.S:1.20 Sat Nov 21 19:59:10 2020 +++ src/sys/arch/arm/sa11x0/sa11x0_irq.S Mon Nov 8 23:57:23 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sa11x0_irq.S,v 1.20 2020/11/21 19:59:10 skrll Exp $ */ +/* $NetBSD: sa11x0_irq.S,v 1.21 2021/11/08 23:57:23 rin Exp $ */ /* * Copyright (c) 1998 Mark Brinicombe. @@ -78,8 +78,7 @@ AST_ALIGNMENT_FAULT_LOCALS * r7 - pspr mode * r8 - Current IRQ requests. * r9 - Used to count through possible IRQ bits. - * r10 - Base address of SAIP - * r11 - Pointer to handler pointer list + * r10 - Pointer to handler pointer list */ ASENTRY_NP(irq_entry) @@ -90,13 +89,14 @@ ASENTRY_NP(irq_entry) /* Load r8 with the SAIPIC interrupt requests */ - ldr r10, _C_LABEL(saipic_base) - ldr r8, [r10, #(SAIPIC_IP)] /* Load IRQ pending register */ + ldr r8, _C_LABEL(saipic_base) + ldr r8, [r8, #(SAIPIC_IP)] /* Load IRQ pending register */ #ifdef INTR_DEBUG - ldr r2, [r10, #(SAIPIC_MR)] adr r0, Ldbg_str mov r1, r8 + ldr r2, _C_LABEL(saipic_base) + ldr r2, [r2, #(SAIPIC_MR)] bl _C_LABEL(printf) #endif /* @@ -124,17 +124,17 @@ ASENTRY_NP(irq_entry) */ mov r9, #(NIPL - 1) - ldr r11, Lspl_masks + ldr r10, Lspl_masks Lfind_highest_ipl: - ldr r2, [r11, r9, lsl #2] + ldr r2, [r10, r9, lsl #2] tst r8, r2 subeq r9, r9, #1 beq Lfind_highest_ipl /* r9 = SPL level of highest priority interrupt */ add r9, r9, #1 - ldr r2, [r11, r9, lsl #2] + ldr r2, [r10, r9, lsl #2] ldr r1, [r4, #CI_CPL] str r9, [r4, #CI_CPL] @@ -155,7 +155,7 @@ Lfind_highest_ipl: bic r0, r0, #I32_bit msr cpsr_all, r0 - ldr r11, Lirqhandlers + ldr r10, Lirqhandlers mov r9, #0x0001 irqloop: @@ -163,7 +163,7 @@ irqloop: tst r8, r9 /* Is a bit set ? */ beq nextirq /* No ? try next bit */ - ldr r6, [r11] /* Get address of first handler structure */ + ldr r6, [r10] /* Get address of first handler structure */ teq r6, #0x /* Do we have a handler */ moveq r0, r8 /* IRQ requests as arg 0 */ @@ -219,7 +219,7 @@ irqchainloop: irqdone: nextirq: - add r11, r11, #0x0004 /* update pointer to handlers */ + add r10, r10, #0x0004 /* update pointer to handlers */ mov r9, r9, lsl #1 /* move on to next bit */ teq r9, #(1 << 31) /* done the last bit ? */ bne irqloop /* no - loop back. */ @@ -238,7 +238,8 @@ nextirq: #ifdef INTR_DEBUG adr r0, Ldbg_str mov r1, #3 - ldr r2, [r10, #(SAIPIC_MR)] + ldr r2, _C_LABEL(saipic_base) + ldr r2, [r2, #(SAIPIC_MR)] bl _C_LABEL(printf) #endif
CVS commit: src/sys/arch/arm/sa11x0
Module Name:src Committed By: rin Date: Mon Nov 8 23:57:23 UTC 2021 Modified Files: src/sys/arch/arm/sa11x0: sa11x0_irq.S Log Message: irq_entry(): Do not clobber fp (= r11), in order not to confuse DDB. Use r10 instead; no need to preserve saipic_base, previous content of r10, throughout this function, except for the case of INTR_DEBUG. For INTR_DEBUG, load saipic_base to scratch register every time it becomes necessary. This is no performance penalty compared with subsequent printf() calls. XXX Rewrite this function by C. There seems no particular reason to use assembler, and no major performance regression is expected. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/sa11x0/sa11x0_irq.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/sa11x0
Module Name:src Committed By: tsutsui Date: Wed Nov 13 17:52:12 UTC 2019 Modified Files: src/sys/arch/arm/sa11x0: sa11x0_ost.c Log Message: Fix another attach failure of zaudio(4) WM8731 on Zaurus SL-C7x0/860. When kernels were configured for both CPU_XSCALE_PXA270 and CPU_XSCALE_PXA250, the OST freq value was not set until tc_init(9) then all delay(9) during configure(9) returned immediately. While here, use proper macro with description for readability. Should be pulled up to netbsd-8 and netbsd-9. (though zaudio(4) won't work on netbsd-8) To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/arm/sa11x0/sa11x0_ost.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/sa11x0/sa11x0_ost.c diff -u src/sys/arch/arm/sa11x0/sa11x0_ost.c:1.32 src/sys/arch/arm/sa11x0/sa11x0_ost.c:1.33 --- src/sys/arch/arm/sa11x0/sa11x0_ost.c:1.32 Sun Oct 9 14:43:17 2016 +++ src/sys/arch/arm/sa11x0/sa11x0_ost.c Wed Nov 13 17:52:12 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: sa11x0_ost.c,v 1.32 2016/10/09 14:43:17 christos Exp $ */ +/* $NetBSD: sa11x0_ost.c,v 1.33 2019/11/13 17:52:12 tsutsui Exp $ */ /* * Copyright (c) 1997 Mark Brinicombe. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sa11x0_ost.c,v 1.32 2016/10/09 14:43:17 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sa11x0_ost.c,v 1.33 2019/11/13 17:52:12 tsutsui Exp $"); #include #include @@ -80,14 +80,23 @@ struct saost_softc { static struct saost_softc *saost_sc = NULL; +#define PXA270_OST_FREQ 325 /* PXA270 uses 3.25MHz */ +#define SAOST_FREQ 3686400 /* Others use 3.6864MHz */ +#define SAOST_MAXFREQ SAOST_FREQ + #if defined(CPU_XSCALE_PXA270) && defined(CPU_XSCALE_PXA250) +/* + * On dynamic configuration, assume fastest frequency for early delay(9) + * before tc_init(9), because longer delay(9) is almost harmless during + * device probe and initialization. + */ #include -static uint32_t freq; -#define TIMER_FREQUENCY freq +static uint32_t saost_freq = SAOST_MAXFREQ; +#define TIMER_FREQUENCY saost_freq #elif defined(CPU_XSCALE_PXA270) -#define TIMER_FREQUENCY 325 /* PXA270 uses 3.25MHz */ +#define TIMER_FREQUENCY PXA270_OST_FREQ #else -#define TIMER_FREQUENCY 3686400 /* 3.6864MHz */ +#define TIMER_FREQUENCY SAOST_FREQ #endif #ifndef STATHZ @@ -230,7 +239,7 @@ cpu_initclocks(void) stathz = STATHZ; profhz = stathz; #if defined(CPU_XSCALE_PXA270) && defined(CPU_XSCALE_PXA250) - TIMER_FREQUENCY = (CPU_IS_PXA250) ? 3686400 : 325; + TIMER_FREQUENCY = (CPU_IS_PXA270) ? PXA270_OST_FREQ : SAOST_FREQ; #endif sc->sc_statclock_step = TIMER_FREQUENCY / stathz;
CVS commit: src/sys/arch/arm/sa11x0
Module Name:src Committed By: tsutsui Date: Wed Nov 13 17:52:12 UTC 2019 Modified Files: src/sys/arch/arm/sa11x0: sa11x0_ost.c Log Message: Fix another attach failure of zaudio(4) WM8731 on Zaurus SL-C7x0/860. When kernels were configured for both CPU_XSCALE_PXA270 and CPU_XSCALE_PXA250, the OST freq value was not set until tc_init(9) then all delay(9) during configure(9) returned immediately. While here, use proper macro with description for readability. Should be pulled up to netbsd-8 and netbsd-9. (though zaudio(4) won't work on netbsd-8) To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/arm/sa11x0/sa11x0_ost.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.