This commit is contained in:
George Hotz
2022-08-09 00:06:24 +02:00
parent 01de17eeb8
commit f4ff130947
3 changed files with 68 additions and 0 deletions

View File

@@ -54,6 +54,50 @@ namespace H11ANE {
uint64_t unused;
};
// H11ANEInDirectPathClient
// _ANE_DeviceOpen
// _ANE_DeviceClose
// _ANE_ProgramSendRequest
// H11ANEInUserClient
// _ANE_DeviceOpen
// _ANE_DeviceClose
// _ANE_ProgramSendRequest
// _ANE_ProgramCreate
// _ANE_ProgramPrepare
// _ANE_ProgramUnprepare
// _ANE_ProgramDestroy
// _ANE_GetStatus
// _ANE_PowerOn
// _ANE_PowerOff
// _ANE_IsPowered
// _ANE_LoadFirmware
// _ANE_ForgetFirmware
// _ANE_SendCommand
// _ANE_SetPowerManagement
// _ANE_GetTime
// _ANE_SetDriverLoggingFlags
// _ANE_ShowSharedMemoryAllocations
// _ANE_SetDARTCacheTTL
// _ANE_SetFirmwareBootArg
// _ANE_SetThrottlingPercentage
// _ANE_AddPersistentClient
// _ANE_RemovePersistentClient
// _ANE_CreateClientLoggingSession
// _ANE_TerminateClientLoggingSession
// _ANE_GetDriverLoggingFlags
// _ANE_FlushInactiveDARTMappings
// _ANE_GetVersion
// _ANE_RegisterFirmwareWorkProcessor
// _ANE_UnregisterFirmwareWorkProcessor
// _ANE_GetFirmwareWorkProcessorItem
// _ANE_CompleteFirmwareWorkProcessorItem
// _ANE_ReleaseFirmwareWorkProcessorBuffers
// _ANE_ReadANERegister
// _ANE_WriteANERegister
// _ANE_ProgramCreateInstance
// note, this is not the raw IOKit class, it's in ANEServices.framework
class H11ANEDevice {
public:
H11ANEDevice(H11ANE::H11ANEDeviceController *param_1, unsigned int param_2);

View File

@@ -54,6 +54,11 @@ int main() {
ret = dev->ANE_IsPowered();
printf("powered? %d\n", ret);
if (ret == 0) {
printf("POWER ON FAILED\n");
return -1;
}
char *prog = (char*)aligned_alloc(0x1000, 0x8000);
FILE *f = fopen("../2_compile/model.hwx", "rb");
int sz = fread(prog, 1, 0x8000, f);

View File

@@ -45,3 +45,22 @@ It can work with 8 base addresses for the DMA streams per OP
This is a Mach-O file. We haven't figured out all the details, but the ops are at 0x4000. See `hwx_parse.py`
## amfid
Sadly disabling amfi breaks things like vscode. You can runtime patch
```
# MacOS 12.4
smol :: ~/fun/tinygrad » sha1sum /usr/libexec/amfid
0f7e7f7e41408f83d7ebc7564a3828f41cb2ab58 /usr/libexec/amfid
# with patching +0x8e38
(lldb) image list
[ 0] 04B6DF6C-6068-3F18-81A7-978985574387 0x0000000102ad0000 /usr/libexec/amfid
(lldb) p *(unsigned int *)0x102ad8e38=0xd2800000
```
This disables the entitlement check, then you don't need a bootarg. I wish Apple made a better way to do this.