Changeset 965dc18 in mainline for kernel/arch/sparc64/src/drivers/scr.c
- Timestamp:
- 2008-12-05T19:59:03Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 49093a4
- Parents:
- 0258e67
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/src/drivers/scr.c
r0258e67 r965dc18 56 56 { 57 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 62 const char *name; 59 63 … … 62 66 if (strcmp(name, "SUNW,m64B") == 0) 63 67 scr_type = SCR_ATYFB; 68 else if (strcmp(name, "SUNW,XVR-100") == 0) 69 scr_type = SCR_XVR; 64 70 else if (strcmp(name, "SUNW,ffb") == 0) 65 71 scr_type = SCR_FFB; … … 68 74 69 75 if (scr_type == SCR_UNKNOWN) { 70 printf("Unknown keyboarddevice.\n");76 printf("Unknown screen device.\n"); 71 77 return; 72 78 } … … 107 113 } 108 114 109 ofw_pci_reg_t *fb_reg = &((ofw_pci_reg_t *) prop->value)[1]; 110 ofw_pci_reg_t abs_reg; 111 112 if (!ofw_pci_reg_absolutize(node, fb_reg, &abs_reg)) { 115 pci_reg = &((ofw_pci_reg_t *) prop->value)[1]; 116 117 if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) { 113 118 printf("Failed to absolutize fb register.\n"); 114 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 124 printf("Failed to determine screen address.\n"); 119 125 return; … … 143 149 144 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 193 case SCR_FFB: 146 194 fb_scanline = 8192; 147 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];150 if (!ofw_upa_apply_ranges(node->parent, reg, &fb_addr)) {197 upa_reg = &((ofw_upa_reg_t *) prop->value)[FFB_REG_24BPP]; 198 if (!ofw_upa_apply_ranges(node->parent, upa_reg, &fb_addr)) { 151 199 printf("Failed to determine screen address.\n"); 152 200 return; … … 165 213 } 166 214 167 ofw_sbus_reg_t *cg6_reg = &((ofw_sbus_reg_t *) prop->value)[0];168 if (!ofw_sbus_apply_ranges(node->parent, cg6_reg, &fb_addr)) {215 sbus_reg = &((ofw_sbus_reg_t *) prop->value)[0]; 216 if (!ofw_sbus_apply_ranges(node->parent, sbus_reg, &fb_addr)) { 169 217 printf("Failed to determine screen address.\n"); 170 218 return; … … 176 224 } 177 225 178 fb_init(fb_addr, fb_width, fb_height, fb_scanline, visual); 226 fb_properties_t props = { 227 .addr = fb_addr, 228 .offset = 0, 229 .x = fb_width, 230 .y = fb_height, 231 .scan = fb_scanline, 232 .visual = visual, 233 }; 234 fb_init(&props); 179 235 } 180 236
Note:
See TracChangeset
for help on using the changeset viewer.