DMA controller

Abstract: A DMA controller is described which has an attached, dedicated memory. Data objects are stored in this memory and are linked to one another, by pointers. Each data object contains DMA block transfer control parameters. A single block transfer is made up of several separate transfers, with each separate transfer defined by one data object. The single block transfer is defined by linking several data objects into a list. The DMA controller consecutively performs the transfers in a linked list without requiring control by a system central processor.

Description: The present invention relates to direct memory access controllers. In digital computer systems, it is common to use direct memory access (DMA) to transfer data between a system memory attached to a main system bus and input/output (I/O) devices. The direction of data transfer can be from the I/O device to memory, or vice versa. A DMA controller is generally used to transfer blocks of data between an I/O device and consecutive locations in the system memory. In order to perform a block transfer, the DMA device needs a starting address for the transfer and a count of the number of data items, which may be bytes, words, or other units of information which can be transmitted in parallel on the computer system bus. In order to perform a DMA block transfer, the DMA controller can take control of the bus for the duration of the transfer, or can transfer one data item each time the system bus is otherwise idle. The latter technique is sometimes referred to as cycle stealing. DMA controllers usually are designed to interface with several independent I/O channels, with four or eight being typical. Each I/O channel has its own buffers and control registers to control DMA transfers to and from that channel. The system central processor has direct access to the registers for each channel, so that transfers can be individually controlled. Each transfer can encompass only a block of consecutively addressed data. In many situations, it would be desirable to make a second block transfer to or from a different location in memory immediately after a first transfer is completed. In a technique known as data chaining, many DMA controllers allow a central processor to load the information required for the second block transfer into another set of control registers within the DMA controller. These control registers may be special registers set aside for the purpose of data chaining, or they can be currently unused control registers for one of the other I/O channels. Upon completion of the first block transfer, the information necessary for the second block transfer is copied over into the control registers for the I/O channel involved, and another block transfer immediately initiated. If the DMA controller implements a function known as auto reload, selected status bits are set when the second block transfer begins. By periodically testing the status bits, the central processor can determine when the second block transfer has been initiated, and load the control information necessary for yet a third block transfer into the data chaining registers if desired. In certain computer system designs, consecutive block transfers to noncontiguous areas of memory occur frequently. This happens often, for example, in a demand paged virtual memory, in which memory pages are also constantly being transferred between the main system memory and a mass storage device, usually a hard disk. Files are typically stored as logically consecutive blocks on the disk, and are often loaded into many nonconsecutive page frames in system memory. When writing a file to disk, the scattered page frames must be gathered together for writing in sequence out to disk. US Patent 4,703,418 discloses a DMA controller which uses command elements stored in system memory by a system processor and specifying the memory address and number of bytes to be transferred. Command elements are executed in sequence by an I/O device. US Patent 4,346,439 discloses a DMA controller in which a processor transfers to an I/O device the starting address and number of entries in a table, each entry in the table containing a starting address and an amount of data to be transferred. The table is stored in main memory. It will be apparent to those skilled in the art that the central processor must be constantly monitoring the status of DMA transfers in order to setup a new transfer each time a previous transfer completes. This generally requires a large number of time consuming interrupts of the central processor, or, worse yet, requires the central processor to periodically-poll the status registers of the DMA controller. The necessity for such high degree of central processor involvement in DMA transfers is clearly undesirable. The prior art, therefore, does not provide a DMA controller which can perform a large number of consecutive block transfers to and from noncontiguous memory locations without requiring intervention from a system central processor after the first of the series of transfers has started. Such a controller would be able to perform scatter-gather operations between main system memory and a disk storage device, a very desirable operation in a demand paged virtual memory. Accordingly the present invention provides a system for controlling data transfers between a memory and another device in a digital computer having a central processor, the system comprising: A Direct Memory Access (DMA) controller for transferring data between the memory and the other device according to transfer control parameters in said controller; and a tag memory, coupled to said DMA controller, wherein said tag memory contains two or more tag objects containing transfer control parameters, characterised in that: the tag memory is separate from the system memory and reserved for the use of the DMA controller, and can be accessed by said DMA controller without reference to said central processor; and transfer control parameters in said DMA controller, a new set of transfer control parameters in a next tag object in said tag memory is transferred to said DMA controller and a new data transfer begun, according to said new set of transfer control parameters. Therefore, a direct memory access controller according the presenting invention includes a separate memory dedicated to support of DMA functions. This separate memory is organized as a heap containing a plurality of objects. Each object stored on the heap contains control information necessary for one DMA block transfer. Each object also includes a pointer to a next object. A desired number of objects may be chained together into a linked list. When one DMA block transfer is completed, the next object on the list is loaded into the control registers for the current I/O channel, and the next block transfer automatically begun. In this manner, a sequence of block transfers is performed until the end of the list is reached. The invention also provides a method for transferring data in a computer system, having a central processor and Direct Memory Access (DMA) controller, comprising the steps of: (a) storing two or more tag objects (32,34,36), each containing control information for a block data transfer, into a tag memory separate from the system memory and reserved for the use of the DMA controller, associated with the DMA controller, wherein said tag memory can be accessed by said DMA controller without reference to said central processor; (b) performing a block data transfer according to control information stored in the DMA controller; (c) transferring control information from one of said tag objects into central registers; (d) performing a block data transfer according to the control information contained in the control registers of the DMA controller; and of the DMA controller; and (e) repeating steps (c) and (d) until the block data transfers corresponding to each of said two or more tag objects have been performed. In order that the invention may be fully understood a preferred embodiment thereof will now be described, by way of example only, with reference to the accompanying drawings in which: FIGURE 1 is a block diagram of a computer system utilizing a DMA controller to interface with I/O devices; FIGURE 2 is a block diagram illustrating the internal organization of a portion of a preferred DMA controller; FIGURE 3 illustrates the information contained within heap objects; and FIGURE 4 is a flowchart illustrating operation of a preferred DMA controller. Figure 1 is a block diagram of a computer system 10. The system 10 includes a central processor 12 connected to a system bus 14. Also connected to the bus 14 are a main system memory 16 and a direct memory access (DMA) controller 18. The DMA controller 18 is the interface between the system memory 16 and all I/O devices 20 connected to the system 10. The I/O devices 20 can include video controllers, serial and parallel ports, and mass storage interfaces such as disk controllers. Also connected to the DMA controller 18 is a separate memory, referred to as a tag table 22. The tag table is a special memory reserved for the use of the DMA controller 18 as will now be described. Figure 2 illustrates those internal characteristics of the DMA controller 18 and the tag table 22 which are relevant to the present invention. Each channel of the DMA controller 18 contains four registers to control the DMA operation. These are an address register 24, a control register 26, a next register 28, and a count register 30. At the beginning of a block transfer, the starting address for the block is loaded into the address register 24. The length of the block is loaded into the count register 30. The control register 26 contains information relevant to the transfer, such as whether the transfer is a read from or a write to main system memory. The control register can also contain a bit indicating whether the address register 24 is to be incremented or decremented after each data item is transferred. Every time a data item is transferred by the DMA controller, the count register 30 is decremented, and the address register 24 is incremented or decremented according to the value of the appropriate bit in the control register 26. When the value of the count register 30 reaches 0, the block transfer has been completed. At this time, the value in the next register 28 is checked. If it points to a valid object or tag in the heap memory 22, the values contained in that object are loaded into the registers 24, 26, 28 and 30. The next block data transfer then begins automatically. The tag table 22 contains a plurality of tags. In tag 2, three tags 32, 34 and 36 are shown. Each tag is a memory object which contains all of the information necessary to reload registers 24, 26, 28, and 30 for another block transfer. The tags are organized as a heap, and are linked together by pointers. When a tag is loaded into the DMA controller's registers the pointer to the next tag is loaded into the next register 28. An initial transfer is defined by the central processor writing values directly into the DMA controller 18 registers. Each tag then defines a subsequent transfer. Initially the value NEXT, contained in the next register 28, points to the first tag 32. That tag provides a pointer to the following tag 34, which in turn points to the final tag 36. The final tag 36 contains a pointer to NIL indicating that it is the last tag of a list. NIL is a reserved pointer value which does not point to a valid heap object. Instead this value is interpreted by the DMA controller 18 as a signal that the end of the heap of tags has been reached. Figure 3 shows a preferred structure for each of the tags in the tag table 22. Each tag contains four fields, an address field 40, a control field 42, a next field 44, and a count field 46. These four fields correspond to the four registers 24, 26, 28, 30 in the DMA controller 18. The 32 bit address field 40 gives the DMA controller 18 access to a 4 Gigabyte address space. The 12 bit count field 46 provides for a maximum transfer block size of 4096 words, and the 12 bit tag field 44 provides access to 4096 tag objects within the tag table 22. The end of heap pointer, NIL, is preferably all binary ones (hexadecimal FFF) or all binary zeros. If the computer system uses virtual memory, the size of the count field 46 is preferably selected such that a complete page in the virtual memory system may be transferred as one block of data. Thus, for example, if the virtual memory uses pages having 1024 words per page, the count field 46 would only be 10 bits long. The remaining bits (in this case, 2 bits) could be used, if desired, to make the next field 44 14 bits long. Since each page is handled as a unit in virtual memory systems, and consecutive page frames in main memory are often unrelated, making the count field match the page size results in the most efficient use of tag table memory. Since each tag is eight bytes long and 4096 tags can be accessed, the tag table 22 should be up to 32 kilobytes long in order to hold the maximum number of tags. Figure 4 shows the control flow used by the DMA controller 18 to make a series of consecutive block transfers. First, in step 50, the DMA registers 24, 26, 28, 30 are loaded directly with the appropriate values for the first data transfer. At this time, either before or after loading the registers directly, all of the information necessary for the remaining tags for this transfer must be loaded into the tag table 22. This load is performed by the central processor 12. One data item is then transferred 52 according to the address stored in the address register 24. The value in the count register 30 is decremented 54. Step 54 includes simultaneously incrementing or decrementing the value of the address register 24, depending upon the desired direction as set in the control register 26. A test is then made 56 to see whether the transfer is complete. This is done by checking the carry out bit from the count register 30. If the transfer is not complete, control returns to step 52. If however the value in the count register 30 is 0, signifying that the transfer is complete, control passes to step 58, where the value in the next register 28 is tested. If the value in the next register is not equal to NIL, the next tag is loaded 60 into the registers in the DMA controller 18 from the tag table 22, and control returns to step 52. If in fact the value in the next register is NIL, then the last tag has been used, and control falls to step 62. In step 62, an indication is made to the central processor 12 that the series of transfers is complete. This will generally be done by raising an interrupt on the bus 14. It will be easily seen by those skilled in the art that the DMA controller described above implements a scatter-gather capability for use in a virtual memory. When a large block of data is to be read into nonconsecutive memory pages, the central processor 12 allocates those pages and sets up the tag table 22 through the DMA controller 18. DMA transfer is then initiated, and the DMA controller 18 handles the entire transfer until it is complete. A similar technique is used for gathering scattered pages in order to write them to memory. The central processor 12 determines which pages are to be written out, and their order, and sets up the tag table 22 through the DMA controller 18. The DMA transfer is then initiated, and is handled completely by the DMA controller 18 until it is complete. Since the tag table is organized as a heap, it is possible to keep several linked lists stored therein. This would allow a separate linked list to be kept, for example, for each I/O channel supported by the DMA controller 18. Since the tag table 22 is organized as a heap, the only limit on the number of separate transfers which may be linked into one larger transfer for a single I/O channel is the number of remaining free memory locations within the tag table 22.

