diff options
Diffstat (limited to 'tools/libxc/xc_ia64_stubs.c')
-rw-r--r-- | tools/libxc/xc_ia64_stubs.c | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/tools/libxc/xc_ia64_stubs.c b/tools/libxc/xc_ia64_stubs.c index 22c6bb953f..335fd5ec71 100644 --- a/tools/libxc/xc_ia64_stubs.c +++ b/tools/libxc/xc_ia64_stubs.c @@ -22,7 +22,7 @@ unsigned long xc_ia64_fpsr_default(void) return FPSR_DEFAULT; } -int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters, +int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters, uint32_t max_factor, uint32_t flags /* XCFLAGS_xxx */, int (*suspend)(int domid)) { @@ -50,8 +50,8 @@ xc_plan9_build(int xc_handle, } int xc_ia64_get_pfn_list(int xc_handle, - uint32_t domid, - unsigned long *pfn_buf, + uint32_t domid, + unsigned long *pfn_buf, unsigned int start_page, unsigned int nr_pages) { @@ -65,16 +65,16 @@ int xc_ia64_get_pfn_list(int xc_handle, op.u.getmemlist.buffer = pfn_buf; if ( (max_pfns != -1UL) - && mlock(pfn_buf, nr_pages * sizeof(unsigned long)) != 0 ) + && mlock(pfn_buf, nr_pages * sizeof(unsigned long)) != 0 ) { PERROR("Could not lock pfn list buffer"); return -1; - } + } ret = do_dom0_op(xc_handle, &op); if (max_pfns != -1UL) - (void)munlock(pfn_buf, nr_pages * sizeof(unsigned long)); + (void)munlock(pfn_buf, nr_pages * sizeof(unsigned long)); return (ret < 0) ? -1 : op.u.getmemlist.num_pfns; } @@ -84,7 +84,7 @@ long xc_get_max_pages(int xc_handle, uint32_t domid) dom0_op_t op; op.cmd = DOM0_GETDOMAININFO; op.u.getdomaininfo.domain = (domid_t)domid; - return (do_dom0_op(xc_handle, &op) < 0) ? + return (do_dom0_op(xc_handle, &op) < 0) ? -1 : op.u.getdomaininfo.max_pages; } @@ -92,7 +92,7 @@ int xc_ia64_copy_to_domain_pages(int xc_handle, uint32_t domid, void* src_page, unsigned long dst_pfn, int nr_pages) { // N.B. gva should be page aligned - + unsigned long *page_array = NULL; int i; @@ -107,13 +107,13 @@ int xc_ia64_copy_to_domain_pages(int xc_handle, uint32_t domid, } for ( i=0; i< nr_pages; i++ ){ - if (xc_copy_to_domain_page(xc_handle, domid, page_array[i], - src_page + (i << PAGE_SHIFT))) - goto error_out; + if (xc_copy_to_domain_page(xc_handle, domid, page_array[i], + src_page + (i << PAGE_SHIFT))) + goto error_out; } free(page_array); return 0; - + error_out: free(page_array); return -1; @@ -123,8 +123,8 @@ error_out: #define HOB_SIGNATURE 0x3436474953424f48 // "HOBSIG64" #define GFW_HOB_START ((4UL<<30)-(14UL<<20)) //4G -14M #define GFW_HOB_SIZE (1UL<<20) //1M -#define MEM_G (1UL << 30) -#define MEM_M (1UL << 20) +#define MEM_G (1UL << 30) +#define MEM_M (1UL << 20) typedef struct { unsigned long signature; @@ -136,7 +136,7 @@ typedef struct { * INFO HOB is the first data data in one HOB list * it contains the control information of the HOB list */ -typedef struct { +typedef struct { HOB_GENERIC_HEADER header; unsigned long length; // current length of hob unsigned long cur_pos; // current poisiton of hob @@ -216,7 +216,7 @@ hob_init( void *buffer ,unsigned long buf_size) // buffer too small return -1; } - + phit = (HOB_INFO*)buffer; phit->header.signature = HOB_SIGNATURE; phit->header.type = HOB_TYPE_INFO; @@ -224,7 +224,7 @@ hob_init( void *buffer ,unsigned long buf_size) phit->length = sizeof(HOB_INFO) + sizeof(HOB_GENERIC_HEADER); phit->cur_pos = 0; phit->buf_size = buf_size; - + terminal = (HOB_GENERIC_HEADER*) (buffer + sizeof(HOB_INFO)); terminal->signature= HOB_SIGNATURE; terminal->type = HOB_TYPE_TERMINAL; @@ -235,7 +235,7 @@ hob_init( void *buffer ,unsigned long buf_size) /* * Add a new HOB to the HOB List. - * + * * hob_start - start address of hob buffer * type - type of the hob to be added * data - data of the hob to be added @@ -250,8 +250,8 @@ hob_add( ) { HOB_INFO *phit; - HOB_GENERIC_HEADER *newhob,*tail; - + HOB_GENERIC_HEADER *newhob,*tail; + phit = (HOB_INFO*)hob_start; if (phit->length + data_size > phit->buf_size){ @@ -259,7 +259,7 @@ hob_add( return -1; } - //append new HOB + //append new HOB newhob = (HOB_GENERIC_HEADER*) (hob_start + phit->length - sizeof(HOB_GENERIC_HEADER)); newhob->signature = HOB_SIGNATURE; @@ -267,7 +267,7 @@ hob_add( newhob->length = data_size + sizeof(HOB_GENERIC_HEADER); memcpy((void*)newhob + sizeof(HOB_GENERIC_HEADER), data, data_size); - // append terminal HOB + // append terminal HOB tail = (HOB_GENERIC_HEADER*) ( hob_start + phit->length + data_size); tail->signature = HOB_SIGNATURE; tail->type = HOB_TYPE_TERMINAL; @@ -281,9 +281,9 @@ hob_add( } int get_hob_size(void* hob_buf){ - + HOB_INFO *phit = (HOB_INFO*)hob_buf; - + if (phit->header.signature != HOB_SIGNATURE){ PERROR("xc_get_hob_size:Incorrect signature"); return -1; @@ -293,30 +293,30 @@ int get_hob_size(void* hob_buf){ int build_hob (void* hob_buf, unsigned long hob_buf_size, unsigned long dom_mem_size) -{ - //Init HOB List +{ + //Init HOB List if (hob_init (hob_buf, hob_buf_size)<0){ PERROR("buffer too small"); goto err_out; } - + if ( add_mem_hob( hob_buf,dom_mem_size) < 0){ PERROR("Add memory hob failed, buffer too small"); goto err_out; } - + if ( add_pal_hob( hob_buf ) < 0 ){ PERROR("Add PAL hob failed, buffer too small"); goto err_out; } - + return 0; err_out: - return -1; + return -1; } -static int +static int load_hob(int xc_handle, uint32_t dom, void *hob_buf) { // hob_buf should be page aligned @@ -334,22 +334,22 @@ load_hob(int xc_handle, uint32_t dom, void *hob_buf) } nr_pages = (hob_size + PAGE_SIZE -1) >> PAGE_SHIFT; - + return xc_ia64_copy_to_domain_pages(xc_handle, dom, hob_buf, GFW_HOB_START, nr_pages ); } #define MIN(x, y) ((x) < (y)) ? (x) : (y) -static int +static int add_mem_hob(void* hob_buf, unsigned long dom_mem_size){ hob_mem_t memhob; // less than 3G memhob.start = 0; memhob.size = MIN(dom_mem_size, 0xC0000000); - + if (hob_add(hob_buf, HOB_TYPE_MEM, &memhob, sizeof(memhob)) < 0){ - return -1; + return -1; } if (dom_mem_size > 0xC0000000) { @@ -373,29 +373,29 @@ unsigned char config_pal_mem_attrib[8] = { }; unsigned char config_pal_cache_info[152] = { 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 6, 4, 6, 7, 255, 1, 0, 1, 0, 64, 0, 0, 12, 12, + 6, 4, 6, 7, 255, 1, 0, 1, 0, 64, 0, 0, 12, 12, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 6, 7, 0, 1, - 0, 1, 0, 64, 0, 0, 12, 12, 49, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 6, 8, 7, 7, 255, 7, 0, 11, 0, 0, 16, 0, - 12, 17, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 7, + 0, 1, 0, 64, 0, 0, 12, 12, 49, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 6, 8, 7, 7, 255, 7, 0, 11, 0, 0, 16, 0, + 12, 17, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 7, 7, 7, 5, 9, 11, 0, 0, 4, 0, 12, 15, 49, 0, 254, 255, - 255, 255, 255, 255, 255, 255, 2, 8, 7, 7, 7, 5, 9, - 11, 0, 0, 4, 0, 12, 15, 49, 0, 0, 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 255, 255, 2, 8, 7, 7, 7, 5, 9, + 11, 0, 0, 4, 0, 12, 15, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 12, 7, 7, 7, 14, 1, 3, 0, 0, 192, 0, 12, 20, 49, 0 }; unsigned char config_pal_cache_prot_info[200] = { - 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, 16, 8, 0, 76, 12, 64, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 8, 0, 16, 4, 0, 76, 44, 68, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, - 0, 16, 8, 0, 81, 44, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 0, 16, 4, 0, 76, 44, 68, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, + 0, 16, 8, 0, 81, 44, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, - 112, 12, 0, 79, 124, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 254, 255, 255, 255, 255, 255, 255, 255, + 112, 12, 0, 79, 124, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 254, 255, 255, 255, 255, 255, 255, 255, 32, 0, 112, 12, 0, 79, 124, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 160, - 12, 0, 84, 124, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 160, + 12, 0, 84, 124, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; unsigned char config_pal_debug_info[16] = { @@ -408,37 +408,37 @@ unsigned char config_pal_freq_base[8] = { 109, 219, 182, 13, 0, 0, 0, 0 }; unsigned char config_pal_freq_ratios[24] = { - 11, 1, 0, 0, 77, 7, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 4, + 11, 1, 0, 0, 77, 7, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 7, 0, 0, 0 }; unsigned char config_pal_halt_info[64] = { - 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; unsigned char config_pal_perf_mon_info[136] = { - 12, 47, 18, 8, 0, 0, 0, 0, 241, 255, 0, 0, 255, 7, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 241, 255, 0, 0, 223, 0, 255, 255, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 12, 47, 18, 8, 0, 0, 0, 0, 241, 255, 0, 0, 255, 7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 241, 255, 0, 0, 223, 0, 255, 255, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; unsigned char config_pal_proc_get_features[104] = { - 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 64, 6, 64, 49, 0, 0, 0, 0, 64, 6, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, - 231, 0, 0, 0, 0, 0, 0, 0, 228, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 64, 6, 64, 49, 0, 0, 0, 0, 64, 6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, + 231, 0, 0, 0, 0, 0, 0, 0, 228, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; unsigned char config_pal_ptce_info[24] = { - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; unsigned char config_pal_register_info[64] = { @@ -473,7 +473,7 @@ unsigned char config_pal_vm_page_size[16] = { typedef struct{ hob_type_t type; void* data; - unsigned long size; + unsigned long size; }hob_batch_t; hob_batch_t hob_batch[]={ @@ -552,13 +552,13 @@ hob_batch_t hob_batch[]={ { HOB_TYPE_PAL_VM_PAGE_SIZE, &config_pal_vm_page_size, sizeof(config_pal_vm_page_size) - }, + }, }; static int add_pal_hob(void* hob_buf){ int i; for (i=0; i<sizeof(hob_batch)/sizeof(hob_batch_t); i++){ - if (hob_add(hob_buf, hob_batch[i].type, + if (hob_add(hob_buf, hob_batch[i].type, hob_batch[i].data, hob_batch[i].size)<0) return -1; @@ -579,17 +579,17 @@ static int setup_guest( int xc_handle, // FIXME: initialize pfn list for a temp hack if (xc_ia64_get_pfn_list(xc_handle, dom, NULL, -1, -1) == -1) { - PERROR("Could not allocate continuous memory"); - goto error_out; + PERROR("Could not allocate continuous memory"); + goto error_out; } - + if ((image_size > 12 * MEM_M) || (image_size & (PAGE_SIZE - 1))) { PERROR("Guest firmware size is incorrect [%ld]?", image_size); return -1; } /* Load guest firmware */ - if( xc_ia64_copy_to_domain_pages( xc_handle, dom, + if( xc_ia64_copy_to_domain_pages( xc_handle, dom, image, 4*MEM_G-image_size, image_size>>PAGE_SHIFT)) { PERROR("Could not load guest firmware into domain"); goto error_out; @@ -610,9 +610,9 @@ static int setup_guest( int xc_handle, *store_mfn = page_array[1]; if ((sp = (shared_iopage_t *) xc_map_foreign_range( - xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, - page_array[0])) == 0) - goto error_out; + xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, + page_array[0])) == 0) + goto error_out; memset(sp, 0, PAGE_SIZE); for (i = 0; i < vcpus; i++) { @@ -665,14 +665,14 @@ int xc_hvm_build(int xc_handle, image_size = (image_size + PAGE_SIZE - 1) & PAGE_MASK; - if ( mlock(&st_ctxt, sizeof(st_ctxt) ) ){ + if ( mlock(&st_ctxt, sizeof(st_ctxt) ) ){ PERROR("Unable to mlock ctxt"); return 1; } op.cmd = DOM0_GETDOMAININFO; op.u.getdomaininfo.domain = (domid_t)domid; - if ( (do_dom0_op(xc_handle, &op) < 0) || + if ( (do_dom0_op(xc_handle, &op) < 0) || ((uint16_t)op.u.getdomaininfo.domain != domid) ) { PERROR("Could not get info on domain"); goto error_out; |