The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/xen/interface/hvm/ioreq.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * ioreq.h: I/O request definitions for device models
    3  * Copyright (c) 2004, Intel Corporation.
    4  * 
    5  * Permission is hereby granted, free of charge, to any person obtaining a copy
    6  * of this software and associated documentation files (the "Software"), to
    7  * deal in the Software without restriction, including without limitation the
    8  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
    9  * sell copies of the Software, and to permit persons to whom the Software is
   10  * furnished to do so, subject to the following conditions:
   11  *
   12  * The above copyright notice and this permission notice shall be included in
   13  * all copies or substantial portions of the Software.
   14  *
   15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   18  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
   20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
   21  * DEALINGS IN THE SOFTWARE.
   22  */
   23 
   24 #ifndef _IOREQ_H_
   25 #define _IOREQ_H_
   26 
   27 #define IOREQ_READ      1
   28 #define IOREQ_WRITE     0
   29 
   30 #define STATE_IOREQ_NONE        0
   31 #define STATE_IOREQ_READY       1
   32 #define STATE_IOREQ_INPROCESS   2
   33 #define STATE_IORESP_READY      3
   34 
   35 #define IOREQ_TYPE_PIO          0 /* pio */
   36 #define IOREQ_TYPE_COPY         1 /* mmio ops */
   37 #define IOREQ_TYPE_PCI_CONFIG   2
   38 #define IOREQ_TYPE_TIMEOFFSET   7
   39 #define IOREQ_TYPE_INVALIDATE   8 /* mapcache */
   40 
   41 /*
   42  * VMExit dispatcher should cooperate with instruction decoder to
   43  * prepare this structure and notify service OS and DM by sending
   44  * virq.
   45  *
   46  * For I/O type IOREQ_TYPE_PCI_CONFIG, the physical address is formatted
   47  * as follows:
   48  * 
   49  * 63....48|47..40|39..35|34..32|31........0
   50  * SEGMENT |BUS   |DEV   |FN    |OFFSET
   51  */
   52 struct ioreq {
   53     uint64_t addr;          /* physical address */
   54     uint64_t data;          /* data (or paddr of data) */
   55     uint32_t count;         /* for rep prefixes */
   56     uint32_t size;          /* size in bytes */
   57     uint32_t vp_eport;      /* evtchn for notifications to/from device model */
   58     uint16_t _pad0;
   59     uint8_t state:4;
   60     uint8_t data_is_ptr:1;  /* if 1, data above is the guest paddr 
   61                              * of the real data to use. */
   62     uint8_t dir:1;          /* 1=read, 0=write */
   63     uint8_t df:1;
   64     uint8_t _pad1:1;
   65     uint8_t type;           /* I/O type */
   66 };
   67 typedef struct ioreq ioreq_t;
   68 
   69 struct shared_iopage {
   70     struct ioreq vcpu_ioreq[1];
   71 };
   72 typedef struct shared_iopage shared_iopage_t;
   73 
   74 struct buf_ioreq {
   75     uint8_t  type;   /* I/O type                    */
   76     uint8_t  pad:1;
   77     uint8_t  dir:1;  /* 1=read, 0=write             */
   78     uint8_t  size:2; /* 0=>1, 1=>2, 2=>4, 3=>8. If 8, use two buf_ioreqs */
   79     uint32_t addr:20;/* physical address            */
   80     uint32_t data;   /* data                        */
   81 };
   82 typedef struct buf_ioreq buf_ioreq_t;
   83 
   84 #define IOREQ_BUFFER_SLOT_NUM     511 /* 8 bytes each, plus 2 4-byte indexes */
   85 struct buffered_iopage {
   86 #ifdef __XEN__
   87     union bufioreq_pointers {
   88         struct {
   89 #endif
   90             uint32_t read_pointer;
   91             uint32_t write_pointer;
   92 #ifdef __XEN__
   93         };
   94         uint64_t full;
   95     } ptrs;
   96 #endif
   97     buf_ioreq_t buf_ioreq[IOREQ_BUFFER_SLOT_NUM];
   98 }; /* NB. Size of this structure must be no greater than one page. */
   99 typedef struct buffered_iopage buffered_iopage_t;
  100 
  101 /*
  102  * ACPI Control/Event register locations. Location is controlled by a 
  103  * version number in HVM_PARAM_ACPI_IOPORTS_LOCATION.
  104  */
  105 
  106 /* Version 0 (default): Traditional Xen locations. */
  107 #define ACPI_PM1A_EVT_BLK_ADDRESS_V0 0x1f40
  108 #define ACPI_PM1A_CNT_BLK_ADDRESS_V0 (ACPI_PM1A_EVT_BLK_ADDRESS_V0 + 0x04)
  109 #define ACPI_PM_TMR_BLK_ADDRESS_V0   (ACPI_PM1A_EVT_BLK_ADDRESS_V0 + 0x08)
  110 #define ACPI_GPE0_BLK_ADDRESS_V0     (ACPI_PM_TMR_BLK_ADDRESS_V0 + 0x20)
  111 #define ACPI_GPE0_BLK_LEN_V0         0x08
  112 
  113 /* Version 1: Locations preferred by modern Qemu. */
  114 #define ACPI_PM1A_EVT_BLK_ADDRESS_V1 0xb000
  115 #define ACPI_PM1A_CNT_BLK_ADDRESS_V1 (ACPI_PM1A_EVT_BLK_ADDRESS_V1 + 0x04)
  116 #define ACPI_PM_TMR_BLK_ADDRESS_V1   (ACPI_PM1A_EVT_BLK_ADDRESS_V1 + 0x08)
  117 #define ACPI_GPE0_BLK_ADDRESS_V1     0xafe0
  118 #define ACPI_GPE0_BLK_LEN_V1         0x04
  119 
  120 /* Compatibility definitions for the default location (version 0). */
  121 #define ACPI_PM1A_EVT_BLK_ADDRESS    ACPI_PM1A_EVT_BLK_ADDRESS_V0
  122 #define ACPI_PM1A_CNT_BLK_ADDRESS    ACPI_PM1A_CNT_BLK_ADDRESS_V0
  123 #define ACPI_PM_TMR_BLK_ADDRESS      ACPI_PM_TMR_BLK_ADDRESS_V0
  124 #define ACPI_GPE0_BLK_ADDRESS        ACPI_GPE0_BLK_ADDRESS_V0
  125 #define ACPI_GPE0_BLK_LEN            ACPI_GPE0_BLK_LEN_V0
  126 
  127 
  128 #endif /* _IOREQ_H_ */
  129 
  130 /*
  131  * Local variables:
  132  * mode: C
  133  * c-file-style: "BSD"
  134  * c-basic-offset: 4
  135  * tab-width: 4
  136  * indent-tabs-mode: nil
  137  * End:
  138  */

Cache object: a82b6344dfc525c9292975fe7b04e1d2


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.