File: tbx_stream.cpp

package info (click to toggle)
intel-compute-runtime 22.43.24595.41-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 57,740 kB
  • sloc: cpp: 631,142; lisp: 3,515; sh: 470; makefile: 76; python: 21
file content (75 lines) | stat: -rw-r--r-- 2,165 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
 * Copyright (C) 2018-2021 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#include "shared/source/aub/aub_helper.h"
#include "shared/source/command_stream/tbx_command_stream_receiver.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/helpers/debug_helpers.h"
#include "shared/source/tbx/tbx_sockets.h"

namespace NEO {

TbxStream::TbxStream() {
}

TbxStream::~TbxStream() {
    delete socket;
}

void TbxStream::open(const char *options) {
}

void TbxStream::close() {
    DEBUG_BREAK_IF(!socket);
    socket->close();
}

bool TbxStream::init(uint32_t stepping, uint32_t device) {
    socket = TbxSockets::create();
    DEBUG_BREAK_IF(!socket);
    auto tbxServer = DebugManager.flags.TbxServer.get();
    auto tbxPort = DebugManager.flags.TbxPort.get();
    return socket->init(tbxServer, tbxPort);
}

void TbxStream::writeMemory(uint64_t addr, const void *memory, size_t size, uint32_t addressSpace, uint32_t hint) {
    uint32_t type = AubHelper::getMemType(addressSpace);
    socket->writeMemory(addr, memory, size, type);
}

void TbxStream::writeGTT(uint32_t gttOffset, uint64_t entry) {
    socket->writeGTT(gttOffset, entry);
}

void TbxStream::writePTE(uint64_t physAddress, uint64_t entry, uint32_t addressSpace) {
    uint32_t type = AubHelper::getMemType(addressSpace);
    socket->writeMemory(physAddress, &entry, sizeof(entry), type);
}

void TbxStream::writeMemoryWriteHeader(uint64_t physAddress, size_t size, uint32_t addressSpace, uint32_t hint) {
}

void TbxStream::writeMMIOImpl(uint32_t offset, uint32_t value) {
    socket->writeMMIO(offset, value);
}

void TbxStream::registerPoll(uint32_t registerOffset, uint32_t mask, uint32_t desiredValue, bool pollNotEqual, uint32_t timeoutAction) {
    bool matches = false;
    bool asyncMMIO = false;
    do {
        uint32_t value;
        socket->readMMIO(registerOffset, &value);

        matches = ((value & mask) == desiredValue);
    } while (matches == pollNotEqual && asyncMMIO);
}

void TbxStream::readMemory(uint64_t physAddress, void *memory, size_t size) {
    socket->readMemory(physAddress, memory, size);
}

} // namespace NEO