A method, system, device and storage medium for obtaining a log

By allocating registers in the solid-state drive configuration space and accessing them using TLP messages, the high cost of exporting logs and the inconvenience of relying on hardware interfaces in existing technologies are solved, achieving flexible and efficient log acquisition and ensuring information security.

CN115129500BActive Publication Date: 2026-02-27SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210753400.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-29
Publication Date
2026-02-27
Estimated Expiration
2042-06-29

AI Technical Summary

Technical Problem

Existing technologies for exporting SSD logs suffer from high costs, inconvenient reliance on hardware interfaces, or limitations imposed by the host system kernel, making log acquisition inconvenient.

Method used

By allocating control registers, address registers, and data registers in the configuration space of the solid-state drive and accessing these registers using TLP messages, logs can be obtained, avoiding reliance on host system kernel features and external hardware assistance.

Benefits of technology

It enables flexible and efficient acquisition of solid-state drive logs without relying on host system kernel features or external hardware assistance, ensuring information security and being unrestricted by the host system environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115129500B_ABST
    Figure CN115129500B_ABST
Patent Text Reader

Abstract

The application discloses a method for obtaining a log, comprising the following steps: in response to the power-on of a hard disk, mapping the configuration space of the hard disk to the memory address space of a host; allocating a control register, an address register and a data register in the configuration space of the hard disk; in response to the access of the host to the memory address space, triggering the generation of TLP information; and based on the TLP information, accessing the control register, the address register and / or the data register to obtain the log. The application also discloses a system, a computer device and a readable storage medium. The scheme provided by the application obtains the log by using multiple registers in the configuration space of the hard disk and reading and writing data through TLP messages, and does not depend on the kernel characteristics of the host system and external hardware assistance.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of storage, in particular to a method, system and device for obtaining a log and a storage medium. BACKGROUND

[0002] Although the solid state disk has undergone a large number of tests and verifications before leaving the factory, problems may still occur in actual application in the face of various environments, in order to quickly find the cause of the problem, it is necessary to export the log saved in the flash during the running process of the solid state disk. The commonly used way to export the log is to use the serial port mode, but the serial port depends on the hardware, which increases the cost, and it is also not convenient to lead out the interface on the shell of the solid state disk. There is also a way to map the local storage space of the solid state disk to the host memory space through the base address register (BAR), and export the log through direct memory reading. This way exports the log quickly, but for some versions of the host system kernel or some custom host system kernels of customers, additional memory space is not allowed to be mapped or read and written after mapping, at this time the solid state disk may need to be moved to other suitable hosts to export the log, which causes a lot of trouble. Some ways use nvme commands to export logs, but some SSD exceptions may cause the nvme device to be unable to recognize. SUMMARY

[0003] Therefore, in order to overcome at least one aspect of the above problems, the embodiments of the present application provide a method for obtaining a log, comprising the following steps:

[0004] In response to the power-on of the hard disk, mapping the configuration space of the hard disk to the memory address space of the host;

[0005] Allocating a control register, an address register and a data register in the configuration space of the hard disk;

[0006] In response to the host accessing the memory address space, triggering the generation of TLP information;

[0007] Accessing the control register, the address register and / or the data register based on the TLP information to obtain the log.

[0008] In some embodiments, accessing the control register, the address register and / or the data register based on the TLP information to obtain the log further comprises:

[0009] The host writes a random number obtaining command to the control register and writes the order of the part of random numbers to be obtained to the address register;

[0010] In response to the control register receiving the get random number command, writing corresponding sequential partial random numbers to the data register according to the value in the address register, and causing the host to obtain the corresponding sequential partial random numbers in the data register by reading the data register.

[0011] In some embodiments, further comprising:

[0012] The host obtains a key corresponding to the hard disk;

[0013] Encrypting the complete random number obtained by sequentially combining the plurality of partial random numbers using the key to generate complete verification data;

[0014] The host writes a write verification data command to the control register, writes the order of the partial verification data to be written to the address register, and writes the corresponding order of the partial verification data to be written to the data register;

[0015] In response to the hard disk receiving the complete verification data, generating check data using the random number returned to the host and the key and comparing it with the complete verification data;

[0016] In response to the check data being the same as the complete verification data, setting a verification success flag to continue reading the log.

[0017] In some embodiments, further comprising:

