Changeset 822b64e in mainline


Ignore:
Timestamp:
2006-07-05T13:53:21Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2e672fd
Parents:
83253ad
Message:

Fix ofw.c to support map and translate methods even on 64-bit platforms.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • arch/sparc64/loader/main.c

    r83253ad r822b64e  
    3131#include "asm.h"
    3232#include "_components.h"
     33#include <ofw.h>
    3334
    3435#define KERNEL_VIRTUAL_ADDRESS 0x400000
     36
     37bootinfo_t bootinfo;
    3538
    3639void bootstrap(void)
    3740{
    3841        printf("HelenOS SPARC64 Bootloader\n");
    39        
     42
    4043        component_t components[COMPONENTS];
    41         bootinfo_t bootinfo;
    4244        init_components(components);
    43        
     45
    4446        printf("\nMemory statistics\n");
    4547        printf(" kernel entry point at %L\n", KERNEL_VIRTUAL_ADDRESS);
     
    4951        for (i = 0; i < COMPONENTS; i++)
    5052                printf(" %L: %s image (size %d bytes)\n", components[i].start, components[i].name, components[i].size);
     53
     54        screen_t scr;
     55       
     56        ofw_screen(&scr);
     57        printf("\n%P: fb, %dx%dx%d\n", ofw_translate(scr.addr), scr.width, scr.height, scr.bpp);
     58
    5159       
    5260        printf("\nCopying components\n");
     
    6573                printf("done.\n");
    6674        }
    67        
     75
    6876        printf("\nBooting the kernel...\n");
    6977        jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo, sizeof(bootinfo));
  • genarch/ofw.c

    r83253ad r822b64e  
    3030#include <printf.h>
    3131#include <asm.h>
     32#include <types.h>
    3233
    3334#define MAX_OFW_ARGS            10
     
    168169void *ofw_translate(const void *virt)
    169170{
    170         ofw_arg_t result[3];
    171        
    172         if (ofw_call("call-method", 4, 4, result, "translate", ofw_mmu, virt, 1) != 0) {
     171        ofw_arg_t result[4];
     172        int shift;
     173
     174        if (ofw_call("call-method", 3, 5, result, "translate", ofw_mmu, virt) != 0) {
    173175                puts("Error: MMU method translate() failed, halting.\n");
    174176                halt();
    175177        }
    176         return (void *) result[2];
     178
     179        if (sizeof(unative_t) == 8)
     180                shift = 32;
     181        else
     182                shift = 0;
     183               
     184        return (void *) (((result[2]&0xffffffff)<<shift)|((result[3])&0xffffffff));
    177185}
    178186
     
    180188int ofw_map(const void *phys, const void *virt, const int size, const int mode)
    181189{
    182         return ofw_call("call-method", 6, 1, NULL, "map", ofw_mmu, mode, size, virt, phys);
     190        uintptr_t phys_hi, phys_lo;
     191
     192        if (sizeof(unative_t) == 8) {
     193                int shift = 32;
     194                phys_hi = (uintptr_t) phys >> shift;
     195                phys_lo = (uintptr_t) phys & 0xffffffff;
     196        } else {
     197                phys_hi = 0;
     198                phys_lo = (uintptr_t) phys;
     199        }
     200
     201        return ofw_call("call-method", 7, 1, NULL, "map", ofw_mmu, mode, size, virt,
     202                phys_hi, phys_lo);
    183203}
    184204
     
    239259        return true;
    240260}
    241 
Note: See TracChangeset for help on using the changeset viewer.