Disclosure of Invention
In order to solve at least one of the above problems, a first embodiment of the present invention provides a hard disk identification method, applied to a controller, comprising the steps of:
S20, identifying the type of the hard disk to be accessed in response to the received external signal;
S40, determining interface information according to the hard disk type and a preset hard disk interface comparison table, wherein the hard disk interface comparison table comprises the hard disk type and the interface information corresponding to the hard disk type;
And S60, responding to the access of the hard disk to be accessed, and setting a hard disk interface according to the interface information.
Further, the hard disk is an NVME hard disk.
Further, the hard disk type includes a first NVME hard disk supporting U.2 standards and a second NVME hard disk supporting U.3 standards.
Further, the first NVME hard disk and the second NVME hard disk correspond to different PCIE interfaces.
Further, step S60 further includes:
and the controller responds to the access of the hard disk to be accessed and transmits the interface information to a PCIE change-over switch, so that the PCIE change-over switch sets a PCIE NVME controller according to the interface information to configure a PCIE interface corresponding to the hard disk to be accessed.
Further, before step S60, the hard disk identification method further includes setting the PCIE switch as a PCIE interface corresponding to the first NVME hard disk;
Step S60 further includes setting the PCIE switch to be a PCIE interface corresponding to the second NVME hard disk when the interface information is the interface information corresponding to the second NVME hard disk.
Further, the controller is a CPLD or an FPGA.
A second embodiment of the present invention provides a hard disk identification system, including a controller, a PCIE switch, and a PCIE NVME controller, where the controller is configured to:
Identifying a hard disk type of the hard disk to be accessed in response to the received external signal;
determining interface information according to the hard disk type and a preset hard disk interface comparison table, wherein the hard disk interface comparison table comprises the hard disk type and the interface information corresponding to the hard disk type;
And responding to the access of the hard disk to be accessed, and transmitting the interface information to the PCIE change-over switch, so that the PCIE change-over switch sets the PCIE NVME controller according to the interface information to configure a PCIE interface corresponding to the hard disk to be accessed.
A third embodiment of the invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method as described in the first embodiment.
A fourth embodiment of the invention provides a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method according to the first embodiment when executing the program.
The beneficial effects of the invention are as follows:
aiming at the existing problems at present, the invention establishes a hard disk identification method, identifies the type of the hard disk to be accessed by responding to the received external signals, determines interface information according to the type of the hard disk and a preset hard disk interface comparison table, responds to the access of the hard disk to be accessed, and sets a hard disk interface according to the interface information, thereby solving the problems that the physical forms of U.2 and U.3 interfaces of the existing hard disk are consistent and the definition of signal interfaces is different, realizing the sharing of the hard disks of the two interfaces, and having higher practicability and wide application prospect.
Detailed Description
In order to more clearly illustrate the present invention, the present invention will be further described with reference to preferred embodiments and the accompanying drawings. Like parts in the drawings are denoted by the same reference numerals. It is to be understood by persons skilled in the art that the following detailed description is illustrative and not restrictive, and that this invention is not limited to the details given herein.
In view of the above situation, the inventor has proposed through extensive research and experiments that the number of mainboards of the existing U.2 interfaces is huge and that there is a problem that the hard disk compatible with the U.3 interface cannot be realized because the hard disk type cannot be identified and the hard disk interface cannot be dynamically adapted.
According to the above-mentioned problems and the causes of the problems, as shown in fig. 1, an embodiment of the present invention provides a hard disk recognition method, applied to a controller, comprising the steps of:
S20, identifying the type of the hard disk to be accessed in response to the received external signal;
S40, determining interface information according to the hard disk type and a preset hard disk interface comparison table, wherein the hard disk interface comparison table comprises the hard disk type and the interface information corresponding to the hard disk type;
And S60, responding to the access of the hard disk to be accessed, and setting a hard disk interface according to the interface information.
Aiming at the existing problems at present, the embodiment establishes a hard disk identification method, thereby solving the problems that the physical forms of U.2 and U.3 interfaces of the existing hard disk are consistent and the definition of signal interfaces is different, realizing the sharing of the hard disk of the two interfaces, and having higher practicability and wide application prospect.
The U.2 and U.3 are both standards of the hard disk, U.2 standard and U.3 standard have different pin assignments, wherein 4-way PCIE (PERIPHERAL COMPONENT INTERCONNECT EXPRESS, high-speed serial computer expansion bus standard), SAS (SERIALATTACHEDSCSI, serial attached SCSI interface) SAS0, SAS1 of U.2 all use different pins, while SAS0/PCIE0, SAS1/PCIE1, SAS2/PCIE2, SAS3/PCIE3 of U.3 share the same pin. Therefore, in the prior art, the U.2 hard disk and the U.3 hard disk have different signal interface definitions due to the consistent physical forms of the interfaces, and the compatibility of the hard disks of the two interfaces cannot be realized. The hard disk type comprises a first NVME hard disk supporting U.2 standard and a second NVME hard disk supporting U.3 standard.
In a specific example, as shown in fig. 2, the hard disk identification system in this example includes a controller 100, a PCIE switch 200, and a PCIE NVME controller 300, where the controller 100 is a CPLD (Complex Programmable Logic Device, complex programmable and logic elements) for controlling a logic flow of hard disk adaptation, the PCIE switch 200 is used for switching interface information of each hard disk, and the PCIE NVME controller 300 is used for performing interface setting according to the interface information.
In a specific embodiment, firstly, the controller 100 receives an external signal to identify a hard disk type of a hard disk to be accessed, specifically, identify whether the hard disk to be accessed is U.2 hard disks or U.3 hard disks, secondly, the controller 100 determines interface information according to the hard disk type and a preset hard disk interface comparison table, wherein the hard disk interface comparison table comprises the hard disk type and interface information corresponding to the hard disk type, and thirdly, the controller 100 responds to the access of the hard disk to be accessed to transmit the interface information to the PCIE switch 200, so that the PCIE switch sets the PCIE NVME controller 300 according to the interface information to configure a PCIE interface corresponding to the hard disk to be accessed.
Specifically, the PCIE switch 200 receives the interface information sent by the CPLD, and sets the configuration of the PCIENVME controller 300 according to the interface information, so that the PCIE NVME controller 300 sets the channel information of the PCIENVME controller, a specific channel definition is shown in fig. 3, and when the PCIE switch 200 sets the interface information of the PCIE NVME controller 300 to be a U.2 hard disk, pin numbers of the PCIE interface are E7-E16, and when the interface information is configured to be a U.3 hard disk, pin numbers of the PCIE interface are S1-S7, taking a first PCIE interface PCIE0 as an example.
The hard disk identification system finishes identification and adaptation of the hard disk to be accessed, thereby solving the problems that the physical forms of the U.2 and U.3 interfaces of the existing hard disk are consistent and the definition of the signal interfaces is different, realizing the sharing of the hard disk of the two interfaces and having higher practicability and wide application prospect.
In this embodiment, the hard disk is an NVME hard disk. NVME (Non-Volatile Memory Express, namely a Non-volatile memory standard) is a solid-state memory specially designed for flash memory, low delay and parallelism of PCIE interface channels can be fully utilized, SSD is allowed to be directly connected with a CPU (central processing unit ) through PCIE, delay is further reduced, NVME also has better performance in the aspects of concurrency performance, qoS (Quality of Service), service quality, manageability and the like, so that the hard disk identification system has higher practicability and can be applied to application scenes with more severe delay requirements.
In this embodiment, the first NVME hard disk and the second NVME hard disk correspond to different PCIE interfaces, as shown in fig. 3, where the first NVME hard disk supporting the U.2 standard and the second NVME hard disk supporting the U.3 standard both include 4 PCIE interfaces, i.e., PCIE0-PCIE3. Because the PCIE channels must be used by the NVMe protocol, the more PCIE channels are occupied, the larger the bandwidth used by the hard disk, that is, the faster the read-write speed of the hard disk. In this embodiment, the PCIE refers to a channel, and the NVME is a protocol (interface specification) of the hard disk. The solid state disk supporting the NVME protocol occupies PCIE channels of a main board and a CPU, wherein the PCIE channels comprise PCIE3.0x2 channels and PCIE3.0x4 channels, the sequential read-write speed of the solid state disk of the PCIE3.0x2 channels is between 1000 and 2000MB/s, and the read-write speed of the solid state disk of the PCIE3.0x4 channels is 3000 MB/s.
In this embodiment, as shown in fig. 2 and 3, the PCIE NVME controller 300 sets channel information of the PCIENVME controllers in response to the configuration of the PCIE switch 200, and specific channel definition uses a first PCIE interface PCIE0 as an example, when the PCIE switch 200 sets the interface information of the PCIE NVME controller 300 to be configured as a U.2 hard disk, pin numbers are E7-E16, and when the interface information is configured as a U.3 hard disk, pin numbers are S1-S7. Therefore, the problems that the physical forms of U.2 and U.3 interfaces of the existing hard disk are consistent and the definition of the signal interfaces is different are solved, the hard disk sharing of the two interfaces can be realized, and the method has higher practicability and wide application prospect.
In an optional embodiment, before step S60, the hard disk identification method further includes setting 200 the PCIE switch to be a PCIE interface corresponding to the first NVME hard disk;
step S60 further includes setting, by the PCIE switch 200, a PCIE interface corresponding to the second NVME hard disk when the interface information is interface information corresponding to the second NVME hard disk.
In this embodiment, the initial value of the PCIE NVME controller 300 is a PCIE interface corresponding to the first NVME hard disk, that is, a hard disk is supported by U.3 in a default condition, and when the PCIE switch 200 is set to be a hard disk corresponding to the second NVME hard disk, that is, a U.2 hard disk, the PCIE NVME controller 300 configures according to a channel definition of the U.2 hard disk. In this embodiment, by setting U.3 hard disks with wider default supporting application areas, larger number and faster speed, the configuration time of the PCIE NVME controller 300 can be effectively reduced, and the execution efficiency of the hard disk identification system is improved.
In an alternative embodiment, the controller is a CPLD or FPGA (Field-Programmable Gate array GATE ARRAY). The FPGA is used as a semi-custom circuit in the field of Application Specific Integrated Circuits (ASIC) on the basis of PAL, GAL, CPLD and other programmable devices, can solve the problem of the deficiency of the custom circuit, can overcome the defect of limited gate circuit number of the original programmable devices, and can effectively improve the execution efficiency of the hard disk identification system.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
It will be appreciated that the above examples are only examples listed for better understanding of the technical solution of the embodiments of the present invention, and are not to be construed as the only limitation of the embodiments of the present invention.
Another embodiment of the present invention provides a computer-readable storage medium having stored thereon a computer program which when executed by a processor implements the hard disk identification method applied to a controller, comprising the steps of:
S20, identifying the type of the hard disk to be accessed in response to the received external signal;
S40, determining interface information according to the hard disk type and a preset hard disk interface comparison table, wherein the hard disk interface comparison table comprises the hard disk type and the interface information corresponding to the hard disk type;
And S60, responding to the access of the hard disk to be accessed, and setting a hard disk interface according to the interface information.
In practical applications, the computer-readable storage medium may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium include an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this embodiment, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
As shown in fig. 4, another embodiment of the present invention provides a schematic structural diagram of a computer device. The computer device 12 shown in fig. 4 is merely an example and should not be construed as limiting the functionality and scope of use of embodiments of the present invention.
As shown in FIG. 4, the computer device 12 is in the form of a general purpose computing device. Components of computer device 12 may include, but are not limited to, one or more processors or processing units 16, a system memory 28, and a bus 18 that connects the various system components, including system memory 28 and processing units 16.
Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, micro channel architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Computer device 12 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by computer device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and/or cache memory 32. The computer device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 4, commonly referred to as a "hard disk drive"). Although not shown in fig. 4, a magnetic disk drive for reading from and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In such cases, each drive may be coupled to bus 18 through one or more data medium interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored in, for example, memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 42 generally perform the functions and/or methods of the embodiments described herein.
The computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with the computer device 12, and/or any devices (e.g., network card, modem, etc.) that enable the computer device 12 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 22. Moreover, computer device 12 may also communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet, through network adapter 20. As shown in fig. 4, the network adapter 20 communicates with other modules of the computer device 12 via the bus 18. It should be appreciated that although not shown in FIG. 4, other hardware and/or software modules may be used in connection with computer device 12, including, but not limited to, microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
The processor unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, for example, implementing a hard disk recognition method provided by an embodiment of the present invention.
It should be understood that the foregoing examples of the present invention are provided merely for clearly illustrating the present invention and are not intended to limit the embodiments of the present invention, and that various other changes and modifications may be made therein by one skilled in the art without departing from the spirit and scope of the present invention as defined by the appended claims.