DMASequencer.hh revision 11339
112953Sgabeblack@google.com/* 212953Sgabeblack@google.com * Copyright (c) 2008 Mark D. Hill and David A. Wood 312953Sgabeblack@google.com * All rights reserved. 412953Sgabeblack@google.com * 512953Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 612953Sgabeblack@google.com * modification, are permitted provided that the following conditions are 712953Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 812953Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 912953Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 1012953Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1112953Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1212953Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1312953Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1412953Sgabeblack@google.com * this software without specific prior written permission. 1512953Sgabeblack@google.com * 1612953Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1712953Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1812953Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1912953Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2012953Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2112953Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2212953Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2312953Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2412953Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2512953Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2612953Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2712953Sgabeblack@google.com */ 2812953Sgabeblack@google.com 2912953Sgabeblack@google.com#ifndef __MEM_RUBY_SYSTEM_DMASEQUENCER_HH__ 3012953Sgabeblack@google.com#define __MEM_RUBY_SYSTEM_DMASEQUENCER_HH__ 3112953Sgabeblack@google.com 3212953Sgabeblack@google.com#include <memory> 3313063Sgabeblack@google.com#include <ostream> 3413063Sgabeblack@google.com 3513063Sgabeblack@google.com#include "mem/protocol/DMASequencerRequestType.hh" 3612957Sgabeblack@google.com#include "mem/ruby/common/DataBlock.hh" 3712957Sgabeblack@google.com#include "mem/ruby/system/RubyPort.hh" 3812961Sgabeblack@google.com#include "params/DMASequencer.hh" 3913063Sgabeblack@google.com 4012954Sgabeblack@google.comstruct DMARequest 4112954Sgabeblack@google.com{ 4212953Sgabeblack@google.com uint64_t start_paddr; 4312953Sgabeblack@google.com int len; 4413063Sgabeblack@google.com bool write; 4512953Sgabeblack@google.com int bytes_completed; 4612961Sgabeblack@google.com int bytes_issued; 4712961Sgabeblack@google.com uint8_t *data; 4812953Sgabeblack@google.com PacketPtr pkt; 4912953Sgabeblack@google.com}; 5012953Sgabeblack@google.com 5112953Sgabeblack@google.comclass DMASequencer : public RubyPort 5212954Sgabeblack@google.com{ 5312954Sgabeblack@google.com public: 5412954Sgabeblack@google.com typedef DMASequencerParams Params; 5512954Sgabeblack@google.com DMASequencer(const Params *); 5612954Sgabeblack@google.com void init() override; 5712954Sgabeblack@google.com 5812954Sgabeblack@google.com /* external interface */ 5912954Sgabeblack@google.com RequestStatus makeRequest(PacketPtr pkt); 6012954Sgabeblack@google.com bool busy() { return m_is_busy;} 6112954Sgabeblack@google.com int outstandingCount() const { return (m_is_busy ? 1 : 0); } 6212954Sgabeblack@google.com bool isDeadlockEventScheduled() const { return false; } 6312954Sgabeblack@google.com void descheduleDeadlockEvent() {} 6412954Sgabeblack@google.com 6512954Sgabeblack@google.com /* SLICC callback */ 6612954Sgabeblack@google.com void dataCallback(const DataBlock & dblk); 6712954Sgabeblack@google.com void ackCallback(); 6812954Sgabeblack@google.com 6912954Sgabeblack@google.com void recordRequestType(DMASequencerRequestType requestType); 7012954Sgabeblack@google.com 7112957Sgabeblack@google.com private: 7212954Sgabeblack@google.com void issueNext(); 7312954Sgabeblack@google.com 7412954Sgabeblack@google.com bool m_is_busy; 7512954Sgabeblack@google.com uint64_t m_data_block_mask; 7612954Sgabeblack@google.com DMARequest active_request; 7712954Sgabeblack@google.com}; 7812954Sgabeblack@google.com 7912954Sgabeblack@google.com#endif // __MEM_RUBY_SYSTEM_DMASEQUENCER_HH__ 8012954Sgabeblack@google.com