Rev 3664 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3664 | Rev 3742 | ||
---|---|---|---|
Line 53... | Line 53... | ||
53 | * @param node Screen device node. |
53 | * @param node Screen device node. |
54 | */ |
54 | */ |
55 | void scr_init(ofw_tree_node_t *node) |
55 | void scr_init(ofw_tree_node_t *node) |
56 | { |
56 | { |
57 | ofw_tree_property_t *prop; |
57 | ofw_tree_property_t *prop; |
- | 58 | ofw_pci_reg_t *pci_reg; |
|
- | 59 | ofw_pci_reg_t pci_abs_reg; |
|
- | 60 | ofw_upa_reg_t *upa_reg; |
|
- | 61 | ofw_sbus_reg_t *sbus_reg; |
|
58 | const char *name; |
62 | const char *name; |
59 | 63 | ||
60 | name = ofw_tree_node_name(node); |
64 | name = ofw_tree_node_name(node); |
61 | 65 | ||
62 | if (strcmp(name, "SUNW,m64B") == 0) |
66 | if (strcmp(name, "SUNW,m64B") == 0) |
Line 72... | Line 76... | ||
72 | printf("Unknown screen device.\n"); |
76 | printf("Unknown screen device.\n"); |
73 | return; |
77 | return; |
74 | } |
78 | } |
75 | 79 | ||
76 | uintptr_t fb_addr; |
80 | uintptr_t fb_addr; |
- | 81 | unsigned int fb_offset = 0; |
|
77 | uint32_t fb_width = 0; |
82 | uint32_t fb_width = 0; |
78 | uint32_t fb_height = 0; |
83 | uint32_t fb_height = 0; |
79 | uint32_t fb_depth = 0; |
84 | uint32_t fb_depth = 0; |
80 | uint32_t fb_linebytes = 0; |
85 | uint32_t fb_linebytes = 0; |
81 | uint32_t fb_scanline = 0; |
86 | uint32_t fb_scanline = 0; |
Line 106... | Line 111... | ||
106 | if (prop->size / sizeof(ofw_pci_reg_t) < 2) { |
111 | if (prop->size / sizeof(ofw_pci_reg_t) < 2) { |
107 | printf("Too few screen registers.\n"); |
112 | printf("Too few screen registers.\n"); |
108 | return; |
113 | return; |
109 | } |
114 | } |
110 | 115 | ||
111 | ofw_pci_reg_t *fb_reg = &((ofw_pci_reg_t *) prop->value)[1]; |
116 | pci_reg = &((ofw_pci_reg_t *) prop->value)[1]; |
112 | ofw_pci_reg_t abs_reg; |
- | |
113 | 117 | ||
114 | if (!ofw_pci_reg_absolutize(node, fb_reg, &abs_reg)) { |
118 | if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) { |
115 | printf("Failed to absolutize fb register.\n"); |
119 | printf("Failed to absolutize fb register.\n"); |
116 | return; |
120 | return; |
117 | } |
121 | } |
118 | 122 | ||
119 | if (!ofw_pci_apply_ranges(node->parent, &abs_reg , &fb_addr)) { |
123 | if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg, |
- | 124 | &fb_addr)) { |
|
120 | printf("Failed to determine screen address.\n"); |
125 | printf("Failed to determine screen address.\n"); |
121 | return; |
126 | return; |
122 | } |
127 | } |
123 | 128 | ||
124 | switch (fb_depth) { |
129 | switch (fb_depth) { |
Line 143... | Line 148... | ||
143 | return; |
148 | return; |
144 | } |
149 | } |
145 | 150 | ||
146 | break; |
151 | break; |
147 | case SCR_XVR: |
152 | case SCR_XVR: |
148 | { |
- | |
149 | if (prop->size / sizeof(ofw_pci_reg_t) < 2) { |
153 | if (prop->size / sizeof(ofw_pci_reg_t) < 2) { |
150 | printf("Too few screen registers.\n"); |
154 | printf("Too few screen registers.\n"); |
151 | return; |
155 | return; |
152 | } |
156 | } |
153 | 157 | ||
154 | ofw_pci_reg_t *fb_reg = &((ofw_pci_reg_t *) prop->value)[1]; |
158 | pci_reg = &((ofw_pci_reg_t *) prop->value)[1]; |
155 | ofw_pci_reg_t abs_reg; |
- | |
156 | 159 | ||
157 | if (!ofw_pci_reg_absolutize(node, fb_reg, &abs_reg)) { |
160 | if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) { |
158 | printf("Failed to absolutize fb register.\n"); |
161 | printf("Failed to absolutize fb register.\n"); |
159 | return; |
162 | return; |
160 | } |
163 | } |
161 | 164 | ||
162 | if (!ofw_pci_apply_ranges(node->parent, &abs_reg , &fb_addr)) { |
165 | if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg, |
- | 166 | &fb_addr)) { |
|
163 | printf("Failed to determine screen address.\n"); |
167 | printf("Failed to determine screen address.\n"); |
164 | return; |
168 | return; |
165 | } |
169 | } |
166 | 170 | ||
- | 171 | fb_offset = 4 * 0x2000; |
|
- | 172 | ||
167 | switch (fb_depth) { |
173 | switch (fb_depth) { |
168 | case 8: |
174 | case 8: |
169 | fb_scanline = fb_linebytes * (fb_depth >> 3); |
175 | fb_scanline = fb_linebytes * (fb_depth >> 3); |
170 | visual = VISUAL_SB1500_PALETTE; |
176 | visual = VISUAL_INDIRECT_8; |
171 | break; |
177 | break; |
172 | case 16: |
178 | case 16: |
173 | fb_scanline = fb_linebytes * (fb_depth >> 3); |
179 | fb_scanline = fb_linebytes * (fb_depth >> 3); |
174 | visual = VISUAL_RGB_5_6_5; |
180 | visual = VISUAL_RGB_5_6_5; |
175 | break; |
181 | break; |
Line 185... | Line 191... | ||
185 | printf("Unsupported bits per pixel.\n"); |
191 | printf("Unsupported bits per pixel.\n"); |
186 | return; |
192 | return; |
187 | } |
193 | } |
188 | 194 | ||
189 | break; |
195 | break; |
190 | } |
- | |
191 | case SCR_FFB: |
196 | case SCR_FFB: |
192 | fb_scanline = 8192; |
197 | fb_scanline = 8192; |
193 | visual = VISUAL_BGR_0_8_8_8; |
198 | visual = VISUAL_BGR_0_8_8_8; |
194 | 199 | ||
195 | ofw_upa_reg_t *reg = &((ofw_upa_reg_t *) prop->value)[FFB_REG_24BPP]; |
200 | upa_reg = &((ofw_upa_reg_t *) prop->value)[FFB_REG_24BPP]; |
196 | if (!ofw_upa_apply_ranges(node->parent, reg, &fb_addr)) { |
201 | if (!ofw_upa_apply_ranges(node->parent, upa_reg, &fb_addr)) { |
197 | printf("Failed to determine screen address.\n"); |
202 | printf("Failed to determine screen address.\n"); |
198 | return; |
203 | return; |
199 | } |
204 | } |
200 | 205 | ||
201 | break; |
206 | break; |
Line 208... | Line 213... | ||
208 | default: |
213 | default: |
209 | printf("Not implemented.\n"); |
214 | printf("Not implemented.\n"); |
210 | return; |
215 | return; |
211 | } |
216 | } |
212 | 217 | ||
213 | ofw_sbus_reg_t *cg6_reg = &((ofw_sbus_reg_t *) prop->value)[0]; |
218 | sbus_reg = &((ofw_sbus_reg_t *) prop->value)[0]; |
214 | if (!ofw_sbus_apply_ranges(node->parent, cg6_reg, &fb_addr)) { |
219 | if (!ofw_sbus_apply_ranges(node->parent, sbus_reg, &fb_addr)) { |
215 | printf("Failed to determine screen address.\n"); |
220 | printf("Failed to determine screen address.\n"); |
216 | return; |
221 | return; |
217 | } |
222 | } |
218 | 223 | ||
219 | break; |
224 | break; |
220 | default: |
225 | default: |
221 | panic("Unexpected type.\n"); |
226 | panic("Unexpected type.\n"); |
222 | } |
227 | } |
223 | 228 | ||
224 | fb_properties_t props; |
229 | fb_properties_t props = { |
225 | props.addr = fb_addr; |
230 | .addr = fb_addr, |
226 | props.fb_start = 0; |
231 | .offset = fb_offset, |
227 | props.x = fb_width; |
232 | .x = fb_width, |
228 | props.y = fb_height; |
233 | .y = fb_height, |
229 | props.scan = fb_scanline; |
234 | .scan = fb_scanline, |
230 | props.visual = visual; |
235 | .visual = visual, |
- | 236 | }; |
|
231 | fb_init(&props); |
237 | fb_init(&props); |
232 | } |
238 | } |
233 | 239 | ||
234 | /** @} |
240 | /** @} |
235 | */ |
241 | */ |