Inter core i7处理器中(x86架构)驱动开发:关于APCI Hardware ID的描述

   最近在调试Inter平台core i7,基于X86架构的工控产品,在移植驱动的过程中,发现GPIO和I2C的device ID添加到pnp驱动框架后无法进入probe函数,后面找了下原因,因为pnp遵循的是ACPI规范,是由于如下Hardware ID字段是需要从BIOS中进行描述的,而目前的驱动匹配不到对应的字段,自然就不可能注册成功了。

   PNP是什么东西?不是三极管的那个PNP啦,这个PNP表示的是:Plug-and-Play,译文为即插即用。

   PnP的作用是自动配置底层计算机中的板卡和其他设备,然后告诉对应设备都做了什么。PnP的任务是把物理设备和软件设备驱动程序相配合,并操作设备,在每个设备和它的驱动程序之间建立通信信道。然后,PnP分配下列资源给设备和硬件:I/O地址、IRQ、DMA通道和内存段。即插即用设备配置的控制权将从系统BIOS传递到系统
软件,所以驱动中一定会有代码进行描述,到时可以跟一下这部分的代码深入了解一下。
由于PNP遵循ACPI的规范,那么既然是规范,那肯定要照着做了,规范怎么说,那就怎么做。

以下是关于ACPI Spec中对Hardware ID的描述,描述如下:

Inter core i7处理器中(x86架构)驱动开发:关于APCI Hardware ID的描述

Inter core i7处理器中(x86架构)驱动开发:关于APCI Hardware ID的描述

有关ASL语言可以参考ACPI SPEC手册的ACPI Source Language (ASL)Reference章节。

如上,关于Hardware ID手册中的意思大致如下:

      该对象用于向OSPM提供设备的PNP ID或ACPI ID。 在描述平台时,任何_HID对象的使用都是可选的。但是,_HID对象必须是用于描述将由OSPM枚举的任何设备。 当总线枚举器不能检测到设备ID时,OSPM只枚举一个设备。当总线枚举器不能检测到设备ID时。例如,ISA总线上的设备是由OSPM列举。除了OSPM使用_ADR对象来描述总线枚举器枚举的设备。

    其中OPSM是:OSPM(OS-directed Power Management) :OSPM 操作系统支持 ACPI 的一个部分,操作系统 (OS)可以从操作系统下驱动程序的角度控制 ACPI 子模块,同时支持 ACPI 包括 SCI 中断,设备事件,系统事件模式,这些事件模式可以充分支持 Hot-plug 方式。

    所以解决驱动匹配不上的问题,只要在BIOS中的ASL工程中对应Hardware描述的部分添加一个字段描述,确保驱动中的字段和BIOS中的字段一致,这样就可以匹配成功了。

OSPM 

操作系统支持

 ACPI 

的一个部分,操作系统

 

OS

)可以从操作系统下驱动程

序的角度控制

 

ACPI 

子模块,

同时支持

 

ACPI 

包括

 SCI 

中断,

设备事件,

系统事件模式,

这些事件模式可以充分支持

 

Hot-pl

ug 

方式。

以下是ACPI中关于PNP ID和ACPI ID的规范信息:

网址:http://www.uefi.org/PNP_ACPI_Registry

PNP ID AND ACPI ID REGISTRY

This is an industry registry of PNP ID and ACPI ID used in the _HID (Hardware ID), _CID (Compatibility ID) or _SUB (Subsystem ID) objects as described in the ACPI Specification for devices that do not have standard enumeration mechanism.  All these devices must contain a _HID (and possibly _CID and _SUB as well) in order to allow the operating system to uniquely recognize the device so that it can load the appropriate driver software. Each device manufacturer is responsible for assigning the PNP ID or ACPI ID for each of these products.

Both PNP ID and ACPI ID consist of two parts: a Vendor ID, followed by a product identifier. Each manufacturer of these devices must be assigned an industry-unique Vendor ID. Your company may already have a Vendor ID from previous work, such as EISA boards or other Plug and Play devices (PNPISA cards, PNP serial devices, PNP monitors, and so on). If you do not have a vendor ID, or do not know if you have one, the UEFI Forum can assign one for you as described on this page, or can verify an existing ID.

The format of Vendor IDs varies depending on the form of ID you choose:

  • PNP ID: PNP Vendor IDs consist of 3 characters, each character being an uppercase letter (A-Z).
  • ACPI ID: ACPI Vendor IDs consist of 4 characters, each character being either an uppercase letter (A-Z) or a numeral (0-9).


It is important to note that the use of PNP ID and ACPI ID are completely interchangeable for use with ACPI. The decision is strictly related to the availability of the characters you want. The PNP ID is legacy, intended for the Plug and Play Specifications that could not support 4 characters, but is still supported in ACPI. ACPI ID enables a much bigger namespace for the ecosystem.

Vendor IDs are subject to uniqueness requirements and some ID requests may not be available. For instance, Microsoft has reserved the PNP ID’s Vendor ID "PNP" to identify various devices that do not have an existing EISA ID, as well as defining compatibility devices. These IDs are defined in the file. The ACPI Specification reserves the ACPI ID’s Vendor ID “ACPI” for use only with devices defined in that specification. Additionally, Vendor IDs consisting only of valid hexadecimal characters (0-9 and A-F) are reserved for assignment by the PCI SIG (these Vendor IDs must be registered with the PCI SIG but can still be used in ACPI). Finally, it may simply be that the character string you request has previously been assigned to another company.

Product Identifiers are always four-character hexadecimal numbers (0-9 and A-F). The Device Manufacturer is responsible for assigning this identifier to each individual product MODEL. Once an identifier is assigned to a product model, it must not be assigned to any other product model manufactured by the same company (that is, that uses the same Vendor ID).

The registry aims to ensure fair, orderly, consistent and conflict free naming of the Vendor IDs.  Originally implemented by Microsoft, this registry is used to help companies avoid unnecessary collisions in implementation.

TO REGISTER A NEW UNIQUE VENDOR ID FOR THE PNP ID OR ACPI ID

Send a request to the ACPI Specification Workgroup Chairperson specifying whether the Vendor ID is for PNP ID or ACPI ID. All requests are subject to Work Group approval based on the objectives noted above.

The list of currently approved Vendor IDs for PNP ID and ACPI ID.  Please note, due to the size of the PNP ID List, your internet browser may take a minute to for the page to load.