@@ -60,7 +60,9 @@ int nvmeIdentify(NVMEController *drive) {
60
60
luxLogf (KPRINT_LEVEL_DEBUG , "- model: %s\n" , drive -> model );
61
61
62
62
int ctrlType = drive -> id -> controllerType - 1 ;
63
- if (ctrlType >= 0 && ctrlType <= 2 ) {
63
+ if (!drive -> id -> controllerType ) {
64
+ luxLogf (KPRINT_LEVEL_WARNING , "- controller type: %d (reserved, assuming legacy I/O controller)\n" , drive -> id -> controllerType );
65
+ } else if (ctrlType >= 0 && ctrlType <= 2 ) {
64
66
luxLogf (KPRINT_LEVEL_DEBUG , "- controller type: %s\n" , controllerType [ctrlType ]);
65
67
} else {
66
68
luxLogf (KPRINT_LEVEL_WARNING , "- controller type: %d (unimplemented), aborting...\n" , drive -> id -> controllerType );
@@ -186,14 +188,14 @@ int nvmeIdentify(NVMEController *drive) {
186
188
cmd .dword11 = 0x00 ; // CSI 0x00 = NVM I/O command set
187
189
nvmeSubmit (drive , 0 , & cmd );
188
190
if (!nvmePoll (drive , 0 , i + 0xBEEF , 20 )) {
189
- luxLogf (KPRINT_LEVEL_WARNING , "- timeout while identifying NVM namespace %d (0x%08X), aborting ...\n" , i , drive -> ns [i ]);
190
- return -1 ;
191
+ luxLogf (KPRINT_LEVEL_WARNING , "- timeout while identifying NVM namespace %d (0x%08X), skipping ...\n" , i , drive -> ns [i ]);
192
+ continue ;
191
193
}
192
194
193
195
NVMIONSIdentification * nvmNSID = (NVMIONSIdentification * ) drive -> id ;
194
196
if (!nvmNSID -> lbaFormatCount ) {
195
- luxLogf (KPRINT_LEVEL_WARNING , "- drive does not report any LBA formats, aborting ...\n" );
196
- return -1 ;
197
+ // luxLogf(KPRINT_LEVEL_WARNING, "- NS %d: drive doesn't report any LBA formats, skipping ...\n", i+1 );
198
+ continue ;
197
199
}
198
200
199
201
drive -> nsSectorSizes [i ] = 1 << nvmNSID -> lbaFormat [0 ].sectorSize ;
@@ -345,6 +347,8 @@ int nvmeIdentify(NVMEController *drive) {
345
347
}
346
348
347
349
for (int i = 0 ; i < drive -> nsCount ; i ++ ) {
350
+ if (!drive -> nsSizes [i ] || !drive -> nsSectorSizes [i ]) continue ;
351
+
348
352
memset (regcmd , 0 , sizeof (SDevRegisterCommand ));
349
353
regcmd -> header .command = COMMAND_SDEV_REGISTER ;
350
354
regcmd -> header .length = sizeof (SDevRegisterCommand );
@@ -369,9 +373,10 @@ int nvmeIdentify(NVMEController *drive) {
369
373
return -1 ;
370
374
}
371
375
376
+ uint8_t statype = (res -> status >> 8 ) & 7 ;
372
377
uint8_t status = (res -> status >> 1 ) & 0xFF ;
373
378
if (status ) {
374
- luxLogf (KPRINT_LEVEL_WARNING , "- I/O error while reading boot sector, error code 0x%02X, aborting...\n" );
379
+ luxLogf (KPRINT_LEVEL_WARNING , "- I/O error while reading boot sector, status type 0x%02X code 0x%02X, aborting...\n" , statype , status );
375
380
free (regcmd );
376
381
return -1 ;
377
382
}
0 commit comments