Rev 2927 | Rev 4337 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2927 | Rev 3674 | ||
|---|---|---|---|
| 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) |
| 63 | scr_type = SCR_ATYFB; |
67 | scr_type = SCR_ATYFB; |
| - | 68 | else if (strcmp(name, "SUNW,XVR-100") == 0) |
|
| - | 69 | scr_type = SCR_XVR; |
|
| 64 | else if (strcmp(name, "SUNW,ffb") == 0) |
70 | else if (strcmp(name, "SUNW,ffb") == 0) |
| 65 | scr_type = SCR_FFB; |
71 | scr_type = SCR_FFB; |
| 66 | else if (strcmp(name, "cgsix") == 0) |
72 | else if (strcmp(name, "cgsix") == 0) |
| 67 | scr_type = SCR_CGSIX; |
73 | scr_type = SCR_CGSIX; |
| 68 | 74 | ||
| 69 | if (scr_type == SCR_UNKNOWN) { |
75 | if (scr_type == SCR_UNKNOWN) { |
| 70 | printf("Unknown keyboard device.\n"); |
76 | printf("Unknown screen device.\n"); |
| 71 | return; |
77 | return; |
| 72 | } |
78 | } |
| 73 | 79 | ||
| 74 | uintptr_t fb_addr; |
80 | uintptr_t fb_addr; |
| 75 | uint32_t fb_width = 0; |
81 | uint32_t fb_width = 0; |
| Line 104... | Line 110... | ||
| 104 | if (prop->size / sizeof(ofw_pci_reg_t) < 2) { |
110 | if (prop->size / sizeof(ofw_pci_reg_t) < 2) { |
| 105 | printf("Too few screen registers.\n"); |
111 | printf("Too few screen registers.\n"); |
| 106 | return; |
112 | return; |
| 107 | } |
113 | } |
| 108 | 114 | ||
| 109 | ofw_pci_reg_t *fb_reg = &((ofw_pci_reg_t *) prop->value)[1]; |
115 | pci_reg = &((ofw_pci_reg_t *) prop->value)[1]; |
| 110 | ofw_pci_reg_t abs_reg; |
- | |
| 111 | 116 | ||
| 112 | if (!ofw_pci_reg_absolutize(node, fb_reg, &abs_reg)) { |
117 | if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) { |
| 113 | printf("Failed to absolutize fb register.\n"); |
118 | printf("Failed to absolutize fb register.\n"); |
| 114 | return; |
119 | return; |
| 115 | } |
120 | } |
| 116 | 121 | ||
| 117 | if (!ofw_pci_apply_ranges(node->parent, &abs_reg , &fb_addr)) { |
122 | if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg, |
| - | 123 | &fb_addr)) { |
|
| 118 | printf("Failed to determine screen address.\n"); |
124 | printf("Failed to determine screen address.\n"); |
| 119 | return; |
125 | return; |
| 120 | } |
126 | } |
| 121 | 127 | ||
| 122 | switch (fb_depth) { |
128 | switch (fb_depth) { |
| Line 140... | Line 146... | ||
| 140 | printf("Unsupported bits per pixel.\n"); |
146 | printf("Unsupported bits per pixel.\n"); |
| 141 | return; |
147 | return; |
| 142 | } |
148 | } |
| 143 | 149 | ||
| 144 | break; |
150 | break; |
| - | 151 | case SCR_XVR: |
|
| - | 152 | if (prop->size / sizeof(ofw_pci_reg_t) < 2) { |
|
| - | 153 | printf("Too few screen registers.\n"); |
|
| - | 154 | return; |
|
| - | 155 | } |
|
| - | 156 | ||
| - | 157 | pci_reg = &((ofw_pci_reg_t *) prop->value)[1]; |
|
| - | 158 | ||
| - | 159 | if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) { |
|
| - | 160 | printf("Failed to absolutize fb register.\n"); |
|
| - | 161 | return; |
|
| - | 162 | } |
|
| - | 163 | ||
| - | 164 | if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg, |
|
| - | 165 | &fb_addr)) { |
|
| - | 166 | printf("Failed to determine screen address.\n"); |
|
| - | 167 | return; |
|
| - | 168 | } |
|
| - | 169 | ||
| - | 170 | switch (fb_depth) { |
|
| - | 171 | case 8: |
|
| - | 172 | fb_scanline = fb_linebytes * (fb_depth >> 3); |
|
| - | 173 | visual = VISUAL_SB1500_PALETTE; |
|
| - | 174 | break; |
|
| - | 175 | case 16: |
|
| - | 176 | fb_scanline = fb_linebytes * (fb_depth >> 3); |
|
| - | 177 | visual = VISUAL_RGB_5_6_5; |
|
| - | 178 | break; |
|
| - | 179 | case 24: |
|
| - | 180 | fb_scanline = fb_linebytes * 4; |
|
| - | 181 | visual = VISUAL_RGB_8_8_8_0; |
|
| - | 182 | break; |
|
| - | 183 | case 32: |
|
| - | 184 | fb_scanline = fb_linebytes * (fb_depth >> 3); |
|
| - | 185 | visual = VISUAL_RGB_0_8_8_8; |
|
| - | 186 | break; |
|
| - | 187 | default: |
|
| - | 188 | printf("Unsupported bits per pixel.\n"); |
|
| - | 189 | return; |
|
| - | 190 | } |
|
| - | 191 | ||
| - | 192 | break; |
|
| 145 | case SCR_FFB: |
193 | case SCR_FFB: |
| 146 | fb_scanline = 8192; |
194 | fb_scanline = 8192; |
| 147 | visual = VISUAL_BGR_0_8_8_8; |
195 | visual = VISUAL_BGR_0_8_8_8; |
| 148 | 196 | ||
| 149 | ofw_upa_reg_t *reg = &((ofw_upa_reg_t *) prop->value)[FFB_REG_24BPP]; |
197 | upa_reg = &((ofw_upa_reg_t *) prop->value)[FFB_REG_24BPP]; |
| 150 | if (!ofw_upa_apply_ranges(node->parent, reg, &fb_addr)) { |
198 | if (!ofw_upa_apply_ranges(node->parent, upa_reg, &fb_addr)) { |
| 151 | printf("Failed to determine screen address.\n"); |
199 | printf("Failed to determine screen address.\n"); |
| 152 | return; |
200 | return; |
| 153 | } |
201 | } |
| 154 | 202 | ||
| 155 | break; |
203 | break; |
| Line 162... | Line 210... | ||
| 162 | default: |
210 | default: |
| 163 | printf("Not implemented.\n"); |
211 | printf("Not implemented.\n"); |
| 164 | return; |
212 | return; |
| 165 | } |
213 | } |
| 166 | 214 | ||
| 167 | ofw_sbus_reg_t *cg6_reg = &((ofw_sbus_reg_t *) prop->value)[0]; |
215 | sbus_reg = &((ofw_sbus_reg_t *) prop->value)[0]; |
| 168 | if (!ofw_sbus_apply_ranges(node->parent, cg6_reg, &fb_addr)) { |
216 | if (!ofw_sbus_apply_ranges(node->parent, sbus_reg, &fb_addr)) { |
| 169 | printf("Failed to determine screen address.\n"); |
217 | printf("Failed to determine screen address.\n"); |
| 170 | return; |
218 | return; |
| 171 | } |
219 | } |
| 172 | 220 | ||
| 173 | break; |
221 | break; |
| 174 | default: |
222 | default: |
| 175 | panic("Unexpected type.\n"); |
223 | panic("Unexpected type.\n"); |
| 176 | } |
224 | } |
| 177 | 225 | ||
| - | 226 | fb_properties_t props = { |
|
| - | 227 | .addr = fb_addr, |
|
| - | 228 | .offset = 0, |
|
| - | 229 | .x = fb_width, |
|
| - | 230 | .y = fb_height, |
|
| 178 | fb_init(fb_addr, fb_width, fb_height, fb_scanline, visual); |
231 | .scan = fb_scanline, |
| - | 232 | .visual = visual, |
|
| - | 233 | }; |
|
| - | 234 | fb_init(&props); |
|
| 179 | } |
235 | } |
| 180 | 236 | ||
| 181 | /** @} |
237 | /** @} |
| 182 | */ |
238 | */ |