Changeset 965dc18 in mainline for boot/arch/sparc64/loader/main.c


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
  • boot/arch/sparc64/loader/main.c

    r0258e67 r965dc18  
    4040
    4141bootinfo_t bootinfo;
     42
    4243component_t components[COMPONENTS];
    4344
     
    5556        char *timestamp = "";
    5657#endif
     58
     59/** UltraSPARC subarchitecture - 1 for US, 3 for US3 */
     60uint8_t subarchitecture;
     61
     62/**
     63 * mask of the MID field inside the ICBUS_CONFIG register shifted by
     64 * MID_SHIFT bits to the right
     65 */
     66uint16_t mid_mask;
    5767
    5868/** Print version information. */
     
    6474}
    6575
     76/* the lowest ID (read from the VER register) of some US3 CPU model */
     77#define FIRST_US3_CPU   0x14
     78
     79/* the greatest ID (read from the VER register) of some US3 CPU model */
     80#define LAST_US3_CPU    0x19
     81
     82/* UltraSPARC IIIi processor implementation code */
     83#define US_IIIi_CODE    0x15
     84
     85/**
     86 * Sets the global variables "subarchitecture" and "mid_mask" to
     87 * correct values.
     88 */
     89static void detect_subarchitecture(void)
     90{
     91        uint64_t v;
     92        asm volatile ("rdpr %%ver, %0\n" : "=r" (v));
     93       
     94        v = (v << 16) >> 48;
     95        if ((v >= FIRST_US3_CPU) && (v <= LAST_US3_CPU)) {
     96                subarchitecture = SUBARCH_US3;
     97                if (v == US_IIIi_CODE)
     98                        mid_mask = (1 << 5) - 1;
     99                else
     100                        mid_mask = (1 << 10) - 1;
     101        } else if (v < FIRST_US3_CPU) {
     102                subarchitecture = SUBARCH_US;
     103                mid_mask = (1 << 5) - 1;
     104        } else {
     105                printf("\nThis CPU is not supported by HelenOS.");
     106        }
     107}
     108
    66109void bootstrap(void)
    67110{
     
    73116        version_print();
    74117       
     118        detect_subarchitecture();
    75119        init_components(components);
    76120
     
    84128                halt();
    85129        }
    86        
     130
    87131        if (bootinfo.memmap.total == 0) {
    88132                printf("Error: no memory detected, halting.\n");
Note: See TracChangeset for help on using the changeset viewer.