Method for distinguishing input / output hub serial hard disk and electronic equipment

By obtaining information about the peripheral interconnect devices of the hard drive and the IOH controller identifier, and using the PCI topology for differentiation, the problem of identifying the interface type of IOH SATA hard drives and M.2 SATA hard drives is solved, improving system maintenance efficiency and fault diagnosis accuracy, and supporting user-friendly storage configuration.

CN121455857BActive Publication Date: 2026-04-21INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INSPUR SUZHOU INTELLIGENT TECH CO LTD
Filing Date
2026-01-05
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing technologies cannot effectively distinguish between the interface types of IOH SATA hard drives and M.2 SATA hard drives, resulting in low system maintenance efficiency, difficulty in fault diagnosis, and the inability of the user interface to display the hard drive interface type, which affects storage configuration planning.

Method used

By acquiring the peripheral component interconnection device information of the serial hard drive to be identified and the controller identifier of the input/output hub, and using the hardware association information in the PCI topology to distinguish them, the control unit to which the hard drive belongs can be determined, thus bypassing the limitations of the SATA protocol.

Benefits of technology

It enables precise differentiation between IOH SATA hard drives and M.2 SATA hard drives, improves system maintenance efficiency, ensures accurate fault diagnosis, and the user interface can clearly display the hard drive interface type, supporting reasonable storage configuration planning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121455857B_ABST
    Figure CN121455857B_ABST
Patent Text Reader

Abstract

This application discloses a method and electronic device for distinguishing serial hard drives in an input / output hub, relating to the field of server storage technology. The method involves first acquiring the Peripheral Component Interconnect (PCI) device information of the serial hard drive to be identified (including manufacturer identifier, device identifier, and bus device function address indicating its physical location), and simultaneously acquiring the identifier of the input / output hub (IOH) controller (including manufacturer identifier, device identifier, and the address range of the IOH in the PCI topology). By comparing these two types of information, the control unit to which the hard drive belongs is determined. If the hard drive belongs to the IOH controller, it indicates that its interface is an IOH SATA type directly associated with the IOH. If it does not belong to the IOH controller, it can be excluded as an IOH SATA hard drive, pointing to an M.2 SATA interface type. This method bypasses the consistent SATA protocol of both, utilizing the difference in physical connection and control affiliation to achieve accurate differentiation of interface types.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of server storage technology, and in particular to a method for distinguishing serial hard drives in an input / output hub and an electronic device. Background Technology

[0002] In modern computer technology, Serial Advanced Technology Attachment (SATA) is the mainstream storage device interface standard. It uses serial transmission to connect storage devices to the motherboard, and its high-speed transmission, hot-swapping support, and wide compatibility have made it a commonly used computer storage interface. In server architectures with stringent storage requirements, IOH SATA hard drives and M.2 SATA hard drives are widely used. Although their physical forms and electrical connection methods differ, the SATA protocol is highly consistent, making it impossible to distinguish their interface types based solely on traditional hard drive information protocols.

[0003] This issue has multiple negative impacts: during system maintenance, it's difficult to locate the physical position and connection status of the hard drive, reducing efficiency and increasing costs; during fault diagnosis, it easily leads to incorrect troubleshooting directions, prolonging fault handling time; and the user interface cannot display the hard drive interface type, affecting storage configuration planning and potentially causing hardware upgrade errors. Therefore, distinguishing between IOH SATA hard drives and M.2 SATA hard drives has become a pressing technical requirement in the current server storage field. Summary of the Invention

[0004] This application provides a method and electronic device for distinguishing serial hard drives in an input / output hub, so as to at least solve the problem in the related art that traditional hard drive information protocols alone cannot distinguish between IOH SATA hard drives and M.2 SATA hard drive interface types.

[0005] This application provides a method for distinguishing serial hard drives in an input / output hub, comprising: obtaining peripheral component interconnection device information associated with the serial hard drive to be identified, and the controller identifier of the input / output hub; wherein, the peripheral component interconnection device information includes a first manufacturer identifier, a first device identifier, and a bus device function address, the bus device function address being used to locate the physical location of the serial hard drive to be identified in the peripheral component interconnection topology; the controller identifier includes a second manufacturer identifier, a second device identifier, and the peripheral component interconnection address range of the input / output hub in the peripheral component interconnection topology; based on the peripheral component interconnection device information and the controller identifier, determining whether the control unit to which the serial hard drive to be identified belongs is the controller of the input / output hub; if so, determining that the serial hard drive to be identified is a serial hard drive of the input / output hub.

[0006] This application also provides a device for distinguishing serial hard drives in an input / output hub, including:

[0007] The acquisition module is used to acquire peripheral component interconnect device information associated with the serial hard drive to be identified, as well as the controller identifier of the input / output hub; wherein, the peripheral component interconnect device information includes a first manufacturer identifier, a first device identifier, and a bus device function address, the bus device function address being used to locate the physical location of the serial hard drive to be identified in the peripheral component interconnect topology; the controller identifier includes a second manufacturer identifier, a second device identifier, and the peripheral component interconnect address range of the input / output hub in the peripheral component interconnect topology;

[0008] The judgment module is used to determine whether the control unit to which the serial port hard drive to be identified belongs is the controller of the input / output hub, based on the peripheral component interconnection device information and controller identifier; if so, the serial port hard drive to be identified is determined to be the serial port hard drive of the input / output hub.

