4 * Copyright (c) 2020 Intel
6 * This work is licensed under the terms of the GNU GPL, version 2. See the
7 * COPYING file in the top-level directory.
14 #include "qapi/qapi-types-machine.h"
15 #include "qapi/qapi-visit-machine.h"
16 #include "hw/pci/pci_host.h"
18 #include "cxl_component.h"
19 #include "cxl_device.h"
21 #define CXL_COMPONENT_REG_BAR_IDX 0
22 #define CXL_DEVICE_REG_BAR_IDX 2
24 #define CXL_WINDOW_MAX 10
26 typedef struct PXBCXLDev PXBCXLDev
;
28 typedef struct CXLFixedWindow
{
31 PXBCXLDev
*target_hbs
[8];
35 /* Todo: XOR based interleaving */
40 typedef struct CXLState
{
43 unsigned int next_mr_idx
;
45 CXLFixedMemoryWindowOptionsList
*cfmw_list
;
49 PCIHostState parent_obj
;
51 CXLComponentState cxl_cstate
;
55 #define TYPE_PXB_CXL_HOST "pxb-cxl-host"
56 OBJECT_DECLARE_SIMPLE_TYPE(CXLHost
, PXB_CXL_HOST
)
58 #define TYPE_CXL_USP "cxl-upstream"
60 typedef struct CXLUpstreamPort CXLUpstreamPort
;
61 DECLARE_INSTANCE_CHECKER(CXLUpstreamPort
, CXL_USP
, TYPE_CXL_USP
)
62 CXLComponentState
*cxl_usp_to_cstate(CXLUpstreamPort
*usp
);