Claims: A system for controlling data transfers between a memory (16) and another device (20), the system comprising: a Direct Memory Access (DMA) controller (18) for transferring data between the memory and the other device according to transfer control parameters in said controller; and a tag memory (22), coupled to said DMA controller, wherein said tag memory contains two or more tag objects (32,34,36) containing transfer control parameters, characterised in that: the tag memory is separate from the system memory and reserved for the use of the DMA controller, and can be accessed by said DMA controller without reference to said central processor; and wherein, upon completion of a data transfer defined by the transfer control parameters in said DMA controller, a new set of transfer control parameters in a next tag object in said tag memory is transferred to said DMA controller and a new data transfer begun according to said new set of transfer control parameters. A system as claimed in Claim 1, wherein said Direct Memory Access (DMA) controller contains address (24), control (26), and count (30) registers, and the transfer control parameters include address, control and count values placed respectively into such registers. A system as claimed in Claim 1 or Claim 2, wherein said digital computer includes a paged virtual memory system, and wherein a complete page frame of said virtual memory system can be transferred during one of said data transfers defined by the transfer control parameters in said Direct Memory Access (DMA) controller. A system as claimed in any preceding claim, wherein said tag memory is organized as a heap, wherein each tag object (32,34,36) contains a pointer to a next tag object, wherein a plurality of tag objects which define related data transfers are linked into a list. A method for transferring data in a computer system, having a central processor (12) and a Direct Memory Access (DMA) controller (18), comprising the steps of: (a) storing two or more tag objects (32,34,36) each containing control information for a block data transfer, into a tag memory (22) separate from the system memory and reserved for the use of the DMA controller, associated with the DMA controller, wherein said tag memory can be accessed by said DMA controller without reference to said central processor; (b) performing a block data transfer according to control information stored in the DMA controller; (c) transferring control information from one of said tag objects into control registers of the DMA controller; and (d) performing a block data transfer according to the control information in the control registers of the DMA controller. (e) repeating steps (c) and (d) until the block data transfers corresponding to each of said two or more tag objects have been performed. A method as claimed in Claim 5, wherein said tag objects (32,34,36) are stored in the memory as a heap, wherein each tag object has a pointer to a next tag object, and wherein a plurality of tag objects which define related data transfers are linked into a list.

Inventors: FOGG RICHARD G JR, MATHIS JOSEPH RICHARD, NICHOLSON JAMES OTTO, FOGG, RICHARD G., JR., MATHIS, JOSEPH RICHARD, NICHOLSON, JAMES OTTO
Applicants: IBM, INTERNATIONAL BUSINESS MACHINES CORPORATION
Application year: 1990
Main classification: G06F13
IPC codes: G06F13