[0009] This application also provides an electronic device, including: a memory for storing a computer program; and a processor for executing the computer program to implement the steps of the above-described method for distinguishing between an input / output hub serial port hard disk.

[0010] This application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of the above-described method for distinguishing between input / output hub serial port hard disks.

[0011] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described method for distinguishing between input / output hub serial port hard disks.

[0012] This application's method solves the problem of distinguishing between IOH SATA hard drives and M.2 SATA hard drives by accurately anchoring the association between serial ATA hard drives and Input / Output Hubs (IOHs). The core logic moves beyond relying solely on SATA protocol information and instead depends on hardware association information within the Peripheral Component Interconnect (PCI) topology: first, it obtains the PCI device information of the serial ATA hard drive to be identified (including manufacturer identifier, device identifier, and the bus device function address indicating its physical location); simultaneously, it obtains the identifier of the IOH controller (including manufacturer identifier, device identifier, and the address range of the IOH in the PCI topology). By comparing these two types of information, it determines the control unit to which the hard drive belongs. If the hard drive belongs to the IOH controller, its interface is an IOH SATA type directly associated with the IOH; if it does not belong, it can be excluded as an IOH SATA hard drive, pointing to an M.2 SATA interface type. This approach bypasses the shared SATA protocol, utilizing the difference in physical connection and control affiliation to achieve precise interface type differentiation, overcoming the shortcomings of traditional protocols that only focus on transmission standards and ignore the essence of hardware connections. Attached Figure Description

[0013] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0014] Figure 1 A schematic diagram of the specific hardware architecture on which the method for distinguishing serial hard drives in an input / output hub provided in this application embodiment depends;

[0015] Figure 2 A flowchart illustrating a method for distinguishing serial hard drives in an input / output hub, as provided in an embodiment of this application;

[0016] Figure 3 A schematic diagram of the structure of an input / output hub serial port hard disk differentiation device provided in an embodiment of this application;

[0017] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0018] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.

[0019] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0020] To more clearly illustrate the embodiments of this application, the technical terms used in the embodiments will be briefly introduced below:

[0021] SATA hard drives refer to hard drives that use the SATA (Serial Advanced Technology Attachment) interface standard, commonly known as serial hard drives, and encompass both mechanical hard drives and solid-state drives with SATA interfaces. They employ a serial connection method, embed a clock signal, and have outstanding error correction capabilities, enabling them to check and automatically correct errors in transmitted commands and data; they also support hot-swapping, and their thin data cables facilitate heat dissipation and cable management within the computer case.

[0022] Input / Output Hub (IOH) SATA hard drives refer to SATA hard drives integrated on the input / output hub. The IOH controller manages the data transmission and control of SATA devices connected to the motherboard. It is connected via an external IOH card, which is essentially a simplified version of the PCH (Platform Controller Hub) and connects to the system through the Peripheral Component Interconnect Express (PCIe) interface.

[0023] M.2 SATA hard drives refer to solid-state drives that use the M.2 interface and follow the SATA protocol for data transmission. They are a product of the combination of the M.2 interface and the SATA protocol, and are designed specifically for devices with limited space. The M.2 interface was originally called NGFF. It is small in size (commonly 22mm wide, with various lengths such as 2242 and 2280) and can be directly inserted into the M.2 slot on the motherboard.

[0024] In server architectures, where storage performance and stability requirements are more stringent, IOH SATA hard drives and M.2 SATA hard drives are two widely used storage devices. From a technical perspective, while they differ significantly in physical form (such as drive size and appearance) and electrical connection methods (such as motherboard pin definitions and signal transmission paths), they share a high degree of consistency at the core SATA protocol level. This characteristic ensures compatibility in key technical aspects such as data transmission logic and command interaction. However, this protocol-level consistency also presents significant technical challenges: when managing and identifying server storage devices, relying solely on traditional hard drive information protocols (such as the industry-standard gEfiDiskInfoProtocolGuid protocol) cannot effectively distinguish the target hard drive's interface type, i.e., it cannot accurately determine whether the hard drive is connected to an IOH SATA interface or an M.2 SATA interface.

[0025] This technical challenge has led to several adverse effects: at the system maintenance level, maintenance personnel struggle to accurately locate the physical position and connection status of hard drives with different interface types, resulting in reduced maintenance efficiency and increased maintenance costs; at the fault diagnosis level, when a server storage system malfunctions, the inability to clearly distinguish the hard drive interface type may lead to incorrect troubleshooting directions, prolonging troubleshooting time and affecting the normal operation of the server; at the user interface device identification level, users cannot clearly understand the specific interface type of the hard drive through the information displayed on the interface, which is not conducive to users' reasonable planning and management of server storage configuration, and may even lead to errors in subsequent hardware upgrades or expansion operations due to misjudgment of the interface type, causing new technical problems.

[0026] Therefore, effectively distinguishing the interface types of IOH SATA hard drives and M.2 SATA hard drives has become a pressing technical requirement in the current server storage field.

