-
Notifications
You must be signed in to change notification settings - Fork 6
/
sys-clipper.S
138 lines (117 loc) · 2.75 KB
/
sys-clipper.S
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/* PALcode and C runtime functions for the CLIPPER system emulation.
Copyright (C) 2011 Richard Henderson
This file is part of QEMU PALcode.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the text
of the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not see
<http://www.gnu.org/licenses/>. */
#include "pal.h"
#include SYSTEM_H
/*
* Sys_Setup
*
* Do any system specific setup necessary.
*
* INPUT PARAMETERS
*
* a0 = whami
* p7 = return address
*/
.globl Sys_Setup
.ent Sys_Setup
Sys_Setup:
.frame $sp, 0, p7, 0
LOAD_PHYS_CCHIP t0
lda t0, TYPHOON_CCHIP_DIR0(t0)
// DIR[23] differ from DIR[01] by 0x400
// DIR[13] differ from DIR[02] by 0x40
and a0, 2, t4
and a0, 1, t3
sll t4, 9, t4
sll t3, 6, t3
addq t0, t4, t0
addq t0, t3, t0
// IIC[0-4] differ from DIR[0-4] by 0x100
lda t2, 0x100(t0)
mtpr t0, ptCpuDIR
mtpr t2, ptCpuIIC
ret
.end Sys_Setup
/*
* Sys_Dev_Vector
*
* Load the SRM interrupt vector for the system.
*
* INPUT PARAMETERS
*
* p7 = return address
*
* OUTPUT PARAMETERS
*
* a1 = interrupt vector
*/
.globl Sys_Dev_Vector
.ent Sys_Dev_Vector
Sys_Dev_Vector:
.frame $sp, 0, p7, 0
mfpr a1, ptCpuDIR // Load int mask for this CPU
ldq_p a1, 0(a1)
beq a1, CallPal_Rti // No interrupts asserted?
cttz a1, a1 // Find the first asserted interrupt.
cmpeq a1, 55, a0 // Is this an ISA interrupt?
addq a1, 16, a1 // PCI interrupt numbers start at 16
beq a0, 1f
LOAD_PHYS_PCHIP0_IACK a1 // IACK results in the ISA irq
ldl_p a1, 0(a1)
1: sll a1, 4, a1
lda a1, 0x800(a1)
ret $31, (p7), 0
.end Sys_Dev_Vector
/*
* Cserve_Ena
*
* Unmask a PCI interrupt
*/
.globl Cserve_Ena
Cserve_Ena:
// FIXME
hw_rei
ENDFN Cserve_Ena
/*
* Cserve_Dis
*
* Mask a PCI interrupt
*/
.globl Cserve_Dis
Cserve_Dis:
// FIXME
hw_rei
ENDFN Cserve_Dis
/*
* PCI parameters
*/
.section .sdata
.align 3
.globl pci_io_base
.type pci_io_base, @object
.size pci_io_base, 8
pci_io_base:
.quad PIO_KSEG_ADDR + TYPHOON_PCHIP0_PCI_IO
.globl pci_conf_base
.type pci_conf_base, @object
.size pci_conf_base, 8
pci_conf_base:
.quad PIO_KSEG_ADDR + TYPHOON_PCHIP0_PCI_CONF
.align 3
.globl pci_mem_base
.type pci_mem_base, @object
.size pci_mem_base, 8
pci_mem_base:
.quad PIO_KSEG_ADDR + TYPHOON_PCHIP0_PCI_MEM