19fdf0c29SDavid Gibson #if !defined(__HW_SPAPR_H__) 29fdf0c29SDavid Gibson #define __HW_SPAPR_H__ 39fdf0c29SDavid Gibson 49c17d615SPaolo Bonzini #include "sysemu/dma.h" 50d09e41aSPaolo Bonzini #include "hw/ppc/xics.h" 6*31fe14d1SNathan Fontenot #include "hw/ppc/spapr_drc.h" 7277f9acfSPaolo Bonzini 84040ab72SDavid Gibson struct VIOsPAPRBus; 93384f95cSDavid Gibson struct sPAPRPHBState; 10639e8102SDavid Gibson struct sPAPRNVRAM; 1146503c2bSMichael Roth typedef struct sPAPRConfigureConnectorState sPAPRConfigureConnectorState; 12*31fe14d1SNathan Fontenot typedef struct sPAPREventLogEntry sPAPREventLogEntry; 134040ab72SDavid Gibson 144be21d56SDavid Gibson #define HPTE64_V_HPTE_DIRTY 0x0000000000000040ULL 154be21d56SDavid Gibson 169fdf0c29SDavid Gibson typedef struct sPAPREnvironment { 174040ab72SDavid Gibson struct VIOsPAPRBus *vio_bus; 183384f95cSDavid Gibson QLIST_HEAD(, sPAPRPHBState) phbs; 19639e8102SDavid Gibson struct sPAPRNVRAM *nvram; 20c04d6cfaSAnthony Liguori XICSState *icp; 2128df36a1SDavid Gibson DeviceState *rtc; 22a3467baaSDavid Gibson 23a8170e5eSAvi Kivity hwaddr ram_limit; 24a3467baaSDavid Gibson void *htab; 254be21d56SDavid Gibson uint32_t htab_shift; 26a8170e5eSAvi Kivity hwaddr rma_size; 277f763a5dSDavid Gibson int vrma_adjust; 28a8170e5eSAvi Kivity hwaddr fdt_addr, rtas_addr; 29b7d1f77aSBenjamin Herrenschmidt ssize_t rtas_size; 30b7d1f77aSBenjamin Herrenschmidt void *rtas_blob; 31a3467baaSDavid Gibson void *fdt_skel; 32a3467baaSDavid Gibson target_ulong entry_point; 33880ae7deSDavid Gibson uint64_t rtc_offset; /* Now used only during incoming migration */ 3498a8b524SAlexey Kardashevskiy struct PPCTimebase tb; 353fc5acdeSAlexander Graf bool has_graphics; 3674d042e5SDavid Gibson 37*31fe14d1SNathan Fontenot uint32_t check_exception_irq; 3874d042e5SDavid Gibson Notifier epow_notifier; 39*31fe14d1SNathan Fontenot QTAILQ_HEAD(, sPAPREventLogEntry) pending_events; 404be21d56SDavid Gibson 414be21d56SDavid Gibson /* Migration state */ 424be21d56SDavid Gibson int htab_save_index; 434be21d56SDavid Gibson bool htab_first_pass; 44e68cb8b4SAlexey Kardashevskiy int htab_fd; 4501a57972SSamuel Mendoza-Jonas bool htab_fd_stale; 4646503c2bSMichael Roth 4746503c2bSMichael Roth /* RTAS state */ 4846503c2bSMichael Roth QTAILQ_HEAD(, sPAPRConfigureConnectorState) ccs_list; 499fdf0c29SDavid Gibson } sPAPREnvironment; 509fdf0c29SDavid Gibson 519fdf0c29SDavid Gibson #define H_SUCCESS 0 529fdf0c29SDavid Gibson #define H_BUSY 1 /* Hardware busy -- retry later */ 539fdf0c29SDavid Gibson #define H_CLOSED 2 /* Resource closed */ 549fdf0c29SDavid Gibson #define H_NOT_AVAILABLE 3 559fdf0c29SDavid Gibson #define H_CONSTRAINED 4 /* Resource request constrained to max allowed */ 569fdf0c29SDavid Gibson #define H_PARTIAL 5 579fdf0c29SDavid Gibson #define H_IN_PROGRESS 14 /* Kind of like busy */ 589fdf0c29SDavid Gibson #define H_PAGE_REGISTERED 15 599fdf0c29SDavid Gibson #define H_PARTIAL_STORE 16 609fdf0c29SDavid Gibson #define H_PENDING 17 /* returned from H_POLL_PENDING */ 619fdf0c29SDavid Gibson #define H_CONTINUE 18 /* Returned from H_Join on success */ 629fdf0c29SDavid Gibson #define H_LONG_BUSY_START_RANGE 9900 /* Start of long busy range */ 639fdf0c29SDavid Gibson #define H_LONG_BUSY_ORDER_1_MSEC 9900 /* Long busy, hint that 1msec \ 649fdf0c29SDavid Gibson is a good time to retry */ 659fdf0c29SDavid Gibson #define H_LONG_BUSY_ORDER_10_MSEC 9901 /* Long busy, hint that 10msec \ 669fdf0c29SDavid Gibson is a good time to retry */ 679fdf0c29SDavid Gibson #define H_LONG_BUSY_ORDER_100_MSEC 9902 /* Long busy, hint that 100msec \ 689fdf0c29SDavid Gibson is a good time to retry */ 699fdf0c29SDavid Gibson #define H_LONG_BUSY_ORDER_1_SEC 9903 /* Long busy, hint that 1sec \ 709fdf0c29SDavid Gibson is a good time to retry */ 719fdf0c29SDavid Gibson #define H_LONG_BUSY_ORDER_10_SEC 9904 /* Long busy, hint that 10sec \ 729fdf0c29SDavid Gibson is a good time to retry */ 739fdf0c29SDavid Gibson #define H_LONG_BUSY_ORDER_100_SEC 9905 /* Long busy, hint that 100sec \ 749fdf0c29SDavid Gibson is a good time to retry */ 759fdf0c29SDavid Gibson #define H_LONG_BUSY_END_RANGE 9905 /* End of long busy range */ 769fdf0c29SDavid Gibson #define H_HARDWARE -1 /* Hardware error */ 779fdf0c29SDavid Gibson #define H_FUNCTION -2 /* Function not supported */ 789fdf0c29SDavid Gibson #define H_PRIVILEGE -3 /* Caller not privileged */ 799fdf0c29SDavid Gibson #define H_PARAMETER -4 /* Parameter invalid, out-of-range or conflicting */ 809fdf0c29SDavid Gibson #define H_BAD_MODE -5 /* Illegal msr value */ 819fdf0c29SDavid Gibson #define H_PTEG_FULL -6 /* PTEG is full */ 829fdf0c29SDavid Gibson #define H_NOT_FOUND -7 /* PTE was not found" */ 839fdf0c29SDavid Gibson #define H_RESERVED_DABR -8 /* DABR address is reserved by the hypervisor on this processor" */ 849fdf0c29SDavid Gibson #define H_NO_MEM -9 859fdf0c29SDavid Gibson #define H_AUTHORITY -10 869fdf0c29SDavid Gibson #define H_PERMISSION -11 879fdf0c29SDavid Gibson #define H_DROPPED -12 889fdf0c29SDavid Gibson #define H_SOURCE_PARM -13 899fdf0c29SDavid Gibson #define H_DEST_PARM -14 909fdf0c29SDavid Gibson #define H_REMOTE_PARM -15 919fdf0c29SDavid Gibson #define H_RESOURCE -16 929fdf0c29SDavid Gibson #define H_ADAPTER_PARM -17 939fdf0c29SDavid Gibson #define H_RH_PARM -18 949fdf0c29SDavid Gibson #define H_RCQ_PARM -19 959fdf0c29SDavid Gibson #define H_SCQ_PARM -20 969fdf0c29SDavid Gibson #define H_EQ_PARM -21 979fdf0c29SDavid Gibson #define H_RT_PARM -22 989fdf0c29SDavid Gibson #define H_ST_PARM -23 999fdf0c29SDavid Gibson #define H_SIGT_PARM -24 1009fdf0c29SDavid Gibson #define H_TOKEN_PARM -25 1019fdf0c29SDavid Gibson #define H_MLENGTH_PARM -27 1029fdf0c29SDavid Gibson #define H_MEM_PARM -28 1039fdf0c29SDavid Gibson #define H_MEM_ACCESS_PARM -29 1049fdf0c29SDavid Gibson #define H_ATTR_PARM -30 1059fdf0c29SDavid Gibson #define H_PORT_PARM -31 1069fdf0c29SDavid Gibson #define H_MCG_PARM -32 1079fdf0c29SDavid Gibson #define H_VL_PARM -33 1089fdf0c29SDavid Gibson #define H_TSIZE_PARM -34 1099fdf0c29SDavid Gibson #define H_TRACE_PARM -35 1109fdf0c29SDavid Gibson 1119fdf0c29SDavid Gibson #define H_MASK_PARM -37 1129fdf0c29SDavid Gibson #define H_MCG_FULL -38 1139fdf0c29SDavid Gibson #define H_ALIAS_EXIST -39 1149fdf0c29SDavid Gibson #define H_P_COUNTER -40 1159fdf0c29SDavid Gibson #define H_TABLE_FULL -41 1169fdf0c29SDavid Gibson #define H_ALT_TABLE -42 1179fdf0c29SDavid Gibson #define H_MR_CONDITION -43 1189fdf0c29SDavid Gibson #define H_NOT_ENOUGH_RESOURCES -44 1199fdf0c29SDavid Gibson #define H_R_STATE -45 1209fdf0c29SDavid Gibson #define H_RESCINDEND -46 12142561bf2SAnton Blanchard #define H_P2 -55 12242561bf2SAnton Blanchard #define H_P3 -56 12342561bf2SAnton Blanchard #define H_P4 -57 12442561bf2SAnton Blanchard #define H_P5 -58 12542561bf2SAnton Blanchard #define H_P6 -59 12642561bf2SAnton Blanchard #define H_P7 -60 12742561bf2SAnton Blanchard #define H_P8 -61 12842561bf2SAnton Blanchard #define H_P9 -62 12942561bf2SAnton Blanchard #define H_UNSUPPORTED_FLAG -256 1309fdf0c29SDavid Gibson #define H_MULTI_THREADS_ACTIVE -9005 1319fdf0c29SDavid Gibson 1329fdf0c29SDavid Gibson 1339fdf0c29SDavid Gibson /* Long Busy is a condition that can be returned by the firmware 1349fdf0c29SDavid Gibson * when a call cannot be completed now, but the identical call 1359fdf0c29SDavid Gibson * should be retried later. This prevents calls blocking in the 1369fdf0c29SDavid Gibson * firmware for long periods of time. Annoyingly the firmware can return 1379fdf0c29SDavid Gibson * a range of return codes, hinting at how long we should wait before 1389fdf0c29SDavid Gibson * retrying. If you don't care for the hint, the macro below is a good 1399fdf0c29SDavid Gibson * way to check for the long_busy return codes 1409fdf0c29SDavid Gibson */ 1419fdf0c29SDavid Gibson #define H_IS_LONG_BUSY(x) ((x >= H_LONG_BUSY_START_RANGE) \ 1429fdf0c29SDavid Gibson && (x <= H_LONG_BUSY_END_RANGE)) 1439fdf0c29SDavid Gibson 1449fdf0c29SDavid Gibson /* Flags */ 1459fdf0c29SDavid Gibson #define H_LARGE_PAGE (1ULL<<(63-16)) 1469fdf0c29SDavid Gibson #define H_EXACT (1ULL<<(63-24)) /* Use exact PTE or return H_PTEG_FULL */ 1479fdf0c29SDavid Gibson #define H_R_XLATE (1ULL<<(63-25)) /* include a valid logical page num in the pte if the valid bit is set */ 1489fdf0c29SDavid Gibson #define H_READ_4 (1ULL<<(63-26)) /* Return 4 PTEs */ 1499fdf0c29SDavid Gibson #define H_PAGE_STATE_CHANGE (1ULL<<(63-28)) 1509fdf0c29SDavid Gibson #define H_PAGE_UNUSED ((1ULL<<(63-29)) | (1ULL<<(63-30))) 1519fdf0c29SDavid Gibson #define H_PAGE_SET_UNUSED (H_PAGE_STATE_CHANGE | H_PAGE_UNUSED) 1529fdf0c29SDavid Gibson #define H_PAGE_SET_LOANED (H_PAGE_SET_UNUSED | (1ULL<<(63-31))) 1539fdf0c29SDavid Gibson #define H_PAGE_SET_ACTIVE H_PAGE_STATE_CHANGE 1549fdf0c29SDavid Gibson #define H_AVPN (1ULL<<(63-32)) /* An avpn is provided as a sanity test */ 1559fdf0c29SDavid Gibson #define H_ANDCOND (1ULL<<(63-33)) 1569fdf0c29SDavid Gibson #define H_ICACHE_INVALIDATE (1ULL<<(63-40)) /* icbi, etc. (ignored for IO pages) */ 1579fdf0c29SDavid Gibson #define H_ICACHE_SYNCHRONIZE (1ULL<<(63-41)) /* dcbst, icbi, etc (ignored for IO pages */ 1589fdf0c29SDavid Gibson #define H_ZERO_PAGE (1ULL<<(63-48)) /* zero the page before mapping (ignored for IO pages) */ 1599fdf0c29SDavid Gibson #define H_COPY_PAGE (1ULL<<(63-49)) 1609fdf0c29SDavid Gibson #define H_N (1ULL<<(63-61)) 1619fdf0c29SDavid Gibson #define H_PP1 (1ULL<<(63-62)) 1629fdf0c29SDavid Gibson #define H_PP2 (1ULL<<(63-63)) 1639fdf0c29SDavid Gibson 164a46622fdSAlexey Kardashevskiy /* Values for 2nd argument to H_SET_MODE */ 165a46622fdSAlexey Kardashevskiy #define H_SET_MODE_RESOURCE_SET_CIABR 1 166a46622fdSAlexey Kardashevskiy #define H_SET_MODE_RESOURCE_SET_DAWR 2 167a46622fdSAlexey Kardashevskiy #define H_SET_MODE_RESOURCE_ADDR_TRANS_MODE 3 168a46622fdSAlexey Kardashevskiy #define H_SET_MODE_RESOURCE_LE 4 169a46622fdSAlexey Kardashevskiy 170a46622fdSAlexey Kardashevskiy /* Flags for H_SET_MODE_RESOURCE_LE */ 17142561bf2SAnton Blanchard #define H_SET_MODE_ENDIAN_BIG 0 17242561bf2SAnton Blanchard #define H_SET_MODE_ENDIAN_LITTLE 1 17342561bf2SAnton Blanchard 174d5ac4f54SAlexey Kardashevskiy /* Flags for H_SET_MODE_RESOURCE_ADDR_TRANS_MODE */ 175d5ac4f54SAlexey Kardashevskiy #define H_SET_MODE_ADDR_TRANS_NONE 0 176d5ac4f54SAlexey Kardashevskiy #define H_SET_MODE_ADDR_TRANS_0001_8000 2 177d5ac4f54SAlexey Kardashevskiy #define H_SET_MODE_ADDR_TRANS_C000_0000_0000_4000 3 178d5ac4f54SAlexey Kardashevskiy 1799fdf0c29SDavid Gibson /* VASI States */ 1809fdf0c29SDavid Gibson #define H_VASI_INVALID 0 1819fdf0c29SDavid Gibson #define H_VASI_ENABLED 1 1829fdf0c29SDavid Gibson #define H_VASI_ABORTED 2 1839fdf0c29SDavid Gibson #define H_VASI_SUSPENDING 3 1849fdf0c29SDavid Gibson #define H_VASI_SUSPENDED 4 1859fdf0c29SDavid Gibson #define H_VASI_RESUMED 5 1869fdf0c29SDavid Gibson #define H_VASI_COMPLETED 6 1879fdf0c29SDavid Gibson 1889fdf0c29SDavid Gibson /* DABRX flags */ 1899fdf0c29SDavid Gibson #define H_DABRX_HYPERVISOR (1ULL<<(63-61)) 1909fdf0c29SDavid Gibson #define H_DABRX_KERNEL (1ULL<<(63-62)) 1919fdf0c29SDavid Gibson #define H_DABRX_USER (1ULL<<(63-63)) 1929fdf0c29SDavid Gibson 19366a0a2cbSDong Xu Wang /* Each control block has to be on a 4K boundary */ 1949fdf0c29SDavid Gibson #define H_CB_ALIGNMENT 4096 1959fdf0c29SDavid Gibson 1969fdf0c29SDavid Gibson /* pSeries hypervisor opcodes */ 1979fdf0c29SDavid Gibson #define H_REMOVE 0x04 1989fdf0c29SDavid Gibson #define H_ENTER 0x08 1999fdf0c29SDavid Gibson #define H_READ 0x0c 2009fdf0c29SDavid Gibson #define H_CLEAR_MOD 0x10 2019fdf0c29SDavid Gibson #define H_CLEAR_REF 0x14 2029fdf0c29SDavid Gibson #define H_PROTECT 0x18 2039fdf0c29SDavid Gibson #define H_GET_TCE 0x1c 2049fdf0c29SDavid Gibson #define H_PUT_TCE 0x20 2059fdf0c29SDavid Gibson #define H_SET_SPRG0 0x24 2069fdf0c29SDavid Gibson #define H_SET_DABR 0x28 2079fdf0c29SDavid Gibson #define H_PAGE_INIT 0x2c 2089fdf0c29SDavid Gibson #define H_SET_ASR 0x30 2099fdf0c29SDavid Gibson #define H_ASR_ON 0x34 2109fdf0c29SDavid Gibson #define H_ASR_OFF 0x38 2119fdf0c29SDavid Gibson #define H_LOGICAL_CI_LOAD 0x3c 2129fdf0c29SDavid Gibson #define H_LOGICAL_CI_STORE 0x40 2139fdf0c29SDavid Gibson #define H_LOGICAL_CACHE_LOAD 0x44 2149fdf0c29SDavid Gibson #define H_LOGICAL_CACHE_STORE 0x48 2159fdf0c29SDavid Gibson #define H_LOGICAL_ICBI 0x4c 2169fdf0c29SDavid Gibson #define H_LOGICAL_DCBF 0x50 2179fdf0c29SDavid Gibson #define H_GET_TERM_CHAR 0x54 2189fdf0c29SDavid Gibson #define H_PUT_TERM_CHAR 0x58 2199fdf0c29SDavid Gibson #define H_REAL_TO_LOGICAL 0x5c 2209fdf0c29SDavid Gibson #define H_HYPERVISOR_DATA 0x60 2219fdf0c29SDavid Gibson #define H_EOI 0x64 2229fdf0c29SDavid Gibson #define H_CPPR 0x68 2239fdf0c29SDavid Gibson #define H_IPI 0x6c 2249fdf0c29SDavid Gibson #define H_IPOLL 0x70 2259fdf0c29SDavid Gibson #define H_XIRR 0x74 2269fdf0c29SDavid Gibson #define H_PERFMON 0x7c 2279fdf0c29SDavid Gibson #define H_MIGRATE_DMA 0x78 2289fdf0c29SDavid Gibson #define H_REGISTER_VPA 0xDC 2299fdf0c29SDavid Gibson #define H_CEDE 0xE0 2309fdf0c29SDavid Gibson #define H_CONFER 0xE4 2319fdf0c29SDavid Gibson #define H_PROD 0xE8 2329fdf0c29SDavid Gibson #define H_GET_PPP 0xEC 2339fdf0c29SDavid Gibson #define H_SET_PPP 0xF0 2349fdf0c29SDavid Gibson #define H_PURR 0xF4 2359fdf0c29SDavid Gibson #define H_PIC 0xF8 2369fdf0c29SDavid Gibson #define H_REG_CRQ 0xFC 2379fdf0c29SDavid Gibson #define H_FREE_CRQ 0x100 2389fdf0c29SDavid Gibson #define H_VIO_SIGNAL 0x104 2399fdf0c29SDavid Gibson #define H_SEND_CRQ 0x108 2409fdf0c29SDavid Gibson #define H_COPY_RDMA 0x110 2419fdf0c29SDavid Gibson #define H_REGISTER_LOGICAL_LAN 0x114 2429fdf0c29SDavid Gibson #define H_FREE_LOGICAL_LAN 0x118 2439fdf0c29SDavid Gibson #define H_ADD_LOGICAL_LAN_BUFFER 0x11C 2449fdf0c29SDavid Gibson #define H_SEND_LOGICAL_LAN 0x120 2459fdf0c29SDavid Gibson #define H_BULK_REMOVE 0x124 2469fdf0c29SDavid Gibson #define H_MULTICAST_CTRL 0x130 2479fdf0c29SDavid Gibson #define H_SET_XDABR 0x134 2489fdf0c29SDavid Gibson #define H_STUFF_TCE 0x138 2499fdf0c29SDavid Gibson #define H_PUT_TCE_INDIRECT 0x13C 2509fdf0c29SDavid Gibson #define H_CHANGE_LOGICAL_LAN_MAC 0x14C 2519fdf0c29SDavid Gibson #define H_VTERM_PARTNER_INFO 0x150 2529fdf0c29SDavid Gibson #define H_REGISTER_VTERM 0x154 2539fdf0c29SDavid Gibson #define H_FREE_VTERM 0x158 2549fdf0c29SDavid Gibson #define H_RESET_EVENTS 0x15C 2559fdf0c29SDavid Gibson #define H_ALLOC_RESOURCE 0x160 2569fdf0c29SDavid Gibson #define H_FREE_RESOURCE 0x164 2579fdf0c29SDavid Gibson #define H_MODIFY_QP 0x168 2589fdf0c29SDavid Gibson #define H_QUERY_QP 0x16C 2599fdf0c29SDavid Gibson #define H_REREGISTER_PMR 0x170 2609fdf0c29SDavid Gibson #define H_REGISTER_SMR 0x174 2619fdf0c29SDavid Gibson #define H_QUERY_MR 0x178 2629fdf0c29SDavid Gibson #define H_QUERY_MW 0x17C 2639fdf0c29SDavid Gibson #define H_QUERY_HCA 0x180 2649fdf0c29SDavid Gibson #define H_QUERY_PORT 0x184 2659fdf0c29SDavid Gibson #define H_MODIFY_PORT 0x188 2669fdf0c29SDavid Gibson #define H_DEFINE_AQP1 0x18C 2679fdf0c29SDavid Gibson #define H_GET_TRACE_BUFFER 0x190 2689fdf0c29SDavid Gibson #define H_DEFINE_AQP0 0x194 2699fdf0c29SDavid Gibson #define H_RESIZE_MR 0x198 2709fdf0c29SDavid Gibson #define H_ATTACH_MCQP 0x19C 2719fdf0c29SDavid Gibson #define H_DETACH_MCQP 0x1A0 2729fdf0c29SDavid Gibson #define H_CREATE_RPT 0x1A4 2739fdf0c29SDavid Gibson #define H_REMOVE_RPT 0x1A8 2749fdf0c29SDavid Gibson #define H_REGISTER_RPAGES 0x1AC 2759fdf0c29SDavid Gibson #define H_DISABLE_AND_GETC 0x1B0 2769fdf0c29SDavid Gibson #define H_ERROR_DATA 0x1B4 2779fdf0c29SDavid Gibson #define H_GET_HCA_INFO 0x1B8 2789fdf0c29SDavid Gibson #define H_GET_PERF_COUNT 0x1BC 2799fdf0c29SDavid Gibson #define H_MANAGE_TRACE 0x1C0 2809fdf0c29SDavid Gibson #define H_FREE_LOGICAL_LAN_BUFFER 0x1D4 2819fdf0c29SDavid Gibson #define H_QUERY_INT_STATE 0x1E4 2829fdf0c29SDavid Gibson #define H_POLL_PENDING 0x1D8 2839fdf0c29SDavid Gibson #define H_ILLAN_ATTRIBUTES 0x244 2849fdf0c29SDavid Gibson #define H_MODIFY_HEA_QP 0x250 2859fdf0c29SDavid Gibson #define H_QUERY_HEA_QP 0x254 2869fdf0c29SDavid Gibson #define H_QUERY_HEA 0x258 2879fdf0c29SDavid Gibson #define H_QUERY_HEA_PORT 0x25C 2889fdf0c29SDavid Gibson #define H_MODIFY_HEA_PORT 0x260 2899fdf0c29SDavid Gibson #define H_REG_BCMC 0x264 2909fdf0c29SDavid Gibson #define H_DEREG_BCMC 0x268 2919fdf0c29SDavid Gibson #define H_REGISTER_HEA_RPAGES 0x26C 2929fdf0c29SDavid Gibson #define H_DISABLE_AND_GET_HEA 0x270 2939fdf0c29SDavid Gibson #define H_GET_HEA_INFO 0x274 2949fdf0c29SDavid Gibson #define H_ALLOC_HEA_RESOURCE 0x278 2959fdf0c29SDavid Gibson #define H_ADD_CONN 0x284 2969fdf0c29SDavid Gibson #define H_DEL_CONN 0x288 2979fdf0c29SDavid Gibson #define H_JOIN 0x298 2989fdf0c29SDavid Gibson #define H_VASI_STATE 0x2A4 2999fdf0c29SDavid Gibson #define H_ENABLE_CRQ 0x2B0 3009fdf0c29SDavid Gibson #define H_GET_EM_PARMS 0x2B8 3019fdf0c29SDavid Gibson #define H_SET_MPP 0x2D0 3029fdf0c29SDavid Gibson #define H_GET_MPP 0x2D4 3035d87e4b7SBenjamin Herrenschmidt #define H_XIRR_X 0x2FC 30442561bf2SAnton Blanchard #define H_SET_MODE 0x31C 30542561bf2SAnton Blanchard #define MAX_HCALL_OPCODE H_SET_MODE 3069fdf0c29SDavid Gibson 30739ac8455SDavid Gibson /* The hcalls above are standardized in PAPR and implemented by pHyp 30839ac8455SDavid Gibson * as well. 30939ac8455SDavid Gibson * 31039ac8455SDavid Gibson * We also need some hcalls which are specific to qemu / KVM-on-POWER. 31139ac8455SDavid Gibson * So far we just need one for H_RTAS, but in future we'll need more 31239ac8455SDavid Gibson * for extensions like virtio. We put those into the 0xf000-0xfffc 31339ac8455SDavid Gibson * range which is reserved by PAPR for "platform-specific" hcalls. 31439ac8455SDavid Gibson */ 31539ac8455SDavid Gibson #define KVMPPC_HCALL_BASE 0xf000 31639ac8455SDavid Gibson #define KVMPPC_H_RTAS (KVMPPC_HCALL_BASE + 0x0) 317c73e3771SBenjamin Herrenschmidt #define KVMPPC_H_LOGICAL_MEMOP (KVMPPC_HCALL_BASE + 0x1) 3182a6593cbSAlexey Kardashevskiy /* Client Architecture support */ 3192a6593cbSAlexey Kardashevskiy #define KVMPPC_H_CAS (KVMPPC_HCALL_BASE + 0x2) 3202a6593cbSAlexey Kardashevskiy #define KVMPPC_HCALL_MAX KVMPPC_H_CAS 32139ac8455SDavid Gibson 3229fdf0c29SDavid Gibson extern sPAPREnvironment *spapr; 3239fdf0c29SDavid Gibson 3242a6593cbSAlexey Kardashevskiy typedef struct sPAPRDeviceTreeUpdateHeader { 3252a6593cbSAlexey Kardashevskiy uint32_t version_id; 3262a6593cbSAlexey Kardashevskiy } sPAPRDeviceTreeUpdateHeader; 3272a6593cbSAlexey Kardashevskiy 3289fdf0c29SDavid Gibson /*#define DEBUG_SPAPR_HCALLS*/ 3299fdf0c29SDavid Gibson 3309fdf0c29SDavid Gibson #ifdef DEBUG_SPAPR_HCALLS 3319fdf0c29SDavid Gibson #define hcall_dprintf(fmt, ...) \ 332d9599c92SDavid Gibson do { fprintf(stderr, "%s: " fmt, __func__, ## __VA_ARGS__); } while (0) 3339fdf0c29SDavid Gibson #else 3349fdf0c29SDavid Gibson #define hcall_dprintf(fmt, ...) \ 3359fdf0c29SDavid Gibson do { } while (0) 3369fdf0c29SDavid Gibson #endif 3379fdf0c29SDavid Gibson 338b13ce26dSAndreas Färber typedef target_ulong (*spapr_hcall_fn)(PowerPCCPU *cpu, sPAPREnvironment *spapr, 3399fdf0c29SDavid Gibson target_ulong opcode, 3409fdf0c29SDavid Gibson target_ulong *args); 3419fdf0c29SDavid Gibson 3429fdf0c29SDavid Gibson void spapr_register_hypercall(target_ulong opcode, spapr_hcall_fn fn); 343aa100fa4SAndreas Färber target_ulong spapr_hypercall(PowerPCCPU *cpu, target_ulong opcode, 3449fdf0c29SDavid Gibson target_ulong *args); 3459fdf0c29SDavid Gibson 346ff9d2afaSDavid Gibson int spapr_allocate_irq(int hint, bool lsi); 347f1c2dc7cSAlexey Kardashevskiy int spapr_allocate_irq_block(int num, bool lsi, bool msi); 348d07fee7eSDavid Gibson 349ee954280SGavin Shan /* ibm,set-eeh-option */ 350ee954280SGavin Shan #define RTAS_EEH_DISABLE 0 351ee954280SGavin Shan #define RTAS_EEH_ENABLE 1 352ee954280SGavin Shan #define RTAS_EEH_THAW_IO 2 353ee954280SGavin Shan #define RTAS_EEH_THAW_DMA 3 354ee954280SGavin Shan 355ee954280SGavin Shan /* ibm,get-config-addr-info2 */ 356ee954280SGavin Shan #define RTAS_GET_PE_ADDR 0 357ee954280SGavin Shan #define RTAS_GET_PE_MODE 1 358ee954280SGavin Shan #define RTAS_PE_MODE_NONE 0 359ee954280SGavin Shan #define RTAS_PE_MODE_NOT_SHARED 1 360ee954280SGavin Shan #define RTAS_PE_MODE_SHARED 2 361ee954280SGavin Shan 362ee954280SGavin Shan /* ibm,read-slot-reset-state2 */ 363ee954280SGavin Shan #define RTAS_EEH_PE_STATE_NORMAL 0 364ee954280SGavin Shan #define RTAS_EEH_PE_STATE_RESET 1 365ee954280SGavin Shan #define RTAS_EEH_PE_STATE_STOPPED_IO_DMA 2 366ee954280SGavin Shan #define RTAS_EEH_PE_STATE_STOPPED_DMA 4 367ee954280SGavin Shan #define RTAS_EEH_PE_STATE_UNAVAIL 5 368ee954280SGavin Shan #define RTAS_EEH_NOT_SUPPORT 0 369ee954280SGavin Shan #define RTAS_EEH_SUPPORT 1 370ee954280SGavin Shan #define RTAS_EEH_PE_UNAVAIL_INFO 1000 371ee954280SGavin Shan #define RTAS_EEH_PE_RECOVER_INFO 0 372ee954280SGavin Shan 373ee954280SGavin Shan /* ibm,set-slot-reset */ 374ee954280SGavin Shan #define RTAS_SLOT_RESET_DEACTIVATE 0 375ee954280SGavin Shan #define RTAS_SLOT_RESET_HOT 1 376ee954280SGavin Shan #define RTAS_SLOT_RESET_FUNDAMENTAL 3 377ee954280SGavin Shan 378ee954280SGavin Shan /* ibm,slot-error-detail */ 379ee954280SGavin Shan #define RTAS_SLOT_TEMP_ERR_LOG 1 380ee954280SGavin Shan #define RTAS_SLOT_PERM_ERR_LOG 2 381ee954280SGavin Shan 382a64d325dSAlexey Kardashevskiy /* RTAS return codes */ 383a64d325dSAlexey Kardashevskiy #define RTAS_OUT_SUCCESS 0 384a64d325dSAlexey Kardashevskiy #define RTAS_OUT_NO_ERRORS_FOUND 1 385a64d325dSAlexey Kardashevskiy #define RTAS_OUT_HW_ERROR -1 386a64d325dSAlexey Kardashevskiy #define RTAS_OUT_BUSY -2 387a64d325dSAlexey Kardashevskiy #define RTAS_OUT_PARAM_ERROR -3 3883ada6b11SAlexey Kardashevskiy #define RTAS_OUT_NOT_SUPPORTED -3 3893ada6b11SAlexey Kardashevskiy #define RTAS_OUT_NOT_AUTHORIZED -9002 390a64d325dSAlexey Kardashevskiy 3913a3b8502SAlexey Kardashevskiy /* RTAS tokens */ 3923a3b8502SAlexey Kardashevskiy #define RTAS_TOKEN_BASE 0x2000 3933a3b8502SAlexey Kardashevskiy 3943a3b8502SAlexey Kardashevskiy #define RTAS_DISPLAY_CHARACTER (RTAS_TOKEN_BASE + 0x00) 3953a3b8502SAlexey Kardashevskiy #define RTAS_GET_TIME_OF_DAY (RTAS_TOKEN_BASE + 0x01) 3963a3b8502SAlexey Kardashevskiy #define RTAS_SET_TIME_OF_DAY (RTAS_TOKEN_BASE + 0x02) 3973a3b8502SAlexey Kardashevskiy #define RTAS_POWER_OFF (RTAS_TOKEN_BASE + 0x03) 3983a3b8502SAlexey Kardashevskiy #define RTAS_SYSTEM_REBOOT (RTAS_TOKEN_BASE + 0x04) 3993a3b8502SAlexey Kardashevskiy #define RTAS_QUERY_CPU_STOPPED_STATE (RTAS_TOKEN_BASE + 0x05) 4003a3b8502SAlexey Kardashevskiy #define RTAS_START_CPU (RTAS_TOKEN_BASE + 0x06) 4013a3b8502SAlexey Kardashevskiy #define RTAS_STOP_SELF (RTAS_TOKEN_BASE + 0x07) 4023a3b8502SAlexey Kardashevskiy #define RTAS_IBM_GET_SYSTEM_PARAMETER (RTAS_TOKEN_BASE + 0x08) 4033a3b8502SAlexey Kardashevskiy #define RTAS_IBM_SET_SYSTEM_PARAMETER (RTAS_TOKEN_BASE + 0x09) 4043a3b8502SAlexey Kardashevskiy #define RTAS_IBM_SET_XIVE (RTAS_TOKEN_BASE + 0x0A) 4053a3b8502SAlexey Kardashevskiy #define RTAS_IBM_GET_XIVE (RTAS_TOKEN_BASE + 0x0B) 4063a3b8502SAlexey Kardashevskiy #define RTAS_IBM_INT_OFF (RTAS_TOKEN_BASE + 0x0C) 4073a3b8502SAlexey Kardashevskiy #define RTAS_IBM_INT_ON (RTAS_TOKEN_BASE + 0x0D) 4083a3b8502SAlexey Kardashevskiy #define RTAS_CHECK_EXCEPTION (RTAS_TOKEN_BASE + 0x0E) 4093a3b8502SAlexey Kardashevskiy #define RTAS_EVENT_SCAN (RTAS_TOKEN_BASE + 0x0F) 4103a3b8502SAlexey Kardashevskiy #define RTAS_IBM_SET_TCE_BYPASS (RTAS_TOKEN_BASE + 0x10) 4113a3b8502SAlexey Kardashevskiy #define RTAS_QUIESCE (RTAS_TOKEN_BASE + 0x11) 4123a3b8502SAlexey Kardashevskiy #define RTAS_NVRAM_FETCH (RTAS_TOKEN_BASE + 0x12) 4133a3b8502SAlexey Kardashevskiy #define RTAS_NVRAM_STORE (RTAS_TOKEN_BASE + 0x13) 4143a3b8502SAlexey Kardashevskiy #define RTAS_READ_PCI_CONFIG (RTAS_TOKEN_BASE + 0x14) 4153a3b8502SAlexey Kardashevskiy #define RTAS_WRITE_PCI_CONFIG (RTAS_TOKEN_BASE + 0x15) 4163a3b8502SAlexey Kardashevskiy #define RTAS_IBM_READ_PCI_CONFIG (RTAS_TOKEN_BASE + 0x16) 4173a3b8502SAlexey Kardashevskiy #define RTAS_IBM_WRITE_PCI_CONFIG (RTAS_TOKEN_BASE + 0x17) 4183a3b8502SAlexey Kardashevskiy #define RTAS_IBM_QUERY_INTERRUPT_SOURCE_NUMBER (RTAS_TOKEN_BASE + 0x18) 4193a3b8502SAlexey Kardashevskiy #define RTAS_IBM_CHANGE_MSI (RTAS_TOKEN_BASE + 0x19) 4203a3b8502SAlexey Kardashevskiy #define RTAS_SET_INDICATOR (RTAS_TOKEN_BASE + 0x1A) 4213a3b8502SAlexey Kardashevskiy #define RTAS_SET_POWER_LEVEL (RTAS_TOKEN_BASE + 0x1B) 4223a3b8502SAlexey Kardashevskiy #define RTAS_GET_POWER_LEVEL (RTAS_TOKEN_BASE + 0x1C) 4233a3b8502SAlexey Kardashevskiy #define RTAS_GET_SENSOR_STATE (RTAS_TOKEN_BASE + 0x1D) 4243a3b8502SAlexey Kardashevskiy #define RTAS_IBM_CONFIGURE_CONNECTOR (RTAS_TOKEN_BASE + 0x1E) 4253a3b8502SAlexey Kardashevskiy #define RTAS_IBM_OS_TERM (RTAS_TOKEN_BASE + 0x1F) 426ee954280SGavin Shan #define RTAS_IBM_SET_EEH_OPTION (RTAS_TOKEN_BASE + 0x20) 427ee954280SGavin Shan #define RTAS_IBM_GET_CONFIG_ADDR_INFO2 (RTAS_TOKEN_BASE + 0x21) 428ee954280SGavin Shan #define RTAS_IBM_READ_SLOT_RESET_STATE2 (RTAS_TOKEN_BASE + 0x22) 429ee954280SGavin Shan #define RTAS_IBM_SET_SLOT_RESET (RTAS_TOKEN_BASE + 0x23) 430ee954280SGavin Shan #define RTAS_IBM_CONFIGURE_PE (RTAS_TOKEN_BASE + 0x24) 431ee954280SGavin Shan #define RTAS_IBM_SLOT_ERROR_DETAIL (RTAS_TOKEN_BASE + 0x25) 4323a3b8502SAlexey Kardashevskiy 433ee954280SGavin Shan #define RTAS_TOKEN_MAX (RTAS_TOKEN_BASE + 0x26) 4343a3b8502SAlexey Kardashevskiy 4353052d951SSam bobroff /* RTAS ibm,get-system-parameter token values */ 4363b50d897SSam bobroff #define RTAS_SYSPARM_SPLPAR_CHARACTERISTICS 20 4373052d951SSam bobroff #define RTAS_SYSPARM_DIAGNOSTICS_RUN_MODE 42 438b907d7b0SSam bobroff #define RTAS_SYSPARM_UUID 48 4393052d951SSam bobroff 4408c8639dfSMike Day /* RTAS indicator/sensor types 4418c8639dfSMike Day * 4428c8639dfSMike Day * as defined by PAPR+ 2.7 7.3.5.4, Table 41 4438c8639dfSMike Day * 4448c8639dfSMike Day * NOTE: currently only DR-related sensors are implemented here 4458c8639dfSMike Day */ 4468c8639dfSMike Day #define RTAS_SENSOR_TYPE_ISOLATION_STATE 9001 4478c8639dfSMike Day #define RTAS_SENSOR_TYPE_DR 9002 4488c8639dfSMike Day #define RTAS_SENSOR_TYPE_ALLOCATION_STATE 9003 4498c8639dfSMike Day #define RTAS_SENSOR_TYPE_ENTITY_SENSE RTAS_SENSOR_TYPE_ALLOCATION_STATE 4508c8639dfSMike Day 4513052d951SSam bobroff /* Possible values for the platform-processor-diagnostics-run-mode parameter 4523052d951SSam bobroff * of the RTAS ibm,get-system-parameter call. 4533052d951SSam bobroff */ 4543052d951SSam bobroff #define DIAGNOSTICS_RUN_MODE_DISABLED 0 4553052d951SSam bobroff #define DIAGNOSTICS_RUN_MODE_STAGGERED 1 4563052d951SSam bobroff #define DIAGNOSTICS_RUN_MODE_IMMEDIATE 2 4573052d951SSam bobroff #define DIAGNOSTICS_RUN_MODE_PERIODIC 3 4583052d951SSam bobroff 4594fe822e0SAlexey Kardashevskiy static inline uint64_t ppc64_phys_to_real(uint64_t addr) 4604fe822e0SAlexey Kardashevskiy { 4614fe822e0SAlexey Kardashevskiy return addr & ~0xF000000000000000ULL; 4624fe822e0SAlexey Kardashevskiy } 4634fe822e0SAlexey Kardashevskiy 46439ac8455SDavid Gibson static inline uint32_t rtas_ld(target_ulong phys, int n) 46539ac8455SDavid Gibson { 466fdfba1a2SEdgar E. Iglesias return ldl_be_phys(&address_space_memory, ppc64_phys_to_real(phys + 4*n)); 46739ac8455SDavid Gibson } 46839ac8455SDavid Gibson 46939ac8455SDavid Gibson static inline void rtas_st(target_ulong phys, int n, uint32_t val) 47039ac8455SDavid Gibson { 471ab1da857SEdgar E. Iglesias stl_be_phys(&address_space_memory, ppc64_phys_to_real(phys + 4*n), val); 47239ac8455SDavid Gibson } 47339ac8455SDavid Gibson 474ab316865SMichael Roth static inline void rtas_st_buffer_direct(target_ulong phys, 475ab316865SMichael Roth target_ulong phys_len, 476ab316865SMichael Roth uint8_t *buffer, uint16_t buffer_len) 477ab316865SMichael Roth { 478ab316865SMichael Roth cpu_physical_memory_write(ppc64_phys_to_real(phys), buffer, 479ab316865SMichael Roth MIN(buffer_len, phys_len)); 480ab316865SMichael Roth } 481ce3fa1ecSSam bobroff 482ce3fa1ecSSam bobroff static inline void rtas_st_buffer(target_ulong phys, target_ulong phys_len, 483ce3fa1ecSSam bobroff uint8_t *buffer, uint16_t buffer_len) 484ce3fa1ecSSam bobroff { 485ce3fa1ecSSam bobroff if (phys_len < 2) { 486ce3fa1ecSSam bobroff return; 487ce3fa1ecSSam bobroff } 488ce3fa1ecSSam bobroff stw_be_phys(&address_space_memory, 489ce3fa1ecSSam bobroff ppc64_phys_to_real(phys), buffer_len); 490ab316865SMichael Roth rtas_st_buffer_direct(phys + 2, phys_len - 2, buffer, buffer_len); 491ce3fa1ecSSam bobroff } 492ce3fa1ecSSam bobroff 493210b580bSAnthony Liguori typedef void (*spapr_rtas_fn)(PowerPCCPU *cpu, sPAPREnvironment *spapr, 494210b580bSAnthony Liguori uint32_t token, 49539ac8455SDavid Gibson uint32_t nargs, target_ulong args, 49639ac8455SDavid Gibson uint32_t nret, target_ulong rets); 4973a3b8502SAlexey Kardashevskiy void spapr_rtas_register(int token, const char *name, spapr_rtas_fn fn); 498210b580bSAnthony Liguori target_ulong spapr_rtas_call(PowerPCCPU *cpu, sPAPREnvironment *spapr, 49939ac8455SDavid Gibson uint32_t token, uint32_t nargs, target_ulong args, 50039ac8455SDavid Gibson uint32_t nret, target_ulong rets); 501a8170e5eSAvi Kivity int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr, 502a8170e5eSAvi Kivity hwaddr rtas_size); 50339ac8455SDavid Gibson 504ad0ebb91SDavid Gibson #define SPAPR_TCE_PAGE_SHIFT 12 505ad0ebb91SDavid Gibson #define SPAPR_TCE_PAGE_SIZE (1ULL << SPAPR_TCE_PAGE_SHIFT) 506ad0ebb91SDavid Gibson #define SPAPR_TCE_PAGE_MASK (SPAPR_TCE_PAGE_SIZE - 1) 507ad0ebb91SDavid Gibson 508ad0ebb91SDavid Gibson #define SPAPR_VIO_BASE_LIOBN 0x00000000 5094290ca49SAlexey Kardashevskiy #define SPAPR_VIO_LIOBN(reg) (0x00000000 | (reg)) 510c8545818SAlexey Kardashevskiy #define SPAPR_PCI_LIOBN(phb_index, window_num) \ 511c8545818SAlexey Kardashevskiy (0x80000000 | ((phb_index) << 8) | (window_num)) 512d9d96a3cSAlexey Kardashevskiy #define SPAPR_IS_PCI_LIOBN(liobn) (!!((liobn) & 0x80000000)) 513c8545818SAlexey Kardashevskiy #define SPAPR_PCI_DMA_WINDOW_NUM(liobn) ((liobn) & 0xff) 514ad0ebb91SDavid Gibson 51574d042e5SDavid Gibson #define RTAS_ERROR_LOG_MAX 2048 51674d042e5SDavid Gibson 5172b7dc949SPaolo Bonzini typedef struct sPAPRTCETable sPAPRTCETable; 51874d042e5SDavid Gibson 519a83000f5SAnthony Liguori #define TYPE_SPAPR_TCE_TABLE "spapr-tce-table" 520a83000f5SAnthony Liguori #define SPAPR_TCE_TABLE(obj) \ 521a83000f5SAnthony Liguori OBJECT_CHECK(sPAPRTCETable, (obj), TYPE_SPAPR_TCE_TABLE) 522a83000f5SAnthony Liguori 523a83000f5SAnthony Liguori struct sPAPRTCETable { 524a83000f5SAnthony Liguori DeviceState parent; 525a83000f5SAnthony Liguori uint32_t liobn; 526a83000f5SAnthony Liguori uint32_t nb_table; 5271b8eceeeSAlexey Kardashevskiy uint64_t bus_offset; 528650f33adSAlexey Kardashevskiy uint32_t page_shift; 529a83000f5SAnthony Liguori uint64_t *table; 530a83000f5SAnthony Liguori bool bypass; 5319bb62a07SAlexey Kardashevskiy bool vfio_accel; 532a83000f5SAnthony Liguori int fd; 533a83000f5SAnthony Liguori MemoryRegion iommu; 534ee9a569aSAlexey Kardashevskiy struct VIOsPAPRDevice *vdev; /* for @bypass migration compatibility only */ 535a83000f5SAnthony Liguori QLIST_ENTRY(sPAPRTCETable) list; 536a83000f5SAnthony Liguori }; 537a83000f5SAnthony Liguori 538f9ce8e0aSThomas Huth sPAPRTCETable *spapr_tce_find_by_liobn(target_ulong liobn); 539*31fe14d1SNathan Fontenot 540*31fe14d1SNathan Fontenot struct sPAPREventLogEntry { 541*31fe14d1SNathan Fontenot int log_type; 542*31fe14d1SNathan Fontenot void *data; 543*31fe14d1SNathan Fontenot QTAILQ_ENTRY(sPAPREventLogEntry) next; 544*31fe14d1SNathan Fontenot }; 545*31fe14d1SNathan Fontenot 54674d042e5SDavid Gibson void spapr_events_init(sPAPREnvironment *spapr); 54774d042e5SDavid Gibson void spapr_events_fdt_skel(void *fdt, uint32_t epow_irq); 5482a6593cbSAlexey Kardashevskiy int spapr_h_cas_compose_response(target_ulong addr, target_ulong size); 54984af6d9fSPaolo Bonzini sPAPRTCETable *spapr_tce_new_table(DeviceState *owner, uint32_t liobn, 5501b8eceeeSAlexey Kardashevskiy uint64_t bus_offset, 551650f33adSAlexey Kardashevskiy uint32_t page_shift, 5529bb62a07SAlexey Kardashevskiy uint32_t nb_table, 5539bb62a07SAlexey Kardashevskiy bool vfio_accel); 554a84bb436SPaolo Bonzini MemoryRegion *spapr_tce_get_iommu(sPAPRTCETable *tcet); 555ad0ebb91SDavid Gibson int spapr_dma_dt(void *fdt, int node_off, const char *propname, 5565c4cbcf2SAlexey Kardashevskiy uint32_t liobn, uint64_t window, uint32_t size); 5575c4cbcf2SAlexey Kardashevskiy int spapr_tcet_dma_dt(void *fdt, int node_off, const char *propname, 5582b7dc949SPaolo Bonzini sPAPRTCETable *tcet); 559eefaccc0SDavid Gibson void spapr_pci_switch_vga(bool big_endian); 560*31fe14d1SNathan Fontenot void spapr_hotplug_req_add_event(sPAPRDRConnector *drc); 561*31fe14d1SNathan Fontenot void spapr_hotplug_req_remove_event(sPAPRDRConnector *drc); 56228df36a1SDavid Gibson 56346503c2bSMichael Roth /* rtas-configure-connector state */ 56446503c2bSMichael Roth struct sPAPRConfigureConnectorState { 56546503c2bSMichael Roth uint32_t drc_index; 56646503c2bSMichael Roth int fdt_offset; 56746503c2bSMichael Roth int fdt_depth; 56846503c2bSMichael Roth QTAILQ_ENTRY(sPAPRConfigureConnectorState) next; 56946503c2bSMichael Roth }; 57046503c2bSMichael Roth 57146503c2bSMichael Roth void spapr_ccs_reset_hook(void *opaque); 57246503c2bSMichael Roth 57328df36a1SDavid Gibson #define TYPE_SPAPR_RTC "spapr-rtc" 57428df36a1SDavid Gibson 57528df36a1SDavid Gibson void spapr_rtc_read(DeviceState *dev, struct tm *tm, uint32_t *ns); 576880ae7deSDavid Gibson int spapr_rtc_import_offset(DeviceState *dev, int64_t legacy_offset); 577ad0ebb91SDavid Gibson 5789fdf0c29SDavid Gibson #endif /* !defined (__HW_SPAPR_H__) */ 579