Skip to contentSkip to conversation

firmware: cleanup

PATCH New Christoph Egger 1 participant 1 message Jul 15, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 firmware: cleanup

Hi!

Attached patch makes functions static which have no prototype. Also collect prototypes in one new header file instead of re-declaring them in each c-file.
Remove unused vprintf()

Signature · 12 lines
AMD Saxony, Dresden, Germany
Operating System Research Center

Legal Information:
AMD Saxony Limited Liability Company & Co. KG
Sitz (Geschäftsanschrift):
   Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland
Registergericht Dresden: HRA 4896
vertretungsberechtigter Komplementär:
   AMD Saxony LLC (Sitz Wilmington, Delaware, USA)
Geschäftsführer der AMD Saxony LLC:
   Dr. Hans-R. Deppe, Thomas McCoy
tools/firmware/hvmloader/cacheattr.c +1 -0
diff -r 63317b6c3eab tools/firmware/hvmloader/cacheattr.c
@@ -22,6 +22,7 @@
 
 #include "util.h"
 #include "config.h"
+#include "common.h"
 
 #define MSR_MTRRphysBase(reg) (0x200 + 2 * (reg))
 #define MSR_MTRRphysMask(reg) (0x200 + 2 * (reg) + 1)
tools/firmware/hvmloader/common.h new file +5 -0
diff -r 63317b6c3eab tools/firmware/hvmloader/common.h
@@ -0,0 +1,5 @@
+
+void cacheattr_init(void);
+void create_mp_tables(void);
+int hvm_write_smbios_tables(void);
+void smp_initialise(void);
tools/firmware/hvmloader/hvmloader.c +3 -4
diff -r 63317b6c3eab tools/firmware/hvmloader/hvmloader.c
@@ -31,6 +31,9 @@
 #include "option_rom.h"
 #include <xen/version.h>
 #include <xen/hvm/params.h>
