Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | # ========== Copyright Header Begin ========================================== |
2 | # | |
3 | # OpenSPARC T2 Processor File: Ultra2.pm | |
4 | # Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved | |
5 | # 4150 Network Circle, Santa Clara, California 95054, U.S.A. | |
6 | # | |
7 | # * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
8 | # | |
9 | # This program is free software; you can redistribute it and/or modify | |
10 | # it under the terms of the GNU General Public License as published by | |
11 | # the Free Software Foundation; version 2 of the License. | |
12 | # | |
13 | # This program is distributed in the hope that it will be useful, | |
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | # GNU General Public License for more details. | |
17 | # | |
18 | # You should have received a copy of the GNU General Public License | |
19 | # along with this program; if not, write to the Free Software | |
20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | # | |
22 | # For the avoidance of doubt, and except that if any non-GPL license | |
23 | # choice is available it will apply instead, Sun elects to use only | |
24 | # the General Public License version 2 (GPLv2) at this time for any | |
25 | # software where a choice of GPL license versions is made | |
26 | # available with the language indicating that GPLv2 or any later version | |
27 | # may be used, or where a choice of which version of the GPL is applied is | |
28 | # otherwise unspecified. | |
29 | # | |
30 | # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
31 | # CA 95054 USA or visit www.sun.com if you need additional information or | |
32 | # have any questions. | |
33 | # | |
34 | # ========== Copyright Header End ============================================ | |
35 | # -*- perl -*- | |
36 | ||
37 | package Midas::MMU::Ultra2; | |
38 | use strict; | |
39 | ||
40 | use Midas::Command; | |
41 | use Midas::Error; | |
42 | use Midas::Configure; | |
43 | use Midas::Globals; | |
44 | use Midas::Segment; | |
45 | ||
46 | use TRELoad 'BitFieldTie'; | |
47 | ||
48 | use base qw(Midas::MMU); | |
49 | use fields qw( | |
50 | ); | |
51 | ||
52 | ||
53 | ||
54 | ||
55 | ############################################################################## | |
56 | ||
57 | sub new { | |
58 | my $class = shift; | |
59 | my %args = @_; | |
60 | my $this = fields::new($class); | |
61 | $this->SUPER::new(); | |
62 | ||
63 | foreach my $key (keys %args) { | |
64 | $this->{$key} = $args{$key}; | |
65 | } | |
66 | ||
67 | $this->set_defaults(); | |
68 | ||
69 | $this->{mapattr_type} = 'Midas::MMU::Ultra2::SectionAttrs'; | |
70 | ||
71 | return $this; | |
72 | } | |
73 | ||
74 | ############################################################################## | |
75 | ||
76 | sub set_defaults { | |
77 | my $this = shift; | |
78 | ||
79 | $this->{vasize} = 64 unless defined $this->{vasize}; | |
80 | $this->{pasize} = 41 unless defined $this->{pasize}; | |
81 | $this->{type} = 'ultra2' unless defined $this->{type}; | |
82 | ||
83 | $this->SUPER::set_defaults(); | |
84 | } | |
85 | ||
86 | ############################################################################## | |
87 | ||
88 | sub mmu_cpp_args { | |
89 | my $this = shift; | |
90 | my $list = ['-DULTRA2']; | |
91 | push @$list, '-DALLOW_TSB_COL' if $CONFIG{allow_tsb_conflicts}; | |
92 | return $list; | |
93 | } | |
94 | ||
95 | ############################################################################## | |
96 | ||
97 | ############################################################################## | |
98 | ############################################################################## | |
99 | ||
100 | { | |
101 | package Midas::MMU::Ultra2::SectionAttrs; | |
102 | use strict; | |
103 | ||
104 | use Carp; | |
105 | use Midas::Command; | |
106 | use Midas::Globals; | |
107 | use Midas::Error; | |
108 | use Midas::MMU::SunSectionAttrs; | |
109 | use Midas::MMU::TTEFormat; | |
110 | use BitFieldTie; | |
111 | ||
112 | ||
113 | use base qw(Midas::MMU::SunSectionAttrs); | |
114 | use fields (qw( ), | |
115 | ( | |
116 | # Hard-code MMU type because 'use fields' directive needs | |
117 | # to happen at compile-time | |
118 | keys %{ get_union_tte_field_hash('ultra2') } | |
119 | ) | |
120 | ); | |
121 | ||
122 | #tte_g is same as tte_rsvd1 for sun4u | |
123 | ||
124 | our @Settable = qw(); | |
125 | ||
126 | our %Settable = map { $_ => 1} Midas::MMU::Ultra2::SectionAttrs->settable(); | |
127 | our %FieldSizes = (); | |
128 | ||
129 | ############################################################################ | |
130 | ||
131 | sub new { | |
132 | my $this = shift; | |
133 | my %args = @_; | |
134 | ||
135 | unless (ref $this) { | |
136 | $this = fields::new($this); | |
137 | } | |
138 | ||
139 | $this->{settable} = \%Settable; | |
140 | foreach my $key (keys %args) { | |
141 | $this->{$key} = $args{$key}; | |
142 | } | |
143 | ||
144 | return $this; | |
145 | } | |
146 | ||
147 | ############################################################################ | |
148 | ||
149 | sub set_defaults { | |
150 | my $this = shift; | |
151 | ||
152 | $this->SUPER::set_defaults(); | |
153 | ||
154 | foreach my $field (keys %FieldSizes) { | |
155 | $this->{$field} = 0 unless defined $this->{$field}; | |
156 | } | |
157 | } | |
158 | ||
159 | ############################################################################# | |
160 | ||
161 | sub settable { | |
162 | my $this = shift; | |
163 | my @settable = $this->SUPER::settable(); | |
164 | push @settable, @Settable; | |
165 | return @settable; | |
166 | } | |
167 | ||
168 | ############################################################################# | |
169 | ||
170 | sub get_field_size_hash { | |
171 | my $this = shift; | |
172 | my $sizes = $this->SUPER::get_field_size_hash(); | |
173 | ||
174 | foreach my $field (keys %FieldSizes) { | |
175 | $sizes->{$field} = $FieldSizes{$field}; | |
176 | } | |
177 | ||
178 | return $sizes; | |
179 | } | |
180 | ||
181 | ############################################################################ | |
182 | ||
183 | sub legal_page_bits { | |
184 | my $this = shift; | |
185 | return (0, 1, 2, 3); | |
186 | } | |
187 | ||
188 | ############################################################################ | |
189 | ||
190 | sub get_data_addr_bits { | |
191 | my $this = shift; | |
192 | return (40, 13); | |
193 | } | |
194 | ||
195 | ########################################################################### | |
196 | ||
197 | } | |
198 | ||
199 | ############################################################################## | |
200 | ||
201 | ############################################################################## | |
202 | ||
203 | 1; |