CPU(4) BSD Programmer's Manual CPU(4)NAMEcpuSYNOPSIS
pseudo-device cpu
options SMP_DEBUG
options KTR
DESCRIPTION
The special file /dev/cpu is an interface to a kernel driver which con-
trols the configuration, startup, and shutdown of multiple CPU systems.
Read and writes are not allowed on this device, the only valid operations
are ioctl's.
This driver is the primary interface between the kernel and the cpu(8)
program. The user mode cpu(8) program makes the policy decisions (such as
interpreting the BIOS MP configuration data) and the device driver imple-
ments these decisions.
The interface exported by cpu is not intended for general use, it may
change at any time.
The ioctls are briefly described below, the parameters mentioned are usu-
ally members of structures passed in/out of the ioctls; their definitions
as well as the definitions for the ioctls themselves may be found in
<i386/i386/cpuioctl.h>.
Most of the data provided to the kernel though this driver is extracted
(or implied) from the BIOS MP configuration information (that is docu-
mented in the Intel Multiprocessing Specification (MPS) 1.4.
CPUGETBOOTP This returns the bootparam data passed into the kernel by
the bootstrap (much of which is based on data provided by
the BIOS). The bootparam data is made up of a list of (po-
tentially) unrelated data items. The num parameter should
be set to the item number desired, len is set to the
length of the provide data area, and data is pointed at
the return data area. If the item requested is past the
end of the list an ENOENT is returned. If the data area
provided is too small (or is 0 in length), the len field
is updated to reflect the actual size of the item (in
bytes) and an ENOSPC is returned.
CPUMAP_LAPIC A CPU number (local APIC id) is provided in num; the phys-
ical address of the local APIC for that CPU is given in
paddr. This ioctl is a prerequisite to switching into sym-
metric I/O mode or manipulating the local APIC registers
on a given CPU.
CPUMAP_IAPIC The I/O APIC number (APIC id) is provided in num; the
physical address of the I/O APIC (as seen by all CPU's) is
given in paddr. Note that the name space for I/O APIC's
and local APIC's is the same.
CPUSETUPBSP This renames the boot processor to its actual APIC id (it
is referred to as Cpu-0 until this point) and starts the
idle process (used to provide kernel context for inter-
rupts) for the boot processor.
CPUGETININ Retrieves and interrupt information table entry, there is
one entry for each I/O interrupt vector. The entries pro-
vide information needed by the kernel when it makes the
transition to symmetric I/O mode.
CPUSETININ Sets an interrupt information table entry. As a general
rule the CPUGETININ() ioctl should be used to get the en-
try, changes made, then this ioctl used to write it back
to the kernel.
CPURDAPIC This allows reading of local or I/O apic registers. Only
the local APIC of the CPU the process doing ioctl on is
accessible (other local APICs are not accessible).
When reading local APIC registers the full byte offset to
the register must be given; when accessing an I/O apic,
register numbers are used. I/O apics are selected by posi-
tive values in apic_num, the local APIC is selected via
apic_num == -1.
CPUWRAPIC This is used to write local or I/O APIC registers; access
rules are as with CPURDAPIC().
CPUSETLINT Set up a local APIC LVT entry, the entry is stored in the
per-cpu area until the switch to symmetric I/O mode is
made.
CPUSIO Performs the switch to symmetric I/O mode.
CPUGO Starts an AP (application processor, any CPU that isn't
the one that was booted).
CPUSTOP Stop a CPU.
CPUSETDR Set a debug register; can be used to monitor reads/writes
to particular memory locations (at the hardware level).
The setdr(8) program uses this ioctl. This acts only on
the debug registers in the CPU running the ioctl.
CPUGETDR Retrieve the contents of a hardware debug register.
CPUGETPCIINFO Scans all attached PCI busses and returns information
about each device found. This is used by the cpu(8) pro-
gram to determine the mapping between I/O APIC pins at-
tached to the PCI bus and the IRQ vectors they were mapped
to at boot time.
CPUCLKSYNC Start clock sync protocol; this uses a broadcast IPI to
synchronize the CPU internal clocks.
CPUSTAT Retrieve SMP related status.
CPUGETIHAND Get struct intrhand entries given an IRQ. This is used to
determine the relative priority (device types) of given
IRQs.
FILES
/dev/cpu
HISTORY
The cpu driver appeared in BSD/OS 4.0.
BSDI BSD/OS September 30, 1997 2