static int xen_pt_bar_reg_init(XenPCIPassthroughState *s, XenPTRegInfo *reg,

                               uint32_t real_offset, uint32_t *data)

{

    uint32_t reg_field = 0;

    int index;



    index = xen_pt_bar_offset_to_index(reg->offset);

    if (index < 0 || index >= PCI_NUM_REGIONS) {

        XEN_PT_ERR(&s->dev, "Internal error: Invalid BAR index [%d].\n", index);

        return -1;

    }



    /* set BAR flag */

    s->bases[index].bar_flag = xen_pt_bar_reg_parse(s, reg);

    if (s->bases[index].bar_flag == XEN_PT_BAR_FLAG_UNUSED) {

        reg_field = XEN_PT_INVALID_REG;

    }



    *data = reg_field;

    return 0;

}

static int xen_pt_bar_reg_init(XenPCIPassthroughState *s, XenPTRegInfo *reg,

                               uint32_t real_offset, uint32_t *data)

{

    uint32_t reg_field = 0;

    int index;



    index = xen_pt_bar_offset_to_index(reg->offset);

    if (index < 0 || index >= PCI_NUM_REGIONS) {

        XEN_PT_ERR(&s->dev, "Internal error: Invalid BAR index [%d].\n", index);

        return -1;

    }



    

    s->bases[index].bar_flag = xen_pt_bar_reg_parse(s, reg);

    if (s->bases[index].bar_flag == XEN_PT_BAR_FLAG_UNUSED) {

        reg_field = XEN_PT_INVALID_REG;

    }



    *data = reg_field;

    return 0;

}

static int FUNC_0(XenPCIPassthroughState *VAR_0, XenPTRegInfo *VAR_1,

                               uint32_t VAR_2, uint32_t *VAR_3)

{

    uint32_t reg_field = 0;

    int VAR_4;



    VAR_4 = xen_pt_bar_offset_to_index(VAR_1->offset);

    if (VAR_4 < 0 || VAR_4 >= PCI_NUM_REGIONS) {

        XEN_PT_ERR(&VAR_0->dev, "Internal error: Invalid BAR VAR_4 [%d].\n", VAR_4);

        return -1;

    }



    

    VAR_0->bases[VAR_4].bar_flag = xen_pt_bar_reg_parse(VAR_0, VAR_1);

    if (VAR_0->bases[VAR_4].bar_flag == XEN_PT_BAR_FLAG_UNUSED) {

        reg_field = XEN_PT_INVALID_REG;

    }



    *VAR_3 = reg_field;

    return 0;

}

static int FUNC_0(XenPCIPassthroughState *VAR_0, XenPTRegInfo *VAR_1,
uint32_t VAR_2, uint32_t *VAR_3)
{ uint32_t reg_field = 0; int VAR_4; VAR_4 = xen_pt_bar_offset_to_index(VAR_1->offset); if (VAR_4 < 0 || VAR_4 >= PCI_NUM_REGIONS) { XEN_PT_ERR(&VAR_0->dev, "Internal error: Invalid BAR VAR_4 [%d].\n", VAR_4); return -1; } VAR_0->bases[VAR_4].bar_flag = xen_pt_bar_reg_parse(VAR_0, VAR_1); if (VAR_0->bases[VAR_4].bar_flag == XEN_PT_BAR_FLAG_UNUSED) { reg_field = XEN_PT_INVALID_REG; } *VAR_3 = reg_field; return 0; }