[SeaBIOS] SeaBIOS recognising USB 3.0 on boot works - partly

2015-11-29 Thread edward wandasiewicz
Running SeaBIOS on a Chromebook Pixel 2015, by default, does not
recognise a plugged in USB 3.0 device attached to a USB 3.0 port or
Type C port.

As of 28 Nov, I ran ./flash_chromebook_rom.sh

from

https://johnlewis.ie/custom-chromebook-firmware/rom-download/

to get Johns most current SeaBIOS which will overwrite the RW_LEGACY slot.



This will recognise some but not all USB devices. It would see my USB
Phillips drive, just the once, but not the Mushkin drive at all.



I then tried reverting the SeaBIOS back to Google's version. Running
Google's ChromeOS recovery, for some reason, does not write or touch
the RW_LEGACY slot at all.


John Lewis SeaBIOS was still there after a ChromeOS recovery. Hmm...

I later found out, other Google ChromeOS recovery images do touch and
overwrite the RW_LEGACY slot, but not for the Pixel 2015 SAMUS for
some reason - bug maybe in the recovery?


With some help from John to extract the shell-ball and manually
overwrite the RW_LEGACY slot from the binary inside the ChromeOS
recovery image

by following the instructions at

https://johnlewis.ie/extracting-the-shell-ball-rom-using-a-chromeos-image/



Write the hardware ID to get future ChromeOS updates

$ ./gbb_utility --set --hwid="SAMUS XXX-YYY-ZZZ" bios.bin bios.hwid.bin


# dd out 2 megs of the ROM at 4 megs in

$ dd bs=1M skip=4 count=2 if=bios.hwid.bin of=rwlegacy.cbfs



Using the flashrom from John's site as upstream doesn't know anything
about flashmap.

$ wget https://johnlewis.ie/Chromebook-ROMs/utils/flashrom -O flashrom.jlewis

$ sudo ./flashrom.jlewis -w -i RW_LEGACY:rwlegacy.cbfs


We now have our original Google version SeaBIOS. But what's this...
Before with Google's SeaBIOS, I had no USB 3.0 device got recognised.
Now it's recognising all of them, all of the time.

But not quite... I have one USB device, a Philips USB 3.0 device,
which for some reason, is appearing not once, but twice in the list of
bootable devices, yet only one and only one Philips USB drive is
attached.


So it appears, we have half a working solution from Google's own
RW_LEGACY, and half a working solution from John's RW_LEGACY.



***
USB 3.0 Devices attached directly to USB 3.0 ports or Type C
***

One - Philips USB 3.0 Flash drive
One - Mushkin Ventura Ulta



*
Google Output
*

SeaBIOS (version -20150402_151143-build122-m2)

Press ESC for boot menu.

Select boot device:

1. USB MSC Drive Philips USB Flash Drive PMAP
2 AHCI/O: KINGSTON RBU-SUS151S364GD ATA-10 Hard-Disk (61057 M
3. USB MSC Drive Philips USB Flash Drive PMAP
4. USB MSC Drive Mushkin Ventura Ultra



**
John Lewis Output
**
Press ESC for boot menu.

Select boot device:

1. USB MSC Drive Philips USB Flash Drive PMAP
2 AHCI/O: KINGSTON RBU-SUS151S364GD ATA-10 Hard-Disk (61057 M

Edward

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


[SeaBIOS] [PATCH 2/3] tpm: Check length parameter of the array

2015-11-29 Thread Stefan Berger
From: Stefan Berger 

Check the length parameter that indicates the length of the array
for whether it has a minimum value of 0x200.

Signed-off-by: Stefan Berger 
---
 src/tcgbios.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/tcgbios.c b/src/tcgbios.c
index c17d80d..285723c 100644
--- a/src/tcgbios.c
+++ b/src/tcgbios.c
@@ -766,6 +766,9 @@ tpm_add_bcv(u32 bootdrv, const u8 *addr, u32 length)
 if (!has_working_tpm())
 return TCG_GENERAL_ERROR;
 
+if (length < 0x200)
+return TCG_INVALID_INPUT_PARA;
+
 const char *string = "Booting BCV device 00h (Floppy)";
 if (bootdrv == 0x80)
 string = "Booting BCV device 80h (HDD)";
-- 
2.4.3


___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH 3/3] tpm: Add a menu for TPM configuration

2015-11-29 Thread Peter Stuge
Stefan Berger wrote:
> +++ b/src/tcgbios.c
> +static u32
> +read_stclear_flags(char *buf, int buf_len)
> +{
..
> +if (rc || returnCode)
> +goto err_exit;
..
> +err_exit:
> +dprintf(DEBUG_tcg, "TCGBIOS: TPM malfunctioning (line %d).\n", __LINE__);

I can't help but think that it would be significantly more useful to
turn the "goto err_exit" into a macro everywhere. Something like:

#define malfunc_err_exit() do { \
  dprintf(DEBUG_tcg, "TCGBIOS: TPM malfunctioning (line %d).\n", __LINE__); \
  goto err_exit; \
} while (0)

..so that the line number of the actual problem is output.


//Peter

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH 3/3] tpm: Add a menu for TPM configuration

2015-11-29 Thread Peter Stuge
Sorry, should have sent all in one email.

Stefan Berger wrote:
> +if (enable)
> +dprintf(DEBUG_tcg, "Return code from TPM_PhysicalEnable = 0x%08x\n",
> +*returnCode);
> +else
> +dprintf(DEBUG_tcg, "Return code from TPM_PhysicalDisable = 0x%08x\n",
> +*returnCode);

Maybe simplify this to one string with %s + enable ? "Enable" : "Disable" ?


> +err_exit:
> +if (enable)
> +dprintf(DEBUG_tcg, "TCGBIOS: Enabling the TPM failed.\n");
> +else
> +dprintf(DEBUG_tcg, "TCGBIOS: Disabling the TPM failed.\n");

Same here.


> +dprintf(DEBUG_tcg, "TCGBIOS: TPM malfunctioning (line %d).\n", __LINE__);

See last email. This dprintf() seems a bit redundant with the error
in the lines above.


> +if (pf.flags[PERM_FLAG_IDX_DISABLE]) {
> +if (verbose)
> +printf("TPM must first be enable.\n");

Typo: enabled


> +tpm_process_cfg(const tpm_bios_cfg *cfg, int verbose, u32 *returnCode)
..
> +if (rc)
> +printf("Op %d: An error occurred: 0x%x TPM return code: 0x%x\n",
> +   cfg->op, rc, *returnCode);

Maybe add a %s __func__ or some word about where this happened.


> +show_tpm_menu(int state, int next_scancodes[7])

Are scancodes really 32-bit? If you use a fixed size that's
presumably to save a bit of memory. I would prefer next_scancodes to
be dynamically sized according to some number of possible scancodes
in an enum or somesuch which is known at compile time, and for it to
be an array of unsigned char/uint8_t or uint16_t, as appropriate for
the hardware. IIRC scancodes are 8 bit?


> +if (state & TPM_STATE_ENABLED)
> +printf("  Enabled");
> +else
> +printf("  Disabled");

I'd use %s ? : for these but that's a matter of taste.


> +void
> +tpm_menu(void)
> +{
..
> +printf("The Trusted Platform Module (TPM) is a hardware device in "
> +   "this machine.\n"

This is not universally true. I believe that the ME implements TPM in
software on recent platforms.


In this patch there is also an msleep(2000) call. Please avoid adding
unneccessary delays to the code.


Thanks!

//Peter

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios