serial

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// UART8250DefaultClock is the reference clock used by the guest UART.
	UART8250DefaultClock = 1843200
	// UART8250MMIOSize reserves a 4 KiB region for the UART registers.
	UART8250MMIOSize = 0x1000
)
View Source
const (
	// Serial16550MMIOSize is the default MMIO region size for Serial16550.
	// This reserves space for the 8 registers with up to 4-byte stride.
	Serial16550MMIOSize = 0x1000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Serial16550MMIO

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

Serial16550MMIO wraps a Serial16550 device and exposes it via MMIO instead of PIO. It supports configurable register stride (1, 2, or 4 bytes) to match different hardware implementations.

func NewSerial16550MMIO

func NewSerial16550MMIO(base uint64, regShift uint32, irqLine chipset.LineInterrupt, out io.Writer, in io.Reader) *Serial16550MMIO

NewSerial16550MMIO creates a new Serial16550MMIO wrapper. base is the MMIO base address, regShift controls register spacing (stride = 1 << regShift), irqLine is the interrupt line, and out/in are the output/input streams.

func (*Serial16550MMIO) Init

func (s *Serial16550MMIO) Init(vm hv.VirtualMachine) error

Init implements hv.Device.

func (*Serial16550MMIO) ReadMMIO

func (s *Serial16550MMIO) ReadMMIO(ctx hv.ExitContext, addr uint64, data []byte) error

ReadMMIO implements chipset.MmioHandler.

func (*Serial16550MMIO) Reset

func (s *Serial16550MMIO) Reset() error

Reset implements chipset.ChangeDeviceState.

func (*Serial16550MMIO) SetIRQLine

func (s *Serial16550MMIO) SetIRQLine(line chipset.LineInterrupt)

SetIRQLine configures the LineInterrupt used for IRQ delivery.

func (*Serial16550MMIO) Start

func (s *Serial16550MMIO) Start() error

Start implements chipset.ChangeDeviceState.

func (*Serial16550MMIO) Stop

func (s *Serial16550MMIO) Stop() error

Stop implements chipset.ChangeDeviceState.

func (*Serial16550MMIO) SupportsMmio

func (s *Serial16550MMIO) SupportsMmio() *chipset.MmioIntercept

SupportsMmio implements chipset.ChipsetDevice.

func (*Serial16550MMIO) SupportsPollDevice

func (s *Serial16550MMIO) SupportsPollDevice() *chipset.PollDevice

SupportsPollDevice implements chipset.ChipsetDevice.

func (*Serial16550MMIO) SupportsPortIO

func (s *Serial16550MMIO) SupportsPortIO() *chipset.PortIOIntercept

SupportsPortIO implements chipset.ChipsetDevice. Returns nil since this device only supports MMIO.

func (*Serial16550MMIO) WriteMMIO

func (s *Serial16550MMIO) WriteMMIO(ctx hv.ExitContext, addr uint64, data []byte) error

WriteMMIO implements chipset.MmioHandler.

type UART8250MMIO

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

UART8250MMIO implements a minimal 16550-compatible UART exposed via MMIO.

func NewUART8250MMIO

func NewUART8250MMIO(base uint64, regShift uint32, irqLine uint32, out io.Writer) *UART8250MMIO

NewUART8250MMIO builds a UART with the supplied base address. regShift controls the spacing of successive registers (stride = 1 << regShift).

func (*UART8250MMIO) Init

func (s *UART8250MMIO) Init(vm hv.VirtualMachine) error

Init implements hv.Device.

func (*UART8250MMIO) MMIORegions

func (s *UART8250MMIO) MMIORegions() []hv.MMIORegion

MMIORegions implements hv.MemoryMappedIODevice.

func (*UART8250MMIO) ReadMMIO

func (s *UART8250MMIO) ReadMMIO(ctx hv.ExitContext, addr uint64, data []byte) error

ReadMMIO implements hv.MemoryMappedIODevice.

func (*UART8250MMIO) WriteMMIO

func (s *UART8250MMIO) WriteMMIO(ctx hv.ExitContext, addr uint64, data []byte) error

WriteMMIO implements hv.MemoryMappedIODevice.

type UART8250Template

type UART8250Template struct {
	Base     uint64
	RegShift uint32
	IRQLine  uint32
	Out      io.Writer
}

UART8250Template is an hv.DeviceTemplate for the MMIO UART.

func (UART8250Template) Create

func (t UART8250Template) Create(vm hv.VirtualMachine) (hv.Device, error)

Create implements hv.DeviceTemplate.

Jump to

Keyboard shortcuts

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