1. Technical Field
Embodiments of the present disclosure relate to device debugging technology, and more particularly to a serial attached Small Computer System Interface (SAS) expander and a debugging method of the SAS expander.
2. Description of Related Art
SAS expanders are widely used in the computer industry. Generally, the SAS expander has a first debug port and a second debug port, for a host computer to debug the SAS expander. However, it is inconvenient for a user to switch between the first debug port and the second debug port to connect the host computer manually. Therefore, a more efficient debugging method of the SAS expander is needed.
The present disclosure, including the accompanying drawings, is illustrated by way of examples and not by way of limitation. It should be noted that references to “an” or “one” embodiment in this disclosure are not necessarily to the same embodiment, and such references mean “at least one.”
In general, the word “module,” as used hereinafter, refers to logic embodied in hardware or firmware, or to a collection of software instructions, written in a programming language, such as, for example, Java, C, or assembly. One or more software instructions in the modules may be embedded in firmware. It will be appreciated that modules may comprise connected logic units, such as gates and flip-flops, and may comprise programmable units, such as programmable gate arrays or processors. The modules described herein may be implemented as either software and/or hardware modules and may be stored in any type of non-transitory computer-readable storage medium or other computer storage device.
A host computer 200 may use the first debug port 11 or the second debug port 12 to debug the SAS expander 100. In one embodiment, the host computer 200 may utilize the first debug port 11 to obtain a version, a status, and register information of the SAS expander chip 1. The host computer 200 may utilize the second debug port 12 to erase and update firmware of the SAS expander chip 1.
For example, when the host computer 200 debugs the SAS expander 100, the host computer 200 sends debug commands to a corresponding debug port (e.g., the first debug port 11 or the second debug port 12). If the host computer 200 needs to obtain the version of the SAS expander chip 1, the host computer 200 sends a debug command of obtaining the version of the SAS expander chip 1, to the first debug port 11. If the host computer 200 needs to erase the firmware of the SAS expander chip 1, the host computer 200 sends a debug command of erasing the firmware of the SAS expander chip 1, to the second debug port 12.
The SAS expander 100 further includes a controlling chip 2, a first serial port 21, a second serial port 22, a third serial port 23. The controlling chip 2 is in communication with the first debug port 11 through a first serial port 21, in communication with the second debug port 12 through a second serial port 22, and in communication with the host computer 200 through a third serial port 23. In one embodiment, the first serial port 21, the second serial port 22, and the third serial port 23 are general-purpose serial communication interfaces, including data transmission ports and data reception ports.
The controlling chip 2 includes a storage device 20 and at least one processor 30. In one embodiment, the storage device 20 is an electrically erasable programmable read-only memory (EEPROM). The storage device 20 stores a number of function modules. The function modules may include computerized codes in the form of one or more programs. The computerized code includes instructions that are executed by the at least one processor 30. In one embodiment, the number of function modules includes a controlling module 201, an analyzing module 202, and a sending module 203.
In one embodiment, the controlling chip 2 predetermines a plurality of debug commands corresponding to the first debug port 11 or the second debug port 12, according to configuration of the first debug port 11 and the second debug port 12. The controlling chip 2 further generates a reference table 204 to record the plurality of debug commands and the corresponding debug ports (e.g., the first debug port 11 or the second debug port 12). The controlling chip 2 stores the reference table 204 in the storage device 20.
As an example, as shown in
For another example, the reference table 204 records the debug command of erasing the firmware of the SAS expander chip 1 as “Rdcfg ff0b 0”, which corresponds to the second debug port 12. The reference table 204 further records a debug command of updating the firmware of the SAS expander chip 1 as “Rdcfg ff0b 1”, which corresponds to the second debug port 12.
The controlling chip 2 controls the third serial port 23 to receive the debug command from the host computer 200, and sends the received debug command to the first debug port 11 or the second debug port 12, according to the reference table 204. Details will be given in the following paragraphs.
In step S1, the controlling module 201 controls the third serial port 23 to receive the debug command from the host computer 200. For example, the controlling module 201 controls the third serial port 23, to receive the debug command “Rdcfg ff0b 0” of erasing the firmware of the SAS expander chip 1.
In step S2, the analyzing module 202 searches the reference table 204 for the received debug command, and determines that the received debug command corresponding to the first debug port 11 or the second debug port 12 when the received debug command is found in the reference table 204. When the received debug command cannot be found in the reference table 204, the analyzing module 202 displays an error reminder to tell a user the received command does not exist in the referenced table 204.
For example, the analyzing module 202 searches the reference table 204 for the received debug command “Rdcfg ff0b 0”, and determines that the received debug command “Rdcfg ff0b 0” corresponds to the second debug port 12 according to the reference table 204. If the received debug command “Rdcfg ff0b 0” is not found in the reference table 204, the analyzing module 202 outputs an error message to a display or an audio device.
In step S3, the sending module 203 sends the received debug command to the first debug port 11 through the first serial port 21 if the received debug command in the reference table 204 corresponds to the first debug port 11, or sends the received debug command to the second debug port 12 through the second serial port 21 if the received debug command in the reference table 204 corresponds to the second debug port 12.
For example, the sending module 203 sends the received debug command “Rdcfg ff0b 0” to the second debug port 12, as the received debug command “Rdcfg ff0b 0” in the reference table 204 corresponds to the second debug port 12.
It should be emphasized that the above-described embodiments of the present disclosure, particularly, any embodiments, are merely possible examples of implementations, merely set forth for a clear understanding of the principles of the disclosure. Many variations and modifications may be made to the above-described embodiment(s) of the disclosure without departing substantially from the spirit and principles of the disclosure. All such modifications and variations are intended to be included herein within the scope of this disclosure and the present disclosure and protected by the following claims.
Number | Date | Country | Kind |
---|---|---|---|
102125867 | Jul 2013 | TW | national |