Sun Java Solaris Communities My SDN Account Join SDN
 
Documentation

Introduction

Since its introduction in 1992, the PCI local bus Intro.doc.html1 has gained wide acceptance in the industry for its open architecture and performance. Being a leader in open systems, Sun started to support PCI device drivers by providing a new set of device driver interfaces (DDI) in the Solaris 2.5 operating environment. Beginning with the Ultra series, Sun supports the PCI bus in its workstation product lines.

The Solaris package provides two documents for PCI driver developers: Writing Device Drivers and Writing Portable DDI-Compliant PCI Drivers (a Sun white paper). Writing Device Drivers is intended for developers who write Solaris device drivers in general. It provides details about direct memory access (DMA), interrupt, device address mapping, and Sun Common SCSI Architecture (SCSA). Writing Portable DDI-Compliant PCI Drivers describes the new DDI functions for writing endian-neutral drivers. This white paper assumes that you have read and understand the contents of these two documents.

This white paper provides next level details on writing PCI device drivers. It addresses issues specifically encountered by PCI driver developers, such as properties and PCI nexus node. This document also gives a brief introduction to IEEE 1275 Standard for Boot Firmware: Core Requirements and Practices and related documents. IEEE 1275 defines the device tree and properties that are used by the firmware to interface with the system software.

PCI devices, being self-identifying devices, contain a configuration space to identify the device as well as to provide device configuration information to the system software. Properties allow driver developers to retrieve device information from PCI devices. Understanding the PCI properties is necessary to correctly set up device address mapping and to write interrupt service routines.

The PCI nexus driver (pci) for the Sun4u machine with the PCI bus is the driver for the on-board Host to PCI Bridge (HPB). pci implements bus-specific DDI functions for DMA, interrupt, and device mapping so that PCI device drivers can use generic DDI functions to perform driver tasks. This white paper provides details about the implementation of the nexus driver for DMA and interrupt and it explains what to expect when you use DMA and interrupt-related DDI functions.

This paper also gives a brief overview of the HPB and the functional description of HPB building blocks. Through a good understanding of the underlying hardware, the PCI driver developer can make the best use of DDI functions, and therefore write an efficient and robust driver.

A summary of the commonly used DDI functions for PCI device drivers is presented in the following table. This list does not preclude other DDI functions from being used in PCI device drivers. Some of the functions in the list are explained in detail in this white paper.

DDI Functions Description
General  
add_drv(1M) Add a new device driver to the system
drvconfig(1M) Configure the /devices directory
pci(4) Configuration files for PCI device driver
buf(9S) Block I/O data transfer structure
ddi_device_acc_attr(9S) Data access attributes structure
physio(9F) Perform physical I/O
Properties  
ddi_prop_op(9F) Get arbitrary-size properties
ddi_getprop(9F) Get boolean and integer-size properties
ddi_getlongprop(9F) Get arbitrary-size properties
ddi_getproplen(9F) Get the length of a given property
Interrupt  
ddi_get_iblock_cookie(9F) Retrieve the interrupt block cookie associated with a particular interrupt specification
ddi_add_intr(9F) Add an interrupt handler to the system
ddi_remove_intr(9F) Remove an interrupt handler from the system
ddi_intr_hilevel(9F) Indicate interrupt handler type
DMA  
ddi_dma_attr(9S) DMA attributes structure (see "ddi_dma_attr(9S)")
ddi_dma_cookie(9S) DMA address cookie
ddi_dma_alloc_handle(9F) Allocate DMA handle
ddi_dma_mem_alloc(9F) Allocate memory for DMA transfer
ddi_dma_mem_free(9F) Free previously allocated memory for DMA
ddi_dma_addr_bind_handle(9F) Bind an address to a DMA handle
ddi_dma_buf_bind_handle(9F) Bind a system buffer (buf(9S)) to a DMA handle
ddi_dma_unbind_handle(9F) Unbind the address in a DMA handle
ddi_dma_free_handle(9F) Free DMA handle
ddi_dma_sync(9F) Synchronize CPU and I/O views of memory
ddi_dma_nextcookie(9F) Retrieve subsequent DMA cookie
ddi_dma_numwin(9F) Retrieve number of DMA windows
ddi_dma_getwin(9F) Activate a new DMA window
Device Address Mapping  
ddi_regs_map_setup(9F) Set up a mapping for a register address space
ddi_regs_map_free(9F) Free a previously mapped register address space
Device Access  
ddi_getb(9F) Read 8 bits of data from the mapped memory address, device register, or allocated DMA memory address
ddi_getw(9F) Read 16 bits of data
ddi_getl(9F) Read 32 bits of data
ddi_getll(9F) Read 64 bits of data
ddi_putb(9F) Write 8 bits of data to the mapped memory address, device register, or allocated DMA memory address
ddi_putw(9F) Write 16 bits of data
ddi_putl(9F) Write 32 bits of data
ddi_putll(9F) Write 64 bits of data
 

Since the implementation of the PCI nexus driver might be changed from release to release, some information in this document may be outdated in future releases of Solaris software. Although some information may apply to all supported platforms of the Solaris environment, this paper is written specifically for developers who write PCI drivers for Sun SPARC platforms.

<< Previous |  Contents |  Next>>