From patchwork Thu Dec 17 18:50:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 58615 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp567797lbb; Thu, 17 Dec 2015 11:23:41 -0800 (PST) X-Received: by 10.140.237.77 with SMTP id i74mr65379240qhc.55.1450380217560; Thu, 17 Dec 2015 11:23:37 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id k6si12594097qhc.54.2015.12.17.11.23.37 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 17 Dec 2015 11:23:37 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:56487 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9e9J-0000gN-2d for patch@linaro.org; Thu, 17 Dec 2015 14:23:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9ddf-0007Q5-MO for qemu-devel@nongnu.org; Thu, 17 Dec 2015 13:50:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9ddd-0007Ll-0V for qemu-devel@nongnu.org; Thu, 17 Dec 2015 13:50:55 -0500 Received: from vms173019pub.verizon.net ([206.46.173.19]:60690) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9ddc-0007Kg-So for qemu-devel@nongnu.org; Thu, 17 Dec 2015 13:50:52 -0500 Received: from serve.minyard.net ([173.57.176.17]) by vms173019.mailsrvcs.net (Oracle Communications Messaging Server 7.0.5.32.0 64bit (built Jul 16 2014)) with ESMTPA id <0NZI007X1N06ID81@vms173019.mailsrvcs.net> for qemu-devel@nongnu.org; Thu, 17 Dec 2015 12:50:30 -0600 (CST) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=btqxfxui c=1 sm=1 tr=0 a=bXmWQgKa9n63w7XTPFb8JQ==:117 a=N54-gffFAAAA:8 a=HL3alpDKAAAA:8 a=oR5dmqMzAAAA:8 a=wUQvQvOEmiQA:10 a=fk1lIlRQAAAA:8 a=pJMg-b49IHjcBru9faUA:9 a=q6XaS_U-MVBWKCCL:21 a=0Vt4G9gxJypkMV7m:21 Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id C02273087; Thu, 17 Dec 2015 12:50:29 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id E3118300FEA; Thu, 17 Dec 2015 12:50:26 -0600 (CST) From: minyard@acm.org To: qemu-devel@nongnu.org, Paolo Bonzini , "Michael S. Tsirkin" , Igor Mammedov Date: Thu, 17 Dec 2015 12:50:12 -0600 Message-id: <1450378219-25799-10-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.5.0 In-reply-to: <1450378219-25799-1-git-send-email-minyard@acm.org> References: <1450378219-25799-1-git-send-email-minyard@acm.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.46.173.19 X-Mailman-Approved-At: Thu, 17 Dec 2015 14:22:15 -0500 Cc: Corey Minyard Subject: [Qemu-devel] [PATCH v5 09/16] ipmi: Add a firmware configuration repository X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Corey Minyard Add a way for IPMI devices to register their firmware information with the IPMI subsystem so that various firmware entities can pull that information later for adding to firmware tables. Signed-off-by: Corey Minyard --- hw/ipmi/ipmi.c | 27 +++++++++++++++++++++++++++ include/hw/ipmi/ipmi.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) -- 2.5.0 diff --git a/hw/ipmi/ipmi.c b/hw/ipmi/ipmi.c index 7d17469..52aba1e 100644 --- a/hw/ipmi/ipmi.c +++ b/hw/ipmi/ipmi.c @@ -123,3 +123,30 @@ static void ipmi_register_types(void) } type_init(ipmi_register_types) + +static IPMIFwInfo *ipmi_fw_info; +static unsigned int ipmi_fw_info_len; + +static uint32_t current_uuid = 1; + +void ipmi_add_fwinfo(IPMIFwInfo *info, Error **errp) +{ + info->uuid = current_uuid++; + ipmi_fw_info = g_realloc(ipmi_fw_info, + sizeof(*ipmi_fw_info) * (ipmi_fw_info_len + 1)); + ipmi_fw_info[ipmi_fw_info_len] = *info; +} + +IPMIFwInfo *ipmi_first_fwinfo(void) +{ + return ipmi_fw_info; +} + +IPMIFwInfo *ipmi_next_fwinfo(IPMIFwInfo *current) +{ + current++; + if (current >= &ipmi_fw_info[ipmi_fw_info_len]) { + return NULL; + } + return current; +} diff --git a/include/hw/ipmi/ipmi.h b/include/hw/ipmi/ipmi.h index e4f7738..74e84a0 100644 --- a/include/hw/ipmi/ipmi.h +++ b/include/hw/ipmi/ipmi.h @@ -168,6 +168,41 @@ typedef struct IPMIBmcClass { */ void ipmi_bmc_find_and_link(Object *obj, Object **bmc); +/* + * Used for transferring information to interfaces that add + * entries to firmware tables. + */ +typedef struct IPMIFwInfo { + const char *interface_name; + int interface_type; + uint8_t ipmi_spec_major_revision; + uint8_t ipmi_spec_minor_revision; + uint8_t i2c_slave_address; + uint32_t uuid; + + uint64_t base_address; + uint64_t register_length; + uint8_t register_spacing; + enum { + IPMI_MEMSPACE_IO, + IPMI_MEMSPACE_MEM32, + IPMI_MEMSPACE_MEM64, + IPMI_MEMSPACE_SMBUS + } memspace; + + int interrupt_number; + enum { + IPMI_LEVEL_IRQ, + IPMI_EDGE_IRQ + } irq_type; + + const char *acpi_parent; +} IPMIFwInfo; + +void ipmi_add_fwinfo(IPMIFwInfo *info, Error **errp); +IPMIFwInfo *ipmi_first_fwinfo(void); +IPMIFwInfo *ipmi_next_fwinfo(IPMIFwInfo *current); + #ifdef IPMI_DEBUG #define ipmi_debug(fs, ...) \ fprintf(stderr, "IPMI (%s): " fs, __func__, ##__VA_ARGS__)