class PowerController

Defined at line 98 of file ../../src/graphics/display/drivers/intel-display/power-controller.h

Communicates with the firmware on the PCU (power controller).

The PCU firmware is also called PCODE (power microcontroller microcode) in

Intel's documentation. The avenue for communication is called the GT Driver

Mailbox (sometimes abbreviated to "GT Mailbox") in Intel's documentation.

All higher-level commands are built on top of Transact(). See the Transact()

comments for low-level details on communicating with the PCU firmware.

Public Methods

void PowerController (fdf::MmioBuffer * mmio_buffer)

Defined at line 77 of file ../../src/graphics/display/drivers/intel-display/power-controller.cc

zx::result<uint64_t> Transact (PowerControllerCommand command)

Performs a command-response exchange with the PCU firmware.

Returns ZX_ERR_IO_MISSED_DEADLINE if a timeout occurs while waiting for the

PCU firmware. This usually happens if the PCU does not complete `command`

in time, but can also indicate that the PCU firmware was already performing

on a different command, and did not become available in a reasonable amount

of time.

In case of success, returns the 64-bit value in the GT Mailbox Data

Low/High registers.

Before submitting `command` to the PCU firmware via the GT Mailbox

registers, this method waits (for quite a while) for any ongoing command to

finish executing. We adopted this strategy because successful execution of

PCU commands is usually critical to the driver's operation, so we trade off

some waiting time in return for maximizing the odds of successful

execution. The consequence of this approach is that Transact() may take

more than `command.timeout_us` to complete.

Defined at line 81 of file ../../src/graphics/display/drivers/intel-display/power-controller.cc

void PowerController (const PowerController & )

Defined at line 117 of file ../../src/graphics/display/drivers/intel-display/power-controller.h

zx::result<> RequestDisplayVoltageLevel (int voltage_level, RetryBehavior retry_behavior)

Informs the PCU of the display engine's voltage requirements.

Returns ZX_ERR_IO_MISSED_DEADLINE if a timeout occurs while communicating

with the the PCU firmware. This indicates a problem in the PCU firmware. We

should not make any clocking changes if this happens.

Returns ZX_ERR_IO_REFUSED if the PCU firmware did not set the voltage to

the requested level. This is an acceptable outcome when `voltage_level` is

not the maximum level. For example, another consumer (device that shares

the voltage rail with the display engine) may have requested a higher

voltage level.

`voltage_level` must be a valid display engine voltage level. All known

display engines use levels 0-3.

Defined at line 117 of file ../../src/graphics/display/drivers/intel-display/power-controller.cc

void PowerController (PowerController && )

Defined at line 118 of file ../../src/graphics/display/drivers/intel-display/power-controller.h

PowerController & operator= (const PowerController & )

Defined at line 119 of file ../../src/graphics/display/drivers/intel-display/power-controller.h

PowerController & operator= (PowerController && )

Defined at line 120 of file ../../src/graphics/display/drivers/intel-display/power-controller.h

void ~PowerController ()

Trivially destructible.

Defined at line 123 of file ../../src/graphics/display/drivers/intel-display/power-controller.h

zx::result<> SetDisplayTypeCColdBlockingTigerLake (bool blocked, RetryBehavior retry_behavior)

Sets the display engine's block TCCOLD (Type C Cold power state) flag.

Returns ZX_ERR_IO_MISSED_DEADLINE if a timeout occurs while communicating

with the the PCU firmware. This indicates a problem in the PCU firmware. We

should stop using Type C ports if this happens.

Returns ZX_ERR_IO_REFUSED if the PCU firmware did not bring the Type C

subsystem into the state implied by the blocking request. This is an

acceptable outcome when `blocked` is false. For example, the Type C ports

may be used by another client.

The Type C system must be brought out of the cold power state before

accessing any registers in the FIA (Flexible IO Adapter) or in the Type C

PHYs. The cold power state must remain blocked as long as the display

engine uses any main link or AUX channel in a Type C connector.

This method implements the communication protocol for Tiger Lake's PCU

firmware. Other processors use different protocols.

Defined at line 160 of file ../../src/graphics/display/drivers/intel-display/power-controller.cc

zx::result<> SetSystemAgentGeyservilleEnabled (bool enabled, RetryBehavior retry_behavior)

Sets the display engine's SAGV (System Agent Geyserville) enabled flag.

Returns ZX_ERR_IO_MISSED_DEADLINE if a timeout occurs while communicating

with the the PCU firmware. This indicates a problem in the PCU firmware. We

should assume that the SAGV is stuck enabled and configure the display

engine's pipes and planes accordingly.

Returns ZX_ERR_IO_REFUSED if the PCU firmware did not bring the system

agent subsystem into the state implied by the enablement request. This is

an acceptable outcome when `enabled` is true.

This method implements the communication protocol for Kaby Lake and Skylake

PCUs. The protocol is supported by Tiger Lake PCUs, but has been superseded

by a more fine-grained version.