[0027] To address all or part of the aforementioned technical problems, this application provides a method for distinguishing serial hard drive interface types. This method relies on the Peripheral Component Interconnect (PCI) device information of the serial hard drive to be identified (including manufacturer identifier, device identifier, and bus device function address indicating physical location) and the identifier of the Input / Output Hub (IOH) controller (including manufacturer identifier, device identifier, and the address range of the IOH in the PCI topology) for comparison. This avoids the identification errors caused by relying solely on port number (Location) and other information. It eliminates the need for complex low-level hardware interaction, enabling rapid type differentiation and adapting to various device scenarios such as servers and industrial computers. By relying on the PCI standard address system and the inherent identifier of the IOH controller, and not on the proprietary protocols of specific hardware manufacturers, it is applicable to IOH devices and SATA hard drive combinations of different brands and architectures, improving the method's versatility and portability. Furthermore, this method distinguishes IOH SATA hard drives from the essential level of controller affiliation, rather than relying on superficial characteristics such as interface type, ensuring the accuracy and reliability of the differentiation results.

[0028] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0029] like Figure 1 The diagram shows a schematic of the specific hardware architecture upon which the method for distinguishing between input / output hub serial port hard drives depends.

[0030] The hardware architecture includes the IOH card and the server motherboard.

[0031] The IOH card is essentially an external PCIe card integrating a simplified version of the PCH (Platform Controller Hub) function. Each card must have at least one IOH controller with an independent hardware identifier and address range. Each controller must have a unique secondary vendor identifier (such as a unique code from the IOH chip manufacturer) and a secondary device identifier (such as the controller's unique device number within the IOH card). It must also have a dedicated PCI address range (including Bus number, Device number, and Function number ranges), and this address range must not overlap with the address ranges of other PCI devices on the motherboard (such as M.2 SATA controllers) to ensure accurate identification of the IOH controller through address matching. Furthermore, each IOH controller needs to expand with a predetermined number of SATA ports (e.g., 8) for mounting IOH SATA hard drives, and a stable hardware signal connection must be established between the ports and the controller to ensure that the hard drive's PCI device information can be associated with its respective controller.

[0032] The server motherboard needs to have a clear PCIe bus hierarchy to ensure that the PCI device information (including the first manufacturer identifier, first device identifier, and BDF address) of the serial ATA hard drive can be read by the Basic Input / Output System (BIOS) or the motherboard management controller via the PCIe bus. The BDF address must strictly adhere to the Peripheral Component Interconnect Special Interest Group (PCI-SIG) specification encoding. The Bus number identifies the PCIe bus branch where the hard drive resides, the Device number identifies the specific device on that bus branch (such as the IOH controller), and the Function number identifies the device's functional module (such as the controller's SATA port function), forming a unique physical location identifier for the hard drive within the PCIe topology. Simultaneously, the connection between the IOH card and the motherboard's PCIe slot must ensure the integrity of the address mapping; that is, the IOH controller's preset PCI address range can be correctly recognized by the system, avoiding failure in hard drive and controller attribution due to incorrect address mapping.

[0033] In the PCI device information of the serial ATA hard drive to be identified, the first manufacturer identifier (hard drive manufacturer code) and the first device identifier (hard drive model code) must be stored in the hard drive's PCI configuration space and can be read by the system through underlying protocols such as EfiPciIoProtocol. The second manufacturer identifier, second device identifier, and PCI address range of the IOH controller must be stored in the IOH card firmware or the motherboard BIOS's preset configuration table to ensure that the system can load this identifier information during the boot phase, providing a data source for subsequent comparison. Furthermore, all hardware identifiers must possess unalterable stability to prevent accidental modification of the identifiers from causing comparison logic failure and ensuring the reliability of the IOH SATA hard drive differentiation results.

[0034] Embodiments of this application provide a method for distinguishing serial hard drives in an input / output hub, such as... Figure 2 As shown, the method includes the following steps:

[0035] S201. Obtain information about the peripheral component interconnection devices associated with the serial hard drive to be identified, as well as the controller identifier of the input / output hub.

[0036] Among them, the serial port hard drives to be identified include input / output hub serial port (IOH SATA) hard drives and target serial port hard drives. The target serial port hard drive is a solid-state drive (i.e., M.2 SATA hard drive) that adopts the M.2 interface form factor and follows the Serial Advanced Technology Annex Protocol for data transmission.

[0037] The peripheral component interconnect device information includes a first vendor identifier, a first device identifier, and a bus device function address. The bus device function address is used to locate the physical location of the serial hard drive to be identified in the peripheral component interconnect topology.

[0038] Input / output hubs are the core controllers in a system that manage input / output devices such as PCIe / SATA.

[0039] The IOH controller identifier includes a second vendor ID, a second device ID, and the peripheral component interconnection address range in the peripheral component interconnection topology. For example, in the BDF address, the bus number is fixed in a specific range of 0x00~0x02, and the device number is 0x1f. For example, the vendor ID of a certain brand of IOH controller is 0x8086, and the device ID is 0x282a. The combination of these two is a unique hardware identifier.

[0040] In some embodiments, before executing step S201, the device path information of the server hard drive associated with the peripheral component interconnection device is first obtained, and then the device path information is parsed to determine the hard drive attribute information; then, the server hard drive is determined to be a serial port hard drive based on the interface type included in the hard drive attribute information.

[0041] The server hard drive's device path information includes its hierarchical path within the system, such as PCI bus → SATA controller → port 1 → hard drive device. This device path information contains structured data representing the device's hardware attributes, embedding key metadata such as interface type, connection location, and manufacturer information.

[0042] The above embodiments fully restore the hierarchical logic of the hard drive through the device path; obtain the physical connection location and hardware attributes of the hard drive, provide data support to avoid configuration errors caused by missing information, and improve the stability and manageability of the server storage system.

