wiki:io_operations

Version 7 (modified by alain, 8 years ago) (diff)

--

Input & Output Operations

A) Peripheral identification

ALMOS-MK identifies a peripheral by a composite index (func,impl). The func index defines a functionnal type, the impl index defines a specific hardware implementation.

  • Each value of the functional index defines a generic (implementation independent) device XYZ, that is characterized by an API defined in the dev_xyz.h file. This generic API allows the kernel to access the peripheral without taking care on the actual implementation.
  • For each generic device XYZ, it can exist several hardware implementation, and each value of the implementation index impl is associated with a specific driver, that must implement the API defined for the XYZ generic device.

ALMOS-MK supports two types of peripheral components:

  • External peripherals are accessed through a bridge located in one single cluster (called cluster_io, identified by the io_cxy parameter in the arch_info description). They are shared ressources that can be used by any kernel instance, running in any cluster. Examples are the generic IOC device (Block Device Controller), the generic NIC device (Network Interface Controller), the generic TXT device (Text Terminal), the generic FBF device (Frame Buffer for Graphical Display Controller.
  • Internal peripherals are replicated in all clusters. Each internal peripheral is a private resource that can only be used by the kernel instance running in the local cluster. There is very few internal peripherals. examples are the generic ICU device (Interrupt Controller Unit), or the generic MMC (L2 Cache Configuration).

ALMOS-MK supports multi-channels peripherals, where one single peripheral controller contains N channels that can run in parallel. Each channel has a separated set of addressable registers, and each channel can be used by the OS as an independent device. Examples are the TXT peripheral (one channel per text terminal), or the NIC peripheral (one channel per MAC interface).

Th composite index is implemented as a 32 bits integer, where the 16 MSB bits define the type, and the 16 LSB bits define the subtype.

B) Device Descriptors Placement

To represent the available peripherals in a given manicore architecture, ALMOS-MK uses device descriptors, implemented as the device_t structure. A device descriptor describes a single channel of a peripheral. It contains the functional index, the implementation index, the channel index, the physical base address, and the size of the physical segment containing the addressable registers for this peripheral channel.

Each device descriptor contains also an embedded waiting queue containing the pending requests registered by the various clients. A client can be any thread, running on any core, in any cluster of the manicure architecture.

Finally, each device descriptor for a generic device XYZ contains a link to the specific driver associated to the available hardware implementation. This link is established in the kernel initialization phase.

  • As internal peripheral are private resources, replicated in all clusters, the device descriptor is stored in the same cluster as the hardware device itself. Therefore, all access are local.
  • For external peripherals, all hardware devices are shared resources located in the I/O cluster. To avoid contention, the device descriptors are distributed on all clusters, as uniformly as possible. Therefore, an I/O operation involve generally three clusters: the client cluster, the I/O cluster, and the cluster containing the device descriptor.