[0018] In response to the check data being different from the complete verification data, the hard disk does not perform any operation based on the TLP information.

[0019] In some embodiments, accessing the control register, the address register and / or the data register based on the TLP information to obtain the log further comprises:

[0020] The host writes the TLP information to the control register, the TLP information including an export log command, a get log start address command and a get log length command;

[0021] In response to the control register receiving the export log command, importing the log from the flash to the DDR;

[0022] In response to the control register receiving the get log start address command, writing the start address of the log in the DDR to the data register, so that the host obtains the start address of the log in the DDR by reading the data register;

[0023] write the length of the log in the DDR into the data register in response to the control register receiving the log length obtaining command, so that the host obtains the length of the log in the DDR by reading the data register.

[0024] In some embodiments, further comprising:

[0025] the host writes a log obtaining command to the control register and writes an address of a log to be obtained to the address register;

[0026] determining a log to be returned according to the address in the address register in response to the control register receiving the log obtaining command, wherein an address offset of the log to be returned is greater than an address offset of the log to be obtained;

[0027] write the log to be returned into the data register so that the host obtains the log to be returned by reading the data register and determines an address of a log to be obtained next to be written to the address register according to the address offset of the log to be returned.

[0028] In some embodiments, the control register, the address register and the data register are allocated in a configuration space of the hard disk, further comprising:

[0029] allocating a control register, a high-bit address register, a low-bit address register and a data register in a configuration space of the hard disk.

[0030] Based on the same inventive concept, according to another aspect of the present application, embodiments of the present application further provide a system for obtaining a log, comprising:

[0031] a mapping module configured to map a configuration space of the hard disk to a memory address space of the host in response to the hard disk being powered on;

[0032] an allocation module configured to allocate a control register, an address register and a data register in a configuration space of the hard disk;

[0033] a generation module configured to trigger generation of TLP information in response to the host accessing the memory address space;

[0034] an obtaining module configured to access the control register, the address register and / or the data register based on the TLP information to obtain the log.

[0035] Based on the same inventive concept, according to another aspect of the present application, embodiments of the present application further provide a computer device, comprising:

[0036] at least one processor; and

[0037] Memory, the memory stores a computer program which can run on the processor, characterized in that the processor executes the program to execute the steps of any one of the methods for obtaining a log as described above.

[0038] Based on the same inventive concept, according to another aspect of the present application, the embodiments of the present application also provide a computer readable storage medium, the computer readable storage medium stores a computer program, the computer program is executed by a processor to execute the steps of any one of the methods for obtaining a log as described above.

[0039] The present application has one of the following beneficial technical effects: the scheme provided by the present application obtains the log by using a plurality of registers in the configuration space of the hard disk and reading and writing data through TLP messages, and does not depend on the kernel characteristics of the host system and external hardware assistance. BRIEF DESCRIPTION OF DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other embodiments can also be obtained without creative labor on the basis of these drawings.

[0041] Figure 1 The flowchart of the method for obtaining a log provided by the embodiments of the present application is shown in the figure;

[0042] Figure 2 The schematic diagram of allocating registers in the configuration space of the hard disk provided by the embodiments of the present application is shown in the figure;

[0043] Figure 3 The flowchart of the host obtaining a random number and writing verification data to the hard disk provided by the embodiments of the present application is shown in the figure;

[0044] Figure 4 The flowchart of the host obtaining a log provided by the embodiments of the present application is shown in the figure;

[0045] Figure 5 The structural schematic diagram of the system for obtaining a log provided by the embodiments of the present application is shown in the figure;

[0046] Figure 6 The structural schematic diagram of the computer device provided by the embodiments of the present application is shown in the figure;

[0047] Figure 7 The structural schematic diagram of the computer readable storage medium provided by the embodiments of the present application is shown in the figure. DETAILED DESCRIPTION

[0048] In order to make the objects, technical solutions and advantages of the present application clearer, the following further describes the embodiments of the present application in detail with reference to the accompanying drawings and in conjunction with specific embodiments.

[0049] It should be noted that all the expressions of "first" and "second" in the embodiments of the present application are used to distinguish two same name different entities or different parameters, and the "first" and "second" are only for the convenience of description, and should not be understood as a limitation of the embodiments of the present application. The subsequent embodiments will not be described one by one.

