Experimental SPD Decode

This commit is contained in:
eloaders 2014-08-25 12:54:17 +02:00
parent 82bea9c22a
commit b47447103a
7 changed files with 129 additions and 244 deletions

View File

@ -1,80 +0,0 @@
' Gambas class file
' Copyright(C) 2011-2014, Michał Głowienka aka eloaders <eloaders@linux.pl>
'
' This program is free software; you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation; either version 3 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
Private Label[200] As Label
Public Logs As New Logger
Public Sub Form_Open()
Dim data As Stream
Dim i, MaxCount As Integer
Dim sLine As String
Dim EDID As New String[]
If Settings["Window/X"] = Null Then
Me.Center
Else
Try Me.X = Settings["Window/X", Me.X]
Try Me.Y = Settings["Window/Y", Me.Y]
Endif
Logs("Execute decode-dimms", Logger.Info)
data = Exec [ChkPrm.ChkExecDir("decode-dimms")] For Input
While Not Eof(data)
Line Input #data, sLine
MaxCount += 1
EDID.Add(sLine, MaxCount)
Wend
For i = 7 To MaxCount
Label[i] = New Label(ScrollView1)
With Label[i]
.X = 2
If i = 1 Then
.Y = 2
Else
.Y = Int(Int(i - 6) * 20)
Endif
If EDID[i - 1] Begins "---" Then
.Alignment = Align.Center
.Font.Bold = True
Endif
.Width = 440
.Height = 21
.Border = Border.Raised
.Padding = 3
If EDID[i - 1] Begins "Minimum" Then
EDID[i - 1] = Replace(EDID[i - 1], "Minimum ", "")
.Text = EDID[i - 1]
Else
.Text = EDID[i - 1]
Endif
If EDID[i - 1] = Null Then
.Visible = False
Endif
.Font.Size = 8
End With
Next
Try Close #data
End
Public Sub Button1_Click()
Me.Close
End

View File

@ -1,21 +0,0 @@
# Gambas Form File 3.0
{ Form Form
Move(0,0,476,539)
#Scaled = False
#Translate = False
Text = "Decode DIMMS"
Icon = Picture["i-nex.png"]
Resizable = False
{ ScrollView1 ScrollView
Move(0,0,474,510)
}
{ Button1 Button
Move(414,510,63,28)
#Translate = False
Font = Font["8"]
ToolTip = "Close this program"
Text = "Close"
Picture = Picture["AppIcons/application-exit2.png"]
}
}

View File

@ -88,8 +88,8 @@ End
Public Sub ht()
Dim NUMLOG, NUMPHY As Float
'CString(Finfosys.CPU_PROCESSOR.Count)
NUMPHY = Finfosys.CPU_PROCESSOR.Count
NUMLOG = CFloat(Finfosys.CPU_CPU_CORES[CFloat(Finfosys.ComboBox1.Index)])
Try NUMPHY = Finfosys.CPU_PROCESSOR.Count
Try NUMLOG = CFloat(Finfosys.CPU_CPU_CORES[CFloat(Finfosys.ComboBox1.Index)])
If NUMLOG = Null Then
Logs("CPU Cores is Null", Logger.Info)

View File

