Skip to content
This repository was archived by the owner on Mar 3, 2026. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
68e61c9
add pirq gen option
MatthewWertman Nov 2, 2024
3b0c664
move scripts to src
MatthewWertman Nov 3, 2024
c9f2cce
add includes
MatthewWertman Nov 4, 2024
7b0b17a
move GUI to ui
MatthewWertman Nov 4, 2024
92e66cd
move getters to util
MatthewWertman Nov 5, 2024
a1366bf
add Popup and Input UI templates
MatthewWertman Nov 5, 2024
10fa3a5
set Popup WindowStyle to default
MatthewWertman Nov 5, 2024
f6d4dda
start skeleton for pirq gen script
MatthewWertman Nov 5, 2024
dfabf96
Increase size of window
MatthewWertman Nov 5, 2024
ee6ecef
bump version
MatthewWertman Nov 6, 2024
0a00472
add pirq gen option
MatthewWertman Nov 2, 2024
8394c44
move scripts to src
MatthewWertman Nov 3, 2024
854d596
add includes
MatthewWertman Nov 4, 2024
4dac34f
move GUI to ui
MatthewWertman Nov 4, 2024
5d1f359
move getters to util
MatthewWertman Nov 5, 2024
5d5b3e9
add Popup and Input UI templates
MatthewWertman Nov 5, 2024
45fef4f
set Popup WindowStyle to default
MatthewWertman Nov 5, 2024
6960129
start skeleton for pirq gen script
MatthewWertman Nov 5, 2024
26ede65
Increase size of window
MatthewWertman Nov 5, 2024
9aaaf5d
Merge branch 'pirq-gen' of https://github.com/MatthewWertman/glt into…
MatthewWertman Nov 7, 2024
278da1d
add lspci
MatthewWertman Nov 7, 2024
665bd0b
some cleanup
MatthewWertman Nov 7, 2024
8fd2ef7
showdown after getting pirq slot
MatthewWertman Nov 7, 2024
26bf82f
generate pirq map
MatthewWertman Nov 7, 2024
8327386
test again without shutdown
MatthewWertman Nov 29, 2024
c90861d
fix include
MatthewWertman Dec 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.json.example → src/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"forceLocalPrograms": false,
"params": {
"awesomeMinerAPIConfig": {
enabled: false,
"enabled": false,
"awesomeHostURL": "",
"awesomeAPIKey": ""
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions gen_expected.ps1 → src/gen_expected.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
. .\p7zip_util.ps1
. .\include\p7zip_util.ps1
if (Test-Path -Path '.\instance.json')
{
$instance = (Get-Content '.\instance.json') | ConvertFrom-Json
Expand All @@ -12,7 +12,7 @@ else



$test_dirs = '.\tests\Amd', '.\tests\Baseboards', '.\tests\Nvidia'
$test_dirs = '..\tests\Amd', '..\tests\Baseboards', '..\tests\Nvidia'
foreach ($test_path in $test_dirs)
{
if (Test-Path $test_path)
Expand Down
4 changes: 2 additions & 2 deletions glt_launcher.ps1 → src/glt_launcher.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<#PSScriptInfo

.VERSION 0.2.6
.VERSION 0.2.7

.GUID fe8bfeb4-23ab-4a96-824c-6a36d85d61b3

Expand Down Expand Up @@ -199,7 +199,7 @@ try
catch
{ Throw 'ERROR (Failed Operation: Unable to load WPF Dependencies)' }

$GUI_PATH = '.\GUI.xaml'
$GUI_PATH = '.\ui\GUI.xaml'
[xml]$XML_WPF = Get-Content -Path $GUI_PATH

if (! $XML_WPF) { Throw "ERROR (Failed Operation: Unabled to find 'GUI.xaml' in script directory.)" }
Expand Down
257 changes: 5 additions & 252 deletions gpu_lookup_tableGUI.ps1 → src/gpu_lookup_tableGUI.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Param (
[string]$ConfigFile
)

# Includes
. .\include\pirq.ps1
. .\include\util.ps1

if (! $ConfigFile) { $ConfigFile = '.\instance.json' }
$config = (Get-Content $ConfigFile) | ConvertFrom-Json

Expand All @@ -16,7 +20,7 @@ $plink = $config.programs.plink

if (-not $config.tests.testMode)
{
. .\p7zip_util.ps1
. .\include\p7zip.ps1
$P7Zip = $config.programs.p7zip
}

Expand All @@ -25,43 +29,6 @@ if (-not $config.tests.testMode)
[Regex]$BUSID_REGEX = '(:[0-9a-f]{2}){2}\.\d'
[Regex]$GPU_BUSID_REGEX = '(:[0-9a-f]{2})(:00)\.\d'

# Supported baseboard names
$SUPPORTED_BASEBOARDS = @(
'BTC-T37',
'BTC-S37',
'ONDA B250 BTC V1.05',
'TB85',
# OctoMiner
'12XTREME',
'X12ULTRA',
'B85 ULTRA',
'CRESCENTBAY',
'B75',
'skylake'
)

## PIRQ MAPS
# ONDA B250
$b250_pirq_hard_map = @(16, 37, 38, 39, 40, 41, 42, 43, 48, 53, 54, 55)
# BTC-T37, BTC-S37
$x37_pirq_hard_map = @(16, 9, 10, 16, 17, 18, 33, 34)
# TB85
$tb85_pirq_hard_map = @(16, 33, 34, 8, 9, 10)
# Octo 8x (ULTRA)
$octo8_pirq_hard_map = @(34, 33, 32, 39, 35, 36, 37, 38)
# CRESCENTBAY
$crescentbay_pirq_hard_map = @(16, 33, 34, 35, 36, 37, 38, 39)
# B75
$b75_pirq_hard_map = @(33, 34, 8, 9, 10, 6, 17, 18) #slot 6 doesn't have a slot number
# skylake
$skylake_pirq_hard_map = @(32, 37, 36, 35, 40, 43, 41, 33)

## End PIRQ MAPS

# OctoMiner 12x (XTREME/ULTRA)
$octo12_hard_map = @('01', '07', '0c', '0d', '0b', '05', '0a', '04', '09', '03', '08', '02')


# FUNCTIONS


Expand Down Expand Up @@ -260,195 +227,6 @@ Function Read-PCI-Slot-Info
}


Function Get-PCI-Handle-Count
{
$pci_handles = @((Get-Content .\dmidecodet9.txt | Select-String -Pattern 'Handle ' -AllMatches) | ForEach-Object { $_ | Show-Column -Column 1 })
return $pci_handles.Count
}


Function Get-Baseboard-Product-Name
{
return (Get-Content .\mb_product_name.txt)
}


# PIRQ TABLE FUNCS


Function Test-For-PIRQ-Table
{
if ((Get-Content .\biosdecode.txt | Select-String -Pattern 'PCI Interrupt Routing').Matches) { return 0 }
return 1
}


Function Read-Baseboard-BIOS
{
return (Get-Content .\dmidecodebios.txt)
}


Function Update-Baseboard-Product-Name
{
for ($idx = 0; $idx -lt $SUPPORTED_BASEBOARDS.Count; $idx++)
{
if ($SUPPORTED_BASEBOARDS[$idx] -eq $mb_product_name)
{
return ( $idx + 1 )
}
}
return $mb_product_name
}


Function Search-PIRQ-Hard-Maps
{
$support_idx = $mb_product -as [int]
if ($null -eq $support_idx)
{ Throw "ERROR (Unsupported: The detected motherboard model is not supported: $mb_product)" }

switch ($support_idx)
{
# BTC-S37, BTC-T37
{ ($_ -eq 1) -or ($_ -eq 2) } { return Write-Output -NoEnumerate $x37_pirq_hard_map }
# ONDA B250
3 { return Write-Output -NoEnumerate $b250_pirq_hard_map }
# TB85
4 { return Write-Output -NoEnumerate $tb85_pirq_hard_map }
# 12XTREME, X12ULTRA
{ ($_ -eq 5) -or ($_ -eq 6) } { return Write-Output -NoEnumerate $octo12_hard_map }
# B85 ULTRA
7 { return Write-Output -NoEnumerate $octo8_pirq_hard_map }
# CRESCENTBAY
8 { return Write-Output -NoEnumerate $crescentbay_pirq_hard_map }
# B75
9 { return Write-Output -NoEnumerate $b75_pirq_hard_map }
# skylake
10 { return Write-Output -NoEnumerate $skylake_pirq_hard_map }
}
}


Function Read-PIRQ-Device-Slot-Ids
{
$devices = $gpu_busids
if ((Get-Content .\gpu_driver.txt | Select-String -Pattern 'amdgpu').Matches -and (Find-GPU-Context-Offset) -ne 1)
{
$devices = $pci_busids
}
$pirq_device_slot_ids = @()
# OctoMiner 12x
if ($mb_product_name -eq '12XTREME' -or $mb_product_name -eq 'X12ULTRA')
{
foreach ($bus in $devices)
{
for ($idx = 0; $idx -lt $pirq_map.Count; $idx++)
{
if ("$bus".Substring(0, 2) -eq $pirq_map[$idx])
{
$pirq_device_slot_ids += $idx
break
}
}
}
return Write-Output -NoEnumerate $pirq_device_slot_ids
}
$cp_of_pirq_map = $pirq_map.Clone()
foreach ($bus in $devices)
{
if ($bus -eq 'MISSING') { continue }
$is_pirq_slot_number_match = (Get-Content .\biosdecode.txt | Select-String -Pattern $bus.Split('.')[0] | Out-String -Stream | Select-String -Pattern 'slot(?: number | )([0-9]{1,})')
try
{
$pirq_slot_number = $is_pirq_slot_number_match.Matches.Groups[1].Value
}
catch
{
#
}

# little bit of headache to get around multiple "16" entries with crescentbay boards
if ($bus -eq '01:00.0' -and $pirq_slot_number -eq '16')
{
$pirq_device_slot_ids += 0
$cp_of_pirq_map[0] = ''
continue
}
elseif ($pirq_slot_number -eq '16' -and $bus -ne '01:00.0')
{
$cp_of_pirq_map[0] = ''
}
# fix BTC-X37 showing slot 1 MISSING when slot 7 is MISSING
if ($mb_product_name -eq 'BTC-T37' -or $mb_product_name -eq 'BTC-S37')
{
if ($pirq_slot_number -eq '33' -and $bus -eq '01:00.0')
{
$pirq_device_slot_ids += 0
$cp_of_pirq_map[0] = ''
continue
}
}
# fix B75 slot 6 not having slot number
if ($mb_product_name -eq 'B75')
{
if ($null -eq $is_pirq_slot_number_match)
{
$pirq_device_slot_ids += 5
$cp_of_pirq_map[5] = ''
continue
}
}
for ($idx = 0; $idx -lt $cp_of_pirq_map.Count; $idx++)
{
if ($cp_of_pirq_map[$idx] -eq $pirq_slot_number)
{
$pirq_device_slot_ids += $idx
$cp_of_pirq_map[$idx] = ''
break
}
}
}
Remove-Variable devices
Remove-Variable cp_of_pirq_map
return Write-Output -NoEnumerate $pirq_device_slot_ids
}


Function Get-Missing-Slot-Ids
{
$missing_slot_ids = @()
if ($PIRQ_FOUND)
{
$slot_ids = @(0..($pirq_map.Count - 1))
}
else
{ $slot_ids = @(0..((Get-PCI-Handle-Count) - 1)) }
foreach ($id in $slot_ids)
{
if ($pci_info_ids -notcontains $id)
{
$missing_slot_ids += $id
}
}
return Write-Output -NoEnumerate $missing_slot_ids
}


Function Get-PIRQ-Device-Designations
{
$pirq_device_slot_designations = @()
foreach ($id in $pci_info_ids)
{
$pirq_device_slot_designations += "PCIE $( $id + 1 )"
}
return Write-Output -NoEnumerate $pirq_device_slot_designations
}


## END PIRQ TABLE FUNCS


Function Request-Data
{
# Need to make manual connection first to accept remote host key
Expand Down Expand Up @@ -699,31 +477,6 @@ Function Show-Table
}


Function Show-Column
{
param (
[Parameter(Mandatory, ValueFromPipeline)][string]$line,
[string]$Delimiter,
[int]$Column
)
if (! $Delimiter) { $Delimiter = ' ' }
($line -split $Delimiter)[$Column]
}


Function Unprotect-SecureString
{
param (
[System.Security.SecureString]$SecureString
)
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString)
$Plain = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
[System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($BSTR)
$SecureString = $SecureString.Dispose()
Return $Plain
}


if ($config.debug.debugMode)
{
$DebugPreference = 'Continue'
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion p7zip_util.ps1 → src/include/p7zip.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ Function Update-Tar
}
else
{ & $P7Zip -bso0 -bsp0 a $tarFile $(, $files) }
}
}
Loading