From patchwork Thu Nov 12 19:02:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 56461 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp595016lbb; Thu, 12 Nov 2015 11:03:53 -0800 (PST) X-Received: by 10.129.39.17 with SMTP id n17mr16332933ywn.36.1447355033225; Thu, 12 Nov 2015 11:03:53 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 203si1083541ywy.356.2015.11.12.11.03.52 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 12 Nov 2015 11:03:53 -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; dkim=fail header.i=@gmail.com Received: from localhost ([::1]:49202 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwxA0-0002ml-4S for patch@linaro.org; Thu, 12 Nov 2015 14:03:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58692) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zwx8y-0001Ri-Sh for qemu-devel@nongnu.org; Thu, 12 Nov 2015 14:02:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zwx8x-00051M-Hs for qemu-devel@nongnu.org; Thu, 12 Nov 2015 14:02:48 -0500 Received: from mail-pa0-x231.google.com ([2607:f8b0:400e:c03::231]:32774) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zwx8x-00051F-DL for qemu-devel@nongnu.org; Thu, 12 Nov 2015 14:02:47 -0500 Received: by pabfh17 with SMTP id fh17so73197141pab.0 for ; Thu, 12 Nov 2015 11:02:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=N9BHA6/fHNv3/S1vyNgU+SOt3hOV3xV4QkJTbFM/5lY=; b=Y8ynBKA0BpwiRxksbUcchquoEg3pcD8WfEogFok2CJ2joc2KtEOE5TGZQLhzbqgnB5 YUyjtJIPzegc5Ysy0elnaEUg+JCNu5mafiTEg0Pm4I3BaSpOC/FSPk0UZ8AFhJgDJjAV 6y5vL57jsDx5J2vOtc7W7F2OIjisyAmY8oec5W6PPFQ7DvrNW+5wz36uIzHzzby7a2S2 Dp/WXn30NbJdDcJLfO21u+agKhLp1GlbLqAPZoAlii2XXV16kQFvtToBGGucvFS/piDM Alfoj71UH7mKySm8gzDEeHemWE0LqU8GmXw4RGtQyMlxiOwv/Fbj35FV6ZpPoXG56yRu yNVA== X-Received: by 10.68.166.99 with SMTP id zf3mr25389543pbb.58.1447354966942; Thu, 12 Nov 2015 11:02:46 -0800 (PST) Received: from t430.minyard.home (pool-173-57-176-17.dllstx.fios.verizon.net. [173.57.176.17]) by smtp.gmail.com with ESMTPSA id wh10sm16154513pab.2.2015.11.12.11.02.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Nov 2015 11:02:45 -0800 (PST) Received: from t430.minyard.home (t430.minyard.home [127.0.0.1]) by t430.minyard.home (8.14.7/8.14.7) with ESMTP id tACJ2hep019740; Thu, 12 Nov 2015 13:02:43 -0600 Received: (from cminyard@localhost) by t430.minyard.home (8.14.7/8.14.7/Submit) id tACJ2hxw019739; Thu, 12 Nov 2015 13:02:43 -0600 From: minyard@acm.org To: qemu-devel@nongnu.org, Paolo Bonzini , "Michael S. Tsirkin" , Igor Mammedov Date: Thu, 12 Nov 2015 13:02:26 -0600 Message-Id: <1447354953-18893-11-git-send-email-minyard@acm.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1447354953-18893-1-git-send-email-minyard@acm.org> References: <1447354953-18893-1-git-send-email-minyard@acm.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::231 Cc: Corey Minyard Subject: [Qemu-devel] [PATCH v4 10/17] 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(+) -- 1.8.3.1 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__)