@ -562,19 +562,19 @@ Public Sub Wykrywanie_procesorow()
Close #CPUINFO_PROC
Label14.Text = Replace(CPU_MODEL_NAME[CFloat(ComboBox1.Index)], "\n", "")
Label14.Tooltip = Replace(CPU_MODEL_NAME[CFloat(ComboBox1.Index)], "\n", "")
Label71.Text = "Flags: " & FFlags.instructions
Label13.Text = UCase$(Replace(Replace(Replace(CPU_VENDOR_ID[CFloat(ComboBox1.Index)], "Authentic", ""), "Genuine", ""), "\n", ""))
Label12.Text = Replace(CPU_CPU_MHZ[CFloat(ComboBox1.Index)], "\n", "") & " MHz"
Label97.Text = "Family: " & Replace(CPU_FAMILYz[CFloat(ComboBox1.Index)], "\n", "")
Label6.Text = "Model: " & Replace(CPU_MODEL[CFloat(ComboBox1.Index)], "\n", "")
Label7.Text = "Stepping: " & Replace(CPU_STEPPING[CFloat(ComboBox1.Index)], "\n", "")
Label8.Text = "Cores: " & Replace(CPU_SIBLINGS[CFloat(ComboBox1.Index)], "\n", "")
Label19.Text = "Phy id: " & Replace(CPU_PHYSICAL_ID[CFloat(ComboBox1.Index)], "\n", "")
Label10.Text = "Bogomips: " & Replace(CPU_BOGOMIPS[CFloat(ComboBox1.Index)], "\n", "")
Label11.Text = "Address sizes: " & Replace(CPU_ADRESS_SIZES[CFloat(ComboBox1.Index)], "\n", "")
Label15.Text = "Power mangament: " & Replace(CPU_POWER_MANAGEMENT[CFloat(ComboBox1.Index)], "\n", "")
Try Label14.Text = Replace(CPU_MODEL_NAME[CFloat(ComboBox1.Index)], "\n", "")
Try Label14.Tooltip = Replace(CPU_MODEL_NAME[CFloat(ComboBox1.Index)], "\n", "")
Try Label71.Text = "Flags: " & FFlags.instructions
Try Label13.Text = UCase$(Replace(Replace(Replace(CPU_VENDOR_ID[CFloat(ComboBox1.Index)], "Authentic", ""), "Genuine", ""), "\n", ""))
Try Label12.Text = Replace(CPU_CPU_MHZ[CFloat(ComboBox1.Index)], "\n", "") & " MHz"
Try Label97.Text = "Family: " & Replace(CPU_FAMILYz[CFloat(ComboBox1.Index)], "\n", "")
Try Label6.Text = "Model: " & Replace(CPU_MODEL[CFloat(ComboBox1.Index)], "\n", "")
Try Label7.Text = "Stepping: " & Replace(CPU_STEPPING[CFloat(ComboBox1.Index)], "\n", "")
Try Label8.Text = "Cores: " & Replace(CPU_SIBLINGS[CFloat(ComboBox1.Index)], "\n", "")
Try Label19.Text = "Phy id: " & Replace(CPU_PHYSICAL_ID[CFloat(ComboBox1.Index)], "\n", "")
Try Label10.Text = "Bogomips: " & Replace(CPU_BOGOMIPS[CFloat(ComboBox1.Index)], "\n", "")
Try Label11.Text = "Address sizes: " & Replace(CPU_ADRESS_SIZES[CFloat(ComboBox1.Index)], "\n", "")
Try Label15.Text = "Power mangament: " & Replace(CPU_POWER_MANAGEMENT[CFloat(ComboBox1.Index)], "\n", "")
Try INDEX0 = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index0/size"), "\n", "")
Try INDEX1 = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index1/size"), "\n", "")
@ -601,42 +601,42 @@ Public Sub Wykrywanie_procesorow()
Try NUMOFSETS2 = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index2/number_of_sets"), "\n", "")
Try NUMOFSETS3 = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index3/number_of_sets"), "\n", "")
Label1.Text = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
Try Label1.Text = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
L0LEVEL,
INDEX0,
L0TYPE,
L0WAYS,
COHERENCY0,
NUMOFSETS0)
Label1.Tooltip = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
Try Label1.Tooltip = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
L0LEVEL,
INDEX0,
L0TYPE,
L0WAYS,
COHERENCY0,
NUMOFSETS0)
Label2.Text = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
Try Label2.Text = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
L1LEVEL,
INDEX1,
L1TYPE,
L1WAYS,
COHERENCY1,
NUMOFSETS1)
Label2.Tooltip = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
Try Label2.Tooltip = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
L1LEVEL,
INDEX1,
L1TYPE,
L1WAYS,
COHERENCY1,
NUMOFSETS1)
Label3.Text = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
Try Label3.Text = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
L2LEVEL,
INDEX2,
L2TYPE,
L2WAYS,
COHERENCY2,
NUMOFSETS2)
Label3.Tooltip = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
Try Label3.Tooltip = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
L2LEVEL,
INDEX2,
L2TYPE,
@ -646,14 +646,14 @@ Public Sub Wykrywanie_procesorow()
If IsNull(L3LEVEL) = False Then
Label5.Text = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
Try Label5.Text = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
L3LEVEL,
INDEX3,
L3TYPE,
L3WAYS,
COHERENCY3,
NUMOFSETS3)
Label5.Tooltip = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
Try Label5.Tooltip = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
L3LEVEL,
INDEX3,
L3TYPE,
@ -1126,12 +1126,6 @@ Public Sub Buttongroup_Click()
Desktop.Open("" & Last.Name & "")
End
Public Sub Button4_Click()
FDIMM.Show
End
Public Sub ComboBox9_Click()
Asound_Drives._INPUT_NAME()
@ -1216,13 +1210,5 @@ Public Sub Button20_Click()
End
Public Sub ComboBox10_Click()
Try TextBox31.Text = Replace(MDecode_dimms.MODULE_MANUFACTURER[CFloat(ComboBox10.Index)], "\n", "")
Try TextBox32.Text = Replace(MDecode_dimms.DRAM_MANUFACTURER[CFloat(ComboBox10.Index)], "\n", "")
Try TextBox33.Text = Replace(MDecode_dimms.MODULE_TYPE[CFloat(ComboBox10.Index)], "\n", "")
Try TextBox34.Text = Replace(MDecode_dimms.PART_NUMBER[CFloat(ComboBox10.Index)], "\n", "")
Try TextBox35.Text = Replace(MDecode_dimms.RAM_SIZE[CFloat(ComboBox10.Index)], "\n", "")
Try TextBox36.Text = Replace(MDecode_dimms.tCL_tRCD_tRDP_tRAS[CFloat(ComboBox10.Index)], "\n", "")
Try TextBox37.Text = Replace(MDecode_dimms.SDRAM_DEVICE_TYPE[CFloat(ComboBox10.Index)], "\n", "")
Try TextBox38.Text = Replace(MDecode_dimms.MAX_MODULE_SPEED[CFloat(ComboBox10.Index)], "\n", "")
MDecode_dimms._inits()
End

