/*1* Permission is hereby granted, free of charge, to any person obtaining a copy2* of this software and associated documentation files (the "Software"), to3* deal in the Software without restriction, including without limitation the4* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or5* sell copies of the Software, and to permit persons to whom the Software is6* furnished to do so, subject to the following conditions:7*8* The above copyright notice and this permission notice shall be included in9* all copies or substantial portions of the Software.10*11* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR12* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,13* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE14* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER15* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING16* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER17* DEALINGS IN THE SOFTWARE.18*/1920#ifndef __XEN_PUBLIC_PHYSDEV_H__21#define __XEN_PUBLIC_PHYSDEV_H__2223/*24* Prototype for this hypercall is:25* int physdev_op(int cmd, void *args)26* @cmd == PHYSDEVOP_??? (physdev operation).27* @args == Operation-specific extra arguments (NULL if none).28*/2930/*31* Notify end-of-interrupt (EOI) for the specified IRQ.32* @arg == pointer to physdev_eoi structure.33*/34#define PHYSDEVOP_eoi 1235struct physdev_eoi {36/* IN */37uint32_t irq;38};3940/*41* Query the status of an IRQ line.42* @arg == pointer to physdev_irq_status_query structure.43*/44#define PHYSDEVOP_irq_status_query 545struct physdev_irq_status_query {46/* IN */47uint32_t irq;48/* OUT */49uint32_t flags; /* XENIRQSTAT_* */50};5152/* Need to call PHYSDEVOP_eoi when the IRQ has been serviced? */53#define _XENIRQSTAT_needs_eoi (0)54#define XENIRQSTAT_needs_eoi (1U<<_XENIRQSTAT_needs_eoi)5556/* IRQ shared by multiple guests? */57#define _XENIRQSTAT_shared (1)58#define XENIRQSTAT_shared (1U<<_XENIRQSTAT_shared)5960/*61* Set the current VCPU's I/O privilege level.62* @arg == pointer to physdev_set_iopl structure.63*/64#define PHYSDEVOP_set_iopl 665struct physdev_set_iopl {66/* IN */67uint32_t iopl;68};6970/*71* Set the current VCPU's I/O-port permissions bitmap.72* @arg == pointer to physdev_set_iobitmap structure.73*/74#define PHYSDEVOP_set_iobitmap 775struct physdev_set_iobitmap {76/* IN */77uint8_t * bitmap;78uint32_t nr_ports;79};8081/*82* Read or write an IO-APIC register.83* @arg == pointer to physdev_apic structure.84*/85#define PHYSDEVOP_apic_read 886#define PHYSDEVOP_apic_write 987struct physdev_apic {88/* IN */89unsigned long apic_physbase;90uint32_t reg;91/* IN or OUT */92uint32_t value;93};9495/*96* Allocate or free a physical upcall vector for the specified IRQ line.97* @arg == pointer to physdev_irq structure.98*/99#define PHYSDEVOP_alloc_irq_vector 10100#define PHYSDEVOP_free_irq_vector 11101struct physdev_irq {102/* IN */103uint32_t irq;104/* IN or OUT */105uint32_t vector;106};107108#define MAP_PIRQ_TYPE_MSI 0x0109#define MAP_PIRQ_TYPE_GSI 0x1110#define MAP_PIRQ_TYPE_UNKNOWN 0x2111112#define PHYSDEVOP_map_pirq 13113struct physdev_map_pirq {114domid_t domid;115/* IN */116int type;117/* IN */118int index;119/* IN or OUT */120int pirq;121/* IN */122int bus;123/* IN */124int devfn;125/* IN */126int entry_nr;127/* IN */128uint64_t table_base;129};130131#define PHYSDEVOP_unmap_pirq 14132struct physdev_unmap_pirq {133domid_t domid;134/* IN */135int pirq;136};137138#define PHYSDEVOP_manage_pci_add 15139#define PHYSDEVOP_manage_pci_remove 16140struct physdev_manage_pci {141/* IN */142uint8_t bus;143uint8_t devfn;144};145146#define PHYSDEVOP_manage_pci_add_ext 20147struct physdev_manage_pci_ext {148/* IN */149uint8_t bus;150uint8_t devfn;151unsigned is_extfn;152unsigned is_virtfn;153struct {154uint8_t bus;155uint8_t devfn;156} physfn;157};158159/*160* Argument to physdev_op_compat() hypercall. Superceded by new physdev_op()161* hypercall since 0x00030202.162*/163struct physdev_op {164uint32_t cmd;165union {166struct physdev_irq_status_query irq_status_query;167struct physdev_set_iopl set_iopl;168struct physdev_set_iobitmap set_iobitmap;169struct physdev_apic apic_op;170struct physdev_irq irq_op;171} u;172};173174#define PHYSDEVOP_setup_gsi 21175struct physdev_setup_gsi {176int gsi;177/* IN */178uint8_t triggering;179/* IN */180uint8_t polarity;181/* IN */182};183184#define PHYSDEVOP_get_nr_pirqs 22185struct physdev_nr_pirqs {186/* OUT */187uint32_t nr_pirqs;188};189190/* type is MAP_PIRQ_TYPE_GSI or MAP_PIRQ_TYPE_MSI191* the hypercall returns a free pirq */192#define PHYSDEVOP_get_free_pirq 23193struct physdev_get_free_pirq {194/* IN */195int type;196/* OUT */197uint32_t pirq;198};199200/*201* Notify that some PIRQ-bound event channels have been unmasked.202* ** This command is obsolete since interface version 0x00030202 and is **203* ** unsupported by newer versions of Xen. **204*/205#define PHYSDEVOP_IRQ_UNMASK_NOTIFY 4206207/*208* These all-capitals physdev operation names are superceded by the new names209* (defined above) since interface version 0x00030202.210*/211#define PHYSDEVOP_IRQ_STATUS_QUERY PHYSDEVOP_irq_status_query212#define PHYSDEVOP_SET_IOPL PHYSDEVOP_set_iopl213#define PHYSDEVOP_SET_IOBITMAP PHYSDEVOP_set_iobitmap214#define PHYSDEVOP_APIC_READ PHYSDEVOP_apic_read215#define PHYSDEVOP_APIC_WRITE PHYSDEVOP_apic_write216#define PHYSDEVOP_ASSIGN_VECTOR PHYSDEVOP_alloc_irq_vector217#define PHYSDEVOP_FREE_VECTOR PHYSDEVOP_free_irq_vector218#define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY XENIRQSTAT_needs_eoi219#define PHYSDEVOP_IRQ_SHARED XENIRQSTAT_shared220221#endif /* __XEN_PUBLIC_PHYSDEV_H__ */222223224