Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

proto(4) [freebsd man page]

PROTO(4)						   BSD Kernel Interfaces Manual 						  PROTO(4)

NAME
proto -- Driver for prototyping and H/W diagnostics SYNOPSIS
To compile this driver into the kernel, place the following line in your kernel configuration file: device proto Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5): proto_load="YES" DESCRIPTION
The proto device driver attaches to PCI devices when no other device drivers are present and creates device special files for all resources associated with the device. The driver itself has no knowledge of the device it attaches to. Programs can open these device special files and perform register-level reads and writes. As such, the proto device driver is nothing but a conduit or gateway between user space pro- grams and the hardware device. Examples for why this is useful include hardware diagnostics and prototyping. In both these use cases, it is far more convenient to develop and run the logic in user space. Especially hardware diagnostics requires a somewhat user-friendly interface and adequate reporting. Nei- ther is done easily as kernel code. FILES
All device special files corresponding to a PCI device are located under /dev/proto/pci<d>:<b>:<s>:<f> with pci<d>:<b>:<s>:<f> representing the location of the PCI device in the PCI hierarchy. A location includes: <d> The PCI domain number <b> The PCI bus number <s> The PCI slot or device number <f> The PCI function number Every PCI device has a device special file called pcicfg. This device special file gives access to the PCI configuration space. For each valid base address register (BAR), a device special file is created that contains the BAR offset and the resource type. A resource type can be either io or mem representing I/O port or memory mapped I/O space (resp.) EXAMPLES
A single function PCI device in domain 0, on bus 1, in slot 2 and having a single memory mapped I/O region will have the following device special files: /dev/proto/pci0:1:2:0/10.mem /dev/proto/pci0:1:2:0/pcicfg AUTHORS
The proto device driver and this manual page were written by Marcel Moolenaar <marcel@xcllnt.net>. SECURITY CONSIDERATIONS
Because programs have direct access to the hardware, the proto driver is inherently insecure. It is not advisable to use this driver on a production machine. MISSING FUNCTIONALITY
The proto driver does not yet support interrupts. Since interrupts cannot be handled by the driver itself, they must be converted into sig- nals and delivered to the program that has registered for interrupts. In order to test the transmission or reception of data, some means of doing direct memory access (DMA) by the device must be possible. This too must be under the control of the program. The details of how a program can set up and initiate DMA still need to be fleshed out. Support for non-PCI devices has not been implemented yet. BSD
April 29, 2014 BSD

Check Out this Related Man Page

PCI(3)							   BSD Library Functions Manual 						    PCI(3)

NAME
pci -- library interface for PCI bus access LIBRARY
PCI Bus Access Library (libpci, -lpci) SYNOPSIS
#include <pci.h> int pcibus_conf_read(int pcifd, u_int bus, u_int dev, u_int func, u_int reg, pcireg_t *valp); int pcibus_conf_write(int pcifd, u_int bus, u_int dev, u_int func, u_int reg, pcireg_t val); int pcidev_conf_read(int devfd, u_int reg, pcireg_t *valp); int pcidev_conf_write(int devfd, u_int reg, pcireg_t val); char * pci_findvendor(pcireg_t id_reg); void pci_devinfo(pcireg_t id_reg, pcireg_t class_reg, char *devinfo, size_t len); void pci_conf_print(int pcifd, u_int bus, u_int dev, u_int func); DESCRIPTION
The pci library provides support for accessing the PCI bus by user programs. These functions are available in the libpci library. Programs should be linked with -lpci. CONFIGURATION SPACE FUNCTIONS
The following functions are used to access PCI configuration space: pcibus_conf_read() Access the PCI configuration register reg on the device located at bus, dev, func, and place the result in *valp. pcifd must be an open file descriptor to a PCI bus within the target PCI domain. pcibus_conf_write() Write the value specified by val into the PCI configuration register reg on the device located at bus, dev, func. pcifd must be an open file descriptor to a PCI bus within the target PCI domain. pcidev_conf_read() Access the PCI configuration register reg on the device associated with the open file descriptor devfd and place the result in *valp. pcidev_conf_write() Write the value specified by val into the PCI configuration register reg on the device associated with the open file descriptor devfd. MISCELLANEOUS FUNCTIONS
The following miscellaneous functions are available: pci_findvendor() Return an ASCII description of the PCI vendor in the PCI ID register id_reg. pci_devinfo() Return an ASCII description of the PCI vendor, PCI product, and PCI class specified by the PCI ID register id_reg and PCI class ID reg- ister class_reg. The description is placed into the buffer pointed to by devinfo; the size of that buffer is specified in len. pci_conf_print() Print the PCI configuration information for the device located at bus, dev, func. pcifd must be an open file descriptor to a PCI bus within the target PCI domain. RETURN VALUES
The pcibus_conf_read(), pcibus_conf_write(), pcidev_conf_read(), and pcidev_conf_write() functions return 0 on success and -1 on failure. The pci_findvendor() function returns NULL if the PCI vendor description cannot be found. SEE ALSO
pci(4) HISTORY
The pcibus_conf_read(), pcibus_conf_write(), pcidev_conf_read(), pcidev_conf_write(), pci_findvendor(), pci_devinfo(), and pci_conf_print() functions first appeared in NetBSD 1.6. BSD
April 24, 2004 BSD
Man Page