Annotation of sys/arch/sparc/sparc/amd7930intr.s, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: amd7930intr.s,v 1.9 2004/09/29 07:35:13 miod Exp $ */
! 2: /* $NetBSD: amd7930intr.s,v 1.10 1997/03/11 01:03:07 pk Exp $ */
! 3: /*
! 4: * Copyright (c) 1995 Rolf Grossmann.
! 5: * Copyright (c) 1992, 1993
! 6: * The Regents of the University of California. All rights reserved.
! 7: *
! 8: * This software was developed by the Computer Systems Engineering group
! 9: * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
! 10: * contributed to Berkeley.
! 11: *
! 12: * All advertising materials mentioning features or use of this software
! 13: * must display the following acknowledgement:
! 14: * This product includes software developed by the University of
! 15: * California, Lawrence Berkeley Laboratory.
! 16: *
! 17: * Redistribution and use in source and binary forms, with or without
! 18: * modification, are permitted provided that the following conditions
! 19: * are met:
! 20: * 1. Redistributions of source code must retain the above copyright
! 21: * notice, this list of conditions and the following disclaimer.
! 22: * 2. Redistributions in binary form must reproduce the above copyright
! 23: * notice, this list of conditions and the following disclaimer in the
! 24: * documentation and/or other materials provided with the distribution.
! 25: * 3. Neither the name of the University nor the names of its contributors
! 26: * may be used to endorse or promote products derived from this software
! 27: * without specific prior written permission.
! 28: *
! 29: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
! 30: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 31: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 32: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
! 33: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 34: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 35: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 36: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 37: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 38: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 39: * SUCH DAMAGE.
! 40: *
! 41: * @(#)bsd_audiointr.s 8.1 (Berkeley) 6/11/93
! 42: */
! 43:
! 44: #ifndef AUDIO_C_HANDLER
! 45: #include "assym.h"
! 46: #include <machine/param.h>
! 47: #include <sparc/sparc/intreg.h>
! 48: #include <machine/psl.h>
! 49: #include <machine/asm.h>
! 50:
! 51: #define AUDIO_SET_SWINTR_4C \
! 52: sethi %hi(INTRREG_VA), %l5; \
! 53: ldub [%l5 + %lo(INTRREG_VA)], %l6; \
! 54: or %l6, IE_L4, %l6; \
! 55: stb %l6, [%l5 + %lo(INTRREG_VA)]
! 56:
! 57: ! raise(0,IPL_AUSOFT) ! NOTE: CPU#0 and IPL_AUSOFT=4
! 58: #define AUDIO_SET_SWINTR_4M \
! 59: sethi %hi(1 << (16 + 4)), %l5; \
! 60: set ICR_PI_SET, %l6; \
! 61: st %l5, [%l6]
! 62:
! 63: /* set software interrupt */
! 64: #if (defined(SUN4) || defined(SUN4C)) && !defined(SUN4M)
! 65: #define AUDIO_SET_SWINTR AUDIO_SET_SWINTR_4C
! 66: #elif !(defined(SUN4) || defined(SUN4C)) && defined(SUN4M)
! 67: #define AUDIO_SET_SWINTR AUDIO_SET_SWINTR_4M
! 68: #else
! 69: #define AUDIO_SET_SWINTR \
! 70: sethi %hi(_C_LABEL(cputyp)), %l5; \
! 71: ld [%l5 + %lo(_C_LABEL(cputyp))], %l5; \
! 72: cmp %l5, CPU_SUN4M; \
! 73: be 8f; \
! 74: AUDIO_SET_SWINTR_4C; \
! 75: ba,a 9f; \
! 76: 8: \
! 77: AUDIO_SET_SWINTR_4M; \
! 78: 9:
! 79: #endif
! 80:
! 81: #define R_amd %l2
! 82: #define R_data %l3
! 83: #define R_end %l4
! 84:
! 85: .seg "data"
! 86: .align 8
! 87: savepc:
! 88: .word 0
! 89:
! 90: .seg "text"
! 91: .align 4
! 92: .global _C_LABEL(amd7930_trap)
! 93: .global _C_LABEL(auiop)
! 94:
! 95: _C_LABEL(amd7930_trap):
! 96: sethi %hi(savepc), %l7
! 97: st %l2, [%l7 + %lo(savepc)]
! 98:
! 99: ! tally interrupt
! 100: sethi %hi(_C_LABEL(uvmexp)+V_INTR), %l7
! 101: ld [%l7 + %lo(_C_LABEL(uvmexp)+V_INTR)], %l6
! 102: inc %l6
! 103: st %l6, [%l7 + %lo(_C_LABEL(uvmexp)+V_INTR)]
! 104: sethi %hi(_C_LABEL(auiop)), %l7
! 105: ld [%l7 + %lo(_C_LABEL(auiop))], %l7
! 106:
! 107: ldd [%l7 + AU_COUNT], %l2
! 108: inccc %l3
! 109: addx %l2, 0, %l2
! 110: std %l2, [%l7 + AU_COUNT]
! 111:
! 112: ld [%l7 + AU_AMD], R_amd
! 113: ldub [R_amd + AMD_IR], %g0 ! clear interrupt
! 114:
! 115: ! receive incoming data
! 116: ld [%l7 + AU_RDATA], R_data
! 117: ld [%l7 + AU_REND], R_end
! 118:
! 119: cmp R_data, 0 ! if (d && d <= e)
! 120: be 1f
! 121: cmp R_data, R_end
! 122: bgu 1f
! 123: nop
! 124:
! 125: ldub [R_amd + AMD_BBRB], %l6 ! *d = amd->bbrb
! 126: stb %l6, [ R_data ]
! 127: cmp R_data, R_end
! 128: inc R_data ! au->au_rdata++
! 129: bne 1f ! if (d == e)
! 130: st R_data, [%l7 + AU_RDATA]
! 131:
! 132: AUDIO_SET_SWINTR
! 133:
! 134: 1:
! 135: ! write outgoing data
! 136: ld [%l7 + AU_PDATA], R_data
! 137: ld [%l7 + AU_PEND], R_end
! 138:
! 139: cmp R_data, 0 ! if (d && d <= e)
! 140: be 2f
! 141: cmp R_data, R_end
! 142: bgu 2f
! 143: nop
! 144:
! 145: ldub [ R_data ], %l6 ! amd->bbtb = *d
! 146: stb %l6, [ R_amd + AMD_BBTB ]
! 147:
! 148: cmp R_data, R_end
! 149: inc R_data ! au->au_pdata++
! 150: bne 2f ! if (d == e)
! 151: st R_data, [%l7 + AU_PDATA]
! 152:
! 153: AUDIO_SET_SWINTR
! 154:
! 155: 2:
! 156: /*
! 157: * Restore psr -- note: psr delay honored by pc restore loads.
! 158: */
! 159: mov %l0, %psr
! 160: sethi %hi(savepc), %l7
! 161: ld [%l7 + %lo(savepc)], %l2
! 162: jmp %l1
! 163: rett %l2
! 164: #endif /* !AUDIO_C_HANDLER */
CVSweb