summaryrefslogtreecommitdiff
path: root/libpeci
AgeCommit message (Collapse)AuthorFilesLines
2020-02-27Add WrEndPointConfig MMIO to peci_cmdsJason M. Bills1-0/+42
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>
2020-02-27Add WrEndPointConfig MMIO to the PECI libraryJason M. Bills2-0/+85
This adds WrEndPointConfig MMIO support to the PECI library. Tested: Combined with the peci_cmds change, 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: I991ab7b1138981cd773f7344a7ad33cbc5292e08 Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2020-02-07Print the completion code on errorJason M. Bills1-0/+11
In some cases, such as timeout, the PECI completion code can still provide additional data, so print it along with the error code. Tested: peci_cmds RdPCIConfig 0 0 0 ERROR 6: command failed cc:0x40 Change-Id: Ib4e8cdc5f6c45e2cd873df344a4e5d2e237a98ee Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2020-02-06Add PECI_CC_TIMEOUT responseJason M. Bills2-0/+6
If the driver times-out on a PECI call and returns ETIMEDOUT, return a new PECI_CC_TIMEOUT response to the caller. Tested: Ran a PECI command with a timeout and confirmed that it returns PECI_CC_TIMEOUT. Change-Id: I93e25948ef05d0e7f137500310a4dfa99ed8980c Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2019-12-05Update usage info of peci_cmds utilityKarthick Sundarrajan1-5/+4
peci_cmds utility is modified to accept both decimal and hex numbers recently. Updating the usage/help information accordingly. Tested: Usage: ./peci_cmds [-a <addr>] [-s <size>] <command> [parameters] Options: -h Display this help information -v Display additional information about the command -a Address of the target. Accepted values are 48-55 (0x30-0x37). Default is 48 (0x30) -s Size of data to read or write in bytes. Accepted values are 1, 2, 4, 8, and 16. Default is 4 Commands: Ping Ping the target GetTemp Get the temperature GetDIB Get the DIB RdPkgConfig Read Package Config <Index Parameter> WrPkgConfig Write Package Config <Index Parameter Data> RdIAMSR MSR Read <Thread Address> RdPCIConfig PCI Read <Bus Dev Func [Reg]> RdPCIConfigLocal Local PCI Read <Bus Dev Func [Reg]> WrPCIConfigLocal Local PCI Write <Bus Dev Func Reg Data> RdEndpointConfigPCILocal Endpoint Local PCI Config Read <Seg Bus Dev Func Reg> WrEndpointConfigPCILocal Endpoint Local PCI Config Write <Seg Bus Dev Func Reg Data> RdEndpointConfigPCI Endpoint PCI Config Read <Seg Bus Dev Func Reg> WrEndpointConfigPCI Endpoint PCI Config Write <Seg Bus Dev Func Reg Data> RdEndpointConfigMMIO Endpoint MMIO Read <AType Bar Seg Bus Dev Func Reg> raw Raw PECI command in bytes Change-Id: I91c9a3775dde47051e558dba7fc54dfeadb924e4 Signed-off-by: Karthick Sundarrajan <karthick.sundarrajan@intel.com>
2019-12-05Fix the peci_cmds utilityKarthick Sundarrajan1-53/+53
At present, the peci_cmds utility just accepts hex for all numerical inputs. Fixed it to accept numericals in decimal or hex or octals. Tested: The index and Param in the output are in hex. root@intel-obmc:~# peci_cmds rdpkgconfig 10 16 -v PECI target[0x30]: Pkg Read of Index 0a Param 0010 cc:0x40 0x00000a9c root@intel-obmc:~# peci_cmds rdpkgconfig 0x10 0x16 -v PECI target[0x30]: Pkg Read of Index 10 Param 0016 cc:0x40 0x00690a00 Change-Id: Idce477653de9ad394b857196b652c66bd02e1e5c Signed-off-by: Karthick Sundarrajan <karthick.sundarrajan@intel.com>
2019-11-26Add peci_WrEndPointConfig_seq for sequential writeKenny L. Ku2-20/+41
Tested: Verified with peci_cmds. Signed-off-by: Kenny K. Ku <kenny.k.ku@intel.com> Change-Id: I72ff9de2a765b5f98ec287783764f71a226cb9cf
2019-11-26Separate stepping from model in peci_GetCPUID()Jason M. Bills2-12/+17
Including the stepping in the CPUID was too granular and was causing a lot of unnecessary updates to code that uses it. This change returns the CPU model as the main parameter for identifying the processor and gives the stepping as a separate parameter in case it is needed. Tested: Combined with the changes in the consumers of this library, verified that the CPU model can correctly be retreived and used to determine the correct PECI calls to use. Change-Id: Ifef3ed4c952bf303bcb43aebb6a013e91719756e Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2019-10-25Add a raw command to peci_cmdsJason M. Bills1-0/+71
This change adds a raw command to peci_cmds that can be used to send a raw PECI command to the CPU. Tested: peci_cmds raw 0x30 ERROR: Unsupported arguments for raw command peci_cmds raw 0x30 5 9 0xa1 0 0 0 ERROR: Incorrect write length for raw command peci_cmds raw 0x30 5 9 0xa1 0 0 0 0 0x40 0x54 0x06 0x05 0x00 0x00 0x00 0x00 0x00 Change-Id: If1cb4c06d379786faea1ca0f8f9dc1a286aa98d6 Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2019-10-24Add ICX CPUID 0x606A4 supportKenny L. Ku1-0/+1
Signed-off-by: Kenny K. Ku <kenny.k.ku@intel.com> Change-Id: If6bceb73d0abf027118bd29dc744b4655e087f3b
2019-10-23Enable build flags and fix warningsJason M. Bills4-73/+104
This enables warnings during the build and fixes some warnings so it builds successfully. Tested: Confirmed that it builds and peci_cmds still works as expected. Change-Id: I768f2bc78050d001f6500b7349cceb40086def07 Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2019-10-16Handle the address and size parameters betterJason M. Bills1-6/+20
Instead of atoi() which has no error handling, switch to strtoul() so failures will return 0 and check the acceptable size and address ranges. Tested: peci_cmds ping -a 0x30 Succeeded peci_cmds ping -a 0x20 ERROR: Invalid address "0x20" peci_cmds RdPCIConfigLocal 0 0 0 -s 1 cc:0x40 0x86 peci_cmds RdPCIConfigLocal 0 0 0 -s 3 ERROR: Invalid size "3" Change-Id: Id42e170844a803122669455db6373201e0624a9c Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2019-10-15Add a LICENSE file for this recipeJason M. Bills1-0/+13
Change-Id: I77ddf63b68ca97af9aa008feb73a7133d2e36505 Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2019-10-15Add a peci_cmds verbose optionJason M. Bills1-36/+92
Don't print the command info by default and use the verbose option to enable it. Tested: peci_cmds RdPkgConfig 0 0 cc:0x40 0x00050654 peci_cmds RdPkgConfig 0 0 -v PECI target[48]: Pkg Read of Index 00 Param 0000 cc:0x40 0x00050654 Change-Id: I21ea390f87aa16582f677185f27a49c0308a2b69 Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2019-10-15Change peci_cmds interface to use a string for the commandJason M. Bills1-450/+395
The dash options to select commands will become very cumbersome as we implement the new PECI 4.0 commands. This separates the parameters into 'options' and 'commands'. Options are set using the dash parameters as they are today. Commands are now selected by a string in the first parameter. This is inspired by the usage of ipmitool and will hopefully feel familiar. This will help as new command types are added so we don't end up overloading the dash options with too many types that have to be checked against the help every time. Tested: Executed the following commands and confirmed they behave as expected: ./peci_cmds -h Usage: ./peci_cmds [-a <addr>] [-s <size>] <command> [parameters] Options: -h Display this help information -a Address of the target in decimal. Default is 48 -s Size of data to read or write in bytes. Default is 4 Commands: Ping Ping the target GetTemp Get the temperature GetDIB Get the DIB RdPkgConfig Read Package Config <Index Parameter> WrPkgConfig Write Package Config <Index Parameter Data> RdIAMSR MSR Read <Thread Address> RdPCIConfig PCI Read for specific hex address <Bus Dev Func [Reg]> RdPCIConfigLocal Local PCI Read for specific hex address <Bus Dev Func [Reg]> WrPCIConfigLocal Local PCI Write for specific hex address <Bus Dev Func Reg Data> ./peci_cmds Ping PECI target[48]: Pinging ... Succeeded ./peci_cmds Ping -a 49 PECI target[49]: Pinging ... Succeeded ./peci_cmds GetTemp PECI target[48]: GetTemp ef1ch (-67.56C) ./peci_cmds GetDIB PECI target[48]: GetDIB 0x3500 ./peci_cmds RdPkgConfig 0 0 PECI target[48]: Pkg Read of Index 00 Param 0000 cc:0x40 0x00050654 ./peci_cmds WrPkgConfig 0 0 0 PECI target[48]: Pkg Write of Index 00 Param 0000: 0x00000000 cc:0x90 ./peci_cmds RdIAMSR 0 411 PECI target[48]: MSR Read of Thread 00 MSR 0411 cc:0x40 0x00000000 ./peci_cmds RdPCIConfig 0 0 0 PECI target[48]: PCI Read of 00:00:00 Reg 00 cc:0x40 0x20208086 ./peci_cmds RdPCIConfigLocal 0 0 0 PECI target[48]: Local PCI Read of 00:00:00 Reg 00 cc:0x40 0x20208086 ./peci_cmds RdPCIConfigLocal 0 0 0 1 -s 1 PECI target[48]: Local PCI Read of 00:00:00 Reg 01 cc:0x40 0x80 ./peci_cmds RdPCIConfigLocal 0 0 0 2 -s 2 PECI target[48]: Local PCI Read of 00:00:00 Reg 02 cc:0x40 0x2020 ./peci_cmds WrPCIConfigLocal d 0 3 270 15 PECI target[48]: Local PCI Write of 0d:00:03 Reg 270: 0x00000015 cc:0x90 ./peci_cmds RdEndpointConfigPCILocal 0 0 0 0 0 cc:0x40 0x09a28086 ./peci_cmds WrEndpointConfigPCILocal 0 0 0 0 0 1 cc:0x40 ./peci_cmds RdEndpointConfigPCI 0 0 0 0 0 cc:0x40 0x09a28086 ./peci_cmds WrEndpointConfigPCI 0 0 0 0 0 1 cc:0x40 ./peci_cmds RdEndpointConfigMMIO 5 0 0 0 0 0 0 cc:0x40 0x00000000 Change-Id: I32bc8a566db7fa6b7a1f4bb1f56e636319b2d7f9 Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2019-10-15Clean up peci_cmds outputJason M. Bills1-111/+80
peci_cmds output is not very uniform and leaves out information such as the PECI completion code and library return value that are useful for debug. This change prints the completion code by default and cleans up some of the output to be more uniform. Tested: peci_cmds -c 0 0 PECI target[48]: Pkg Read of Index 00 Param 0000: cc:0x40 0x00050654 peci_cmds -c 0 100 PECI target[48]: Pkg Read of Index 00 Param 0100: cc:0x90 0x00000000 peci_cmds -lw d 0 3 270 15 PECI target[48]: Local PCI Write of 0d:00:03 Reg 270: 0x00000015 cc:0x90 Change-Id: I9094c7c77521ea381006b972aea2bf98e8c200cf Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2019-10-14Update peci_cmds with RdEndPointConfig and WrEndPointConfig supportKenny L. Ku3-2/+317
- update peci_cmds with Endpoint PCI/Local read/write support - update peci_cmds with MMIO read support Tested: - Manually tested using peci_cmds Signed-off-by: Kenny K. Ku <kenny.k.ku@intel.com> Change-Id: Iddd62bd458d4a11c36dfc43fb966ba2283be800d
2019-10-09Allow raw PECI ping commandsJason M. Bills1-1/+1
The PECI ping command has a read length of zero, so when it's called the response buffer is NULL since it has a size of zero. This change allows the command to continue with a NULL response buffer pointer as long as the read length is zero. Tested: Sent a raw ping command to a present CPU and got a successful response. Sent a raw ping command to a not-present CPU and got a failed response. Sent a raw read package config command and got the expected data. Change-Id: I3e672b68e60716c8e239cab569d400f24760cb5b Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2019-09-13Add libpeci as a standalone libraryJason M. Bills5-0/+1793
Tested: Verified that PECI functions and the peci_cmds application are available and functional from the standalone library. Change-Id: I9c0d3ba73db0f7e4bd7495dbeaae9cb60e3cda63 Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>