jobslot.cc (10915:71ace17ccb3d) jobslot.cc (11313:89fd4a775287)
1/*
1/*
2 * Copyright (c) 2014-2015 ARM Limited
2 * Copyright (c) 2014-2016 ARM Limited
3 * All rights reserved
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *

--- 12 unchanged lines hidden (view full) ---

23#include <cstdlib>
24
25#include "jobcontrol.hh"
26#include "gpu.hh"
27#include "regutils.hh"
28
29namespace NoMali {
30
3 * All rights reserved
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *

--- 12 unchanged lines hidden (view full) ---

23#include <cstdlib>
24
25#include "jobcontrol.hh"
26#include "gpu.hh"
27#include "regutils.hh"
28
29namespace NoMali {
30
31static const Status STATUS_IDLE(Status::CLASS_NOFAULT, 0, 0);
32static const Status STATUS_DONE(Status::CLASS_NOFAULT, 0, 1);
33static const Status STATUS_ACTIVE(Status::CLASS_NOFAULT, 1, 0);
34
31const std::vector<JobSlot::cmd_t> JobSlot::cmds {
32 &JobSlot::cmdNop, // JSn_COMMAND_NOP
33 &JobSlot::cmdStart, // JSn_COMMAND_START
34 &JobSlot::cmdSoftStop, // JSn_COMMAND_SOFT_STOP
35 &JobSlot::cmdHardStop, // JSn_COMMAND_HARD_STOP
36 &JobSlot::cmdSoftStop0, // JSn_COMMAND_SOFT_STOP_0
37 &JobSlot::cmdHardStop0, // JSn_COMMAND_HARD_STOP_0
38 &JobSlot::cmdSoftStop1, // JSn_COMMAND_SOFT_STOP_1

--- 60 unchanged lines hidden (view full) ---

99void
100JobSlot::tryStart()
101{
102 // Only actually start something if the next command is start
103 if (regs[RegAddr(JSn_COMMAND_NEXT)] != JSn_COMMAND_START )
104 return;
105
106 // Reset the status register
35const std::vector<JobSlot::cmd_t> JobSlot::cmds {
36 &JobSlot::cmdNop, // JSn_COMMAND_NOP
37 &JobSlot::cmdStart, // JSn_COMMAND_START
38 &JobSlot::cmdSoftStop, // JSn_COMMAND_SOFT_STOP
39 &JobSlot::cmdHardStop, // JSn_COMMAND_HARD_STOP
40 &JobSlot::cmdSoftStop0, // JSn_COMMAND_SOFT_STOP_0
41 &JobSlot::cmdHardStop0, // JSn_COMMAND_HARD_STOP_0
42 &JobSlot::cmdSoftStop1, // JSn_COMMAND_SOFT_STOP_1

--- 60 unchanged lines hidden (view full) ---

103void
104JobSlot::tryStart()
105{
106 // Only actually start something if the next command is start
107 if (regs[RegAddr(JSn_COMMAND_NEXT)] != JSn_COMMAND_START )
108 return;
109
110 // Reset the status register
107 regs[RegAddr(JSn_STATUS)] = 0;
111 regs[RegAddr(JSn_STATUS)] = STATUS_ACTIVE.value;
108
109 // Transfer the next job configuration to the active job
110 // configuration
111 regs.set64(RegAddr(JSn_HEAD_LO), regs.get64(RegAddr(JSn_HEAD_NEXT_LO)));
112 regs.set64(RegAddr(JSn_TAIL_LO), regs.get64(RegAddr(JSn_HEAD_NEXT_LO)));
113 regs.set64(RegAddr(JSn_AFFINITY_LO),
114 regs.get64(RegAddr(JSn_AFFINITY_NEXT_LO)));
115 regs[RegAddr(JSn_CONFIG)] = regs[RegAddr(JSn_CONFIG_NEXT)];
112
113 // Transfer the next job configuration to the active job
114 // configuration
115 regs.set64(RegAddr(JSn_HEAD_LO), regs.get64(RegAddr(JSn_HEAD_NEXT_LO)));
116 regs.set64(RegAddr(JSn_TAIL_LO), regs.get64(RegAddr(JSn_HEAD_NEXT_LO)));
117 regs.set64(RegAddr(JSn_AFFINITY_LO),
118 regs.get64(RegAddr(JSn_AFFINITY_NEXT_LO)));
119 regs[RegAddr(JSn_CONFIG)] = regs[RegAddr(JSn_CONFIG_NEXT)];
116 regs[RegAddr(JSn_COMMAND)] = regs[RegAddr(JSn_COMMAND_NEXT)];
117
118 // Reset the next job configuration
119 regs.set64(RegAddr(JSn_HEAD_NEXT_LO), 0);
120
121 // Reset the next job configuration
122 regs.set64(RegAddr(JSn_HEAD_NEXT_LO), 0);
120 regs.set64(RegAddr(JSn_AFFINITY_NEXT_LO), 0);
121 regs[RegAddr(JSn_CONFIG_NEXT)] = 0;
122 regs[RegAddr(JSn_COMMAND_NEXT)] = 0;
123
124 runJob();
125}
126
127void
128JobSlot::runJob()
129{
123 regs[RegAddr(JSn_COMMAND_NEXT)] = 0;
124
125 runJob();
126}
127
128void
129JobSlot::runJob()
130{
130 exitJob(Status(Status::CLASS_NOFAULT, 0, 1), // JSn_STATUS_DONE
131 exitJob(STATUS_DONE,
131 0); // Time stamp counter value
132}
133
134void
135JobSlot::exitJob(Status status, uint64_t fault_address)
136{
137 assert(status.statusClass() == Status::CLASS_NOFAULT ||
138 status.statusClass() == Status::CLASS_JOB);

--- 78 unchanged lines hidden ---
132 0); // Time stamp counter value
133}
134
135void
136JobSlot::exitJob(Status status, uint64_t fault_address)
137{
138 assert(status.statusClass() == Status::CLASS_NOFAULT ||
139 status.statusClass() == Status::CLASS_JOB);

--- 78 unchanged lines hidden ---