aboutsummaryrefslogtreecommitdiff
path: root/libstb
AgeCommit message (Collapse)AuthorFilesLines
2018-03-27libstb/create-container: munmap() signature file addressCyril Bur2-19/+21
I also couldn't ignore that the same function had both a void *infile and a char *inFile. The inFile variable is clearly a filename, why not call it that. Fixes: CID 263054 and 263051 Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2018-02-28build: use thin archives rather than incremental linkingNicholas Piggin4-4/+4
This changes to build system to use thin archives rather than incremental linking for built-in.o, similar to recent change to Linux. built-in.o is renamed to built-in.a, and is created as a thin archive with no index, for speed and size. All built-in.a are aggregated into a skiboot.tmp.a which is a thin archive built with an index, making it suitable or linking. This is input into the final link. The advantags of build size and linker code placement flexibility are not as great with skiboot as a bigger project like Linux, but it's a conceptually better way to build, and is more compatible with link time optimisation in toolchains which might be interesting for skiboot particularly for size reductions. Size of build tree before this patch is 34.4MB, afterwards 23.1MB. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2018-02-28libstb/secureboot: Fix logging of secure verify messages.Pridhiviraj Paidipeddi1-12/+19
Currently we are logging secure verify/enforce messages in PR_EMERG level even when there is no secureboot mode enabled. So reduce the log level to PR_ERR when secureboot mode is OFF. Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2018-02-13stb: Put correct label (for skiboot) into containerStewart Smith1-2/+8
Hostboot will expect the label field of the stb header to contain "PAYLOAD" for skiboot or it will fail to load and run skiboot. The failure looks something like this: 53.40896|ISTEP 20. 1 - host_load_payload 53.65840|secure|Secureboot Failure plid = 0x90000755, rc = 0x1E07 53.65881|System shutting down with error status 0x1E07 53.67547|================================================ 53.67954|Error reported by secure (0x1E00) PLID 0x90000755 53.67560| Container's component ID does not match expected component ID 53.67561| ModuleId 0x09 SECUREBOOT::MOD_SECURE_VERIFY_COMPONENT 53.67845| ReasonCode 0x1e07 SECUREBOOT::RC_ROM_VERIFY 53.67998| UserData1 : 0x0000000000000000 53.67999| UserData2 : 0x0000000000000000 53.67999|------------------------------------------------ 53.68000| Callout type : Procedure Callout 53.68000| Procedure : EPUB_PRC_HB_CODE 53.68001| Priority : SRCI_PRIORITY_HIGH 53.68001|------------------------------------------------ 53.68002| Callout type : Procedure Callout 53.68003| Procedure : EPUB_PRC_FW_VERIFICATION_ERR 53.68003| Priority : SRCI_PRIORITY_HIGH 53.68004|------------------------------------------------ Reported-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com> Tested-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2018-02-08stb: Enforce secure boot if called before libstb initializedStewart Smith1-0/+1
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2018-02-08stb: Correctly error out when no PCR for resourceStewart Smith1-1/+2
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2018-02-08libstb: fix failure of calling trusted measure without STB initialization.Pridhiviraj Paidipeddi1-0/+10
When we load a flash resource during OPAL init, STB calls trusted measure to measure the given resource. There is a situation when a flash gets loaded before STB initialization then trusted measure cannot measure properly. So this patch fixes this issue by calling trusted measure only if the corresponding trusted init was done. The ideal fix is to make sure STB init done at the first place during init and then do the loading of flash resources, by that way STB can properly verify and measure the all resources. Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2018-02-08libstb: fix failure of calling cvc verify without STB initialization.Pridhiviraj Paidipeddi1-0/+9
Currently in OPAL init time at various stages we are loading various PNOR partition containers from the flash device. When we load a flash resource STB calls the CVC verify and trusted measure(sha512) functions. So when we have a flash resource gets loaded before STB initialization, then cvc verify function fails to start the verify and enforce the boot. Below is one of the example failure where our VERSION partition gets loading early in the boot stage without STB initialization done. This is with secure mode off. STB: VERSION NOT VERIFIED, invalid param. buf=0x305ed930, len=4096 key-hash=0x0 hash-size=0 In the same code path when secure mode is on, the boot process will abort. So this patch fixes this issue by calling cvc verify only if we have STB init was done. And also we need a permanent fix in init path to ensure STB init gets done at first place and then start loading all other flash resources. Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2018-02-07libstb/tpm_chip: Add missing new line to print messages.Pridhiviraj Paidipeddi1-2/+2
Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2018-02-07libstb: increase the log level of verify/measure messages to PR_NOTICE.Pridhiviraj Paidipeddi2-2/+2
Currently libstb logs the verify and hash caluculation messages in PR_INFO level. So when there is a secure boot enforcement happens in loading last flash resource(Ex: BOOTKERNEL), the previous verify and measure messages are not logged to console, which is not clear to the end user which resource is verified and measured. So this patch fixes this by increasing the log level to PR_NOTICE. Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2018-01-19libstb/cvc: Register P8 secure ROM code correctlyStewart Smith1-2/+2
Register the location of the secure ROM, not the address of the location. Fixes: 594c7a6ae3ccc Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-12-20allow secure boot if not enforcing itStewart Smith1-6/+0
We check the secure boot containers no matter what, only *enforcing* secure boot if we're booting in secure mode. This gives us an extra layer of checking firmware is legit even when secure mode isn't enabled, as well as being really useful for testing. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-12-18libstb/(create|print)-container: Sync with sb-signing-utilsStewart Smith14-386/+1573
The sb-signing-utils project has improved upon the skeleton create-container tool that existed in skiboot, including being able to (quite easily) create *signed* images. This commit brings in that code (and makes it build in the skiboot build environment) and updates our skiboot.*.stb generating code to use the development keys. We also update print-container as well, syncing it with the upstream project. Derived from github.com:open-power/sb-signing-utils.git at v0.3-5-gcb111c03ad7f (and yes, changes here will be submitted upstream) Cc: Dave Heller <hellerda@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-12-18libstb/cvc: update memory-region to point to /reserved-memoryClaudio Carvalho2-1/+33
The linux documentation, reserved-memory.txt, says that memory-region is a phandle that pairs to a children of /reserved-memory. This updates /ibm,secureboot/ibm,cvc/memory-region to point to /reserved-memory/secure-crypt-algo-code instead of /ibm,hostboot/reserved-memory/secure-crypt-algo-code. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-12-18libstb: add support for ibm, secureboot-v2Claudio Carvalho3-0/+71
ibm,secureboot-v2 changes: - The Container Verification Code is represented by the ibm,cvc node. - Each ibm,cvc child describes a CVC service. - hash-algo is superseded by hw-key-hash-size. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-12-18libstb: remove stb.c and obsolete companionsClaudio Carvalho10-762/+2
This removes all the files that were replaced by secureboot.c, trustedboot.c and cvc.c. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-12-18libstb/tpm_chip.c: define pr_fmt and fix messages loggedClaudio Carvalho1-36/+42
This defines pr_fmt and also fix messages logged: - EV_SEPARATOR instead of 0xFFFFFFFF - when an event is measured it also prints the tpm id, event type and event log length (yay!) Now we can filter the messages logged by libstb and its sub-modules by running: $> grep STB /sys/firmware/opal/msglog Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-12-18libstb/tss: update the list of event types supportedClaudio Carvalho2-6/+28
Skiboot, precisely the tpmLogMgr, initializes the firmware event log by calculating its length so that a new event can be recorded without exceeding the log size. In order to calculate the size, it walks through the log until it finds an especific event type. However, if the log has an unknown event type, the tpmLogMgr will not be able to reach the end of the log. This updates the list of event types with all of those supported by hostboot. Thus, skiboot can properly calculate the event log length. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-12-18tpm_i2c_nuvoton: add nuvoton, npct601 to the compatible propertyClaudio Carvalho1-0/+10
The linux kernel doesn't have a driver compatible with "nuvoton,npct650", but it does have for "nuvoton,npct601", which should also be compatible with npct650. This adds "nuvoton,npct601" to the compatible devtree property. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-12-18libstb/trustedboot.c: import stb_final() from stb.cClaudio Carvalho2-0/+79
The stb_final() primary goal is to measure the event EV_SEPARATOR into PCR[0-7] when trusted boot is about to exit the boot services. This imports the stb_final() from stb.c into trustedboot.c, but making the following changes: - Rename it to trustedboot_exit_boot_services(). - As specified in the TCG PC Client spec, EV_SEPARATOR events must be logged with the name 0xFFFFFF. - Remove the rom driver clean-up call. - Don't allow code to be measured in skiboot after trustedboot_exit_boot_services() is called. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-12-18libstb/cvc.c: import softrom behavior from drivers/sw_driver.cClaudio Carvalho3-1/+21
Softrom is used only for testing with mambo. By setting compatible="ibm,secureboot-v1-softrom" in the "ibm,secureboot" node, firmware images can be properly measured even if the Container-Verification-Code (CVC) is not available. In this case, the mbedtls_sha512() function is used to calculate the sha512 hash of the firmware images. This imports the softrom behavior from libstb/drivers/sw_driver.c code into cvc.c, but now softrom is implemented as a flag. When the flag is set, the wrappers for the CVC services work the same way as in sw_driver.c. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-12-18libstb/trustedboot.c: import tb_measure() from stb.cClaudio Carvalho5-2/+173
This imports tb_measure() from stb.c, but now it calls the CVC sha512 wrapper to calculate the sha512 hash of the firmware image provided. In trustedboot.c, the tb_measure() is renamed to trustedboot_measure(). The new function, trustedboot_measure(), no longer checks if the container payload hash calculated at boot time matches with the hash found in the container header. A few reasons: - If the system admin wants the container header to be checked/validated, the secure boot jumper must be set. Otherwise, the container header information may not be reliable. - The container layout is expected to change over time. Skiboot would need to maintain a parser for each container layout change. - Skiboot could be checking the hash against a container version that is not supported by the Container-Verification-Code (CVC). The tb_measure() calls are updated to trustedboot_measure() in a subsequent patch. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-12-18libstb/secureboot.c: import sb_verify() from stb.cClaudio Carvalho5-6/+131
This imports the sb_verify() function from stb.c, but now it calls the CVC verify wrapper in order to verify signed firmware images. The hw-key-hash and hw-key-hash-size initialized in secureboot.c are passed to the CVC verify function wrapper. In secureboot.c, the sb_verify() is renamed to secureboot_verify(). The sb_verify() calls are updated in a subsequent patch. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-12-18libstb: import stb_init() breaking it into multiple filesClaudio Carvalho10-24/+501
This imports stb_init() from stb.c, but breaking it into multiple files in order to make the code easier to read and to maintain. New files created: secureboot.c, trustedboot.c and cvc.c. The secureboot_init() in secureboot.c also initializes the hardware key hash and the hardware key hash size, which are used to call the CVC verify wrapper. These variables were initialized in the romcode_probe() function, libstb/drivers/romcode.c. The cvc_init() in cvc.c is slightly modified from what exists in stb_init(). Now it calls cvc_register() and cvc_service_register(). Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-12-18libstb: move drivers/sha512.* to mbedtls directoryClaudio Carvalho6-3/+15
The drivers/sha512.c file is a SHA512 hash implementation imported from the mbed TLS project. As a matter of semantics, this moves drivers/sha512.* to the mbedtls directory. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-10-02i2c: Move tpm i2c wrapper code into coreAndrew Donnellan2-95/+11
The TPM code has a wrapper around the main i2c API to allow synchronous use. Move it into core/i2c.c so it can be used by other possible users. In particular, a future patch will use this to drive OpenCAPI device resets during boot time. Cc: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Cc: Frederic Barrat <fbarrat@linux.vnet.ibm.com> Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-06-26Big log level reduction...Benjamin Herrenschmidt1-2/+2
90% of what we print isn't useful to a normal user. This dramatically reduces the amount of messages printed by OPAL in normal circumstances. We still need to add a way to bump the log level at boot based on a BMC scratch register or some HDAT property. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-05-18libstb: Fix build in OpenSSL 1.1Russell Currey1-4/+11
OpenSSL has some API changes which causes a build break in libstb. Specifically, directly accessing some members of a signature now requires using a helper. This fixes things in OpenSSL 1.1 and has no effect on OpenSSL 1.0. The build failure was as follows: [ HOSTCC ] libstb/create-container.c In file included from /usr/include/openssl/asn1.h:24:0, from /usr/include/openssl/ec.h:30, from libstb/create-container.c:36: libstb/create-container.c: In function ‘getSigRaw’: libstb/create-container.c:104:31: error: dereferencing pointer to incomplete type ‘ECDSA_SIG {aka struct ECDSA_SIG_st}’ rlen = BN_num_bytes(signature->r); ^ Signed-off-by: Russell Currey <ruscur@russell.cc> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-05-12tpm_i2c_nuvoton: fix use-after-free in tpm_register_chip failure pathStewart Smith1-1/+3
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-05-08libstb/create-container: Fix coverity warningsDave Heller1-1/+2
Signed-off-by: Dave Heller <hellerda@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-04-07libstb/create-container: Add full container build and sign with imprint keysDave Heller4-12/+415
This adds support for writing all the public key and signature fields to the container header, and for dumping the prefix and software headers so they may may be signed, and for signing those headers with the imprint keys. Signed-off-by: Dave Heller <hellerda@linux.vnet.ibm.com> [stewart@linux.vnet.ibm.com: fixup warnings&build, include openssl-devel in CI dockerfiles] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-03-16Makefile: Update clean target for stbMichael Neuling1-0/+5
stb leaves a bunch of files around even after clean. Fix this. Signed-off-by: Michael Neuling <mikey@neuling.org> [stewart@linux.vnet.ibm.com: use explicit TARGET rather than *.stb] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-12-22print-stb-container: Fix build on centos7Stewart Smith1-2/+3
Because of ordering of include files, we got: /usr/include/bits/stat.h:106:31: error: expected identifier or '(' before '[' token __syscall_slong_t __unused[3]; Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-12-02i2c: Add nuvoton quirk, disallowing i2cdetect as it locks TPMStewart Smith1-0/+28
In TPM 2.0 Firmware 1.3.0.1 and 1.3.1.0 (at least) there exists a bug where if you send the wrong thing to the TPM it may lock the bus, with no way of recovery except powering the TPM off/on. On our current systems, the only way to power the TPM off/on is to pull the power on the system (*NOT* just power off/on to host from BMC). So, this patch adds the ability to do things to the i2c request really early on, well before it hits any hardware, such as quickly drop it. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-29tpm_i2c_nuvoton: work out the polling time using mftb()Claudio Carvalho1-26/+45
Currently, the polling time is calculated by adding the sleep time to it. This calculates the polling time by taking timestamps with mftb() before calling the i2c-interface to send an i2c request to the tpm. Thus having a much more accurate polling time. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-29tpm_i2c_nuvoton: handle errors after reading the tpm fifoClaudio Carvalho1-1/+11
This adds code to handle errors after reading the tpm fifo in tpm_read_fifo(). Fixes: 56ad053c3e8bf0764ad5878cb018f00a389d30cf Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-29tpm_i2c_nuvoton: cleanup variables in tpm_read_fifo()Claudio Carvalho1-17/+11
The tpm_read_fifo() has unnecessary and not so intuitive variables. This cleans up these variables. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-29tpm_i2c_nuvoton: handle errors after writting the tpm fifoClaudio Carvalho1-2/+11
This adds code to handle errors after writting the tpm fifo in tpm_write_fifo(). Fixes: 56ad053c3e8bf0764ad5878cb018f00a389d30cf Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-29tpm_i2c_nuvoton: cleanup variables in tpm_write_fifo()Claudio Carvalho1-27/+23
The tpm_write_fifo() has unnecessary and not so intuitive variables. This cleans up these variables. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-29tpm_i2c_nuvoton: handle errors after writing sts.commandReady in step 5Claudio Carvalho1-1/+11
This adds code to handle errors after writting the sts.commandReady to release the tpm. Fixes: 56ad053c3e8bf0764ad5878cb018f00a389d30cf Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-29tpm_i2c_nuvoton: handle errors after writing sts.goClaudio Carvalho1-2/+11
This handles errors returned by the tpm-i2c interface after writing sts.go in tpm_transmit(). Fixes: 56ad053c3e8bf0764ad5878cb018f00a389d30cf Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-29tpm_i2c_nuvoton: handle errors after checking the tpm fifo statusClaudio Carvalho1-66/+86
The functions tpm_is_expecting() and tpm_is_data_avail() ignore the errors returned by the tpm-i2c interface. This adds code to handle erros after checking the tpm fifo status. The tpm_is_expecting() and tpm_is_data_avail() functions are replaced by tpm_wait_for_fifo_status(). Fixes: 56ad053c3e8bf0764ad5878cb018f00a389d30cf Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-29tpm_i2c_nuvoton: return burst_count in tpm_read_burst_count()Claudio Carvalho1-21/+19
This returns burst_count as opposed to pass it as a parameter. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-29tpm_i2c_nuvoton: isolate the code that handles the TPM_TIMEOUT_D timeoutClaudio Carvalho1-124/+95
TPM_TIMEOUT_D timeout is only related to burst_count polling. This moves the burstCount polling code to tpm_read_burst_count() in order to isolate the code that is related to TPM_TIMEOUT_D. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-29tpm_i2c_nuvoton: handle errors after reading sts.commandReadyClaudio Carvalho1-32/+50
This adds code to handle errors after reading sts.commandReady. The nested loop in tpm_poll_for_command_ready() is splitted in two functions. Fixes: 56ad053c3e8bf0764ad5878cb018f00a389d30cf Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-29tpm_i2c_nuvoton: add tpm_status_read_byte()Claudio Carvalho1-9/+10
The tpm status register is read from multiple places by calling the tpm-i2c-interface. This adds the tpm_status_read_byte() to be the only function that directly calls the tpm-i2c interface to read the tpm status register Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-29tpm_i2c_nuvoton: add tpm_check_status()Claudio Carvalho1-10/+16
This adds the tpm_check_status(), which makes the code more easy to read and also allows the use of a mask to check status. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-29tpm_i2c_nuvoton: rename defines to shorter namesClaudio Carvalho1-49/+44
This shorten some defines to better fit in 80 columms. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-24tpm_i2c_interface: decouple rc from being done with i2c requestStewart Smith1-4/+14
This ensures the i2c subsystem is done with the i2c request before we continue. Since it handles timeouts, we don't have to here. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com> Tested-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-24tpm_i2c_interface: set timeout before each requestStewart Smith1-1/+1
The i2c code manipulates req->timeout, so it has to be reset before re-sending. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com> Tested-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>