A solid-state drive NVMe control method, device, electronic device, and storage medium
By modifying the NVMe hard drive's configuration file and BIOS control, power was applied to the NVMe hard drive during shutdown, resolving the energy waste and damage issues that occur when the NVMe hard drive is shut down, and improving the hard drive's lifespan and system stability.
Patent Information
- Application Number
- CN202310359108.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-06
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2043-04-06
AI Technical Summary
NVMe hard drives remain powered on even when the computer is off, leading to energy waste, hard drive damage, and reduced lifespan.
By modifying the configuration file to set the default power-on/off state of the NVMe hard drive to power-off mode, and controlling the hard drive's power-on/off through the PCIeswitch extended bus standard conversion chip during the BIOS boot phase, the success and stability of the operation were verified using an oscilloscope.
This allows power to be applied to the NVMe hard drive when the system is shut down, avoiding energy waste and hard drive damage, and improving hard drive lifespan and system stability.
Smart Images

Figure CN116756069B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of NVMe hard drive control technology, and in particular to a solid-state drive NVMe control method, a solid-state drive NVMe control device, an electronic device, and a computer-readable storage medium. Background Technology
[0002] PCIe switches provide expansion or aggregation capabilities, allowing more devices to connect to a single PCIe port. They act as packet routers, identifying the path a given packet should take based on its address or other routing information; they are PCIe-to-PCIe bridges. A PCIe switch chip is a chip equipped with PCIe switch technology. NVMe hard drives are solid-state drives that can be used in servers. NVM Express (NVMe), or Non-Volatile Memory Host Controller Interface Specification (NVMHCIS), is a logical device interface specification. It is a bus transmission protocol specification (equivalent to the application layer in communication protocols) based on the device's logical interface, similar to AHCI, used to access non-volatile memory media attached via the PCIe bus. Even after the server shuts down the device by entering a shutdown command in the operating system, the NVMe hard drive remains powered on. This is because NVMe hard drives are responsible for storing data in the storage system. To ensure that NVMe hard drives can work properly, the relevant technologies fix the power-on mode in the configuration file of the PCIeSwitch chip for controlling the NVMe hard drive.
[0003] Using the above method to control NVMe hard drives, when the device is powered off, there is no need for data interaction with the NVMe hard drive. Powering on the NVMe hard drive not only wastes energy but also damages it, thereby reducing its lifespan. Summary of the Invention
[0004] This invention provides a method, apparatus, electronic device, and computer-readable storage medium for controlling NVMe solid-state drives, in order to solve the problem of how to power down NVMe hard drives when the computer is shut down.
[0005] This invention discloses a control method for a solid-state drive (NVMe). The NVMe SSD is configured with a corresponding PCIeswitch (extension bus standard conversion chip), a BIOS (Basic Input / Output System), and register slot control. The PCIeswitch has a power-on / off configuration file for power-on / off control of the NVMe SSD, which may include:
[0006] Set the power-on / off configuration file to power-off mode;
[0007] A preset field for expressing the power-on mode is written into the power controller bit of the slot control register so that the solid-state drive NVMe can be powered on by reading the power controller bit when the basic input / output system BIOS is in the startup phase.
[0008] When the solid-state drive NVMe is powered on, the PCIeswitch expansion bus standard conversion chip controls the solid-state drive NVMe to power off based on the power-on / off configuration file.
[0009] Optionally, it may also include:
[0010] When the Basic Input / Output System BIOS is in the startup phase, enumerate the downlink bridge devices for the PCIeswitch expansion bus standard conversion chip.
[0011] Optionally, it may also include:
[0012] Read the power controller bit and determine whether the preset field has been successfully written into the power controller bit based on the power controller bit.
[0013] If it is determined that the preset field was not successfully written to the power controller bit in the power controller byte, the step of writing the preset field for expressing the power-on mode to the power controller bit in the slot control register is re-executed a preset number of times.
[0014] Optionally, it may also include:
[0015] When it is determined that the preset field was not successfully written to the power controller bit, a first determination result is generated and the first determination result is entered into the runtime of the BIOS.
[0016] Optionally, the Basic Input / Output System BIOS includes a BIOS SETUP function, which may further include, prior to the step of powering on the NVMe solid-state drive by reading the power controller bit:
[0017] The BIOS SETUP setting configures the power-on / off switch options for the NVMe solid-state drive in the BIOS, and determines whether the NVMe drive is successfully powered on / off using these power-on / off switch options.
[0018] Optionally, the NVMe hard drive is equipped with a corresponding oscilloscope, and the step of determining whether the NVMe hard drive is successfully powered on and off via the power-on / off switch option may include:
[0019] The power-on / off switch option is used to perform power-on / off operations on the NVMe hard drive according to a preset time period and a preset number of times.
[0020] During the power-on / off operation, the oscilloscope is used to acquire the power signal for the NVMe hard drive, and the power signal is used to determine whether the NVMe hard drive has been successfully powered on / off.
[0021] This invention also provides a solid-state drive (NVMe) control device, characterized in that the NVMe solid-state drive is configured with a corresponding extended bus standard conversion chip PCIeswitch, a basic input / output system BIOS, and register slot control. The extended bus standard conversion chip PCIeswitch has a power-on / off configuration file for power-on / off control of the NVMe solid-state drive, including:
[0022] A power-down mode setting module is used to set the power-down configuration file to power-down mode;
[0023] The solid-state drive NVMe power-on module is used to write a preset field for expressing the power-on mode into the power controller bit of the slot control register, so that when the basic input / output system BIOS is in the startup phase, the solid-state drive NVMe is powered on by reading the power controller bit.
[0024] The solid-state drive NVMe power-off module is used to control the solid-state drive NVMe to power off based on the power-on / off configuration file through the extended bus standard conversion chip PCIeswitch when the solid-state drive NVMe is in the power-on state.
[0025] Optionally, it may also include:
[0026] The downlink bridge device enumeration module is used to enumerate the downlink bridge devices for the PCIeswitch expansion bus standard conversion chip when the Basic Input / Output System BIOS is in the startup phase.
[0027] Optionally, it may also include:
[0028] A successful write judgment module is used to read the power controller bit and determine whether the preset field has been successfully written into the power controller bit based on the power controller bit.
[0029] When it is determined that the preset field has not been successfully written to the power controller bit, the solid-state drive NVMe power-on module is invoked.
[0030] Optionally, it may also include:
[0031] The first determination result generation module is used to generate a first determination result when the determination fails to write the preset field into the power controller bit, and to record the first determination result into the runtime of the basic input / output system BIOS.
[0032] Optionally, the Basic Input / Output System BIOS includes a configuration function BIOS SETUP, and may further include:
[0033] The power-on / off switch option configuration module is used to configure power-on / off switch options for the NVMe solid-state drive in the BIOS SETUP function, and to determine whether the NVMe hard drive is successfully powered on or off through the power-on / off switch options.
[0034] Optionally, the NVMe hard drive is equipped with a corresponding oscilloscope, and the power-on / off switch option configuration module may include:
[0035] The power-on / off operation execution submodule is used to perform power-on / off operations on the NVMe hard drive according to a preset time period and a preset number of times using the power-on / off switch option;
[0036] The power-on / off determination submodule is used to acquire the power signal for the NVMe hard drive using the oscilloscope when performing the power-on / off operation, and to determine whether the NVMe hard drive has been successfully powered on or off using the power signal.
[0037] This invention also provides a server configured with an NVMe solid-state drive, an expansion bus standard conversion chip (PCIeswitch), a basic input / output system (BIOS), and a register slot control corresponding to the NVMe. The PCIeswitch has a power-on / off configuration file for power-on / off control of the NVMe. The server is used to set the power-on / off configuration file to a power-off mode. A preset field for expressing the power-on mode is written into the power controller bit of the register slot control, so that when the BIOS is in the startup phase, the power controller bit is read to power on the NVMe. When the NVMe is in the power-on state, the PCIeswitch controls the NVMe to power off based on the power-on / off configuration file.
[0038] This invention also discloses an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;
[0039] The memory is used to store computer programs;
[0040] When the processor executes a program stored in the memory, it implements the method described in the embodiments of the present invention.
[0041] This invention also discloses a computer-readable storage medium storing instructions that, when executed by one or more processors, cause the processors to perform the methods described in this invention.
[0042] The embodiments of the present invention have the following advantages:
[0043] In this embodiment of the invention, the power-on / off configuration file is set to power-off mode; a preset field for expressing the power-on mode is written into the power controller byte of the register, so that when the basic input / output system is in the startup phase, the solid-state drive is powered on by reading the power controller byte; when the solid-state drive is in the power-on state, the PCIeswitch expansion bus standard conversion chip controls the solid-state drive to power off based on the power-on / off configuration file, thereby realizing power-off of the NVMe drive when the system is powered off. Attached Figure Description
[0044] Figure 1 This is a schematic diagram of an electrical connection structure between an NVMe hard drive and a PCIe switch and a PCA9555 provided in an embodiment of the present invention;
[0045] Figure 2 This is a flowchart of the steps of a solid-state drive NVMe control method provided in an embodiment of the present invention;
[0046] Figure 3 This is a flowchart illustrating the steps of a solid-state drive NVMe control method provided in an embodiment of the present invention;
[0047] Figure 4 This is a structural block diagram of a solid-state drive NVMe control device provided in an embodiment of the present invention;
[0048] Figure 5 This is a hardware structure block diagram of an electronic device provided in various embodiments of the present invention;
[0049] Figure 6 This is a schematic diagram of a computer-readable medium provided in an embodiment of the present invention. Detailed Implementation
[0050] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0051] To enable those skilled in the art to better understand the embodiments of the present invention, some technical terms of the embodiments of the present invention are explained below.
[0052] NVMe: NVMe hard drives are solid-state drives that can be used in servers. NVM Express (NVMe), or Non-Volatile Memory Host Controller Interface Specification (NVMHCIS), is a logical device interface specification. Similar to AHCI, it's a bus transmission protocol specification based on a device logical interface (equivalent to the application layer in communication protocols) used to access non-volatile memory media attached via the PCI Express (PCIe) bus.
[0053] CPLD: CPLD (Complex Programmable Logic Device) is short for Complex PLD, a more complex logic element than PLD. A CPLD is a digital integrated circuit whose logic functions are constructed by the user according to their specific needs. Its basic design method involves using an integrated development environment (IDE) platform, employing schematic diagrams, hardware description languages, and other methods to generate corresponding target files. The code is then transferred to the target chip via a download cable ("in-system" programming) to realize the designed digital system.
[0054] PCI-Express (Peripheral Component Interconnect Express) is a high-speed serial computer expansion bus standard, originally named "3GIO," designed to replace older PCI, PCI-X, and AGP bus standards. PCIe is a high-speed serial point-to-point dual-channel high-bandwidth transmission standard. Connected devices are allocated dedicated channel bandwidth and do not share bus bandwidth. It primarily supports active power management, error reporting, end-to-end reliable transmission, hot-plugging, and Quality of Service (QoS) functions.
[0055] PCIe Switch: A PCIe switch provides expansion or aggregation capabilities, allowing more devices to connect to a single PCIe port. They act as packet routers, identifying the path a given packet should take based on its address or other routing information. They are a type of PCIe-to-PCIe bridge. A PCIe switch chip is a chip equipped with PCIe switch technology.
[0056] PCA9555: A low-voltage 16-bit general purpose input / output (GPIO) expander with interrupts and weak pull-up resistors, suitable for I2C bus / SMBus applications.
[0057] BIOS: BIOS is an abbreviation for "Basic Input Output System." It's a set of programs embedded in a ROM chip on the computer's motherboard. The BIOS stores the computer's most important basic input / output programs, the power-on self-test (POST) program, and the system boot program. It can read and write detailed system settings from the CMOS. Its main function is to provide the lowest-level, most direct hardware settings and control for the computer. In addition, the BIOS provides some system parameters to the operating system. Changes to system hardware are hidden by the BIOS; programs use BIOS functions rather than directly controlling the hardware. Modern operating systems often bypass the abstraction layer provided by the BIOS and directly control hardware components.
[0058] I2C: The I2C bus is a simple, bidirectional, two-wire synchronous serial bus. It requires only two wires to transmit information between devices connected to the bus. The master device initiates data transmission on the bus and generates a clock to enable transmission; any addressed device is considered a slave device. The master-slave and send-receive relationships on the bus are not constant but depend on the direction of data transmission. If the master wants to send data to a slave device, it first addresses the slave device, then actively sends data to the slave device, and finally terminates the data transmission. If the master wants to receive data from a slave device, it first addresses the slave device, then receives the data sent by the slave device, and finally terminates the receiving process. In this case, the master is responsible for generating the timing clock and terminating the data transmission.
[0059] Slot control register: The slot control register can serve as a software interface to control PCIe hot-plug events.
[0060] In practical applications, even after the server shuts down the device by entering a shutdown command in the operating system, the NVMe hard drive remains powered on. When the device is powered off, there is no longer a need for data interaction with the NVMe hard drive. Keeping the NVMe hard drive powered on not only wastes energy but also damages it, thus reducing its lifespan.
[0061] The server's NVMe hard drive is connected to the downstream port of the Switch chip, and its power-on / off enable signal PWR_EN is connected to the 9555 expansion chip. The 9555 chip is controlled by the Switch's firmware via the I2C bus. The Switch chip's firmware sends commands to the 9555 chip via the I2C bus, and the 9555 chip pulls the PWR_EN signal line high or low according to the commands to achieve the purpose of powering on and off the NVMe hard drive.
[0062] The Switch firmware controls the power-on and power-off of NVMe hard drives through a configuration file. During the Switch chip's power-on and power-off processes, this configuration file sets the NVMe hard drive's power-on and power-off states. This configuration file can only be set to one mode: power-on or power-off. Since NVMe hard drives are responsible for storing data in the storage system, ensuring their proper functioning is paramount. For NVMe hard drives to function correctly, they require power. To guarantee this, the NVMe hard drive power-on / power-off control section in the Switch chip's configuration file is fixed to power-on mode. Therefore, once the device is plugged in and powered on, the NVMe hard drive remains powered on, even when the device is powered off, as long as the power cord is not unplugged.
[0063] In related technologies, modifying the Switch chip configuration file to set the NVMe hard drive to the default power-off state can solve the problem of the NVMe hard drive still being powered on when the system is powered off. Although the NVMe driver can power on the NVMe hard drive after entering the operating system, ensuring that the NVMe hard drive can support data services normally when the system is powered on, the NVMe hard drive is always in a power-off state during the BIOS startup phase. That is, the NVMe hard drive is not powered on before entering the operating system, so the NVMe hard drive device cannot be seen in BIOS setup; the NVMe hard drive link status cannot be seen in the switch serial port either, which makes it inconvenient to check the Switch status information during the BIOS startup phase. At the same time, the earlier the NVMe hard drive is powered on, the more stable its performance will be. Therefore, not being able to power on the NVMe hard drive during the BIOS phase poses a certain risk to the stability of the entire system.
[0064] To address the issue of not being able to flexibly power on and off the disk during power-on and power-off processes, some technologies connect the disk's power-off enable signal to the CPLD, allowing the CPLD to send signals to power on and off the NVMe hard drive during power-on and power-off processes. However, this solution requires hardware modifications and re-boarding, which is time-consuming and can result in some economic losses.
[0065] One of the core inventive points of this invention is to achieve flexible power-on and power-off of the NVMe hard drive during the device power-on and power-off process through software without modifying the original hardware design.
[0066] Specifically, refer to Figure 1 , Figure 1This is a schematic diagram of an electrical connection structure between an NVMe hard drive, a PCIe switch, and a PCA9555, provided in an embodiment of the present invention. The switch firmware can set the default power-on and power-off states of the NVMe hard drive through a configuration file. At the same time, when the switch chip is in a normal power-on state, when the switch firmware detects a change in the value of the power controller bit in the slot control register of the configuration space of the switch downlink bridge device, the switch firmware can execute corresponding code to control the power-on and power-off states of its downlink port device, and send instructions to the 9555 chip through the I2C bus to control the NVMe hard drive's PWR_EN signal to go high or low.
[0067] This invention can power down the NVMe hard drive when the device is shut down by modifying the default NVMe hard drive status in the configuration file to the power-down state. Simultaneously, it can power on the NVMe hard drive during startup by modifying the power controller bit value of the slot control register in the configuration space of the Switch downlink bridge device at an appropriate time during BIOS startup. To increase the controllability of this operation, an option is added to the BIOS setup interface to control whether this function is enabled. To verify the correctness of NVMe hard drive power-on / off during the BIOS stage, a secondary option is set below the previous switch option. This option is for testing and verification purposes and can be set to continuously power on and off the NVMe hard drive, with the number of consecutive power-on / off cycles set. During startup, the effectiveness of this function can be verified by capturing continuous PWR_EN signal waveforms with an oscilloscope. The default setting of the BIOS setup selects this function as enabled, and after setting the power controller bit, it reads back and verifies whether the value is set successfully. This process can be repeated a preset number of times, and relevant information is printed in the BIOS log.
[0068] Reference Figure 2 The diagram illustrates a flowchart of a solid-state drive NVMe control method provided in an embodiment of the present invention, which may specifically include the following steps:
[0069] Step 201: Set the power-on / off configuration file to power-off mode;
[0070] Step 202: Write a preset field to express the power-on mode into the power controller bit of the slot control register, so that the solid-state drive NVMe can be powered on by reading the power controller bit when the basic input / output system BIOS is in the startup phase.
[0071] Step 203: When the solid-state drive NVMe is in a power-on state, the PCIeswitch expansion bus standard conversion chip controls the solid-state drive NVMe to power off based on the power-on / off configuration file.
[0072] In practical applications, the embodiments of the present invention can be applied to servers equipped with solid-state drives (NVMe). The solid-state drives (NVMe) can be configured with corresponding expansion bus standard conversion chips (PCIeswitch), basic input / output system (BIOS), and register slot control. The expansion bus standard conversion chips (PCIeswitch) can have power-on and power-off configuration files for power-on and power-off control of the solid-state drives (NVMe).
[0073] In a specific implementation, the present invention can set the power-on / off configuration file to power-off mode. Specifically, the content of the NVMe hard drive power-on / off control part in the Switch chip configuration file can be fixed to power-off mode, so that when the Switch is powered off, the Switch firmware will power off the NVMe hard drive according to the value of the configuration file during the power-off process, thereby achieving the purpose of powering off the NVMe hard drive when the Switch is powered off.
[0074] In this embodiment of the invention, the switch can also be configured during the BIOS boot phase, so that the power controller bit of the slot control register in the downlink port configuration space of all NVMe hard drives is in the power-on state, so as to power on the NVMe hard drives during the BIOS boot phase.
[0075] After setting the power-on / off configuration file to power-off mode and writing a preset field to express the power-on mode into the power controller bit of the slot control register, this embodiment of the invention can control the NVMe solid-state drive to power off based on the power-on / off configuration file through the PCIeswitch extended bus standard conversion chip when the NVMe solid-state drive is in the power-on state.
[0076] For example, after the PCIeswitch powers on the NVMe SSD, the operating system (OS) sends a shutdown command to the PCIeswitch, and the PCIeswitch responds to the shutdown command by powering down the NVMe SSD based on the configuration file.
[0077] In this embodiment of the invention, the power-on / off configuration file is set to power-off mode; a preset field for expressing the power-on mode is written into the power controller byte of the register, so that when the basic input / output system is in the startup phase, the solid-state drive is powered on by reading the power controller byte; when the solid-state drive is in the power-on state, the PCIeswitch expansion bus standard conversion chip controls the solid-state drive to power off based on the power-on / off configuration file, thereby realizing power-off of the NVMe drive when the system is powered off.
[0078] Based on the above embodiments, modified embodiments of the above embodiments are proposed. It should be noted that, in order to keep the description brief, only the differences from the above embodiments are described in the modified embodiments.
[0079] In an optional embodiment of the present invention, it further includes:
[0080] When the Basic Input / Output System BIOS is in the startup phase, enumerate the downlink bridge devices for the PCIeswitch expansion bus standard conversion chip.
[0081] In practical applications, the inability to determine the downstream bridge device of the PCIeswitch during the BIOS boot process may cause server crashes.
[0082] In this embodiment of the invention, after enumerating all the downlink bridge devices of the Switch during the BIOS startup phase, a preset field for expressing the power-on mode can be written to the power controller bit of the slot control register, in order to avoid a crash during the BIOS startup process.
[0083] In an optional embodiment of the present invention, it further includes:
[0084] Read the power controller bit and determine whether the preset field has been successfully written into the power controller bit based on the power controller bit.
[0085] If it is determined that the preset field was not successfully written to the power controller bit in the power controller byte, the step of writing the preset field for expressing the power-on mode to the power controller bit in the slot control register is re-executed a preset number of times.
[0086] In a specific implementation, embodiments of the present invention can read back the setting of the power controller bit in the NVMe power-on register slot control through the BIOS to determine whether the power controller bit in the slot control register is set to the power-on state.
[0087] If it is determined that the power controller bit in the slot control register is not set to the power-on state, the preset field for expressing the power-on mode can be rewritten to the power controller bit in the slot control register a preset number of times to improve the success rate of setting the power controller bit.
[0088] Optionally, when it is determined that the preset field was not successfully written to the power controller bit, a first determination result is generated and the first determination result is entered into the runtime of the basic input / output system BIOS.
[0089] To enable R&D personnel to better understand the reasons for successful setting when the power controller bit of the slot control register is not set to the power-on state, this embodiment of the invention can record the first determination result in the BIOS log. Specifically, the first determination result can be the process of operating the NVMe power-on register slot control, including the retry process and the final result of whether the setting was successful.
[0090] In this embodiment of the invention, the power controller bit can be read, and based on the power controller bit, it can be determined whether the preset field has been successfully written into the power controller byte. If it is determined that the preset field has not been successfully written into the power controller byte, the step of writing the preset field for expressing the power-on mode into the power controller bit of the slot control register is re-executed a preset number of times. When it is determined that the preset field has not been successfully written into the power controller bit, a first determination result is generated and recorded in the runtime of the basic input / output system BIOS, thereby improving the success rate of register slot control and further improving the power-down control efficiency of the NVMe solid-state drive.
[0091] In an optional embodiment of the present invention, the basic input / output system BIOS includes a BIOS SETUP function, and prior to the step of powering on the solid-state drive NVMe by reading the power controller bit, it further includes:
[0092] The BIOS SETUP setting configures the power-on / off switch options for the NVMe solid-state drive in the BIOS, and determines whether the NVMe drive is successfully powered on / off using these power-on / off switch options.
[0093] In practical applications, to further improve the power-down control efficiency of NVMe solid-state drives, embodiments of the present invention can set a power-on / off switch option in the BIOS SETUP function of the Basic Input / Output System BIOS to set a virtual switch for the NVMe solid-state drive, thereby performing power-on / off operations on the NVMe solid-state drive through the virtual switch, and thus determining whether the NVMe drive has been successfully powered on / off.
[0094] Optionally, the NVMe hard drive is equipped with a corresponding oscilloscope, and the step of determining whether the NVMe hard drive is successfully powered on and off via the power-on / off switch option includes:
[0095] The power-on / off switch option is used to perform power-on / off operations on the NVMe hard drive according to a preset time period and a preset number of times.
[0096] During the power-on / off operation, the oscilloscope is used to acquire the power signal for the NVMe hard drive, and the power signal is used to determine whether the NVMe hard drive has been successfully powered on / off.
[0097] For example, the power-on / off switch option can be set as a first-level menu, and the first-level menu can be set as key1; a second-level menu can be set under key1, which can contain both power-on and power-off options; a third-level menu can be set under the second-level menu, which can be used to set the number of power-on / off cycles and the time period; after completing the menu settings, the NVMe hard drive can be continuously powered on and off based on the power-on / off options, preset time periods, and preset number of cycles, and the power signal PWR_EN of the NVMe hard drive can be captured with an oscilloscope during the power-on / off operation. The power signal PWR_EN can be used to determine whether the NVMe hard drive has been successfully powered on and off, and can also be used to verify the timeliness of the Switch firmware's response to BIOS settings and whether any omissions have occurred.
[0098] In this embodiment of the invention, the BIOS SETUP setting configures a power-on / off switch option for the NVMe solid-state drive (SSD), and uses this power-on / off switch option to determine whether the NVMe SSD has been successfully powered on and off. The power-on / off switch option is used to perform power-on / off operations on the NVMe SSD according to a preset time period and a preset number of times. During the power-on / off operation, an oscilloscope is used to acquire the power signal for the NVMe SSD, and the power signal is used to determine whether the NVMe SSD has been successfully powered on and off. This allows for testing the stability of the NVMe SSD's power-on / off process, thereby further ensuring the stability of the NVMe SSD's power-on / off process.
[0099] To enable those skilled in the art to better understand the embodiments of the present invention, a complete example is provided below to illustrate the embodiments of the present invention.
[0100] refer to Figure 3 , Figure 3 This is a flowchart illustrating the steps of a solid-state drive NVMe control method provided in an embodiment of the present invention.
[0101] 1. Modify the configuration file of the switch chip to set the default power-on / off state of the NVMe hard drive to power-off state, ensuring that the NVMe hard drive is in the power-off state when the device is powered off;
[0102] 2. Powering on the NVMe hard drive during the BIOS boot process is achieved by setting the registers in the Switch downlink port configuration space;
[0103] 3. During the BIOS startup phase, the registers for powering on the NVMe hard drive are configured only after all the downlink bridge devices of the Switch have been enumerated, in order to avoid system crashes during the BIOS startup process.
[0104] 4. Read back the settings of the NVMe power-on register in the BIOS to check if the settings are successful. If the settings fail, retry a maximum of three times.
[0105] 5. The BIOS log records the process of operating the NVMe power-on register, including the retry process and the final result of whether the setting was successful;
[0106] 6. The BIOS setup settings include a switch option to select whether to enable the function of powering on the NVMe hard drive during the BIOS phase;
[0107] 7. The BIOS setup menu is used to test whether the NVMe hard drive is successfully powered on and off, and to verify the timeliness of the Switch firmware's response to BIOS settings and whether there are any omissions in processing. After setting this option, the NVMe hard drive will be continuously powered on and off during the BIOS boot process. Use an oscilloscope to capture the PWR_EN signal to record the actual power-on and power-off process. By comparing the two, you can conclude whether there is a problem.
[0108] 8. By configuring the registers of the Switch's downlink bridge device and in conjunction with the Switch's firmware, it is possible to power on and off NVMe hard drives.
[0109] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0110] Reference Figure 4 The diagram illustrates a structural block diagram of a solid-state drive NVMe control device provided in an embodiment of the present invention, which may specifically include the following modules:
[0111] The power-off mode setting module 401 is used to set the power-off configuration file to power-off mode;
[0112] The solid-state drive NVMe power-on module 402 is used to write a preset field for expressing the power-on mode into the power controller bit of the slot control register, so that when the basic input / output system BIOS is in the startup phase, the solid-state drive NVMe is powered on by reading the power controller bit.
[0113] The solid-state drive NVMe power-off module 403 is used to control the solid-state drive NVMe to power off based on the power-on / off configuration file through the extended bus standard conversion chip PCIeswitch when the solid-state drive NVMe is in the power-on state.
[0114] Optionally, it may also include:
[0115] The downlink bridge device enumeration module is used to enumerate the downlink bridge devices for the PCIeswitch expansion bus standard conversion chip when the Basic Input / Output System BIOS is in the startup phase.
[0116] Optionally, it may also include:
[0117] A successful write judgment module is used to read the power controller bit and determine whether the preset field has been successfully written into the power controller bit based on the power controller bit.
[0118] When it is determined that the preset field has not been successfully written to the power controller bit, the solid-state drive NVMe power-on module is invoked.
[0119] Optionally, it may also include:
[0120] The first determination result generation module is used to generate a first determination result when the determination fails to write the preset field into the power controller bit, and to record the first determination result into the runtime of the basic input / output system BIOS.
[0121] Optionally, the Basic Input / Output System BIOS includes a configuration function BIOS SETUP, and may further include:
[0122] The power-on / off switch option configuration module is used to configure power-on / off switch options for the NVMe solid-state drive in the BIOS SETUP function, and to determine whether the NVMe hard drive is successfully powered on or off through the power-on / off switch options.
[0123] Optionally, the NVMe hard drive is equipped with a corresponding oscilloscope, and the power-on / off switch option configuration module may include:
[0124] The power-on / off operation execution submodule is used to perform power-on / off operations on the NVMe hard drive according to a preset time period and a preset number of times using the power-on / off switch option;
[0125] The power-on / off determination submodule is used to acquire the power signal for the NVMe hard drive using the oscilloscope when performing the power-on / off operation, and to determine whether the NVMe hard drive has been successfully powered on or off using the power signal.
[0126] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0127] In another embodiment of the present invention, a server is also provided. The server is configured with a solid-state drive (NVMe), an expansion bus standard conversion chip (PCIeswitch), a basic input / output system (BIOS), and a register slot control corresponding to the NVMe. The PCIeswitch has a power-on / off configuration file for power-on / off control of the NVMe. The server is used to set the power-on / off configuration file to a power-off mode. A preset field for expressing the power-on mode is written into the power controller bit of the register slot control, so that when the BIOS is in the startup phase, the NVMe is powered on by reading the power controller bit. When the NVMe is in the power-on state, the PCIeswitch controls the NVMe to power off based on the power-on / off configuration file.
[0128] As the server implementation is basically similar to the method implementation, it is described in a relatively simple way. For relevant details, please refer to the description of the method implementation.
[0129] In addition, this invention also provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described solid-state drive NVMe control method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0130] This invention also provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the various processes of the above-described NVMe solid-state drive control method embodiments and achieves the same technical effects. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0131] Figure 5 A schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention.
[0132] The electronic device 500 includes, but is not limited to, components such as: a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface unit 508, a memory 509, a processor 510, and a power supply 511. Those skilled in the art will understand that... Figure 5 The electronic device structures shown are not intended to limit the electronic device. An electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements. In embodiments of the present invention, the electronic device includes, but is not limited to, mobile phones, tablet computers, laptops, PDAs, in-vehicle terminals, wearable devices, and pedometers.
[0133] It should be understood that, in this embodiment of the invention, the radio frequency unit 501 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink data from the base station and processes it with the processor 510; additionally, it transmits uplink data to the base station. Typically, the radio frequency unit 501 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier, a duplexer, etc. Furthermore, the radio frequency unit 501 can also communicate with networks and other devices through a wireless communication system.
[0134] The electronic device provides users with wireless broadband internet access through the network module 502, such as helping users send and receive emails, browse web pages, and access streaming media.
[0135] The audio output unit 503 can convert audio data received by the radio frequency unit 501 or the network module 502 or stored in the memory 509 into audio signals and output them as sound. Furthermore, the audio output unit 503 can also provide audio output related to specific functions performed by the electronic device 500 (e.g., call signal reception sound, message reception sound, etc.). The audio output unit 503 includes a speaker, a buzzer, and a receiver, etc.
[0136] Input unit 504 is used to receive audio or video signals. Input unit 504 may include a graphics processing unit (GPU) 5041 and a microphone 5042. The GPU 5041 processes image data of still images or videos acquired by an image capture device (such as a camera) in video capture mode or image capture mode. The processed image frames can be displayed on display unit 506. The image frames processed by GPU 5041 can be stored in memory 509 (or other storage medium) or transmitted via radio frequency unit 501 or network module 502. Microphone 5042 can receive sound and process such sound into audio data. The processed audio data can be converted into a format that can be transmitted to a mobile communication base station via radio frequency unit 501 in telephone call mode.
[0137] The electronic device 500 also includes at least one sensor 505, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 5061 according to the ambient light level, and the proximity sensor can turn off the display panel 5061 and / or backlight when the electronic device 500 is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used to identify the posture of the electronic device (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc. The sensor 505 may also include a fingerprint sensor, pressure sensor, iris sensor, molecular sensor, gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc., which will not be described in detail here.
[0138] The display unit 506 is used to display information input by the user or information provided to the user. The display unit 506 may include a display panel 5061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0139] User input unit 507 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of electronic devices. Specifically, user input unit 507 includes a touch panel 5071 and other input devices 5072. Touch panel 5071, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near touch panel 5071). Touch panel 5071 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 510, which receives and executes commands from the processor 510. In addition, touch panel 5071 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. Besides touch panel 5071, user input unit 507 may also include other input devices 5072. Specifically, other input devices 5072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, joysticks, etc., which will not be described in detail here.
[0140] Furthermore, the touch panel 5071 can cover the display panel 5061. When the touch panel 5071 detects a touch operation on or near it, it transmits the information to the processor 510 to determine the type of touch event. Subsequently, the processor 510 provides corresponding visual output on the display panel 5061 based on the type of touch event. Although in Figure 5 In this embodiment, the touch panel 5071 and the display panel 5061 are two independent components to realize the input and output functions of the electronic device. However, in some embodiments, the touch panel 5071 and the display panel 5061 can be integrated to realize the input and output functions of the electronic device. The specific implementation is not limited here.
[0141] Interface unit 508 serves as an interface for connecting external devices to electronic device 500. For example, external devices may include a wired or wireless headphone port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, and so on. Interface unit 508 can be used to receive input from external devices (e.g., data, power, etc.) and transmit the received input to one or more components within electronic device 500, or it can be used to transmit data between electronic device 500 and external devices.
[0142] The memory 509 can be used to store software programs and various data. The memory 509 may primarily include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback, image playback, etc.), etc.; the data storage area may store data created based on the use of the mobile phone (such as audio data, phonebook, etc.). Furthermore, the memory 509 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0143] The processor 510 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 509, and by calling data stored in the memory 509, it performs various functions and processes data, thereby providing overall monitoring of the electronic device. The processor 510 may include one or more processing units; preferably, the processor 510 may integrate an application processor and a modem processor. The application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 510.
[0144] The electronic device 500 may also include a power supply 511 (such as a battery) for supplying power to various components. Preferably, the power supply 511 can be logically connected to the processor 510 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system.
[0145] In addition, the electronic device 500 includes some functional modules not shown, which will not be described in detail here.
[0146] It should be noted that, in this document, 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. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0147] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of 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. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0148] like Figure 6 As shown, in another embodiment of the present invention, a computer-readable storage medium 601 is also provided, which stores instructions that, when executed on a computer, cause the computer to perform the solid-state drive NVMe control method described in the above embodiment.
[0149] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of the present invention.
[0150] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. 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 implementations should not be considered beyond the scope of this invention.
[0151] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0152] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0153] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0154] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0155] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0156] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A solid state disk NVMe control method, characterized in that, The NVMe solid-state drive is configured with a corresponding PCIeswitch expansion bus standard conversion chip, a basic input / output system BIOS, and register slot control. The PCIeswitch expansion bus standard conversion chip has a power-on / off configuration file for the power-on / off control of the NVMe solid-state drive, including: Set the power-on / off configuration file to power-off mode; A preset field for expressing the power-on mode is written into the power controller bit of the slot control register so that the solid-state drive NVMe can be powered on by reading the power controller bit when the basic input / output system BIOS is in the startup phase. When the solid-state drive NVMe is powered on, the PCIeswitch expansion bus standard conversion chip controls the solid-state drive NVMe to power off based on the power-on / off configuration file.
2. The method of claim 1, wherein, Also includes: When the Basic Input / Output System BIOS is in the startup phase, enumerate the downlink bridge devices for the PCIeswitch expansion bus standard conversion chip.
3. The method of claim 1, wherein, Also includes: Read the power controller bit and determine whether the preset field was successfully written into the power controller bit based on the power controller bit. If it is determined that the preset field was not successfully written to the power controller bit in the power controller byte, the step of writing the preset field for expressing the power-on mode to the power controller bit in the slot control register is re-executed a preset number of times.
4. The method of claim 3, wherein, Also includes: When it is determined that the preset field was not successfully written to the power controller bit, a first determination result is generated and the first determination result is entered into the runtime of the BIOS.
5. The method of claim 1, wherein, The Basic Input / Output System BIOS includes a BIOS SETUP function, and prior to the step of powering on the NVMe solid-state drive by reading the power controller bit, it further includes: The BIOS SETUP setting configures the power-on / off switch options for the NVMe solid-state drive in the BIOS, and determines whether the NVMe drive is successfully powered on / off using these power-on / off switch options.
6. The method according to claim 5, characterized in that, The NVMe hard drive is equipped with a corresponding oscilloscope. The step of determining whether the NVMe hard drive is successfully powered on or off via the power-on / off switch option includes: The power-on / off switch option is used to perform power-on / off operations on the NVMe hard drive according to a preset time period and a preset number of times. During the power-on / off operation, the oscilloscope is used to acquire the power signal for the NVMe hard drive, and the power signal is used to determine whether the NVMe hard drive has been successfully powered on / off.
7. A solid-state drive NVMe control device, characterized in that, The NVMe solid-state drive is configured with a corresponding PCIeswitch expansion bus standard conversion chip, a basic input / output system BIOS, and register slot control. The PCIeswitch expansion bus standard conversion chip has a power-on / off configuration file for the power-on / off control of the NVMe solid-state drive, including: A power-down mode setting module is used to set the power-down configuration file to power-down mode; The solid-state drive NVMe power-on module is used to write a preset field for expressing the power-on mode into the power controller bit of the slot control register, so that when the basic input / output system BIOS is in the startup phase, the solid-state drive NVMe is powered on by reading the power controller bit. The solid-state drive NVMe power-off module is used to control the solid-state drive NVMe to power off based on the power-on / off configuration file through the extended bus standard conversion chip PCIeswitch when the solid-state drive NVMe is in the power-on state.
8. A server, the server being configured with a solid-state drive (NVMe), an expansion bus standard conversion chip (PCIeswitch), a basic input / output system (BIOS), and a register slot control corresponding to the NVMe, the PCIeswitch having a power-on / off configuration file for power-on / off control of the NVMe, the server being configured to set the power-on / off configuration file to a power-off mode; writing a preset field for expressing a power-on mode into the power controller bit of the register slot control, so that when the BIOS is in the startup phase, the server powers on the NVMe by reading the power controller bit; when the NVMe is in a power-on state, the server controls the NVMe to power off based on the power-on / off configuration file via the PCIeswitch.
9. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; The memory is used to store computer programs; When the processor executes a program stored in the memory, it implements the method as described in any one of claims 1-6.
10. A computer-readable storage medium having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method as described in any one of claims 1-6.
Citation Information
Patent Citations
SSD normal power failure test method and device, computer equipment and storage medium
CN111782446A
Hard disk power supply system and method, electronic equipment and storage medium
CN115509334A
