Set tcpa calls in the rombios and other fixes
PATCH 1/1 Set tcpa calls in the rombios and other fixes
This patch places some tcpa calls into the rombios that had previously not applied anymore or were not set.
Force the reads from MMIO memory locations that the compiler otherwise optimizes away (-O2) if there was an immediate write to the same memory location before.
Use #define'd constants wherever possible.
Fix all remaining compiler warnings.
Signed-off-by Stefan Berger <[email protected]>
xen-unstable.hg/tools/firmware/rombios/32bit/tcgbios/tcgbios.c +6 -8
@@ -146,7 +146,7 @@ static tcpa_acpi_t tcpa_acpi;static int tpm_driver_to_use =TPM_INVALID_DRIVER ;static -uint32_t MA_IsTPMPresent () +uint32_t MA_IsTPMPresent (void ) {uint32_t rc =0 ;unsigned int i;
@@ -263,11 +263,11 @@ void tcpa_acpi_init(void) {struct acpi_20_rsdt *rsdt;uint32_t length; -struct acpi_20_tcpa *tcpa; +struct acpi_20_tcpa *tcpa = (void *)0 ;uint16_t found =0 ;uint16_t rsdp_off;uint16_t off; -struct acpi_20_rsdp *rsdp; +struct acpi_20_rsdp *rsdp = (void *)0 ;if (MA_IsTPMPresent () ==0 ) {return ;
@@ -732,8 +732,8 @@ void tcpa_ipl(Bit32u seg)void tcpa_measure_post (Bit32u from,Bit32u to) {struct pcpes pcpes;/* PCClientPCREventStruc */ -memset (&pcpes,0x0 ,sizeof (pcpes));int len = to - from; +memset (&pcpes,0x0 ,sizeof (pcpes));if (len >0 ) { sha1((unsigned char *)from,
@@ -986,7 +986,7 @@ uint32_t PassThroughToTPM32(struct pttti {uint32_t rc =0 ;uint8_t *cmd32; -uint32_t resbuflen; +uint32_t resbuflen =0 ;if (TCG_IsShutdownPreBootInterface () !=0 ) { rc = (TCG_PC_TPMERROR |
@@ -1277,9 +1277,7 @@ typedef struct _sha1_ctx { } sha1_ctx; -static inline uint32_t rol (val, rol) -uint32_t val; -uint16_t rol; +static inline uint32_t rol (uint32_t val,uint16_t rol) {return (val << rol) | (val >> (32 - rol)); }
xen-unstable.hg/tools/firmware/rombios/rombios.c +10 -3
@@ -5722,9 +5722,6 @@ int13_cdemu(DS, ES, DI, SI, BP, SP, BX, goto int13_fail; } -#if BX_TCGBIOS -tcpa_ipl ((Bit32u )bootseg);/* specs: 8.2.3 steps 4 and 5 */ -#endif switch (GET_AH ()) {
@@ -7741,6 +7738,10 @@ ASM_END } } +#if BX_TCGBIOS +tcpa_add_bootdevice ((Bit32u )0L , (Bit32u )bootdrv); +#endif +/* Canonicalize bootseg:bootip */ bootip = (bootseg &0x0fff ) <<4 ; bootseg &=0xf000 ;
@@ -7760,6 +7761,9 @@ ASM_END bootdrv = (Bit8u)(status>>8 ); bootseg =read_word (ebda_seg,&EbdaData->cdemu.load_segment);/* Canonicalize bootseg:bootip */ +#if BX_TCGBIOS +tcpa_add_bootdevice ((Bit32u )1L , (Bit32u )0L ); +#endif bootip = (bootseg &0x0fff ) <<4 ; bootseg &=0xf000 ;break ;
@@ -7773,6 +7777,9 @@ ASM_ENDdefault :return ; } +#if BX_TCGBIOS +tcpa_ipl ((Bit32u )bootseg);/* specs: 8.2.3 steps 4 and 5 */ +#endif /* Debugging info */ printf ("Booting from %x:%x\n" , bootseg, bootip);
xen-unstable.hg/tools/firmware/rombios/32bit/tcgbios/tpm_drivers.c +34 -18
111 lines not on this page · raw message
xen-unstable.hg/tools/firmware/rombios/32bit/util.h +15 -0
@@ -24,5 +24,20 @@ void byte_to_hex(char *digits, uint8_t bvoid uuid_to_string (char *dest,uint8_t *uuid);int printf (const char *fmt, ...); +static inline uint8_t mmio_readb (uint8_t *addr) +{ +return *(volatile uint8_t *)addr; +} + +static inline uint16_t mmio_readw (uint16_t *addr) +{ +return *(volatile uint16_t *)addr; +} + +static inline uint32_t mmio_readl (uint32_t *addr) +{ +return *(volatile uint32_t *)addr; +} +#endif
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel