Overview   API Reference  

device_base Struct Reference

Base class implementing the device interface along with iospace_handler, mmio_handler, and irq_source. More...

#include <device_base.hpp>

Inheritance diagram for device_base:

Inheritance graph
[legend]
Collaboration diagram for device_base:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 device_base (machine_base &machine, const string &device_name)
virtual uint32_t read_ioport (l4_port_t port, access_size access_size)
 Stub implementation, which always returns an invalid value.
virtual int write_ioport (l4_port_t port, uint32_t data, access_size access_size)
 Stub implementation, which always returns -L4_ENOTSUPP.
virtual l4_umword_t read_mmio (l4_gpa_t address, access_size access_size)
 Stub implementation, which always returns an invalid value.
virtual int write_mmio (l4_gpa_t address, l4_umword_t data, access_size access_size)
 Stub implementation, which always returns -L4_ENOTSUPP.
virtual l4_hva_t map_mmio_region (int flags, l4_gpa_t base, l4_gpa_t size=1)
 Stub implementation, which always returns an invalid value (0).
virtual int unmap_mmio_region (l4_gpa_t base, l4_gpa_t size=1)
 Stub implementation, which always returns -L4_ENOTSUPP.
virtual void irq_moved (l4_irq_t from, l4_irq_t to)
 Called whenever the IRQ management chooses to assign this device annother IRQ than the requested one.
virtual const char * name (void) const
 Returns the device's name.
virtual int reset (void)
 Resets the device's state back to defaults as when powering up the machine.

Static Public Attributes

static const bool VERBOSE_ALLOCATION = false

Protected Member Functions

virtual int use_iospace (l4_port_t base, l4_port_t size=1, bool verbose=VERBOSE_ALLOCATION)
 Allocates the specified I/O space region by registering itself as handler.
virtual int change_iospace (iospace_manager::ioport_flags use, l4_port_t base, l4_port_t size=1, bool verbose=VERBOSE_ALLOCATION)
 Changes the specified I/O space region to the desired state.
virtual int free_iospace (l4_port_t base, l4_port_t size=1, bool verbose=VERBOSE_ALLOCATION)
 Frees the specified I/O space region by unregistering itself.
virtual int use_iomemory (l4_gpa_t base, l4_gpa_t size=1, bool verbose=VERBOSE_ALLOCATION)
 Allocates the specified I/O memory region by registering itself as handler.
virtual int free_iomemory (l4_gpa_t base, l4_gpa_t size=1, bool verbose=VERBOSE_ALLOCATION)
 Frees the specified I/O memory region by unregistering itself.
virtual int use_irq (irq_manager::irq_flags use=irq_manager::VIRTUAL, l4_irq_t requested_irq=irq_manager::NO_IRQ, l4_irq_t physical_irq=irq_manager::NO_IRQ, bool verbose=VERBOSE_ALLOCATION)
 Allocate an IRQ for the specified usage.
void assert_irq (void) const
 Assert the (previously allocated) IRQ.
virtual int free_irq (bool verbose=VERBOSE_ALLOCATION)
 Free the (previously allocated) IRQ.

Protected Attributes

const string device_name
 The device's name returned by name().
machine_basemachine
 Reference to the machine object this device belongs to.
l4_irq_t irq
 Allocated IRQ, if applicable.


Detailed Description

Base class implementing the device interface along with iospace_handler, mmio_handler, and irq_source.

Member Function Documentation

virtual uint32_t device_base::read_ioport ( l4_port_t  port,
access_size  access_size 
) [inline, virtual]

Stub implementation, which always returns an invalid value.

Implemented here as a dummy to avoid unnecessary overriding in descendant classes. This function is intended to be overridden.

Implements iospace_handler.

Reimplemented in uart, l4io_device, and piix_ide.

References iospace_handler::INVALID, and name().

virtual int device_base::write_ioport ( l4_port_t  port,
uint32_t  data,
access_size  access_size 
) [inline, virtual]

Stub implementation, which always returns -L4_ENOTSUPP.

Implemented here as a dummy to avoid unnecessary overriding in descendant classes. This function is intended to be overridden.

Implements iospace_handler.

Reimplemented in uart, l4io_device, and piix_ide.

References name().

virtual l4_umword_t device_base::read_mmio ( l4_gpa_t  address,
access_size  access_size 
) [inline, virtual]

Stub implementation, which always returns an invalid value.

