summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/man/man9/Makefile5
-rw-r--r--share/man/man9/pci_conf_read.9114
2 files changed, 117 insertions, 2 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index ba0113dc284..ec8ba88ca5e 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.105 2005/10/30 20:02:24 pedro Exp $
+# $OpenBSD: Makefile,v 1.106 2005/11/14 14:30:21 mickey Exp $
# $NetBSD: Makefile,v 1.4 1996/01/09 03:23:01 thorpej Exp $
# Makefile for section 9 (kernel function and variable) manual pages.
@@ -17,7 +17,7 @@ MAN= altq.9 audio.9 autoconf.9 boot.9 buffercache.9 bus_dma.9 bus_space.9 \
kern.9 knote.9 kthread.9 ktrace.9 loadfirmware.9 lock.9 log.9 \
malloc.9 mbuf.9 mbuf_tags.9 md5.9 microtime.9 \
mountroothook_establish.9 mutex.9 namei.9 \
- panic.9 pfind.9 physio.9 pmap.9 \
+ panic.9 pci_conf_read.9 pfind.9 physio.9 pmap.9 \
pool.9 powerhook_establish.9 ppsratecheck.9 printf.9 psignal.9 \
radio.9 random.9 rasops.9 ratecheck.9 resettodr.9 rssadapt.9 \
shutdownhook_establish.9 sleep.9 spl.9 startuphook_establish.9 \
@@ -213,6 +213,7 @@ MLINKS+=rssadapt.9 ieee80211_rssadapt_choose.9 \
rssadapt.9 ieee80211_rssadapt_lower_rate.9 \
rssadapt.9 ieee80211_rssadapt_raise_rate.9 \
rssadapt.9 ieee80211_rssadapt_updatestats.9
+MLINKS+=pci_conf_read.9 pci_conf_write.9 pci_conf_read.9 pci_make_tag.9
MLINKS+=pfind.9 pgfind.9
MLINKS+=pmap.9 pmap_init.9 pmap.9 pmap_enter.9 pmap.9 pmap_remove.9 \
pmap.9 pmap_unwire.9 pmap.9 pmap_protect.9 pmap.9 pmap_page_protect.9 \
diff --git a/share/man/man9/pci_conf_read.9 b/share/man/man9/pci_conf_read.9
new file mode 100644
index 00000000000..e719b095190
--- /dev/null
+++ b/share/man/man9/pci_conf_read.9
@@ -0,0 +1,114 @@
+.\" $OpenBSD: pci_conf_read.9,v 1.1 2005/11/14 14:30:21 mickey Exp $
+.\"
+.\" Copyright (c) 2005 Michael Shalayeff
+.\" All rights reserved.
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd November 20, 2005
+.Dt BUS_SPACE 9
+.Os
+.Sh NAME
+.Nm pci_make_tag ,
+.Nm pci_conf_read ,
+.Nm pci_conf_write
+.Nd PCI config space manipulation functions
+.Sh SYNOPSIS
+.Fd #include <alpha/pci/pci_machdep.h>
+.Fd #include <i386/pci/pci_machdep.h>
+.Fd #include <cats/pci/pci_machdep.h>
+.Fd #include <powerpc/pci/pci_machdep.h>
+.Fd #include <sgi/pci/pci_machdep.h>
+.Fd #include <machine/pci_machdep.h>
+.Ft pcitag_t
+.Fn pci_make_tag "pci_chipset_tag_t pc" "int bus" "int dev" "int func"
+.Ft pcireg_t
+.Fn pci_conf_read "pci_chipset_tag_t pc" "pcitag_t tag" "int reg"
+.Ft void
+.Fn pci_conf_write "pci_chipset_tag_t pc" "pcitag_t tag" "int reg" \
+"pcireg_t val"
+.Sh DESCRIPTION
+These functions provide a way for accessing PCI configuration space.
+.Pp
+The following types are defined in the MD include
+.Pa Aq pci_machdep.h
+file:
+.Bl -tag -width pci_chipset_tag_t -offset indent
+.It pci_chipset_tag_t
+a PCI chipset descriptor;
+.It pcitag_t
+a PCI device tag;
+.It pcireg_t
+a PCI register datum.
+.El
+.Pp
+In order to access PCI configuration space a device tag shall be made using
+.Nm pci_make_tag
+given the PCI chipset tag
+.Ar pc
+and the device specification in a tuple of
+.Ar bus ,
+.Ar device ,
+.Ar function .
+The PCI tag composition is a PCI chipset dependant operation
+although often as simple as shift and logical OR combination.
+Having a tag composed now it is possible to perform configuration
+space read and write with
+.Nm pci_conf_read
+and
+.Nm pci_conf_write
+respectively.
+Access to PCI configuration space is only provided for whole
+.Nm pcireg_t
+items that is usually a 32-bit integer.
+Accesses to non-existant PCI devices do not (or should not) generate
+any kinds of faults or interruptions and thus allow for an easy device
+scanning by cycling through all possible device and function numbers
+for a given bus.
+.Pp
+Below is an overview of defined PCI configuration space registers for
+devices:
+.Bl -tag -width 0xff -offset indent
+.It 0x00
+Vendor (lower word) and Product (higher word) identification.
+(see
+.Pa /sys/dev/pci/pcidevs
+for a comprehensive list)
+.It 0x04
+Commands and Status register.
+.It 0x08
+PCI device's class and subclass ids.
+See
+.Pa /sys/dev/pci/pcireg.h
+for PCI_CLASS_* and PCI_SUBCLASS_* definitions.
+.It 0x0c
+Specify (low byte to high): cache line size, PCI lattency timer, header type
+and BIST.
+.It 0x10 - 0x28
+Base address registers for IO and memory space mapped registers.
+.It 0x28
+Cardbus CIS register.
+.It 0x2c
+Similar to 0x00 register's definitions for a subsystem identification.
+.It 0x34
+A pointer to the capabilities list.
+Each item is an offset in the configuration space itself.
+.It 0x3c
+Interrupt line and pin numbers.
+.El
+.Pp
+.Sh SEE ALSO
+.Xr cardbus 4 ,
+.Xr pci 4 .
+.\" .Sh HISTORY
+.\" .Sh AUTHORS