[0050] In the embodiments of the present application, DDR, Double Data Rate SDRAM, is a double rate SDRAM.

[0051] BAR, Base Address Registers. Base address registers exist in PCIe configuration space, which is used to determine the amount of system memory space required by the function, and provides a base address for mapping to the function memory space. The base address register can be mapped to the memory space or the I / O space. There are generally 6 BARs, BAR0-BAR5, in PCIe Type0.

[0052] RC, Root complex. In a PCI Express (PCIe) system, the root complex device connects the processor and memory subsystem to the PCI Express switching fabric composed of one or more switching devices.

[0053] TLP, Transaction Layer Packet.

[0054] According to one aspect of the present application, the embodiments of the present application provide a method for obtaining a log, as shown in Figure 1 The method can include the following steps:

[0055] S1, in response to the power-on of the hard disk, mapping the configuration space of the hard disk to the memory address space of the host;

[0056] S2, allocating control registers, address registers and data registers in the configuration space of the hard disk;

[0057] S3, in response to the host accessing the memory address space, triggering the generation of TLP information;

[0058] S4, accessing the control registers, the address registers and / or the data registers based on the TLP information to obtain the log.

[0059] The application uses TLP message to read and write PCIe register to transmit the solid state disk log, and the PCIe register is easy to access, and no additional software tool is needed, and the register can be accessed as long as the TLP message is constructed, and the host system kernel characteristics and external hardware assistance are not dependent.

[0060] In some embodiments, S1, in response to the hard disk power-on, maps the configuration space of the hard disk to the memory address space of the host, and specifically, as shown in Figure 2 As shown in the figure, each solid state disk has such a space, the host software can obtain some information of the device by reading it, and the device can also be configured through it, and the space is called PCIe configuration space. When the solid state disk is powered on, the host system maps the PCIe device open space to the memory address space of the host, and the host needs to access the PCIe device space, and only needs to access the corresponding memory address space. The RC checks the memory address, and if it is found that the memory address is the mapping of a PCIe device space, it will trigger the generation of TLP to access the corresponding PCIe device to read or write the PCIe device.

[0061] A PCIe device can have several internal spaces to be mapped to the memory space of the host system, and the size and attributes of the spaces are written in the Configuration BAR register when the device is shipped. After power-on, the host system software reads the BAR and allocates the corresponding system memory address space to it, and writes the corresponding memory base address back to the BAR.

[0062] In some embodiments, the control register, the address register and the data register are allocated in the configuration space of the hard disk, and further comprising:

[0063] The control register, the high address register, the low address register and the data register are allocated in the configuration space of the hard disk.

[0064] Specifically, although a PCIe device can have several internal spaces, some host systems can not map all the internal spaces or can not use them after mapping. But at least one PCIe configuration space is mapped, and the capability register of the PCie is accessed in the configuration space. The host reads or writes data through the mapped memory address space to obtain the capability and attribute configuration of the solid state hardware. Any host system must be able to map this space, otherwise the PCIe device cannot be recognized. The register used by the application to obtain the log is in the configuration space, and a block of unused address space is applied, and four registers are allocated, which are control register, address register high 32bit, address register low 32bit and data register. Each register stores 32bit data. Figure 2As shown, BAR0 and BAR1 record the memory space address mapped by the host system, and the host accesses the capability register, MSIX interrupt, and other information of the PCIe device by accessing the memory space address. The four registers used by the application are an address space allocated from the remaining space of the register area. The host can read and write these four registers through TLP message operations.

[0065] The control register: the host writes different control commands to the control register to inform the solid state disk of the next operation. The control command is mainly divided into: GET_RANDOM, VERIFY, LOG2DDR, GET_ADDRU / GET_ADDRL, GET_LENU / GET_LENL, and GET_LOG.

[0066] The address register: when the host wants to get the log, the host writes the address where the log to be obtained to the two registers. When the host writes data to the data register, it can specify the 32-bit data through the two registers.

[0067] The data register: the host reads or writes data through the register according to different commands.

[0068] It should be noted that whether to allocate an address register or two address registers (address register high 32 bits and address register low 32 bits) can be determined according to the data address and data size in the DDR. For example, when the data and address in the DDR are represented by 64 bits, two address registers (address register high 32 bits and address register low 32 bits) can be allocated to represent the high address (left 32-bit address) and low address (right 32-bit address) to form 64 bits.

