chipset

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeDeviceState

type ChangeDeviceState interface {
	Start() error
	Stop() error
	Reset() error
}

ChangeDeviceState exposes lifecycle hooks for chipset devices.

type Chipset

type Chipset struct {
	// contains filtered or unexported fields
}

Chipset represents the built dispatch tables for chipset devices.

func (*Chipset) HandleMMIO

func (c *Chipset) HandleMMIO(ctx hv.ExitContext, addr uint64, data []byte, isWrite bool) error

HandleMMIO dispatches an MMIO access to the registered device.

func (*Chipset) HandlePIO

func (c *Chipset) HandlePIO(ctx hv.ExitContext, port uint16, data []byte, isWrite bool) error

HandlePIO dispatches an I/O port access to the registered device.

func (*Chipset) Poll

func (c *Chipset) Poll(ctx context.Context) error

Poll executes Poll on all poll-capable devices.

func (*Chipset) Reset

func (c *Chipset) Reset() error

Reset resets all registered devices.

func (*Chipset) Start

func (c *Chipset) Start() error

Start activates all registered devices.

func (*Chipset) Stop

func (c *Chipset) Stop() error

Stop deactivates all registered devices.

type ChipsetBuilder

type ChipsetBuilder struct {
	// contains filtered or unexported fields
}

ChipsetBuilder registers devices and their intercepts before creating a Chipset.

func NewBuilder

func NewBuilder() *ChipsetBuilder

NewBuilder returns an empty ChipsetBuilder instance.

func (*ChipsetBuilder) Build

func (b *ChipsetBuilder) Build() (*Chipset, error)

Build finalizes the chipset layout and returns the constructed Chipset.

func (*ChipsetBuilder) RegisterDevice

func (b *ChipsetBuilder) RegisterDevice(name string, dev ChipsetDevice) error

RegisterDevice adds a chipset device and wires up its intercepts.

func (*ChipsetBuilder) WithInterruptLine

func (b *ChipsetBuilder) WithInterruptLine(line uint8, sink InterruptSink) error

WithInterruptLine registers a sink for a specific interrupt line.

func (*ChipsetBuilder) WithMmioRegion

func (b *ChipsetBuilder) WithMmioRegion(base, size uint64, handler MmioHandler) error

WithMmioRegion registers a memory-mapped region handler.

func (*ChipsetBuilder) WithPioPort

func (b *ChipsetBuilder) WithPioPort(port uint16, handler PortIOHandler) error

WithPioPort registers a single I/O port handler.

type ChipsetDevice

type ChipsetDevice interface {
	hv.Device
	ChangeDeviceState

	SupportsPortIO() *PortIOIntercept
	SupportsMmio() *MmioIntercept
	SupportsPollDevice() *PollDevice
}

ChipsetDevice is the unified interface all chipset devices must implement.

type EOITarget

type EOITarget interface {
	HandleEOI(uint32)
}

EOITarget is the minimal interface for receivers of EOI broadcasts (e.g. IOAPIC).

type InterruptSink

type InterruptSink interface {
	SetIRQ(line uint8, level bool)
}

InterruptSink receives interrupt assertions for a given line.

type LineInterrupt

type LineInterrupt interface {
	SetLevel(high bool)
	PulseInterrupt()
}

LineInterrupt models an interrupt line that supports level and edge semantics.

func LineInterruptDetached

func LineInterruptDetached() LineInterrupt

LineInterruptDetached returns a LineInterrupt that drops all signals.

func LineInterruptFromFunc

func LineInterruptFromFunc(fn func(bool)) LineInterrupt

LineInterruptFromFunc adapts a simple level function to LineInterrupt.

type LineSet

type LineSet struct {
	// contains filtered or unexported fields
}

LineSet manages interrupt lines and EOI callbacks.

func NewLineSet

func NewLineSet(sink InterruptSink) *LineSet

NewLineSet builds a LineSet that forwards assertions to the provided sink.

func (*LineSet) AllocateLine

func (l *LineSet) AllocateLine(irq uint8) LineInterrupt

AllocateLine returns a LineInterrupt handle for the given IRQ line.

func (*LineSet) AttachEOITarget

func (l *LineSet) AttachEOITarget(target EOITarget)

AttachEOITarget wires EOI broadcasts to any target exposing HandleEOI(uint32).

func (*LineSet) BroadcastEOI

func (l *LineSet) BroadcastEOI(vector uint8)

BroadcastEOI notifies listeners that an EOI was signalled for the vector.

func (*LineSet) RegisterEOICallback

func (l *LineSet) RegisterEOICallback(line uint8, fn func())

RegisterEOICallback registers a callback for the given vector. The callback is invoked when BroadcastEOI is called with the same vector.

type MmioHandler

type MmioHandler interface {
	ReadMMIO(ctx hv.ExitContext, addr uint64, data []byte) error
	WriteMMIO(ctx hv.ExitContext, addr uint64, data []byte) error
}

MmioHandler handles reads and writes to memory-mapped regions.

type MmioIntercept

type MmioIntercept struct {
	Regions []hv.MMIORegion
	Handler MmioHandler
}

MmioIntercept describes the MMIO regions a device serves and the handler for them.

type PollDevice

type PollDevice struct {
	Handler PollHandler
}

PollDevice registers a poll-capable device with the chipset.

type PollHandler

type PollHandler interface {
	Poll(ctx context.Context) error
}

PollHandler performs periodic maintenance for a device that requires polling.

type PortIOHandler

type PortIOHandler interface {
	ReadIOPort(ctx hv.ExitContext, port uint16, data []byte) error
	WriteIOPort(ctx hv.ExitContext, port uint16, data []byte) error
}

PortIOHandler handles reads and writes to individual I/O ports.

type PortIOIntercept

type PortIOIntercept struct {
	Ports   []uint16
	Handler PortIOHandler
}

PortIOIntercept describes the ports a device wants to serve and the handler for them.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL