include/fw.h — Internal declarations

Internal firmware declarations: register and boot-data accessors, the global state g, the trace macro, and the functions shared between the source files (documented where they are defined).

static inline uint32_t cr_read32(uint32_t off)

Read a 32-bit GPU register (core bank).

Parameters:
  • off – Register offset.

Returns:

The register value.

static inline void cr_write32(uint32_t off, uint32_t v)

Write a 32-bit GPU register (core bank).

Parameters:
  • off – Register offset.

  • v – The value.

static inline uint64_t cr_read64(uint32_t off)

Read a 64-bit GPU register, low word first.

Parameters:
  • off – Register offset.

Returns:

The register value.

static inline void cr_write64(uint32_t off, uint64_t v)

Write a 64-bit GPU register, low word first.

Parameters:
  • off – Register offset.

  • v – The value.

static inline void bcast_write32(uint32_t off, uint32_t v)

Write a 32-bit GPU register through the XPU broadcast bank (every core).

Parameters:
  • off – Register offset.

  • v – The value.

static inline void bcast_write64(uint32_t off, uint64_t v)

Write a 64-bit GPU register through the broadcast bank, low word first.

Parameters:
  • off – Register offset.

  • v – The value.

static inline volatile uint32_t *boot_data_word(uint32_t off)

Get a word of the boot-data page (uncached KSEG1).

Parameters:
  • off – Byte offset (BD_*).

Returns:

Pointer to the word.

static inline void *fwptr(fwaddr_t a)

Turn a firmware address from the host into a pointer.

Parameters:
  • a – The firmware address.

Returns:

The pointer in the heap window, or NULL when a is 0.

struct fw_state

The firmware’s global state, g.

struct sysinit *sysinit

The host’s system initialisation data.

struct osinit *osinit

The host’s OS initialisation data.

struct sysdata *sysdata

System data reported to the host.

struct osdata *osdata

OS data reported to the host.

struct runtime_cfg *runtime_cfg

Runtime configuration written by the host.

struct tracebuf *tracebuf

Trace control.

volatile uint32_t *trace_buf

Thread 0’s trace ring, or NULL when tracing is off.

uint32_t trace_size

Size of the trace ring in words.

struct ccb_ctl *kccb_ctl

Kernel CCB control block.

uint8_t *kccb

Kernel CCB commands.

volatile uint32_t *kccb_rtn

Kernel CCB return slots.

struct ccb_ctl *fwccb_ctl

Firmware CCB control block.

uint8_t *fwccb

Firmware CCB commands.

uint32_t core_clock_hz

Core clock in Hz.

uint32_t timer_ticks_per_ms

CR_TIMER ticks per ms (clock / 256).

uint32_t count_per_ms

CP0 Count ticks per ms (clock / 2).

uint32_t pow_state

Power state (POW_STATE_*).

bool forced_idle

The host forced the GPU idle: no new task starts.

bool powered_off

Powered off: interrupts do nothing until the next boot.

bool kick_pending

Set by the background or interrupt task: work for the scheduler (not used).

uint32_t config_flags

Configuration flags (sysdata.config_flags).

uint32_t timer_irqs

Interrupt counters (debug).

uint32_t cdm_kicks

Compute kicks (debug).

TRACE(sfid, ...)

Write a trace entry.

Parameters:
  • sfid – The SFID_* identifier.

  • ... – The parameters, as many as the SFID’s format string expects (tools/check-trace-args.py checks this at build time).