Commit Graph

828 Commits

Author SHA1 Message Date
Joshua Jeyaraj
306b217bc0 moving from private repo 2018-10-10 14:43:35 +05:30
mdlewisfb
3831578255 Merge pull request #107 from Telecominfraproject/ltc4274_fixes
Fixes for ltc4274
2018-10-04 12:56:34 -07:00
mdlewisfb
28f82700dc Misc inconsistency fixes for header and source code files, including fixing ltc4274_reset error with missing param. 2018-10-03 10:14:28 -07:00
mdlewisfb
55962ac120 Fixing incorrect enum typedef, issue #101 2018-10-03 10:01:10 -07:00
mdlewisfb
f70dd75754 Fix for implicit fall through, issue #102 2018-10-03 09:51:02 -07:00
mdlewisfb
2172a405d3 Fixes for Test_ocmp_eeprom.c warnings. 2018-10-03 07:55:07 -07:00
mdlewisfb
adb69fdd20 Fixes for Test_ocmp_ltc4274.c warnings. 2018-10-03 07:24:47 -07:00
mdlewisfb
4257c30a7d Fixes for Test_powerSource.c warnings. 2018-10-02 18:46:42 -07:00
mdlewisfb
497d013e9c Fixes for Test_PinGroup_driver.c and Test_pca9557.c warnings. 2018-10-02 18:45:29 -07:00
mdlewisfb
5ee3f2cd8a Fixes for Test_OcGpio.c warnings. 2018-10-02 18:36:19 -07:00
mdlewisfb
6b65c57fe4 Fixes for Test_ltc4275.c warnings. 2018-10-02 18:31:24 -07:00
mdlewisfb
40348f0ad4 Fixed missing function prototype in fake_GPIO.h 2018-10-02 16:16:37 -07:00
mdlewisfb
28bef2fa9a Fixes for Test_GpioSX1509.c warnings. 2018-10-02 16:10:20 -07:00
mdlewisfb
2bdb96355b Fixes for Test_ocmp_adt7481.c warnings. 2018-10-02 16:07:46 -07:00
mdlewisfb
842d289290 Adding -fshort-enums flag to fix Linux stack smashing error. 2018-10-02 15:50:30 -07:00
mdlewisfb
dab621bb15 Merge pull request #60 from Telecominfraproject/directory_cleanup
Directory cleanup
2018-10-02 10:29:49 -07:00
mdlewisfb
774a23c00f Reverting common/inc move 2018-10-02 10:28:26 -07:00
mdlewisfb
3537665179 Updating CCS project to point to inc/ instead of common/ 2018-10-02 10:28:25 -07:00
mdlewisfb
39c6592de4 Consolidating inc/ and common/inc directories all under inc/. 2018-10-02 10:28:24 -07:00
mdlewisfb
d3982f98dc Renaming Devices to devices for consistent directory naming. 2018-10-02 10:28:23 -07:00
Kashif Ali
31d75a0ffd Re-addig coding style guide for OCWare 2018-10-01 09:56:42 -07:00
Vishal Thakur
0b08f7a126 Updated unit test makefile with respect to the repository structure. 2018-09-28 23:40:21 -07:00
Vishal Thakur
b9761dc1cc Added Copyright header to Unit test files. 2018-09-28 23:40:16 -07:00
Vishal Thakur
973eb3b3d1 OpenCellular OCware repo merged to OpenCellular TIP repo.
> Changes done :
> 1. Shared schema between host and embedded controller.
2. Commands messages are handled at driver level.
3. Debug message type added to enable debugging on i2c, spi and gpio's.
4. Auto test capabilities added to ethernet module.
5. Unit test cases written for multiple devices like LTC4275, LTC4274, LTC4015,ADT7481, PCA9557, SX1509.
2018-09-28 23:40:11 -07:00
David Hendricks
6a28b88fbb firmware/coreboot: Subtree merge libgfxinit
Signed-off-by: David Hendricks <dhendricks@fb.com>
2018-06-14 15:36:02 -07:00
David Hendricks
6f4bd2f6eb firmware/coreboot: Subtree merged libhwbase
Signed-off-by: David Hendricks <dhendricks@fb.com>
2018-06-14 15:32:35 -07:00
David Hendricks
d4467c3e5b firmware/coreboot: Subtree merged chrome-ec
Signed-off-by: David Hendricks <dhendricks@fb.com>
2018-06-14 15:25:36 -07:00
David Hendricks
262ea45093 firmware/coreboot: Subtree merged arm-trusted-firmware
Signed-off-by: David Hendricks <dhendricks@fb.com>
2018-06-14 15:22:44 -07:00
David Hendricks
95e19f53aa firmware/coreboot: Subtree merged vboot
Signed-off-by: David Hendricks <dhendricks@fb.com>
2018-06-14 15:19:56 -07:00
David Hendricks
4833902df2 firmware/coreboot: Subtree merged blobs 2018-06-14 15:16:35 -07:00
David Hendricks
994e41f949 firmware/coreboot: Subtree merged nvidia-cbootimage 2018-06-14 15:13:32 -07:00
David Hendricks
6d6d5fecc0 firmware/coreboot: Initial import via subtree merge
Signed-off-by: David Hendricks <dhendricks@fb.com>
2018-06-14 13:12:30 -07:00
Andrey Pronin
41c585ed74 tpm_lite: stub: retry in case of TPM comm error
This CL retries reads and writes from/to TPM device if an error
is returned by read()/write(), up to 3 total attempts.

This is useful case of transient TPM communication errors that go
away after a single retry. Without this CL, after such errors the
encstateful key might be regenerated and encstateful data wiped.

BRANCH=none
BUG=chromium:702724
TEST=1) normal boot still works;
     2) simulate a single error, verify that it retries.

Change-Id: I259882209df0aad66cd083729f746ea45909922b
Reviewed-on: https://chromium-review.googlesource.com/1067939
Commit-Ready: Andrey Pronin <apronin@chromium.org>
Tested-by: Andrey Pronin <apronin@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
2018-05-24 15:44:34 -07:00
Mattias Nissler
1c98ae4fdd tpm_lite: Set O_CLOEXEC when opening TPM device.
This sets O_CLOEXEC when opening the TPM device to make sure the file
descriptor isn't shared across processes. The TPM character device
exposes the raw communication channel to send/receive commands to/from
the TPM. The TPM is not designed for concurrent access by multiple
users and the kernel driver already returns EBUSY on open when a
different process has already opened it. Consequently, it only makes
sense to have the /dev/tpm0 file descriptor be closed automatically on
exec().

None of the callers I'm aware of need to share the TPM file descriptor
across processes, and mount-encrypted has some ad-hoc code to close the
descriptor when it does fork+exec to spawn a helper. The existing code
isn't consistent and comprehensive (mount-encrypted spawns other
helpers where it forgets to close the file descriptor), so the plan is
to set O_CLOEXEC and remove the ad-hoc code.

BRANCH=None
BUG=None
TEST=Compiles, passes tests, image boots.

Change-Id: Ia6e73fb12e8f2ed8fe99b4c53ea6eb8cda4a21f5
Reviewed-on: https://chromium-review.googlesource.com/1055569
Commit-Ready: Mattias Nissler <mnissler@chromium.org>
Tested-by: Mattias Nissler <mnissler@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
2018-05-14 09:14:48 -07:00
Sam Hurst
ae602dee78 cgpt: Remove unnecessary 512-byte sector check and minimum lba count checks.
This was an oversight from a previous CL:1007498 that removed the 512 block
size restrictions.

BUG=b:77540192
BRANCH=none
TEST=manual
make runtests passed.

Change-Id: I75b3ffebcc25afdde3774bcbb4a9600215a04436
Reviewed-on: https://chromium-review.googlesource.com/1031193
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
2018-05-01 08:31:57 -07:00
Duncan Laurie
534194ead7 Add new NV and GBB flag to control UDC
This change adds a new NV and GBB flag for controlling USB device
mode behavior, adding an additional step to enable UDC on systems
that support it.

Users of this feature will need to first enable developer mode and
then enable UDC separately by running "crossystem dev_enable_udc=1".

Alternatively those without write protect enabled can set a GBB
flag to have UDC enabled by default while in developer mode.

This is based on the security reviewed proposal at
https://docs.google.com/document/d/1b6avd9xvhvljN_NKtctWrClj4mSYZ_uPmp7MmAnPwqs

BUG=b:74339386
BRANCH=poppy
TEST=manual testing on Eve device

Change-Id: I6f440320f28b033639b53246d3034bc8acc37a33
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1010769
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-04-17 15:47:13 -07:00
David Hendricks
c14b527ae5 firmware: Move EC files to a new ec/ subdirectory
This makes room for other non-EC related firmware files.

Signed-off-by: David Hendricks <dhendricks@fb.com>
2018-04-16 20:39:55 -07:00
Mattias Nissler
e4e246f15c tpm_lite: tpmc command to check owner auth
Add a command that checks whether the well-known secret (SHA1 hash of
20 zero bytes) works for owner authentication. This is accomplished by
sending a DefineSpace command for TPM_NV_INDEX_TRIAL, which will
trigger auth checks but not actually allocate an NVRAM space.
Successful command execution thus indicates that authorization was
successful. tpmc exposes the status via its exit status. This will be
used in the tpm-firmware-updater driver script to verify that the TPM
is in upgradable state.

BRANCH=None
BUG=chromium:788719
TEST=compiles

Change-Id: I630831127e0e01186650412a92643c2153fbe2ee
Reviewed-on: https://chromium-review.googlesource.com/978171
Trybot-Ready: Mattias Nissler <mnissler@chromium.org>
Tested-by: Mattias Nissler <mnissler@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
2018-04-13 10:03:39 +00:00
Mattias Nissler
dc060ace1b tpm_lite: Add TlclGetSpaceInfo
The new TlclGetSpaceInfo function returns more detailed information
about a defined NVRAM space. The existing TlclGetPermissions function
is now using TlclGetSpaceInfo behind the scenes.

BRANCH=None
BUG=chromium:788719
TEST=New unit tests.

Change-Id: I6c4f490d575788b696fd742a69e81e2767ec50f1
Reviewed-on: https://chromium-review.googlesource.com/937705
Trybot-Ready: Mattias Nissler <mnissler@chromium.org>
Tested-by: Mattias Nissler <mnissler@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
2018-04-13 10:03:37 +00:00
Mattias Nissler
ec9040c4ef tpm_lite: Add missing NVRAM attribute constants.
Add the remaining constants for NVRAM space attributes. The code
previously only declared the ones required in vboot_reference, but
that led to other code growing its own ad-hoc declarations for missing
constants. Just declare them all to simplify things.

BRANCH=None
BUG=chromium:788719
TEST=compiles

Change-Id: I749ae5e4dc1b2ba56121fe42fd136b505d8cae80
Reviewed-on: https://chromium-review.googlesource.com/937704
Trybot-Ready: Mattias Nissler <mnissler@chromium.org>
Tested-by: Mattias Nissler <mnissler@chromium.org>
Reviewed-by: Mattias Nissler <mnissler@chromium.org>
2018-04-13 10:03:35 +00:00
Mattias Nissler
2e62620ce7 tpm_lite: Support delegation family functionality.
Adds two new functions and their corresponding TPM commands to create
delegation families and list the delegation family table, respectively.
This isn't sufficient to meaningfully manage delegation families, but good
enough for the (ab)use case of storing flags in delegation family labels, which
we are going to do in order to strengthen encrypted stateful to guarantee
recreation of the encrypted file system after TPM clear..

BRANCH=None
BUG=chromium:788719
TEST=new unit tests

Change-Id: I31beb662784a8fff450b485c7cabc553944d7772
Reviewed-on: https://chromium-review.googlesource.com/817199
Trybot-Ready: Mattias Nissler <mnissler@chromium.org>
Tested-by: Mattias Nissler <mnissler@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
2018-04-13 10:03:34 +00:00
Mattias Nissler
bc5b2db15b tpm_lite: Add more general DefineSpaceEx function
Add a TlclDefineSpaceEx function that allows to pass additional
parameters when creating NVRAM spaces, i.e. owner authorization as
well as PCR bindings.

BRANCH=None
BUG=chromium:788719
TEST=New unit tests.

Change-Id: I73404c05528a89604fea3bcb1f00741fb865ba77
Reviewed-on: https://chromium-review.googlesource.com/814114
Reviewed-by: Andrey Pronin <apronin@chromium.org>
Trybot-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Trybot-Ready: Mattias Nissler <mnissler@chromium.org>
Tested-by: Mattias Nissler <mnissler@chromium.org>
2018-04-13 10:03:32 +00:00
Mattias Nissler
ac2286e8f8 tpm_lite: Implement TakeOwnership support
Add the ability to take TPM ownership. This requires two new commands:
TPM_OIAP to start an auth session and TPM_TakeOwnership to establish
ownership. TPM_TakeOwnership requires an auth session and proper
command authentication to work, which is also added.

BRANCH=None
BUG=chromium:788719
TEST=new unit tests

Change-Id: Ib70144eedb0b1c7c43b26c06529d33ccbaa51a0e
Reviewed-on: https://chromium-review.googlesource.com/790414
Reviewed-by: Andrey Pronin <apronin@chromium.org>
Tested-by: Mattias Nissler <mnissler@chromium.org>
Trybot-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Trybot-Ready: Mattias Nissler <mnissler@chromium.org>
2018-04-13 10:03:31 +00:00
Mattias Nissler
163b41233c tpm_lite: Implement ReadPubek command.
Add a TlclReadPubek library function to read the public endorsement
key.

BRANCH=None
BUG=chromium:788719
TEST=New unit tests.

