DMASequencer.hh revision 9104
17008Snate@binkert.org/* 27008Snate@binkert.org * Copyright (c) 2008 Mark D. Hill and David A. Wood 37008Snate@binkert.org * All rights reserved. 47008Snate@binkert.org * 57008Snate@binkert.org * Redistribution and use in source and binary forms, with or without 67008Snate@binkert.org * modification, are permitted provided that the following conditions are 77008Snate@binkert.org * met: redistributions of source code must retain the above copyright 87008Snate@binkert.org * notice, this list of conditions and the following disclaimer; 97008Snate@binkert.org * redistributions in binary form must reproduce the above copyright 107008Snate@binkert.org * notice, this list of conditions and the following disclaimer in the 117008Snate@binkert.org * documentation and/or other materials provided with the distribution; 127008Snate@binkert.org * neither the name of the copyright holders nor the names of its 137008Snate@binkert.org * contributors may be used to endorse or promote products derived from 147008Snate@binkert.org * this software without specific prior written permission. 157008Snate@binkert.org * 167008Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 177008Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 187008Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 197008Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 207008Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 217008Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 227008Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 237008Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 247008Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 257008Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 267008Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 277008Snate@binkert.org */ 286285Snate@binkert.org 297039Snate@binkert.org#ifndef __MEM_RUBY_SYSTEM_DMASEQUENCER_HH__ 307039Snate@binkert.org#define __MEM_RUBY_SYSTEM_DMASEQUENCER_HH__ 316285Snate@binkert.org 326285Snate@binkert.org#include <ostream> 337039Snate@binkert.org 349104Shestness@cs.utexas.edu#include "mem/protocol/DMASequencerRequestType.hh" 356285Snate@binkert.org#include "mem/ruby/common/DataBlock.hh" 366285Snate@binkert.org#include "mem/ruby/system/RubyPort.hh" 376876Ssteve.reinhardt@amd.com#include "params/DMASequencer.hh" 386876Ssteve.reinhardt@amd.com 397039Snate@binkert.orgstruct DMARequest 407039Snate@binkert.org{ 417039Snate@binkert.org uint64_t start_paddr; 427039Snate@binkert.org int len; 437039Snate@binkert.org bool write; 447039Snate@binkert.org int bytes_completed; 457039Snate@binkert.org int bytes_issued; 467039Snate@binkert.org uint8* data; 477039Snate@binkert.org PacketPtr pkt; 486285Snate@binkert.org}; 496285Snate@binkert.org 507039Snate@binkert.orgclass DMASequencer : public RubyPort 517039Snate@binkert.org{ 527039Snate@binkert.org public: 536876Ssteve.reinhardt@amd.com typedef DMASequencerParams Params; 547039Snate@binkert.org DMASequencer(const Params *); 557039Snate@binkert.org void init(); 567039Snate@binkert.org /* external interface */ 578615Snilay@cs.wisc.edu RequestStatus makeRequest(PacketPtr pkt); 587039Snate@binkert.org bool busy() { return m_is_busy;} 598688Snilay@cs.wisc.edu int outstandingCount() const { return (m_is_busy ? 1 : 0); } 608688Snilay@cs.wisc.edu bool isDeadlockEventScheduled() const { return false; } 618688Snilay@cs.wisc.edu void descheduleDeadlockEvent() {} 626285Snate@binkert.org 637039Snate@binkert.org /* SLICC callback */ 647039Snate@binkert.org void dataCallback(const DataBlock & dblk); 657039Snate@binkert.org void ackCallback(); 666285Snate@binkert.org 677039Snate@binkert.org void printConfig(std::ostream & out); 686285Snate@binkert.org 699104Shestness@cs.utexas.edu void recordRequestType(DMASequencerRequestType requestType); 709104Shestness@cs.utexas.edu 717039Snate@binkert.org private: 727039Snate@binkert.org void issueNext(); 736285Snate@binkert.org 747039Snate@binkert.org private: 757039Snate@binkert.org bool m_is_busy; 767039Snate@binkert.org uint64_t m_data_block_mask; 777039Snate@binkert.org DMARequest active_request; 787039Snate@binkert.org int num_active_requests; 796285Snate@binkert.org}; 806285Snate@binkert.org 817039Snate@binkert.org#endif // __MEM_RUBY_SYSTEM_DMASEQUENCER_HH__ 82