Implemented here as a dummy to avoid unnecessary overriding in descendant classes. This function is intended to be overridden.

Implements mmio_handler.

References mmio_handler::INVALID, and name().

virtual int device_base::write_mmio ( l4_gpa_t  address,
l4_umword_t  data,
access_size  access_size 
) [inline, virtual]

Stub implementation, which always returns -L4_ENOTSUPP.

Implemented here as a dummy to avoid unnecessary overriding in descendant classes. This function is intended to be overridden.

Implements mmio_handler.

References name().

virtual l4_hva_t device_base::map_mmio_region ( int  flags,
l4_gpa_t  base,
l4_gpa_t  size = 1 
) [inline, virtual]

Stub implementation, which always returns an invalid value (0).

Implemented here as a dummy to avoid unnecessary overriding in descendant classes. This function is intended to be overridden.

Implements mmio_handler.

Reimplemented in pci_device_base< SpaceT >, l4io_device, pci_device_base< l4io_device_config_space >, pci_device_base< piix_ide_config_space >, and pci_device_base< dummy_device_config_space >.

References name().

virtual int device_base::unmap_mmio_region ( l4_gpa_t  base,
l4_gpa_t  size = 1 
) [inline, virtual]

Stub implementation, which always returns -L4_ENOTSUPP.

Implemented here as a dummy to avoid unnecessary overriding in descendant classes. This function is intended to be overridden.

Implements mmio_handler.

Reimplemented in pci_device_base< SpaceT >, l4io_device, pci_device_base< l4io_device_config_space >, pci_device_base< piix_ide_config_space >, and pci_device_base< dummy_device_config_space >.

References name().

virtual void device_base::irq_moved ( l4_irq_t  from,
l4_irq_t  to 
) [inline, virtual]

Called whenever the IRQ management chooses to assign this device annother IRQ than the requested one.

Updates the stored IRQ.

Implements irq_source.

Reimplemented in pci_device_base< SpaceT >, pci_device_base< l4io_device_config_space >, pci_device_base< piix_ide_config_space >, and pci_device_base< dummy_device_config_space >.

Referenced by pci_device_base< dummy_device_config_space >::irq_moved().

virtual int device_base::use_iospace ( l4_port_t  base,
l4_port_t  size = 1,
bool  verbose = VERBOSE_ALLOCATION 
) [inline, protected, virtual]

Allocates the specified I/O space region by registering itself as handler.

Override read_ioport and write_ioport to implement the desired functionality.

References machine, and iospace_manager::register_iospace_handler().

Referenced by pci_device_base< SpaceT >::ioregion_relocated().

virtual int device_base::use_iomemory ( l4_gpa_t  base,
l4_gpa_t  size = 1,
bool  verbose = VERBOSE_ALLOCATION 
) [inline, protected, virtual]

Allocates the specified I/O memory region by registering itself as handler.

Override read_mmio and write_mmio to implement the desired functionality.

References machine, and memory_manager::register_mmio_handler().

Referenced by pci_device_base< SpaceT >::ioregion_relocated().

virtual int device_base::use_irq ( irq_manager::irq_flags  use = irq_manager::VIRTUAL,
l4_irq_t  requested_irq = irq_manager::NO_IRQ,
l4_irq_t  physical_irq = irq_manager::NO_IRQ,
bool  verbose = VERBOSE_ALLOCATION 
) [inline, protected, virtual]

Allocate an IRQ for the specified usage.

The virtual IRQ is returned and additionally stored as attribute irq. Negative values denote error conditions.

Reimplemented in pci_device_base< SpaceT >, pci_device_base< l4io_device_config_space >, pci_device_base< piix_ide_config_space >, and pci_device_base< dummy_device_config_space >.

References machine, irq_manager::NO_IRQ, and irq_manager::register_irq().

Referenced by pci_device_base< dummy_device_config_space >::use_irq().

void device_base::assert_irq ( void   )  const [inline, protected]

Assert the (previously allocated) IRQ.

This function is not intended to be overridden.

References irq_manager::assert_irq(), and machine.


Member Data Documentation

Reference to the machine object this device belongs to.

Used to request/free resources.

Referenced by assert_irq(), change_iospace(), free_iomemory(), free_iospace(), free_irq(), use_iomemory(), use_iospace(), and use_irq().


The documentation for this struct was generated from the following file:

L4vmm Reference Manual, written by Mario Schwalbe  © 2006-2008