From: David Gibson <david@gibson.dropbear.id.au>
To: Scott Wood <scottwood@freescale.com>
Cc: linuxppc-dev@ozlabs.org, paulus@samba.org
Subject: Re: [PATCH 14/20] bootwrapper: Add strtoull().
Date: Tue, 21 Aug 2007 12:47:13 +1000 [thread overview]
Message-ID: <20070821024713.GM15469@localhost.localdomain> (raw)
In-Reply-To: <20070820174004.GM30562@ld0162-tx32.am.freescale.net>
On Mon, Aug 20, 2007 at 12:40:04PM -0500, Scott Wood wrote:
> This will be needed by PlanetCore firmware support.
>
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> ---
> arch/powerpc/boot/Makefile | 2 +-
> arch/powerpc/boot/stdlib.c | 41 +++++++++++++++++++++++++++++++++++++++++
> arch/powerpc/boot/stdlib.h | 6 ++++++
> 3 files changed, 48 insertions(+), 1 deletions(-)
> create mode 100644 arch/powerpc/boot/stdlib.c
> create mode 100644 arch/powerpc/boot/stdlib.h
>
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index 4ab5f75..bad54ba 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -45,7 +45,7 @@ src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \
> ns16550.c serial.c simple_alloc.c div64.S util.S \
> gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \
> 44x.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c \
> - cpm-serial.c
> + cpm-serial.c stdlib.c
> src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c \
> cuboot-ebony.c treeboot-ebony.c prpmc2800.c \
> ps3-head.S ps3-hvcall.S ps3.c cuboot-8xx.c cuboot-pq2.c
> diff --git a/arch/powerpc/boot/stdlib.c b/arch/powerpc/boot/stdlib.c
> new file mode 100644
> index 0000000..ed6e728
> --- /dev/null
> +++ b/arch/powerpc/boot/stdlib.c
> @@ -0,0 +1,41 @@
> +/*
> + * stdlib functions
> + *
> + * Author: Scott Wood <scottwood@freescale.com>
> + *
> + * Copyright (c) 2007 Freescale Semiconductor, Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 as published
> + * by the Free Software Foundation.
> + */
> +
> +#include "stdlib.h"
> +
> +/* Not currently supported: leading whitespace, sign, 0x prefix, zero base */
> +unsigned long long int strtoull(const char *ptr, char **end, int base)
> +{
> + unsigned long long ret = 0;
> +
> + while (*ptr) {
> + int digit;
> +
> + if (*ptr >= '0' && *ptr <= '9')
> + digit = *ptr - '0';
> + else if (*ptr >= 'A' && *ptr <= 'Z')
> + digit = *ptr - 'A' + 10;
> + else if (*ptr >= 'a' && *ptr <= 'z')
> + digit = *ptr - 'a' + 10;
> + else
> + break;
Hrm... I note this has no sort of error checking if the string has
digits which don't fit in the given base.
> + ret *= base;
> + ret += digit;
> + ptr++;
> + }
> +
> + if (end)
> + *end = (char *)ptr;
> +
> + return ret;
> +}
> diff --git a/arch/powerpc/boot/stdlib.h b/arch/powerpc/boot/stdlib.h
> new file mode 100644
> index 0000000..1bf01ac
> --- /dev/null
> +++ b/arch/powerpc/boot/stdlib.h
> @@ -0,0 +1,6 @@
> +#ifndef _PPC_BOOT_STDLIB_H_
> +#define _PPC_BOOT_STDLIB_H_
> +
> +unsigned long long int strtoull(const char *ptr, char **end, int base);
> +
> +#endif
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
next prev parent reply other threads:[~2007-08-21 2:47 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-20 17:39 [PATCH 01/20] bootwrapper: Update .gitignore Scott Wood
2007-08-20 17:39 ` [PATCH 02/20] bootwrapper: Set timebase_period_ns from dt_fixup_cpu_clocks Scott Wood
2007-08-21 1:53 ` David Gibson
2007-08-20 17:39 ` [PATCH 03/20] bootwrapper: dt_xlate_range() bugfixes Scott Wood
2007-08-21 2:01 ` David Gibson
2007-08-20 17:39 ` [PATCH 04/20] bootwrapper: Add dt_is_compatible() Scott Wood
2007-08-21 2:28 ` David Gibson
2007-08-20 17:39 ` [PATCH 05/20] bootwrapper: flatdevtree fixes Scott Wood
2007-08-21 2:30 ` David Gibson
2007-08-21 16:09 ` Scott Wood
2007-08-22 1:09 ` David Gibson
2007-08-22 17:24 ` Scott Wood
2007-08-23 2:01 ` David Gibson
2007-08-23 17:48 ` Scott Wood
2007-08-24 1:01 ` David Gibson
2007-08-24 14:48 ` Scott Wood
2007-08-24 22:17 ` David Gibson
2007-08-23 18:00 ` Segher Boessenkool
2007-08-20 17:39 ` [PATCH 06/20] bootwrapper: Add 16-bit I/O, sync(), eieio(), and barrier() Scott Wood
2007-08-21 2:31 ` David Gibson
2007-08-20 17:39 ` [PATCH 07/20] bootwrapper: Add TARGET_HAS_ETHn tests to ppcboot.h Scott Wood
2007-08-21 3:33 ` David Gibson
2007-08-20 17:39 ` [PATCH 08/20] bootwrapper: serial_console_init() fixes Scott Wood
2007-08-21 2:38 ` David Gibson
2007-08-20 17:39 ` [PATCH 09/20] bootwrapper: Declare udelay() in ops.h Scott Wood
2007-08-21 2:39 ` David Gibson
2007-08-21 16:12 ` Scott Wood
2007-08-22 1:09 ` David Gibson
2007-08-20 17:39 ` [PATCH 10/20] bootwrapper: Add CPM serial driver Scott Wood
2007-08-21 2:42 ` David Gibson
2007-08-21 16:15 ` Scott Wood
2007-08-22 1:10 ` David Gibson
2007-08-20 17:39 ` [PATCH 11/20] bootwrapper: Move linker symbols into ops.h Scott Wood
2007-08-21 2:43 ` David Gibson
2007-08-20 17:40 ` [PATCH 12/20] bootwrapper: Add 8xx cuboot support Scott Wood
2007-08-21 2:44 ` David Gibson
2007-08-21 16:20 ` Scott Wood
2007-08-22 1:47 ` David Gibson
2007-08-20 17:40 ` [PATCH 13/20] bootwrapper: Add PowerQUICC II (82xx with CPM) " Scott Wood
2007-08-21 3:30 ` David Gibson
2007-08-20 17:40 ` [PATCH 14/20] bootwrapper: Add strtoull() Scott Wood
2007-08-21 2:47 ` David Gibson [this message]
2007-08-21 16:20 ` Scott Wood
2007-08-20 17:40 ` [PATCH 15/20] bootwrapper: Add dt_get_path() Scott Wood
2007-08-21 3:03 ` David Gibson
2007-08-20 17:40 ` [PATCH 16/20] bootwrapper: Move strncmp() and strchr() from flatdevtree_env.h to string.h Scott Wood
2007-08-21 3:06 ` David Gibson
2007-08-20 17:40 ` [PATCH 17/20] bootwrapper: Add PlanetCore firmware support Scott Wood
2007-08-21 3:16 ` David Gibson
2007-08-21 16:29 ` Scott Wood
2007-08-22 1:20 ` David Gibson
2007-08-20 17:40 ` [PATCH 18/20] bootwrapper: Add a zImage.bin.<platform> target Scott Wood
2007-08-21 3:27 ` David Gibson
2007-08-20 17:40 ` [PATCH 19/20] bootwrapper: Only print MAC addresses when the node is actually present Scott Wood
2007-08-21 3:20 ` David Gibson
2007-08-20 17:40 ` [PATCH 20/20] bootwrapper: Add fsl_get_immr(), mpc885_get_clock(), and pq2_get_clocks() Scott Wood
2007-08-21 3:25 ` David Gibson
2007-08-21 16:34 ` Scott Wood
2007-08-22 1:30 ` David Gibson
2007-08-21 1:50 ` [PATCH 01/20] bootwrapper: Update .gitignore David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070821024713.GM15469@localhost.localdomain \
--to=david@gibson.dropbear.id.au \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.org \
--cc=scottwood@freescale.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).