Clean up console fields in start_info structure. Add compat code for

older kernels so they can use the old start_info API.

Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
kfraser@localhost.localdomain committed 2006-08-15 15:50:36 +01:00
1 parent b61c3f8c66
commit 121ec85fcf
18 files changed
+135 -108

No files matched your search

@@ -1670,32 +1670,35 @@ void __init setup_arch(char **cmdline_p)
screen_info.orig_video_cols = 80;
screen_info.orig_video_ega_bx = 3;
screen_info.orig_video_points = 16;
if (xen_start_info->con_info_size >= sizeof(console_info_t)) {
const console_info_t *console_info = (void *)xen_start_info + xen_start_info->con_info_offs;
screen_info.orig_video_mode = console_info->txt_mode;
screen_info.orig_video_isVGA = console_info->video_type;
screen_info.orig_video_lines = console_info->video_height;
screen_info.orig_video_cols = console_info->video_width;
screen_info.orig_video_points = console_info->txt_points;
screen_info.lfb_width = console_info->video_width;
screen_info.lfb_height = console_info->video_height;
screen_info.lfb_depth = console_info->lfb_depth;
screen_info.lfb_base = console_info->lfb_base;
screen_info.lfb_size = console_info->lfb_size;
screen_info.lfb_linelength = console_info->lfb_linelen;
screen_info.red_size = console_info->red_size;
screen_info.red_pos = console_info->red_pos;
screen_info.green_size = console_info->green_size;
screen_info.green_pos = console_info->green_pos;
screen_info.blue_size = console_info->blue_size;
screen_info.blue_pos = console_info->blue_pos;
screen_info.rsvd_size = console_info->rsvd_size;
screen_info.rsvd_pos = console_info->rsvd_pos;
if (xen_start_info->console.dom0.info_size >=
sizeof(struct dom0_vga_console_info)) {
const struct dom0_vga_console_info *info =
(struct dom0_vga_console_info *)(
(char *)xen_start_info +
xen_start_info->console.dom0.info_off);
screen_info.orig_video_mode = info->txt_mode;
screen_info.orig_video_isVGA = info->video_type;
screen_info.orig_video_lines = info->video_height;
screen_info.orig_video_cols = info->video_width;
screen_info.orig_video_points = info->txt_points;
screen_info.lfb_width = info->video_width;
screen_info.lfb_height = info->video_height;
screen_info.lfb_depth = info->lfb_depth;
screen_info.lfb_base = info->lfb_base;
screen_info.lfb_size = info->lfb_size;
screen_info.lfb_linelength = info->lfb_linelen;
screen_info.red_size = info->red_size;
screen_info.red_pos = info->red_pos;
screen_info.green_size = info->green_size;
screen_info.green_pos = info->green_pos;
screen_info.blue_size = info->blue_size;
screen_info.blue_pos = info->blue_pos;
screen_info.rsvd_size = info->rsvd_size;
screen_info.rsvd_pos = info->rsvd_pos;
}
screen_info.orig_y = screen_info.orig_video_lines - 1;
xen_start_info->console_mfn = 0;
xen_start_info->console_evtchn = 0;
xen_start_info->console.domU.mfn = 0;
xen_start_info->console.domU.evtchn = 0;
} else
screen_info.orig_video_isVGA = 0;
@@ -648,32 +648,35 @@ void __init setup_arch(char **cmdline_p)
screen_info.orig_video_cols = 80;
screen_info.orig_video_ega_bx = 3;
screen_info.orig_video_points = 16;
if (xen_start_info->con_info_size >= sizeof(console_info_t)) {
const console_info_t *console_info = (void *)xen_start_info + xen_start_info->con_info_offs;
screen_info.orig_video_mode = console_info->txt_mode;
screen_info.orig_video_isVGA = console_info->video_type;
screen_info.orig_video_lines = console_info->video_height;
screen_info.orig_video_cols = console_info->video_width;
screen_info.orig_video_points = console_info->txt_points;
screen_info.lfb_width = console_info->video_width;
screen_info.lfb_height = console_info->video_height;
screen_info.lfb_depth = console_info->lfb_depth;
screen_info.lfb_base = console_info->lfb_base;
screen_info.lfb_size = console_info->lfb_size;
screen_info.lfb_linelength = console_info->lfb_linelen;
screen_info.red_size = console_info->red_size;
screen_info.red_pos = console_info->red_pos;
screen_info.green_size = console_info->green_size;
screen_info.green_pos = console_info->green_pos;
screen_info.blue_size = console_info->blue_size;
screen_info.blue_pos = console_info->blue_pos;
screen_info.rsvd_size = console_info->rsvd_size;
screen_info.rsvd_pos = console_info->rsvd_pos;
if (xen_start_info->console.dom0.info_size >=
sizeof(struct dom0_vga_console_info)) {
const struct dom0_vga_console_info *info =
(struct dom0_vga_console_info *)(
(char *)xen_start_info +
xen_start_info->console.dom0.info_off);
screen_info.orig_video_mode = info->txt_mode;
screen_info.orig_video_isVGA = info->video_type;
screen_info.orig_video_lines = info->video_height;
screen_info.orig_video_cols = info->video_width;
screen_info.orig_video_points = info->txt_points;
screen_info.lfb_width = info->video_width;
screen_info.lfb_height = info->video_height;
screen_info.lfb_depth = info->lfb_depth;
screen_info.lfb_base = info->lfb_base;
screen_info.lfb_size = info->lfb_size;
screen_info.lfb_linelength = info->lfb_linelen;
screen_info.red_size = info->red_size;
screen_info.red_pos = info->red_pos;
screen_info.green_size = info->green_size;
screen_info.green_pos = info->green_pos;
screen_info.blue_size = info->blue_size;
screen_info.blue_pos = info->blue_pos;
screen_info.rsvd_size = info->rsvd_size;
screen_info.rsvd_pos = info->rsvd_pos;
}
screen_info.orig_y = screen_info.orig_video_lines - 1;
xen_start_info->console_mfn = 0;
xen_start_info->console_evtchn = 0;
xen_start_info->console.domU.mfn = 0;
xen_start_info->console.domU.evtchn = 0;
} else
screen_info.orig_video_isVGA = 0;
+1 -1
View File
@@ -13,7 +13,7 @@ config XEN
if XEN
config XEN_INTERFACE_VERSION
hex
default 0x00030202
default 0x00030203
menu "XEN"
@@ -52,13 +52,13 @@ static int xencons_irq;
static inline struct xencons_interface *xencons_interface(void)
{
return mfn_to_virt(xen_start_info->console_mfn);
return mfn_to_virt(xen_start_info->console.domU.mfn);
}
static inline void notify_daemon(void)
{
/* Use evtchn: this is called early, before irq is set up. */
notify_remote_via_evtchn(xen_start_info->console_evtchn);
notify_remote_via_evtchn(xen_start_info->console.domU.evtchn);
}
int xencons_ring_send(const char *data, unsigned len)
@@ -116,11 +116,11 @@ int xencons_ring_init(void)
unbind_from_irqhandler(xencons_irq, NULL);
xencons_irq = 0;
if (!xen_start_info->console_evtchn)
if (!xen_start_info->console.domU.evtchn)
return 0;
err = bind_evtchn_to_irqhandler(
xen_start_info->console_evtchn,
xen_start_info->console.domU.evtchn,
handle_input, 0, "xencons", NULL);
if (err <= 0) {
printk(KERN_ERR "XEN console request irq failed %i\n", err);
@@ -106,7 +106,8 @@ static void pre_suspend(void)
clear_fixmap(FIX_SHARED_INFO);
xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn);
xen_start_info->console_mfn = mfn_to_pfn(xen_start_info->console_mfn);
xen_start_info->console.domU.mfn =
mfn_to_pfn(xen_start_info->console.domU.mfn);
}
static void post_suspend(void)
+2 -2
View File
@@ -288,8 +288,8 @@ xc_linux_restore(int xc_handle, int io_fd, uint32_t dom,
start_info->flags = 0;
*store_mfn = page_array[start_info->store_mfn];
start_info->store_evtchn = store_evtchn;
*console_mfn = page_array[start_info->console_mfn];
start_info->console_evtchn = console_evtchn;
*console_mfn = page_array[start_info->console.domU.mfn];
start_info->console.domU.evtchn = console_evtchn;
munmap(start_info, PAGE_SIZE);
/*
+2 -2
View File
@@ -308,8 +308,8 @@ static unsigned long create_start_info(start_info_t *si,
si->shared_info = eomem - (PAGE_SIZE * 1);
si->store_mfn = si->nr_pages - 2;
si->store_evtchn = store_evtchn;
si->console_mfn = si->nr_pages - 3;
si->console_evtchn = console_evtchn;
si->console.domU.mfn = si->nr_pages - 3;
si->console.domU.evtchn = console_evtchn;
si_addr = eomem - (PAGE_SIZE * 4);
return si_addr;
+4 -4
View File
@@ -569,8 +569,8 @@ static int setup_guest(int xc_handle,
start_info->flags = flags;
start_info->store_mfn = nr_pages - 2;
start_info->store_evtchn = store_evtchn;
start_info->console_mfn = nr_pages - 1;
start_info->console_evtchn = console_evtchn;
start_info->console.domU.mfn = nr_pages - 1;
start_info->console.domU.evtchn = console_evtchn;
start_info->nr_pages = nr_pages; // FIXME?: nr_pages - 2 ????
bp = (struct xen_ia64_boot_param *)(start_info + 1);
@@ -1047,8 +1047,8 @@ static int setup_guest(int xc_handle,
start_info->mfn_list = vphysmap_start;
start_info->store_mfn = guest_store_mfn;
start_info->store_evtchn = store_evtchn;
start_info->console_mfn = guest_console_mfn;
start_info->console_evtchn = console_evtchn;
start_info->console.domU.mfn = guest_console_mfn;
start_info->console.domU.evtchn = console_evtchn;
if ( initrd->len != 0 )
{
start_info->mod_start = vinitrd_start;
+3 -2
View File
@@ -690,8 +690,9 @@ int xc_linux_restore(int xc_handle, int io_fd,
start_info->flags = 0;
*store_mfn = start_info->store_mfn = p2m[start_info->store_mfn];
start_info->store_evtchn = store_evtchn;
*console_mfn = start_info->console_mfn = p2m[start_info->console_mfn];
start_info->console_evtchn = console_evtchn;
start_info->console.domU.mfn = p2m[start_info->console.domU.mfn];
start_info->console.domU.evtchn = console_evtchn;
*console_mfn = start_info->console.domU.mfn;
munmap(start_info, PAGE_SIZE);
/* Uncanonicalise each GDT frame number. */
+5 -3
View File
@@ -335,7 +335,9 @@ int construct_dom0(struct domain *d,
vphysmap_start = round_pgup(vinitrd_end);
vphysmap_end = vphysmap_start + (nr_pages * sizeof(unsigned long));
vstartinfo_start = round_pgup(vphysmap_end);
vstartinfo_end = vstartinfo_start + sizeof(start_info_t) + sizeof(console_info_t);
vstartinfo_end = (vstartinfo_start +
sizeof(struct start_info) +
sizeof(struct dom0_vga_console_info));
vpt_start = round_pgup(vstartinfo_end);
for ( nr_pt_pages = 2; ; nr_pt_pages++ )
{
@@ -773,8 +775,8 @@ int construct_dom0(struct domain *d,
if ( fill_console_start_info((void *)(si + 1)) )
{
si->con_info_offs = sizeof(start_info_t);
si->con_info_size = sizeof(console_info_t);
si->console.dom0.info_off = sizeof(struct start_info);
si->console.dom0.info_size = sizeof(struct dom0_vga_console_info);
}
/* Reinstate the caller's page tables. */
+1 -1
View File
@@ -154,7 +154,7 @@ static void putchar_console(int c)
}
}
int fill_console_start_info(console_info_t *ci)
int fill_console_start_info(struct dom0_vga_console_info *ci)
{
memset(ci, 0, sizeof(*ci));
+6
View File
@@ -7,8 +7,14 @@
#ifndef __HYPERVISOR_IF_IA64_H__
#define __HYPERVISOR_IF_IA64_H__
/* Structural guest handles introduced in 0x00030201. */
#if __XEN_INTERFACE_VERSION__ >= 0x00030201
#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
typedef struct { type *p; } __guest_handle_ ## name
#else
#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
typedef type * __guest_handle_ ## name
#endif
#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name
-5
View File
@@ -21,11 +21,6 @@
#ifndef __XEN_PUBLIC_ARCH_PPC_64_H__
#define __XEN_PUBLIC_ARCH_PPC_64_H__
#if !(defined(__XEN__) || defined(__XEN_TOOLS__))
/* not sure how this is supposed to get asserted */
#define __XEN_INTERFACE_VERSION__ 0x00030202
#endif
#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
typedef struct { \
int __pad[(sizeof (long long) - sizeof (void *)) / sizeof (int)]; \
+6
View File
@@ -9,8 +9,14 @@
#ifndef __XEN_PUBLIC_ARCH_X86_32_H__
#define __XEN_PUBLIC_ARCH_X86_32_H__
/* Structural guest handles introduced in 0x00030201. */
#if __XEN_INTERFACE_VERSION__ >= 0x00030201
#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
typedef struct { type *p; } __guest_handle_ ## name
#else
#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
typedef type * __guest_handle_ ## name
#endif
#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name
+6
View File
@@ -9,8 +9,14 @@
#ifndef __XEN_PUBLIC_ARCH_X86_64_H__
#define __XEN_PUBLIC_ARCH_X86_64_H__
/* Structural guest handles introduced in 0x00030201. */
#if __XEN_INTERFACE_VERSION__ >= 0x00030201
#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
typedef struct { type *p; } __guest_handle_ ## name
#else
#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
typedef type * __guest_handle_ ## name
#endif
#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name
+1 -22
View File
@@ -9,7 +9,7 @@
#ifndef __XEN_PUBLIC_XEN_COMPAT_H__
#define __XEN_PUBLIC_XEN_COMPAT_H__
#define __XEN_LATEST_INTERFACE_VERSION__ 0x00030202
#define __XEN_LATEST_INTERFACE_VERSION__ 0x00030203
#if defined(__XEN__) || defined(__XEN_TOOLS__)
/* Xen is built with matching headers and implements the latest interface. */
@@ -23,25 +23,4 @@
#error "These header files do not support the requested interface version."
#endif
/* New sched_op hypercall introduced in 0x00030101. */
#if __XEN_INTERFACE_VERSION__ < 0x00030101
#undef __HYPERVISOR_sched_op
#define __HYPERVISOR_sched_op __HYPERVISOR_sched_op_compat
#endif
/* Structural guest handles introduced in 0x00030201. */
#if __XEN_INTERFACE_VERSION__ < 0x00030201
#undef __DEFINE_XEN_GUEST_HANDLE
#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
typedef type * __guest_handle_ ## name
#endif
/* New event-channel and physdev hypercalls introduced in 0x00030202. */
#if __XEN_INTERFACE_VERSION__ < 0x00030202
#undef __HYPERVISOR_event_channel_op
#define __HYPERVISOR_event_channel_op __HYPERVISOR_event_channel_op_compat
#undef __HYPERVISOR_physdev_op
#define __HYPERVISOR_physdev_op __HYPERVISOR_physdev_op_compat
#endif
#endif /* __XEN_PUBLIC_XEN_COMPAT_H__ */
+37 -12
View File
@@ -9,6 +9,8 @@
#ifndef __XEN_PUBLIC_XEN_H__
#define __XEN_PUBLIC_XEN_H__
#include "xen-compat.h"
#if defined(__i386__)
#include "arch-x86_32.h"
#elif defined(__x86_64__)
@@ -78,6 +80,24 @@
#define __HYPERVISOR_arch_6 54
#define __HYPERVISOR_arch_7 55
/*
* HYPERCALL COMPATIBILITY.
*/
/* New sched_op hypercall introduced in 0x00030101. */
#if __XEN_INTERFACE_VERSION__ < 0x00030101
#undef __HYPERVISOR_sched_op
#define __HYPERVISOR_sched_op __HYPERVISOR_sched_op_compat
#endif
/* New event-channel and physdev hypercalls introduced in 0x00030202. */
#if __XEN_INTERFACE_VERSION__ < 0x00030202
#undef __HYPERVISOR_event_channel_op
#define __HYPERVISOR_event_channel_op __HYPERVISOR_event_channel_op_compat
#undef __HYPERVISOR_physdev_op
#define __HYPERVISOR_physdev_op __HYPERVISOR_physdev_op_compat
#endif
/*
* VIRTUAL INTERRUPTS
*
@@ -467,14 +487,15 @@ struct start_info {
xen_pfn_t store_mfn; /* MACHINE page number of shared page. */
uint32_t store_evtchn; /* Event channel for store communication. */
union {
xen_pfn_t console_mfn; /* MACHINE page number of console page. */
uint32_t con_info_offs; /* Dom0 only: offset of console_info from
start_info */
};
union {
uint32_t console_evtchn;/* Event channel for console messages. */
uint32_t con_info_size; /* Dom0 only: size of console_info */
};
struct {
xen_pfn_t mfn; /* MACHINE page number of console page. */
uint32_t evtchn; /* Event channel for console page. */
} domU;
struct {
uint32_t info_off; /* Offset of console_info struct. */
uint32_t info_size; /* Size of console_info struct from start.*/
} dom0;
} console;
/* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME). */
unsigned long pt_base; /* VIRTUAL address of page directory. */
unsigned long nr_pt_frames; /* Number of bootstrap p.t. frames. */
@@ -485,11 +506,17 @@ struct start_info {
};
typedef struct start_info start_info_t;
/* New console union for dom0 introduced in 0x00030203. */
#if __XEN_INTERFACE_VERSION__ < 0x00030203
#define console_mfn console.domU.mfn
#define console_evtchn console.domU.evtchn
#endif
/* These flags are passed in the 'flags' field of start_info_t. */
#define SIF_PRIVILEGED (1<<0) /* Is the domain privileged? */
#define SIF_INITDOMAIN (1<<1) /* Is this the initial control domain? */
typedef struct console_info {
typedef struct dom0_vga_console_info {
uint8_t video_type;
uint8_t txt_points;
uint16_t txt_mode;
@@ -509,7 +536,7 @@ typedef struct console_info {
uint8_t blue_size;
uint8_t rsvd_pos;
uint8_t rsvd_size;
} console_info_t;
} dom0_vga_console_info_t;
typedef uint64_t cpumap_t;
@@ -526,8 +553,6 @@ typedef uint8_t xen_domain_handle_t[16];
#endif /* !__ASSEMBLY__ */
#include "xen-compat.h"
#endif /* __XEN_PUBLIC_XEN_H__ */
/*
+1 -1
View File
@@ -18,7 +18,7 @@ long read_console_ring(XEN_GUEST_HANDLE(char), u32 *, int);
void init_console(void);
void console_endboot(void);
int fill_console_start_info(console_info_t *);
int fill_console_start_info(struct dom0_vga_console_info *);
void console_force_unlock(void);
void console_force_lock(void);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.