pdiag_pcicfg_read

Purpose

Reads a PCI Configuration register.

Syntax


#include <sys/pdiagex_dds.h>
#include <sys/pdiag_def.h>

int32 pdiag_pcicfg_read( device_instance, reg_offset, datasize, data )

pdiag_addr_t         device_instance;
ulong                reg_offset;
int                  datasize;
uchar                *data;

Description

The pdiag_pcicfg_read() function reads 8, 16, or 32 bits of a PCI Configuration register for this particular resource. The reg_offset parameter contains the register offset into the device's PCI configuration table. The calling application must provide a valid register offset before calling pdiag_pcicfg_read. The returned data is the 8, 16, or 32 bit value read from the PCI register configuration table. All the byte swapping required is performed internally by this function; the calling application must not alter the byte positioning of the data.

Execution Environment

The pdiag_pcicfg_read() function can be called from the process environment only.

Parameters

Parameter Description
device_instance Pointer to the string name of the specific device to read.
reg_offset Contains the offset within the PCI configuration table register to be read.
datasize The data size will be specified as follows:
Size
Type
8 bits
IOCHAR8
16 bits
IOSHORT16
32 bits
IOLONG32
data Pointer to the data to be read within the PCI Configuration Table.
Note: The value read is the specified size on the datasize parameter.

Return Value

The pdiag_pcicfg_read function returns one of the following values:

Return Value Description
0 Successful return
-1 Software error