platform.h revision 181624
11541Srgrimes/****************************************************************************** 21541Srgrimes * platform.h 31541Srgrimes * 41541Srgrimes * Hardware platform operations. Intended for use by domain-0 kernel. 51541Srgrimes * 61541Srgrimes * Permission is hereby granted, free of charge, to any person obtaining a copy 71541Srgrimes * of this software and associated documentation files (the "Software"), to 81541Srgrimes * deal in the Software without restriction, including without limitation the 91541Srgrimes * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 101541Srgrimes * sell copies of the Software, and to permit persons to whom the Software is 111541Srgrimes * furnished to do so, subject to the following conditions: 121541Srgrimes * 131541Srgrimes * The above copyright notice and this permission notice shall be included in 141541Srgrimes * all copies or substantial portions of the Software. 151541Srgrimes * 161541Srgrimes * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 171541Srgrimes * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 181541Srgrimes * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 191541Srgrimes * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 201541Srgrimes * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 211541Srgrimes * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 221541Srgrimes * DEALINGS IN THE SOFTWARE. 231541Srgrimes * 241541Srgrimes * Copyright (c) 2002-2006, K Fraser 251541Srgrimes */ 261541Srgrimes 271541Srgrimes#ifndef __XEN_PUBLIC_PLATFORM_H__ 281541Srgrimes#define __XEN_PUBLIC_PLATFORM_H__ 291541Srgrimes 301541Srgrimes#include "xen.h" 311541Srgrimes 321541Srgrimes#define XENPF_INTERFACE_VERSION 0x03000001 331541Srgrimes 3412819Sphk/* 351541Srgrimes * Set clock such that it would read <secs,nsecs> after 00:00:00 UTC, 361541Srgrimes * 1 January, 1970 if the current system time was <system_time>. 371541Srgrimes */ 381541Srgrimes#define XENPF_settime 17 391541Srgrimesstruct xenpf_settime { 401541Srgrimes /* IN variables. */ 411541Srgrimes uint32_t secs; 421541Srgrimes uint32_t nsecs; 431541Srgrimes uint64_t system_time; 441541Srgrimes}; 451541Srgrimestypedef struct xenpf_settime xenpf_settime_t; 461541SrgrimesDEFINE_XEN_GUEST_HANDLE(xenpf_settime_t); 471541Srgrimes 481541Srgrimes/* 491541Srgrimes * Request memory range (@mfn, @mfn+@nr_mfns-1) to have type @type. 501541Srgrimes * On x86, @type is an architecture-defined MTRR memory type. 511541Srgrimes * On success, returns the MTRR that was used (@reg) and a handle that can 521541Srgrimes * be passed to XENPF_DEL_MEMTYPE to accurately tear down the new setting. 533308Sphk * (x86-specific). 541541Srgrimes */ 5512517Sjulian#define XENPF_add_memtype 31 5612517Sjulianstruct xenpf_add_memtype { 5712517Sjulian /* IN variables. */ 5812517Sjulian xen_pfn_t mfn; 5912819Sphk uint64_t nr_mfns; 6012819Sphk uint32_t type; 6112819Sphk /* OUT variables. */ 6211789Sbde uint32_t handle; 6312675Sjulian uint32_t reg; 6412675Sjulian}; 6512675Sjuliantypedef struct xenpf_add_memtype xenpf_add_memtype_t; 6612675SjulianDEFINE_XEN_GUEST_HANDLE(xenpf_add_memtype_t); 6712675Sjulian 6812675Sjulian/* 6912731Sbde * Tear down an existing memory-range type. If @handle is remembered then it 7012675Sjulian * should be passed in to accurately tear down the correct setting (in case 7112675Sjulian * of overlapping memory regions with differing types). If it is not known 7212675Sjulian * then @handle should be set to zero. In all cases @reg must be set. 7312675Sjulian * (x86-specific). 7412675Sjulian */ 7512675Sjulian#define XENPF_del_memtype 32 7612675Sjulianstruct xenpf_del_memtype { 7712675Sjulian /* IN variables. */ 7812675Sjulian uint32_t handle; 7912678Sphk uint32_t reg; 8012675Sjulian}; 8112675Sjuliantypedef struct xenpf_del_memtype xenpf_del_memtype_t; 8212675SjulianDEFINE_XEN_GUEST_HANDLE(xenpf_del_memtype_t); 8312675Sjulian 8412678Sphk/* Read current type of an MTRR (x86-specific). */ 8512675Sjulian#define XENPF_read_memtype 33 8612675Sjulianstruct xenpf_read_memtype { 8712675Sjulian /* IN variables. */ 8812675Sjulian uint32_t reg; 8912675Sjulian /* OUT variables. */ 901541Srgrimes xen_pfn_t mfn; 911541Srgrimes uint64_t nr_mfns; 921541Srgrimes uint32_t type; 931541Srgrimes}; 941541Srgrimestypedef struct xenpf_read_memtype xenpf_read_memtype_t; 951541SrgrimesDEFINE_XEN_GUEST_HANDLE(xenpf_read_memtype_t); 961541Srgrimes 971541Srgrimes#define XENPF_microcode_update 35 9812564Sjulianstruct xenpf_microcode_update { 9912564Sjulian /* IN variables. */ 1001541Srgrimes void * data; /* Pointer to microcode data */ 10112819Sphk uint32_t length; /* Length of microcode data. */ 10212819Sphk}; 1031541Srgrimestypedef struct xenpf_microcode_update xenpf_microcode_update_t; 1041541SrgrimesDEFINE_XEN_GUEST_HANDLE(xenpf_microcode_update_t); 1051541Srgrimes 1061541Srgrimes#define XENPF_platform_quirk 39 1071541Srgrimes#define QUIRK_NOIRQBALANCING 1 /* Do not restrict IO-APIC RTE targets */ 10812819Sphk#define QUIRK_IOAPIC_BAD_REGSEL 2 /* IO-APIC REGSEL forgets its value */ 1091541Srgrimes#define QUIRK_IOAPIC_GOOD_REGSEL 3 /* IO-APIC REGSEL behaves properly */ 1101541Srgrimesstruct xenpf_platform_quirk { 1111541Srgrimes /* IN variables. */ 1121541Srgrimes uint32_t quirk_id; 1131541Srgrimes}; 1141541Srgrimestypedef struct xenpf_platform_quirk xenpf_platform_quirk_t; 1151541SrgrimesDEFINE_XEN_GUEST_HANDLE(xenpf_platform_quirk_t); 1161541Srgrimes 1171541Srgrimes#define XENPF_firmware_info 50 1181541Srgrimes#define XEN_FW_DISK_INFO 1 /* from int 13 AH=08/41/48 */ 1191541Srgrimes#define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */ 1201541Srgrimes#define XEN_FW_VBEDDC_INFO 3 /* from int 10 AX=4f15 */ 12112819Sphkstruct xenpf_firmware_info { 1221541Srgrimes /* IN variables. */ 1231541Srgrimes uint32_t type; 1241541Srgrimes uint32_t index; 1251541Srgrimes /* OUT variables. */ 1261541Srgrimes union { 1271541Srgrimes struct { 1281541Srgrimes /* Int13, Fn48: Check Extensions Present. */ 1291541Srgrimes uint8_t device; /* %dl: bios device number */ 1301541Srgrimes uint8_t version; /* %ah: major version */ 1311541Srgrimes uint16_t interface_support; /* %cx: support bitmap */ 1321541Srgrimes /* Int13, Fn08: Legacy Get Device Parameters. */ 1331541Srgrimes uint16_t legacy_max_cylinder; /* %cl[7:6]:%ch: max cyl # */ 1341541Srgrimes uint8_t legacy_max_head; /* %dh: max head # */ 1351541Srgrimes uint8_t legacy_sectors_per_track; /* %cl[5:0]: max sector # */ 1361541Srgrimes /* Int13, Fn41: Get Device Parameters (as filled into %ds:%esi). */ 1371541Srgrimes /* NB. First uint16_t of buffer must be set to buffer size. */ 1381541Srgrimes void * edd_params; 1391541Srgrimes } disk_info; /* XEN_FW_DISK_INFO */ 1401541Srgrimes struct { 1411541Srgrimes uint8_t device; /* bios device number */ 1421541Srgrimes uint32_t mbr_signature; /* offset 0x1b8 in mbr */ 1431541Srgrimes } disk_mbr_signature; /* XEN_FW_DISK_MBR_SIGNATURE */ 14412675Sjulian struct { 1451541Srgrimes /* Int10, AX=4F15: Get EDID info. */ 1461541Srgrimes uint8_t capabilities; 1471541Srgrimes uint8_t edid_transfer_time; 1481541Srgrimes /* must refer to 128-byte buffer */ 1491541Srgrimes XEN_GUEST_HANDLE(uint8_t) edid; 1501541Srgrimes } vbeddc_info; /* XEN_FW_VBEDDC_INFO */ 1511541Srgrimes } u; 1521541Srgrimes}; 1531541Srgrimestypedef struct xenpf_firmware_info xenpf_firmware_info_t; 1541541SrgrimesDEFINE_XEN_GUEST_HANDLE(xenpf_firmware_info_t); 1551541Srgrimes 1561541Srgrimesstruct xen_platform_op { 1571541Srgrimes uint32_t cmd; 1581541Srgrimes uint32_t interface_version; /* XENPF_INTERFACE_VERSION */ 1591541Srgrimes union { 1601541Srgrimes struct xenpf_settime settime; 1611541Srgrimes struct xenpf_add_memtype add_memtype; 1621541Srgrimes struct xenpf_del_memtype del_memtype; 1631541Srgrimes struct xenpf_read_memtype read_memtype; 1641541Srgrimes struct xenpf_microcode_update microcode; 1651541Srgrimes struct xenpf_platform_quirk platform_quirk; 1661541Srgrimes struct xenpf_firmware_info firmware_info; 1679824Sbde uint8_t pad[128]; 1681541Srgrimes } u; 1691541Srgrimes}; 1701541Srgrimestypedef struct xen_platform_op xen_platform_op_t; 1719639SbdeDEFINE_XEN_GUEST_HANDLE(xen_platform_op_t); 1729624Sbde 1733308Sphk#endif /* __XEN_PUBLIC_PLATFORM_H__ */ 1741541Srgrimes 1751541Srgrimes/* 1761541Srgrimes * Local variables: 1777724Sache * mode: C 1787724Sache * c-set-style: "BSD" 1791541Srgrimes * c-basic-offset: 4 1801541Srgrimes * tab-width: 4 1811541Srgrimes * indent-tabs-mode: nil 18212675Sjulian * End: 1831541Srgrimes */ 1841541Srgrimes