[0043] In the process of obtaining the device path information of the server hard drive associated with the peripheral component interconnection device, the above embodiment first scans and finds the hard drive handle of the server hard drive, and then extracts the device path information of the server hard drive based on the hard drive handle.

[0044] The hard drive handle is a unique identifier / index for the server's hard drive. The BIOS first determines the server's hard drive handle using the gEfiDiskInfoProtocolGuid protocol. Then, for each hard drive handle, it calls the HandleProtocol protocol, passing in the gEfiDiskInfoProtocolGuid identifier, to transform the physical connection relationship of the server's hard drive in the system into structured device path information. gEfiDiskInfoProtocolGuid is the core protocol used in the Unified Extensible Firmware Interface system to describe hard drive storage devices; all hard drive device handles in the system are bound to this protocol.

[0045] Specifically, in the unified and extensible firmware interface system, the function "LocateHandleBuffer" is called, specifying the search type as protocol-based search and passing in the target protocol "gEfiDiskInfoProtocolGuid". This function retrieves an array of handles corresponding to the server hard drives, with each handle corresponding to a physical or logical hard drive. After retrieving all server hard drive handles, the handle array is traversed one by one, and a parsing operation is performed on each hard drive handle to ensure that the device path information of each server hard drive is obtained.

[0046] For the currently traversed disk handle, the function "HandleProtocol" or "OpenProtocol" is called to identify the server disk's device path information based on the current disk handle and the target protocol "gEfiDevicePathProtocolGuid". Upon successful HandleProtocol call, the device path information of the current disk is returned. The "gEfiDevicePathProtocolGuid" protocol extracts device path attributes, binds the handle to this protocol, and ultimately obtains the specific path information of the server disk.

[0047] Device path information can be converted into a readable string format using path resolution functions to identify the physical connection location or logical identifier of the server hard drive.

[0048] The above embodiments establish a basic framework for hard drive identification through two key protocols: gEfiDiskInfoProtocolGuid and gEfiDevicePathProtocolGuid. The gEfiDiskInfoProtocolGuid protocol can traverse and obtain the handles of all hard drives in the system, providing a unique identifier for subsequent operations; while gEfiDevicePathProtocolGuid is responsible for collecting the device path information of each hard drive, including basic attributes such as the physical connection method and interface type of the hard drive.

[0049] Based on the above embodiments, when obtaining the peripheral component interconnect device information associated with the serial hard drive to be identified, the device path information of the serial hard drive to be identified is first parsed to determine the identifier of the peripheral component interconnect controller to which the serial hard drive to be identified is connected; then, the identifier of the peripheral component interconnect controller is parsed to obtain the bus device function (BFD) address. The peripheral component interconnect controller (Controller) to which the serial hard drive to be identified is connected is a key intermediate node connecting the server and the hard drive.

[0050] Specifically, based on the device path information of the serial hard drive to be identified, the function "LocateDevicePath" is called, passing in the gEfiPciProtocolGuid and a DevicePath pointer. This function searches for the controller handle bound to the gEfiPciProtocolGuid protocol along the hierarchical structure of the device path information. Then, the function "HandleProtocol" or "OpenProtocol" is called, passing in the controller handle and gEfiPciIoProtocolGuid, to obtain a pointer to the EFI_PCI_IO_PROTOCOL structure. The PCI controller's configuration space is then read through the relevant interfaces of EFI_PCI_IO_PROTOCOL. The first four bytes of the PCI configuration space (configuration space offset 0x00) contain the configuration space identifier. In the byte at offset 0x01, the high two bits represent the bus number (Bus), the middle three bits represent the device number (Device), and the low three bits represent the function number (Function). The combination of these three bits constitutes the complete Bus Device Function (BDF) address. The BDF address format is typically "Bus:Device.Function", such as "0x01:0x02.0x00". The BDF address can also be obtained by calling the GetLocation function.

[0051] By mapping the extracted BDF address to the interconnection topology of peripheral components, the physical location of the serial hard drive to be identified can be clearly determined. For example, "Bus=0x01" indicates the first PCIe bus, "Device=0x02" indicates the second device on this bus, and "Function=0x00" indicates the 0th function of this device. Combined with the previously obtained hard drive location information (such as SATA port), the specific topology location of the hard drive in the "PCIe bus → controller → port → hard drive" hierarchy can be completely determined.

[0052] The above embodiment traces the corresponding controller (Handle) through DevicePath information. Subsequently, by binding the EfiPciIoProtocol, the BDF address is successfully extracted. This BDF address precisely indicates the physical location of the hard drive. In this way, the system not only establishes the association between the hard drive and the PCIe topology but also establishes a clear hardware link between the hard drive and the controller, solving the problem of hard drive location difficulties in complex system bus architectures.

[0053] Based on the above embodiments, obtaining the controller identifier of the input / output hub includes: 1) the device path information of the serial hard drive to be identified; 2) calling a device path parsing utility function; 3) traversing the hierarchical nodes in the device path information; and 4) determining whether the server hard drive is a serial hard drive based on the type and subtype of the hierarchical nodes. The device path consists of multiple nodes, each corresponding to a hardware connection level, such as a bus node, controller node, or device node. Simultaneously, the interface type of the current server hard drive is determined through the interface identifier field in the node data of the hierarchical nodes. For example, if the field value is "SATA", it is determined to be a serial hard drive; if the field value is other (such as NVMe, IDE, etc.), the judgment process is terminated.