+
+#include "common.h"
+
 
 asm (
     "    .text                       \n"
@@ -98,10 +101,6 @@ asm (
     "stack_top:                      \n"
     "    .text                       \n"
     );
-
-void smp_initialise(void);
-void create_mp_tables(void);
-int hvm_write_smbios_tables(void);
 
 static enum { VGA_none, VGA_std, VGA_cirrus } virtual_vga = VGA_none;
 
tools/firmware/hvmloader/mp_tables.c +10 -11
diff -r 63317b6c3eab tools/firmware/hvmloader/mp_tables.c
@@ -30,6 +30,8 @@
 
 #include <stdint.h>
 #include "config.h"
+
+#include "common.h"
 
 /* number of non-processor MP table entries */
 #define NR_NONPROC_ENTRIES     18
@@ -68,8 +70,6 @@
 #define INTR_MAX_NR            16
 
 #include "util.h"
-
-extern int get_vcpu_nr(void);  /* for the guest's VCPU count */
 
 /*
  * The following structures are defined in the MuliProcessor Specifiation v1.4
@@ -152,7 +152,7 @@ struct mp_local_intr_entry {
 };
 
 
-void fill_mp_config_table(struct mp_config_table *mpct, int length)
+static void fill_mp_config_table(struct mp_config_table *mpct, int length)
 {
     int vcpu_nr, i;
     uint8_t checksum;
@@ -199,7 +199,7 @@ void fill_mp_config_table(struct mp_conf
 }
 
 /* fills in an MP processor entry for VCPU 'vcpu_id' */
-void fill_mp_proc_entry(struct mp_proc_entry *mppe, int vcpu_id)
+static void fill_mp_proc_entry(struct mp_proc_entry *mppe, int vcpu_id)
 {
     mppe->type = ENTRY_TYPE_PROCESSOR;
     mppe->lapic_id = LAPIC_ID(vcpu_id);
@@ -213,7 +213,7 @@ void fill_mp_proc_entry(struct mp_proc_e
 
 
 /* fills in an MP bus entry of type 'type' and bus ID 'bus_id' */
-void fill_mp_bus_entry(struct mp_bus_entry *mpbe, int bus_id, const char *type)
+static void fill_mp_bus_entry(struct mp_bus_entry *mpbe, int bus_id, const char *type)
 {
     int i;
 
@@ -225,7 +225,7 @@ void fill_mp_bus_entry(struct mp_bus_ent
 
 
 /* fills in an MP IOAPIC entry for IOAPIC 'ioapic_id' */
-void fill_mp_ioapic_entry(struct mp_ioapic_entry *mpie)
+static void fill_mp_ioapic_entry(struct mp_ioapic_entry *mpie)
 {
     mpie->type = ENTRY_TYPE_IOAPIC;
     mpie->ioapic_id = IOAPIC_ID;
@@ -236,7 +236,7 @@ void fill_mp_ioapic_entry(struct mp_ioap
 
 
 /* fills in an IO interrupt entry for IOAPIC 'ioapic_id' */
-void fill_mp_io_intr_entry(
+static void fill_mp_io_intr_entry(
     struct mp_io_intr_entry *mpiie,
     int src_bus_id, int src_bus_irq, int ioapic_id, int dst_ioapic_intin)
 {
@@ -251,7 +251,7 @@ void fill_mp_io_intr_entry(
 
 
 /* fill in the mp floating processor structure */
-void fill_mpfps(struct mp_floating_pointer_struct *mpfps, uint32_t mpct)
+static void fill_mpfps(struct mp_floating_pointer_struct *mpfps, uint32_t mpct)
 {
     int i;
     uint8_t checksum;
@@ -283,7 +283,7 @@ void fill_mpfps(struct mp_floating_point
  * The '___HVMMP' signature is created by the ROMBIOS and designates a chunk
  * of space inside the ROMBIOS that is safe for us to write our MP table info
  */
-void* get_mp_table_start(void)
+static void *get_mp_table_start(void)
 {
     char *bios_mem;
 
@@ -300,7 +300,7 @@ void* get_mp_table_start(void)
 
 
 /* recalculate the new ROMBIOS checksum after adding MP tables */
-void reset_bios_checksum(void)
+static void reset_bios_checksum(void)
 {
     uint32_t i;
     uint8_t checksum;
@@ -311,7 +311,6 @@ void reset_bios_checksum(void)
 
     *((uint8_t *)(ROMBIOS_BEGIN + ROMBIOS_MAXOFFSET)) = -checksum;
 }
-
 
 /* create_mp_tables - creates MP tables for the guest based upon config data */
 void create_mp_tables(void)
tools/firmware/hvmloader/smbios.c +2 -0
diff -r 63317b6c3eab tools/firmware/hvmloader/smbios.c
@@ -27,6 +27,8 @@
 #include "util.h"
 #include "hypercall.h"
 #include "e820.h"
+
+#include "common.h"
 
 static int
 write_smbios_tables(void *start,
tools/firmware/hvmloader/smp.c +3 -1
diff -r 63317b6c3eab tools/firmware/hvmloader/smp.c
@@ -23,6 +23,8 @@
 #include "util.h"
 #include "config.h"
 #include "apic_regs.h"
+
+#include "common.h"
 
 #define AP_BOOT_EIP 0x1000
 extern char ap_boot_start[], ap_boot_end[];
@@ -69,7 +71,7 @@ asm (
     "    .text                       \n"
     );
 
-extern void cacheattr_init(void);
+void ap_start(void);
 
 /*static*/ void ap_start(void)
 {
tools/firmware/rombios/32bit/tcgbios/tcgbios.c +2 -2
diff -r 63317b6c3eab tools/firmware/rombios/32bit/tcgbios/tcgbios.c
@@ -581,7 +581,7 @@ static char wake_event_1[]    = "Wake Ev
  * data       : additional parameter; used as parameter for 10.4.3
  *              'action index'
  */
-void tcpa_add_measurement(uint32_t pcrIndex,
+static void tcpa_add_measurement(uint32_t pcrIndex,
                           uint16_t event_type,
                           uint32_t data)
 {
@@ -863,7 +863,7 @@ uint32_t tcpa_initialize_tpm(uint32_t ph
 }
 
 
-uint16_t TCG_IsShutdownPreBootInterface(void)
+static uint16_t TCG_IsShutdownPreBootInterface(void)
 {
 	return tcpa_acpi.flags & STATUS_FLAG_SHUTDOWN;
 }
tools/firmware/rombios/32bit/tcgbios/tpm_drivers.c +6 -6
diff -r 63317b6c3eab tools/firmware/rombios/32bit/tcgbios/tpm_drivers.c
@@ -75,7 +75,7 @@ static uint32_t tis_activate(uint32_t ba
 	return rc;
 }
 
-uint32_t tis_ready(uint32_t baseaddr)
+static uint32_t tis_ready(uint32_t baseaddr)
 {
 	uint32_t rc = 0;
 	uint8_t *tis_addr = (uint8_t*)baseaddr;
@@ -86,7 +86,7 @@ uint32_t tis_ready(uint32_t baseaddr)
 	return rc;
 }
 
-uint32_t tis_senddata(uint32_t baseaddr, unsigned char *data, uint32_t len)
+static uint32_t tis_senddata(uint32_t baseaddr, unsigned char *data, uint32_t len)
 {
 	uint32_t rc = 0;
 	uint8_t *tis_addr = (uint8_t*)baseaddr;
@@ -127,7 +127,7 @@ uint32_t tis_senddata(uint32_t baseaddr,
 	return rc;
 }
 
-uint32_t tis_readresp(uint32_t baseaddr, unsigned char *buffer, uint32_t len)
+static uint32_t tis_readresp(uint32_t baseaddr, unsigned char *buffer, uint32_t len)
 {
 	uint32_t rc = 0;
 	uint32_t offset = 0;
@@ -147,7 +147,7 @@ uint32_t tis_readresp(uint32_t baseaddr,
 }
 
 
-uint32_t tis_waitdatavalid(uint32_t baseaddr)
+static uint32_t tis_waitdatavalid(uint32_t baseaddr)
 {
 	uint8_t *tis_addr = (uint8_t*)baseaddr;
 	uint32_t rc = 0;
@@ -157,7 +157,7 @@ uint32_t tis_waitdatavalid(uint32_t base
 	return rc;
 }
 
-uint32_t tis_waitrespready(uint32_t baseaddr, uint32_t timeout)
+static uint32_t tis_waitrespready(uint32_t baseaddr, uint32_t timeout)
 {
 	uint32_t rc = 0;
 	uint8_t *tis_addr = (uint8_t*)baseaddr;
@@ -170,7 +170,7 @@ uint32_t tis_waitrespready(uint32_t base
 }
 
 /* if device is not there, return '0', '1' otherwise */
-uint32_t tis_probe(uint32_t baseaddr)
+static uint32_t tis_probe(uint32_t baseaddr)
 {
 	uint32_t rc = 0;
 	uint8_t *tis_addr = (uint8_t*)baseaddr;
tools/firmware/rombios/32bit/util.c +0 -6
diff -r 63317b6c3eab tools/firmware/rombios/32bit/util.c
@@ -388,12 +388,6 @@ int printf(const char *fmt, ...)
     return 0;
 }
 
-int vprintf(const char *fmt, va_list ap)
-{
-    _doprint(putchar, fmt, ap);
-    return 0;
-}
-
 void mssleep(uint32_t waittime)
 {
     uint32_t i;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel