rombios: Simplify 32-bit gateway interface definitions.
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 22 Jan 2009 17:41:13 +0000 (17:41 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 22 Jan 2009 17:41:13 +0000 (17:41 +0000)
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
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

index 551a9ffdc038349b395202fdcb86117da743dc85..e2f72605ddbb84271fd7e4ebc5db4ff320047fba 100644 (file)
  *
  * Author: Stefan Berger <stefanb@us.ibm.com>
  */
+
 #include "rombios_compat.h"
-#include "32bitprotos.h"
 
 /*
    the jumptable that will be copied into the rombios in the 0xf000 segment
    for every function that is to be called from the lower BIOS, make an entry
    here.
  */
-#define TABLE_ENTRY(idx, func) [idx] = (uint32_t)func
-uint32_t jumptable[IDX_LAST+1] __attribute__((section (".biosjumptable"))) =
+uint32_t jumptable[] __attribute__((section (".biosjumptable"))) =
 {
-       TABLE_ENTRY(IDX_TCPA_ACPI_INIT, tcpa_acpi_init),
-       TABLE_ENTRY(IDX_TCPA_EXTEND_ACPI_LOG, tcpa_extend_acpi_log),
-
-       TABLE_ENTRY(IDX_TCGINTERRUPTHANDLER, TCGInterruptHandler),
-
-       TABLE_ENTRY(IDX_TCPA_CALLING_INT19H, tcpa_calling_int19h),
-       TABLE_ENTRY(IDX_TCPA_RETURNED_INT19H, tcpa_returned_int19h),
-       TABLE_ENTRY(IDX_TCPA_ADD_EVENT_SEPARATORS, tcpa_add_event_separators),
-       TABLE_ENTRY(IDX_TCPA_WAKE_EVENT, tcpa_wake_event),
-       TABLE_ENTRY(IDX_TCPA_ADD_BOOTDEVICE, tcpa_add_bootdevice),
-       TABLE_ENTRY(IDX_TCPA_START_OPTION_ROM_SCAN, tcpa_start_option_rom_scan),
-       TABLE_ENTRY(IDX_TCPA_OPTION_ROM, tcpa_option_rom),
-       TABLE_ENTRY(IDX_TCPA_IPL, tcpa_ipl),
-       TABLE_ENTRY(IDX_TCPA_MEASURE_POST, tcpa_measure_post),
-
-       TABLE_ENTRY(IDX_TCPA_INITIALIZE_TPM, tcpa_initialize_tpm),
-
-       TABLE_ENTRY(IDX_GET_S3_WAKING_VECTOR, get_s3_waking_vector),
-
-       TABLE_ENTRY(IDX_LAST       , 0)     /* keep last */
+#define X(idx, ret, fn, args...) [idx] = (uint32_t)fn,
+#include "32bitprotos.h"
+#undef X
 };
index 2198645d1d585341811c25cb45cbb801d8671e50..f33e3e783f18db08e9df01948e6808cedddf0f44 100644 (file)
@@ -89,4 +89,8 @@ static inline void write_byte(Bit16u seg, Bit16u off, Bit8u val)
        *addr = val;
 }
 
+#define X(idx, ret, fn, args...) ret fn (args);
+#include "32bitprotos.h"
+#undef X
+
 #endif
index b06af22f00616fdce09a4ed9be40a00865325961..d5e2202df4f11f8e74cdbdf21fe2266bedd23422 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "util.h"
 #include "tcgbios.h"
-#include "32bitprotos.h"
 
 /* local structure and variables */
 struct ptti_cust {
@@ -259,6 +258,10 @@ uint8_t acpi_validate_entry(struct acpi_header *hdr)
 }
 
 
+/*
+   initialize the TCPA ACPI subsystem; find the ACPI tables and determine
+   where the TCPA table is.
+ */
 void tcpa_acpi_init(void)
 {
        struct acpi_20_rsdt *rsdt;
@@ -313,6 +316,16 @@ static void tcpa_reset_acpi_log(void)
 }
 
 
