New commit in github
https://github.com/EfiPy/EfiPy2/commit/325e07e6c24b2c3c58010d533aea3b06f03704f4
Its comment is "---".
Actually, python.efi adds socket interface according to Enabling socket support in Py368ReadMe.txt
New commit in github
https://github.com/EfiPy/EfiPy2/commit/325e07e6c24b2c3c58010d533aea3b06f03704f4
Its comment is "---".
Actually, python.efi adds socket interface according to Enabling socket support in Py368ReadMe.txt
This python script is published here on 4/2/2016. That just an sample code for demoing the capability of python language to read/write IO port via CorePy.
It is changed to PciScanSample1.py and another two PciScan sample scripts are also published.
The another two samples demo how to read/write IO port by EfiPy2 new X86Processor class in EfiPy2.Lib.X86Processor.
And for EfiPy2, the formal PciScan script is here.
This script can dump PCI device ID and Device ID, its device name and class name will be dumped as well.
The device name and class name data base is got from pci.ids which is also used popular Unix-like lspci in pciutils package.
The new github repository pciid.py is duty on parsing pci.ids to python dictionary in here and here.
This is the result after launch PciScan.py in Qemu.
After CPUID, MSR draft is also complete. The samples in QEMU are put in
python X86MsrInfo -d -a --verbose
This sample can dump MSR registers in each CPU core with parameter "-a".
Or with "-c n" parameter to dump MSR registers in specified CPU core, the n is core index in EFI_MP_SERVICES_PROTOCOL.
This script makes me possible to check processor information.
Command line:
python X86CpuInfo.py > X86CpuInfo.txt
This is the result on QEMU
This is a EFI_MP_SERVICES_PROTOCOL related libary making Python invoke CPUID, MSR and MMIO related function running on different CPU core.
These processor functions are made from CorePy. It also provides the capabilities
1. Geting which CPU core python application runs on (X86Processors.WhoAmI).
2. Local APIC MMIO Address (X86Processors.LocalApicAddress)
3. Each APIC IDs from EFI_MP_SERVICES_PROTOCOL
This is a sample code of getting APIC ID on each core via EfiPy2.Lib.X86Processor.
Sample output from EfiPy2 on QEMU.
CorePy is used to assembly machine code in python script. EfiPy project uses it for some function wich is not available by UEFI protcol easily, for example to read/write I/O, CPUID and MSR.
CorePy is developmented in Linux system. the prologue and epilogue in current status have to be improved for fitting current UEFI calling convention .
Note:
Calling convetion code is patched at
https://github.com/EfiPy/EfiPy2/commit/217fdd233568449d71b2b4082b6220d7fb8
AcpiAnalyze.py, AcpiRetrieve.py, AcpiTableList.py
These three applications can run on Windows, Linux and UEFI shell.
Retrieve all ACPI tables in current host and save to file with Acpi_XXXX.dat.
The output for example
$ ls -l
total 88
-rw-r--r-- 1 root root 114 二 8 10:52 Acpi_APIC.dat
-rw-r--r-- 1 root root 165 二 8 10:52 'Acpi_ASF!.dat'
-rw-r--r-- 1 root root 176 二 8 10:52 Acpi_DMAR.dat
-rw-r--r-- 1 root root 39858 二 8 10:52 Acpi_DSDT.dat
-rw-r--r-- 1 root root 244 二 8 10:52 Acpi_FACP.dat
-rw-r--r-- 1 root root 64 二 8 10:52 Acpi_FACS.dat
-rw-r--r-- 1 root root 56 二 8 10:52 Acpi_HPET.dat
-rw-r--r-- 1 root root 60 二 8 10:52 Acpi_MCFG.dat
-rw-r--r-- 1 root root 36 二 8 10:52 Acpi_RSDP.dat
-rw-r--r-- 1 root root 2474 二 8 10:52 Acpi_SSDT1.dat
-rw-r--r-- 1 root root 2706 二 8 10:52 Acpi_SSDT2.dat
-rw-r--r-- 1 root root 877 二 8 10:52 Acpi_SSDT.dat
-rw-r--r-- 1 root root 108 二 8 10:52 Acpi_XSDT.dat
$
Application
Library
Usage:
It is included in the sample code. The result is
Usage:
It is included in the sample code. The result is
$ ./HexDump
//
// No title, ShowOffset:0, No AddressBegin
//
HexDump (NULL, 0, 0xFFFFFFFF, s1, sizeof (s1));
0D 0A 03 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D | ...ABCDEFGHIJKLM
4E 4F 50 51 52 53 54 55 56 57 58 59 5A 61 62 63 | NOPQRSTUVWXYZabc
64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 | defghijklmnopqrs
74 75 76 77 78 79 7A 41 42 43 44 45 46 47 48 49 | tuvwxyzABCDEFGHI
4A 4B 4C 4D 4E 4F 50 51 52 00 | JKLMNOPQR.
//
// No title, ShowOffset:1, No AddressBegin
//
HexDump (NULL, 1, 0xFFFFFFFF, s1, sizeof (s1));
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
======================= ======================= ================
0D 0A 03 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D | ...ABCDEFGHIJKLM
4E 4F 50 51 52 53 54 55 56 57 58 59 5A 61 62 63 | NOPQRSTUVWXYZabc
64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 | defghijklmnopqrs
74 75 76 77 78 79 7A 41 42 43 44 45 46 47 48 49 | tuvwxyzABCDEFGHI
4A 4B 4C 4D 4E 4F 50 51 52 00 | JKLMNOPQR.
//
// No title, ShowOffset:0, Show AddressBegin
//
HexDump (NULL, 0, 0x123, s1, sizeof (s1));
0x00000120 0D 0A 03 41 42 43 44 45 46 47 48 49 4A | ...ABCDEFGHIJ
0x00000130 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A | KLMNOPQRSTUVWXYZ
0x00000130 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 | abcdefghijklmnop
0x00000130 71 72 73 74 75 76 77 78 79 7A 41 42 43 44 45 46 | qrstuvwxyzABCDEF
0x00000130 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 00 | GHIJKLMNOPQR.
//
// No title, ShowOffset:1, Show AddressBegin
//
HexDump (NULL, 1, 0x123, s1, sizeof (s1));
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
========== ======================= ======================= ================
0x00000120 0D 0A 03 41 42 43 44 45 46 47 48 49 4A | ...ABCDEFGHIJ
0x00000130 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A | KLMNOPQRSTUVWXYZ
0x00000130 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 | abcdefghijklmnop
0x00000130 71 72 73 74 75 76 77 78 79 7A 41 42 43 44 45 46 | qrstuvwxyzABCDEF
0x00000130 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 00 | GHIJKLMNOPQR.
//
// With title, ShowOffset:0, no AddressBegin
//
HexDump ("Title: ShowOffset:0, AddressBegin: 0xFFFFFFFF", 0, 0xFFFFFFFF, s1, sizeof (s1));
Title: ShowOffset:0, AddressBegin: 0xFFFFFFFF
-------------------------------------------------------------------
0D 0A 03 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D | ...ABCDEFGHIJKLM
4E 4F 50 51 52 53 54 55 56 57 58 59 5A 61 62 63 | NOPQRSTUVWXYZabc
64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 | defghijklmnopqrs
74 75 76 77 78 79 7A 41 42 43 44 45 46 47 48 49 | tuvwxyzABCDEFGHI
4A 4B 4C 4D 4E 4F 50 51 52 00 | JKLMNOPQR.
//
// With title, ShowOffset:0, show AddressBegin
//
HexDump ("Title: ShowOffset:0, AddressBegin: 0x120", 0, 0x120, s1, sizeof (s1));
Title: ShowOffset:0, AddressBegin: 0x120
------------------------------------------------------------------------------
0x00000120 0D 0A 03 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D | ...ABCDEFGHIJKLM
0x00000130 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 61 62 63 | NOPQRSTUVWXYZabc
0x00000130 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 | defghijklmnopqrs
0x00000130 74 75 76 77 78 79 7A 41 42 43 44 45 46 47 48 49 | tuvwxyzABCDEFGHI
0x00000130 4A 4B 4C 4D 4E 4F 50 51 52 00 | JKLMNOPQR.
//
// With title, ShowOffset:0, Show AddressBegin
//
HexDump ("Title: ShowOffset:0, AddressBegin: 0x123", 0, 0x123, s1, sizeof (s1));
Title: ShowOffset:0, AddressBegin: 0x123
------------------------------------------------------------------------------
0x00000120 0D 0A 03 41 42 43 44 45 46 47 48 49 4A | ...ABCDEFGHIJ
0x00000130 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A | KLMNOPQRSTUVWXYZ
0x00000130 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 | abcdefghijklmnop
0x00000130 71 72 73 74 75 76 77 78 79 7A 41 42 43 44 45 46 | qrstuvwxyzABCDEF
0x00000130 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 00 | GHIJKLMNOPQR.
//
// With title, ShowOffset:1, no AddressBegin
//
HexDump ("Title: ShowOffset:1, AddressBegin: 0xFFFFFFFF", 1, 0xFFFFFFFF, s1, sizeof (s1));
Title: ShowOffset:1, AddressBegin: 0xFFFFFFFF
-------------------------------------------------------------------
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
======================= ======================= ================
0D 0A 03 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D | ...ABCDEFGHIJKLM
4E 4F 50 51 52 53 54 55 56 57 58 59 5A 61 62 63 | NOPQRSTUVWXYZabc
64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 | defghijklmnopqrs
74 75 76 77 78 79 7A 41 42 43 44 45 46 47 48 49 | tuvwxyzABCDEFGHI
4A 4B 4C 4D 4E 4F 50 51 52 00 | JKLMNOPQR.
//
// With title, ShowOffset:1, show AddressBegin
//
HexDump ("Title: ShowOffset:1, AddressBegin: 0x120", 1, 0x120, s1, sizeof (s1));
Title: ShowOffset:1, AddressBegin: 0x120
------------------------------------------------------------------------------
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
========== ======================= ======================= ================
0x00000120 0D 0A 03 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D | ...ABCDEFGHIJKLM
0x00000130 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 61 62 63 | NOPQRSTUVWXYZabc
0x00000130 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 | defghijklmnopqrs
0x00000130 74 75 76 77 78 79 7A 41 42 43 44 45 46 47 48 49 | tuvwxyzABCDEFGHI
0x00000130 4A 4B 4C 4D 4E 4F 50 51 52 00 | JKLMNOPQR.
//
// With title, ShowOffset:1, show AddressBegin
//
HexDump ("Title: ShowOffset:1, AddressBegin: 0x120", 1, 0x120, s2, sizeof (s2));
Title: ShowOffset:1, AddressBegin: 0x120
------------------------------------------------------------------------------
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
========== ======================= ======================= ================
0x00000120 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | ................
0x00000130 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F | ................
0x00000130 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F | !"#$%&'()*+,-./
0x00000130 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F | 0123456789:;<=>?
0x00000130 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F | @ABCDEFGHIJKLMNO
0x00000130 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F | PQRSTUVWXYZ[\]^_
0x00000130 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F | `abcdefghijklmno
0x00000130 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F | pqrstuvwxyz{|}~.
0x00000130 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F | ................
0x00000130 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F | ................
0x00000130 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF | ................
0x00000130 B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF | ................
0x00000130 C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF | ................
0x00000130 D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF | ................
0x00000130 E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF | ................
0x00000130 F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF | ................
//
// With title, ShowOffset:1, show AddressBegin
//
HexDump ("Title: ShowOffset:1, AddressBegin: 0x121", 1, 0x121, s2, sizeof (s2));
Title: ShowOffset:1, AddressBegin: 0x121
------------------------------------------------------------------------------
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
========== ======================= ======================= ================
0x00000120 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E | ...............
0x00000130 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E | ................
0x00000130 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E | . !"#$%&'()*+,-.
0x00000130 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E | /0123456789:;<=>
0x00000130 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E | ?@ABCDEFGHIJKLMN
0x00000130 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E | OPQRSTUVWXYZ[\]^
0x00000130 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E | _`abcdefghijklmn
0x00000130 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E | opqrstuvwxyz{|}~
0x00000130 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E | ................
0x00000130 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E | ................
0x00000130 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE | ................
0x00000130 AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE | ................
0x00000130 BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE | ................
0x00000130 CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE | ................
0x00000130 DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE | ................
0x00000130 EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE | ................
0x00000130 FF | .
//
// With title, ShowOffset:1, show AddressBegin
//
HexDump ("Title: ShowOffset:1, AddressBegin: 0x120", 1, 0x120, s3, sizeof (s3));
Title: ShowOffset:1, AddressBegin: 0x120
------------------------------------------------------------------------------
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
========== ======================= ======================= ================
0x00000120 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | ................
0x00000130 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F | ................
0x00000130 20 21 22 23 24 25 26 27 | !"#$%&'
//
// With title, ShowOffset:1, show AddressBegin
//
HexDump ("Title: ShowOffset:1, AddressBegin: 0x121", 1, 0x121, s3, sizeof (s3));
Title: ShowOffset:1, AddressBegin: 0x121
------------------------------------------------------------------------------
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
========== ======================= ======================= ================
0x00000120 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E | ...............
0x00000130 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E | ................
0x00000130 1F 20 21 22 23 24 25 26 27 | . !"#$%&'
//
// With title, ShowOffset:1, show AddressBegin
//
HexDump ("Title: ShowOffset:1, AddressBegin: 0x120", 1, 0x120, s4, sizeof (s4));
Title: ShowOffset:1, AddressBegin: 0x120
------------------------------------------------------------------------------
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
========== ======================= ======================= ================
0x00000120 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F | 0123456789:;<=>?
0x00000130 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F | @ABCDEFGHIJKLMNO
0x00000130 50 51 52 53 54 55 56 | PQRSTUV
//
// With title, ShowOffset:1, show AddressBegin
//
HexDump ("Title: ShowOffset:1, AddressBegin: 0x121", 1, 0x121, s4, sizeof (s4));
Title: ShowOffset:1, AddressBegin: 0x121
------------------------------------------------------------------------------
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
========== ======================= ======================= ================
0x00000120 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E | 0123456789:;<=>
0x00000130 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E | ?@ABCDEFGHIJKLMN
0x00000130 4F 50 51 52 53 54 55 56 | OPQRSTUV
//
// With title, ShowOffset:1, show AddressBegin
//
HexDump ("Title: ShowOffset:1, AddressBegin: 0x120", 1, 0x120, s5, sizeof (s5));
Title: ShowOffset:1, AddressBegin: 0x120
------------------------------------------------------------------------------
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
========== ======================= ======================= ================
0x00000120 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F | 0123456789:;<=>?
0x00000130 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F | @ABCDEFGHIJKLMNO
0x00000130 50 51 52 53 54 55 56 57 58 59 | PQRSTUVWXY
//
// With title, ShowOffset:1, show AddressBegin
//
HexDump ("Title: ShowOffset:1, AddressBegin: 0x121", 1, 0x121, s5, sizeof (s5));
Title: ShowOffset:1, AddressBegin: 0x121
------------------------------------------------------------------------------
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
========== ======================= ======================= ================
0x00000120 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E | 0123456789:;<=>
0x00000130 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E | ?@ABCDEFGHIJKLMN
0x00000130 4F 50 51 52 53 54 55 56 57 58 59 | OPQRSTUVWXY
//
// With title, ShowOffset:1, show AddressBegin
//
HexDump ("Title: ShowOffset:1, AddressBegin: 0x127", 1, 0x127, s5, sizeof (s5));
Title: ShowOffset:1, AddressBegin: 0x127
------------------------------------------------------------------------------
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
========== ======================= ======================= ================
0x00000120 30 31 32 33 34 35 36 37 38 | 012345678
0x00000130 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 | 9:;<=>?@ABCDEFGH
0x00000130 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 | IJKLMNOPQRSTUVWX
0x00000130 59 | Y
//
// With title, ShowOffset:1, show AddressBegin
//
HexDump ("Title: ShowOffset:1, AddressBegin: 0x128", 1, 0x128, s5, sizeof (s5));
Title: ShowOffset:1, AddressBegin: 0x128
------------------------------------------------------------------------------
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
========== ======================= ======================= ================
0x00000120 30 31 32 33 34 35 36 37 | 01234567
0x00000130 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 | 89:;<=>?@ABCDEFG
0x00000130 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 | HIJKLMNOPQRSTUVW
0x00000130 58 59 | XY
//
// With title, ShowOffset:1, show AddressBegin
//
HexDump ("Title: ShowOffset:1, AddressBegin: 0x12F", 1, 0x12F, s5, sizeof (s5));
Title: ShowOffset:1, AddressBegin: 0x12F
------------------------------------------------------------------------------
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
========== ======================= ======================= ================
0x00000120 30 | 0
0x00000130 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 | 123456789:;<=>?@
0x00000130 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 | ABCDEFGHIJKLMNOP
0x00000130 51 52 53 54 55 56 57 58 59 | QRSTUVWXY