View File

@ -1853,37 +1853,34 @@
Alignment = Align.Center
Border = Border.Raised
}
{ TextBox31 TextBox
Move(0,154,231,28)
Text = ("TextBox31")
}
{ TextBox32 TextBox
Move(231,154,238,28)
Text = ("TextBox32")
}
{ TextBox33 TextBox
Move(0,182,231,28)
Text = ("TextBox33")
}
{ TextBox34 TextBox
Move(231,182,238,28)
Text = ("TextBox34")
}
{ TextBox35 TextBox
Move(0,210,231,28)
Text = ("TextBox35")
}
{ TextBox36 TextBox
Move(231,210,238,28)
Text = ("TextBox36")
}
{ TextBox37 TextBox
Move(0,238,231,28)
Text = ("TextBox37")
}
{ TextBox38 TextBox
Move(231,238,238,28)
Text = ("TextBox38")
{ Frame2 Frame
Move(0,154,469,322)
Font = Font["8"]
Text = ("---===Serial Presence Detect===---")
{ Label227 Label
Move(259,21,203,28)
Font = Font["8"]
Padding = 3
Border = Border.Raised
}
{ Label256 Label
Move(91,21,168,28)
Font = Font["8"]
Padding = 3
Border = Border.Raised
}
{ Label257 Label
Move(7,21,84,28)
Font = Font["8"]
Padding = 3
Border = Border.Raised
}
{ Label258 Label
Move(7,49,168,28)
Font = Font["8"]
Padding = 3
Border = Border.Raised
}
}
Index = 8
Text = "Network"

View File

@ -1,78 +1,81 @@
' Gambas module file
Public NOSDRAMDIMMSDAD As New String[]
Public MODULE_TYPE As New String[]
Public MODULE_MANUFACTURER As New String[]
Public DRAM_MANUFACTURER As New String[]
Public ASM_SERIALNUMBER As New String[]
Public PART_NUMBER As New String[]
Public RAM_SIZE As New String[]
Public MAX_MODULE_SPEED As New String[]
Public FUN_MEM_TYPE As New String[]
Public tCL_tRCD_tRDP_tRAS As New String[]
Public SDRAM_DEVICE_TYPE As New String[]
'DRAM Manufacturer
Public Sub _inits()
Dim DECODE_DIMMS As Stream
Dim sLine As String
Dim sIcon As String
Dim iPos As Integer
Dim Character As Integer
Dim sKey As String
Dim sVal As String
DECODE_DIMMS = Exec ["i-nex-dimms"] For Read
For Each sLine In DECODE_DIMMS.Lines
sLine = Trim(sLine)
If Not sLine Then Continue
iPos = InStr(sLine, ":")
If iPos = 0 Then Continue
sKey = Trim(Left$(sLine, iPos - 1))
sVal = Trim(Mid$(sLine, iPos + 1))
Select Case sKey
Case Like "*Module Manufacturer*"
MODULE_MANUFACTURER.Add(sVal)
Case Like "*DRAM Manufacturer*"
DRAM_MANUFACTURER.Add(sVal)
Case Like "*Assembly Serial Number*"
ASM_SERIALNUMBER.Add(sVal)
Case Like "*Part Number*"
PART_NUMBER.Add(sVal)
Case Like "*Module Type*"
MODULE_TYPE.Add(sVal)
Case Like "*Decoding EEPROM*"
NOSDRAMDIMMSDAD.Add(Right(sVal, 6))
Case Like "*Size*"
RAM_SIZE.Add(sVal)
Case Like "*Maximum module speed*"
MAX_MODULE_SPEED.Add(sVal)
Case Like "*Fundamental Memory type*"
FUN_MEM_TYPE.Add(sVal)
Case Like "*Module Type*"
MODULE_TYPE.Add(sVal)
Case Like "*tCL-tRCD-tRP-tRAS*"
tCL_tRCD_tRDP_tRAS.Add(sVal)
Case Like "*SDRAM Device Type*"
SDRAM_DEVICE_TYPE.Add(sVal)
Case Like "**"
Case Like "**"
Case Like "**"
Case Like "**"
Case Like "**"
Case Like "**"
End Select
'Print sVal
Next
Finfosys.ComboBox10.List = NOSDRAMDIMMSDAD
Finfosys.ComboBox10.Index = 0
Public PART_NUMBER As String
Public MEMORY_TYPE As String
Public SPD_REVISION As String
Public MODULE_TYPE As String
Public Sub List_EEPROM()
Try Finfosys.ComboBox10.List = Dir("/sys/bus/i2c/drivers/eeprom/", "*-****")
End
Public Sub _inits()
Dim hFile As File
Dim sLine As String
Dim i As Integer
Dim spd_data As New String[]
Dim spd_data_asc As New String[]
Dim spd_data_str As New String[]
Dim module_types As String[] = ["Undefined", "RDIMM", "UDIMM", "SO-DIMM",
"Micro-DIMM", "Mini-RDIMM", "Mini-UDIMM",
"Mini-CDIMM", "72b-SO-UDIMM", "72b-SO-RDIMM",
"72b-SO-CDIMM", "LRDIMM", "16b-SO-DIMM",
"32b-SO-DIMM"]
Dim SIZERAM As Integer
SETNULL()
spd_data.Clear
spd_data_asc.Clear
spd_data_str.Clear
hFile = Open "/sys/bus/i2c/drivers/eeprom/" & Finfosys.ComboBox10.Text & "/eeprom" For Input
While Not Eof(hFile)
Line Input #hFile, sLine
If Len(sLine) = 256 Then
For i = 0 To Len(sLine)
'Print Hex(Asc(Mid$(sLine, i + 1, 1)))
spd_data.Add(Hex(Asc(Mid$(sLine, i + 1, 1))))
spd_data_asc.Add(Asc(Mid$(sLine, i + 1, 1)))
spd_data_str.Add(Mid$(sLine, i + 1, 1))
Next
Endif
Wend
If spd_data.Count <= 257 And spd_data.Count > 0 Then
Select Case spd_data[0]
Case 08
MEMORY_TYPE = "DDR2"
Case 92
MEMORY_TYPE = "DDR3"
Case "0C"
MEMORY_TYPE = "DDR4"
End Select
SPD_REVISION = Mid(spd_data[1], 1, 1) & "." & Mid(spd_data[1], 2, 1)
For i = 128 To 145
PART_NUMBER &= spd_data_str[i]
Next
Try MODULE_TYPE = module_types[spd_data[3]]
Endif
FINALIZE()
Close #hFile
End
Public Sub FINALIZE()
Finfosys.Label227.Text = "Part number: " & PART_NUMBER
Finfosys.Label256.Text = "Memory type: " & MEMORY_TYPE
Finfosys.Label258.Text = "Module Type: " & MODULE_TYPE
Finfosys.Label257.Text = "SPD RV: " & SPD_REVISION
End
Public Sub SETNULL()
MODULE_TYPE = Null
SPD_REVISION = Null
PART_NUMBER = Null
MEMORY_TYPE = Null
End

View File

@ -17,7 +17,7 @@
Public CPUINFO_FILE As String
Public Sub Main()
Dim PrintErr As Boolean = True
MDecode_dimms._inits()
MDecode_dimms.List_EEPROM()
Select Case Application.Args[1]
Case "--help"
Print ("\n " & Application.name & " " & Application.version & " running on:\n"