Early PCs
Peripheral devices in the early PCs used fixed
i/o-ports and fixed memory-addresses, e.g.:
64
doublewords
PCI Configuration Space Body
(48 doublewords variable format)
0 31
Status
Register
BIST
Header
Type
Command
Register
Latency
Timer
Cache
Line
Size
0
Device
ID
Vendor
ID
Class Code
Class/SubClass/ProgIF
Revision
ID
Dwords
1- 0
3- 2
Base Address 1
Base Address 0
5- 4
Base Address 3
Base Address 2
7- 6
Base Address 5
Base Address 4
9- 8
11 - 10
Subsystem
Device ID
Subsystem
Vendor ID
reserved
capabilities
pointer
13 - 12
Interrupt
Line
reserved
15 - 14
memory
space
(4GB)
i/o space
(64KB)
PCI
configuration
space
(16MB)
CONFADD
( 0x0CF8)
E
N
23
reserved
16 15
bus
(8-bits)
device
(5-bits)
11 10
8 7
function
(3-bits)
doubleword
(6-bits)
00
CONFDAT
( 0x0CFC)
$0x0CFC, %dx
%dx, %eax
$16, %eax
%al, header_type
# setup port-number in DX
# input configuration longword
# shift word 2 into AL register
# store Header Type in variable
Demo Program
We created a short Linux utility that searches for
and reports all of your systems PCI devices
Its named pciprobe.cpp on our CS635 website
It uses some C++ macros that expand to Intel
input/output instructions -- which normally are
privileged instructions that a Linux applicationprogram is not allowed to execute (segfault!)
Our system administrator (Alex Fedosov) has
created a utility (named iopl3) that will allow
your command-shell to acquire I/O privileges
Vendors identity
The VENDOR-ID 0x14E4 belongs to the
Broadcom Corporation (headquarters in
Irvine, California)
Information about this firm may be learned
from the corporations website:
<http://www.broadcom.com>
Typical NIC
packet
main
memory
TX FIFO
buffer
B
U
S
CPU
nic
RX FIFO
transceiver
LAN
cable
Source-address (6-bytes)
Drivers authors
The Linux kernels open-source driver for
the Broadcom tigon3 network controller
was jointly written by David S. Miller (see
photo below) and Jeff Garzik
David Millers announcement in Feb 2002
of their drivers BETA version is online.
It includes his candid comments about
the challenge of writing such a driver when
the vendor does not make available its
devices programming documentation.
0 31
Status
Register
BIST
Header
Type
Command
Register
Latency
Timer
Cache
Line
Size
0
DeviceID
0x1677
VendorID
0x14E4
Class Code
Class/SubClass/ProgIF
Revision
ID
Dwords
1- 0
3- 2
Base Address 1
Base Address 0
5- 4
Base Address 3
Base Address 2
7- 6
Base Address 5
Base Address 4
9- 8
11 - 10
Subsystem
Device ID
Subsystem
Vendor ID
reserved
capabilities
pointer
13 - 12
Interrupt
Line
reserved
15 - 14
Linux helper-functions
#include <linux/pci.h>
struct pci_dev
unsigned int
void
*devp;
iomem_base, iomem_size;
*io;
Big-Endian to Little-Endian
Broadcom network interface storage-addresses
0x0410
mac
1
mac
0
mac
1
mac
2
mac
3
mac
4
mac
4
mac
3
mac
5
mac
2
In-class exercise
Copy the tigon3.c source-module to your
own directory, then rename it anchor.c
Your assignment is to modify it so that it
will show information about the Intel NICs
in our anchor clusters machines:
#define VENDOR_ID 0x8086
#define DEVICE_ID 0x109A
// Intel Corp
// 82573L NIC
Little-Endian to Little-Endian
Intel network interface storage-addresses
0x5400
mac
0
mac
2
mac
3
mac
0
mac
1
mac
2
mac
3
mac
5
mac
4
mac
5