Re: [PATCH Xilinx Alveo 7/8] fpga: xrt: Alveo management physical function driver

Xu Yilun
2020-12-02T03:05:49Z

> +static int xmgmt_main_event_cb(struct platform_device *pdev,
> + enum xrt_events evt, void *arg)
> +{
> + struct xmgmt_main *xmm = platform_get_drvdata(pdev);
> + struct xrt_event_arg_subdev *esd = (struct xrt_event_arg_subdev *)arg;
> + enum xrt_subdev_id id;
> + int instance;
> + size_t fwlen;
> +
> + switch (evt) {
> + case XRT_EVENT_POST_CREATION: {
> + id = esd->xevt_subdev_id;
> + instance = esd->xevt_subdev_instance;
> + xrt_info(pdev, "processing event %d for (%d, %d)",
> + evt, id, instance);
> +
> + if (id == XRT_SUBDEV_GPIO)
> + xmm->gpio_ready = true;
> + else if (id == XRT_SUBDEV_QSPI)
> + xmm->flash_ready = true;
> + else
> + BUG_ON(1);
> +
> + if (xmm->gpio_ready && xmm->flash_ready) {
> + int rc;
> +
> + rc = load_firmware_from_disk(pdev, &xmm->firmware_blp,
> + &fwlen);
> + if (rc != 0) {
> + rc = load_firmware_from_flash(pdev,
> + &xmm->firmware_blp, &fwlen);

I'm curious that before the shell metadata is loaded, how the QSPI
subdev is enumerated and get to work? The QSPI DT info itself is
stored in metadata, is it?

I didn't find the creation of leaf platform devices, maybe I can find
the answer in the missing Patch #5?

Thanks,
Yilun

> + }
> + if (rc == 0 && is_valid_firmware(pdev,
> + xmm->firmware_blp, fwlen))
> + (void) xmgmt_create_blp(xmm);
> + else
> + xrt_err(pdev,
> + "failed to find firmware, giving up");
> + xmm->evt_hdl = NULL;
> + }
> + break;
> + }