Changeset 9a5b556 in mainline for boot/arch/sparc64/loader


Ignore:
Timestamp:
2006-09-12T13:03:55Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6eabb6e6
Parents:
7bb6b06
Message:

sparc64 work:

  • find a CPU node and read its clock_frequency attribute
  • implement asm_delay_loop()
  • set TICK_COMPARE register according to processor frequency
  • small improvements at random places

OpenFirmware work:

  • two new functions for walking the device tree

Generic boot loader work:

  • added basic string functions

Usual pile of indentation and formatting fixes.

Location:
boot/arch/sparc64/loader
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/sparc64/loader/Makefile

    r7bb6b06 r9a5b556  
    5252        main.c \
    5353        ../../../generic/printf.c \
     54        ../../../generic/string.c \
    5455        ../../../genarch/ofw.c \
    5556        ofwarch.c \
  • boot/arch/sparc64/loader/main.c

    r7bb6b06 r9a5b556  
    6767                printf("Error: unable to get keyboard properties\n");
    6868
     69        if (!ofw_cpu(&bootinfo.cpu))
     70                printf("Error: unable to get cpu properties\n");
     71
    6972        printf("\nDevice statistics\n");
     73        printf(" cpu: %dMHz\n", bootinfo.cpu.clock_frequency/1000000);
    7074        printf(" memory: %dM\n", bootinfo.memmap.total>>20);
    7175        printf(" screen at %P, resolution %dx%d, %d bpp (scanline %d bytes)\n", (uintptr_t) bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline);
  • boot/arch/sparc64/loader/main.h

    r7bb6b06 r9a5b556  
    4646
    4747typedef struct {
     48        uint32_t clock_frequency;
     49} cpu_t;
     50
     51typedef struct {
    4852        taskmap_t taskmap;
    4953        memmap_t memmap;
    5054        screen_t screen;
    5155        keyboard_t keyboard;
     56        cpu_t cpu;
    5257} bootinfo_t;
    5358
  • boot/arch/sparc64/loader/ofwarch.c

    r7bb6b06 r9a5b556  
    3535#include <ofw.h>
    3636#include <printf.h>
     37#include <string.h>
     38#include "main.h"
    3739
    3840int bpp2align[] = {
     
    8082        return true;
    8183}
     84
     85int ofw_cpu(cpu_t *cpu)
     86{
     87        char type_name[BUF_SIZE];
     88
     89        phandle node;
     90        node = ofw_get_child_node(ofw_root);
     91        if (node == 0 || node == -1) {
     92                printf("Could not find any child nodes of the root node.\n");
     93                return;
     94        }
     95       
     96        for (; node != 0 && node != -1; node = ofw_get_peer_node(node)) {
     97                if (ofw_get_property(node, "device_type", type_name, sizeof(type_name)) > 0) {
     98                        if (strncmp(type_name, "cpu", 3) == 0) {
     99                                uint32_t mhz;
     100                               
     101                                if (ofw_get_property(node, "clock-frequency", &mhz, sizeof(mhz)) <= 0)
     102                                        continue;
     103                                       
     104                                cpu->clock_frequency = mhz;
     105                                return 1;
     106                        }
     107                }
     108        };
     109
     110        return 0;
     111}
  • boot/arch/sparc64/loader/ofwarch.h

    r7bb6b06 r9a5b556  
    3030#define BOOT_sparc64_OFWARCH_H_
    3131
     32#include "main.h"
     33
    3234#define OFW_ADDRESS_CELLS       2
    3335#define OFW_SIZE_CELLS          2
     
    3537extern int bpp2align[];
    3638
     39extern int ofw_cpu(cpu_t *cpu);
     40
    3741#endif
Note: See TracChangeset for help on using the changeset viewer.