I had occasion to use libpayload in an internal diagnostic this week, and I was able to find lots of room for improvement in libpayload.. :) Perhaps the biggest improvement here is the multiboot patch which lets libpayload applications run under GRUB unmolested. I think thats pretty cool, and it extends the reach of libpayload beyond coreboot.
Jordan
Using gcc to compile assembly files lets us use preprocessor directives.
Signed-off-by: Jordan Crouse jordan.crouse@amd.com Index: libpayload/Makefile =================================================================== --- libpayload.orig/Makefile 2008-10-17 14:38:33.000000000 -0600 +++ libpayload/Makefile 2008-10-17 14:38:47.000000000 -0600 @@ -115,8 +115,8 @@ $(Q)$(CC) -m32 $(CFLAGS) -c -o $@ $<
$(obj)/%.S.o: $(src)/%.S - $(Q)printf " AS $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(AS) --32 -o $@ $< + $(Q)printf " CC $(subst $(shell pwd)/,,$(@))\n" + $(Q)$(CC) -m32 $(CFLAGS) -c -o $@ $<
endif
jordan.crouse@amd.com schrieb:
- $(Q)printf " AS $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(AS) --32 -o $@ $< + $(Q)printf " CC $(subst $(shell pwd)/,,$(@))\n" + $(Q)$(CC) -m32 $(CFLAGS) -c -o $@ $<
Simple enough. Acked-by: Patrick Georgi patrick.georgi@coresystems.de
Allow the payload to enable a PCI device as a bus master.
Signed-off-by: Jordan Crouse jordan.crouse@amd.com Index: libpayload/drivers/pci.c =================================================================== --- libpayload.orig/drivers/pci.c 2008-10-17 14:37:39.000000000 -0600 +++ libpayload/drivers/pci.c 2008-10-17 14:39:52.000000000 -0600 @@ -112,3 +112,11 @@ { return pci_read_config32(dev, 0x10 + (bar * 4)); } + +void pci_set_bus_master(pcidev_t dev) +{ + u16 val = pci_read_config16(dev, REG_COMMAND); + val |= REG_COMMAND_BM; + pci_write_config16(dev, REG_COMMAND, val); +} + Index: libpayload/include/pci.h =================================================================== --- libpayload.orig/include/pci.h 2008-10-17 14:37:39.000000000 -0600 +++ libpayload/include/pci.h 2008-10-17 14:40:17.000000000 -0600 @@ -35,10 +35,12 @@ typedef u32 pcidev_t;
#define REG_VENDOR_ID 0x00 -#define REG_DEVICE_ID 0x04 +#define REG_COMMAND 0x04 #define REG_HEADER_TYPE 0x0E #define REG_PRIMARY_BUS 0x18
+#define REG_COMMAND_BM (1 << 2) + #define HEADER_TYPE_NORMAL 0 #define HEADER_TYPE_BRIDGE 1 #define HEADER_TYPE_CARDBUS 2 @@ -64,4 +66,6 @@ int pci_find_device(u16 vid, u16 did, pcidev_t *dev); u32 pci_read_resource(pcidev_t dev, int bar);
+void pci_set_bus_master(pcidev_t dev); + #endif
jordan.crouse@amd.com schrieb:
Allow the payload to enable a PCI device as a bus master.
#define REG_VENDOR_ID 0x00 -#define REG_DEVICE_ID 0x04 +#define REG_COMMAND 0x04 Why was REG_DEVICE_ID there, and why can it be removed now?
Other than that, Acked-by: Patrick Georgi patrick.georgi@coresystems.de
On 18/10/08 21:49 +0200, Patrick Georgi wrote:
jordan.crouse@amd.com schrieb:
Allow the payload to enable a PCI device as a bus master.
#define REG_VENDOR_ID 0x00 -#define REG_DEVICE_ID 0x04 +#define REG_COMMAND 0x04 Why was REG_DEVICE_ID there, and why can it be removed now?
REG_DEVICE_ID was flat out wrong (the device ID lives at 0x02).
Jordan
Make libpayload applications multiboot compatible. Add the multiboot OS table and grok the loader table, especially the memory map and the command line. This makes libpayload applications loadable by GRUB.
Signed-off-by: Jordan Crouse jordan.crouse@amd.com Index: libpayload/Config.in =================================================================== --- libpayload.orig/Config.in 2008-10-17 14:37:39.000000000 -0600 +++ libpayload/Config.in 2008-10-17 14:41:15.000000000 -0600 @@ -35,6 +35,14 @@ bool default y
+menu "Architecture Options" + +config MULTIBOOT + bool "Multiboot header support" + default y + +endmenu + menu "Standard Libraries"
config LIBC Index: libpayload/Makefile =================================================================== --- libpayload.orig/Makefile 2008-10-17 14:38:47.000000000 -0600 +++ libpayload/Makefile 2008-10-17 14:41:15.000000000 -0600 @@ -76,6 +76,11 @@ BUILD-y := crypto/Makefile.inc libc/Makefile.inc drivers/Makefile.inc BUILD-$(CONFIG_TINYCURSES) += curses/Makefile.inc
+# The primary target needs to be here before we include the +# other files + +all: lib + include $(PLATFORM-y) $(BUILD-y)
OBJS := $(patsubst %,$(obj)/%,$(TARGETS-y)) Index: libpayload/i386/Makefile.inc =================================================================== --- libpayload.orig/i386/Makefile.inc 2008-10-17 14:38:09.000000000 -0600 +++ libpayload/i386/Makefile.inc 2008-10-17 14:41:15.000000000 -0600 @@ -31,3 +31,5 @@ TARGETS-y += i386/timer.o i386/coreboot.o i386/util.S.o TARGETS-y += i386/exec.S.o i386/virtual.o
+# Multiboot support is configurable +TARGETS-$(CONFIG_MULTIBOOT) += i386/multiboot.o Index: libpayload/i386/head.S =================================================================== --- libpayload.orig/i386/head.S 2008-10-17 14:37:39.000000000 -0600 +++ libpayload/i386/head.S 2008-10-17 14:41:15.000000000 -0600 @@ -27,6 +27,7 @@ * SUCH DAMAGE. */
+ .code32 .global _entry, _leave .text .align 4 @@ -42,6 +43,21 @@ /* We're back - go back to the bootloader. */ ret
+ .align 4 + +#define MB_MAGIC 0x1BADB002 +#define MB_FLAGS 0x00010003 + +mb_header: + .long MB_MAGIC + .long MB_FLAGS + .long -(MB_MAGIC + MB_FLAGS) + .long mb_header + .long _start + .long _edata + .long _end + .long _init + /* * This function saves off the previous stack and switches us to our * own execution environment. @@ -53,6 +69,11 @@ /* Store current stack pointer. */ movl %esp, %esi
+ /* Store EAX and EBX */ + + movl %eax,loader_eax + movl %ebx,loader_ebx + /* Setup new stack. */ movl $_stack, %ebx
Index: libpayload/i386/main.c =================================================================== --- libpayload.orig/i386/main.c 2008-10-17 14:38:09.000000000 -0600 +++ libpayload/i386/main.c 2008-10-17 14:41:36.000000000 -0600 @@ -29,13 +29,21 @@
#include <libpayload.h>
+unsigned long loader_eax; /**< The value of EAX passed from the loader */ +unsigned long loader_ebx; /**< The value of EBX passed from the loader */ + +unsigned int main_argc; /**< The argc value to pass to main() */ + +/** The argv value to pass to main() */ +char *main_argv[MAX_ARGC_COUNT]; + /** * This is our C entry function - set up the system * and jump into the payload entry point. */ void start_main(void) { - extern int main(void); + extern int main(int argc, char **argv);
/* Set up the consoles. */ console_init(); @@ -52,7 +60,8 @@ * Go to the entry point. * In the future we may care about the return value. */ - (void) main(); + + (void) main(main_argc, (main_argc != 0) ? main_argv : NULL);
/* * Returning here will go to the _leave function to return Index: libpayload/i386/multiboot.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libpayload/i386/multiboot.c 2008-10-17 14:41:15.000000000 -0600 @@ -0,0 +1,96 @@ +/* + * This file is part of the libpayload project. + * + * Copyright (C) 2008 Advanced Micro Devices, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <config.h> +#include <libpayload.h> +#include <multiboot_tables.h> + +extern unsigned long loader_eax; +extern unsigned long loader_ebx; + +static void mb_parse_mmap(struct multiboot_header *table, + struct sysinfo_t *info) +{ + u8 *start = (u8 *) phys_to_virt(table->mmap_addr); + u8 *ptr = start; + + info->n_memranges = 0; + + while(ptr < (start + table->mmap_length)) { + struct multiboot_mmap *mmap = (struct multiboot_mmap *) ptr; + + /* 1 == normal RAM. Ignore everything else for now */ + + if (mmap->type == 1) { + info->memrange[info->n_memranges].base = mmap->addr; + info->memrange[info->n_memranges].size = mmap->length; + + if (++info->n_memranges == SYSINFO_MAX_MEM_RANGES) + return; + } + + ptr += (mmap->size + sizeof(mmap->size)); + } +} + +static void mb_parse_cmdline(struct multiboot_header *table) +{ + extern int main_argc; + extern char *main_argv[]; + char *c = phys_to_virt(table->cmdline); + + while(*c != '\0' && main_argc < MAX_ARGC_COUNT) { + main_argv[main_argc++] = c; + + for( ; *c != '\0' && !isspace(*c); c++); + + if (*c) { + *c = 0; + c++; + } + } +} + +int get_multiboot_info(struct sysinfo_t *info) +{ + struct multiboot_header *table; + + if (loader_eax != MULTIBOOT_MAGIC) + return -1; + + table = (struct multiboot_header *) phys_to_virt(loader_ebx); + + if (table->flags & MULTIBOOT_FLAGS_MMAP) + mb_parse_mmap(table, info); + + if (table->flags & MULTIBOOT_FLAGS_CMDLINE) + mb_parse_cmdline(table); + + return 0; +} Index: libpayload/i386/sysinfo.c =================================================================== --- libpayload.orig/i386/sysinfo.c 2008-10-17 14:37:39.000000000 -0600 +++ libpayload/i386/sysinfo.c 2008-10-17 14:41:15.000000000 -0600 @@ -29,6 +29,7 @@
#include <config.h> #include <libpayload.h> +#include <multiboot_tables.h>
/** * This is a global structure that is used through the library - we set it @@ -48,7 +49,15 @@ /* Get the CPU speed (for delays). */ lib_sysinfo.cpu_khz = get_cpu_speed();
- /* Get the memory information. */ +#ifdef CONFIG_MULTIBOOT + /* Get the information from the multiboot tables, + * if they exist */ + get_multiboot_info(&lib_sysinfo); +#endif + + /* Get information from the coreboot tables, + * if they exist */ + get_coreboot_info(&lib_sysinfo);
if (!lib_sysinfo.n_memranges) { Index: libpayload/include/libpayload.h =================================================================== --- libpayload.orig/include/libpayload.h 2008-10-17 14:37:39.000000000 -0600 +++ libpayload/include/libpayload.h 2008-10-17 14:41:15.000000000 -0600 @@ -64,6 +64,8 @@
#define RAND_MAX 0x7fffffff
+#define MAX_ARGC_COUNT 10 + /* * Payload information parameters - these are used to pass information * to the entity loading the payload. @@ -407,6 +409,7 @@ * @{ */ int get_coreboot_info(struct sysinfo_t *info); +int get_multiboot_info(struct sysinfo_t *info);
void lib_get_sysinfo(void);
Index: libpayload/include/multiboot_tables.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libpayload/include/multiboot_tables.h 2008-10-17 14:41:15.000000000 -0600 @@ -0,0 +1,76 @@ +/* + * This file is part of the libpayload project. + * + * Copyright (C) 2008 Advanced Micro Devices, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef MULTIBOOT_TABLES_H_ +#define MULTIBOOT_TABLES_H_ + +#include <arch/types.h> + +#define MULTIBOOT_MAGIC 0x2BADB002UL +#define MULTIBOOT_FLAGS_MMAP (1 << 6) +#define MULTIBOOT_FLAGS_CMDLINE (1 << 2) +struct multiboot_header { + u32 flags; + u32 mem_lower; + u32 mem_higher; + u32 boot_device; + u32 cmdline; + u32 mods_count; + u32 mods_addr; + + u32 syms[4]; + + u32 mmap_length; + u32 mmap_addr; + + u32 drives_length; + u32 drives_addr; + + u32 config_table; + + u32 boot_loader_name; + + u32 apm_table; + + u32 vbe_control_info; + u32 vbe_mode_info; + u32 vbe_mode; + u32 vbe_interface_seg; + u32 vbe_interface_off; + u32 vbe_interface_len; +}; + +struct multiboot_mmap { + u32 size; + u64 addr; + u64 length; + u32 type; +} __attribute((packed)); + +#endif Index: libpayload/lib/libpayload.ldscript =================================================================== --- libpayload.orig/lib/libpayload.ldscript 2008-10-17 14:37:39.000000000 -0600 +++ libpayload/lib/libpayload.ldscript 2008-10-17 14:41:15.000000000 -0600 @@ -60,6 +60,8 @@ *(.data.*) }
+ _edata = .; + .bss : { *(.bss) *(.bss.*)
jordan.crouse@amd.com wrote:
- (void) main(main_argc, (main_argc != 0) ? main_argv : NULL);
Shouldn't we always pass argv[0] - is this different with multiboot?
Otherwise:
Acked-by: Peter Stuge peter@stuge.se
On 19/10/08 04:53 +0200, Peter Stuge wrote:
jordan.crouse@amd.com wrote:
- (void) main(main_argc, (main_argc != 0) ? main_argv : NULL);
Shouldn't we always pass argv[0] - is this different with multiboot?
multiboot does pass the name of the payload as argv[0]. For coreboot, what would we pass? I don't think we understand any names - its all just bits on the ROM.
Jordan
Remove a possiblity for evil recusion and fix the function and slot definition in the PCI search loop
Signed-off-by: Jordan Crouse jordan.crouse@amd.com Index: libpayload/drivers/pci.c =================================================================== --- libpayload.orig/drivers/pci.c 2008-10-17 14:39:52.000000000 -0600 +++ libpayload/drivers/pci.c 2008-10-17 14:45:17.000000000 -0600 @@ -75,27 +75,36 @@ unsigned char hdr;
for (devfn = 0; devfn < 0x100; devfn++) { - val = pci_read_config32(PCI_DEV(bus, PCI_SLOT(devfn), - PCI_FUNC(devfn)), REG_VENDOR_ID); + int func = devfn & 0x7; + int slot = (devfn >> 3) & 0x1f; + + val = pci_read_config32(PCI_DEV(bus, slot, func), + REG_VENDOR_ID);
if (val == 0xffffffff || val == 0x00000000 || val == 0x0000ffff || val == 0xffff0000) continue;
if (val == ((did << 16) | vid)) { - *dev = PCI_DEV(bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); + *dev = PCI_DEV(bus, slot, func); return 1; }
- hdr = pci_read_config8(PCI_DEV(bus, PCI_SLOT(devfn), - PCI_FUNC(devfn)), REG_HEADER_TYPE); + hdr = pci_read_config8(PCI_DEV(bus, slot, func), + REG_HEADER_TYPE); hdr &= 0x7F;
if (hdr == HEADER_TYPE_BRIDGE || hdr == HEADER_TYPE_CARDBUS) { unsigned int busses; - busses = pci_read_config32(PCI_DEV(bus, PCI_SLOT(devfn), - PCI_FUNC(devfn)), REG_PRIMARY_BUS); - if (find_on_bus((busses >> 8) & 0xFF, vid, did, dev)) + busses = pci_read_config32(PCI_DEV(bus, slot, func), + REG_PRIMARY_BUS); + busses = (busses >> 8) & 0xFF; + + /* Avoid recursion if the new bus is the same as + * the old bus (insert lame The Who joke here) */ + + if ((busses != bus) && + find_on_bus(busses, vid, did, dev)) return 1; } }
jordan.crouse@amd.com schrieb:
Remove a possiblity for evil recusion and fix the function and slot definition in the PCI search loop
Signed-off-by: Jordan Crouse jordan.crouse@amd.com Acked-by: Patrick Georgi patrick.georgi@coresystems.de
On 18/10/08 19:06 +0200, Patrick Georgi wrote:
jordan.crouse@amd.com schrieb:
Remove a possiblity for evil recusion and fix the function and slot definition in the PCI search loop
Signed-off-by: Jordan Crouse jordan.crouse@amd.com Acked-by: Patrick Georgi patrick.georgi@coresystems.de
r3674. Thanks.
If the system in question does not have a superIO, then a read of 0x64 will return 0xFF and we will loop forever.
Signed-off-by: Jordan Crouse jordan.crouse@amd.com Index: libpayload/drivers/keyboard.c =================================================================== --- libpayload.orig/drivers/keyboard.c 2008-10-15 17:22:11.000000000 -0600 +++ libpayload/drivers/keyboard.c 2008-10-15 17:39:12.000000000 -0600 @@ -175,11 +175,10 @@ while (inb(0x64) & 2); }
- int keyboard_havechar(void) { unsigned char c = inb(0x64); - return c & 1; + return (c == 0xFF) ? 0 : c & 1; }
unsigned char keyboard_get_scancode(void) @@ -332,6 +331,12 @@ u8 mode; map = &keyboard_layouts[0];
+ /* If 0x64 returns 0xff, then we have no keyboard + * controller */ + + if (inb(0x64) == 0xFF) + return; + /* Empty keyboard buffer */ while (keyboard_havechar()) keyboard_getchar();
Signed-off-by: Jordan Crouse jordan.crouse@amd.com Acked-by: Patrick Georgi patrick.georgi@coresystems.de
On 18/10/08 09:13 +0200, Patrick Georgi wrote:
Signed-off-by: Jordan Crouse jordan.crouse@amd.com Acked-by: Patrick Georgi patrick.georgi@coresystems.de
r3675. Thanks.
Signed-off-by: Jordan Crouse jordan.crouse@amd.com Index: libpayload/include/libpayload.h =================================================================== --- libpayload.orig/include/libpayload.h 2008-10-16 15:10:04.000000000 -0600 +++ libpayload/include/libpayload.h 2008-10-16 15:10:27.000000000 -0600 @@ -327,6 +327,8 @@ char *strdup(const char *s); char *strstr(const char *h, const char *n); char *strsep(char **stringp, const char *delim); +unsigned int strtoul(const char *s, char **nptr, int base); + /** @} */
/** Index: libpayload/libc/string.c =================================================================== --- libpayload.orig/libc/string.c 2008-10-16 15:03:53.000000000 -0600 +++ libpayload/libc/string.c 2008-10-16 15:10:27.000000000 -0600 @@ -271,3 +271,95 @@ return token; }
+/* Check that a character is in the valid range for the + given base +*/ + +static int _valid(char ch, int base) +{ + char end = (base > 9) ? '9' : '0' + (base - 1); + + /* all bases will be some subset of the 0-9 range */ + + if (ch >= '0' && ch <= end) + return 1; + + /* Bases > 11 will also have to match in the a-z range */ + + if (base > 11) { + if (tolower(ch) >= 'a' && + tolower(ch) <= 'a' + (base - 11)) + return 1; + } + + return 0; +} + +/* Return the "value" of the character in the given base */ + +static int _offset(char ch, int base) +{ + if (ch >= '0' && ch <= '9') + return ch - '0'; + else + return tolower(ch) - 'a'; +} + +/** + * Convert the initial portion of a string into an unsigned int + * @param ptr A pointer to the string to convert + * @param nptr A pointer to the unconverted part of the string + * @param base The base of the number to convert, or 0 for auto + * @return An unsigned integer representation of the string + */ + +unsigned int strtoul(const char *ptr, char **endptr, int base) +{ + int ret = 0; + + if (endptr != NULL) + *endptr = (char *) ptr; + + /* Purge whitespace */ + + for( ; *ptr && isspace(*ptr); ptr++); + + if (!*ptr) + return 0; + + /* Determine the base */ + + if (base == 0) { + if (ptr[0] == '0' && (ptr[1] == 'x' || ptr[1] == 'X')) + base = 16; + else if (ptr[0] == '0') { + base = 8; + ptr++; + } + else + base = 10; + } + + /* Base 16 allows the 0x on front - so skip over it */ + + if (base == 16) { + if (ptr[0] == '0' && (ptr[1] == 'x' || ptr[1] == 'X')) + ptr += 2; + } + + /* If the first character isn't valid, then don't + * bother */ + + if (!*ptr || !_valid(*ptr, base)) + return 0; + + for( ; *ptr && _valid(*ptr, base); ptr++) + ret = (ret * base) + _offset(*ptr, base); + + if (endptr != NULL) + *endptr = (char *) ptr; + + return ret; +} + +
jordan.crouse@amd.com schrieb:
Signed-off-by: Jordan Crouse jordan.crouse@amd.com [...] +/** + * Convert the initial portion of a string into an unsigned int + * @param ptr A pointer to the string to convert + * @param nptr A pointer to the unconverted part of the string
endptr, as in the declaration
Tested build, reviewed, but no functional test. With that in mind, Acked-by: Patrick Georgi patrick.georgi@coresystems.de
On 18/10/08 09:02 +0200, Patrick Georgi wrote:
jordan.crouse@amd.com schrieb:
Signed-off-by: Jordan Crouse jordan.crouse@amd.com [...] +/**
- Convert the initial portion of a string into an unsigned int
- @param ptr A pointer to the string to convert
- @param nptr A pointer to the unconverted part of the string
endptr, as in the declaration
Tested build, reviewed, but no functional test. With that in mind, Acked-by: Patrick Georgi patrick.georgi@coresystems.de
r3676. Thanks.
On faster machines, delta might be more then 32 bits
Signed-off-by: Jordan Crouse jordan.crouse@amd.com Index: libpayload/i386/timer.c =================================================================== --- libpayload.orig/i386/timer.c 2008-10-17 14:37:38.000000000 -0600 +++ libpayload/i386/timer.c 2008-10-17 14:48:53.000000000 -0600 @@ -75,7 +75,7 @@ return cpu_khz; }
-static inline void _delay(unsigned int delta) +static inline void _delay(unsigned long long delta) { unsigned long long timeout = rdtsc() + delta; while (rdtsc() < timeout) ;
jordan.crouse@amd.com schrieb:
On faster machines, delta might be more then 32 bits
Signed-off-by: Jordan Crouse jordan.crouse@amd.com
Acked-by: Patrick Georgi patrick.georgi@coresystems.de
On 18/10/08 09:16 +0200, Patrick Georgi wrote:
jordan.crouse@amd.com schrieb:
On faster machines, delta might be more then 32 bits
Signed-off-by: Jordan Crouse jordan.crouse@amd.com
Acked-by: Patrick Georgi patrick.georgi@coresystems.de
r3677. Thanks.