1 /*
2  * Copyright (C) 2019-2021 Intel Corporation
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  */
7 
8 #include "shared/source/command_stream/command_stream_receiver_simulated_common_hw_bdw_and_later.inl"
9 
10 namespace NEO {
11 typedef TGLLPFamily Family;
12 
13 template <>
initGlobalMMIO()14 void CommandStreamReceiverSimulatedCommonHw<Family>::initGlobalMMIO() {
15     for (auto &mmioPair : AUBFamilyMapper<Family>::globalMMIO) {
16         stream->writeMMIO(mmioPair.first, mmioPair.second);
17     }
18 
19     if (this->isLocalMemoryEnabled()) {
20         MMIOPair lmemCfg = {0x0000cf58, 0x80000000}; //LMEM_CFG
21         stream->writeMMIO(lmemCfg.first, lmemCfg.second);
22     }
23 }
24 
25 template <>
getPPGTTAdditionalBits(GraphicsAllocation * gfxAllocation)26 uint64_t CommandStreamReceiverSimulatedCommonHw<Family>::getPPGTTAdditionalBits(GraphicsAllocation *gfxAllocation) {
27     return BIT(PageTableEntry::presentBit) | BIT(PageTableEntry::writableBit) |
28            ((gfxAllocation && gfxAllocation->getMemoryPool() == MemoryPool::LocalMemory) ? BIT(PageTableEntry::localMemoryBit) : 0);
29 }
30 
31 template <>
getGTTData(void * memory,AubGTTData & data)32 void CommandStreamReceiverSimulatedCommonHw<Family>::getGTTData(void *memory, AubGTTData &data) {
33     data = {};
34     data.present = true;
35 
36     data.localMemory = this->isLocalMemoryEnabled();
37 }
38 
39 template <>
submitLRCA(const MiContextDescriptorReg & contextDescriptor)40 void CommandStreamReceiverSimulatedCommonHw<Family>::submitLRCA(const MiContextDescriptorReg &contextDescriptor) {
41     auto mmioBase = getCsTraits(osContext->getEngineType()).mmioBase;
42     stream->writeMMIO(AubMemDump::computeRegisterOffset(mmioBase, 0x2510), contextDescriptor.ulData[0]);
43     stream->writeMMIO(AubMemDump::computeRegisterOffset(mmioBase, 0x2514), contextDescriptor.ulData[1]);
44 
45     // Load our new exec list
46     stream->writeMMIO(AubMemDump::computeRegisterOffset(mmioBase, 0x2550), 1);
47 }
48 
49 template class CommandStreamReceiverSimulatedCommonHw<Family>;
50 } // namespace NEO
51