MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / IdentifyController

Method IdentifyController

Kernel/src/storage/nvme.cpp:169–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls 6

KernelAllocate4KPagesFunction · 0.85
KernelMapVirtualMemory4KFunction · 0.85
memsetFunction · 0.85
WarningFunction · 0.85
SubmitWaitMethod · 0.80

Tested by

no test coverage detected