Ignore:
Timestamp:
2008-12-05T19:59:03Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
49093a4
Parents:
0258e67
Message:

Merge sparc branch to trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/src/drivers/scr.c

    r0258e67 r965dc18  
    5656{
    5757        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;
    5862        const char *name;
    5963       
     
    6266        if (strcmp(name, "SUNW,m64B") == 0)
    6367                scr_type = SCR_ATYFB;
     68        else if (strcmp(name, "SUNW,XVR-100") == 0)
     69                scr_type = SCR_XVR;
    6470        else if (strcmp(name, "SUNW,ffb") == 0)
    6571                scr_type = SCR_FFB;
     
    6874       
    6975        if (scr_type == SCR_UNKNOWN) {
    70                 printf("Unknown keyboard device.\n");
     76                printf("Unknown screen device.\n");
    7177                return;
    7278        }
     
    107113                }
    108114       
    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)) {
    113118                        printf("Failed to absolutize fb register.\n");
    114119                        return;
    115120                }
    116121       
    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)) {
    118124                        printf("Failed to determine screen address.\n");
    119125                        return;
     
    143149               
    144150                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;
    145193        case SCR_FFB:   
    146194                fb_scanline = 8192;
    147195                visual = VISUAL_BGR_0_8_8_8;
    148196
    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)) {
    151199                        printf("Failed to determine screen address.\n");
    152200                        return;
     
    165213                }
    166214               
    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)) {
    169217                        printf("Failed to determine screen address.\n");
    170218                        return;
     
    176224        }
    177225
    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);
    179235}
    180236
Note: See TracChangeset for help on using the changeset viewer.