Abstract:
An electronic circuit coordinates accesses to a register shared among multiple system resources by managing the priority of each system resource relative to others. When a priority register access is initiated, a signal is generated to block a simultaneous or overlapping register access by another system resource. If another register access is already in operation, it will be completed before the priority register access operates on the shared register. Otherwise, if the priority register access operates on the register first, the non-priority register access is held off until the priority register access completes. A method coordinates the potentially simultaneous or overlapping register accesses by multiple system resources to a shared register. When a priority register access initiates, a lookahead signal issues to set a busy flag that blocks competing register accesses until the priority register access completes.

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention pertains generally to computer systems and more particularly to systems and methods of controlling register access in an electronic circuit. 
     2. Background of the Invention 
     A computer system typically includes a host data bus that conveys data among resources within the system. For example, it is popular for modern personal computer systems to have a host bus that complies with the Peripheral Component Interconnect (PCI) specification. The PCI host bus may support a variety of peripherals, including graphics cards, SCSI adapters and sound adapters. 
     In some applications, a host PCI bus may also support a host controller interface (HCI) to a second bus, such as a bus complying with the IEEE 1394-1995 Standard for a High-performance Serial Bus, Aug. 30, 1996 (the &#34;1394 Standard&#34;), incorporated herein by reference. In the case of an HCI supporting an IEEE 1394 bus, it is preferable that the controller comply with the 1394 Open Host Controller Interface Specification, Release 1.0, Oct. 20, 1997, herein incorporated by reference, which defines requirements of a standard 1394 Open HCI. For example, a 1394 bus may connect peripherals to a host computer system. 
     The 1394 Standard defines the standard characteristics of a 1394 bus and devices attached thereto. For example, a 1394-compliant device on a 1394-compliant bus must communicate with an HCI following a specific protocol, defined in the 1394 Standard. One aspect of this communication protocol is a set of lock transactions, including, for example: mask --  swap, compare --  swap, fetch --  add, little --  add, bounded --  add, and wrap --  add. Generally, a lock transaction is a transaction accessing a resource that requires more than one clock cycle to complete and prevents access to the same resource by another transaction until it completes. 
     According to the 1394 Standard, the compare --  swap function (the &#34;compare-and-swap&#34; function) is required to access a sequence of bus management registers: the BUS --  MANAGEMENT --  ID register, the BANDWIDTH --  AVAILABLE register, the CHANNELS --  AVAILABLE --  HI register, and the CHANNELS --  AVAILABLE --  LO register. The 1394 standard specifies that lock transactions may be implemented in hardware or software. A hardware implementation of a compare-and-swap function requires more than one clock cycle to execute completely. 
     FIG. 1 depicts a prior implementation of a 1394 host controller 100 that does not comply with the 1394 Open HCI specification, which requires a hardware implementation of the lock transaction circuitry. Bus management registers 116 are implemented in the host memory of host system 101. The 1394 link and physical layer 102 is connected to 1394 bus 104, and host bus interface 106 is connected to host bus 108. The 1394 link and physical layer 102 communicates with host bus interface 106 via the physical response unit 110, physical read request unit 112, and physical write request unit 114 to access registers in a physical address range. Write lock requests, such as compare-and-swap operations, to bus management registers 116 from nodes located on the 1394 bus 104 are received by the 1394 link and physical layer 102 in the form of packet data and sent to host-resident software for execution. The host software coordinates overlapping compare-and-swap operations from competing buses by scheduling such requests sequentially on a first come, first served basis. In other words, the software acts as a gateway to guarantee the sequential, non-overlapping execution of overlapping compare-and-swap requests. 
     The 1394 Open HCI specification defines characteristics of a standard 1394 host controller. Among other requirements, the 1394 Open HCI requires a hardware implementation for performing lock transactions from one or more buses, including specified data, argument and control registers associated with each supported bus. In a configuration with more than one bus, nodes from multiple buses may attempt to access a shared target register simultaneously. In other words, each bus can independently initiate a lock transaction using its respective data, compare, and control register set. Because a compare-and-swap function requires more than one clock cycle to complete, there is substantial opportunity for one bus to start a compare-and-swap operation while the other bus is performing this same operation on the same register (i.e., overlapping execution of compare-and-swap operations). If allowed, such an occurrence may cause the data in the target register to become corrupted. This possibility of corrupted data exists for any host controller interface that supports potentially simultaneous lock transactions from two or more buses to the same target register. In 1394 Open HCI systems with multiple 1394 buses, each 1394 bus is associated with its own hardware implementation of bus management registers and lock transaction circuitry. 
     The 1394 Open HCI specification does not, however, define the actual hardware implementation of the circuitry for such lock transactions. That is, the 1394 Open HCI specifies that a compliant HCI satisfy certain functional requirements, but the electrical circuit that implements those functional requirements is undefined. Therefore, need exists for a circuit and method to coordinate competing lock transactions directed to the same target register so as to prevent a collision that could cause data corruption. 
     SUMMARY OF THE INVENTION 
     It is therefore an object of the present invention to provide a device for coordinating potentially simultaneous or overlapping accesses to a data storage location shared by multiple system resources or buses. 
     It is another object of the present invention to provide a device to prevent data corruption in a register or memory location caused by simultaneous or overlapping accesses by more than one system resource. 
     It is yet another object of the present invention to provide a device to grant priority to an access to a data storage location by a first bus so as to prevent data corruption caused by an access from a second bus sharing the same data storage location. 
     It is yet another object of the present invention to provide a technique for coordinating potentially simultaneous or overlapping accesses to a data storage location shared by multiple system resources. 
     It is yet another object of the present invention to provide a technique for preventing data corruption by simultaneous or overlapping accesses to a data storage location by more than one system resource. 
     Additional objects, advantages, and novel features of the invention will be set forth in part in the description which follows and in part will become apparent to those skilled in the art upon examination of the following or may be learned by practice of the invention. The objects and advantages of the invention may be realized and attained by means of the instrumentalities and combination particularly pointed out in the appended claims. 
     To achieve the foregoing and other objects, and in accordance with the purposes of the present invention, as embodied and broadly described herein, the circuit of this invention may comprise a target data storage location coupled between a priority bus and a secondary bus; a priority access interface coupled to a target data storage location and the priority bus that controls a priority access to the target data storage location from the priority bus; a secondary access interface coupled to the target data storage location and the secondary bus that controls a secondary access to the target data storage location from the secondary bus; and a priority control module coupled to the priority access interface that causes the secondary access from the secondary bus to be blocked during and in response to a request for the priority access from the priority bus. 
     The present invention may also comprise, in accordance with its object and purposes, a method having the steps of receiving a request for a priority access to a target data storage location from a priority bus; providing a lookahead signal in response to the request for the priority access; setting a busy signal in response to the lookahead signal; performing a first phase of the priority access; performing a second phase of the priority access; and resetting the busy signal during the second phase of the priority access. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 depicts a block diagram of a prior art host controller lacking 1394 Open HCI specification compliance. 
     FIG. 2 depicts a block diagram of a preferred embodiment in accordance with the present invention. 
     FIG. 3 depicts a state machine diagram of a preferred embodiment in accordance with the present invention. 
     FIG. 4 depicts a timing diagram of signals and operations of a preferred embodiment in accordance with the present invention. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     The 1394 Open Host Controller Interface (&#34;Open HCI&#34;) is an implementation of the link layer protocol of a 1394 serial bus, with additional features to support the transaction and bus management layers. Among many other features and requirements, a 1394 Open HCI implements a number of autonomous Control and Status Register (CSR) resources, including the 1394 compare-and-swap bus management registers. The CSR resources comply with the &#34;ISO/IEC 13213: 1994 [ANSI/IEEE Std 1212, 1994 Edition], Information technology--Microprocessor systems--Control and Status Registers (CSR) Architecture for microcomputer buses,&#34; herein incorporated by reference. The bus management registers are implemented in hardware internal to the 1394 Open HCI and consist of the following registers: BUS --  MANAGEMENT --  ID register, the BANDWIDTH --  AVAILABLE register, the CHANNELS --  AVAILABLE --  HI register, and the CHANNELS --  AVAILABLE --  LO register. Although the detailed description of a preferred embodiment focuses on write accesses to data registers, the invention generally contemplates coordinating any lock transaction to a shared storage location, including a data register or a memory location. Specified lock transactions include, for example: mask --  swap, compare --  swap, fetch --  add, little --  add, bounded --  add, and wrap --  add. 
     FIG. 2 depicts a preferred embodiment of a 1394 Open HCI device 200, in accordance with the present invention. In this implementation, 1394 bus 204 has priority over the host bus, but the priority assignment may vary and may be allocated among more than two buses. For the purposes of FIG. 2, the host bus 206 is a secondary bus in that it has a lower priority than 1394 bus 204. Bus management registers 202 are physically located in the 1394 Open HCI device 200, not in the host system as shown in the prior art of FIG. 1. Bus management registers 202 and other internal 1394 Open HCI registers (shown generally at 220), including the host CSR registers 208, 210, and 212, are mapped to a portion of the host system&#39;s address space (not shown). CSR registers for the 1394 registers (232, 234, and 236) are not mapped into the host system&#39;s address space but are coupled to the physical write request module 226. Physical read request module 218 is coupled to bus management registers 202 and is not required to access bus management registers 202 through the CSR registers. The host system generally writes to bus management registers 202 using host address lines to access the host CSR registers 208, 210, and 212, but the 1394 bus writes to bus management registers 202 using 1394 CSR registers 232, 234, and 236, which are not accessible by the host system using host address lines. Both host CSR registers and 1394 CSR registers support the compare-and-swap function for the corresponding bus. The 1394 bus accesses the 1394 CSR registers through physical write request module 226 using physical addresses. If the 1394 bus writes to the physical address of a bus management register in a compare-and-swap transaction, the physical write request module 226 will execute a compare-and-swap operation to the target register, where the target register is the bus management register to which the compare-and-swap operation is directed. 
     The compare-and-swap function requires a data parameter (data --  value), an argument parameter (arg --  value), and a target register selection code (reg --  select) as inputs and returns a resulting value (old --  value) as output, which was the previous value in the target register. These values are communicated between a bus and the bus management registers 202 via a trio of CSR registers: a CSR data register, a CSR compare register, and a CSR control register. Each bus having access to bus management registers 202 has at least a trio of such CSR registers. For the purposes of this disclosure, hdata register 208, hcompare register 210, and hcontrol register 212 in FIG. 2 are the CSR registers providing host access to bus management registers 202. Likewise, pdata register 232, pcompare register 234, and pcontrol register 236 provide 1394 bus access to bus management registers 202. 
     The compare-and-swap function is prepared by loading a data --  value and an arg --  value into corresponding CSR data registers (e.g., hdata and pdata) and compare registers (e.g., hcompare and pcompare) and is executed when the reg --  select value is written to the CSR control register (e.g., hcontrol and pcontrol). The reg --  select value specifies the bus management registers 202 on which the compare-and-swap function is to operate. Thereafter, the HCI compares the old --  value, which is currently stored in the target register, to the arg --  value. If the old --  value equals the arg --  value, the data --  value is written to the target register and the old --  value is returned to the appropriate CSR data register (hdata and pdata). If the old --  value does not equal arg --  value, the old --  value remains in the target register and is also returned in the CSR data register. A compare-and-swap operation requires two clock cycles to complete after a control register (e.g., hcontrol and pcontrol) is written. A &#34;compare&#34; phase occurs during the first clock cycle, and a &#34;swap&#34; phase occurs during the second clock cycle. The compare-and-swap function returns a status (csrDone) to the CSR control register to indicate completion of the operation. The operation was successful (i.e., data --  value was written to the target register) if the result in the appropriate CSR data register (e.g., hdata or pdata) equals arg --  value. 
     A compare-and-swap operation provides atomic access to one of bus management registers 202 from either the host bus 206 or from 1394 bus 204. To access one of the bus management registers 202 from the host bus 206, the host system must first load an hdata register 208 with the new data value to be loaded into the appropriate bus management register (the &#34;target&#34; register). The host must also load hcompare register 210 with the value expected to be currently in the target register. Generally, the procedure for writing to CSR registers allows the data register (e.g., hdata register 208) and the compare register (e.g., hcompare register 210) to be written in any order so long as the writes to these registers occur prior to the write to the control register (e.g., hcontrol register 212). This is true for both host and 1394 CSR registers. Thereafter, the host must write the hcontrol register 212 with the reg --  select value of the target register. A write to hcontrol register 212 initiates a compare-and-swap operation on the target register. When the compare-and-swap operation is complete, a csrDone bit (not shown) in hcontrol register 212 is set, and the hdata register 208 contains the previous value of the target register. If this previous value equals the value loaded in hcompare, the operation was successful. 
     To access one of the bus management registers 202 from 1394 bus 204, a node (not shown) attached to 1394 bus 204 sends a packet to 1394 link and physical layer 214. A packet indicates the destination node, the source node, the type of requests, the destination address, and other information, as specified in the 1394 standard. A read request packet also includes a transaction label, a &#34;tcode&#34; identifying the type of packet, a retry code, a priority field, and a CRC header. A write lock request packet includes the information described in a read request packet and, in addition, includes a data --  value, an arg --  value, the length of the data to be written, and a CRC value for the write data. For both operations, the reg --  select address to be written to the control register is represented by an offset in the destination address field. 
     If the packet specifies a read request to a bus management register 202, the request is directed into physical read request FIFO 216. Read requests are processed sequentially in a first-in, first-out manner by physical read request receive module 218. Read requests access the bus management register 202 without using the CSR registers. The result of the read request is selected from the appropriate bus management register 202, and directed into physical response FIFO 222 by physical response unit 221. From physical response FIFO 222, the result is packetized in 1394 link and physical layer 214 for transmission via 1394 bus 204 to the requesting 1394 node (not shown). 
     If the packet specifies a write lock request, the request packet is directed into physical write request FIFO 224. Write lock request packets are processed sequentially in a first-in, first-out manner by physical write request receive module 226. If the address is a write lock request operation to one of the bus management registers 202, then the request is processed through the priority control module 228. Otherwise, the request is processed through host bus interface 230. It should be noted that in a preferred embodiment in accordance with the present invention, the physical read request FIFO 216 and the physical write request FIFO 224 are combined into a single physical FIFO device. 
     When physical write request receive module 226 receives a write lock request from the 1394 bus 204, it issues phylookahead signal on line 240 in preparation of blocking accesses by the host bus to bus management registers 202. The phylookahead signal on line 240 is pulsed high for one clock, cycle two cycles before the physical write request receive module 226 writes the reg --  select value to pcontrol register 236. The two cycles are the eval --  update --  time for the compare-and-swap operation. The eval --  update --  time value represents the time required to complete the lock transaction. For a compare-and-swap transaction, this value is two clock cycles. In a different lock transaction, this value could be greater. Registers pdata 232 and pcompare 234 may be written at any time before physical write request receive module 226 writes to pcontrol 236. 
     The phylookahead signal on line 240 (corresponding to phylookahead pulse 404 in FIG. 4) sets a busy signal on line 247 to block lock transactions from the host bus. For example, if the host writes into its hcontrol register 212 at the same time physical write request receive module 226 writes to pcontrol register 236, the busy signal on line 247 is already set (having been set in response to phylookahead signal on line 240 two clock cycles previously) and the host&#39;s lock transaction is held off until the busy signal on line 247 resets. The busy signal on line 247 resets during the &#34;swap&#34; phase of the 1394 compare-and-swap operation so that a pending host compare-and-swap operation may commence in the clock cycle following the &#34;swap&#34; phase of the 1394 compare-and-swap operation. 
     While the host&#39;s lock transaction is waiting, a waitinghost signal on line 245 is set. Once the &#34;swap&#34; phase of the 1394 compare-and-swap operation is complete, the busy signal on line 247 resets and the &#34;compare&#34; phase of the pending host compare-and-swap operation may commence. During the host&#39;s &#34;compare&#34; phase, the waitinghost signal on line 245 resets. By comparison, if the host has already started its two-clock-cycle compare-and-swap request when the physical write request receive module 226 receives the write lock request from 1394 bus 204, the host operation will have necessarily completed before the physical write request receive module 226 writes to its pcontrol register 236, thereby avoiding a collision of potentially competing compare-and-swap requests. 
     If physical write request receive module 226 aborts the 1394 write lock operation, it issues a phyabort signal on line 242, which is a high pulse lasting one clock cycle. The phyabort signal on line 242 clears the busy signal on line 247 in the same clock cycle the phyabort signal is pulsed. 
     More than one register or set of registers may be supported using the apparatus and method in accordance with the present invention. In the embodiment described herein, four bus management registers are supported by the same set of data, compare, and control registers, but multiple data, compare, and control registers may be used to support multiple target registers in any combination. The reg --  select code, which is written to the appropriate control register (hcontrol or pcontrol) indicates the register on which the compare-and-swap operation is performed. Likewise, other sets of registers may be supported by a single set of data, compare, and control registers, or by multiple sets of data, compare, and control registers. 
     FIG. 3 depicts a state machine representing the operation of an embodiment of the present invention. The notation in FIG. 3 includes signal names, state names, and Boolean operators. The `|` character represents a Boolean &#34;OR&#34; operation, and the `&amp;` character represents a Boolean &#34;AND&#34; operation. The `!` character represents a Boolean &#34;NOT&#34; operation. The open and closed parentheses (`(`and `)`) denote a priority operation, such that operations within a pair of parentheses are performed prior to operations outside of the pair of parentheses. 
     IDLE state 300 represents a state wherein neither a host bus nor a 1394 bus is executing or waiting to execute a compare-and-swap operation. This state machine is controlled by four signals: PhyControl, HostControl, Busy, and WaitingHost. The PhyControl signal indicates a write to a 1394 control register (pcontrol 236 in FIG. 2). The HostControl signal indicates a write to a HostControl register (hcontrol 212 in FIG. 2). These control signals represent attempts by the host bus or 1394 bus to initiate a compare-and-swap operation. The busy signal is set in response to a PhyLookAhead pulse, and represents a pending or concurrent compare-and-swap operation by the 1394 bus. The busy signal remains set following a PhyLookAhead pulse until the state machine reaches the 1394 --  Swap state 302. The WaitingHost signal indicates that the host bus has attempted to initiate a compare-and-swap operation in the same cycle as the 1394 bus or during a period when the busy signal is set. 
     When the device is in IDLE state 300, no pending nor concurrent compare-and-swap operation exists. In response to a PhyControl signal from the 1394 bus, the state machine transitions to state 1394 --  Compare 302. On the next clock signal the state machine transitions to the 1394 --  Swap state 304. If, at the conclusion of the 1394 --  Swap state 304, the HostControl signal and the WaitingHost signal are not set, the state machine transitions back to IDLE state 300. Alternatively, if either the HostControl signal or the WaitingHost signal is set, the state machine transitions from 1394 --  Swap state 304 to Host --  Compare state 306, which represents the first phase of a Host compare-and-swap operation. The 1394 --  Swap state 304 represents the second phase of a 1394 compare-and-swap operation. 
     Returning again to IDLE state 300, if either the HostControl signal or the WaitingHost signal is set, and neither the busy signal nor the PhyControl signal are set, the state machine transitions from IDLE state 300 to Host --  Compare state 306. On the next clock cycle, the state machine transitions to Host --  Swap state 308. If, at the completion of Host --  Swap state 308, the PhyControl signal is not set, the state machine transitions back to IDLE state 300. Alternatively, if the PhyControl signal is set, the state machine transitions to 1394 --  Compare state 302, which represents the first phase of a 1394 compare-and-swap operation. Host --  Swap state 308 represents the second phase of a host compare-and-swap operation. 
     FIG. 4 depicts a timing diagram including various internal signals, operations, and system states of a preferred embodiment in accordance with the present invention. &#34;CLOCK&#34; represents an externally generated periodic clocking signal input to the device. Signals and operations in a preferred embodiment in accordance with the present invention are synchronized on the rising edge of the clock signal. &#34;PhyLookAhead,&#34; &#34;PhysAbort,&#34; &#34;BUSY,&#34; and &#34;WaitingHost&#34; have been defined previously. &#34;STATE&#34; represents states of the state machine represented in FIG. 3. 
     A write lock transaction by the 1394 bus is initiated by a lock request packet received by the physical write request module 226 in FIG. 2. Operation Write1394DataReg represents a physical request write operation to the pdata register 232 in FIG. 2. Operation Write1394CmprReg represents a physical request write operation to the pcompare register 234 in FIG. 2. Operation Write1394CntrlReg represents a physical request write operation to the pcontrol register 236 in FIG. 2. Operation Write1394CntrlReg also corresponds to the PhyControl signal in FIG. 3. Likewise, operation WritePCIDataReg represents a host write operation to the hdata register 208 in FIG. 2. Operation WritePCICmprReg represents a host write operation to the hcompare register 210 in FIG. 2. Operation WritePCICntrlReg represents a host write operation to the hcontrol register 212 in FIG. 2. Operation WritePCICntrlReg also corresponds to the HostControl signal in FIG. 3. 
     The first part of the timing diagram illustrates the condition when the host bus and the 1394 bus attempt to initiate compare-and-swap operations simultaneously, that is, on the same clock cycle. As shown, the Write1394DataReg operation and the WritePCIDataReg operation occur on the same clock cycle at 400 and 402, respectively. In response to receipt of a lock request packet, the PhyLookAhead Signal pulses high for one clock cycle at 404. In response to the PhyLookAhead Signal, the busy signal sets at 406 in the clock cycle following the leading edge of the PhyLookAhead pulse. Meanwhile, the Write1394CmprReg and WritePCICmprReg operations proceed at 408 and 410, respectively. 
     Thereafter, Write1394CntrlReg and WritePCICntrlReg operations commence on the same clock cycle at 412 and 414, respectively, while the busy signal remains set at 406. On the next clock cycle, the 1394 --  Compare State 416 occurs while the Host --  Compare state 418 is held off and WaitingHost signal 420 is set. During the 1394 --  Swap state at 424, the busy signal resets at 422. At the completion of 1394 --  Swap state 424, Host --  Compare state 418 commences. At the completion of Host --  Compare state 418, the WaitingHost signal resets at 426 and Host --  Swap state 428 occurs. At the completion of Host --  Swap state 428, the system returns to the IDLE state. 
     The timing diagram also illustrates the effect of a PhysAbort signal on a concurrent 1394 compare-and-swap operation. A Write1394DataReg operation commences at 430, and the PhyLookAhead signal is pulsed at 432. In this scenario, the busy signal sets at 436 in the clock cycle following the PhyLookAhead pulse. In FIG. 4, the 1394 interface circuitry aborts its compare-and-swap operation by issuing the PhysAbort signal at 434. The busy signal resets at 438 in response to the PhysAbort signal, and the 1394 compare-and-swap operation then terminates. 
     While the method disclosed herein has been described and shown with reference to particular steps performed in a particular order (for example, in the timing diagram and state machine diagram), it will be understood that these steps may be combined, sub-divided, or re-ordered to form an equivalent method without departing from the teachings of the present invention. Accordingly, unless specifically indicated herein, the order and grouping of the steps is not a limitation of the present invention. 
     Moreover, while there have been described herein the principles of the present invention in conjunction with a 1394 Open HCI, it is to be clearly understood that the foregoing description is made only by way of example and not as a limitation to the scope of the invention. Particularly, it is recognized that the teachings of the foregoing disclosure will suggest other modifications to those persons skilled in the relevant art. Such modifications may involve other features which are already known per se and which may be used instead of or in addition to features already described herein. Although claims have been formulated in this application to particular combinations of features, it should be understood that the scope of the disclosure herein also includes any novel feature or any novel combination of features disclosed either explicitly or implicitly or any generalization or modification thereof which would be apparent to persons skilled in the relevant art, whether or not such relates to the same invention as presently claimed in any claim and whether or not it mitigates any or all of the same technical problems as confronted by the present invention. The applicants hereby reserve the right to formulate new claims to such features and/or combinations of such features during the prosecution of the present application or of any further application derived therefrom.