Misplaced Pages

PCI configuration space

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

PCI configuration space is the underlying way that the Conventional PCI , PCI-X and PCI Express perform auto configuration of the cards inserted into their bus.

#693306

73-498: PCI devices have a set of registers referred to as configuration space and PCI Express introduces extended configuration space for devices. Configuration space registers are mapped to memory locations. Device drivers and diagnostic software must have access to the configuration space, and operating systems typically use APIs to allow access to device configuration space. When the operating system does not have access methods defined or APIs for memory mapped configuration space requests,

146-544: A procedural language such as Lua could consist primarily of basic routines to execute code, manipulate data or handle errors while an API for an object-oriented language , such as Java, would provide a specification of classes and its class methods . Hyrum's law states that "With a sufficient number of users of an API, it does not matter what you promise in the contract: all observable behaviors of your system will be depended on by somebody." Meanwhile, several studies show that most applications that use an API tend to use

219-420: A software framework : a framework can be based on several libraries implementing several APIs, but unlike the normal use of an API, the access to the behavior built into the framework is mediated by extending its content with new classes plugged into the framework itself. Moreover, the overall program flow of control can be out of the control of the caller and in the framework's hands by inversion of control or

292-496: A user interface , an API is typically not visible to users. It is an "under the hood" portion of a software system, used for machine-to-machine communication. A well-designed API exposes only objects or actions needed by software or software developers. It hides details that have no use. This abstraction simplifies programming. Building software using APIs has been compared to using building-block toys, such as Lego bricks. Software services or software libraries are analogous to

365-565: A 32-bit word. Configuration reads and writes can be initiated from the CPU in two ways: one legacy method via I/O addresses 0xCF8 and 0xCFC , and another called memory-mapped configuration. The legacy method was present in the original PCI, and it is called Configuration Access Mechanism (CAM). It allows for 256 bytes of a device's address space to be reached indirectly via two 32-bit registers called PCI CONFIG_ADDRESS and PCI CONFIG_DATA. These registers are at addresses 0xCF8 and 0xCFC in

438-449: A broad term describing much of the communication on the internet. When used in this way, the term API has overlap in meaning with the term communication protocol . The interface to a software library is one type of API. The API describes and prescribes the "expected behavior" (a specification) while the library is an "actual implementation" of this set of rules. A single API can have multiple implementations (or none, being abstract) in

511-517: A business ecosystem. The main policies for releasing an API are: An important factor when an API becomes public is its "interface stability". Changes to the API—for example adding new parameters to a function call—could break compatibility with the clients that depend on that API. When parts of a publicly presented API are subject to change and thus not stable, such parts of a particular API should be documented explicitly as "unstable". For example, in

584-460: A client would need to know for practical purposes. Documentation is crucial for the development and maintenance of applications using the API. API documentation is traditionally found in documentation files but can also be found in social media such as blogs, forums, and Q&A websites. Traditional documentation files are often presented via a documentation system, such as Javadoc or Pydoc, that has

657-435: A consistent appearance and structure. However, the types of content included in the documentation differs from API to API. In the interest of clarity, API documentation may include a description of classes and methods in the API as well as "typical usage scenarios, code snippets, design rationales, performance discussions, and contracts", but implementation details of the API services themselves are usually omitted. It can take

730-473: A device and must implement at least function number zero. The first 64 bytes of configuration space are standardized; the remainder are available for vendor-defined purposes. Some high-end computers support more than one PCI domain (or PCI segment); each PCI segment supports up to 256 buses. A PCI segment may be referred to a PCI root bridge . In order to allow more parts of configuration space to be standardized without conflicting with existing uses, there can be

803-534: A given API, it is possible to infer the typical usages, as well the required contracts and directives. Then, templates can be used to generate natural language from the mined data. In 2010, Oracle Corporation sued Google for having distributed a new implementation of Java embedded in the Android operating system. Google had not acquired any permission to reproduce the Java API, although permission had been given to

SECTION 10

#1732780305694

876-579: A given device in the PCI Express fabric. During system initialization, BIOS determines the base address for this "stolen" address region and communicates it to the root complex and to the operating system. Each device has its own 4 KB space and each device's info is accessible through a simple array dev[bus][device][function] so that 256 MB of physical contiguous space is "stolen" for this use (256 buses × 32 devices × 8 functions × 4 KB = 256 MB). The base physical address of this array

