ia64/xen-unstable

view xen/include/asm-x86/hvm/io.h @ 19848:5839491bbf20

[IA64] replace MAX_VCPUS with d->max_vcpus where necessary.

don't use MAX_VCPUS, and use vcpu::max_vcpus.
The changeset of 2f9e1348aa98 introduced max_vcpus to allow more vcpus
per guest. This patch is ia64 counter part.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Mon Jun 29 11:26:05 2009 +0900 (2009-06-29)
parents ad55c06c9bbc
children
line source
1 /*
2 * io.h: HVM IO support
3 *
4 * Copyright (c) 2004, Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17 * Place - Suite 330, Boston, MA 02111-1307 USA.
18 */
20 #ifndef __ASM_X86_HVM_IO_H__
21 #define __ASM_X86_HVM_IO_H__
23 #include <asm/hvm/vpic.h>
24 #include <asm/hvm/vioapic.h>
25 #include <public/hvm/ioreq.h>
26 #include <public/event_channel.h>
28 #define MAX_IO_HANDLER 16
30 #define HVM_PORTIO 0
31 #define HVM_BUFFERED_IO 2
33 typedef int (*hvm_mmio_read_t)(struct vcpu *v,
34 unsigned long addr,
35 unsigned long length,
36 unsigned long *val);
37 typedef int (*hvm_mmio_write_t)(struct vcpu *v,
38 unsigned long addr,
39 unsigned long length,
40 unsigned long val);
41 typedef int (*hvm_mmio_check_t)(struct vcpu *v, unsigned long addr);
43 typedef int (*portio_action_t)(
44 int dir, uint32_t port, uint32_t bytes, uint32_t *val);
45 typedef int (*mmio_action_t)(ioreq_t *);
46 struct io_handler {
47 int type;
48 unsigned long addr;
49 unsigned long size;
50 union {
51 portio_action_t portio;
52 mmio_action_t mmio;
53 } action;
54 };
56 struct hvm_io_handler {
57 int num_slot;
58 struct io_handler hdl_list[MAX_IO_HANDLER];
59 };
61 struct hvm_mmio_handler {
62 hvm_mmio_check_t check_handler;
63 hvm_mmio_read_t read_handler;
64 hvm_mmio_write_t write_handler;
65 };
67 int hvm_io_intercept(ioreq_t *p, int type);
68 void register_io_handler(
69 struct domain *d, unsigned long addr, unsigned long size,
70 void *action, int type);
72 static inline int hvm_portio_intercept(ioreq_t *p)
73 {
74 return hvm_io_intercept(p, HVM_PORTIO);
75 }
77 static inline int hvm_buffered_io_intercept(ioreq_t *p)
78 {
79 return hvm_io_intercept(p, HVM_BUFFERED_IO);
80 }
82 int hvm_mmio_intercept(ioreq_t *p);
83 int hvm_buffered_io_send(ioreq_t *p);
85 static inline void register_portio_handler(
86 struct domain *d, unsigned long addr,
87 unsigned long size, portio_action_t action)
88 {
89 register_io_handler(d, addr, size, action, HVM_PORTIO);
90 }
92 static inline void register_buffered_io_handler(
93 struct domain *d, unsigned long addr,
94 unsigned long size, mmio_action_t action)
95 {
96 register_io_handler(d, addr, size, action, HVM_BUFFERED_IO);
97 }
99 void send_timeoffset_req(unsigned long timeoff);
100 void send_invalidate_req(void);
101 int handle_mmio(void);
102 int handle_mmio_with_translation(unsigned long gva, unsigned long gpfn);
103 void hvm_interrupt_post(struct vcpu *v, int vector, int type);
104 void hvm_io_assist(void);
105 void hvm_dpci_eoi(struct domain *d, unsigned int guest_irq,
106 union vioapic_redir_entry *ent);
108 struct hvm_hw_stdvga {
109 uint8_t sr_index;
110 uint8_t sr[8];
111 uint8_t gr_index;
112 uint8_t gr[9];
113 bool_t stdvga;
114 bool_t cache;
115 uint32_t latch;
116 struct page_info *vram_page[64]; /* shadow of 0xa0000-0xaffff */
117 spinlock_t lock;
118 };
120 void stdvga_init(struct domain *d);
121 void stdvga_deinit(struct domain *d);
123 extern void hvm_dpci_msi_eoi(struct domain *d, int vector);
124 #endif /* __ASM_X86_HVM_IO_H__ */