[0054] If the current server hard drive is determined to be a serial port hard drive, the attributes are extracted from the node data: the interface type is determined by the interface identifier field of the hierarchical node; the location is obtained from the port number and device address fields of the hierarchical node; the manufacturer information is obtained from EFI_DISK_INFO_PROTOCOL or EFI_STORAGE_DEVICE_IDENTIFICATION_PROTOCOL associated with the device path information; the manufacturer name and product model fields in the protocol are read; the device status is obtained by parsing the device status flags of the hierarchical node; the GetMediaInfo function of EFI_BLOCK_IO_PROTOCOL is called, and after binding the protocol through the hard drive handle, the total number of sectors and the number of bytes per sector in the returned media information structure are read, and the product of the two is the total capacity of the hard drive.

[0055] After the attribute extraction is completed, the interface type field is checked again to see if it is clearly SATA. If it is, the subsequent steps are continued. If not, or if other interface types are identified in the middle, the processing flow of the current hard drive is terminated directly, and the device path information of the next hard drive can be switched.

[0056] In the above embodiments, the parsing tool function can accurately capture the node features related to SATA by traversing level by level, avoiding misidentifying non-SATA storage devices as serial hard drives, improving the accuracy of serial hard drive identification, and laying a precise foundation for further differentiation between IOH SATA and M.2 SATA.

[0057] S202. Based on the peripheral component interconnection device information and controller identifier, determine whether the control unit to which the serial port hard drive to be identified belongs is the controller of the input / output hub.

[0058] In some embodiments, during step S202, the peripheral component interconnect device information is matched with the controller identifier. If the match is successful, it is determined that the control unit to which the serial hard drive to be identified belongs is the I / O hub controller. This indicates that the serial hard drive to be identified is mounted to the system through the IOH controller, and can be identified as an IOH SATA hard drive. If the peripheral component interconnect device information fails to match the controller identifier, it is determined that the serial hard drive to be identified is the target serial hard drive, which is a solid-state drive using an M.2 interface and conforming to the Serial Advanced Technology Annex (SAT) protocol for data transmission.

[0059] As mentioned above, the controller identifier includes the vendor identifier, device identifier, and PCI address range. Based on the PCI device information and the EFI_PCI_IO_PROTOCOL protocol pointer, the PCI configuration space can be accessed through the Pci.Read function of EFI_PCI_IO_PROTOCOL to extract the first vendor identifier, the first device identifier, and the BDF address.

[0060] Specifically, the combination of the first vendor identifier and the first device identifier of the PCI device information is first compared with the combination of the second vendor identifier and the second device identifier of the controller to determine if they are the same; and it is also determined whether the BDF address of the PCI device information falls within the PCI address range of the IOH controller. If either determination result is yes, then the PCI controller of the serial hard drive to be identified is determined to be the IOH controller. If both determination results are no, then it is determined that the serial hard drive to be identified is not connected to the IOH controller, and the serial hard drive to be identified can be identified as the target serial hard drive (M.2 SATA hard drive), and the current determination process is terminated.

[0061] The above embodiments compare the parsed PCI device information (including bus number, device number, vendor ID, etc.) with the IOH controller identifier one by one to confirm the hard drive's mounting path at the hardware level. If the match is successful, it means the hard drive is connected to the system through the IOH controller and is directly identified as an IOH SATA hard drive; if the match fails, the possibility of IOH mounting is ruled out, and combined with the pre-judgment result of the serial port hard drive, it can be accurately located as an M.2 SATA hard drive. This matching logic based on hardware identifiers is not affected by the consistency of the SATA protocol layer, improving the identification accuracy of the two types of hard drives and avoiding the risk of misjudgment due to similar protocol attributes.

[0062] S203. If yes, then determine that the serial port hard drive to be identified is an input / output hub serial port hard drive.

[0063] In some embodiments, the IOH hub controller includes a first controller, a second controller, and a third controller. It should be noted that a single IOH card integrates three independent IOH controllers, each capable of connecting to eight SATA ports, for a total of 24 ports.

[0064] After executing step S203, the PCI device information of the serial hard drive to be identified is compared with the controller identifier of the first controller. If the BDF address of the PCI device information falls within the PCI address range of the first controller, the control unit to which the serial hard drive belongs is determined, i.e., the serial hard drive to be identified is mounted on the first controller. Then, the serial number corresponding to the first controller is assigned to a preset variable. This preset variable is used to specify the controller serial number to which the serial hard drive belongs, thereby accurately distinguishing the specific controller to which the IOH SATA hard drive belongs.

[0065] Specifically, a unique identifier is assigned to each controller based on the PCI device information. For example, the BDF address of controller 1 is 0x00:0x1f.0, controller 2 is 0x00:0x1f.1, and controller 3 is 0x00:0x1f.2; and the variable IOHControllerIndex is assigned the values ​​1, 2, and 3 respectively. For a confirmed IOH SATA hard drive, the specific IOH controller connected to the IOH SATA hard drive is determined by combining its corresponding PCI device information. If the identifier matches controller 1, then IOHControllerIndex = 1; if it matches controller 2, then it is assigned the value 2; and if it matches controller 3, then it is assigned the value 3, thus completing the controller differentiation.

