Mailing List Archive

[xen-unstable] rombios: Simplify 32-bit gateway interface definitions.
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1232646073 0
# Node ID fe2957a376fe54e8b5506fa7aba6fa5c252aecdf
# Parent b10fd9f4fe38c38069b140bf8689c5fc15cd595f
rombios: Simplify 32-bit gateway interface definitions.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
---
tools/firmware/rombios/32bit/32bitbios.c | 28 ----
tools/firmware/rombios/32bit/rombios_compat.h | 4
tools/firmware/rombios/32bit/tcgbios/tcgbios.c | 18 ++
tools/firmware/rombios/32bitgateway.c | 15 --
tools/firmware/rombios/32bitprotos.h | 62 ++-------
tools/firmware/rombios/rombios.c | 5
tools/firmware/rombios/tcgbios.c | 168 -------------------------
7 files changed, 46 insertions(+), 254 deletions(-)

diff -r b10fd9f4fe38 -r fe2957a376fe tools/firmware/rombios/32bit/32bitbios.c
--- a/tools/firmware/rombios/32bit/32bitbios.c Thu Jan 22 16:32:06 2009 +0000
+++ b/tools/firmware/rombios/32bit/32bitbios.c Thu Jan 22 17:41:13 2009 +0000
@@ -19,35 +19,17 @@
*
* 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
};
diff -r b10fd9f4fe38 -r fe2957a376fe tools/firmware/rombios/32bit/rombios_compat.h
--- a/tools/firmware/rombios/32bit/rombios_compat.h Thu Jan 22 16:32:06 2009 +0000
+++ b/tools/firmware/rombios/32bit/rombios_compat.h Thu Jan 22 17:41:13 2009 +0000
@@ -89,4 +89,8 @@ static inline void write_byte(Bit16u seg
*addr = val;
}

+#define X(idx, ret, fn, args...) ret fn (args);
+#include "32bitprotos.h"
+#undef X
+
#endif
diff -r b10fd9f4fe38 -r fe2957a376fe tools/firmware/rombios/32bit/tcgbios/tcgbios.c
--- a/tools/firmware/rombios/32bit/tcgbios/tcgbios.c Thu Jan 22 16:32:06 2009 +0000
+++ b/tools/firmware/rombios/32bit/tcgbios/tcgbios.c Thu Jan 22 17:41:13 2009 +0000
@@ -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_
}


+/*
+ 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)
{
diff -r b10fd9f4fe38 -r fe2957a376fe tools/firmware/rombios/32bitgateway.c
--- a/tools/firmware/rombios/32bitgateway.c Thu Jan 22 16:32:06 2009 +0000
+++ b/tools/firmware/rombios/32bitgateway.c Thu Jan 22 17:41:13 2009 +0000
@@ -46,8 +46,6 @@
#define PM_16BIT_CS (gdt_entry_pm_16bit_cs - gdt_base)
#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:
@@ -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
diff -r b10fd9f4fe38 -r fe2957a376fe tools/firmware/rombios/32bitprotos.h
--- a/tools/firmware/rombios/32bitprotos.h Thu Jan 22 16:32:06 2009 +0000
+++ b/tools/firmware/rombios/32bitprotos.h Thu Jan 22 17:41:13 2009 +0000
@@ -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)
diff -r b10fd9f4fe38 -r fe2957a376fe tools/firmware/rombios/rombios.c
--- a/tools/firmware/rombios/rombios.c Thu Jan 22 16:32:06 2009 +0000
+++ b/tools/firmware/rombios/rombios.c Thu Jan 22 17:41:13 2009 +0000
@@ -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

+#include "32bitgateway.c"
ASM_END
-#include "32bitgateway.c"
+#include "tcgbios.c"
ASM_START

;--------------------
diff -r b10fd9f4fe38 -r fe2957a376fe tools/firmware/rombios/tcgbios.c
--- a/tools/firmware/rombios/tcgbios.c Thu Jan 22 16:32:06 2009 +0000
+++ b/tools/firmware/rombios/tcgbios.c Thu Jan 22 17:41:13 2009 +0000
@@ -25,162 +25,6 @@
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
@@ -205,18 +49,6 @@ tcpa_do_measure_POSTs()
POST_MEASURE(timer_tick_post, int76_handler)

ret
- 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
}


_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog