Merge branch '2018-11-16-master-imports'
[oweals/u-boot.git] / drivers / misc / swap_case.c
index 80ccb9f38345538ac1c56f1fad335b6a4953fd35..fa608cec1b92a0a9cd2a55586ddb135fd27df263 100644 (file)
@@ -118,6 +118,36 @@ static int sandbox_swap_case_read_config(struct udevice *emul, uint offset,
                *valuep = result;
                break;
        }
+       case PCI_CAPABILITY_LIST:
+               *valuep = PCI_CAP_ID_PM_OFFSET;
+               break;
+       case PCI_CAP_ID_PM_OFFSET:
+               *valuep = (PCI_CAP_ID_EXP_OFFSET << 8) | PCI_CAP_ID_PM;
+               break;
+       case PCI_CAP_ID_PM_OFFSET + PCI_CAP_LIST_NEXT:
+               *valuep = PCI_CAP_ID_EXP_OFFSET;
+               break;
+       case PCI_CAP_ID_EXP_OFFSET:
+               *valuep = (PCI_CAP_ID_MSIX_OFFSET << 8) | PCI_CAP_ID_EXP;
+               break;
+       case PCI_CAP_ID_EXP_OFFSET + PCI_CAP_LIST_NEXT:
+               *valuep = PCI_CAP_ID_MSIX_OFFSET;
+               break;
+       case PCI_CAP_ID_MSIX_OFFSET:
+               *valuep = PCI_CAP_ID_MSIX;
+               break;
+       case PCI_CAP_ID_MSIX_OFFSET + PCI_CAP_LIST_NEXT:
+               *valuep = 0;
+               break;
+       case PCI_EXT_CAP_ID_ERR_OFFSET:
+               *valuep = (PCI_EXT_CAP_ID_VC_OFFSET << 20) | PCI_EXT_CAP_ID_ERR;
+               break;
+       case PCI_EXT_CAP_ID_VC_OFFSET:
+               *valuep = (PCI_EXT_CAP_ID_DSN_OFFSET << 20) | PCI_EXT_CAP_ID_VC;
+               break;
+       case PCI_EXT_CAP_ID_DSN_OFFSET:
+               *valuep = PCI_EXT_CAP_ID_DSN;
+               break;
        }
 
        return 0;
@@ -285,3 +315,10 @@ U_BOOT_DRIVER(sandbox_swap_case_emul) = {
        .priv_auto_alloc_size = sizeof(struct swap_case_priv),
        .platdata_auto_alloc_size = sizeof(struct swap_case_platdata),
 };
+
+static struct pci_device_id sandbox_swap_case_supported[] = {
+       { PCI_VDEVICE(SANDBOX, SANDBOX_PCI_DEVICE_ID), SWAP_CASE_DRV_DATA },
+       {},
+};
+
+U_BOOT_PCI_DEVICE(sandbox_swap_case_emul, sandbox_swap_case_supported);