Skip to content

Commit 5d2d688

Browse files
committed
FDB: version 57 (see fdfdb commits)
1 parent a2c1220 commit 5d2d688

File tree

2 files changed

+622
-178
lines changed

2 files changed

+622
-178
lines changed

FDBGen/src/iTXTech/FlashDetector/FDBGen/Generator/SiliconMotionSSD.php

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,58 @@
2727
use iTXTech\SimpleFramework\Util\StringUtil;
2828

2929
class SiliconMotionSSD extends Generator{
30+
private const CONTROLLERS = [
31+
"2258XT" => null,
32+
"2259XT" => null,
33+
"2258" => null,
34+
"58XT" => "2258XT",
35+
"2259AB" => "2259",
36+
"2258AB" => "2258"
37+
];
38+
3039
public static function getDirName() : string{
3140
return "smssd";
3241
}
3342

3443
public static function merge(Fdb $fdb, string $data, string $filename) : void{
3544
$controller = "SM" . explode("_", $filename)[0];
45+
//新版本SM2258XT的Flash.SET格式变成更加完整的列表,包含SM2258系列,SM2259系列的配置
46+
//标识前缀也变为 B
47+
$prefix = $controller == "SM2258XT" ? "B" : "A";
48+
//部分支持不在新版列表中体现,比如SKHY16nm/14nm,Kioxia BiCS2等
49+
if($controller == "SM2258XTLEGACY"){
50+
$controller = "SM2258XT";
51+
}
3652
$fdb->getInfo()->addController($controller);
3753
$data = explode("\r\n", $data);
3854
foreach($data as $k => $config){
39-
if(StringUtil::startsWith($config, "A") and
40-
!StringUtil::startsWith($data[$k + 1], "A") and
55+
if(StringUtil::startsWith($config, $prefix) and
56+
!StringUtil::startsWith($data[$k + 1], $prefix) and
4157
!StringUtil::endsWith($config, "[END]")){
4258
list($flash, $info) = explode("=", $data[$k + 1], 2);
4359
list($vendor, $density, $pn) = explode(",", $flash, 3);
60+
//更正错误厂商命名
4461
$vendor = str_replace(
4562
["hynix", "stm", "power flash"],
4663
["skhynix", "st", "powerchip"],
4764
strtolower($vendor));
65+
if($prefix == "B"){
66+
$matches = [];
67+
preg_match_all('/(?<=\(SM)[^)]+/', $pn, $matches);
68+
$matches = $matches[0];
69+
if(count($matches) > 0){
70+
$matches = $matches[0];
71+
if(in_array($matches, array_keys(self::CONTROLLERS))){
72+
$con = "SM" . (self::CONTROLLERS[$matches] ?? $matches);
73+
}
74+
}
75+
if(isset($con)){//在prefix为B的模式下,只有有主控后缀的才被加入FDB
76+
$controller = $con;
77+
unset($con);
78+
}else{
79+
continue;
80+
}
81+
}
4882
$pn = trim(preg_replace('/\(.*?\)/', '', $pn));
4983
if($vendor == "sandisk"){
5084
if(StringUtil::startsWith($pn, "SNDK ") and strlen(substr($pn, 5)) > 5){
@@ -83,10 +117,11 @@ public static function merge(Fdb $fdb, string $data, string $filename) : void{
83117
for($i = 0; $i < 6; $i++){
84118
$id .= $rawId[$i];
85119
}
86-
87-
$fdb->getPartNumber($vendor, $pn, true)
88-
->addFlashId($id)
89-
->addController($controller);
120+
if($pn != "TSB"){
121+
$fdb->getPartNumber($vendor, $pn, true)
122+
->addFlashId($id)
123+
->addController($controller);
124+
}
90125
$fdb->getIddb()->getFlashId($id, true)->addController($controller);
91126
}
92127
}

0 commit comments

Comments
 (0)