Apparatus and method for controlling storage device in host system
By using a dedicated command buffer and storage host controller to execute power loss protection commands in storage devices, data corruption caused by sudden power loss is solved, and data integrity and security is improved.
Patent Information
- Application Number
- CN202411936491.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-01-09
- Filing Date
- 2024-12-26
- Publication Date
- 2025-07-11
AI Technical Summary
In storage devices, the prior art is difficult to completely prevent data corruption due to sudden power loss.
A dedicated command buffer is used to preserve power loss protection commands, which are executed by the storage host controller in power loss events to protect data.
It effectively reduces the impact of sudden power loss on data in storage devices and improves data integrity and security.
Smart Images

Figure CN120295554A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a storage device, and more particularly, to an apparatus and method for controlling a storage device in a host system. Background Art
[0002] During the process of writing data to or erasing data from a storage device, a sudden power loss may cause data corruption in the storage device. Taking NAND (Not And) flash memory as an example, when a sudden power loss occurs during erasing a block or programming data, it may cause partial or all data corruption in the affected block. Specifically, during the time interval from issuing an erase command to the target block completing its busy state, or during the time interval from issuing a write command to the target page completing its busy state, a sudden power loss may cause data corruption in the block.
[0003] In the case where a sudden power loss occurs, if the power supplied to the dynamic random access memory (DRAM) is interrupted before the power supply to the host and the storage device is interrupted, the DRAM temporarily stores the data to be programmed into the storage device, there is a risk of data corruption. This is because after the DRAM loses power, the host and the storage device can still run briefly, so the storage device may receive incorrect data from the DRAM.
[0004] In the prior art, in order to counteract the possibility of data corruption that may be caused by a sudden power loss during programming or erasing data on a storage device, the host system may utilize data recovery methods implemented by software running on its storage controller or the device controller of the storage device. These methods aim to minimize the chance of data corruption. In addition, it is also proposed to optimize the power-off sequence on the circuit board in the prior art. This optimization ensures that the power supply to the host system or the storage device is cut off before the power supply to the DRAM is interrupted, thereby reducing the possibility of obtaining corrupted data from the DRAM. However, both of these methods have drawbacks, making them may not be able to completely prevent data corruption caused by a sudden power loss. Therefore, there is a need for a method to solve data corruption that may be caused by a sudden power loss in this field. Summary of the Invention
[0005] An object of the present invention is to provide an apparatus and method for handling sudden power loss events. The present invention features a dedicated command buffer as part of a storage host controller. The command buffer is designed to retain a set of power loss protection commands configured by software running on the host system, ensuring a rapid response in the event of a power loss. Upon receiving a notification of power loss, the storage host controller immediately executes the power loss protection commands stored in the dedicated command buffer. This allows for effective and timely data protection in such critical situations. This method has successfully reduced the impact of sudden power loss on the data within the storage device, thereby enhancing data integrity and security.
[0006] According to one embodiment, an apparatus for controlling a storage device in a host system is provided. The apparatus includes a power loss detection module, a power loss handling command buffer, and a storage host controller. The power loss detection module is configured to determine whether a power loss event has occurred based on the level of the supply voltage. The power loss handling command buffer is configured to store one or more power loss protection commands. The storage host controller is connected to the power loss detection module and the power loss handling command buffer and is configured to execute one or more power loss protection commands in the power loss handling command buffer in response to a power loss event, thereby performing one or more specified operations on the storage device.
[0007] According to one embodiment, a method for controlling a storage device in a host system is provided. The method includes: storing one or more power loss protection commands; determining whether a power loss event has occurred based on the level of the supply voltage; and executing one or more power loss protection commands in response to a power loss event, thereby performing one or more specified operations on the storage device.
[0008] These and other objects of the present invention will no doubt become apparent to those skilled in the art after reading the following detailed description of the preferred embodiments depicted in the various figures and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 According to one embodiment of the present invention, an electronic device including a host system and a storage device is shown.
[0010] Figure 2 According to one embodiment of the present invention, the operation mode of the power loss detection module is shown.
[0011] Figure 3 According to one embodiment of the present invention, the process of a storage device having a device controller handling a power loss event is shown.
[0012] Figure 4According to an embodiment of the present invention, a process of a storage device handling a power loss event without a device controller is shown.
[0013] Figure 5 According to an embodiment of the present invention, a simplified process of a method for handling a power loss event is shown. Detailed implementation manners
[0014] In the following description, to provide a thorough understanding of the current embodiments, many specific details are set. However, for those skilled in the art, it is not necessary to use these specific details to practice the current embodiments. In other cases, well-known materials or methods are not described in detail to avoid obscuring the current embodiments.
[0015] In this specification, the reference to "an embodiment" or "a certain embodiment" means that the specified features, structures, or characteristics associated with the embodiment or example are included in at least one embodiment of the current embodiments. Therefore, the phrases "in an embodiment" or "in a certain embodiment" that appear throughout this specification do not necessarily refer to the same embodiment. Additionally, the specified features, structures, or characteristics can be combined in any suitable combination and / or sub-combination in one or more embodiments.
[0016] Figure 1 According to an embodiment of the present invention, an electronic device including a host system and a storage device is shown. As Figure 1 shown, the electronic device 10 includes a host system 100 and storage devices 200 and 300. The host system 100 and the storage devices 200 and 300 are components of the electronic device 10 for implementing the specified functions of the electronic device 10. The host system 100 is operable to manage operations, process data, and execute instructions, while the storage devices 200 and 300 are configured to provide storage spaces for accumulating, retaining, and retrieving data within the electronic device 10.
[0017] In one embodiment, the host system 100 can be embodied within a chip and adopt a system-on-chip (SoC) architecture, thus promoting compactness and enhanced integration of multiple subsystems. In one embodiment, the storage devices 200 and 300 can be implemented based on flash memory technology and can be implemented as universal flash storage (UFS) devices, embedded multimedia card (eMMC) devices, or devices based on NAND or NOR flash memory technology. Additionally, the host system 100 can interface with the storage devices 200 and 300 through a specified communication protocol to implement data transmission, synchronization operations, and error detection and correction mechanisms.
[0018] The host system 100 includes a host controller 110 and a device 120. The host controller 110, as the central core of the host system 100, is basically responsible for coordinating the operations of various components and subsystems included in the host system 100, ensuring seamless integration and coherent functionality among the components and subsystems. The device 120 is configured to handle sudden power loss events. The device 120 includes a storage host controller 121, a power loss detection module 122, and a power loss handling command buffer 123. The storage host controller 121 is configured to control any peripheral storage devices connected to the host system 100, in response to requests initiated by the host controller 110. In addition, the storage host controller 121 is configured to control the storage devices 200 and 300, managing access, erase, read, and write operations.
[0019] Note that the storage devices 200 and 300 mentioned in this embodiment are for illustrative purposes only and not limitations. According to various embodiments of the present invention, the storage devices that the host system 100 and the storage host controller 121 can control may differ in number and type from those in this embodiment. In addition, the electronic device 10 further includes a power supply circuit 30 for providing a supply voltage VDD (Voltage Drain Drain, drain power supply voltage) to various components of the electronic device 10, thereby providing sufficient power for the electronic device 10.
[0020] Figure 2 is according to an embodiment of the present invention, showing the operation mode of the power loss detection module. Please refer to Figure 2 , within the host system 100, there may be one or more voltage conversion circuits 130_1 and 130_2, operable to provide a regulated or converted supply voltage for the storage devices 200 and 300. According to various embodiments, the voltage conversion circuits 130_1 and 130_2 may include linear dropout regulators (LDOs), DC-DC converters, or similar devices. In one embodiment, the supply voltage VDD provided by the power module 30 may be 12V, and the voltage conversion circuits 130_1 and 130_2 can convert the 12V supply voltage VDD into a regulated or converted voltage REG1 of 3.3V or REG2 of 1.8V. As Figure 2As shown, the power loss detection module 122 includes a comparator 1221 and an optional voltage divider circuit 1222. Generally, the comparator 1221 is configured to determine whether the level of the supply voltage VDD is lower than a predetermined safety threshold by comparing the supply voltage VDD or a converted voltage VREG (reference voltage, reference voltage) derived from the supply voltage VDD with the predetermined safety threshold, so as to determine whether a power loss event has occurred. In some embodiments, the power loss detection module 112 may rely on the voltage divider circuit 1222 to divide the supply voltage VDD or regulate or convert the voltage VREG to generate a divided voltage. Accordingly, the comparator 1221 compares the divided voltage with the predetermined safety threshold to determine whether a power loss event has occurred. However, this does not mean limiting the scope of the present invention. In some embodiments, the voltage divider circuit 1222 is not necessary.
[0021] If the comparator 122 detects that the level of the supply voltage VDD or the regulated / converted voltage VREG is lower than the predetermined safety threshold, the power loss detection module 122 determines that a power loss event has occurred and sends a power loss event notification to the storage host controller 121. The storage host controller 121 is configured to execute one or more power loss protection commands stored in the power loss processing command buffer 123 after receiving the power loss event notification.
[0022] Generally, the power loss processing command buffer 123 stores a series of pre-configured commands that are specifically configured to handle power loss events. The power loss processing command buffer 123 is one of several command buffers associated with the storage host controller 121. Different from other command buffers (not shown) within the storage host controller 121, the power loss processing command buffer 123 specifically accommodates commands related to power loss processing, while other command buffers are designated for commands for normal operations. In addition, the commands in the power loss processing command buffer 123 are given priority, with a higher priority than the commands in other command buffers, ensuring an immediate response to power loss events. The storage host controller 121 can execute the power loss protection commands to perform specified operations on the storage devices 200 and 300, thereby protecting the data within the storage devices 200 and 300.
[0023] The operations performed by the storage host controller 121 on the storage devices 200 and 300 after executing the power loss protection commands may vary depending on whether there are inherent device controllers within the storage devices 200 and 300.
[0024] Figure 3 According to an embodiment of the present invention, the process of a storage device with a device controller handling a power loss event is shown. Please refer to Figure 3, according to an embodiment, this figure shows the method flow of a storage device with a device controller (e.g., storage device 200) handling a power loss event. In this embodiment, the storage device 200 can be an eMMC or UFS storage device, which includes a device controller 210 and storage units 220_1 - 220_N (i.e., NAND or NOR flash memory chips). The access to the storage units 220_1 - 220_N is managed depending on the firmware or software running on the device controller 210. The method for a storage device with a device controller to handle a power loss event can be implemented on the analog part (e.g., analog module) and the digital part (e.g., digital module) of the host system 100. Specifically, the power loss detection module 122 included in the analog module is configured to determine whether a power loss event has occurred by comparing the supply voltage VDD or a voltage derived from the supply voltage VDD with a predetermined threshold.
[0025] If the power loss detection module 122 detects a power loss event, it notifies the storage host controller 121 included in the digital module of the power loss event. In response to the power loss event, the storage host controller 121 executes one or more power loss protection commands stored in the power loss handling buffer 123. In one embodiment, executing one or more power loss protection commands will trigger the storage host controller 121 to send a power off notification to the storage device 200. After receiving the power off notification, the firmware or software running on the device controller 210 will initiate a power off procedure, which includes performing a series of specified operations on the storage units 220_1 - 220_N to protect the integrity and security of the data within the storage device 200. According to various embodiments, executing one or more power loss protection commands may further trigger the storage host controller 121 to perform different operations. For example, executing one or more power loss protection commands may trigger the storage host controller 121 to stop sending further access requests to the storage device 120 after sending the power off notification to the storage device 120.
[0026] Figure 4 According to an embodiment of the present invention, it shows the process of a storage device without a device controller handling a power loss event. Please refer to Figure 4, according to an embodiment, this figure shows the method flow of a storage device (e.g., storage device 300) without a device controller handling a power loss event. In this embodiment, the storage device 300 can be a compilation of NAND or NOR flash memory chips, integrated with a simple control circuit, which includes storage units 320_1 - 320_N (i.e., NAND or NOR flash memory chips). The storage units 320_1 - 320_N are directly accessed by the storage host controller 121. The method of a storage device without a device controller handling a power loss event can also be implemented on the analog module and digital module of the host system 100. Specifically, the power loss detection module 122 included in the analog module is configured to determine whether a power loss event occurs.
[0027] After detecting a power loss event, the power loss detection module 122 notifies the storage host controller 121 of the power loss event. In response to the power loss event, the storage host controller 121 executes one or more power loss protection commands stored in the power loss processing buffer 123. Executing one or more power loss protection commands will trigger the storage host controller 121 to configure specified control signals to the storage device 300. In one embodiment, executing one or more power loss protection commands will trigger the storage device controller 121 to configure the chip enable (CE) signal between the storage host controller 121 and the storage device 300, where the chip enable signal will be configured to the disabled state, thereby deactivating the storage units 320_1 - 320_N. This means that the storage device 300 will discard subsequent erase and program commands. In addition, executing one or more power loss protection commands will trigger the storage device controller to stop sending further erase and program commands to the storage device 300. In one embodiment, executing one or more power loss protection commands will further trigger the storage device controller 121 to keep the write protection signal between the storage host controller 121 and the storage device 300 in the writable state or erasable state. This will allow the completion of ongoing operations of one or more storage units 320_1 - 320_N. In this case, the commands, addresses, and / or data of the write and / or erase requests have been fully received by the storage device 300, but one or more storage units 320_1 - 320_N are still busy. Keeping the write protection signal in the writable state or erasable state will ensure the preservation of data and prevent potential data corruption or loss within the storage device 300.
[0028] Figure 5 is a simplified flow chart showing the method of handling a power loss event according to an embodiment of the present invention, which is a flow chart of a method for controlling one or more storage devices in a host system. As Figure 5 shown, the method of the present invention includes the following simplified process:
[0029] Step S110: Store one or more power loss protection commands;
[0030] Step S120: Determine whether a power loss event has occurred based on the level of the supply voltage;
[0031] Step S130: In response to the power loss event, execute one or more power loss protection commands to perform one or more specified operations on the storage device.
[0032] Since the principles and specific details of the above steps have been explained in detail through the above embodiments, they will not be repeated here. It should be noted that by adding other additional steps or making appropriate modifications and adjustments, the above process may better improve flexibility and further enhance the accuracy and efficiency of handling power loss events.
[0033] A feature of the present invention is a specially designed command buffer for retaining a series of power loss protection commands, pre-configured for optimal response in sudden power loss events. This feature is crucial for the integrity and security of data in storage devices. The present invention eliminates the risk of data loss and corruption in sudden power loss events by immediately notifying the storage device to stop any ongoing erase and write operations. In summary, the integration and implementation of the power loss protection command buffer in a System-on-Chip (SoC) is reflected in the improvement of overall data security and the enhancement of system reliability. This advancement is significant in ensuring that the SoC system can withstand and adapt to unexpected power interruptions, thereby ensuring the preservation and security of critical information and system stability.
[0034] The implementation mode according to this embodiment can be realized as a device, a method, or a computer program product. Therefore, this embodiment can take a fully hardware implementation mode, a fully software implementation mode, or a mode combining software and hardware aspects, which are usually referred to as "modules" or "systems" here. In addition, this embodiment can take the form of a computer program product implemented on any tangible expression medium having program code for a computer stored in the medium. In terms of hardware, the present invention can be implemented by applying the following technologies or related combinations: individual operating logics with logic gates capable of performing logic functions according to data signals, and specified application integrated circuits (ASICs), programmable gate arrays (PGAs), or field programmable gate arrays (FPGAs) combined with appropriate combinational logics.
[0035] The flowcharts and block diagrams in the flowcharts illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present embodiment. In this regard, each block in the flowchart or block diagram may represent a module, segment, or portion of code that contains one or more executable instructions for implementing the specified logical function. It should also be noted that each block in the block diagram and / or flowchart illustration, as well as combinations of blocks in the block diagram and / or flowchart illustration, can be implemented by a dedicated hardware system that performs the specified function or behavior, or a combination of hardware and computer instructions. These computer program instructions can be stored in a computer-readable medium that directs a computer or other programmable data processing device to work in a specified manner, such that the instructions stored in the computer-readable medium produce a manufacture that includes instruction means for implementing the functions / behavior specified in the flowchart and / or block diagram block or blocks.
[0036] Those skilled in the art will immediately observe that numerous modifications and changes can be made to the devices and methods while retaining the teachings of the invention. Accordingly, the foregoing disclosure should be construed only within the bounds of the claims.
Claims
1. A device for controlling a storage device in a host system, characterized in that, Comprising: A power loss detection module configured to determine whether a power loss event has occurred based on the level of the supply voltage; A power loss handling command buffer configured to store one or more power loss protection commands; And A storage host controller connected to the power loss detection module and the power loss handling command buffer, configured to execute the one or more power loss protection commands in response to the power loss event in the power loss handling command buffer, thereby performing one or more specified operations on the storage device.
2. The device according to claim 1, characterized in that, The storage device includes a device controller and one or more storage units, and the storage host controller executes the one or more power loss protection commands to send a power-off notification to the device controller of the storage device when it is determined that the power loss event has occurred.
3. The device according to claim 2, characterized in that, The storage host controller executes the one or more power loss protection commands to stop sending further access requests to the storage device when it is determined that the power loss event has occurred.
4. The device according to claim 2, wherein The storage device includes one or more storage units but no device controller, and the storage host controller executes the one or more power loss protection commands to deactivate the one or more storage units by configuring the chip enable signal associated with the storage units to a disabled state when it is determined that the power loss event has occurred.
5. The device according to claim 4, characterized in that, The storage host controller executes the one or more power loss protection commands to stop sending erase and program commands to the storage device when it is determined that the power loss event has occurred.
6. The device according to claim 4, characterized in that, The storage host controller executes the one or more power loss protection commands to allow ongoing operations of the one or more storage units to be completed by keeping the write protection signal associated with the one or more storage units in a writable or erasable state when it is determined that the power loss event has occurred.
7. The device according to claim 1, characterized in that, The power loss detection module includes: A comparator configured to compare the supply voltage or a regulated or converted voltage derived from the supply voltage with a predetermined threshold to determine whether the power loss event has occurred.
8. The device according to claim 1, characterized in that, The power loss detection module includes: A voltage divider circuit configured to divide the supply voltage or a regulated or converted voltage derived from the supply voltage to generate a divided voltage; and A comparator configured to compare the divided voltage with a predetermined threshold to determine whether the power loss event has occurred.
9. The device according to claim 1, wherein The storage device is a non-volatile memory.
10. A method for controlling a storage device in a host system, characterized in that, Comprising: Storing one or more power loss protection commands; Determining whether a power loss event has occurred based on the level of the supply voltage; And Executing the one or more power loss protection commands in response to the power loss event, thereby performing one or more specified operations on the storage device.
11. The method according to claim 10, wherein The storage device includes a device controller and one or more storage units, and the steps of performing the one or more specified operations on the storage device include: Sending a power-off notification to the device controller of the storage device when it is determined that the power loss event has occurred.
12. The method according to claim 11, wherein The steps of performing the one or more specified operations on the storage device include: When it is determined that the power loss event has occurred, stop sending further access requests to the storage device.
13. The method according to claim 11, wherein The storage device includes one or more storage cells but no device controller, and the steps of performing the one or more specified operations on the storage device include: When it is determined that the power loss event has occurred, deactivate the one or more storage cells by configuring the chip enable signal associated with the storage cells to a disabled state.
14. The method according to claim 13, wherein The steps of performing the one or more specified operations on the storage device include: When it is determined that the power loss event has occurred, stop sending erase and program commands to the storage device.
15. The method according to claim 13, characterized in that, The steps of performing one or more specified operations on the storage device include: If it is determined that the power loss event has occurred, allow ongoing operations of the one or more storage cells to complete by keeping the write protection signal associated with the one or more storage cells in a writable state or an erasable state.
16. The method according to claim 10, wherein The steps of determining whether the power loss event occurs according to the level of the supply voltage include: Compare the supply voltage or a regulated or converted voltage derived from the supply voltage with a predetermined threshold to determine whether the power loss event has occurred.
17. The method according to claim 10, wherein The steps of determining whether the power loss event occurs according to the level of the supply voltage include: Divide the supply voltage or a regulated or converted voltage derived from the supply voltage to generate a divided voltage; and Compare the divided voltage with a predetermined threshold to determine whether the power loss event has occurred.
18. The method according to claim 10, wherein The storage device is a non-volatile memory.