qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>,
	Patrick Venture <venture@google.com>,
	Hao Wu <wuhaotsh@google.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Titus Rwantare <titusr@google.com>,
	Andrew Jeffery <andrew@aj.id.au>, Joel Stanley <joel@jms.id.au>,
	Graeme Gregory <quic_ggregory@quicinc.com>,
	Maheswara Kurapati <quic_mkurapat@quicinc.com>,
	qemu-arm <qemu-arm@nongnu.org>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [PATCH 3/9] hw/arm/aspeed: qcom-dc-scm-v1: add block backed FRU device
Date: Thu, 23 Jun 2022 18:50:48 +0200	[thread overview]
Message-ID: <870f3dae-2dfd-f760-4ad6-a92a20eb9871@kaod.org> (raw)
In-Reply-To: <852d9c04-1ece-3b88-c8f2-d96d333f7bde@quicinc.com>

On 6/23/22 18:34, Jae Hyun Yoo wrote:
> Hello Patrick,
> 
> On 6/23/2022 8:28 AM, Patrick Venture wrote:
>>
>>
>> On Wed, Jun 22, 2022 at 10:48 AM Jae Hyun Yoo <quic_jaehyoo@quicinc.com <mailto:quic_jaehyoo@quicinc.com>> wrote:
>>
>>     From: Graeme Gregory <quic_ggregory@quicinc.com
>>     <mailto:quic_ggregory@quicinc.com>>
>>
>>     The FRU device uses the index 0 device on bus IF_NONE.
>>
>>     -drive file=$FRU,format=raw,if=none
>>
>>     file must match FRU size of 128k
>>
>>     Signed-off-by: Graeme Gregory <quic_ggregory@quicinc.com
>>     <mailto:quic_ggregory@quicinc.com>>
>>     ---
>>       hw/arm/aspeed.c | 22 +++++++++++++++++-----
>>       1 file changed, 17 insertions(+), 5 deletions(-)
>>
>>     diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
>>     index 785cc543d046..36d6b2c33e48 100644
>>     --- a/hw/arm/aspeed.c
>>     +++ b/hw/arm/aspeed.c
>>     @@ -992,17 +992,29 @@ static void fby35_i2c_init(AspeedMachineState
>>     *bmc)
>>            */
>>       }
>>
>>     +static void qcom_dc_scm_fru_init(I2CBus *bus, uint8_t addr,
>>     uint32_t rsize)
>>     +{
>>     +    I2CSlave *i2c_dev = i2c_slave_new("at24c-eeprom", addr);
>>     +    DeviceState *dev = DEVICE(i2c_dev);
>>     +    /* Use First Index for DC-SCM FRU */
>>     +    DriveInfo *dinfo = drive_get(IF_NONE, 0, 0);
>>     +
>>     +    qdev_prop_set_uint32(dev, "rom-size", rsize);
>>     +
>>     +    if (dinfo) {
>>     +        qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(dinfo));
>>     +    }
>>     +
>>     +    i2c_slave_realize_and_unref(i2c_dev, bus, &error_abort);
>>     +}
>>
>>
>> We've sent a similar patch up for the at24c but in its own file -- but looking at this, we could likely expand it to suite our cases as well - is there a reason it's named qcom_dc_scm_fru_init?  Presumably that's to handle the drive_get parameters.  If you make it use `drive_get(IF_NONE, bus, unit);` You'll be able to associate a drive via parameters like you aim to.
> 
> Okay. I agree with you that it can be more generic to be used for other
> machines too. I'll rewrite this function in v2 to make it have below
> shape.
> 
> static void
> at24c_eeprom_init_from_drive(I2CBus *bus, uint8_t addr, uint32_t rsize,
>                               int bus, int unit)

Yes and if other non-Aspeed machines need it one day, we could export it.
There is no need for now to multiply the interface now.

Thanks,

C.

