Index: trunk/i386/libsaio/gma.c =================================================================== --- trunk/i386/libsaio/gma.c (revision 2661) +++ trunk/i386/libsaio/gma.c (revision 2662) @@ -39,22 +39,23 @@ #include "pci.h" #include "platform.h" #include "device_inject.h" +#include "convert.h" #include "gma.h" #include "vbe.h" #include "graphics.h" #ifndef DEBUG_GMA -#define DEBUG_GMA 0 + #define DEBUG_GMA 0 #endif #ifndef DEBUG_BDW -#define DEBUG_BDW 1 + #define DEBUG_BDW 1 #endif #if DEBUG_GMA -#define DBG(x...) printf(x) + #define DBG(x...) printf(x) #else -#define DBG(x...) + #define DBG(x...) #endif static bool doit = false; @@ -64,7 +65,7 @@ #define AAPL_LEN_HSW ( sizeof(default_aapl_haswell) / sizeof(uint8_t) ) #if DEBUG_BDW -static uint8_t default_aapl_broadwell[] = { 0x00,0x00,0x1e,0x16 }; // broadwell_ig_vals[3] +static uint8_t default_aapl_broadwell[] = { 0x00,0x00,0x1e,0x16 }; // broadwell_ig_vals[2] #define AAPL_LEN_BDW ( sizeof(default_aapl_broadwell) / sizeof(uint8_t) ) #endif @@ -843,7 +844,7 @@ } else { - uint32_t ig_platform_id = 0x161e0000; // set the default platform ig + uint32_t ig_platform_id = 0x16160000; // set the default platform ig devprop_add_value(device, "AAPL,ig-platform-id", (uint8_t *)&ig_platform_id, 4); } Index: trunk/i386/libsaio/device_inject.c =================================================================== --- trunk/i386/libsaio/device_inject.c (revision 2661) +++ trunk/i386/libsaio/device_inject.c (revision 2662) @@ -14,13 +14,13 @@ #include "convert.h" #ifndef DEBUG_INJECT -#define DEBUG_INJECT 0 + #define DEBUG_INJECT 0 #endif #if DEBUG_INJECT -#define DBG(x...) printf(x) + #define DBG(x...) printf(x) #else -#define DBG(x...) msglog(x) + #define DBG(x...) msglog(x) #endif uint32_t devices_number = 1; @@ -400,42 +400,6 @@ /* ======================================================= */ - -/******************************************************************* - * Decodes a sequence of 'len' hexadecimal chars from 'hex' into * - * a binary. returns -1 in case of error (i.e. badly formed chars) * - *******************************************************************/ -int hex2bin( const char *hex, uint8_t *bin, int len ) -{ - char *p; - int i; - char buf[3]; - - if (hex == NULL || bin == NULL || len <= 0 || strlen(hex) != len * 2) - { - printf("[ERROR] bin2hex input error\n"); - return -1; - } - - buf[2] = '\0'; - p = (char *) hex; - - for (i = 0; i < len; i++) - { - if (p[0] == '\0' || p[1] == '\0' || !isxdigit(p[0]) || !isxdigit(p[1])) - { - printf("[ERROR] bin2hex '%s' syntax error\n", hex); - return -2; - } - buf[0] = *p++; - buf[1] = *p++; - bin[i] = (unsigned char) strtoul(buf, NULL, 16); - } - return 0; -} - -/* ======================================================= */ - /* a fine place for this code */ int devprop_add_network_template(DevPropDevice *device, uint16_t vendor_id) Index: trunk/i386/libsaio/hda.c =================================================================== --- trunk/i386/libsaio/hda.c (revision 2661) +++ trunk/i386/libsaio/hda.c (revision 2662) @@ -66,17 +66,18 @@ #include "pci_root.h" #include "platform.h" #include "device_inject.h" +#include "convert.h" #include "hda.h" //#include "aml_generator.h" #ifndef DEBUG_HDA -#define DEBUG_HDA 0 + #define DEBUG_HDA 0 #endif #if DEBUG_HDA -#define DBG(x...) verbose(x) + #define DBG(x...) verbose(x) #else -#define DBG(x...) + #define DBG(x...) #endif extern uint32_t devices_number; Index: trunk/i386/libsaio/device_inject.h =================================================================== --- trunk/i386/libsaio/device_inject.h (revision 2661) +++ trunk/i386/libsaio/device_inject.h (revision 2662) @@ -79,6 +79,5 @@ void devprop_free_string(DevPropString *string); int devprop_add_network_template(DevPropDevice *device, uint16_t vendor_id); -int hex2bin(const char *hex, uint8_t *bin, int len); #endif /* !__LIBSAIO_DEVICE_INJECT_H */ Index: trunk/i386/libsaio/nvidia.c =================================================================== --- trunk/i386/libsaio/nvidia.c (revision 2661) +++ trunk/i386/libsaio/nvidia.c (revision 2662) @@ -52,17 +52,18 @@ #include "pci.h" #include "platform.h" #include "device_inject.h" +#include "convert.h" #include "nvidia.h" #include "nvidia_helper.h" #ifndef DEBUG_NVIDIA -#define DEBUG_NVIDIA 0 + #define DEBUG_NVIDIA 0 #endif #if DEBUG_NVIDIA -#define DBG(x...) printf(x) + #define DBG(x...) printf(x) #else -#define DBG(x...) + #define DBG(x...) #endif #define NVIDIA_ROM_SIZE 0x20000 @@ -93,8 +94,8 @@ const char *nvidia_slot_name[] = { "AAPL,slot-name", "Slot-1" }; static uint8_t default_NVCAP[]= { - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, + 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00 }; Index: trunk/i386/libsaio/ati.c =================================================================== --- trunk/i386/libsaio/ati.c (revision 2661) +++ trunk/i386/libsaio/ati.c (revision 2662) @@ -7,13 +7,13 @@ #include "ati.h" #ifndef DEBUG_ATI -#define DEBUG_ATI 0 + #define DEBUG_ATI 0 #endif #if DEBUG_ATI -#define DBG(x...) printf(x) + #define DBG(x...) printf(x) #else -#define DBG(x...) msglog(x) + #define DBG(x...) msglog(x) #endif /* vals */ Index: trunk/i386/libsaio/convert.c =================================================================== --- trunk/i386/libsaio/convert.c (revision 2661) +++ trunk/i386/libsaio/convert.c (revision 2662) @@ -163,6 +163,39 @@ /* ======================================================= */ +/******************************************************************* + * Decodes a sequence of 'len' hexadecimal chars from 'hex' into * + * a binary. returns -1 in case of error (i.e. badly formed chars) * + *******************************************************************/ +int hex2bin( const char *hex, uint8_t *bin, int len ) +{ + char *p; + int i; + char buf[3]; + + if (hex == NULL || bin == NULL || len <= 0 || strlen(hex) != len * 2) + { + printf("[ERROR] bin2hex input error\n"); + return -1; + } + + buf[2] = '\0'; + p = (char *) hex; + + for (i = 0; i < len; i++) + { + if (p[0] == '\0' || p[1] == '\0' || !isxdigit(p[0]) || !isxdigit(p[1])) + { + printf("[ERROR] bin2hex '%s' syntax error\n", hex); + return -2; + } + buf[0] = *p++; + buf[1] = *p++; + bin[i] = (unsigned char) strtoul(buf, NULL, 16); + } + return 0; +} + /* ======================================================= */ // FIXME: can't use my original code here, Index: trunk/i386/libsaio/convert.h =================================================================== --- trunk/i386/libsaio/convert.h (revision 2661) +++ trunk/i386/libsaio/convert.h (revision 2662) @@ -15,6 +15,7 @@ EFI_CHAR8 *getUUIDFromString(const char *source); void *convertHexStr2Binary(const char *hexStr, int *outLength); uint32_t ascii_hex_to_int(char *buff); +int hex2bin( const char *hex, uint8_t *bin, int len ); static inline uint16_t dp_swap16(uint16_t toswap) { Index: trunk/i386/libsaio/fake_efi.c =================================================================== --- trunk/i386/libsaio/fake_efi.c (revision 2661) +++ trunk/i386/libsaio/fake_efi.c (revision 2662) @@ -19,13 +19,13 @@ #include "sl.h" #ifndef DEBUG_EFI -#define DEBUG_EFI 0 + #define DEBUG_EFI 0 #endif #if DEBUG_EFI -#define DBG(x...) printf(x) + #define DBG(x...) printf(x) #else -#define DBG(x...) + #define DBG(x...) #endif extern void setup_pci_devs(pci_dt_t *pci_dt); Index: trunk/i386/boot2/drivers.c =================================================================== --- trunk/i386/boot2/drivers.c (revision 2661) +++ trunk/i386/boot2/drivers.c (revision 2662) @@ -41,9 +41,9 @@ #include "modules.h" #if DEBUG -#define DBG(x...) printf(x) + #define DBG(x...) printf(x) #else -#define DBG(x...) msglog(x) + #define DBG(x...) msglog(x) #endif // extern char gMacOSVersion[8]; Index: trunk/i386/boot2/boot.c =================================================================== --- trunk/i386/boot2/boot.c (revision 2661) +++ trunk/i386/boot2/boot.c (revision 2662) @@ -57,13 +57,17 @@ #include "device_tree.h" #ifndef DEBUG_BOOT2 -#define DEBUG_BOOT2 0 + #define DEBUG_BOOT2 0 #endif +#ifndef DEBUG_INTERRUPTS + #define DEBUG_INTERRUPTS 0 +#endif + #if DEBUG_BOOT2 -#define DBG(x...) printf(x) + #define DBG(x...) printf(x) #else -#define DBG(x...) msglog(x) + #define DBG(x...) msglog(x) #endif /* @@ -77,7 +81,9 @@ bool gScanSingleDrive; bool useGUI; -static int interruptsAvailable = 0; +#if DEBUG_INTERRUPTS + static int interruptsAvailable = 0; +#endif static bool gUnloadPXEOnExit = false; @@ -446,12 +452,14 @@ // Initialize boot-log initBooterLog(); +#if DEBUG_INTERRUPTS // Enable interrupts interruptsAvailable = SetupInterrupts(); if (interruptsAvailable) { EnableInterrupts(); } +#endif // Initialize boot info structure. initKernBootStruct(); @@ -856,10 +864,13 @@ nbpUnloadBaseCode(); } +#if DEBUG_INTERRUPTS if (interruptsAvailable) { DisableInterrupts(); } +#endif + } /*! Index: trunk/i386/boot2/gui.c =================================================================== --- trunk/i386/boot2/gui.c (revision 2661) +++ trunk/i386/boot2/gui.c (revision 2662) @@ -14,13 +14,13 @@ #include "vers.h" #ifndef DEBUG_GUI -#define DEBUG_GUI 0 + #define DEBUG_GUI 0 #endif #if DEBUG_GUI -#define DBG(x...) printf(x) + #define DBG(x...) printf(x) #else -#define DBG(x...) + #define DBG(x...) #endif #define IMG_REQUIRED -1