Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3663 → Rev 3664

/branches/sparc/boot/arch/sparc64/loader/main.c
40,9 → 40,6
 
bootinfo_t bootinfo;
 
/** UltraSPARC subarchitecture - 1 for US, 3 for US3 */
uint8_t subarchitecture;
 
component_t components[COMPONENTS];
 
char *release = RELEASE;
59,6 → 56,15
char *timestamp = "";
#endif
 
/** UltraSPARC subarchitecture - 1 for US, 3 for US3 */
uint8_t subarchitecture;
 
/**
* mask of the MID field inside the ICBUS_CONFIG register shifted by
* MID_SHIFT bits to the right
*/
uint16_t mid_mask;
 
/** Print version information. */
static void version_print(void)
{
68,13 → 74,17
}
 
/* the lowest ID (read from the VER register) of some US3 CPU model */
#define FIRST_US3_CPU 0x14
#define FIRST_US3_CPU 0x14
 
/* the greatest ID (read from the VER register) of some US3 CPU model */
#define LAST_US3_CPU 0x19
#define LAST_US3_CPU 0x19
 
/* UltraSPARC IIIi processor implementation code */
#define US_IIIi_CODE 0x15
 
/**
* Sets the global variable "subarchitecture" to the correct value.
* Sets the global variables "subarchitecture" and "mid_mask" to
* correct values.
*/
static void detect_subarchitecture(void)
{
84,8 → 94,15
v = (v << 16) >> 48;
if ((v >= FIRST_US3_CPU) && (v <= LAST_US3_CPU)) {
subarchitecture = SUBARCH_US3;
if (v == US_IIIi_CODE)
mid_mask = (1 << 5) - 1;
else
mid_mask = (1 << 10) - 1;
} else if (v < FIRST_US3_CPU) {
subarchitecture = SUBARCH_US;
mid_mask = (1 << 5) - 1;
} else {
printf("\nThis CPU is not supported by HelenOS.");
}
}
 
/branches/sparc/boot/arch/sparc64/loader/ofwarch.c
40,7 → 40,9
#include "main.h"
#include "asm.h"
 
/* these tho variables will be set by the detect_subarchitecture function */
extern uint8_t subarchitecture;
extern uint16_t mid_mask;
 
void write(const char *str, const int len)
{
129,14 → 131,7
: "r" (0), "i" (ASI_ICBUS_CONFIG));
current_mid >>= ICBUS_CONFIG_MID_SHIFT;
 
if (subarchitecture == SUBARCH_US) {
current_mid &= ICBUS_CONFIG_MID_MASK_US;
} else if (subarchitecture == SUBARCH_US3) {
current_mid &= ICBUS_CONFIG_MID_MASK_US3;
} else {
printf("MID format unknown for this subarchitecture.");
return 0;
}
current_mid &= mid_mask;
 
/* wake up CPUs */
/branches/sparc/boot/arch/sparc64/loader/register.h
35,7 → 35,5
 
#define ASI_ICBUS_CONFIG 0x4a
#define ICBUS_CONFIG_MID_SHIFT 17
#define ICBUS_CONFIG_MID_MASK_US 0x1f
#define ICBUS_CONFIG_MID_MASK_US3 0x3ff
 
#endif