diff options
author | Jason M. Bills <jason.m.bills@linux.intel.com> | 2020-02-19 02:10:44 +0300 |
---|---|---|
committer | Jason M. Bills <jason.m.bills@linux.intel.com> | 2020-02-27 04:45:32 +0300 |
commit | cc7cab726c778145f44dc3f5caee1a9655cc893e (patch) | |
tree | 6ac267f7b5ca0ba94062a597d736bb4f7c3e8497 /libpeci/peci_cmds.c | |
parent | ef7772033c6072375a845ca139da78e0c54c1318 (diff) | |
download | provingground-cc7cab726c778145f44dc3f5caee1a9655cc893e.tar.xz |
Add WrEndPointConfig MMIO to peci_cmds
This adds WrEndPointConfig MMIO support to the peci_cmds utility.
Tested:
Ran this command:
peci_cmds WrEndpointConfigMMIO 6 0 0 0x7e 0x1a 0x0 0x224e0 0x5f5a56
and got the expected command buffer in the driver log:
[ 795.207278] peci_aspeed 1e78b000.peci-bus: HEAD : 0x00011730
[ 795.212980] TX : c5 00 05 00 00 00 06 00 d0 7e e0 24 02 00 00 00 .........~.$....
[ 795.220556] TX : 00 00 56 5a 5f 00 a8 ..VZ_..
Change-Id: Ibccaa8c390b89556162b7c131f7176b4883e06ec
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
Diffstat (limited to 'libpeci/peci_cmds.c')
-rw-r--r-- | libpeci/peci_cmds.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/libpeci/peci_cmds.c b/libpeci/peci_cmds.c index ec7dda9..ee23cca 100644 --- a/libpeci/peci_cmds.c +++ b/libpeci/peci_cmds.c @@ -64,6 +64,8 @@ void Usage(char* progname) "Endpoint PCI Config Write <Seg Bus Dev Func Reg Data>"); printf("\t%-28s%s\n", "RdEndpointConfigMMIO", "Endpoint MMIO Read <AType Bar Seg Bus Dev Func Reg>"); + printf("\t%-28s%s\n", "WrEndpointConfigMMIO", + "Endpoint MMIO Write <AType Bar Seg Bus Dev Func Reg Data>"); printf("\t%-28s%s\n", "raw", "Raw PECI command in bytes"); printf("\n"); } @@ -86,6 +88,7 @@ int main(int argc, char* argv[]) uint16_t u16PciReg = 0; uint64_t u64Offset = 0; uint32_t u32PciWriteVal = 0; + uint64_t u64MmioWriteVal = 0; uint8_t u8PkgIndex = 0; uint16_t u16PkgParam = 0; uint32_t u32PkgValue = 0; @@ -586,6 +589,45 @@ int main(int argc, char* argv[]) } printf(" cc:0x%02x 0x%0*x\n", cc, u8Size * 2, u32PciReadVal); } + else if (strcmp(cmd, "wrendpointconfigmmio") == 0) + { + index = argc; + switch (argc - optind) + { + case 8: + u64MmioWriteVal = strtoull(argv[--index], NULL, 0); + u64Offset = strtoull(argv[--index], NULL, 0); + u8PciFunc = (uint8_t)strtoul(argv[--index], NULL, 0); + u8PciDev = (uint8_t)strtoul(argv[--index], NULL, 0); + u8PciBus = (uint8_t)strtoul(argv[--index], NULL, 0); + u8Seg = (uint8_t)strtoul(argv[--index], NULL, 0); + u8Bar = (uint8_t)strtoul(argv[--index], NULL, 0); + u8AddrType = (uint8_t)strtoul(argv[--index], NULL, 0); + break; + + default: + printf( + "ERROR: Unsupported arguments for Endpoint MMIO Write\n"); + goto ErrorExit; + } + if (verbose) + { + printf("Endpoint MMIO Write of Seg:%02x %02x:%02x:%02x AType:%02x " + "Bar:%02x Offset:0x%" PRIx64 ": 0x%0*" PRIx64 "\n", + u8Seg, u8PciBus, u8PciDev, u8PciFunc, u8AddrType, u8Bar, + u64Offset, u8Size * 2, u64MmioWriteVal); + } + ret = peci_WrEndPointConfigMmio(address, u8Seg, u8PciBus, u8PciDev, + u8PciFunc, u8Bar, u8AddrType, u64Offset, + u8Size, u64MmioWriteVal, &cc); + if (0 != ret) + { + printf("ERROR %d: command failed\n", ret); + printf(" cc:0x%02x\n", cc); + return 1; + } + printf(" cc:0x%02x\n", cc); + } else if (strcmp(cmd, "raw") == 0) { if ((argc - optind) < 3) |