[0066] The above embodiments achieve hard drive and controller attribution locking through precise BDF address matching. The address matching logic avoids misjudgments caused by duplicate controller identifiers or device ID conflicts, refining the identification granularity of IOH SATA hard drives from whether they are IOH type to which specific IOH controller they belong to. In the IOH card multi-controller architecture, once it is determined that the hard drive is mounted on the first controller, the serial number corresponding to the first controller is assigned to a preset variable. This variable can be directly associated with the physical location information of the controller, facilitating operation and maintenance location.

[0067] Based on the above embodiments, the preset variable is converted into an offset base, and a binary left shift operation is performed on the offset base to convert it into an offset. Then, the original port number of the serial hard drive to be identified is added to the offset to obtain the global port number of the serial hard drive to be identified, that is, the port number of the IOH SATA hard drive.

[0068] The original port number (i.e., Location) of the serial hard drive to be identified is obtained from the previously parsed hard drive attribute information; this number is 0-7. The left shift operation of 3 bits essentially assigns 8 consecutive global port number ranges to each controller. This preserves the original port information while achieving a globally unique sort, ultimately achieving standardized management of the location of all SATA hard drives under the IOH card and avoiding port number conflicts.

[0069] For example, the sorting formula Location+=(IOHControllerIndex-1)<<3 is executed. Shifting left by 3 bits is equivalent to multiplying by 8. For controller 1, (1-1)<<3=0, the original Location (0-7) remains unchanged, and the global port number is 0-7; for controller 2, (2-1)<<3=8, the original Location is added by 8, and the global port number is 8-15; for controller 3, (3-1)<<3=16, the original Location is added by 16, and the global port number is 16-23.

[0070] The calculated port number of the IOH SATA hard drive can be associated with and stored along with IOHControllerIndex and other hard drive attributes. The physical location of the IOH SATA hard drive can be quickly located using this global port number. For example, global port number 10 corresponds to port 2 of controller 2, and global port number 20 corresponds to port 4 of controller 3.

[0071] The above embodiment achieves clear differentiation of the three IOH controllers by comparing IOH controller identifiers and assigning values ​​to the IOHControllerIndex variable, avoiding management confusion. More importantly, a shift operation algorithm is used to uniformly adjust the originally scattered and duplicated port location numbers to a global port number of 0-23. This operation not only solves the problem of duplicate port numbers under different controllers but also achieves standardized management of the 24 SATA ports of the IOH card. Thus, each hard drive port has a unique and standardized identifier, improving management efficiency.

[0072] Based on the above embodiments, a hard drive identification identifier is set for the serial hard drive to be identified in order to distinguish whether the serial hard drive to be identified is an IOH SATA hard drive or an M.2 SATA hard drive. Then, the hard drive identification identifier and global port number are displayed on the web interface of the baseboard management controller.

[0073] The hard drive identification identifier can be a Boolean variable (IsIOH SATADrive), providing a concise and clear identifier for the hard drive's interface. The True / False state of this variable can directly distinguish between an IOHSATA hard drive and an M.2 SATA hard drive.

[0074] Specifically, a Boolean variable `IsIOH SATADrive` is defined, initialized to `False` by default. If the serial hard drive to be identified is determined to be an IOH SATA hard drive, the variable is updated, setting `IsIOH SATADrive` to `True`. If it is determined to be an M.2 SATA hard drive, it remains `False`, thus completing the hard drive interface type identification. The assigned value of the `IsIOH SATADrive` variable can be packaged with other core hard drive information and synchronized to the Baseboard Management Controller (BMC)'s storage module via the system's internal communication mechanism, ensuring that the BMC can obtain complete hard drive attributes and classification identifiers.

[0075] When the background program of the Baseboard Management Controller (BMC WEB) reads hard drive information, it categorizes the drives using the IsIOHSATADrive variable as a filter. When the variable is True, the hard drive is categorized and displayed under the "IOH SATA" module, along with its global port number (0-23). ​​When the variable is False, it is categorized and displayed under the "M.2SATA" module, without displaying the IOH-specific location number, thus clearly distinguishing different types of hard drives and avoiding user confusion. When viewing IOH SATA hard drives in the BMC WEB interface, users can quickly locate the corresponding hard drive by comparing the global port number displayed on the interface with the physical silkscreen markings on the chassis, and then perform operations such as plugging / unplugging, replacing, and troubleshooting, ensuring the accuracy of the operation. It should be noted that the chassis will pre-mark the installation positions of IOH SATA hard drives in the order of 0-23, such as "SATA0", "SATA15", "SATA23", etc.

[0076] The above embodiment introduces the IsIOH SATADrive boolean variable to provide a concise and clear classification identifier for hard drive types. Combined with the classification display function of the BMCWEB interface and the corresponding design with the hard drive location silkscreen, users can quickly locate the target hard drive simply by viewing relevant information on the BMC WEB interface. This design not only reduces the difficulty of operation and maintenance but also improves the accuracy and efficiency of operations such as replacement, troubleshooting, and configuration.

[0077] In summary, this application provides a method for distinguishing serial hard drives in an input / output hub. First, by obtaining hard drive handles and device path information using gEfiDiskInfoProtocolGuid and gEfiDevicePathProtocolGuid, it achieves comprehensive enumeration and basic attribute extraction of all hard drives in the system, laying a data foundation for subsequent filtering. Next, by tracing the PCI controller handle using DevicePath and extracting the BDF address by binding EfiPciIoProtocol, it accurately establishes the hardware connection link between the hard drive, PCI topology, and controller, solving the problem of physical location of the hard drive in the system bus architecture. Then, by comparing IOH controller identifiers and assigning values ​​to the IOHControllerIndex variable, it clearly distinguishes the three IOH controllers. After shifting operations, the scattered port locations are uniformly sorted into global numbers from 0 to 23, completely solving the confusion problem of duplicate port numbers under different controllers and achieving standardized management of the 24 SATA ports of the IOH card. Finally, the introduction of the IsIOHSATADrive boolean variable provides a concise classification identifier for hard drive types, combined with BMC... The web-based categorization display corresponds to the Location silkscreen, allowing users to quickly locate the target hard drive through the interface information.

