Skip to content

Commit

Permalink
generate script
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Jan 6, 2017
1 parent 36e191c commit f3e1469
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
15 changes: 7 additions & 8 deletions CLOVER/bin/find-nvme.py
Expand Up @@ -19,15 +19,14 @@ def find_entries_matching_name(ioreg_plist, name, depth=0):
child_path = my_name + '.' + found
yield child_path

to_find = 'IONVMeController'
ioreg_string = subprocess.check_output(['ioreg', '-a'])
ioreg_plist = plistlib.readPlistFromString(ioreg_string)

concatenated_templates = ''
for found in find_entries_matching_name(ioreg_plist, to_find):
devpath = re.sub(r'.*?AppleACPIPlatformExpert', '_SB', found).replace('AppleACPIPCI.', '').replace('IOPP.', '').replace('.' + to_find, '')
ioreg_plist = plistlib.readPlistFromString(subprocess.check_output(['ioreg', '-a']))
for controller in ['IONVMeController', 'HackrNVMeController']:
for found in find_entries_matching_name(ioreg_plist, controller):
devpath = re.sub(r'.*?AppleACPIPlatformExpert', '_SB', found).replace('AppleACPIPCI.', '').replace('IOPP.', '').replace('.' + controller, '')

template = """
template = """
External(%s, DeviceObj)
Method(%s._DSM, 4)
{
Expand All @@ -39,7 +38,7 @@ def find_entries_matching_name(ioreg_plist, name, depth=0):
})
}
""" % (devpath, devpath)
concatenated_templates += template
concatenated_templates += template

dsl = """
DefinitionBlock("", "SSDT", 2, "hack", "NVMe-Pcc", 0)
Expand All @@ -48,4 +47,4 @@ def find_entries_matching_name(ioreg_plist, name, depth=0):
}
""" % concatenated_templates

print dsl
print dsl
5 changes: 5 additions & 0 deletions CLOVER/bin/generate-nvme-aml.sh
@@ -0,0 +1,5 @@
#!/usr/bin/env sh

cd $(dirname $0)
python find-nvme.py > ../ACPI/patched/SSDT-NVMe-Pcc.aml
ACPICA/iasl ../ACPI/patched/SSDT-NVMe-Pcc.aml

0 comments on commit f3e1469

Please sign in to comment.