949-464: A list of capabilities defined within the remaining 192 bytes of PCI configuration space. Each capability has one byte that describes which capability it is, and one byte to point to the next capability. The number of additional bytes depends on the capability ID. If capabilities are being used, a bit in the Status register is set, and a pointer to the first in a linked list of capabilities is provided in

1022-441: A modular software library in the 1940s for EDSAC , an early computer. The subroutines in this library were stored on punched paper tape organized in a filing cabinet . This cabinet also contained what Wilkes and Wheeler called a "library catalog" of notes about each subroutine and how to incorporate it into a program. Today, such a catalog would be called an API (or an API specification or API documentation) because it instructs

1095-470: A number of forms, including instructional documents, tutorials, and reference works. It'll also include a variety of information types, including guides and functionalities. Restrictions and limitations on how the API can be used are also covered by the documentation. For instance, documentation for an API function could note that its parameters cannot be null, that the function itself is not thread safe . Because API documentation tends to be comprehensive, it

1168-529: A person (the end user ) other than a computer programmer who is incorporating it into software. An API is often made up of different parts which act as tools or services that are available to the programmer. A program or a programmer that uses one of these parts is said to call that portion of the API. The calls that make up the API are also known as subroutines , methods, requests, or endpoints . An API specification defines these calls, meaning that it explains how to use or implement them. One purpose of APIs

1241-440: A programmer on how to use (or "call") each subroutine that the programmer needs. Wilkes and Wheeler's book The Preparation of Programs for an Electronic Digital Computer contains the first published API specification. Joshua Bloch considers that Wilkes and Wheeler "latently invented" the API, because it is more of a concept that is discovered than invented. The term "application program interface" (without an -ing suffix)

1314-499: A read to a specified B/D/F combination for the vendor ID register succeeds, the system firmware or operating system knows that it exists; it writes all ones to its BARs and reads back the device's requested memory size in an encoded form. The design implies that all address space sizes are a power of two and are naturally aligned. At this point, the BIOS or operating system will program the memory-mapped addresses and I/O port addresses into

1387-643: A shipping company API that can be added to an eCommerce-focused website to facilitate ordering shipping services and automatically include current shipping rates, without the site developer having to enter the shipper's rate table into a web database. While "web API" historically has been virtually synonymous with web service , the recent trend (so-called Web 2.0 ) has been moving away from Simple Object Access Protocol ( SOAP ) based web services and service-oriented architecture (SOA) towards more direct representational state transfer (REST) style web resources and resource-oriented architecture (ROA). Part of this trend

1460-404: A similar mechanism. An API can specify the interface between an application and the operating system . POSIX , for example, specifies a set of common APIs that aim to enable an application written for a POSIX conformant operating system to be compiled for another POSIX conformant operating system. Linux and Berkeley Software Distribution are examples of operating systems that implement

1533-441: A small part of the API. Language bindings are also APIs. By mapping the features and capabilities of one language to an interface implemented in another language, a language binding allows a library or service written in one language to be used when developing in another language. Tools such as SWIG and F2PY, a Fortran -to- Python interface generator, facilitate the creation of such interfaces. An API can also be related to

SECTION 20

#1732780305694

1606-454: Is a challenge for writers to keep the documentation updated and for users to read it carefully, potentially yielding bugs. API documentation can be enriched with metadata information like Java annotations . This metadata can be used by the compiler, tools, and by the run-time environment to implement custom behaviors or custom handling. It is possible to generate API documentation in a data-driven manner. By observing many programs that use

1679-511: Is allocated by the PCI-SIG . The 16-bit device ID is then assigned by the vendor. There is an inactive project to collect all known Vendor and Device IDs. (See the external links below.) The Status register is used to report which features are supported and whether certain kinds of errors have occurred. The Command register contains a bitmask of features that can be individually enabled and disabled. The Header Type register values determine

1752-430: Is an API response . A weather forecasting app might integrate with a number of weather sensor APIs, gathering weather data from throughout a geographical area. An API is often compared to a contract . It represents an agreement between parties: a service provider who offers the API and the software developers who rely upon it. If the API remains stable, or if it changes only in predictable ways, developers' confidence in

1825-512: Is an architectural approach that revolves around providing a program interface to a set of services to different applications serving different types of consumers. When used in the context of web development , an API is typically defined as a set of specifications, such as Hypertext Transfer Protocol (HTTP) request messages, along with a definition of the structure of response messages, usually in an Extensible Markup Language ( XML ) or JavaScript Object Notation ( JSON ) format. An example might be

1898-407: Is called an API specification . A computer system that meets this standard is said to implement or expose an API. The term API may refer either to the specification or to the implementation. In contrast to a user interface , which connects a computer to a person, an application programming interface connects computers or pieces of software to each other. It is not intended to be used directly by

1971-522: Is created in one place dynamically can be posted and updated to multiple locations on the web. For example, Twitter's REST API allows developers to access core Twitter data and the Search API provides methods for developers to interact with Twitter Search and trends data. The design of an API has significant impact on its usage. The principle of information hiding describes the role of programming interfaces as enabling modular programming by hiding

2044-399: Is first recorded in a paper called Data structures and techniques for remote computer graphics presented at an AFIPS conference in 1968. The authors of this paper use the term to describe the interaction of an application—a graphics program in this case—with the rest of the computer system. A consistent application interface (consisting of Fortran subroutine calls) was intended to free

2117-419: Is merely a device's sequential number on that bus. Moreover, after a new bridge is detected, a new bus number is defined, and device enumeration restarts at device number zero. If no response is received from the device's function #0, the bus master performs an abort and returns an all-bits-on value ( FFFFFFFF in hexadecimal), which is an invalid VID/DID value, thus the BIOS or operating system can tell that

2190-456: Is not specified. For example, on modern x86 systems the ACPI tables contain the necessary information. API An application programming interface ( API ) is a connection between computers or between computer programs . It is a type of software interface , offering a service to other pieces of software . A document or standard that describes how to build such a connection or interface

2263-453: Is now the most common meaning of the term API. The Semantic Web proposed by Tim Berners-Lee in 2001 included "semantic APIs" that recast the API as an open , distributed data interface rather than a software behavior interface. Proprietary interfaces and agents became more widespread than open ones, but the idea of the API as a data interface took hold. Because web APIs are widely used to exchange data of all kinds online, API has become

PCI configuration space - Misplaced Pages Continue

2336-475: Is related to the Semantic Web movement toward Resource Description Framework (RDF), a concept to promote web-based ontology engineering technologies. Web APIs allow the combination of multiple APIs into new applications known as mashups . In the social media space, web APIs have allowed web communities to facilitate sharing content and data between communities and applications. In this way, content that

2409-427: Is required to decode only the lowest order 11 bits of the address space (AD[10] to AD[0]) address/data signals, and can ignore decoding the 21 high order A/D signals (AD[31] to AD[11]) because a Configuration Space access implementation has each slot's IDSEL pin connected to a different high order address/data line AD[11] through AD[31]. The IDSEL signal is a different pin for each PCI device/adapter/slot. To configure

2482-684: Is system dependent. This register does not apply to PCI Express. The Subsystem ID (SSID) and the Subsystem Vendor ID (SVID) differentiate specific model (such as an add-in card). While the Vendor ID is that of the chipset manufacturer, the Subsystem Vendor ID is that of the card manufacturer. The Subsystem ID is assigned by the subsystem vendor, the Device ID is assigned by the chipset manufacturer. As an example, in

2555-451: Is the following: As explained previously, addressing a device via Bus, Device, and Function (BDF) is also referred to as "addressing a device geographically." See arch/x86/pci/early.c in the Linux kernel code for an example of code that uses geographical addressing. When extended configuration space is used on some AMD CPUs, the extra bits 11:8 of the offset are written to bits 27:24 of

2628-440: Is to hide the internal details of how a system works, exposing only those parts a programmer will find useful and keeping them consistent even if the internal details later change. An API may be custom-built for a particular pair of systems, or it may be a shared standard allowing interoperability among many systems. The term API is often used to refer to web APIs , which allow communication between computers that are joined by

2701-533: The Cap. pointer register defined in the Standardized Registers. PCI-X 2.0 and PCI Express introduced an extended configuration space, up to 4096 bytes. The only standardized part of extended configuration space is the first four bytes at 0x100 which are the start of an extended capability list. Extended capabilities are very much like normal capabilities except that they can refer to any byte in

2774-549: The Google Guava library, the parts that are considered unstable, and that might change soon, are marked with the Java annotation @Beta . A public API can sometimes declare parts of itself as deprecated or rescinded. This usually means that part of the API should be considered a candidate for being removed, or modified in a backward incompatible way. Therefore, these changes allow developers to transition away from parts of

2847-686: The Java language in particular. In the 1990s, with the spread of the internet , standards like CORBA , COM , and DCOM competed to become the most common way to expose API services. Roy Fielding 's dissertation Architectural Styles and the Design of Network-based Software Architectures at UC Irvine in 2000 outlined Representational state transfer (REST) and described the idea of a "network-based Application Programming Interface" that Fielding contrasted with traditional "library-based" APIs. XML and JSON web APIs saw widespread commercial adoption beginning in 2000 and continuing as of 2021. The web API

2920-512: The Java remote method invocation API uses the Java Remote Method Protocol to allow invocation of functions that operate remotely, but appear local to the developer. Therefore, remote APIs are useful in maintaining the object abstraction in object-oriented programming ; a method call , executed locally on a proxy object, invokes the corresponding method on the remote object, using the remoting protocol, and acquires

2993-556: The Linux Standard Base provides an ABI. Remote APIs allow developers to manipulate remote resources through protocols , specific standards for communication that allow different technologies to work together, regardless of language or platform. For example, the Java Database Connectivity API allows developers to query many different types of databases with the same set of functions, while

PCI configuration space - Misplaced Pages Continue

3066-479: The internet . There are also APIs for programming languages , software libraries , computer operating systems , and computer hardware . APIs originated in the 1940s, though the term did not emerge until the 1960s and 70s. An API opens a software system to interactions from the outside. It allows two software systems to communicate across a boundary — an interface — using mutually agreed-upon signals. In other words, an API connects software entities together. Unlike

3139-471: The motherboard ) through the PCI controller using the per slot or per device IDSEL (Initialization Device Select) signals. When the computer is powered on, the PCI bus(es) and device(s) must be enumerated by BIOS or operating system. Bus enumeration is performed by attempting to access the PCI configuration space registers for each buses, devices and functions. Note that device number, different from VID and DID,

3212-428: The "Above 4G" option in system firmware, 64 bit BARs can be used. Resizable BAR (also known as Re-Size BAR , AMD Smart Access Memory (SAM), or ASRock Clever Access Memory (CAM)) is a capability which a PCIe device can use to negotiate a larger BAR size. Classically, BARs were limited to a size of 256MB, but modern graphics cards have framebuffers much larger than that. This mismatch led to inefficiencies when

3285-461: The API that will be removed or not supported in the future. Client code may contain innovative or opportunistic usages that were not intended by the API designers. In other words, for a library with a significant user base, when an element becomes part of the public API, it may be used in diverse ways. On February 19, 2020, Akamai published their annual “State of the Internet” report, showcasing

3358-489: The API will increase. This may increase their use of the API. The term API initially described an interface only for end-user-facing programs, known as application programs . This origin is still reflected in the name "application programming interface." Today, the term is broader, including also utility software and even hardware interfaces . The idea of the API is much older than the term itself. British computer scientists Maurice Wilkes and David Wheeler worked on

3431-463: The CONFIG_ADDRESS register: The second method was created for PCI Express. It is called Enhanced Configuration Access Mechanism (ECAM). It extends device's configuration space to 4 KB, with the bottom 256 bytes overlapping the original (legacy) configuration space in PCI. The section of the addressable space is "stolen" so that the accesses from the CPU don't go to memory but rather reach

3504-538: The CPU accessed the framebuffer. Resizable BAR lets a CPU access the whole framebuffer at once, thus improving performance. A PCI device may also have an option ROM . When performing a Configuration Space access, a PCI device does not decode the address to determine if it should respond, but instead looks at the Initialization Device Select signal (IDSEL). There is a system-wide unique activation method for each IDSEL signal. The PCI device

