PowerPC kvm-userspace patches
PATCH v2 1/1 PowerPC kvm-userspace patches
This set address issues disscussed by Hollis on the first go around. As well as some minor fixes.
This set of patches enables the following:
-Device tree Support
- Add libfdt to kvm-userspace
- Add bamboo device tree to qemu source
- Detection of host Device Tree attributes
- Device tree loading
- Ability to specify initrd on the command line
- Ability to add kernel arguments on the command line
- Ability to load compressed uImages
- Ability to specify memory on the command line
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
PATCH 1/1 Add libfdt to KVM userspace
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1205507804 18000
# Branch merge
# Node ID b573d2790e7813337bf26c76a5c773a59592da5d # Parent 6e75956d053d2cc96699100f08d2eef25e219644 Add libfdt to KVM userspace
This patch adds libfdt to allow for motification of device tree entries into the KVM userspace tree.
Makefile +7 -2
@@ -5,7 +5,7 @@ DESTDIR= rpmrelease = devel -.PHONY: kernel user libkvm qemu bios vgabios extboot clean +.PHONY: kernel user libkvm qemu bios vgabios extboot clean libfdt all: libkvm qemu ifneq '$(filter $(ARCH), x86_64 i386 ia64)' ''
@@ -20,6 +20,9 @@ qemu: libkvm qemu: libkvm ifneq '$(filter $(ARCH), i386 x86_64)' '' qemu: extboot +endif +ifneq '$(filter $(ARCH), powerpc)' '' + qemu: libfdt endif user: libkvm
@@ -38,6 +41,8 @@ extboot: || ! cmp -s qemu/pc-bios/extboot.bin extboot/extboot.bin; then \ cp extboot/extboot.bin qemu/pc-bios/extboot.bin; \ fi +libfdt: + $(MAKE) -C $@ bindir = /usr/bin
@@ -88,7 +93,7 @@ srpm: $(RM) $(tmpspec) clean: - for i in $(if $(WANT_MODULE), kernel) user libkvm qemu; do \ + for i in $(if $(WANT_MODULE), kernel) user libkvm qemu libfdt; do \ make -C $$i clean; \ done rm -f config.mak user/config.mak
configure +3 -0
@@ -103,6 +103,9 @@ fi if [ "$arch" = "powerpc" ]; then target_exec="ppcemb-softmmu" + qemu_cflags="$qemu_cflags -I $PWD/libfdt" + qemu_ldflags="$qemu_ldflags -L $PWD/libfdt" + qemu_opts="$qemu_opts --enable-libfdt" fi #configure user dir
libfdt/Makefile new file +19 -0
@@ -0,0 +1,19 @@ +include ../config.mak +include ../user/config.mak + +LIBFDT_SRCS = fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c +LIBFDT_INCLUDES = fdt.h libfdt.h +LIBFDT_EXTRA = libfdt_internal.h +LIBFDT_LIB = libfdt.a + +LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o) + +CFLAGS += -I . + +$(LIBFDT_LIB): $(LIBFDT_OBJS) + $(AR) rcs $@ $^ + +all: $(LIBFDT_LIB) + +clean: + rm -rf *.o *.a
libfdt/README new file +3 -0
@@ -0,0 +1,3 @@ +libfdt was grabbed from dtc source. This is the upstream source for libfdt. +It can be found here: +http://www.jdl.com/software/
libfdt/fdt.c new file +194 -0
194 lines not on this page · raw message
libfdt/fdt.h new file +60 -0
60 lines not on this page · raw message
libfdt/fdt_ro.c new file +476 -0
476 lines not on this page · raw message
libfdt/fdt_rw.c new file +467 -0
467 lines not on this page · raw message
libfdt/fdt_strerror.c new file +96 -0
96 lines not on this page · raw message
libfdt/fdt_sw.c new file +258 -0
258 lines not on this page · raw message
libfdt/fdt_wip.c new file +144 -0
144 lines not on this page · raw message
libfdt/libfdt.h new file +1076 -0
1,076 lines not on this page · raw message
libfdt/libfdt_env.h new file +22 -0
@@ -0,0 +1,22 @@ +#ifndef _LIBFDT_ENV_H +#define _LIBFDT_ENV_H + +#include <stddef.h> +#include <stdint.h> +#include <string.h> +#include <endian.h> +#include <byteswap.h> + +#if __BYTE_ORDER == __BIG_ENDIAN +#define fdt32_to_cpu (x) (x) +#define cpu_to_fdt32 (x) (x) +#define fdt64_to_cpu (x) (x) +#define cpu_to_fdt64 (x) (x) +#else +#define fdt32_to_cpu (x) (bswap_32((x))) +#define cpu_to_fdt32 (x) (bswap_32((x))) +#define fdt64_to_cpu (x) (bswap_64((x))) +#define cpu_to_fdt64 (x) (bswap_64((x))) +#endif + +#endif /* _LIBFDT_ENV_H */
libfdt/libfdt_internal.h new file +96 -0
96 lines not on this page · raw message
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
PATCH 1/1 Add libfdt support to qemu
In reply to Jerone Young# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1205507804 18000
# Branch merge
# Node ID d96091321011ee86681f00bbaf72337ebc937791 # Parent b573d2790e7813337bf26c76a5c773a59592da5d Add libfdt support to qemu
This patch adds needed configuration options to compile in libfdt support into qemu.
qemu/Makefile.target +5 -0
@@ -555,6 +555,11 @@ ifdef CONFIG_VNC_TLS ifdef CONFIG_VNC_TLS CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS) LIBS += $(CONFIG_VNC_TLS_LIBS) +endif + +ifdef CONFIG_LIBFDT +LIBS += -lfdt +DEPLIBS += libfdt.a endif # SCSI layer
qemu/configure +8 -0
@@ -112,6 +112,7 @@ uname_release="" uname_release="" curses="yes" cpu_emulation="yes" +device_tree_support="no" # OS specific targetos=`uname -s`
@@ -345,6 +346,8 @@ for opt do ;; --disable-cpu-emulation) cpu_emulation="no" ;; + --enable-libfdt) device_tree_support="yes" + ;; *) echo "ERROR: unknown option $opt"; exit 1 ;; esac
@@ -449,6 +452,7 @@ echo " --enable-uname-release=R Return echo " --enable-uname-release=R Return R for uname -r in usermode emulation" echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" echo " --disable-cpu-emulation disables use of qemu cpu emulation code" +echo " --enable-libfdt enable libfdt support for device tree support" echo "" echo "NOTE: The object files are built at the place where configure is launched" exit 1
@@ -1186,6 +1190,10 @@ elif test "$target_cpu" = "ppcemb" ; the echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h echo "#define TARGET_PPC 1" >> $config_h echo "#define TARGET_PPCEMB 1" >> $config_h + if test "$device_tree_support" = "yes" ; then + echo "#define CONFIG_LIBFDT 1" >> $config_h + echo "CONFIG_LIBFDT=1" >> $config_mak + fi configure_kvm elif test "$target_cpu" = "ppc64" ; then echo "TARGET_ARCH=ppc64" >> $config_mak
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Re: [PATCH 2 of 7] Add libfdt support to qemu
Instead of having an explicit --enable-libfdt, it would be nicer to compile probe for it and then provide a --disable-libfdt option. Then it Just Works without a special configure flag.
Regards,
Anthony Liguori
Quoted 69 lines · Jerone Young
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1205507804 18000
# Branch merge
# Node IDd96091321011ee86681f00bbaf72337ebc937791# Parentb573d2790e7813337bf26c76a5c773a59592da5dAdd libfdt support to qemuThis patch adds needed configuration options to compile in libfdt support into qemu.
Signed-off-by Jerone Young <[email protected]>qemu/Makefile.target +5
-0@@ -555,6 +555,11 @@ ifdef CONFIG_VNC_TLS ifdef CONFIG_VNC_TLS CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS) LIBS += $(CONFIG_VNC_TLS_LIBS) +endif + +ifdef CONFIG_LIBFDT +LIBS += -lfdt +DEPLIBS += libfdt.a endif # SCSI layerqemu/configure +8
-1@@ -112,6 +112,7 @@ uname_release="" uname_release="" curses="yes" cpu_emulation="yes" +device_tree_support="no" # OS specific targetos=`uname -s`@@ -345,6 +346,8 @@ for opt do ;; --disable-cpu-emulation) cpu_emulation="no" ;; + --enable-libfdt) device_tree_support="yes" + ;; *) echo "ERROR: unknown option $opt"; exit 1 ;; esac@@ -449,6 +452,7 @@ echo " --enable-uname-release=R Return echo " --enable-uname-release=R Return R for uname -r in usermode emulation" echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" echo " --disable-cpu-emulation disables use of qemu cpu emulation code" +echo " --enable-libfdt enable libfdt support for device tree support" echo "" echo "NOTE: The object files are built at the place where configure is launched" exit 1@@ -1186,6 +1190,10 @@ elif test "$target_cpu" = "ppcemb" ; the echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h echo "#define TARGET_PPC 1" >> $config_h echo "#define TARGET_PPCEMB 1" >> $config_h + if test "$device_tree_support" = "yes" ; then + echo "#define CONFIG_LIBFDT 1" >> $config_h + echo "CONFIG_LIBFDT=1" >> $config_mak + fi configure_kvm elif test "$target_cpu" = "ppc64" ; then echo "TARGET_ARCH=ppc64" >> $config_mak -------------------------------------------------------------------------
Quoted 8 lines
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
PATCH 1/1 Create new load_uboot() & gunzip support to uboot loader in Qemu
In reply to Jerone Young# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1205507804 18000
# Branch merge
# Node ID 8b68dc88abc897e7502e2c73ca1e40eb2084104f
# Parent d96091321011ee86681f00bbaf72337ebc937791 Create new load_uboot() & gunzip support to uboot loader in Qemu
This patch adds the ability for the load address to be caputred when loading a uImage or cuImage. It also adds a better return code as the size can be an usigned long. This is done by creating a new function prototype and calling it load_uboot_l . To keep compatibility with code already using the old load_uboot a wrapper function has been created so current callers will not break them.
Also added is gunzip support to allow for loading of uimages with a compressed kenrel imagexs.
qemu/loader.c +147 -9
@@ -26,6 +26,8 @@#include "sysemu.h" #include "uboot_image.h" +#include <zlib.h> +/* return the size or -1 if error */ int get_image_size (const char *filename) {
@@ -263,14 +265,106 @@ static void bswap_uboot_header(uboot_ima }/* Load a U-Boot image. */ -int load_uboot (const char *filename,target_ulong *ep,int *is_linux) -{ - + +/* gunzip functionality is derived from gunzip function +* in uboot source code +*/ + +#define ZALLOC_ALIGNMENT 16 + +static void *zalloc (void *x,unsigned items,unsigned size) +{ +void *p; + + size *= items; + size = (size +ZALLOC_ALIGNMENT -1 ) & ~(ZALLOC_ALIGNMENT -1 ); + + p =malloc (size); + +return (p); +} + +static void zfree (void *x,void *addr,unsigned nb) +{ +free (addr); +} + + +#define HEAD_CRC 2 +#define EXTRA_FIELD 4 +#define ORIG_NAME 8 +#define COMMENT 0x10 +#define RESERVED 0xe0 + +#define DEFLATED 8 + +static int gunzip (void *dst,int dstlen,unsigned char *src, +unsigned long *lenp) +{ +z_stream s; +int r, i, flags; + +/* skip header */ + i =10 ; + flags = src[3 ]; +if (src[2 ] !=DEFLATED || (flags &RESERVED ) !=0 ) { +puts ("Error: Bad gzipped data\n" ); +return -1 ; + } +if ((flags &EXTRA_FIELD ) !=0 ) + i =12 + src[10 ] + (src[11 ] <<8 ); +if ((flags &ORIG_NAME ) !=0 ) +while (src[i++] !=0 ) + ; +if ((flags &COMMENT ) !=0 ) +while (src[i++] !=0 ) + ; +if ((flags &HEAD_CRC ) !=0 ) + i +=2 ; +if (i >= *lenp) { +puts ("Error: gunzip out of data in header\n" ); +return -1 ; + } + + s.zalloc = zalloc; + s.zfree = zfree; + + r =inflateInit2 (&s, -MAX_WBITS ); +if (r !=Z_OK ) { +printf ("Error: inflateInit2() returned %d\n" , r); +return (-1 ); + } + s.next_in = src + i; + s.avail_in = *lenp - i; + s.next_out = dst; + s.avail_out = dstlen; + r =inflate (&s,Z_FINISH ); +if (r !=Z_OK && r !=Z_STREAM_END ) { +printf ("Error: inflate() returned %d\n" , r); +return -1 ; + } + *lenp = s.next_out - (unsigned char *) dst; +inflateEnd (&s); + +return 0 ; +} + + +#define MAX_KERNEL_SIZE 8*1024*1024 //8MB +/* This functions can load uImage & cuImage files */ +int load_uimage (const char *filename,target_ulong *ep, +target_ulong *load_address, +target_ulong *loaded_image_size, +int *is_linux) +{int fd;int size; +int ret;uboot_image_header_t h;uboot_image_header_t *hdr = &h;uint8_t *data =NULL ; +uint8_t *uncompressed_data =NULL ; +unsigned long tmp_loaded_image_size; fd =open (filename,O_RDONLY |O_BINARY );if (fd <0 )
@@ -291,13 +385,14 @@ int load_uboot(const char *filename, tar goto fail; } -/* TODO: Implement compressed images. */ -if (hdr->ih_comp !=IH_COMP_NONE ) { -fprintf (stderr,"Unable to load compressed u-boot images\n" ); +/* TODO bzip2 support */ +if (hdr->ih_comp ==IH_COMP_BZIP2 ) { +fprintf (stderr,"Unable to load bzip2 compressed u-boot images\n" ); goto fail; }/* TODO: Check CPU type. */ +if (is_linux) {if (hdr->ih_type ==IH_TYPE_KERNEL && hdr->ih_os ==IH_OS_LINUX ) *is_linux =1 ;
@@ -306,6 +401,7 @@ int load_uboot(const char *filename, tar } *ep = hdr->ih_ep; + data =qemu_malloc (hdr->ih_size);if (!data) goto fail;
@@ -315,9 +411,36 @@ int load_uboot(const char *filename, tar goto fail; } -cpu_physical_memory_write_rom (hdr->ih_load, data, hdr->ih_size); - -return hdr->ih_size; + tmp_loaded_image_size = hdr->ih_size; + +if (hdr->ih_comp ==IH_COMP_GZIP ) { + uncompressed_data =qemu_malloc (MAX_KERNEL_SIZE ); + ret =gunzip (uncompressed_data,MAX_KERNEL_SIZE , + (unsigned char *) data, + &tmp_loaded_image_size); + +if (ret <0 ) { +fprintf (stderr,"Unable to decompress gziped image!\n" ); + goto fail; + } + +qemu_free (data); +cpu_physical_memory_write_rom (hdr->ih_load, uncompressed_data, + tmp_loaded_image_size); + + } +else { +cpu_physical_memory_write_rom (hdr->ih_load, data, + tmp_loaded_image_size); + } + +if (loaded_image_size !=NULL ) + *loaded_image_size = tmp_loaded_image_size; + +if ( load_address !=NULL ) + *load_address = hdr->ih_load; + +return 0 ; fail:if (data)
@@ -325,3 +448,18 @@ fail:close (fd);return -1 ; } + + +int load_uboot (const char *filename,target_ulong *ep,int *is_linux) +{ +int ret; +target_ulong size; + + + ret =load_uimage (filename, ep,NULL , &size, is_linux); + +if (ret <0 ) +return ret; +else +return (int )size; +}
qemu/sysemu.h +3 -0
@@ -182,6 +182,9 @@ int load_elf(const char *filename, int64 uint64_t *pentry, uint64_t *lowaddr, uint64_t *highaddr);int load_aout (const char *filename,uint8_t *addr);int load_uboot (const char *filename,target_ulong *ep,int *is_linux); +int load_uimage (const char *filename,target_ulong *ep, +target_ulong *la,target_ulong *loaded_image_size, +int *is_linux);#endif #ifdef HAS_AUDIO
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
PATCH 1/1 Add PPC 440EP bamboo board device tree source & binary into qemu
In reply to Jerone Young# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1205514170 18000
# Branch merge
# Node ID 60d8930ecedd292053f9c5340c95704b20e10c65
# Parent 8b68dc88abc897e7502e2c73ca1e40eb2084104f
Add PPC 440EP bamboo board device tree source & binary into qemu
This patch places the bamboo device tree for the PPC 440EP bamboo board into the pc-bios directory of the qemu source. This also adds a rule into the pc-bios/Makefile to build device tree files.
qemu/Makefile +2 -1
@@ -195,7 +195,8 @@ endif mkdir -p "$(DESTDIR)$(datadir)" for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ video.x openbios-sparc32 pxe-ne2k_pci.bin \ - pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin extboot.bin; \ + pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin extboot.bin \ + bamboo.dtb; \ do \ $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ done
qemu/pc-bios/Makefile +4 -1
@@ -12,6 +12,9 @@ all: $(TARGETS) %.o: %.S $(CC) $(DEFINES) -c -o $@ $< +%.dtb: %.dts + dtc -O dtb -I dts -o $@ $< + clean: - rm -f $(TARGETS) *.o *~ + rm -f $(TARGETS) *.o *~ *.dtb
qemu/pc-bios/bamboo.dtb new file binary +0 -0
qemu/pc-bios/bamboo.dts new file +301 -0
301 lines not on this page · raw message
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Re: [kvm-ppc-devel] [PATCH 4 of 7] Add PPC 440EP bamboo board device tree source & binary into qemu
There is no zImage, so those comments do not make sense. "Filled in by loader" would be more accurate.
You left MAL0 and EMAC0 commented out; please remove them.
You left PCI0 uncommented; please comment it out until qemu actually emulates the PCI controller.
Signature · 2 lines
Hollis Blanchard IBM Linux Technology Center
Quoted 373 lines · Jerone Young
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1205514170 18000
# Branch merge
# Node ID60d8930ecedd292053f9c5340c95704b20e10c65
# Parent8b68dc88abc897e7502e2c73ca1e40eb2084104f
Add PPC 440EP bamboo board device tree source & binary into qemuThis patch places the bamboo device tree for the PPC 440EP bamboo board into the pc-bios directory of the qemu source. This also adds a rule into the pc-bios/Makefile to build device tree files.
Signed-off-by Jerone Young <[email protected]>qemu/Makefile +2
-1@@ -195,7 +195,8 @@ endif mkdir -p "$(DESTDIR)$(datadir)" for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ video.x openbios-sparc32 pxe-ne2k_pci.bin \ - pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin extboot.bin; \ + pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin extboot.bin \ + bamboo.dtb; \ do \ $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ doneqemu/pc-bios/Makefile +4
-1@@ -12,6 +12,9 @@ all: $(TARGETS) %.o: %.S $(CC) $(DEFINES) -c -o $@ $< +%.dtb: %.dts + dtc -O dtb -I dts -o $@ $< + clean: - rm -f $(TARGETS) *.o *~ + rm -f $(TARGETS) *.o *~ *.dtbqemu/pc-bios/bamboo.dtb new file binary +0
-0qemu/pc-bios/bamboo.dts new file +301
-1@@ -0,0 +1,301 @@ +/* + * Device Tree Source for AMCC Bamboo + * + * Copyright (c) 2006, 2007 IBM Corp. + * Josh Boyer <[email protected]> + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without + * any warranty of any kind, whether express or implied. + */ + +/ { + #address-cells = <2>; + #size-cells = <1>; + model = "amcc,bamboo"; + compatible = "amcc,bamboo"; + dcr-parent = <&/cpus/cpu@0>; + + aliases { + serial0 = &UART0; + serial1 = &UART1; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + model = "PowerPC,440EP"; + reg = <0>; + clock-frequency = <1fca0550>; + timebase-frequency = <017d7840>; + i-cache-line-size = <20>; + d-cache-line-size = <20>; + i-cache-size = <8000>; + d-cache-size = <8000>; + dcr-controller; + dcr-access-method = "native"; + }; + }; + + memory { + device_type = "memory"; + reg = <0 0 9000000>; + }; + + UIC0: interrupt-controller0 { + compatible = "ibm,uic-440ep","ibm,uic"; + interrupt-controller; + cell-index = <0>; + dcr-reg = <0c0 009>; + #address-cells = <0>; + #size-cells = <0>; + #interrupt-cells = <2>; + }; +/* + UIC1: interrupt-controller1 { + compatible = "ibm,uic-440ep","ibm,uic"; + interrupt-controller; + cell-index = <1>; + dcr-reg = <0d0 009>; + #address-cells = <0>; + #size-cells = <0>; + #interrupt-cells = <2>; + interrupts = <1e 4 1f 4>; + interrupt-parent = <&UIC0>; + }; +*/ + + SDR0: sdr { + compatible = "ibm,sdr-440ep"; + dcr-reg = <00e 002>; + }; + + CPR0: cpr { + compatible = "ibm,cpr-440ep"; + dcr-reg = <00c 002>; + }; + + plb { + compatible = "ibm,plb-440ep", "ibm,plb-440gp", "ibm,plb4"; + #address-cells = <2>; + #size-cells = <1>; + ranges; + clock-frequency = <07f28154>; /* Filled in by zImage */ + + SDRAM0: sdram { + compatible = "ibm,sdram-440ep", "ibm,sdram-405gp"; + dcr-reg = <010 2>; + }; + + DMA0: dma { + compatible = "ibm,dma-440ep", "ibm,dma-440gp"; + dcr-reg = <100 027>; + }; + +/* + MAL0: mcmal { + compatible = "ibm,mcmal-440ep", "ibm,mcmal-440gp", "ibm,mcmal"; + dcr-reg = <180 62>; + num-tx-chans = <4>; + num-rx-chans = <2>; + interrupt-parent = <&MAL0>; + interrupts = <0 1 2 3 4>; + #interrupt-cells = <1>; + #address-cells = <0>; + #size-cells = <0>; + interrupt-map = <0 &UIC0 a 4 + 1 &UIC0 b 4 + 2 &UIC1 0 4 + 3 &UIC1 1 4 + 4 &UIC1 2 4>; + }; +*/ + POB0: opb { + compatible = "ibm,opb-440ep", "ibm,opb-440gp", "ibm,opb"; + #address-cells = <1>; + #size-cells = <1>; + /* Bamboo is oddball in the 44x world and doesn't use the ERPN + * bits. + */ + ranges = <00000000 0 00000000 80000000 + 80000000 0 80000000 80000000>; + /* interrupt-parent = <&UIC1>; */ + interrupts = <7 4>; + clock-frequency = <0>; /* Filled in by zImage */ + + EBC0: ebc { + compatible = "ibm,ebc-440ep", "ibm,ebc-440gp", "ibm,ebc"; + dcr-reg = <012 2>; + #address-cells = <2>; + #size-cells = <1>; + clock-frequency = <>; /* Filled in by zImage */ + interrupts = <5 1>; + /* interrupt-parent = <&UIC1>; */ + }; + + UART0: serial@ef600300 { + device_type = "serial"; + compatible = "ns16550"; + reg = <ef600300 8>; + virtual-reg = <ef600300>; + clock-frequency = <00a8c000>; /* Filled in by zImage */ + current-speed = <1c200>; + interrupt-parent = <&UIC0>; + interrupts = <0 4>; + }; + + UART1: serial@ef600400 { + device_type = "serial"; + compatible = "ns16550"; + reg = <ef600400 8>; + virtual-reg = <ef600400>; + clock-frequency = <00a8c000>; + current-speed = <0>; + interrupt-parent = <&UIC0>; + interrupts = <1 4>; + }; +/* + UART2: serial@ef600500 { + device_type = "serial"; + compatible = "ns16550"; + reg = <ef600500 8>; + virtual-reg = <ef600500>; + clock-frequency = <0>; + current-speed = <0>; + interrupt-parent = <&UIC0>; + interrupts = <3 4>; + }; + + UART3: serial@ef600600 { + device_type = "serial"; + compatible = "ns16550"; + reg = <ef600600 8>; + virtual-reg = <ef600600>; + clock-frequency = <0>; + current-speed = <0>; + interrupt-parent = <&UIC0>; + interrupts = <4 4>; + }; + +*/ + IIC0: i2c@ef600700 { + device_type = "i2c"; + compatible = "ibm,iic-440ep", "ibm,iic-440gp", "ibm,iic"; + reg = <ef600700 14>; + interrupt-parent = <&UIC0>; + interrupts = <2 4>; + }; + + IIC1: i2c@ef600800 { + device_type = "i2c"; + compatible = "ibm,iic-440ep", "ibm,iic-440gp", "ibm,iic"; + reg = <ef600800 14>; + interrupt-parent = <&UIC0>; + interrupts = <7 4>; + }; + + ZMII0: emac-zmii@ef600d00 { + device_type = "zmii-interface"; + compatible = "ibm,zmii-440ep", "ibm,zmii-440gp", "ibm,zmii"; + reg = <ef600d00 c>; + }; + +/* + EMAC0: ethernet@ef600e00 { + linux,network-index = <0>; + device_type = "network"; + compatible = "ibm,emac-440ep", "ibm,emac-440gp", "ibm,emac"; + interrupt-parent = <&UIC1>; + interrupts = <1c 4 1d 4>; + reg = <ef600e00 70>; + local-mac-address = [000000000000]; + mal-device = <&MAL0>; + mal-tx-channel = <0 1>; + mal-rx-channel = <0>; + cell-index = <0>; + max-frame-size = <5dc>; + rx-fifo-size = <1000>; + tx-fifo-size = <800>; + phy-mode = "rmii"; + phy-map = <00000000>; + zmii-device = <&ZMII0>; + zmii-channel = <0>; + }; + + EMAC1: ethernet@ef600f00 { + linux,network-index = <1>; + device_type = "network"; + compatible = "ibm,emac-440ep", "ibm,emac-440gp", "ibm,emac"; + interrupt-parent = <&UIC1>; + interrupts = <1e 4 1f 4>; + reg = <ef600f00 70>; + local-mac-address = [000000000000]; + mal-device = <&MAL0>; + mal-tx-channel = <2 3>; + mal-rx-channel = <1>; + cell-index = <1>; + max-frame-size = <5dc>; + rx-fifo-size = <1000>; + tx-fifo-size = <800>; + phy-mode = "rmii"; + phy-map = <00000000>; + zmii-device = <&ZMII0>; + zmii-channel = <1>; + }; + + usb@ef601000 { + compatible = "ohci-be"; + reg = <ef601000 80>; + interrupts = <8 1 9 1>; + interrupt-parent = < &UIC1 >; + }; +*/ + }; + + PCI0: pci@ec000000 { + device_type = "pci"; + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + compatible = "ibm,plb440ep-pci", "ibm,plb-pci"; + primary; + reg = <0 eec00000 8 /* Config space access */ + 0 eed00000 4 /* IACK */ + 0 eed00000 4 /* Special cycle */ + 0 ef400000 40>; /* Internal registers */ + + /* Outbound ranges, one memory and one IO, + * later cannot be changed. Chip supports a second + * IO range but we don't use it for now + */ + ranges = <02000000 0 a0000000 0 a0000000 0 20000000 + 01000000 0 00000000 0 e8000000 0 00010000>; + + /* Inbound 2GB range starting at 0 */ + dma-ranges = <42000000 0 0 0 0 0 80000000>; + + /* Bamboo has all 4 IRQ pins tied together per slot */ + interrupt-map-mask = <f800 0 0 0>; + interrupt-map = < + /* IDSEL 1 */ + 0800 0 0 0 &UIC0 1c 8 + + /* IDSEL 2 */ + 1000 0 0 0 &UIC0 1b 8 + + /* IDSEL 3 */ + 1800 0 0 0 &UIC0 1a 8 + + /* IDSEL 4 */ + 2000 0 0 0 &UIC0 19 8 + >; + }; + }; + + chosen { + linux,stdout-path = "/plb/opb/serial@ef600300"; + }; +}; -------------------------------------------------------------------------
Quoted 7 lines
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-ppc-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Re: [kvm-ppc-devel] [PATCH 4 of 7] Add PPC 440EP bamboo board device tree source & binary into qemu
Quoted 2 lines · Hollis Blanchard
There is no zImage, so those comments do not make sense. "Filled in by loader" would be more accurate.
Currently the values there are hard coded. But I do still need to know what values are filled in by zImage, that we are currently not filling in yet. This can be changed.
Quoted 2 lines
You left MAL0 and EMAC0 commented out; please remove them.
I left these out.
Quoted 3 lines
You left PCI0 uncommented; please comment it out until qemu actually emulates the PCI controller.
oh forgot about this. Since I have the PCI stuff in my local repo. I'll do this again.
Quoted 387 lines
Signature · 3 lines
-- Hollis Blanchard IBM Linux Technology CenterQuoted 373 lines · Jerone Young
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1205514170 18000
# Branch merge
# Node ID60d8930ecedd292053f9c5340c95704b20e10c65
# Parent8b68dc88abc897e7502e2c73ca1e40eb2084104f
Add PPC 440EP bamboo board device tree source & binary into qemuThis patch places the bamboo device tree for the PPC 440EP bamboo board into the pc-bios directory of the qemu source. This also adds a rule into the pc-bios/Makefile to build device tree files.
Signed-off-by Jerone Young <[email protected]>qemu/Makefile +2
-1@@ -195,7 +195,8 @@ endif mkdir -p "$(DESTDIR)$(datadir)" for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ video.x openbios-sparc32 pxe-ne2k_pci.bin \ - pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin extboot.bin; \ + pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin extboot.bin \ + bamboo.dtb; \ do \ $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ doneqemu/pc-bios/Makefile +4
-1@@ -12,6 +12,9 @@ all: $(TARGETS) %.o: %.S $(CC) $(DEFINES) -c -o $@ $< +%.dtb: %.dts + dtc -O dtb -I dts -o $@ $< + clean: - rm -f $(TARGETS) *.o *~ + rm -f $(TARGETS) *.o *~ *.dtbqemu/pc-bios/bamboo.dtb new file binary +0
-0qemu/pc-bios/bamboo.dts new file +301
-1@@ -0,0 +1,301 @@ +/* + * Device Tree Source for AMCC Bamboo + * + * Copyright (c) 2006, 2007 IBM Corp. + * Josh Boyer <[email protected]> + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without + * any warranty of any kind, whether express or implied. + */ + +/ { + #address-cells = <2>; + #size-cells = <1>; + model = "amcc,bamboo"; + compatible = "amcc,bamboo"; + dcr-parent = <&/cpus/cpu@0>; + + aliases { + serial0 = &UART0; + serial1 = &UART1; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + model = "PowerPC,440EP"; + reg = <0>; + clock-frequency = <1fca0550>; + timebase-frequency = <017d7840>; + i-cache-line-size = <20>; + d-cache-line-size = <20>; + i-cache-size = <8000>; + d-cache-size = <8000>; + dcr-controller; + dcr-access-method = "native"; + }; + }; + + memory { + device_type = "memory"; + reg = <0 0 9000000>; + }; + + UIC0: interrupt-controller0 { + compatible = "ibm,uic-440ep","ibm,uic"; + interrupt-controller; + cell-index = <0>; + dcr-reg = <0c0 009>; + #address-cells = <0>; + #size-cells = <0>; + #interrupt-cells = <2>; + }; +/* + UIC1: interrupt-controller1 { + compatible = "ibm,uic-440ep","ibm,uic"; + interrupt-controller; + cell-index = <1>; + dcr-reg = <0d0 009>; + #address-cells = <0>; + #size-cells = <0>; + #interrupt-cells = <2>; + interrupts = <1e 4 1f 4>; + interrupt-parent = <&UIC0>; + }; +*/ + + SDR0: sdr { + compatible = "ibm,sdr-440ep"; + dcr-reg = <00e 002>; + }; + + CPR0: cpr { + compatible = "ibm,cpr-440ep"; + dcr-reg = <00c 002>; + }; + + plb { + compatible = "ibm,plb-440ep", "ibm,plb-440gp", "ibm,plb4"; + #address-cells = <2>; + #size-cells = <1>; + ranges; + clock-frequency = <07f28154>; /* Filled in by zImage */ + + SDRAM0: sdram { + compatible = "ibm,sdram-440ep", "ibm,sdram-405gp"; + dcr-reg = <010 2>; + }; + + DMA0: dma { + compatible = "ibm,dma-440ep", "ibm,dma-440gp"; + dcr-reg = <100 027>; + }; + +/* + MAL0: mcmal { + compatible = "ibm,mcmal-440ep", "ibm,mcmal-440gp", "ibm,mcmal"; + dcr-reg = <180 62>; + num-tx-chans = <4>; + num-rx-chans = <2>; + interrupt-parent = <&MAL0>; + interrupts = <0 1 2 3 4>; + #interrupt-cells = <1>; + #address-cells = <0>; + #size-cells = <0>; + interrupt-map = <0 &UIC0 a 4 + 1 &UIC0 b 4 + 2 &UIC1 0 4 + 3 &UIC1 1 4 + 4 &UIC1 2 4>; + }; +*/ + POB0: opb { + compatible = "ibm,opb-440ep", "ibm,opb-440gp", "ibm,opb"; + #address-cells = <1>; + #size-cells = <1>; + /* Bamboo is oddball in the 44x world and doesn't use the ERPN + * bits. + */ + ranges = <00000000 0 00000000 80000000 + 80000000 0 80000000 80000000>; + /* interrupt-parent = <&UIC1>; */ + interrupts = <7 4>; + clock-frequency = <0>; /* Filled in by zImage */ + + EBC0: ebc { + compatible = "ibm,ebc-440ep", "ibm,ebc-440gp", "ibm,ebc"; + dcr-reg = <012 2>; + #address-cells = <2>; + #size-cells = <1>; + clock-frequency = <>; /* Filled in by zImage */ + interrupts = <5 1>; + /* interrupt-parent = <&UIC1>; */ + }; + + UART0: serial@ef600300 { + device_type = "serial"; + compatible = "ns16550"; + reg = <ef600300 8>; + virtual-reg = <ef600300>; + clock-frequency = <00a8c000>; /* Filled in by zImage */ + current-speed = <1c200>; + interrupt-parent = <&UIC0>; + interrupts = <0 4>; + }; + + UART1: serial@ef600400 { + device_type = "serial"; + compatible = "ns16550"; + reg = <ef600400 8>; + virtual-reg = <ef600400>; + clock-frequency = <00a8c000>; + current-speed = <0>; + interrupt-parent = <&UIC0>; + interrupts = <1 4>; + }; +/* + UART2: serial@ef600500 { + device_type = "serial"; + compatible = "ns16550"; + reg = <ef600500 8>; + virtual-reg = <ef600500>; + clock-frequency = <0>; + current-speed = <0>; + interrupt-parent = <&UIC0>; + interrupts = <3 4>; + }; + + UART3: serial@ef600600 { + device_type = "serial"; + compatible = "ns16550"; + reg = <ef600600 8>; + virtual-reg = <ef600600>; + clock-frequency = <0>; + current-speed = <0>; + interrupt-parent = <&UIC0>; + interrupts = <4 4>; + }; + +*/ + IIC0: i2c@ef600700 { + device_type = "i2c"; + compatible = "ibm,iic-440ep", "ibm,iic-440gp", "ibm,iic"; + reg = <ef600700 14>; + interrupt-parent = <&UIC0>; + interrupts = <2 4>; + }; + + IIC1: i2c@ef600800 { + device_type = "i2c"; + compatible = "ibm,iic-440ep", "ibm,iic-440gp", "ibm,iic"; + reg = <ef600800 14>; + interrupt-parent = <&UIC0>; + interrupts = <7 4>; + }; + + ZMII0: emac-zmii@ef600d00 { + device_type = "zmii-interface"; + compatible = "ibm,zmii-440ep", "ibm,zmii-440gp", "ibm,zmii"; + reg = <ef600d00 c>; + }; + +/* + EMAC0: ethernet@ef600e00 { + linux,network-index = <0>; + device_type = "network"; + compatible = "ibm,emac-440ep", "ibm,emac-440gp", "ibm,emac"; + interrupt-parent = <&UIC1>; + interrupts = <1c 4 1d 4>; + reg = <ef600e00 70>; + local-mac-address = [000000000000]; + mal-device = <&MAL0>; + mal-tx-channel = <0 1>; + mal-rx-channel = <0>; + cell-index = <0>; + max-frame-size = <5dc>; + rx-fifo-size = <1000>; + tx-fifo-size = <800>; + phy-mode = "rmii"; + phy-map = <00000000>; + zmii-device = <&ZMII0>; + zmii-channel = <0>; + }; + + EMAC1: ethernet@ef600f00 { + linux,network-index = <1>; + device_type = "network"; + compatible = "ibm,emac-440ep", "ibm,emac-440gp", "ibm,emac"; + interrupt-parent = <&UIC1>; + interrupts = <1e 4 1f 4>; + reg = <ef600f00 70>; + local-mac-address = [000000000000]; + mal-device = <&MAL0>; + mal-tx-channel = <2 3>; + mal-rx-channel = <1>; + cell-index = <1>; + max-frame-size = <5dc>; + rx-fifo-size = <1000>; + tx-fifo-size = <800>; + phy-mode = "rmii"; + phy-map = <00000000>; + zmii-device = <&ZMII0>; + zmii-channel = <1>; + }; + + usb@ef601000 { + compatible = "ohci-be"; + reg = <ef601000 80>; + interrupts = <8 1 9 1>; + interrupt-parent = < &UIC1 >; + }; +*/ + }; + + PCI0: pci@ec000000 { + device_type = "pci"; + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + compatible = "ibm,plb440ep-pci", "ibm,plb-pci"; + primary; + reg = <0 eec00000 8 /* Config space access */ + 0 eed00000 4 /* IACK */ + 0 eed00000 4 /* Special cycle */ + 0 ef400000 40>; /* Internal registers */ + + /* Outbound ranges, one memory and one IO, + * later cannot be changed. Chip supports a second + * IO range but we don't use it for now + */ + ranges = <02000000 0 a0000000 0 a0000000 0 20000000 + 01000000 0 00000000 0 e8000000 0 00010000>; + + /* Inbound 2GB range starting at 0 */ + dma-ranges = <42000000 0 0 0 0 0 80000000>; + + /* Bamboo has all 4 IRQ pins tied together per slot */ + interrupt-map-mask = <f800 0 0 0>; + interrupt-map = < + /* IDSEL 1 */ + 0800 0 0 0 &UIC0 1c 8 + + /* IDSEL 2 */ + 1000 0 0 0 &UIC0 1b 8 + + /* IDSEL 3 */ + 1800 0 0 0 &UIC0 1a 8 + + /* IDSEL 4 */ + 2000 0 0 0 &UIC0 19 8 + >; + }; + }; + + chosen { + linux,stdout-path = "/plb/opb/serial@ef600300"; + }; +}; -------------------------------------------------------------------------Quoted 7 lines
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-ppc-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
PATCH 1/1 Add dynamic device tree manipulation & change uboot loader for PPC bamboo board model
In reply to Jerone Young# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1205514172 18000
# Branch merge
# Node ID 9dd933f712ce2983997be94bae401572d5bba8f2
# Parent 60d8930ecedd292053f9c5340c95704b20e10c65
Add dynamic device tree manipulation & change uboot loader for PPC bamboo board model
This patch adds code to dynamically manipulate the device tree when loaded into memory. This allows us to finally have the ability to manipulate the kernel command line & initrd from the qemu command line. This will also let us setup different settings for the board.
This patch also now uses new uboot loader uboot_loader_l() to load kernel image.
qemu/Makefile.target +1 -1
@@ -615,7 +615,7 @@ OBJS+= unin_pci.o ppc_chrp.o OBJS+= unin_pci.o ppc_chrp.o # PowerPC 4xx boards OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc405_uc.o ppc405_boards.o -OBJS+= ppc440.o ppc440_bamboo.o +OBJS+= ppc440.o ppc440_bamboo.o device_tree.o endif ifeq ($(TARGET_BASE_ARCH), mips) OBJS+= mips_r4k.o mips_malta.o mips_pica61.o mips_mipssim.o
qemu/hw/device_tree.c new file +181 -0
181 lines not on this page · raw message
qemu/hw/device_tree.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* Header with function prototypes to help device tree manipulation using +* libfdt. It also provides functions to read entries from device tree proc +* interface. +* +* Copyright 2008 IBM Corporation. +* Authors: Jerone Young <[email protected]> +* +* This work is licensed under the GNU GPL license version 2 or later. +* +*/ + +/* device-tree proc support functions */ +uint32_t read_proc_dt_prop_cell (char *path_in_device_tree); + +#ifdef CONFIG_LIBFDT +/* device tree functions */ +void *load_device_tree (char *filename_path,target_ulong load_addr); +void dump_device_tree_to_file (void *fdt,char *filename); +void dt_cell (void *fdt,char *node_path,char *property, +uint32_t val); +void dt_string (void *fdt,char *node_path,char *property, +char *string); +#endif
qemu/hw/ppc440_bamboo.c +68 -18
132 lines not on this page · raw message
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
PATCH 1/1 Modify PPC bamboo & ppc440 board models
In reply to Jerone Young# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1205514173 18000
# Branch merge
# Node ID 63237bde74818a5dc3cdb1baee781dab101290ce # Parent 9dd933f712ce2983997be94bae401572d5bba8f2 Modify PPC bamboo & ppc440 board models
This patch renames pp440_init to ppc440ep_init, as ppc440 is the name of the core and ppc440ep is the name of the SOC. When we init we are initializing the SOC.
Also in this patch we now call cpu_ppc_init for bamboo with string 440 .. as 440 is the core.
qemu/hw/ppc440.c +1 -1
@@ -10,7 +10,7 @@#include "ppc440.h" -void ppc440_init(CPUState *env, +void ppc440ep_init(CPUState *env, target_phys_addr_t ram_bases[2], target_phys_addr_t ram_sizes[2], qemu_irq **picp,
qemu/hw/ppc440.h +1 -1
@@ -20,7 +20,7 @@#include "exec-all.h" #include "boards.h" -void ppc440_init(CPUState *env, +void ppc440ep_init(CPUState *env, target_phys_addr_t ram_bases[2], target_phys_addr_t ram_sizes[2], qemu_irq **picp,
qemu/hw/ppc440_bamboo.c +2 -3
@@ -68,8 +68,7 @@ void bamboo_init(ram_addr_t ram_size, inprintf ("Ram size of domain is %d bytes\n" , (int )ram_size);/* Setup CPU */ -/* XXX We cheat for now and use 405 */ - env =cpu_ppc_init ("405" ); + env =cpu_ppc_init ("440" );if (!env) {fprintf (stderr,"Unable to initilize CPU!\n" );exit (1 );
@@ -77,7 +76,7 @@ void bamboo_init(ram_addr_t ram_size, in/* call init */ printf ("Calling function ppc440_init\n" ); -ppc440_init (env, ram_bases, ram_sizes, &pic,1 ); +ppc440ep_init (env, ram_bases, ram_sizes, &pic,1 );printf ("Done calling ppc440_init\n" );/* Register mem */
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
PATCH 1/1 Add ability to specify ram on command line for bamboo board model
In reply to Jerone Young# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1205514174 18000
# Branch merge
# Node ID 3060b75a9597d4ab67c23871df41fc5e5476df2b
# Parent 63237bde74818a5dc3cdb1baee781dab101290ce
Add ability to specify ram on command line for bamboo board model
This patch adds the ability to now specify ram sizes on the command line. Due to the nature of the code there are restictions on exactly how much ram and the multiple that the size must match.
qemu/hw/ppc440_bamboo.c +35 -17
@@ -40,32 +40,50 @@ void bamboo_init(ram_addr_t ram_size, intarget_ulong dt_base=0 ;void *fdt;int ret; +unsigned long ram_sticks[] = {0 ,0 };/* Value will be in bytes */ +ram_addr_t tmp_ram_size; +int ram_stick_sizes[] = {256 ,128 ,64 ,32 ,16 ,8 };/* in Mega bytes */ +int i=0 , k=0 ;uint32_t cpu_freq;uint32_t timebase_freq;printf ("%s: START\n" , __func__); -/* Setup Memory */ -if (ram_size) { -printf ("Ram size specified on command line is %i bytes\n" , - (int )ram_size); -printf ("WARNING: RAM is hard coded to 144MB\n" ); - } -else { -printf ("Using defualt ram size of %iMB\n" , - ((int )ram_size/1024 )/1024 ); +/* Setup Memory */ +printf ("Ram size passed is: %i MB\n" , + ((int )ram_size/1024 )/1024 ); + + tmp_ram_size = ram_size; + +for (i=0 ; i < (sizeof (ram_sticks)/sizeof (unsigned long )); i++) + { +for (k=0 ; k < (sizeof (ram_stick_sizes)/sizeof (int )); k++) + { +if ((((tmp_ram_size/1024 )/1024 )/ram_stick_sizes[k]) >0 ) + { + ram_sticks[i] = ram_stick_sizes[k]*1024 *1024 ; + tmp_ram_size -= ram_stick_sizes[k]*1024 *1024 ; +break ; + } + } + } -/* Each bank can only have memory in configurations of -* 16MB, 32MB, 64MB, 128MB, or 256MB -*/ - ram_bases[0 ] =0x0 ; - ram_sizes[0 ] =0x08000000 ; - ram_bases[1 ] =0x0 ; - ram_sizes[1 ] =0x01000000 ; +if (tmp_ram_size) +printf ("WARNING: %i left over memory is ram\n" , + (tmp_ram_size/1024 )/1024 ); -printf ("Ram size of domain is %d bytes\n" , (int )ram_size); +/* Each bank can only have memory in configurations of +* 4MB, 8MB, 16MB, 32MB, 64MB, 128MB, or 256MB +* why? see sdram_bcr() +* +* Max of 512MB +*/ + ram_bases[0 ] =0x0 ; + ram_sizes[0 ] = ram_sticks[0 ]; + ram_bases[1 ] =0x0 ; + ram_sizes[1 ] = ram_sticks[1 ];/* Setup CPU */ env =cpu_ppc_init ("440" );
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Re: [kvm-ppc-devel] [PATCH 7 of 7] Add ability to specify ram on command line for bamboo board model
Quoted 49 lines · Jerone Young
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1205514174 18000
# Branch merge
# Node ID3060b75a9597d4ab67c23871df41fc5e5476df2b
# Parent63237bde74818a5dc3cdb1baee781dab101290ce
Add ability to specify ram on command line for bamboo board modelThis patch adds the ability to now specify ram sizes on the command line. Due to the nature of the code there are restictions on exactly how much ram and the multiple that the size must match.
Signed-off-by Jerone Young <[email protected]>qemu/hw/ppc440_bamboo.c +13
-9@@ -40,32 +40,50 @@ void bamboo_init(ram_addr_t ram_size, intarget_ulong dt_base=0 ;void *fdt;int ret; +unsigned long ram_sticks[] = {0 ,0 };/* Value will be in bytes */ +ram_addr_t tmp_ram_size; +int ram_stick_sizes[] = {256 ,128 ,64 ,32 ,16 ,8 };/* in Mega bytes */ +int i=0 , k=0 ;uint32_t cpu_freq;uint32_t timebase_freq;printf ("%s: START\n" , __func__); -/* Setup Memory */ -if (ram_size) { -printf ("Ram size specified on command line is %i bytes\n" , - (int )ram_size); -printf ("WARNING: RAM is hard coded to 144MB\n" ); - } -else { -printf ("Using defualt ram size of %iMB\n" , - ((int )ram_size/1024 )/1024 ); +/* Setup Memory */ +printf ("Ram size passed is: %i MB\n" , + ((int )ram_size/1024 )/1024 ); + + tmp_ram_size = ram_size; + +for (i=0 ; i < (sizeof (ram_sticks)/sizeof (unsigned long )); i++) + { +for (k=0 ; k < (sizeof (ram_stick_sizes)/sizeof (int )); k++)
qemu/hw/ppc440_bamboo.c void bamboo_init(ram_addr_t ram_size, in · line 71
Quoted 10 lines
qemu/hw/ppc440_bamboo.c +9
-0+ { +if ((((tmp_ram_size/1024 )/1024 )/ram_stick_sizes[k]) >0 ) + { + ram_sticks[i] = ram_stick_sizes[k]*1024 *1024 ; + tmp_ram_size -= ram_stick_sizes[k]*1024 *1024 ; +break ; + } + } + }
Please match the curly brace syntax used everywhere else.
Also, I don't think it makes any sense to multiply and divide by 1024*1024 everywhere; just use the proper units to begin with. Try N<<20 to represent N MB.
"tmp_ram_size" is also unnecessary; just subtract from "ram_size" and see if it's non-zero at the end.
Quoted 12 lines
qemu/hw/ppc440_bamboo.c +3
-8-/* Each bank can only have memory in configurations of -* 16MB, 32MB, 64MB, 128MB, or 256MB -*/ - ram_bases[0 ] =0x0 ; - ram_sizes[0 ] =0x08000000 ; - ram_bases[1 ] =0x0 ; - ram_sizes[1 ] =0x01000000 ; +if (tmp_ram_size) +printf ("WARNING: %i left over memory is ram\n" , + (tmp_ram_size/1024 )/1024 ); -printf ("Ram size of domain is %d bytes\n" , (int )ram_size);
qemu/hw/ppc440_bamboo.c void bamboo_init(ram_addr_t ram_size, in · line 86
Quoted 10 lines
qemu/hw/ppc440_bamboo.c +10
-0+/* Each bank can only have memory in configurations of +* 4MB, 8MB, 16MB, 32MB, 64MB, 128MB, or 256MB +* why? see sdram_bcr() +* +* Max of 512MB +*/ + ram_bases[0 ] =0x0 ; + ram_sizes[0 ] = ram_sticks[0 ]; + ram_bases[1 ] =0x0 ; + ram_sizes[1 ] = ram_sticks[1 ];
Why keep a separate ram_sticks[] array? Just operate directly on ram_sizes[], and while you're at it stop hardcoding 2 entries: the SDRAM controller can emulate all 4.
Also, ram_bases[1] here is very wrong; that definitely needs to be fixed.
Signature · 8 lines
Hollis Blanchard IBM Linux Technology Center ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Re: [kvm-ppc-devel] [PATCH 7 of 7] Add ability to specify ram on command line for bamboo board model
Quoted 81 lines · Hollis Blanchard
Quoted 49 lines · Jerone Young
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1205514174 18000
# Branch merge
# Node ID3060b75a9597d4ab67c23871df41fc5e5476df2b
# Parent63237bde74818a5dc3cdb1baee781dab101290ce
Add ability to specify ram on command line for bamboo board modelThis patch adds the ability to now specify ram sizes on the command line. Due to the nature of the code there are restictions on exactly how much ram and the multiple that the size must match.
Signed-off-by Jerone Young <[email protected]>qemu/hw/ppc440_bamboo.c +13
-9@@ -40,32 +40,50 @@ void bamboo_init(ram_addr_t ram_size, intarget_ulong dt_base=0 ;void *fdt;int ret; +unsigned long ram_sticks[] = {0 ,0 };/* Value will be in bytes */ +ram_addr_t tmp_ram_size; +int ram_stick_sizes[] = {256 ,128 ,64 ,32 ,16 ,8 };/* in Mega bytes */ +int i=0 , k=0 ;uint32_t cpu_freq;uint32_t timebase_freq;printf ("%s: START\n" , __func__); -/* Setup Memory */ -if (ram_size) { -printf ("Ram size specified on command line is %i bytes\n" , - (int )ram_size); -printf ("WARNING: RAM is hard coded to 144MB\n" ); - } -else { -printf ("Using defualt ram size of %iMB\n" , - ((int )ram_size/1024 )/1024 ); +/* Setup Memory */ +printf ("Ram size passed is: %i MB\n" , + ((int )ram_size/1024 )/1024 ); + + tmp_ram_size = ram_size; + +for (i=0 ; i < (sizeof (ram_sticks)/sizeof (unsigned long )); i++) + { +for (k=0 ; k < (sizeof (ram_stick_sizes)/sizeof (int )); k++)qemu/hw/ppc440_bamboo.c void bamboo_init(ram_addr_t ram_size, in · line 71
Quoted 10 lines
qemu/hw/ppc440_bamboo.c +9
-0+ { +if ((((tmp_ram_size/1024 )/1024 )/ram_stick_sizes[k]) >0 ) + { + ram_sticks[i] = ram_stick_sizes[k]*1024 *1024 ; + tmp_ram_size -= ram_stick_sizes[k]*1024 *1024 ; +break ; + } + } + }Please match the curly brace syntax used everywhere else.
Also, I don't think it makes any sense to multiply and divide by 1024*1024 everywhere; just use the proper units to begin with. Try N<<20 to represent N MB.
"
tmp_ram_size" is also unnecessary; just subtract from "ram_size" and see if it's non-zero at the end.Quoted 11 lines
qemu/hw/ppc440_bamboo.c +3
-7-/* Each bank can only have memory in configurations of -* 16MB, 32MB, 64MB, 128MB, or 256MB -*/ - ram_bases[0 ] =0x0 ; - ram_sizes[0 ] =0x08000000 ; - ram_bases[1 ] =0x0 ; - ram_sizes[1 ] =0x01000000 ; +if (tmp_ram_size) +printf ("WARNING: %i left over memory is ram\n" , + (tmp_ram_size/1024 )/1024 );
Quoted 15 lines
qemu/hw/ppc440_bamboo.c void bamboo_init(ram_addr_t ram_size, in · line 86
Quoted 11 lines
qemu/hw/ppc440_bamboo.c +10
-1-printf ("Ram size of domain is %d bytes\n" , (int )ram_size); +/* Each bank can only have memory in configurations of +* 4MB, 8MB, 16MB, 32MB, 64MB, 128MB, or 256MB +* why? see sdram_bcr() +* +* Max of 512MB +*/ + ram_bases[0 ] =0x0 ; + ram_sizes[0 ] = ram_sticks[0 ]; + ram_bases[1 ] =0x0 ; + ram_sizes[1 ] = ram_sticks[1 ];Why keep a separate ram_sticks[] array? Just operate directly on ram_sizes[], and while you're at it stop hardcoding 2 entries: the SDRAM controller can emulate all 4.
Sure can just manipulate these directly. As for the ram_bases have been this way since day 1. If it's works don't break it :-). I'll look into the SDRAM controller doing 4 slots.
Quoted 3 lines
Also, ram_bases[1] here is very wrong; that definitely needs to be fixed.
I need to see exactly what these ram_bases mean in the emulation code. This could be right, as I believe this is how it's done in other qemu code? I'll look and see.
Quoted 1 line
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Re: [PATCH 7 of 7] Add ability to specify ram on command line for bamboo board model
In reply to Jerone YoungQuoted 18 lines · Jerone Young
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1205514174 18000
# Branch merge
# Node ID3060b75a9597d4ab67c23871df41fc5e5476df2b
# Parent63237bde74818a5dc3cdb1baee781dab101290ce
Add ability to specify ram on command line for bamboo board modelThis patch adds the ability to now specify ram sizes on the command line. Due to the nature of the code there are restictions on exactly how much ram and the multiple that the size must match.
Signed-off-by Jerone Young <[email protected]>
qemu/hw/ppc440_bamboo.c void bamboo_init(ram_addr_t ram_size, in · line 44
Quoted 5 lines
qemu/hw/ppc440_bamboo.c +1
-0@@ -40,32 +40,50 @@ void bamboo_init(ram_addr_t ram_size, intarget_ulong dt_base=0 ;void *fdt;int ret; +unsigned long ram_sticks[] = {0 ,0 };/* Value will be in bytes */
s/unsigned long/ram_addr_t/ or whatever's appropriate. unsigned long should almost never appear in QEMU code.
Quoted 18 lines
qemu/hw/ppc440_bamboo.c +3
-9+ram_addr_t tmp_ram_size; +int ram_stick_sizes[] = {256 ,128 ,64 ,32 ,16 ,8 };/* in Mega bytes */ +int i=0 , k=0 ;uint32_t cpu_freq;uint32_t timebase_freq;printf ("%s: START\n" , __func__); -/* Setup Memory */ -if (ram_size) { -printf ("Ram size specified on command line is %i bytes\n" , - (int )ram_size); -printf ("WARNING: RAM is hard coded to 144MB\n" ); - } -else { -printf ("Using defualt ram size of %iMB\n" , - ((int )ram_size/1024 )/1024 );
qemu/hw/ppc440_bamboo.c void bamboo_init(ram_addr_t ram_size, in · line 72
Quoted 10 lines
qemu/hw/ppc440_bamboo.c +9
-0+/* Setup Memory */ +printf ("Ram size passed is: %i MB\n" , + ((int )ram_size/1024 )/1024 ); + + tmp_ram_size = ram_size; + +for (i=0 ; i < (sizeof (ram_sticks)/sizeof (unsigned long )); i++) + { +for (k=0 ; k < (sizeof (ram_stick_sizes)/sizeof (int )); k++)
This looks like 8 spaces to me? Should be 4 for QEMU code.
Also, if there isn't already an ARRAY_SIZE() macro, now would be a good way to introduce one. Typically one does sizeof(array) / sizeof(array[0]) too to be a bit more defensive about types.
Quoted 38 lines
qemu/hw/ppc440_bamboo.c +22
-8+ { +if ((((tmp_ram_size/1024 )/1024 )/ram_stick_sizes[k]) >0 ) + { + ram_sticks[i] = ram_stick_sizes[k]*1024 *1024 ; + tmp_ram_size -= ram_stick_sizes[k]*1024 *1024 ; +break ; + } + } + } -/* Each bank can only have memory in configurations of -* 16MB, 32MB, 64MB, 128MB, or 256MB -*/ - ram_bases[0 ] =0x0 ; - ram_sizes[0 ] =0x08000000 ; - ram_bases[1 ] =0x0 ; - ram_sizes[1 ] =0x01000000 ; +if (tmp_ram_size) +printf ("WARNING: %i left over memory is ram\n" , + (tmp_ram_size/1024 )/1024 ); -printf ("Ram size of domain is %d bytes\n" , (int )ram_size); +/* Each bank can only have memory in configurations of +* 4MB, 8MB, 16MB, 32MB, 64MB, 128MB, or 256MB +* why? see sdram_bcr() +* +* Max of 512MB +*/ + ram_bases[0 ] =0x0 ; + ram_sizes[0 ] = ram_sticks[0 ]; + ram_bases[1 ] =0x0 ; + ram_sizes[1 ] = ram_sticks[1 ];qemu/hw/ppc440_bamboo.c +0
-1/* Setup CPU */ env =cpu_ppc_init ("440" ); -------------------------------------------------------------------------
Quoted 8 lines
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Quoted 2 lines · Jerone Young
This set address issues disscussed by Hollis on the first go around. As well as some minor fixes.
Btw, please also update the description for patches 3 and 5 to rename "load_uboot_l".
Signature · 8 lines
Hollis Blanchard IBM Linux Technology Center ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/