Name

HAL Port — Implementation Details

Overview

This documentation explains how the eCos HAL specification has been mapped onto the PC hardware, and should be read in conjunction with that specification. The PC platform HAL package complements the i386 architectural HAL. It provides functionality which is specific to the target board.

Startup

Following a hard or soft reset the HAL will initialize or reinitialize the on-chip peripherals that are used by eCos. There is an exception for RAM startup applications which depend on a monitor for certain services.

Linker Scripts and Memory Maps

The platform HAL package provides the memory layout information needed to generate the linker script. The key memory locations are as follows:

Low RAM

This is the original 640KB of PC RAM between 0x00000000 and 0x000a0000. For FLOPPY startup this is all the RAM that is available since the BIOS operations used to load the executable off the diskette can only write to this memory region.

The lower few K bytes of this region are allocated to special uses as follows:

BaseSizePurpose
0x000000000x1000 The BIOS stores various system parameters in this area, and it is left untouched in case these values are of use.
0x000010000x800 The Interrupt Descriptor Table (IDT). Space for a full sized 256 entry table is left, although a full size table is not normally created.
0x000018000x400 The Vector Service Routine (VSR) table. There is space here for 256 entries, matching the IDT, although not all will be used.
0x00001c000x400 The Virtual Vector Table. This is used to pass control between RedBoot and the application for access to services and debugging.
0x000020000x1000 This area is used in SMP configurations to start up and synchronize the slave CPUs. It is unused in non-SMP configurations.
0x000030000xbd000 Any FLOPPY startup application will load itself at 0x00003000 and use RAM up to the 0x000a0000 boundary. In RAM and GRUB startup configurations this area is unused.
Reserved Region

The region between 0x000a0000 and 0x00100000 is reserved for ROMs, devices and display memory. The only thing of real interest here is the character display buffer at 0x000B8000.

Main Memory
The region above 0x00100000 is the main memory area. This is where RAM and GRUB startup applications are loaded. The upper limit of this region depends on the amount of RAM fitted and is determined at runtime by querying the BIOS.
PCI Devices
The exact memory region used to map PCI devices is largely dependent on the BIOS, but is usually placed above the 0xD0000000 boundary. Drivers for PCI devices will usually determine the location of any device memory regions by querying the device configuration.
IO Ports
The i386 architecture defines a separate address space for IO device registers. These are accessed by the IO instructions. All the standard PC devices are available in this space, and any PCI devices that define IO ports will also be allocated here by the BIOS. In eCos these ports are accessed using the HAL_READ_XXX() and HAL_WRITE_XXX() macros defined in the hal_io.h header.

SMP Support

The i386 HAL contains support for Symmetric Multi-Processing (SMP). The HAL expects the machine to be running under a multiprocessor-aware BIOS and expects to find an MP configuration table from which to configure itself. The HAL also switches over to using the per-CPU APICs and the shared IOAPIC for interrupt control in preference to the standard PIC.

SMP support in eCos is enabled by setting the CYGPKG_KERNEL_SMP_SUPPORT configuration option. This will cause the HAL-level support to be enabled. If applications are to be run under RedBoot then an SMP-aware RedBoot must be used. The FLOPPY_SMP and GRUB_SMP configurations of RedBoot supply this.

Other Issues

The PC platform HAL does not affect the implementation of other parts of the eCos HAL specification. The generic i386 variant HAL, and the I386 architectural HAL documentation should be consulted for further details.