From: "Bill Rieske" Subject: [PATCH] smbios support large memory guests Date: Thu, 09 Oct 2008 09:44:04 -0600 Message-ID: <48EDD25F.860B.008B.3@novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part3C1597D4.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part3C1597D4.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline This reports more than one memory device if the memory for the guest is = larger than 16G. Signed-off-by: Bill Rieske --=__Part3C1597D4.0__= Content-Type: text/plain; name="smbios-large-mem.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="smbios-large-mem.diff" diff -r e66cecb66b1e tools/firmware/hvmloader/smbios.c=0A--- a/tools/firmwa= re/hvmloader/smbios.c Wed Oct 08 14:00:58 2008 +0100=0A+++ b/tools/firmwa= re/hvmloader/smbios.c Thu Oct 09 09:18:03 2008 -0600=0A@@ -56,11 +56,11 = @@ static void *=0A static void *=0A smbios_type_16_init(void *start, = uint32_t memory_size_mb);=0A static void *=0A-smbios_type_17_init(void = *start, uint32_t memory_size_mb);=0A+smbios_type_17_init(void *start, = uint32_t memory_size_mb, int instance);=0A static void *=0A-smbios_type_19_= init(void *start, uint32_t memory_size_mb);=0A+smbios_type_19_init(void = *start, uint32_t memory_size_mb, int instance);=0A static void *=0A-smbios_= type_20_init(void *start, uint32_t memory_size_mb);=0A+smbios_type_20_init(= void *start, uint32_t memory_size_mb, int instance);=0A static void *=0A = smbios_type_32_init(void *start);=0A static void *=0A@@ -89,9 +89,11 @@ = write_smbios_tables(void *start,=0A uint8_t uuid[16], = char *xen_version,=0A uint32_t xen_major_version, = uint32_t xen_minor_version)=0A {=0A+ uint64_t devmemsize;=0A = unsigned cpu_num, nr_structs =3D 0, max_struct_size =3D 0;=0A char *p, = *q;=0A char cpu_manufacturer[15];=0A+ int i;=0A =0A get_cpu_manu= facturer(cpu_manufacturer, 15);=0A =0A@@ -112,9 +114,15 @@ write_smbios_tab= les(void *start,=0A for ( cpu_num =3D 1; cpu_num <=3D vcpus; cpu_num++ = )=0A do_struct(smbios_type_4_init(p, cpu_num, cpu_manufacturer));= =0A do_struct(smbios_type_16_init(p, memsize));=0A- do_struct(smbios= _type_17_init(p, memsize));=0A- do_struct(smbios_type_19_init(p, = memsize));=0A- do_struct(smbios_type_20_init(p, memsize));=0A+ for ( = i=3D0; memsize; memsize -=3D devmemsize ) =0A+ {=0A+ devmemsize = =3D (memsize < 0x4000) ? memsize : 0x4000; =0A+ /* more than 1 of = each type needed if memsize */=0A+ /* represents greater than 16G = */=0A+ do_struct(smbios_type_17_init(p, devmemsize,i));=0A+ = do_struct(smbios_type_19_init(p, devmemsize,i));=0A+ do_struct(smbio= s_type_20_init(p, devmemsize,i++));=0A+ }=0A do_struct(smbios_type_3= 2_init(p));=0A do_struct(smbios_type_127_init(p));=0A =0A@@ -456,7 = +464,8 @@ smbios_type_16_init(void *start, uint32_=0A p->error_correcti= on =3D 0x01; /* other */=0A p->maximum_capacity =3D memsize * 1024;=0A = p->memory_error_information_handle =3D 0xfffe; /* none provided */=0A- = p->number_of_memory_devices =3D 1;=0A+ p->number_of_memory_devices = =3D ( memsize <=3D 0x4000 )?1:=0A+ ( memsize % 0x4000 )? (memsize >> = 14)+1:memsize >> 14;=0A =0A start +=3D sizeof(struct smbios_type_16);= =0A *((uint16_t *)start) =3D 0;=0A@@ -465,15 +474,16 @@ smbios_type_16_= init(void *start, uint32_=0A =0A /* Type 17 -- Memory Device */=0A static = void *=0A-smbios_type_17_init(void *start, uint32_t memory_size_mb)=0A+smbi= os_type_17_init(void *start, uint32_t memory_size_mb, int instance)=0A = {=0A+ char buf[16];=0A struct smbios_type_17 *p =3D (struct = smbios_type_17 *)start;=0A =0A memset(p, 0, sizeof(*p));=0A =0A = p->header.type =3D 17;=0A p->header.length =3D sizeof(struct = smbios_type_17);=0A- p->header.handle =3D 0x1100;=0A+ p->header.handl= e =3D 0x1100+instance;=0A =0A p->physical_memory_array_handle =3D = 0x1000;=0A p->total_width =3D 64;=0A@@ -489,8 +499,11 @@ smbios_type_17= _init(void *start, uint32_=0A p->type_detail =3D 0;=0A =0A start = +=3D sizeof(struct smbios_type_17);=0A- strcpy((char *)start, "DIMM = 1");=0A- start +=3D strlen("DIMM 1") + 1;=0A+ strcpy((char *)start, = "DIMM ");=0A+ start +=3D strlen("DIMM ");=0A+ itoa(buf, instance);=0A= + strcpy((char *)start, buf);=0A+ start +=3D strlen(buf) +1;=0A = *((uint8_t *)start) =3D 0;=0A =0A return start+1;=0A@@ -498,7 +511,7 = @@ smbios_type_17_init(void *start, uint32_=0A =0A /* Type 19 -- Memory = Array Mapped Address */=0A static void *=0A-smbios_type_19_init(void = *start, uint32_t memory_size_mb)=0A+smbios_type_19_init(void *start, = uint32_t memory_size_mb, int instance)=0A {=0A struct smbios_type_19 = *p =3D (struct smbios_type_19 *)start;=0A =0A@@ -506,10 +519,10 @@ = smbios_type_19_init(void *start, uint32_=0A =0A p->header.type =3D = 19;=0A p->header.length =3D sizeof(struct smbios_type_19);=0A- = p->header.handle =3D 0x1300;=0A+ p->header.handle =3D 0x1300+instance;= =0A =0A- p->starting_address =3D 0;=0A- p->ending_address =3D = (memory_size_mb-1) * 1024;=0A+ p->starting_address =3D instance*0x4000;= =0A+ p->ending_address =3D (( memory_size_mb+instance*0x4000 )-1)* = 1024;=0A p->memory_array_handle =3D 0x1000;=0A p->partition_width = =3D 1;=0A =0A@@ -528,11 +541,11 @@ smbios_type_20_init(void *start, = uint32_=0A =0A p->header.type =3D 20;=0A p->header.length =3D = sizeof(struct smbios_type_20);=0A- p->header.handle =3D 0x1400;=0A+ = p->header.handle =3D 0x1400+instance;=0A =0A- p->starting_address =3D = 0;=0A- p->ending_address =3D (memory_size_mb-1)*1024;=0A- p->memory_d= evice_handle =3D 0x1100;=0A+ p->starting_address =3D instance*0x4000;=0A= + p->ending_address =3D (( memory_size_mb+instance*0x4000 ) -1)*1024;=0A= + p->memory_device_handle =3D 0x1100+instance;=0A p->memory_array_ma= pped_address_handle =3D 0x1300;=0A p->partition_row_position =3D 1;=0A = p->interleave_position =3D 0;=0A --=__Part3C1597D4.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part3C1597D4.0__=--