Change-Id: I5f23b76b88198d656f4ba5782d2b4f25aaa082b1
Reviewed-on: https://chromium-review.googlesource.com/790413
Reviewed-by: Andrey Pronin <apronin@chromium.org>
Tested-by: Mattias Nissler <mnissler@chromium.org>
Trybot-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Trybot-Ready: Mattias Nissler <mnissler@chromium.org>
2018-04-13 10:03:28 +00:00
Sam Hurst
d6f52a05a3 cgpt: Remove hard coded 512 block size.
Remove 512 sector block size restriction so that UFS, with sector block size 4096
or greater, can be used. The sector block size is queried from the kernel with
ioctl(BLKSSZGET) or queried from depthcharge with VbExDiskGetInfo().

BUG=b:77540192
BRANCH=none
TEST=manual
make runtests passed.
Tested firmware on Kevin and boot to kernel from disk.
Executed cgpt show /dev/mmcblk0 on eve device and verified output was correct.
Should be tested on device with sector block size greater than 512.

Change-Id: I8165c8ee4da68180eecc8d12b3fb501cc5c60a5d
Reviewed-on: https://chromium-review.googlesource.com/1007498
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
2018-04-12 23:11:01 -07:00
Mattias Nissler
1fc5daa6b0 tpm_lite: Introduce cursor read helpers
Add helper functions that read a number in TPM byte order and advance
the buffer pointer in a single operation. Replace instances of this
pattern with call to the helpers. No functional changes.

BRANCH=None
BUG=None
TEST=existing unit tests

Change-Id: I96d866893ec875aafc978cbe2a55ea7f9f27542c
Reviewed-on: https://chromium-review.googlesource.com/985832
Commit-Ready: Mattias Nissler <mnissler@chromium.org>
Tested-by: Mattias Nissler <mnissler@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
2018-04-09 05:52:56 -07:00
Mattias Nissler
13fcffe754 tpm_lite: Drop FOR_TEST for tlcl.c
firmware/lib/tpm_lite.c turned off CHROMEOS_ENVIRONMENT if FOR_TEST is
enabled, resulting in a situation where code specific to
CHROMEOS_ENVIRONMENT couldn't be tested. Fortunately, AFAICS
tlcl_tests does not use FOR_TEST for anything useful any longer, so
just drop it.

BRANCH=None
BUG=None
TEST=FEATURES=test emerge-$BOARD -v1 vboot_reference

Change-Id: I7f08ef6d2343bc60a6d2982c3cc7bae0507d94d5
Reviewed-on: https://chromium-review.googlesource.com/937703
Commit-Ready: Mattias Nissler <mnissler@chromium.org>
Tested-by: Mattias Nissler <mnissler@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-04-09 05:52:55 -07:00
Duncan Laurie
0bdec67fc7 ec_sync: Go to recovery on aux fw update failure
If an aux firmware update fails enter recovery with a specific
reason code so we can identify systems that fail.

Also handle the case where the update succeeds and requests a
cold reset of the EC, first clearing the oprom flag if
necessary in order to prevent a second reset.

Unit test was added to check recovery reason for aux firmware
update failure.

BUG=b:74336712
BRANCH=eve
TEST=manual: force update to fail and ensure it goes to recovery
mode, and after successful update check that the option rom flag
is cleared before the EC reset happens.
Unit tests udpated and 'make runtests' passes.

Change-Id: I35a93892a0f8bb16eac0925ada5dfbc5c3144f8d
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/959671
Reviewed-by: Caveh Jalali <caveh@google.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-03-30 16:53:03 -07:00
Duncan Laurie
bc5a737d39 ec_sync: Add recovery reason for aux update failure
Add a distinct recovery reason for aux firmware update failures
so we have some visibility into failures in eventlog.

This is used in a subsequent commit.

BUG=b:74336712
BRANCH=eve
TEST=manual: force update failure and ensure device goes to recovery
with this reason

Change-Id: I4b215444592b7c31cd25d59ad2a52b85d504e3bf
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/959669
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: caveh jalali <caveh@chromium.org>
2018-03-28 19:34:28 -07:00
Andrey Pronin
a872e9b49e firmware: tpm2_lite: fix command/response code type
Responses and commands share the same header structure. The
tpm_code field corresponds to TPM_CC in one case and TPM_RC
in the other. Make it uint32_t (instead of TPM_CC) in the
structure to avoid confusion when dealing with responses.

BUG=chromium:825894
BRANCH=none
TEST=build

Change-Id: I07821f35b0f539a863ee97c0a08c141d0533a4de
Signed-off-by: Andrey Pronin <apronin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/981111
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-03-27 14:58:11 -07:00