3577-678: The IDSEL signal to reach a valid level. The scanning on the bus is performed on the Intel platform by accessing two defined standardized ports. These ports are the Configuration Space Address ( 0xCF8 ) I/O port and Configuration Space Data ( 0xCFC ) I/O port. The value written to the Configuration Space Address I/O port is created by combining B/D/F values and the registers address value into

3650-459: The PCI controller. Because all PCI devices are in an inactive state upon system reset, they will have no addresses assigned to them by which the operating system or device drivers can communicate with them. Either the BIOS or the operating system geographically addresses the PCI devices (for example, the first PCI slot, the second PCI slot, the third PCI slot, or the integrated PCI devices, etc., on

3723-502: The POSIX APIs. Microsoft has shown a strong commitment to a backward-compatible API, particularly within its Windows API (Win32) library, so older applications may run on newer versions of Windows using an executable-specific setting called "Compatibility Mode". An API differs from an application binary interface (ABI) in that an API is source code based while an ABI is binary based. For instance, POSIX provides APIs while

SECTION 50

#1732780305694

3796-401: The application programming interface separately from other interfaces, such as the query interface. Database professionals in the 1970s observed these different interfaces could be combined; a sufficiently rich application interface could support the other interfaces as well. This observation led to APIs that supported all types of programming, not just application programming. By 1990, the API

3869-413: The bricks; they may be joined together via their APIs, composing a new software product. The process of joining is called integration . As an example, consider a weather sensor that offers an API. When a certain message is transmitted to the sensor, it will detect the current weather conditions and reply with a weather report. The message that activates the sensor is an API call , and the weather report

3942-422: The card in slot n , the PCI bus bridge performs a configuration-space access cycle with the PCI device's register to be addressed on lines AD[7:2] (AD[1:0] are always zero since registers are double words (32-bits)), and the PCI function number specified on bits AD[10:8], with all higher-order bits zeros except for AD[ n +11] being used as the IDSEL signal on a given slot/device. To reduce electrically loading down

4015-539: The card, which is the kind of information the driver may use to apply a minor card-specific change in its operation. To address a PCI device, it must be enabled by being mapped into the system's I/O port address space or memory-mapped address space . The system's firmware (e.g. BIOS ) or the operating system program the Base Address Registers (commonly called BARs) to inform the device of its resources configuration by writing configuration commands to

4088-515: The case of wireless network cards , the chip manufacturer might be Intel or Broadcom or Atheros , and the card manufacturer might be Netgear or Hewlett-Packard . Generally, the Vendor ID–;Device ID combination designates which driver the host should load in order to handle the device, as all cards with the same VID:DID combination can be handled by the same driver. The Subsystem Vendor ID–Subsystem ID combination identifies

4161-412: The device's BAR configuration registers. These addresses stay valid as long as the system remains turned on. Upon power-off, these settings are lost and the procedure is repeated next time the system is powered back on. The BIOS or operating system will also program some other registers of the PCI configuration space for each PCI device, e.g. interrupt request . Since this entire process is fully automated,

4234-459: The different layouts of remaining 48 bytes (64-16) of the header, depending on the function of the device. That is, Type 1 headers for Root Complex, switches, and bridges. Then Type 0 for endpoints. The Cache Line Size register must be programmed before the device is told it can use the memory-write-and-invalidate transaction. This should normally match the CPU's cache line size, but the correct setting

4307-459: The discovery continues recursively until all possible domain/bus/device combinations are scanned. Each non-bridge PCI device function can implement up to 6 BARs, each of which can respond to different addresses in I/O port and memory-mapped address space. Each BAR describes a region that is between 16 bytes and 2 gigabytes in size, located below the 4 gigabyte address space limit. If a platform supports

4380-501: The driver or diagnostic software has the burden to access the configuration space in a manner that is compatible with the operating system's underlying access rules. In all systems, device drivers are encouraged to use APIs provided by the operating system to access the configuration space of the device. One of the major improvements the PCI Local Bus had over other I/O architectures was its configuration mechanism. In addition to

4453-461: The extended configuration space (by using 12 bits instead of eight), have a four-bit version number and a 16-bit capability ID. Extended capability IDs overlap with normal capability IDs, but there is no chance of confusion as they are in separate lists. The Device ID (DID) and Vendor ID (VID) registers identify the device (such as an IC ), and are commonly called the PCI ID . The 16-bit vendor ID

SECTION 60

#1732780305694

4526-420: The form of different libraries that share the same programming interface. The separation of the API from its implementation can allow programs written in one language to use a library written in another. For example, because Scala and Java compile to compatible bytecode , Scala developers can take advantage of any Java API. API use can vary depending on the type of programming language involved. An API for

4599-476: The growing trend of cybercriminals targeting public API platforms at financial services worldwide. From December 2017 through November 2019, Akamai witnessed 85.42 billion credential violation attacks. About 20%, or 16.55 billion, were against hostnames defined as API endpoints. Of these, 473.5 million have targeted financial services sector organizations. API documentation describes what services an API offers and how to use those services, aiming to cover everything

4672-490: The implementation details of the modules so that users of modules need not understand the complexities inside the modules. Thus, the design of an API attempts to provide only the tools a user would expect. The design of programming interfaces represents an important part of software architecture , the organization of a complex piece of software. APIs are one of the more common ways technology companies integrate. Those that provide and use APIs are considered as being members of

4745-514: The normal memory-mapped and I/O port spaces, each device function on the bus has a configuration space , which is 256 bytes long, addressable by knowing the eight-bit PCI bus , five-bit device, and three-bit function numbers for the device (commonly referred to as the BDF or B/D/F , as abbreviated from bus/device/function ). This allows up to 256 buses, each with up to 32 devices, each supporting eight functions. A single PCI expansion card can respond as

4818-614: The programmer from dealing with idiosyncrasies of the graphics display device, and to provide hardware independence if the computer or the display were replaced. The term was introduced to the field of databases by C. J. Date in a 1974 paper called The Relational and Network Approaches: Comparison of the Application Programming Interface . An API became a part of the ANSI/SPARC framework for database management systems . This framework treated

4891-442: The result to be used locally as a return value. A modification of the proxy object will also result in a corresponding modification of the remote object. Web APIs are the defined interfaces through which interactions happen between an enterprise and applications that use its assets, which also is a Service Level Agreement (SLA) to specify the functional provider and expose the service path or URL for its API users. An API approach

4964-452: The similar OpenJDK project. Judge William Alsup ruled in the Oracle v. Google case that APIs cannot be copyrighted in the U.S. and that a victory for Oracle would have widely expanded copyright protection to a "functional set of symbols" and allowed the copyrighting of simple software commands: To accept Oracle's claim would be to allow anyone to copyright one version of code to carry out

5037-432: The specified combination bus/device_number/function (B/D/F) is not present. So, when a read to a function ID of zero for a given bus/device causes the master (initiator) to abort, it must then be presumed that no working device exists on that bus because devices are required to implement function number zero. In this case, reads to the remaining functions numbers (1–7) are not necessary as they also will not exist. When

5110-508: The timing critical (and thus electrically loading sensitive) AD[] bus, the IDSEL signal on the PCI slot connector is usually connected to its assigned AD[ n +11] pin through a resistor. This causes the PCI's IDSEL signal to reach its active condition more slowly than other PCI bus signals (due to the RC time constant of both the resistor and the IDSEL pin's input capacitance). Thus Configuration Space accesses are performed more slowly to allow time for

5183-441: The user is spared the task of configuring any newly added hardware manually by changing DIP switches on the cards themselves. This automatic device discovery and address space assignment is how plug and play is implemented. If a PCI-to-PCI bridge is found, the system must assign the secondary PCI bus beyond the bridge a bus number other than zero, and then enumerate the devices on that secondary bus. If more PCI bridges are found,

5256-460: The x86 I/O address space. For example, a software driver (firmware, OS kernel or kernel driver) can use these registers to configure a PCI device by writing the address of the device's register into CONFIG_ADDRESS, and by putting the data that is supposed to be written to the device into CONFIG_DATA. Since this process requires a write to a register in order to write the device's register, it is referred to as "indirection". The format of CONFIG_ADDRESS

5329-455: Was defined simply as "a set of services available to a programmer for performing certain tasks" by technologist Carl Malamud . The idea of the API was expanded again with the dawn of remote procedure calls and web APIs . As computer networks became common in the 1970s and 80s, programmers wanted to call libraries located not only on their local computers, but on computers located elsewhere. These remote procedure calls were well supported by

#693306