Defined at line 193 of file ../../src/graphics/display/drivers/intel-display/power-controller.cc

zx::result<uint32_t> GetSystemAgentBlockTimeUsTigerLake ()

Reads the SAGV (System Agent Geyserville) blocking time.

Returns the SAGV Block Time, in microseconds.

Returns ZX_ERR_IO_MISSED_DEADLINE if a timeout occurs while communicating

with the the PCU firmware. Returns ZX_ERR_IO_REFUSED if the PCU firmware

reports an error. In either case, the display engine's planes cannot be

used safely.

This method implements the communication protocol for the Tiger Lake PCU.

The protocol is not supported on Kaby Lake and Skylake PCUs.

Defined at line 230 of file ../../src/graphics/display/drivers/intel-display/power-controller.cc

zx::result<uint32_t> GetSystemAgentBlockTimeUsKabyLake ()

Reads the SAGV (System Agent Geyserville) blocking time.

Returns the SAGV Block Time, in microseconds.

This method has the same signature as GetSystemAgentBlockTimeUsTigerLake()

for programming convenience. On Kaby Lake and Skylake PCUs, the SAGV

blocking time is constant.

Defined at line 258 of file ../../src/graphics/display/drivers/intel-display/power-controller.cc

zx::result<std::array<uint8_t, 8>> GetRawMemoryLatencyDataUs ()

Reads the PCU's memory latency data.

Returns the raw memory latency data, as it is returned by the PCU firmware.

Each entry in the returned array represents a memory latency level, in

microseconds. The data may have to be adjusted based on the display engine

hardware and on extra information from the memory controller about the

installed DRAM.

Returns ZX_ERR_IO_MISSED_DEADLINE if a timeout occurs while communicating

with the the PCU firmware. Returns ZX_ERR_IO_REFUSED if the PCU firmware

reports an error. In either case, the display engine's planes cannot be

used safely.

Defined at line 268 of file ../../src/graphics/display/drivers/intel-display/power-controller.cc

zx::result<MemorySubsystemInfo> GetMemorySubsystemInfoTigerLake ()

Reads MemSS (Memory Subsystem) information from the PCU.

Returns ZX_ERR_IO_MISSED_DEADLINE if a timeout occurs while communicating

with the the PCU firmware. Returns ZX_ERR_IO_REFUSED if the PCU firmware

reports an error. In either case, SAGV (System Agent Geyserville) cannot be

enabled safely.

Defined at line 376 of file ../../src/graphics/display/drivers/intel-display/power-controller.cc

display::ScopedValueChange<int> OverridePreviousCommandTimeoutUsForTesting (int timeout_us)

Tests that simulate retries must use the overrides below to avoid flakiness

stemming from scheduling variability. Tests that simulate timeouts should

use the overrides below to get the PowerController to issue a deterministic

MMIO access pattern.

Defined at line 435 of file ../../src/graphics/display/drivers/intel-display/power-controller.cc

display::ScopedValueChange<int> OverrideVoltageLevelRequestReplyTimeoutUsForTesting (int timeout_us)

static

Defined at line 441 of file ../../src/graphics/display/drivers/intel-display/power-controller.cc

display::ScopedValueChange<int> OverrideVoltageLevelRequestTotalTimeoutUsForTesting (int timeout_us)

static

Defined at line 447 of file ../../src/graphics/display/drivers/intel-display/power-controller.cc

display::ScopedValueChange<int> OverrideTypeCColdBlockingChangeReplyTimeoutUsForTesting (int timeout_us)

static

Defined at line 453 of file ../../src/graphics/display/drivers/intel-display/power-controller.cc

display::ScopedValueChange<int> OverrideTypeCColdBlockingChangeTotalTimeoutUsForTesting (int timeout_us)

static

Defined at line 459 of file ../../src/graphics/display/drivers/intel-display/power-controller.cc

display::ScopedValueChange<int> OverrideSystemAgentEnablementChangeReplyTimeoutUsForTesting (int timeout_us)

static

Defined at line 465 of file ../../src/graphics/display/drivers/intel-display/power-controller.cc

display::ScopedValueChange<int> OverrideSystemAgentEnablementChangeTotalTimeoutUsForTesting (int timeout_us)

static

Defined at line 471 of file ../../src/graphics/display/drivers/intel-display/power-controller.cc

display::ScopedValueChange<int> OverrideGetMemorySubsystemInfoReplyTimeoutUsForTesting (int timeout_us)

static

Defined at line 477 of file ../../src/graphics/display/drivers/intel-display/power-controller.cc

display::ScopedValueChange<int> OverrideGetMemoryLatencyReplyTimeoutUsForTesting (int timeout_us)

static

Defined at line 483 of file ../../src/graphics/display/drivers/intel-display/power-controller.cc

Enumerations

enum RetryBehavior
Name Value
kNoRetry 0
kRetryUntilStateChanges 1

Behavior when the PCU-reported state doesn't match the requested state.

Defined at line 101 of file ../../src/graphics/display/drivers/intel-display/power-controller.h