[0078] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.

[0079] like Figure 3 As shown in the figure, embodiments of this application also provide a device for distinguishing serial hard disks from input / output hubs, the device comprising:

[0080] The acquisition module 301 is used to acquire peripheral component interconnect device information associated with the serial hard drive to be identified, as well as the controller identifier of the input / output hub; wherein, the peripheral component interconnect device information includes a first manufacturer identifier, a first device identifier, and a bus device function address, the bus device function address being used to locate the physical location of the serial hard drive to be identified in the peripheral component interconnect topology; the controller identifier includes a second manufacturer identifier, a second device identifier, and the peripheral component interconnect address range of the input / output hub in the peripheral component interconnect topology;

[0081] The judgment module 302 is used to determine whether the control unit to which the serial port hard drive to be identified belongs is the controller of the input / output hub based on the peripheral component interconnection device information and controller identifier; if so, the serial port hard drive to be identified is determined to be the serial port hard drive of the input / output hub.

[0082] As an optional implementation provided in this application embodiment, the acquisition module 301, before acquiring the peripheral component interconnect device information associated with the serial hard drive to be identified and the controller identifier of the input / output hub, is further configured to: acquire the device path information of the server hard drive associated with the peripheral component interconnect device; wherein, the device path information includes the hierarchical path of the server hard drive in the system; parse the device path information to determine the hard drive attribute information; and determine whether the server hard drive is a serial hard drive based on the interface type included in the hard drive attribute information.

[0083] As an optional implementation provided in this application embodiment, the acquisition module 301, when acquiring the device path information of the server hard disk associated with the peripheral component interconnection device, is specifically used to: scan and find the hard disk handle of the server hard disk associated with the peripheral component interconnection device; and extract the device path information of the server hard disk based on the hard disk handle.

[0084] As an optional implementation provided in this application, the acquisition module 301, when acquiring the peripheral component interconnect device information associated with the serial port hard disk to be identified, is specifically used to: parse the device path information of the serial port hard disk to be identified, determine the peripheral component interconnect controller handle connected to the serial port hard disk to be identified; parse the peripheral component interconnect controller handle to obtain the bus device function address.

[0085] As an optional implementation provided in this application, the judgment module 302 is specifically used to: match the peripheral component interconnection device information with the controller identifier; if the peripheral component interconnection device information and the controller identifier are successfully matched, then determine that the control unit to which the serial port hard disk to be identified belongs is the controller of the input / output hub.

[0086] As an optional implementation provided in this application embodiment, the judgment module 302, after matching the peripheral component interconnection device information with the controller identifier, is further configured to: if the peripheral component interconnection device information and the controller identifier fail to match, determine that the serial port hard drive to be identified is the target serial port hard drive, and the target serial port hard drive is a solid-state hard drive that adopts the M.2 interface form and follows the serial SATA protocol to transmit data.

[0087] As an optional implementation provided in this application, the controller of the input / output hub includes a first controller, a second controller, and a third controller; the judgment module 302, if yes, after determining that the serial port hard drive to be identified is an input / output hub serial port hard drive, is further configured to: compare the peripheral component interconnection device information of the serial port hard drive to be identified with the identifier of the first controller; if the bus device function address falls within the peripheral component interconnection address range corresponding to the first controller, then determine that the control unit to which the serial port hard drive to be identified belongs is the first controller; assign the serial number corresponding to the first controller to a preset variable, the preset variable being used to specify the controller serial number to which the serial port hard drive to be identified belongs.

[0088] As an optional implementation provided in this application, the judgment module 302, after assigning the serial number corresponding to the first controller to the preset variable, is further configured to: convert the preset variable into an offset base; perform a binary left shift operation on the offset base to convert it into an offset; and add the original port number of the serial hard disk to be identified to the offset to obtain the global port number of the serial hard disk to be identified.

[0089] As an optional implementation provided in this application embodiment, the judgment module 302, if yes, after determining that the serial port hard drive to be identified is an input / output hub serial port hard drive, is further configured to: set a hard drive determination identifier for the serial port hard drive to be identified, the hard drive determination identifier being used to distinguish whether the serial port hard drive to be identified is an input / output hub serial port hard drive or a target serial port hard drive, the target serial port hard drive being a solid-state hard drive using an M.2 interface and following the SATA protocol for data transmission; and display the hard drive determination identifier and global port number on the web interface of the baseboard management controller.

[0090] For a description of the features in the embodiment corresponding to the device for distinguishing serial hard drives from input / output hubs, please refer to the relevant description of the embodiment corresponding to the method for distinguishing serial hard drives from input / output hubs, which will not be repeated here.

[0091] like Figure 4 As shown, embodiments of this application also provide an electronic device, including a memory 401 and a processor 402. The memory 401 stores a computer program, and the processor 402 is configured to run the computer program to execute the steps in any of the above-described embodiments of the method for distinguishing serial hard disks from an input / output hub.

