From 86ba121d6623cf02c7d99d2e056b6d9f912966f7 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Thu, 9 Jul 2009 23:29:21 +0200 Subject: [PATCH] pci.9: Sync with FreeBSD. --- share/man/man9/Makefile | 1 + share/man/man9/pci.9 | 75 ++++++++++++++++++++++++++++++----------- 2 files changed, 56 insertions(+), 20 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 8879e24f09..5ee99ab7c2 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -521,6 +521,7 @@ MLINKS+=pci.9 pci_disable_busmaster.9 \ pci.9 pci_enable_busmaster.9 \ pci.9 pci_enable_io.9 \ pci.9 pci_find_bsf.9 \ + pci.9 pci_find_dbsf.9 \ pci.9 pci_find_device.9 \ pci.9 pci_get_powerstate.9 \ pci.9 pci_read_config.9 \ diff --git a/share/man/man9/pci.9 b/share/man/man9/pci.9 index e855a424fb..89194e499f 100644 --- a/share/man/man9/pci.9 +++ b/share/man/man9/pci.9 @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 2003 Bruce M Simpson +.\" Copyright (c) 2005 Bruce M Simpson .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -23,10 +23,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man9/pci.9,v 1.2.2.1 2003/06/13 01:04:17 hmp Exp $ +.\" $FreeBSD: src/share/man/man9/pci.9,v 1.11 2008/02/15 23:56:33 danger Exp $ .\" $DragonFly: src/share/man/man9/pci.9,v 1.6 2008/08/02 01:14:36 dillon Exp $ .\" -.Dd July 19, 2008 +.Dd July 9, 2009 .Dt PCI 9 .Os .Sh NAME @@ -40,6 +40,7 @@ .Nm pci_set_powerstate , .Nm pci_get_powerstate , .Nm pci_find_bsf , +.Nm pci_find_dbsf , .Nm pci_find_device .Nd PCI bus interface .Sh SYNOPSIS @@ -47,27 +48,28 @@ .In bus/pci/pcivar.h .In bus/pci/pcireg.h .In bus/pci/pci_cfgreg.h -.Pp -.Ft void -.Fn pci_write_config "device_t dev" "int reg" "u_int32_t val" "int width" .Ft void +.Fn pci_write_config "device_t dev" "int reg" "uint32_t val" "int width" +.Ft int .Fn pci_enable_busmaster "device_t dev" -.Ft void +.Ft int .Fn pci_disable_busmaster "device_t dev" -.Ft void +.Ft int .Fn pci_enable_io "device_t dev" "int space" -.Ft void +.Ft int .Fn pci_disable_io "device_t dev" "int space" .Ft int .Fn pci_set_powerstate "device_t dev" "int state" .Ft int .Fn pci_get_powerstate "device_t dev" -.Ft u_int32_t +.Ft uint32_t .Fn pci_read_config "device_t dev" "int reg" "int width" .Ft device_t -.Fn pci_find_bsf "u_int8_t bus" "u_int8_t slot" "u_int8_t func" +.Fn pci_find_bsf "uint8_t bus" "uint8_t slot" "uint8_t func" .Ft device_t -.Fn pci_find_device "u_int16_t vendor" "u_int16_t device" +.Fn pci_find_dbsf "uint32_t domain" "uint8_t bus" "uint8_t slot" "uint8_t func" +.Ft device_t +.Fn pci_find_device "uint16_t vendor" "uint16_t device" .Sh DESCRIPTION The .Nm @@ -153,14 +155,14 @@ full functionality to the user. .It Dv PCI_POWERSTATE_D1 Class-specific low-power state in which device context may or may not be lost. -Buses in this state cannot do anything to the bus, to +Busses in this state cannot do anything to the bus, to force devices to lose context. .It Dv PCI_POWERSTATE_D2 Class-specific low-power state in which device context may or may not be lost. Attains greater power savings than .Dv PCI_POWERSTATE_D1 . -Buses in this state can cause devices to loose some context. +Busses in this state can cause devices to lose some context. Devices .Em must be prepared for the bus to be in this state or higher. @@ -195,6 +197,35 @@ of a PCI device, given its .Fa slot , and .Fa func . +The +.Fa slot +number actually refers to the number of the device on the bus, +which does not necessarily indicate its geographic location +in terms of a physical slot. +Note that in case the system has multiple PCI domains, +the +.Fn pci_find_bsf +function only searches the first one. +Actually, it is equivalent to: +.Bd -literal -offset indent +pci_find_dbsf(0, bus, slot, func); +.Ed +.Pp +The +.Fn pci_find_dbsf +function looks up the +.Vt device_t +of a PCI device, given its +.Fa domain , +.Fa bus , +.Fa slot , +and +.Fa func . +The +.Fa slot +number actually refers to the number of the device on the bus, +which does not necessarily indicate its geographic location +in terms of a physical slot. .Pp The .Fn pci_find_device @@ -218,8 +249,8 @@ space on the target architecture. .Xr bus_alloc_resource 9 , .Xr bus_dma 9 , .Xr bus_release_resource 9 , -.Xr BUS_SETUP_INTR 9 , -.Xr BUS_TEARDOWN_INTR 9 , +.Xr bus_setup_intr 9 , +.Xr bus_teardown_intr 9 , .Xr devclass 9 , .Xr device 9 , .Xr driver 9 , @@ -238,8 +269,12 @@ space on the target architecture. .%O ISBN 0-201-30974-2 .Re .Sh AUTHORS -This man page was written by -.An Bruce M Simpson Aq bms@spc.org . +This manual page was written by +.An Bruce M Simpson Aq bms@FreeBSD.org . .Sh BUGS -This manual page does not yet document PAE and how it affects memory-space -mapping of PCI devices. +The kernel PCI code has a number of references to +.Dq "slot numbers" . +These do not refer to the geographic location of PCI devices, +but to the device number assigned by the combination of the PCI IDSEL +mechanism and the platform firmware. +This should be taken note of when working with the kernel PCI code. -- 2.41.0