| 167 | } |
| 168 | |
| 169 | long Controller::IdentifyController(){ |
| 170 | //if(!controllerIdentityPhys){ |
| 171 | controllerIdentityPhys = Memory::AllocatePhysicalMemoryBlock(); |
| 172 | controllerIdentity = reinterpret_cast<ControllerIdentity*>(Memory::KernelAllocate4KPages(1)); |
| 173 | Memory::KernelMapVirtualMemory4K(controllerIdentityPhys, (uintptr_t)controllerIdentity, 1); |
| 174 | //} |
| 175 | |
| 176 | NVMeCommand identifyCommand; |
| 177 | memset(&identifyCommand, 0, sizeof(NVMeCommand)); |
| 178 | |
| 179 | identifyCommand.opcode = AdminCmdIdentify; |
| 180 | identifyCommand.prp1 = controllerIdentityPhys; |
| 181 | |
| 182 | identifyCommand.identify.cns = NVMeIdentifyCommand::CNSController; |
| 183 | |
| 184 | NVMeCompletion completion; |
| 185 | adminQueue.SubmitWait(identifyCommand, completion); |
| 186 | |
| 187 | if(completion.status > 0){ |
| 188 | IF_DEBUG(debugLevelNVMe >= DebugLevelVerbose, { |
| 189 | Log::Warning("[NVMe] Status %d attempting to identify controller", completion.status); |
| 190 | }) |
| 191 | return completion.status; |
| 192 | } |
| 193 | |
| 194 | return 0; |
| 195 | } |
| 196 | } |
nothing calls this directly
no test coverage detected