|
|
void os_set_msparam(msparam_t msparam, void *valuep)
os_set_msparam can be called only from the PSM's initpsm entry point. These parameters, therefore, cannot be changed once the PSM is initialized. os_set_msparam must not be called more than once for the same parameter from the same initpsm operation.
The PSM should set the following machine-specific parameters by calling os_set_msparam from the initpsm function. If the PSM does not set a parameter, the default value is used.
The following table lists the parameter numbers:
| Parameter | msparam value |
|---|---|
| MSPARAM_PLATFORM_NAME | 1 |
| MSPARAM_SW_SYSDUMP | 2 |
| MSPARAM_TIME_RES | 3 |
| MSPARAM_TICK_1_RES | 4 |
| MSPARAM_TICK_1_MAX | 5 |
| MSPARAM_TICK_2_RES | 6 |
| MSPARAM_TICK_2_MAX | 7 |
| MSPARAM_ISLOT_MAX | 8 |
| MSPARAM_INTR_ORDER_MAX | 9 |
| MSPARAM_INTR_TASKPRI_MAX | 10 |
| MSPARAM_SHUTDOWN_CAPS | 11 |
| MSPARAM_TOPOLOGY | 12 |
| MSPARAM_FARCOPY_MIN | 15 |
| MSPARAM_HW_SERIAL | 16 |
MSPARAM_PLATFORM_NAME(char *)
MSPARAM_HW_SERIAL(char
)
MSPARAM_SW_SYSDUMP(ms_bool_t)MSPARAM_TIME_RES(ms_time_t)MSPARAM_TICK_1_RES(ms_time_t)MSPARAM_TICK_1_MAX(ms_time_t)MSPARAM_TICK_2_RES(ms_time_t)Set this parameter only if clock 2 is programmable separately from clock 1.
MSPARAM_TICK_2_MAX(ms_time_t)Set this parameter only if clock 2 is programmable separately from clock 1.
MSPARAM_ISLOT_MAX(ms_islot_t)MSPARAM_INTR_ORDER_MAX(unsigned int)MSPARAM_INTR_TASKPRI_MAX(unsigned int)MSPARAM_FARCOPY_MIN(ms_size_t)MSPARAM_SHUTDOWN_CAPS(unsigned int)Defaults to zero.
MSPARAM_TOPOLOGY(ms_topology_t *)The PSM creates a topology structure either statically or during a call to initpsm, and sets MSPARAM_TOPOLOGY to be a pointer to this structure. The PSM can base this topology structure in whole or in part on os_default_topology, the topology determined by the core kernel as best it can, without platform-specific knowledge.
The basic topology structure is as follows:
typedef struct {
unsigned int mst_nresource;
ms_resource_t *mst_resources;
} ms_topology_t;
The topology structure describes resources configured in the system.
These may include some resources which are not actually available
(for example, they may be powered down, or may have failed).
Each resource is described by an ms_resource_t structure, and is included in an array of such structures, pointed to by mst_resources. The ms_resource_t structure is as follows:
typedef struct {
ms_cgnum_t msr_cgif; /* Nearest CPU group */
ms_bool_t msr_private; /* True if resource is private
(cannot be accessed from
other CPU groups) */
ms_cpu_t msr_private_cpu; /* MS_CPU_ANY or CPU #
resource restricted to */
msr_type_t msr_type; /* Type of resource */
union {
msr_cpu_t msr_cpu;
msr_cache_t msr_cache;
msr_memory_t msr_memory;
msr_bus_t msr_bus;
msr_cg_t msr_cg;
} msri;
} ms_resource_t;
The msr_type field of ms_resource_t identifies the flavor
of union that appears in the structure. It can take the following values:
| msr_type | msr_type number | Variable | Description |
|---|---|---|---|
| MSR_CPU | 1 | msr_cpu | A CPU |
| MSR_ICACHE | 2 | msr_cache | An instruction-only cache |
| MSR_DCACHE | 3 | msr_cache | A data-only cache |
| MSR_UCACHE | 4 | msr_cache | A unified cache |
| MSR_BUS | 5 | msr_bus | An I/O bus bridge |
| MSR_MEMORY | 6 | msr_memory | Mainstore memory |
| MSR_CG | 7 | msr_cg | A CPU group |
Resources near a particular CPU group (as indicated by msr_cgnum) are also accessible from other CPU groups, but with a higher latency cost, unless the msr_private flag is set.
msr_private_cpu is valid only if the msr_private flag is
set. In this case, if msr_private_cpu is not equal to
MS_CPU_ANY,
it is the CPU number of the one CPU that can access the
resource.
Type-specific resource information is described in the following structures:
typedef struct {
ms_cpu_t msr_cpuid; /* CPU number */
unsigned long msr_clockspeed; /* CPU clock frequency
(zero if not known) */
} msr_cpu_t;
typedef struct {
ms_memsize_t msr_size; /* Total cache size, in bytes */
ms_size_t msr_line_size; /* Cache line size, in bytes */
unsigned long msr_level; /* Level in cache hierarchy
(1 is closest to CPU) */
unsigned long msr_associativity;
ms_bool_t msr_dma_coherent;
ms_bool_t msr_write_through;
ms_bool_t msr_far_only;
ms_bool_t msr_read_only;
} msr_cache_t;
typedef struct {
ms_paddr_t msr_address;
ms_memsize_t msr_size;
unsigned int msr_flags;
} msr_memory_t;
typedef struct {
msr_bus_type_t msr_bus_type;
unsigned long msr_bus_number;
msr_routing_t *msr_intr_routing;
unsigned int msr_n_routing;
} msr_bus_t;
typedef struct {
ms_cgid_t msr_cgid;
} msr_cg_t;
The msr_flags field of an msr_memory_t structure
identifies special attributes of a memory segment, and can have or more
of the following bit values OR-ed together:
The msr_bus_type field of an msr_bus_t structure
identifies the type of I/O bus. It can take the following
values:
| msr_bus_type | msr_bus_type number |
|---|---|
| MSR_BUS_NONSTD | 0 |
| MSR_BUS_PCI | 1 |
| MSR_BUS_EISA | 2 |
| MSR_BUS_MCA | 3 |
| MSR_BUS_ISA | 4 |
msr_intr_routing_t describes the interrupt routing (mapping from
interrupt sources to interrupt slots). If set to NULL, the standard
routing for the bus type will be used. Standard routing for ISA,
EISA and MCA is one-to-one (that is, IRQ, interrupt
source and interrupt slot are identical). Standard routing for PCI
is determined by calling the PCI BIOS. If msr_intr_routing_t
is not NULL, it points to an array of msr_n_routing entries
with the following structure:
typedef struct {
unsigned long msr_isource;
ms_islot_t msr_islot;
} msr_routing_t;
msr_isource identifies an interrupt source in a format specific
to the bus type. msr_islot identifies the interrupt slot to which
the interrupt source is mapped.
It must not exceed the value of MSPARAM_ISLOT_MAX.
For ISA, EISA and MCA bus types, the interrupt source is the IRQ number. For the PCI bus type, the interrupt source is a tuple of (PCI bus #, device #, pin #), with the interrupt pin # (A=0, B=1, C=2, D=3) in the low 2 bits, the device # in the next 5 bits and the PCI bus # in the remaining bits.