--- linux-2.6-xen-sparse/include/xen/protocols.h | 57 +++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) Index: build-32-unstable-13495/linux-2.6-xen-sparse/include/xen/protocols.h =================================================================== --- /dev/null +++ build-32-unstable-13495/linux-2.6-xen-sparse/include/xen/protocols.h @@ -0,0 +1,57 @@ +#ifndef __XEN_PROTOCOLS_H__ +#define __XEN_PROTOCOLS_H__ + +enum xen_io_proto_id { + /* For all front/backends */ + XEN_IO_PROTO_ABI_X86_32 = 1, + XEN_IO_PROTO_ABI_X86_64 = 2, + XEN_IO_PROTO_ABI_IA64 = 3, + XEN_IO_PROTO_ABI_POWERPC64 = 4, + + /* framebuffer via grant tables on little endian machines */ + XEN_IO_PROTO_FB_LE_GRANT = 5, +}; + +static const char *xen_io_proto_names[] = { + [ XEN_IO_PROTO_ABI_X86_32 ] = "x86_32-abi", + [ XEN_IO_PROTO_ABI_X86_64 ] = "x86_64-abi", + [ XEN_IO_PROTO_ABI_IA64 ] = "ia64-abi", + [ XEN_IO_PROTO_ABI_POWERPC64 ] = "powerpc64-abi", + + [ XEN_IO_PROTO_FB_LE_GRANT ] = "fb-le-grant", +}; +#define XEN_IO_PROTO_COUNT (sizeof(xen_io_proto_names)/sizeof(xen_io_proto_names[0])) + +static enum xen_io_proto_id xen_io_proto_name2id(const char *name) +{ + int id; + + for (id = 0; id < XEN_IO_PROTO_COUNT; id++) { + if (!xen_io_proto_names[id]) + continue; + if (0 != strcmp(name, xen_io_proto_names[id])) + continue; + return i; + } +} + +static const char *xen_io_proto_id2name(enum xen_io_proto_id id) +{ + if (id >= XEN_IO_PROTO_COUNT) + return NULL; + return xen_io_proto_names[id]; +} + +#if defined(__i386__) +# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32 +#elif defined(__x86_64__) +# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_64 +#elif defined(__ia64__) +# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_IA64 +#elif defined(__powerpc64__) +# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_POWERPC64 +#else +# error arch fixup needed here +#endif + +#endif