> 
> Thanks,
> Jae
> 
>>     +
>>       static void qcom_dc_scm_bmc_i2c_init(AspeedMachineState *bmc)
>>       {
>>           AspeedSoCState *soc = &bmc->soc;
>>
>>           i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 15),
>>     "tmp105", 0x4d);
>>
>>     -    uint8_t *eeprom_buf = g_malloc0(128 * 1024);
>>     -    if (eeprom_buf) {
>>     -        smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 15), 0x53,
>>     -                              eeprom_buf);
>>     -    }
>>     +    qcom_dc_scm_fru_init(aspeed_i2c_get_bus(&soc->i2c, 15), 0x53,
>>     128 * 1024);
>>       }
>>
>>       static bool aspeed_get_mmio_exec(Object *obj, Error **errp)
>>     --     2.25.1
>>
>>



  reply	other threads:[~2022-06-23 16:52 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22 17:28 [PATCH 0/9] Add Qualcomm BMC machines Jae Hyun Yoo
2022-06-22 17:28 ` [PATCH 1/9] hw/arm/aspeed: add support for the Qualcomm EVB proto board Jae Hyun Yoo
2022-06-22 17:28 ` [PATCH 2/9] hw/arm/aspeed: add support for the Qualcomm DC-SCM v1 board Jae Hyun Yoo
2022-06-22 17:28 ` [PATCH 3/9] hw/arm/aspeed: qcom-dc-scm-v1: add block backed FRU device Jae Hyun Yoo
2022-06-23  5:28   ` Joel Stanley
2022-06-23 14:00     ` Jae Hyun Yoo
2022-06-23 15:28   ` Patrick Venture
2022-06-23 16:34     ` Jae Hyun Yoo
2022-06-23 16:50       ` Cédric Le Goater [this message]
2022-06-23 17:16     ` Cédric Le Goater
2022-06-23 17:37       ` Patrick Venture
2022-06-27 15:01         ` Jae Hyun Yoo
2022-07-01  7:52         ` Cédric Le Goater
2022-06-27 15:57   ` Cédric Le Goater
2022-06-22 17:28 ` [PATCH 4/9] hw/arm/aspeed: add Qualcomm Firework machine and " Jae Hyun Yoo
2022-06-23  6:43   ` Cédric Le Goater
2022-06-23 14:11     ` Jae Hyun Yoo
2022-06-24  7:32       ` Cédric Le Goater
2022-06-27 14:48         ` Jae Hyun Yoo
2022-06-22 17:28 ` [PATCH 5/9] hw/i2c: pmbus: Page #255 is valid page for read requests Jae Hyun Yoo
2022-06-22 20:49   ` Titus Rwantare
2022-06-22 22:04     ` Jae Hyun Yoo
2022-06-22 17:28 ` [PATCH 6/9] hw/sensor: add Maxim MAX31785 device Jae Hyun Yoo
2022-06-22 20:49   ` Titus Rwantare
2022-06-22 22:06     ` Jae Hyun Yoo
2022-06-23  5:17   ` Joel Stanley
2022-06-23  5:40     ` Cédric Le Goater
2022-06-23 14:02       ` Jae Hyun Yoo
2022-06-22 17:28 ` [PATCH 7/9] hw/arm/aspeed: firework: Add MAX31785 Fan controllers Jae Hyun Yoo
2022-06-22 17:28 ` [PATCH 8/9] hw/arm/aspeed: firework: Add Thermal Diodes Jae Hyun Yoo
2022-06-22 17:28 ` [PATCH 9/9] hw/arm/aspeed: firework: add I2C MUXes for VR channels Jae Hyun Yoo
2022-06-23  5:27   ` Joel Stanley
2022-06-23 13:58     ` Jae Hyun Yoo
2022-06-23  5:25 ` [PATCH 0/9] Add Qualcomm BMC machines Joel Stanley
2022-06-23  6:48   ` Cédric Le Goater
2022-06-23 10:24     ` Graeme Gregory
2022-06-23 14:12       ` Jae Hyun Yoo
2025-09-30  5:59 ` Cédric Le Goater

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=870f3dae-2dfd-f760-4ad6-a92a20eb9871@kaod.org \
    --to=clg@kaod.org \
    --cc=andrew@aj.id.au \
    --cc=joel@jms.id.au \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quic_ggregory@quicinc.com \
    --cc=quic_jaehyoo@quicinc.com \
    --cc=quic_mkurapat@quicinc.com \
    --cc=titusr@google.com \
    --cc=venture@google.com \
    --cc=wuhaotsh@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).