ia64/xen-unstable

changeset 19075:fe2957a376fe

rombios: Simplify 32-bit gateway interface definitions.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jan 22 17:41:13 2009 +0000 (2009-01-22)
parents b10fd9f4fe38
children 9b0289a165eb
files tools/firmware/rombios/32bit/32bitbios.c tools/firmware/rombios/32bit/rombios_compat.h tools/firmware/rombios/32bit/tcgbios/tcgbios.c tools/firmware/rombios/32bitgateway.c tools/firmware/rombios/32bitprotos.h tools/firmware/rombios/rombios.c tools/firmware/rombios/tcgbios.c
line diff
     1.1 --- a/tools/firmware/rombios/32bit/32bitbios.c	Thu Jan 22 16:32:06 2009 +0000
     1.2 +++ b/tools/firmware/rombios/32bit/32bitbios.c	Thu Jan 22 17:41:13 2009 +0000
     1.3 @@ -19,35 +19,17 @@
     1.4   *
     1.5   * Author: Stefan Berger <stefanb@us.ibm.com>
     1.6   */
     1.7 +
     1.8  #include "rombios_compat.h"
     1.9 -#include "32bitprotos.h"
    1.10  
    1.11  /*
    1.12     the jumptable that will be copied into the rombios in the 0xf000 segment
    1.13     for every function that is to be called from the lower BIOS, make an entry
    1.14     here.
    1.15   */
    1.16 -#define TABLE_ENTRY(idx, func) [idx] = (uint32_t)func
    1.17 -uint32_t jumptable[IDX_LAST+1] __attribute__((section (".biosjumptable"))) =
    1.18 +uint32_t jumptable[] __attribute__((section (".biosjumptable"))) =
    1.19  {
    1.20 -	TABLE_ENTRY(IDX_TCPA_ACPI_INIT, tcpa_acpi_init),
    1.21 -	TABLE_ENTRY(IDX_TCPA_EXTEND_ACPI_LOG, tcpa_extend_acpi_log),
    1.22 -
    1.23 -	TABLE_ENTRY(IDX_TCGINTERRUPTHANDLER, TCGInterruptHandler),
    1.24 -
    1.25 -	TABLE_ENTRY(IDX_TCPA_CALLING_INT19H, tcpa_calling_int19h),
    1.26 -	TABLE_ENTRY(IDX_TCPA_RETURNED_INT19H, tcpa_returned_int19h),
    1.27 -	TABLE_ENTRY(IDX_TCPA_ADD_EVENT_SEPARATORS, tcpa_add_event_separators),
    1.28 -	TABLE_ENTRY(IDX_TCPA_WAKE_EVENT, tcpa_wake_event),
    1.29 -	TABLE_ENTRY(IDX_TCPA_ADD_BOOTDEVICE, tcpa_add_bootdevice),
    1.30 -	TABLE_ENTRY(IDX_TCPA_START_OPTION_ROM_SCAN, tcpa_start_option_rom_scan),
    1.31 -	TABLE_ENTRY(IDX_TCPA_OPTION_ROM, tcpa_option_rom),
    1.32 -	TABLE_ENTRY(IDX_TCPA_IPL, tcpa_ipl),
    1.33 -	TABLE_ENTRY(IDX_TCPA_MEASURE_POST, tcpa_measure_post),
    1.34 -
    1.35 -	TABLE_ENTRY(IDX_TCPA_INITIALIZE_TPM, tcpa_initialize_tpm),
    1.36 -
    1.37 -	TABLE_ENTRY(IDX_GET_S3_WAKING_VECTOR, get_s3_waking_vector),
    1.38 -
    1.39 -	TABLE_ENTRY(IDX_LAST       , 0)     /* keep last */
    1.40 +#define X(idx, ret, fn, args...) [idx] = (uint32_t)fn,
    1.41 +#include "32bitprotos.h"
    1.42 +#undef X
    1.43  };
     2.1 --- a/tools/firmware/rombios/32bit/rombios_compat.h	Thu Jan 22 16:32:06 2009 +0000
     2.2 +++ b/tools/firmware/rombios/32bit/rombios_compat.h	Thu Jan 22 17:41:13 2009 +0000
     2.3 @@ -89,4 +89,8 @@ static inline void write_byte(Bit16u seg
     2.4  	*addr = val;
     2.5  }
     2.6  
     2.7 +#define X(idx, ret, fn, args...) ret fn (args);
     2.8 +#include "32bitprotos.h"
     2.9 +#undef X
    2.10 +
    2.11  #endif
     3.1 --- a/tools/firmware/rombios/32bit/tcgbios/tcgbios.c	Thu Jan 22 16:32:06 2009 +0000
     3.2 +++ b/tools/firmware/rombios/32bit/tcgbios/tcgbios.c	Thu Jan 22 17:41:13 2009 +0000
     3.3 @@ -26,7 +26,6 @@
     3.4  
     3.5  #include "util.h"
     3.6  #include "tcgbios.h"
     3.7 -#include "32bitprotos.h"
     3.8  
     3.9  /* local structure and variables */
    3.10  struct ptti_cust {
    3.11 @@ -259,6 +258,10 @@ uint8_t acpi_validate_entry(struct acpi_
    3.12  }
    3.13  
    3.14  
    3.15 +/*
    3.16 +   initialize the TCPA ACPI subsystem; find the ACPI tables and determine
    3.17 +   where the TCPA table is.
    3.18 + */
    3.19  void tcpa_acpi_init(void)
    3.20  {
    3.21  	struct acpi_20_rsdt *rsdt;
    3.22 @@ -313,6 +316,16 @@ static void tcpa_reset_acpi_log(void)
    3.23  }
    3.24  
    3.25  
    3.26 +/*
    3.27 + * Extend the ACPI log with the given entry by copying the
    3.28 + * entry data into the log.
    3.29 + * Input
    3.30 + *  Pointer to the structure to be copied into the log
    3.31 + *
    3.32 + * Output:
    3.33 + *  lower 16 bits of return code contain entry number
    3.34 + *  if entry number is '0', then upper 16 bits contain error code.
    3.35 + */
    3.36  uint32_t tcpa_extend_acpi_log(uint32_t entry_ptr)
    3.37  {
    3.38  	uint32_t res = 0;
    3.39 @@ -622,7 +635,8 @@ void tcpa_wake_event()
    3.40  }
    3.41  
    3.42  /*
    3.43 - * add the boot device to the measurement log
    3.44 + * Add a measurement regarding the boot device (CDRom, Floppy, HDD) to
    3.45 + * the list of measurements.
    3.46   */
    3.47  void tcpa_add_bootdevice(uint32_t bootcd, uint32_t bootdrv)
    3.48  {
     4.1 --- a/tools/firmware/rombios/32bitgateway.c	Thu Jan 22 16:32:06 2009 +0000
     4.2 +++ b/tools/firmware/rombios/32bitgateway.c	Thu Jan 22 17:41:13 2009 +0000
     4.3 @@ -47,8 +47,6 @@
     4.4  #define PM_32BIT_DS  (gdt_entry_pm_32bit_ds - gdt_base)
     4.5  #define PM_16BIT_DS  (gdt_entry_pm_16bit_ds - gdt_base)
     4.6  
     4.7 -ASM_START
     4.8 -
     4.9      .align 16
    4.10  gdt_base:
    4.11      .word 0,0
    4.12 @@ -178,20 +176,11 @@ upcall4:
    4.13      popf
    4.14      ret
    4.15  
    4.16 -/* macro for functions to declare their call into 32bit space */
    4.17  MACRO DoUpcall
    4.18      mov bx, #?1
    4.19      jmp Upcall
    4.20  MEND
    4.21  
    4.22 -ASM_END
    4.23 -
    4.24 +#define X(idx, ret, fn, args...) _ ## fn: DoUpcall(idx)
    4.25  #include "32bitprotos.h"
    4.26 -#include "tcgbios.c"
    4.27 -
    4.28 -Bit32u get_s3_waking_vector()
    4.29 -{
    4.30 -    ASM_START
    4.31 -    DoUpcall(IDX_GET_S3_WAKING_VECTOR)
    4.32 -    ASM_END
    4.33 -}
    4.34 +#undef X
     5.1 --- a/tools/firmware/rombios/32bitprotos.h	Thu Jan 22 16:32:06 2009 +0000
     5.2 +++ b/tools/firmware/rombios/32bitprotos.h	Thu Jan 22 17:41:13 2009 +0000
     5.3 @@ -1,47 +1,15 @@
     5.4 -#ifndef PROTOS_HIGHBIOS
     5.5 -#define PROTOS_HIGHBIOS
     5.6 -
     5.7 -/* shared include file for bcc and gcc */
     5.8 -
     5.9 -/* bcc does not like 'enum' */
    5.10 -#define IDX_TCGINTERRUPTHANDLER            0
    5.11 -#define IDX_TCPA_ACPI_INIT                 1
    5.12 -#define IDX_TCPA_EXTEND_ACPI_LOG           2
    5.13 -#define IDX_TCPA_CALLING_INT19H            3
    5.14 -#define IDX_TCPA_RETURNED_INT19H           4
    5.15 -#define IDX_TCPA_ADD_EVENT_SEPARATORS      5
    5.16 -#define IDX_TCPA_WAKE_EVENT                6
    5.17 -#define IDX_TCPA_ADD_BOOTDEVICE            7
    5.18 -#define IDX_TCPA_START_OPTION_ROM_SCAN     8
    5.19 -#define IDX_TCPA_OPTION_ROM                9
    5.20 -#define IDX_TCPA_IPL                       10
    5.21 -#define IDX_TCPA_INITIALIZE_TPM            11
    5.22 -#define IDX_TCPA_MEASURE_POST              12
    5.23 -#define IDX_GET_S3_WAKING_VECTOR           13
    5.24 -#define IDX_LAST                           14 /* keep last! */
    5.25 -
    5.26 -#ifdef GCC_PROTOS
    5.27 -  #define PARMS(x...) x
    5.28 -#else
    5.29 -  /* bcc doesn't want any parameter types in prototypes */
    5.30 -  #define PARMS(x...)
    5.31 -#endif
    5.32 -
    5.33 -Bit32u TCGInterruptHandler( PARMS(pushad_regs_t *regs, Bit32u esds, Bit32u flags_ptr));
    5.34 -
    5.35 -void tcpa_acpi_init( PARMS(void) );
    5.36 -Bit32u tcpa_extend_acpi_log( PARMS(Bit32u entry_ptr) );
    5.37 -void tcpa_calling_int19h( PARMS(void) );
    5.38 -void tcpa_returned_int19h( PARMS(void) );
    5.39 -void tcpa_add_event_separators( PARMS(void) );
    5.40 -void tcpa_wake_event( PARMS(void) );
    5.41 -void tcpa_add_bootdevice( PARMS(Bit32u bootcd, Bit32u bootdrv) );
    5.42 -void tcpa_start_option_rom_scan( PARMS(void) );
    5.43 -void tcpa_option_rom( PARMS(Bit32u seg) );
    5.44 -void tcpa_ipl( PARMS(Bit32u bootcd,Bit32u seg,Bit32u off,Bit32u count) );
    5.45 -void tcpa_measure_post( PARMS(Bit32u from, Bit32u to) );
    5.46 -Bit32u tcpa_initialize_tpm( PARMS(Bit32u physpres) );
    5.47 -
    5.48 -Bit32u get_s3_waking_vector( PARMS(void) );
    5.49 -
    5.50 -#endif
    5.51 +X(0,  Bit32u, TCGInterruptHandler,
    5.52 +  pushad_regs_t *regs, Bit32u esds, Bit32u flags_ptr)
    5.53 +X(1,  void,   tcpa_acpi_init, void)
    5.54 +X(2,  Bit32u, tcpa_extend_acpi_log, Bit32u entry_ptr)
    5.55 +X(3,  void,   tcpa_calling_int19h,void)
    5.56 +X(4,  void,   tcpa_returned_int19h, void)
    5.57 +X(5,  void,   tcpa_add_event_separators, void)
    5.58 +X(6,  void,   tcpa_wake_event, void)
    5.59 +X(7,  void,   tcpa_add_bootdevice, Bit32u bootcd, Bit32u bootdrv)
    5.60 +X(8,  void,   tcpa_start_option_rom_scan, void)
    5.61 +X(9,  void,   tcpa_option_rom, Bit32u seg)
    5.62 +X(10, void,   tcpa_ipl, Bit32u bootcd, Bit32u seg, Bit32u off, Bit32u count)
    5.63 +X(11, void,   tcpa_measure_post, Bit32u from, Bit32u to)
    5.64 +X(12, Bit32u, tcpa_initialize_tpm, Bit32u physpres)
    5.65 +X(13, Bit32u, get_s3_waking_vector, void)
     6.1 --- a/tools/firmware/rombios/rombios.c	Thu Jan 22 16:32:06 2009 +0000
     6.2 +++ b/tools/firmware/rombios/rombios.c	Thu Jan 22 17:41:13 2009 +0000
     6.3 @@ -726,7 +726,9 @@ typedef struct {
     6.4      } cdemu_t;
     6.5  #endif // BX_ELTORITO_BOOT
     6.6  
     6.7 +#define X(idx, ret, fn, arg...) ret fn ();
     6.8  #include "32bitprotos.h"
     6.9 +#undef X
    6.10  
    6.11    // for access to EBDA area
    6.12    //     The EBDA structure should conform to
    6.13 @@ -9497,8 +9499,9 @@ use16 386
    6.14  
    6.15  #endif
    6.16  
    6.17 +#include "32bitgateway.c"
    6.18  ASM_END
    6.19 -#include "32bitgateway.c"
    6.20 +#include "tcgbios.c"
    6.21  ASM_START
    6.22  
    6.23  ;--------------------
     7.1 --- a/tools/firmware/rombios/tcgbios.c	Thu Jan 22 16:32:06 2009 +0000
     7.2 +++ b/tools/firmware/rombios/tcgbios.c	Thu Jan 22 17:41:13 2009 +0000
     7.3 @@ -25,162 +25,6 @@
     7.4    Support for TCPA ACPI logging
     7.5   ******************************************************************/
     7.6  
     7.7 -/*
     7.8 - * Extend the ACPI log with the given entry by copying the
     7.9 - * entry data into the log.
    7.10 - * Input
    7.11 - *  Pointer to the structure to be copied into the log
    7.12 - *
    7.13 - * Output:
    7.14 - *  lower 16 bits of return code contain entry number
    7.15 - *  if entry number is '0', then upper 16 bits contain error code.
    7.16 - */
    7.17 -Bit32u tcpa_extend_acpi_log(entry_ptr)
    7.18 -    Bit32u entry_ptr;
    7.19 -{
    7.20 -	ASM_START
    7.21 -	DoUpcall(IDX_TCPA_EXTEND_ACPI_LOG)
    7.22 -	ASM_END
    7.23 -}
    7.24 -
    7.25 -
    7.26 -/*
    7.27 -   initialize the TCPA ACPI subsystem; find the ACPI tables and determine
    7.28 -   where the TCPA table is.
    7.29 - */
    7.30 - void
    7.31 -tcpa_acpi_init()
    7.32 -{
    7.33 -	ASM_START
    7.34 -	DoUpcall(IDX_TCPA_ACPI_INIT)
    7.35 -	ASM_END
    7.36 -}
    7.37 -
    7.38 -
    7.39 -/*
    7.40 - * Add measurement to log about call of int 19h
    7.41 - */
    7.42 - void
    7.43 -tcpa_calling_int19h()
    7.44 -{
    7.45 -	ASM_START
    7.46 -	DoUpcall(IDX_TCPA_CALLING_INT19H)
    7.47 -	ASM_END
    7.48 -}
    7.49 -
    7.50 -/*
    7.51 - * Add measurement to log about retuning from int 19h
    7.52 - */
    7.53 - void
    7.54 -tcpa_returned_int19h()
    7.55 -{
    7.56 -	ASM_START
    7.57 -	DoUpcall(IDX_TCPA_RETURNED_INT19H)
    7.58 -	ASM_END
    7.59 -}
    7.60 -
    7.61 -/*
    7.62 - * Add event separators for PCRs 0 to 7; specs 8.2.3
    7.63 - */
    7.64 - void
    7.65 -tcpa_add_event_separators()
    7.66 -{
    7.67 -	ASM_START
    7.68 -	DoUpcall(IDX_TCPA_ADD_EVENT_SEPARATORS)
    7.69 -	ASM_END
    7.70 -}
    7.71 -
    7.72 -
    7.73 -/*
    7.74 - * Add a wake event to the log
    7.75 - */
    7.76 - void
    7.77 -tcpa_wake_event()
    7.78 -{
    7.79 -	ASM_START
    7.80 -	DoUpcall(IDX_TCPA_WAKE_EVENT)
    7.81 -	ASM_END
    7.82 -}
    7.83 -
    7.84 -
    7.85 -/*
    7.86 - * Add measurement to the log about option rom scan
    7.87 - * 10.4.3 : action 14
    7.88 - */
    7.89 - void
    7.90 -tcpa_start_option_rom_scan()
    7.91 -{
    7.92 -	ASM_START
    7.93 -	DoUpcall(IDX_TCPA_START_OPTION_ROM_SCAN)
    7.94 -	ASM_END
    7.95 -}
    7.96 -
    7.97 -
    7.98 -/*
    7.99 - * Add measurement to the log about an option rom
   7.100 - */
   7.101 - void
   7.102 -tcpa_option_rom(seg)
   7.103 -    Bit32u seg;
   7.104 -{
   7.105 -	ASM_START
   7.106 -	DoUpcall(IDX_TCPA_OPTION_ROM)
   7.107 -	ASM_END
   7.108 -}
   7.109 -
   7.110 -/*
   7.111 - * Add a measurement regarding the boot device (CDRom, Floppy, HDD) to
   7.112 - * the list of measurements.
   7.113 - */
   7.114 -void
   7.115 - tcpa_add_bootdevice(bootcd, bootdrv)
   7.116 -  Bit32u bootcd;
   7.117 -  Bit32u bootdrv;
   7.118 -{
   7.119 -	ASM_START
   7.120 -	DoUpcall(IDX_TCPA_ADD_BOOTDEVICE)
   7.121 -	ASM_END
   7.122 -}
   7.123 -
   7.124 -/*
   7.125 - * Add a measurement to the log in support of 8.2.5.3
   7.126 - * Creates two log entries
   7.127 - *
   7.128 - * Input parameter:
   7.129 - *  seg    : segment where the IPL data are located
   7.130 - */
   7.131 - void
   7.132 - tcpa_ipl(bootcd,seg,off,count)
   7.133 -    Bit32u bootcd;
   7.134 -    Bit32u seg;
   7.135 -    Bit32u off;
   7.136 -    Bit32u count;
   7.137 -{
   7.138 -	ASM_START
   7.139 -	DoUpcall(IDX_TCPA_IPL)
   7.140 -	ASM_END
   7.141 -}
   7.142 -
   7.143 -
   7.144 -Bit32u
   7.145 -tcpa_initialize_tpm(physpres)
   7.146 -  Bit32u physpres;
   7.147 -{
   7.148 -	ASM_START
   7.149 -	DoUpcall(IDX_TCPA_INITIALIZE_TPM)
   7.150 -	ASM_END
   7.151 -}
   7.152 -
   7.153 -void
   7.154 -tcpa_measure_post(from, to)
   7.155 -   Bit32u from;
   7.156 -   Bit32u to;
   7.157 -{
   7.158 -	ASM_START
   7.159 -	DoUpcall(IDX_TCPA_MEASURE_POST)
   7.160 -	ASM_END
   7.161 -}
   7.162 -
   7.163  ASM_START
   7.164  MACRO POST_MEASURE
   7.165  	push word #0x000f
   7.166 @@ -208,18 +52,6 @@ tcpa_do_measure_POSTs()
   7.167  	ASM_END
   7.168  }
   7.169  
   7.170 -Bit32u
   7.171 -TCGInterruptHandler(regs_ptr, es, ds, flags_ptr)
   7.172 -   Bit32u regs_ptr;
   7.173 -   Bit16u es;
   7.174 -   Bit16u ds;
   7.175 -   Bit32u flags_ptr;
   7.176 -{
   7.177 -	ASM_START
   7.178 -	DoUpcall(IDX_TCGINTERRUPTHANDLER)
   7.179 -	ASM_END
   7.180 -}
   7.181 -
   7.182  /*
   7.183   * C-dispatcher for the TCG BIOS functions
   7.184   */