[0069] In some embodiments, accessing the control register, the address register, and / or the data register based on the TLP information to obtain the log further includes:

[0070] The host writes a GET_RANDOM command to the control register and writes the order of the part of random numbers to be obtained to the address register;

[0071] In response to the control register receiving the GET_RANDOM command, write the part of random numbers of the corresponding order to the data register according to the value in the address register, so that the host obtains the part of random numbers of the corresponding order in the data register by reading the data register.

[0072] In some embodiments, further comprising:

[0073] The host obtains a key corresponding to the hard disk;

[0074] The key is used to encrypt the complete random number obtained by sequentially combining the plurality of partial random numbers to generate complete verification data;

[0075] The host writes a write verification data command to the control register, writes the order of the partial verification data to be written to the address register, and writes the partial verification data corresponding to the order to be written to the data register;

[0076] In response to the hard disk receiving the complete verification data, the check data is generated using the random number returned to the host and the key and compared with the complete verification data;

[0077] In response to the check data being the same as the complete verification data, a verification success flag is set to continue reading the log.

[0078] In some embodiments, further comprising:

[0079] In response to the check data being different from the complete verification data, the hard disk does not perform any operation based on the TLP information.

[0080] Specifically, before obtaining the log, the solid state disk needs to verify the legitimacy of the obtaining party (the symmetric encryption algorithm used in the verification is determined according to the situation, such as 3DES, SM4, the following description takes SM4 algorithm as an example, the key is 16 bytes, the 16-byte random number is encrypted to generate 16-byte verification data), the host obtains 16-byte random number from the solid state disk through the command register, encrypts the random number using the known key written in the solid state disk at the time of factory, generates verification data and writes it to the solid state disk, the solid state disk encrypts the random number with the same algorithm to generate verification data for comparison, and sets a verification success flag after successful verification. Only then will it respond to subsequent commands and export the log.

[0081] Here, the random number is encrypted for verification, which ensures the randomness of each verification and has anti-replay effect. At the same time, the verification success flag will be cleared after a controller level reset.

[0082] The operation flow is as shown in Figure 3 The figure takes C to represent the command register, AU to represent the address high 32-bit register, AL to represent the address low 32-bit register, and D to represent the data register.

[0083] In some embodiments, based on the TLP information, the control register, the address register and / or the data register are accessed to obtain the log, further comprising:

[0084] the host writes the TLP information to the control register, the TLP information including an export log command, a get log start address command and a get log length command;

[0085] in response to the control register receiving the export log command, importing the log from the flash into the DDR;

[0086] in response to the control register receiving the get log start address command, writing a start address of the log in the DDR to the data register, so that the host gets the start address of the log in the DDR by reading the data register;

[0087] in response to the control register receiving the get log length command, writing a length of the log in the DDR to the data register, so that the host gets the length of the log in the DDR by reading the data register.

[0088] In some embodiments, further comprising:

[0089] the host writes a get log command to the control register and writes an address of a log to be obtained to the address register;

[0090] in response to the control register receiving the get log command, determining a log to be returned according to the address in the address register, wherein an address offset of the log to be returned is greater than an address offset of the log to be obtained;

[0091] writing the log to be returned to the data register so that the host gets the log to be returned by reading the data register and determines an address of a log to be obtained next to be written to the address register according to the address offset of the log to be returned.

[0092] Specifically, as Figure 4As shown, the host writes the value of LOG2DDR into the command register, informing the SSD to import the log from the flash into the DDR, and if the verification fails, the SSD does not perform any operation. If the verification passes, the SSD reads the log from the flash into the DDR. The host delays for several seconds and then writes the value of GET_ADDRU into the command register to obtain the first address of the log in the DDR. If the verification fails, the SSD returns all 0s when the host reads the data register, and if the verification passes, the SSD returns the high 32-bit value of the first address of the log in the DDR when the host reads the data register. The GET_ADDRL, GET_LENU and GET_LENL commands are similar. At this time, the host obtains the position and total length of the log in the SSD. The host writes the value of GET_LOG into the command register and writes the value of the address to be read into the address register, and the SSD returns the 32-bit log data at this position when the host reads the data register. The host changes the value of the address to continuously read the log information from the SSD.

[0093] It should be noted that each time the host writes an address to the hard disk, the address corresponds to only one byte (8 bits) of the log, but since the size of the data register is 32 bits, the hard disk returns four bytes (32 bits) of the log to the host, and thus the host writes an address into the address register that is 4 greater than the previous address when obtaining data next time.

[0094] The scheme provided by the application requires to provide verification information before obtaining the log, and the log can be obtained only after the verification passes. The encrypted plaintext is a random number, which has a replay prevention effect, ensures that the log cannot be obtained at will, and ensures the security of the information. The TLP message is used to read and write access the PCIe register to export the log, which is flexible and convenient and does not depend on the host system environment and the serial port hardware support of the solid state hardware.

[0095] Based on the same inventive concept, according to another aspect of the application, embodiments of the application also provide a system 400 for obtaining a log, as shown in Figure 5 The system comprises:

[0096] a mapping module 401 configured to map a configuration space of the hard disk to a memory address space of a host in response to power-on of the hard disk;

[0097] an allocation module 402 configured to allocate a control register, an address register and a data register in the configuration space of the hard disk;

[0098] a generation module 403 configured to trigger generation of TLP information in response to access of the memory address space by the host;

[0099] The acquisition module 404 is configured to access the control register, the address register and / or the data register based on the TLP information to acquire the log.

[0100] Based on the same inventive concept, according to another aspect of the present application, as shown in Figure 6 Embodiments of the present application also provide a computer device 501, which comprises:

[0101] at least one processor 520; and

[0102] a memory 510, the memory 510 storing a computer program 511 executable on the processor, the processor 520 executing the program to perform the steps of any of the above methods for acquiring a log.

[0103] Based on the same inventive concept, according to another aspect of the present application, as shown in Figure 7 Embodiments of the present application also provide a computer readable storage medium 601, the computer readable storage medium 601 storing a computer program 610, the computer program 610 being executed by a processor to perform the steps of any of the above methods for acquiring a log.

[0104] Finally, it needs to be explained that all or part of the processes in the above-mentioned embodiments can be understood by those of ordinary skill in the art that they can be completed by a computer program instructing relevant hardware, and the program can be stored in a computer readable storage medium, and the program when executed can include the processes of the above-mentioned embodiments of the methods.

[0105] In addition, it should be understood that the computer readable storage medium (for example, the memory) herein can be a volatile memory or a non-volatile memory, or can include both volatile memory and non-volatile memory.

[0106] Those skilled in the art will also appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein can be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends on the particular application and design constraints imposed on the overall system. Skilled persons can implement the functions described in various ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the embodiments of the present application.

[0107] The above are exemplary embodiments disclosed by the present application, but it should be noted that various changes and modifications can be made without departing from the scope of the embodiments disclosed by the present application defined by the claims. The functions, steps and / or actions of the method claims described herein need not be performed in any particular order. Furthermore, although elements of the embodiments disclosed by the present application can be described or claimed in individual forms, they can also be understood as plural unless explicitly limited to single.

[0108] It should be understood that, as used herein, the singular forms "a", "an" and "the" are intended to include plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising", or "includes" and / or "including" when used herein, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0109] The above-mentioned embodiment number of the embodiments of the present application is only for description, not representing the advantages or disadvantages of the embodiments.

[0110] Those skilled in the art can understand that all or part of the steps of the above-mentioned embodiments can be completed by hardware, or by program instructing relevant hardware to complete, and the program can be stored in a computer readable storage medium, and the above-mentioned storage medium can be read-only memory, magnetic disk or optical disk, etc.

[0111] Those skilled in the art should understand that the above discussion of any embodiment is only exemplary, and is not intended to imply that the scope of the embodiments disclosed by the present application (including the claims) is limited to these examples; under the idea of the embodiments of the present application, the above embodiments or technical features in different embodiments can also be combined, and there are many other changes of the above different aspects of the embodiments of the present application, and they are not provided in details for the sake of simplicity. Therefore, any omission, modification, equivalent replacement, improvement, etc. made within the spirit and principles of the embodiments of the present application shall be included in the protection scope of the embodiments of the present application.

Claims

1. A method for obtaining logs, characterized in that, Includes the following steps: In response to power-on of the hard disk, the configuration space of the hard disk is mapped to the host's memory address space; Allocate control registers, address registers, and data registers in the configuration space of the hard disk; In response to the host accessing the memory address space, TLP information is generated. Access the control register, the address register, and / or the data register based on the TLP information to obtain the log; Accessing the control register, the address register, and / or the data register based on the TLP information to obtain the log further includes: The sequence in which the host writes a command to obtain random numbers to the control register and writes a portion of the random numbers to be obtained to the address register; In response to the control register receiving the command to obtain random numbers, a portion of random numbers in the corresponding order is written into the data register according to the value in the address register, so that the host can obtain the portion of random numbers in the corresponding order in the data register by reading the data register; The host obtains the key corresponding to the hard drive; The complete random number, obtained by sequentially combining multiple partial random numbers using the key, is then encrypted to generate complete verification data. The sequence of the host writing write verification data commands to the control register and writing partial verification data to be written to the address register, and the sequence of writing the partial verification data to be written to the data register in the corresponding order; In response to the hard disk receiving the complete verification data, it generates verification data using the random number returned to the host and the key, and compares it with the complete verification data; In response to the fact that the verification data is the same as the complete verification data, a verification success flag is set to continue reading the log.

2. The method as described in claim 1, characterized in that, Also includes: In response to the discrepancy between the verification data and the complete verification data, the hard drive does not perform any operation based on the TLP information.

3. The method as described in claim 1, characterized in that, Accessing the control register, the address register, and / or the data register based on the TLP information to obtain the log further includes: The host writes the TLP information to the control register. The TLP information includes an export log command, a get log start address command, and a get log length command. In response to the control register receiving the export log command, the log is imported from flash into DDR; In response to the control register receiving the command to obtain the log start address, the start address of the log in the DDR is written to the data register, so that the host can obtain the start address of the log in the DDR by reading the data register; In response to the control register receiving the command to obtain the log length, the length of the log in the DDR is written to the data register, so that the host can obtain the length of the log in the DDR by reading the data register.

4. The method as described in claim 3, characterized in that, Also includes: The host writes a log retrieval command to the control register and writes the address of the log to be retrieved to the address register; In response to the control register receiving the log acquisition command, the log to be returned is determined according to the address in the address register, wherein the address offset of the log to be returned is greater than the address offset of the log to be acquired; The log to be returned is written to the data register so that the host can obtain the log to be returned by reading the data register, and the address of the next log to be obtained is determined by the address offset of the log to be returned.

5. The method as described in claim 1, characterized in that, Allocating control registers, address registers, and data registers in the configuration space of the hard disk further includes: The configuration space of the hard disk is allocated with control registers, high-order address registers, low-order address registers, and data registers.

6. A system for acquiring logs, characterized in that, include: The mapping module is configured to map the configuration space of the hard disk to the memory address space of the host in response to power-on of the hard disk; The allocation module is configured to allocate control registers, address registers, and data registers in the configuration space of the hard disk; The generation module is configured to trigger the generation of TLP information in response to the host accessing the memory address space; The acquisition module is configured to access the control register, the address register, and / or the data register based on the TLP information to obtain the log; The acquisition module is also configured as follows: The sequence in which the host writes a command to obtain random numbers to the control register and writes a portion of the random numbers to be obtained to the address register; In response to the control register receiving the command to obtain random numbers, a portion of random numbers in the corresponding order is written into the data register according to the value in the address register, so that the host can obtain the portion of random numbers in the corresponding order in the data register by reading the data register; The host obtains the key corresponding to the hard drive; The complete random number, obtained by sequentially combining multiple partial random numbers using the key, is then encrypted to generate complete verification data. The sequence of the host writing write verification data commands to the control register and writing partial verification data to be written to the address register, and the sequence of writing the partial verification data to be written to the data register in the corresponding order; In response to the hard disk receiving the complete verification data, it generates verification data using the random number returned to the host and the key, and compares it with the complete verification data; In response to the fact that the verification data is the same as the complete verification data, a verification success flag is set to continue reading the log.

7. A computer device, comprising: At least one processor; as well as A memory storing a computer program executable on the processor, characterized in that the processor executes the program by performing the steps of the method as described in any one of claims 1-5.

8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it performs the steps of the method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Method for accessing hard disk in IDE mode

    CN110795364A

  • Solid state disk communication method, device, equipment and system and storage medium

    CN112346665A