Re: [SeaBIOS] [PATCH] Add an IPMI SMBIOS entry

2012-07-31 Thread Gleb Natapov
On Mon, Jul 30, 2012 at 09:57:47PM -0500, miny...@acm.org wrote:
 From: Corey Minyard cminy...@mvista.com
 
 An IPMI device is being added to the qemu code, and it has an
 SMBIOS entry to describe the interface characteristics.  So add
 the SMBIOS entry to the BIOS so it can handle this.
 
 Signed-off-by: Corey Minyard cminy...@mvista.com
 ---
  Makefile   |2 +-
  src/ipmi.c |   16 
  src/ipmi.h |   27 +++
  src/paravirt.c |   18 ++
  src/paravirt.h |9 +
  src/post.c |2 ++
  src/smbios.c   |   54 ++
  src/smbios.h   |   12 
  src/util.h |5 +
  9 files changed, 144 insertions(+), 1 deletions(-)
  create mode 100644 src/ipmi.c
  create mode 100644 src/ipmi.h
 
 diff --git a/Makefile b/Makefile
 index dfdec5c..1b6eb96 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -13,7 +13,7 @@ SRCBOTH=misc.c stacks.c pmm.c output.c util.c block.c 
 floppy.c ata.c mouse.c \
  pnpbios.c pirtable.c vgahooks.c ramdisk.c pcibios.c blockcmd.c \
  usb.c usb-uhci.c usb-ohci.c usb-ehci.c usb-hid.c usb-msc.c \
  virtio-ring.c virtio-pci.c virtio-blk.c virtio-scsi.c apm.c ahci.c \
 -usb-uas.c lsi-scsi.c
 +usb-uas.c lsi-scsi.c ipmi.c
  SRC16=$(SRCBOTH) system.c disk.c font.c
  SRC32FLAT=$(SRCBOTH) post.c shadow.c memmap.c coreboot.c boot.c \
  acpi.c smm.c mptable.c smbios.c pciinit.c optionroms.c mtrr.c \
 diff --git a/src/ipmi.c b/src/ipmi.c
 new file mode 100644
 index 000..7521a8b
 --- /dev/null
 +++ b/src/ipmi.c
 @@ -0,0 +1,16 @@
 +// IPMI setup information
 +//
 +// Copyright (C) 2012  Corey Minyard cminy...@mvista.com
 +//
 +// This file may be distributed under the terms of the GNU LGPLv3 license.
 +
 +#include ipmi.h
 +#include paravirt.h
 +
 +struct ipmi_info ipmi_info;
 +
 +void
 +ipmi_setup(void)
 +{
 +qemu_cfg_load_ipmi(ipmi_info);
 +}
 diff --git a/src/ipmi.h b/src/ipmi.h
 new file mode 100644
 index 000..b0cf61e
 --- /dev/null
 +++ b/src/ipmi.h
 @@ -0,0 +1,27 @@
 +// IPMI setup information
 +//
 +// Copyright (C) 2012  Corey Minyard cminy...@mvista.com
 +//
 +// This file may be distributed under the terms of the GNU LGPLv3 license.
 +
 +#ifndef __IPMI_H
 +#define __IPMI_H
 +
 +#include config.h // CONFIG_COREBOOT
 +#include types.h
 +
 +struct ipmi_info {
 +u64 base_addr;
 +u8 interface;
 +u8 reg_space;
 +u8 reg_spacing;
 +u8 slave_addr;
 +u8 irq;
 +u8 version;
 +};
 +
 +extern struct ipmi_info ipmi_info;
 +
 +void ipmi_setup(void);
 +
 +#endif
 diff --git a/src/paravirt.c b/src/paravirt.c
 index 2a98d53..4986cfb 100644
 --- a/src/paravirt.c
 +++ b/src/paravirt.c
 @@ -148,6 +148,24 @@ void* qemu_cfg_e820_load_next(void *addr)
  return addr;
  }
  
 +void qemu_cfg_load_ipmi(struct ipmi_info *info)
 +{
 +qemu_cfg_read_entry(info-interface, QEMU_CFG_IPMI_INTERFACE, 
 sizeof(u8));
 +qemu_cfg_read_entry(info-base_addr, QEMU_CFG_IPMI_BASE_ADDR, 
 sizeof(u64));
 +
 +if ((info-interface == 0) || (info-base_addr == 0)) 
 +return;
 +
 +info-base_addr = le64_to_cpu(info-base_addr);
 +qemu_cfg_read_entry(info-reg_spacing, QEMU_CFG_IPMI_REG_SPACING,
 +sizeof(u8));
 +qemu_cfg_read_entry(info-reg_space, QEMU_CFG_IPMI_REG_SPACE, 
 sizeof(u8));
 +qemu_cfg_read_entry(info-version, QEMU_CFG_IPMI_VERSION, sizeof(u8));
 +qemu_cfg_read_entry(info-slave_addr, QEMU_CFG_IPMI_SLAVE_ADDR,
 +sizeof(u8));
 +qemu_cfg_read_entry(info-irq, QEMU_CFG_IPMI_IRQ, sizeof(u8));
 +}
 +
  struct smbios_header {
  u16 length;
  u8 type;
 diff --git a/src/paravirt.h b/src/paravirt.h
 index a284c41..b14e41b 100644
 --- a/src/paravirt.h
 +++ b/src/paravirt.h
 @@ -3,6 +3,7 @@
  
  #include config.h // CONFIG_COREBOOT
  #include util.h
 +#include ipmi.h // struct ipmi_info
  
  /* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx.  It
   * should be used to determine that a VM is running under KVM.
 @@ -35,6 +36,13 @@ static inline int kvm_para_available(void)
  #define QEMU_CFG_BOOT_MENU  0x0e
  #define QEMU_CFG_MAX_CPUS   0x0f
  #define QEMU_CFG_FILE_DIR   0x19
 +#define QEMU_CFG_IPMI_INTERFACE 0x30
 +#define QEMU_CFG_IPMI_BASE_ADDR 0x31
 +#define QEMU_CFG_IPMI_REG_SPACE 0x32
 +#define QEMU_CFG_IPMI_REG_SPACING   0x33
 +#define QEMU_CFG_IPMI_SLAVE_ADDR0x34
 +#define QEMU_CFG_IPMI_IRQ   0x35
 +#define QEMU_CFG_IPMI_VERSION   0x36
Better to add _one_ fw_cfg entry that contains all of the info. But I am
sure Kevin will want this to be passed through file interface anyway.

  #define QEMU_CFG_ARCH_LOCAL 0x8000
  #define QEMU_CFG_ACPI_TABLES(QEMU_CFG_ARCH_LOCAL + 0)
  #define QEMU_CFG_SMBIOS_ENTRIES (QEMU_CFG_ARCH_LOCAL + 1)
 @@ -64,6 +72,7 @@ struct e820_reservation {
  };
  u32 

Re: [SeaBIOS] [PATCH] Add an IPMI SMBIOS entry

2012-07-31 Thread Gleb Natapov
On Tue, Jul 31, 2012 at 08:33:53AM -0500, Corey Minyard wrote:
 On 07/31/2012 02:10 AM, Gleb Natapov wrote:
 
   /* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx.  It
* should be used to determine that a VM is running under KVM.
 @@ -35,6 +36,13 @@ static inline int kvm_para_available(void)
   #define QEMU_CFG_BOOT_MENU  0x0e
   #define QEMU_CFG_MAX_CPUS   0x0f
   #define QEMU_CFG_FILE_DIR   0x19
 +#define QEMU_CFG_IPMI_INTERFACE 0x30
 +#define QEMU_CFG_IPMI_BASE_ADDR 0x31
 +#define QEMU_CFG_IPMI_REG_SPACE 0x32
 +#define QEMU_CFG_IPMI_REG_SPACING   0x33
 +#define QEMU_CFG_IPMI_SLAVE_ADDR0x34
 +#define QEMU_CFG_IPMI_IRQ   0x35
 +#define QEMU_CFG_IPMI_VERSION   0x36
 Better to add _one_ fw_cfg entry that contains all of the info. But I am
 sure Kevin will want this to be passed through file interface anyway.
 
 
 I considered that, but that seems like a more brittle interface. New
 fields may need to be added in the future.  I'll look at the file
 interface, but I would think it would be best to have something that
 could be added to.
 
If you think it will have to be extended version it or include feature
bitmap.

--
Gleb.

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH] Add an IPMI SMBIOS entry

2012-07-31 Thread Corey Minyard

On 07/31/2012 02:10 AM, Gleb Natapov wrote:


  
  /* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx.  It

   * should be used to determine that a VM is running under KVM.
@@ -35,6 +36,13 @@ static inline int kvm_para_available(void)
  #define QEMU_CFG_BOOT_MENU  0x0e
  #define QEMU_CFG_MAX_CPUS   0x0f
  #define QEMU_CFG_FILE_DIR   0x19
+#define QEMU_CFG_IPMI_INTERFACE 0x30
+#define QEMU_CFG_IPMI_BASE_ADDR 0x31
+#define QEMU_CFG_IPMI_REG_SPACE 0x32
+#define QEMU_CFG_IPMI_REG_SPACING   0x33
+#define QEMU_CFG_IPMI_SLAVE_ADDR0x34
+#define QEMU_CFG_IPMI_IRQ   0x35
+#define QEMU_CFG_IPMI_VERSION   0x36
Better to add _one_ fw_cfg entry that contains all of the info. But I am
sure Kevin will want this to be passed through file interface anyway.


I considered that, but that seems like a more brittle interface. New 
fields may need to be added in the future.  I'll look at the file 
interface, but I would think it would be best to have something that 
could be added to.


Thanks,

-corey


___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios