mirror of
https://github.com/lemonade-sdk/mac-amdgpu.git
synced 2026-11-23 04:29:26 -10:00
Correct firmware acknowledgements, GPU address translation, MES queue setup, SDMA and CP submission, and driver session teardown. Add runtime identity checks, host diagnostics, checked GART mapping lifetime, and reusable aligned aperture reservations. Record build 172 hardware acceptance and build 173 allocator validation. Add 19 regression suites covering packet layouts, firmware sequencing, command-ring reuse, mapping failure retention, and lifecycle behavior.
34 lines
1.3 KiB
C++
34 lines
1.3 KiB
C++
#include <cassert>
|
|
#include <cstdint>
|
|
#include <cstdio>
|
|
constexpr int kIOReturnSuccess = 0, kIOReturnBadArgument = 1, kIOReturnUnsupported = 2;
|
|
constexpr uint64_t kMacAMDGPUMethodRuntimeBuild = 43;
|
|
#define MACAMDGPU_BUILD_VERSION 159
|
|
struct Arguments {
|
|
uint32_t scalarInputCount = 0;
|
|
uint64_t *scalarOutput = nullptr;
|
|
uint32_t scalarOutputCount = 0;
|
|
};
|
|
static int query(uint64_t selector, Arguments *arguments) {
|
|
// No PCI object or hardware helpers exist in this harness: the response
|
|
// must depend only on the binary's build and the RPC argument shape.
|
|
switch (selector) {
|
|
#include "runtime_selector_under_test.inc"
|
|
default: return kIOReturnUnsupported;
|
|
}
|
|
}
|
|
int main() {
|
|
uint64_t output[4] = {};
|
|
Arguments a{0, output, 4};
|
|
assert(query(43, &a) == 0);
|
|
assert(a.scalarOutputCount == 3);
|
|
assert(output[0] == 0x414D444750554142ull && output[1] == 1 && output[2] == 159);
|
|
a.scalarInputCount = 1;
|
|
assert(query(43, &a) == kIOReturnBadArgument);
|
|
a.scalarInputCount = 0; a.scalarOutputCount = 2;
|
|
assert(query(43, &a) == kIOReturnBadArgument);
|
|
a.scalarOutputCount = 3; a.scalarOutput = nullptr;
|
|
assert(query(43, &a) == kIOReturnBadArgument);
|
|
puts("Runtime selector: responding build, protocol identity, exact result count and argument validation pass");
|
|
}
|