static void rtas_read_pci_config(sPAPREnvironment *spapr,

                                 uint32_t token, uint32_t nargs,

                                 target_ulong args,

                                 uint32_t nret, target_ulong rets)

{

    uint32_t val, size, addr;

    PCIDevice *dev = find_dev(spapr, 0, rtas_ld(args, 0));



    if (!dev) {

        rtas_st(rets, 0, -1);

        return;

    }

    size = rtas_ld(args, 1);

    addr = rtas_pci_cfgaddr(rtas_ld(args, 0));

    val = pci_host_config_read_common(dev, addr, pci_config_size(dev), size);

    rtas_st(rets, 0, 0);

    rtas_st(rets, 1, val);

}

static void rtas_read_pci_config(sPAPREnvironment *spapr,

                                 uint32_t token, uint32_t nargs,

                                 target_ulong args,

                                 uint32_t nret, target_ulong rets)

{

    uint32_t val, size, addr;

    PCIDevice *dev = find_dev(spapr, 0, rtas_ld(args, 0));



    if (!dev) {

        rtas_st(rets, 0, -1);

        return;

    }

    size = rtas_ld(args, 1);

    addr = rtas_pci_cfgaddr(rtas_ld(args, 0));

    val = pci_host_config_read_common(dev, addr, pci_config_size(dev), size);

    rtas_st(rets, 0, 0);

    rtas_st(rets, 1, val);

}

static void FUNC_0(sPAPREnvironment *VAR_0,

                                 uint32_t VAR_1, uint32_t VAR_2,

                                 target_ulong VAR_3,

                                 uint32_t VAR_4, target_ulong VAR_5)

{

    uint32_t val, size, addr;

    PCIDevice *dev = find_dev(VAR_0, 0, rtas_ld(VAR_3, 0));



    if (!dev) {

        rtas_st(VAR_5, 0, -1);

        return;

    }

    size = rtas_ld(VAR_3, 1);

    addr = rtas_pci_cfgaddr(rtas_ld(VAR_3, 0));

    val = pci_host_config_read_common(dev, addr, pci_config_size(dev), size);

    rtas_st(VAR_5, 0, 0);

    rtas_st(VAR_5, 1, val);

}

static void FUNC_0(sPAPREnvironment *VAR_0,
uint32_t VAR_1, uint32_t VAR_2,
target_ulong VAR_3,
uint32_t VAR_4, target_ulong VAR_5)
{ uint32_t val, size, addr; PCIDevice *dev = find_dev(VAR_0, 0, rtas_ld(VAR_3, 0)); if (!dev) { rtas_st(VAR_5, 0, -1); return; } size = rtas_ld(VAR_3, 1); addr = rtas_pci_cfgaddr(rtas_ld(VAR_3, 0)); val = pci_host_config_read_common(dev, addr, pci_config_size(dev), size); rtas_st(VAR_5, 0, 0); rtas_st(VAR_5, 1, val); }