[0092] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above embodiments of the method for distinguishing serial hard disks from an input / output hub.

[0093] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0094] The embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above embodiments of the method for distinguishing serial hard disks from input / output hubs.

[0095] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above embodiments of the method for distinguishing serial hard disks from input / output hubs.

[0096] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0097] The foregoing has provided a detailed description of the method for distinguishing serial hard drives in an input / output hub and the electronic device thereof. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only intended to help understand the method and core ideas of this application. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this application.

Claims

1. A method for distinguishing serial port hard drives in an input / output hub, characterized in that, include: Obtain the peripheral component interconnect device information associated with the serial hard drive to be identified, and the controller identifier of the input / output hub; wherein, the peripheral component interconnect device information includes a first vendor identifier, a first device identifier, and a bus device function address, the bus device function address being used to locate the physical location of the serial hard drive to be identified in the peripheral component interconnect topology; the controller identifier includes a second vendor identifier, a second device identifier, and the peripheral component interconnect address range of the input / output hub in the peripheral component interconnect topology; Based on the peripheral component interconnection device information and the controller identifier, determine whether the control unit to which the serial port hard drive to be identified belongs is the controller of the input / output hub; If so, then the serial port hard drive to be identified is determined to be an input / output hub serial port hard drive; The step of determining whether the home control unit of the serial hard drive to be identified is the controller of the input / output hub based on the peripheral component interconnection device information and the controller identifier includes: comparing the bus device function address of the serial hard drive to be identified with the peripheral component interconnection address range of the input / output hub; if the bus device function address falls within the peripheral component interconnection address range, then the home control unit of the serial hard drive to be identified is determined to be the controller of the input / output hub.

2. The method according to claim 1, characterized in that, Before acquiring the peripheral component interconnect device information associated with the serial hard drive to be identified, and the controller identifier of the input / output hub, the method further includes: Obtain device path information of the server hard drive associated with the peripheral component interconnection device; wherein, the device path information includes the hierarchical path of the server hard drive in the system; The device path information is parsed to determine the hard drive attribute information; Based on the interface type included in the hard drive attribute information, determine whether the server hard drive is a serial port hard drive.

3. The method according to claim 2, characterized in that, The step of obtaining the device path information of the server hard drive associated with the peripheral component interconnect device includes: Scan and locate the hard drive handles of server hard drives associated with peripheral component interconnect devices; Based on the hard drive handle, extract the device path information of the server hard drive.

4. The method according to claim 3, characterized in that, Obtain information about the peripheral component interconnect devices associated with the serial hard drive to be identified, including: The device path information of the serial port hard drive to be identified is parsed to determine the peripheral component interconnect controller handle to which the serial port hard drive to be identified is connected. The peripheral component interconnect controller handle is parsed to obtain the bus device function address.

5. The method according to claim 1, characterized in that, The step of determining whether the control unit to which the serial port hard drive to be identified belongs is the controller of the input / output hub based on the peripheral component interconnection device information and the controller identifier includes: Match the peripheral component interconnect device information with the controller identifier; If the peripheral component interconnect device information matches the controller identifier, then the control unit to which the serial hard drive to be identified belongs is determined to be the controller of the input / output hub.

6. The method according to claim 5, characterized in that, After matching the peripheral component interconnect device information with the controller identifier, the method further includes: If the peripheral component interconnect device information fails to match the controller identifier, then the serial hard drive to be identified is determined to be the target serial hard drive, which is a solid-state drive that uses an M.2 interface and follows the SATA protocol for data transmission.

7. The method according to claim 1, characterized in that, The controller of the input / output hub includes a first controller, a second controller, and a third controller; If so, after determining that the serial port hard drive to be identified is an input / output hub serial port hard drive, the method further includes: The peripheral component interconnection device information of the serial hard drive to be identified is compared with the identifier of the first controller; If the function address of the bus device falls within the range of the peripheral component interconnection address corresponding to the first controller, then the control unit to which the serial port hard disk to be identified belongs is the first controller. Assign the serial number corresponding to the first controller to a preset variable. The preset variable is used to determine the controller serial number to which the serial port hard drive to be identified belongs.

8. The method according to claim 7, characterized in that, After assigning the sequence number corresponding to the first controller to a preset variable, the method further includes: Convert the preset variable into an offset base; Perform a binary left shift operation on the offset base to convert it into an offset value; The original port number of the serial hard drive to be identified is added to the offset to obtain the global port number of the serial hard drive to be identified.

9. The method according to claim 8, characterized in that, If so, after determining that the serial port hard drive to be identified is an input / output hub serial port hard drive, the method further includes: Set the hard drive identification identifier of the serial port hard drive to be identified. The hard drive identification identifier is used to distinguish whether the serial port hard drive to be identified is an input / output hub serial port hard drive or a target serial port hard drive. The target serial port hard drive is a solid-state drive that adopts the M.2 interface form and follows the SATA protocol to transmit data. The hard disk identification identifier and the global port number are displayed on the web interface of the baseboard management controller.

10. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the method for distinguishing serial hard disks from an input / output hub as described in any one of claims 1 to 9 when executing the computer program.

Citation Information

Patent Citations

  • Method and device for recognizing hard disk type of hard disk back plate

    CN106326171A

  • Interconnection link control method and apparatus, nonvolatile readable storage medium and electronic device

    WO2025200577A1