+/*
+ * Extend the ACPI log with the given entry by copying the
+ * entry data into the log.
+ * Input
+ *  Pointer to the structure to be copied into the log
+ *
+ * Output:
+ *  lower 16 bits of return code contain entry number
+ *  if entry number is '0', then upper 16 bits contain error code.
+ */
 uint32_t tcpa_extend_acpi_log(uint32_t entry_ptr)
 {
        uint32_t res = 0;
@@ -622,7 +635,8 @@ void tcpa_wake_event()
 }
 
 /*
- * add the boot device to the measurement log
+ * Add a measurement regarding the boot device (CDRom, Floppy, HDD) to
+ * the list of measurements.
  */
 void tcpa_add_bootdevice(uint32_t bootcd, uint32_t bootdrv)
 {
index 46f87ea4c42150cfa430a791d88856d056bc0042..f5125ec7a3ace7aadffa7c506e34cc4e89089100 100644 (file)
@@ -47,8 +47,6 @@
 #define PM_32BIT_DS  (gdt_entry_pm_32bit_ds - gdt_base)
 #define PM_16BIT_DS  (gdt_entry_pm_16bit_ds - gdt_base)
 
-ASM_START
-
     .align 16
 gdt_base:
     .word 0,0
@@ -178,20 +176,11 @@ upcall4:
     popf
     ret
 
-/* macro for functions to declare their call into 32bit space */
 MACRO DoUpcall
     mov bx, #?1
     jmp Upcall
 MEND
 
-ASM_END
-
+#define X(idx, ret, fn, args...) _ ## fn: DoUpcall(idx)
 #include "32bitprotos.h"
-#include "tcgbios.c"
-
-Bit32u get_s3_waking_vector()
-{
-    ASM_START
-    DoUpcall(IDX_GET_S3_WAKING_VECTOR)
-    ASM_END
-}
+#undef X
index f0c401476a98e8894673f6ba44d6d95833d6f290..aa1f2dcebd4d637bcb6d8f4596b7690500c03540 100644 (file)
@@ -1,47 +1,15 @@
-#ifndef PROTOS_HIGHBIOS
-#define PROTOS_HIGHBIOS
-
-/* shared include file for bcc and gcc */
-
-/* bcc does not like 'enum' */
-#define IDX_TCGINTERRUPTHANDLER            0
-#define IDX_TCPA_ACPI_INIT                 1
-#define IDX_TCPA_EXTEND_ACPI_LOG           2
-#define IDX_TCPA_CALLING_INT19H            3
-#define IDX_TCPA_RETURNED_INT19H           4
-#define IDX_TCPA_ADD_EVENT_SEPARATORS      5
-#define IDX_TCPA_WAKE_EVENT                6
-#define IDX_TCPA_ADD_BOOTDEVICE            7
-#define IDX_TCPA_START_OPTION_ROM_SCAN     8
-#define IDX_TCPA_OPTION_ROM                9
-#define IDX_TCPA_IPL                       10
-#define IDX_TCPA_INITIALIZE_TPM            11
-#define IDX_TCPA_MEASURE_POST              12
-#define IDX_GET_S3_WAKING_VECTOR           13
-#define IDX_LAST                           14 /* keep last! */
-
-#ifdef GCC_PROTOS
-  #define PARMS(x...) x
-#else
-  /* bcc doesn't want any parameter types in prototypes */
-  #define PARMS(x...)
-#endif
-
-Bit32u TCGInterruptHandler( PARMS(pushad_regs_t *regs, Bit32u esds, Bit32u flags_ptr));
-
-void tcpa_acpi_init( PARMS(void) );
-Bit32u tcpa_extend_acpi_log( PARMS(Bit32u entry_ptr) );
-void tcpa_calling_int19h( PARMS(void) );
-void tcpa_returned_int19h( PARMS(void) );
-void tcpa_add_event_separators( PARMS(void) );
-void tcpa_wake_event( PARMS(void) );
-void tcpa_add_bootdevice( PARMS(Bit32u bootcd, Bit32u bootdrv) );
-void tcpa_start_option_rom_scan( PARMS(void) );
-void tcpa_option_rom( PARMS(Bit32u seg) );
-void tcpa_ipl( PARMS(Bit32u bootcd,Bit32u seg,Bit32u off,Bit32u count) );
-void tcpa_measure_post( PARMS(Bit32u from, Bit32u to) );
-Bit32u tcpa_initialize_tpm( PARMS(Bit32u physpres) );
-
-Bit32u get_s3_waking_vector( PARMS(void) );
-
-#endif
+X(0,  Bit32u, TCGInterruptHandler,
+  pushad_regs_t *regs, Bit32u esds, Bit32u flags_ptr)
+X(1,  void,   tcpa_acpi_init, void)
+X(2,  Bit32u, tcpa_extend_acpi_log, Bit32u entry_ptr)
+X(3,  void,   tcpa_calling_int19h,void)
+X(4,  void,   tcpa_returned_int19h, void)
+X(5,  void,   tcpa_add_event_separators, void)
+X(6,  void,   tcpa_wake_event, void)
+X(7,  void,   tcpa_add_bootdevice, Bit32u bootcd, Bit32u bootdrv)
+X(8,  void,   tcpa_start_option_rom_scan, void)
+X(9,  void,   tcpa_option_rom, Bit32u seg)
+X(10, void,   tcpa_ipl, Bit32u bootcd, Bit32u seg, Bit32u off, Bit32u count)
+X(11, void,   tcpa_measure_post, Bit32u from, Bit32u to)
+X(12, Bit32u, tcpa_initialize_tpm, Bit32u physpres)
+X(13, Bit32u, get_s3_waking_vector, void)
index 00d62120ba00113f6fb3767449e5e3d98071b9fe..865b79ea260cc872ff387188e121ef815812f841 100644 (file)
@@ -726,7 +726,9 @@ typedef struct {
     } cdemu_t;
 #endif // BX_ELTORITO_BOOT
 
+#define X(idx, ret, fn, arg...) ret fn ();
 #include "32bitprotos.h"
+#undef X
 
   // for access to EBDA area
   //     The EBDA structure should conform to
@@ -9497,8 +9499,9 @@ use16 386
 
 #endif
 
-ASM_END
 #include "32bitgateway.c"
+ASM_END
+#include "tcgbios.c"
 ASM_START
 
 ;--------------------
index 9adba404fc78cf4664eabfa22c64f55819c8f8c3..c7ec261081bce5209cb5a29c619c0524cb1bde72 100644 (file)
   Support for TCPA ACPI logging
  ******************************************************************/
 
-/*
- * Extend the ACPI log with the given entry by copying the
- * entry data into the log.
- * Input
- *  Pointer to the structure to be copied into the log
- *
- * Output:
- *  lower 16 bits of return code contain entry number
- *  if entry number is '0', then upper 16 bits contain error code.
- */
-Bit32u tcpa_extend_acpi_log(entry_ptr)
-    Bit32u entry_ptr;
-{
-       ASM_START
-       DoUpcall(IDX_TCPA_EXTEND_ACPI_LOG)
-       ASM_END
-}
-
-
-/*
-   initialize the TCPA ACPI subsystem; find the ACPI tables and determine
-   where the TCPA table is.
- */
- void
-tcpa_acpi_init()
-{
-       ASM_START
-       DoUpcall(IDX_TCPA_ACPI_INIT)
-       ASM_END
-}
-
-
-/*
- * Add measurement to log about call of int 19h
- */
- void
-tcpa_calling_int19h()
-{
-       ASM_START
-       DoUpcall(IDX_TCPA_CALLING_INT19H)
-       ASM_END
-}
-
-/*
- * Add measurement to log about retuning from int 19h
- */
- void
-tcpa_returned_int19h()
-{
-       ASM_START
-       DoUpcall(IDX_TCPA_RETURNED_INT19H)
-       ASM_END
-}
-
-/*
- * Add event separators for PCRs 0 to 7; specs 8.2.3
- */
- void
-tcpa_add_event_separators()
-{
-       ASM_START
-       DoUpcall(IDX_TCPA_ADD_EVENT_SEPARATORS)
-       ASM_END
-}
-
-
-/*
- * Add a wake event to the log
- */
- void
-tcpa_wake_event()
-{
-       ASM_START
-       DoUpcall(IDX_TCPA_WAKE_EVENT)
-       ASM_END
-}
-
-
-/*
- * Add measurement to the log about option rom scan
- * 10.4.3 : action 14
- */
- void
-tcpa_start_option_rom_scan()
-{
-       ASM_START
-       DoUpcall(IDX_TCPA_START_OPTION_ROM_SCAN)
-       ASM_END
-}
-
-
-/*
- * Add measurement to the log about an option rom
- */
- void
-tcpa_option_rom(seg)
-    Bit32u seg;
-{
-       ASM_START
-       DoUpcall(IDX_TCPA_OPTION_ROM)
-       ASM_END
-}
-
-/*
- * Add a measurement regarding the boot device (CDRom, Floppy, HDD) to
- * the list of measurements.
- */
-void
- tcpa_add_bootdevice(bootcd, bootdrv)
-  Bit32u bootcd;
-  Bit32u bootdrv;
-{
-       ASM_START
-       DoUpcall(IDX_TCPA_ADD_BOOTDEVICE)
-       ASM_END
-}
-
-/*
- * Add a measurement to the log in support of 8.2.5.3
- * Creates two log entries
- *
- * Input parameter:
- *  seg    : segment where the IPL data are located
- */
- void
- tcpa_ipl(bootcd,seg,off,count)
-    Bit32u bootcd;
-    Bit32u seg;
-    Bit32u off;
-    Bit32u count;
-{
-       ASM_START
-       DoUpcall(IDX_TCPA_IPL)
-       ASM_END
-}
-
-
-Bit32u
-tcpa_initialize_tpm(physpres)
-  Bit32u physpres;
-{
-       ASM_START
-       DoUpcall(IDX_TCPA_INITIALIZE_TPM)
-       ASM_END
-}
-
-void
-tcpa_measure_post(from, to)
-   Bit32u from;
-   Bit32u to;
-{
-       ASM_START
-       DoUpcall(IDX_TCPA_MEASURE_POST)
-       ASM_END
-}
-
 ASM_START
 MACRO POST_MEASURE
        push word #0x000f
@@ -208,18 +52,6 @@ tcpa_do_measure_POSTs()
        ASM_END
 }
 
-Bit32u
-TCGInterruptHandler(regs_ptr, es, ds, flags_ptr)
-   Bit32u regs_ptr;
-   Bit16u es;
-   Bit16u ds;
-   Bit32u flags_ptr;
-{
-       ASM_START
-       DoUpcall(IDX_TCGINTERRUPTHANDLER)
-       ASM_END
-}
-
 /*
  * C-dispatcher for the TCG BIOS functions
  */