Rev 3618 | Rev 3742 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3618 | Rev 3664 | ||
|---|---|---|---|
| Line 38... | Line 38... | ||
| 38 | #include <align.h> |
38 | #include <align.h> |
| 39 | #include <string.h> |
39 | #include <string.h> |
| 40 | 40 | ||
| 41 | bootinfo_t bootinfo; |
41 | bootinfo_t bootinfo; |
| 42 | 42 | ||
| 43 | /** UltraSPARC subarchitecture - 1 for US, 3 for US3 */ |
- | |
| 44 | uint8_t subarchitecture; |
- | |
| 45 | - | ||
| 46 | component_t components[COMPONENTS]; |
43 | component_t components[COMPONENTS]; |
| 47 | 44 | ||
| 48 | char *release = RELEASE; |
45 | char *release = RELEASE; |
| 49 | 46 | ||
| 50 | #ifdef REVISION |
47 | #ifdef REVISION |
| Line 57... | Line 54... | ||
| 57 | char *timestamp = "\nBuilt on " TIMESTAMP; |
54 | char *timestamp = "\nBuilt on " TIMESTAMP; |
| 58 | #else |
55 | #else |
| 59 | char *timestamp = ""; |
56 | char *timestamp = ""; |
| 60 | #endif |
57 | #endif |
| 61 | 58 | ||
| - | 59 | /** UltraSPARC subarchitecture - 1 for US, 3 for US3 */ |
|
| - | 60 | uint8_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 | */ |
|
| - | 66 | uint16_t mid_mask; |
|
| - | 67 | ||
| 62 | /** Print version information. */ |
68 | /** Print version information. */ |
| 63 | static void version_print(void) |
69 | static void version_print(void) |
| 64 | { |
70 | { |
| 65 | printf("HelenOS SPARC64 Bootloader\nRelease %s%s%s\n" |
71 | printf("HelenOS SPARC64 Bootloader\nRelease %s%s%s\n" |
| 66 | "Copyright (c) 2006 HelenOS project\n", |
72 | "Copyright (c) 2006 HelenOS project\n", |
| 67 | release, revision, timestamp); |
73 | release, revision, timestamp); |
| 68 | } |
74 | } |
| 69 | 75 | ||
| 70 | /* the lowest ID (read from the VER register) of some US3 CPU model */ |
76 | /* the lowest ID (read from the VER register) of some US3 CPU model */ |
| 71 | #define FIRST_US3_CPU 0x14 |
77 | #define FIRST_US3_CPU 0x14 |
| 72 | 78 | ||
| 73 | /* the greatest ID (read from the VER register) of some US3 CPU model */ |
79 | /* the greatest ID (read from the VER register) of some US3 CPU model */ |
| 74 | #define LAST_US3_CPU 0x19 |
80 | #define LAST_US3_CPU 0x19 |
| - | 81 | ||
| - | 82 | /* UltraSPARC IIIi processor implementation code */ |
|
| - | 83 | #define US_IIIi_CODE 0x15 |
|
| 75 | 84 | ||
| 76 | /** |
85 | /** |
| 77 | * Sets the global variable "subarchitecture" to the correct value. |
86 | * Sets the global variables "subarchitecture" and "mid_mask" to |
| - | 87 | * correct values. |
|
| 78 | */ |
88 | */ |
| 79 | static void detect_subarchitecture(void) |
89 | static void detect_subarchitecture(void) |
| 80 | { |
90 | { |
| 81 | uint64_t v; |
91 | uint64_t v; |
| 82 | asm volatile ("rdpr %%ver, %0\n" : "=r" (v)); |
92 | asm volatile ("rdpr %%ver, %0\n" : "=r" (v)); |
| 83 | 93 | ||
| 84 | v = (v << 16) >> 48; |
94 | v = (v << 16) >> 48; |
| 85 | if ((v >= FIRST_US3_CPU) && (v <= LAST_US3_CPU)) { |
95 | if ((v >= FIRST_US3_CPU) && (v <= LAST_US3_CPU)) { |
| 86 | subarchitecture = SUBARCH_US3; |
96 | subarchitecture = SUBARCH_US3; |
| - | 97 | if (v == US_IIIi_CODE) |
|
| - | 98 | mid_mask = (1 << 5) - 1; |
|
| - | 99 | else |
|
| - | 100 | mid_mask = (1 << 10) - 1; |
|
| 87 | } else if (v < FIRST_US3_CPU) { |
101 | } else if (v < FIRST_US3_CPU) { |
| 88 | subarchitecture = SUBARCH_US; |
102 | subarchitecture = SUBARCH_US; |
| - | 103 | mid_mask = (1 << 5) - 1; |
|
| - | 104 | } else { |
|
| - | 105 | printf("\nThis CPU is not supported by HelenOS."); |
|
| 89 | } |
106 | } |
| 90 | } |
107 | } |
| 91 | 108 | ||
| 92 | void bootstrap(void) |
109 | void bootstrap(void) |
| 93 | { |
110 | { |