Documentation
¶
Index ¶
- type ChangeDeviceState
- type Chipset
- func (c *Chipset) HandleMMIO(ctx hv.ExitContext, addr uint64, data []byte, isWrite bool) error
- func (c *Chipset) HandlePIO(ctx hv.ExitContext, port uint16, data []byte, isWrite bool) error
- func (c *Chipset) Poll(ctx context.Context) error
- func (c *Chipset) Reset() error
- func (c *Chipset) Start() error
- func (c *Chipset) Stop() error
- type ChipsetBuilder
- func (b *ChipsetBuilder) Build() (*Chipset, error)
- func (b *ChipsetBuilder) RegisterDevice(name string, dev ChipsetDevice) error
- func (b *ChipsetBuilder) WithInterruptLine(line uint8, sink InterruptSink) error
- func (b *ChipsetBuilder) WithMmioRegion(base, size uint64, handler MmioHandler) error
- func (b *ChipsetBuilder) WithPioPort(port uint16, handler PortIOHandler) error
- type ChipsetDevice
- type EOITarget
- type InterruptSink
- type LineInterrupt
- type LineSet
- type MmioHandler
- type MmioIntercept
- type PollDevice
- type PollHandler
- type PortIOHandler
- type PortIOIntercept
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangeDeviceState ¶
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 ¶
HandleMMIO dispatches an MMIO access to the registered device.
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 ¶
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 ¶
AttachEOITarget wires EOI broadcasts to any target exposing HandleEOI(uint32).
func (*LineSet) BroadcastEOI ¶
BroadcastEOI notifies listeners that an EOI was signalled for the vector.
func (*LineSet) RegisterEOICallback ¶
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 ¶
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.