From: dietmar.hahn@fujitsu-siemens.com Date: Tue, 18 Nov 2008 09:55:51 +0000 (+0100) Subject: [IA64] Remove the useless big endian stuff. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14044 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6e3fe157f023a9163a3fb33930a5d9ccc8b7d6ac;p=xen.git [IA64] Remove the useless big endian stuff. This patch removes all the useless big endian stuff from the mini-os. Before there was an effort to support big endian for PV-guest. But the big endian support was never gotten into the common parts of the mini-os so it makes no sense to have this only in the ia64 specific sources. And as there is no open source big endian os and porting our BS2000 os to ia64 was stopped, nobody wants that stuff in the common minos. So this looks ugly then and remove the big endian stuff. Signed-off-by: Dietmar Hahn --- diff --git a/extras/mini-os/arch/ia64/arch.mk b/extras/mini-os/arch/ia64/arch.mk index 12168713ee..e6a17d3eb7 100644 --- a/extras/mini-os/arch/ia64/arch.mk +++ b/extras/mini-os/arch/ia64/arch.mk @@ -1,5 +1,3 @@ -# Build for Big Endian? -BIGENDIAN ?= n ARCH_CFLAGS := -mfixed-range=f2-f5,f12-f15,f32-f127 -mconstant-gp ARCH_CFLAGS += -O2 @@ -9,12 +7,3 @@ ARCH_ASFLAGS += -fno-builtin -fno-common -fno-strict-aliasing -mconstant-gp ARCH_LDFLAGS = -warn-common -# Next lines are for big endian code ! -ifeq ($(BIGENDIAN),y) -ARCH_CFLAGS += -mbig-endian -Wa,-mbe -Wa,-mlp64 -ARCH_CFLAGS += -DBIG_ENDIAN -ARCH_ASFLAGS += -Wa,-mbe -ARCH_ASFLAGS += -DBIG_ENDIAN -ARCH_LDFLAGS = -EB -d -endif - diff --git a/extras/mini-os/arch/ia64/common.c b/extras/mini-os/arch/ia64/common.c index c65f0a0d07..45b770326c 100644 --- a/extras/mini-os/arch/ia64/common.c +++ b/extras/mini-os/arch/ia64/common.c @@ -116,8 +116,8 @@ registerCallback(void) { struct callback_register event = { - .type = SWAP(CALLBACKTYPE_event), - .address = SWAP((unsigned long)&hypervisor_callback), + .type = CALLBACKTYPE_event, + .address = (unsigned long)&hypervisor_callback, }; HYPERVISOR_callback_op(CALLBACKOP_register, &event); } @@ -126,46 +126,44 @@ static void init_start_info(start_info_t* xen_start_info) { /* Make a copy of the start_info structure */ - start_info.nr_pages = SWAP(xen_start_info->nr_pages); - start_info.shared_info = SWAP(xen_start_info->shared_info); - start_info.flags = SWAP(xen_start_info->flags); - start_info.store_mfn = SWAP(xen_start_info->store_mfn); - start_info.store_evtchn = SWAP(xen_start_info->store_evtchn); - start_info.console.domU.mfn = SWAP(xen_start_info->console.domU.mfn); + start_info.nr_pages = xen_start_info->nr_pages; + start_info.shared_info = xen_start_info->shared_info; + start_info.flags = xen_start_info->flags; + start_info.store_mfn = xen_start_info->store_mfn; + start_info.store_evtchn = xen_start_info->store_evtchn; + start_info.console.domU.mfn = xen_start_info->console.domU.mfn; start_info.console.domU.evtchn = - SWAP(xen_start_info->console.domU.evtchn); - start_info.pt_base = SWAP(xen_start_info->pt_base); - start_info.nr_pt_frames = SWAP(xen_start_info->nr_pt_frames); - start_info.mfn_list = SWAP(xen_start_info->mfn_list); - start_info.mod_start = SWAP(xen_start_info->mod_start); - start_info.mod_len = SWAP(xen_start_info->mod_len); + xen_start_info->console.domU.evtchn; + start_info.pt_base = xen_start_info->pt_base; + start_info.nr_pt_frames = xen_start_info->nr_pt_frames; + start_info.mfn_list = xen_start_info->mfn_list; + start_info.mod_start = xen_start_info->mod_start; + start_info.mod_len = xen_start_info->mod_len; } static void init_boot_params(void) { - ia64BootParamG.command_line = SWAP(ia64_boot_paramP->command_line); - ia64BootParamG.efi_systab = SWAP(ia64_boot_paramP->efi_systab); - ia64BootParamG.efi_memmap = SWAP(ia64_boot_paramP->efi_memmap); - ia64BootParamG.efi_memmap_size = - SWAP(ia64_boot_paramP->efi_memmap_size); - ia64BootParamG.efi_memdesc_size = - SWAP(ia64_boot_paramP->efi_memdesc_size); + ia64BootParamG.command_line = ia64_boot_paramP->command_line; + ia64BootParamG.efi_systab = ia64_boot_paramP->efi_systab; + ia64BootParamG.efi_memmap = ia64_boot_paramP->efi_memmap; + ia64BootParamG.efi_memmap_size = ia64_boot_paramP->efi_memmap_size; + ia64BootParamG.efi_memdesc_size = ia64_boot_paramP->efi_memdesc_size; ia64BootParamG.efi_memdesc_version = - SWAP(ia64_boot_paramP->efi_memdesc_version); + ia64_boot_paramP->efi_memdesc_version; ia64BootParamG.console_info.num_cols = - SWAP(ia64_boot_paramP->console_info.num_cols); + ia64_boot_paramP->console_info.num_cols; ia64BootParamG.console_info.num_rows = - SWAP(ia64_boot_paramP->console_info.num_rows); + ia64_boot_paramP->console_info.num_rows; ia64BootParamG.console_info.orig_x = - SWAP(ia64_boot_paramP->console_info.orig_x); + ia64_boot_paramP->console_info.orig_x; ia64BootParamG.console_info.orig_y = - SWAP(ia64_boot_paramP->console_info.orig_y); - ia64BootParamG.fpswa = SWAP(ia64_boot_paramP->fpswa); - ia64BootParamG.initrd_start = SWAP(ia64_boot_paramP->initrd_start); - ia64BootParamG.initrd_size = SWAP(ia64_boot_paramP->initrd_size); - ia64BootParamG.domain_start = SWAP(ia64_boot_paramP->domain_start); - ia64BootParamG.domain_size = SWAP(ia64_boot_paramP->domain_size); + ia64_boot_paramP->console_info.orig_y; + ia64BootParamG.fpswa = ia64_boot_paramP->fpswa; + ia64BootParamG.initrd_start = ia64_boot_paramP->initrd_start; + ia64BootParamG.initrd_size = ia64_boot_paramP->initrd_size; + ia64BootParamG.domain_start = ia64_boot_paramP->domain_start; + ia64BootParamG.domain_size = ia64_boot_paramP->domain_size; /* * Copy and parse the boot command line. diff --git a/extras/mini-os/arch/ia64/debug.c b/extras/mini-os/arch/ia64/debug.c index d95252b4c3..f5b378381f 100644 --- a/extras/mini-os/arch/ia64/debug.c +++ b/extras/mini-os/arch/ia64/debug.c @@ -102,7 +102,6 @@ static const char *ia64_vector_names[] = { typedef struct { -#if !defined(BIG_ENDIAN) uint64_t sof :7; /* 0-6 size of frame */ uint64_t sol :7; /* 7-13 size of locals (in + loc) */ uint64_t sor :4; @@ -111,16 +110,6 @@ typedef struct uint64_t rrb_pr :6; uint64_t res :25; /* reserved */ uint64_t v :1; /* The v bit */ -#else /* !BIG_ENDIAN */ - uint64_t v :1; /* The v bit */ - uint64_t res :25; /* reserved */ - uint64_t rrb_pr :6; - uint64_t rrb_fr :7; - uint64_t rrb_gr :7; - uint64_t sor :4; - uint64_t sol :7; /* 7-13 size of locals (in + loc) */ - uint64_t sof :7; /* 0-6 size of frame */ -#endif /* BIG_ENDIAN */ } ifs_t; void diff --git a/extras/mini-os/arch/ia64/efi.c b/extras/mini-os/arch/ia64/efi.c index 498eac42ad..cdb25b33ec 100644 --- a/extras/mini-os/arch/ia64/efi.c +++ b/extras/mini-os/arch/ia64/efi.c @@ -49,13 +49,6 @@ efi_get_time(efi_time_t* tmP) printk("efi.getTime() failed\n"); return 0; } - -#if defined(BIG_ENDIAN) - tmP->Year = SWAP(tmP->Year); - tmP->TimeZone = SWAP(tmP->TimeZone); - tmP->Nanosecond = SWAP(tmP->Nanosecond); -#endif - return 1; } @@ -65,17 +58,7 @@ efi_get_time(efi_time_t* tmP) static int efi_guid_cmp(efi_guid_t* a_le, efi_guid_t* b) { -#if defined(BIG_ENDIAN) - if(SWAP(a_le->Data1) != b->Data1) - return 1; - if(SWAP(a_le->Data2) != b->Data2) - return 1; - if(SWAP(a_le->Data3) != b->Data3) - return 1; - return memcmp(a_le->Data4, b->Data4, sizeof(uint8_t)*8); -#else return memcmp(a_le, b, sizeof(efi_guid_t)); -#endif } void @@ -99,20 +82,20 @@ init_efi(void) efiSysTableP = (efi_system_table_t*)__va(ia64BootParamG.efi_systab); machineFwG.efi.efiSysTableP = efiSysTableP; PRINT_BV("EfiSystemTable at: %p\n", efiSysTableP); - fwP = (uint16_t*) __va(SWAP(efiSysTableP->FirmwareVendor)); + fwP = (uint16_t*) __va(efiSysTableP->FirmwareVendor); if (fwP) { for (i = 0; i < (int)sizeof(fwVendor) - 1 && *fwP; ++i) - fwVendor[i] = SWAP(*fwP++); + fwVendor[i] = *fwP++; fwVendor[i] = '\0'; } PRINT_BV(" EFI-FirmwareVendor : %s\n", fwVendor); PRINT_BV(" EFI-FirmwareRevision : %d\n", - SWAP(efiSysTableP->FirmwareRevision)); + efiSysTableP->FirmwareRevision); PRINT_BV(" EFI-SystemTable-Revision : %d.%d\n", - SWAP(efiSysTableP->Hdr.Revision)>>16, - SWAP(efiSysTableP->Hdr.Revision)&0xffff); + efiSysTableP->Hdr.Revision >> 16, + efiSysTableP->Hdr.Revision & 0xffff); rsP = (efi_runtime_services_t*) - __va(SWAP(efiSysTableP->RuntimeServices)); + __va(efiSysTableP->RuntimeServices); mdcnt = ia64BootParamG.efi_memmap_size / ia64BootParamG.efi_memdesc_size; memdP = (efi_memory_descriptor_t*) __va(ia64BootParamG.efi_memmap); @@ -123,10 +106,10 @@ init_efi(void) mdP = NextMemoryDescriptor(mdP, ia64BootParamG.efi_memdesc_size)) { /* Relocate runtime memory segments for firmware. */ PRINT_BV(" %d. Type: %x Attributes: 0x%lx\n", - i, SWAP(mdP->Type), SWAP(mdP->Attribute)); + i, mdP->Type, mdP->Attribute); PRINT_BV(" PhysStart: 0x%lx NumPages: 0x%lx\n", - SWAP(mdP->PhysicalStart), SWAP(mdP->NumberOfPages)); - switch (SWAP(mdP->Type)) { + mdP->PhysicalStart, mdP->NumberOfPages); + switch (mdP->Type) { case EfiRuntimeServicesData: PRINT_BV(" -> EfiRuntimeServicesData\n"); break; @@ -139,18 +122,17 @@ init_efi(void) case EfiConventionalMemory: PRINT_BV(" -> EfiConventionalMemory\n"); PRINT_BV(" start: 0x%lx end: 0x%lx\n", - SWAP(mdP->PhysicalStart), - SWAP(mdP->PhysicalStart)+ - SWAP(mdP->NumberOfPages)*EFI_PAGE_SIZE); + mdP->PhysicalStart, + mdP->PhysicalStart + + mdP->NumberOfPages * EFI_PAGE_SIZE); if (numConvMem) { printk(" Currently only one efi " "memory chunk supported !!!\n"); break; } - machineFwG.mach_mem_start = - SWAP(mdP->PhysicalStart); + machineFwG.mach_mem_start = mdP->PhysicalStart; machineFwG.mach_mem_size = - SWAP(mdP->NumberOfPages)*EFI_PAGE_SIZE; + mdP->NumberOfPages * EFI_PAGE_SIZE; numConvMem++; break; case EfiMemoryMappedIOPortSpace: @@ -158,7 +140,7 @@ init_efi(void) break; case EfiPalCode: machineFwG.ia64_pal_base = - __va(SWAP(mdP->PhysicalStart)); + __va(mdP->PhysicalStart); PRINT_BV(" -> EfiPalCode\n" " start : %p\n", machineFwG.ia64_pal_base); @@ -170,12 +152,11 @@ init_efi(void) * virtual addressing and the efi runtime functions * may be called directly. */ - if (SWAP(mdP->Attribute) & EFI_MEMORY_RUNTIME) { - if (SWAP(mdP->Attribute) & EFI_MEMORY_WB) - mdP->VirtualStart = - SWAP(__va(mdP->PhysicalStart)); + if (mdP->Attribute & EFI_MEMORY_RUNTIME) { + if (mdP->Attribute & EFI_MEMORY_WB) + mdP->VirtualStart = __va(mdP->PhysicalStart); else { - if (SWAP(mdP->Attribute) & EFI_MEMORY_UC) + if (mdP->Attribute & EFI_MEMORY_UC) printk("efi_init: RuntimeMemory with " "UC attribute !!!!!!\n"); /* @@ -187,7 +168,7 @@ init_efi(void) } /* Now switch efi runtime stuff to virtual addressing. */ status = ia64_call_efi_physical( - (void*)__va(SWAP((uint64_t)rsP->SetVirtualAddressMap)), + (void*)__va((uint64_t)rsP->SetVirtualAddressMap), ia64BootParamG.efi_memmap_size, ia64BootParamG.efi_memdesc_size, ia64BootParamG.efi_memdesc_version, @@ -200,35 +181,35 @@ init_efi(void) } /* Getting efi function pointer for getEfiTime. */ machineFwG.efi.getTimeF = - (efi_get_time_t)__va(SWAP((uint64_t)rsP->GetTime)); + (efi_get_time_t)__va((uint64_t)rsP->GetTime); /* Getting efi function pointer for resetSystem. */ machineFwG.efi.resetSystemF = - (efi_reset_system_t)__va(SWAP((uint64_t)rsP->ResetSystem)); + (efi_reset_system_t)__va((uint64_t)rsP->ResetSystem); /* Scanning the Configuration table of the EfiSystemTable. */ PRINT_BV("NumberOfConfigTableEntries: %ld\n", - SWAP(efiSysTableP->NumberOfTableEntries)); + efiSysTableP->NumberOfTableEntries); confP = (efi_configuration_table_t*) - __va(SWAP(efiSysTableP->ConfigurationTable)); - for (i = 0; i < SWAP(efiSysTableP->NumberOfTableEntries); i++) { + __va(efiSysTableP->ConfigurationTable); + for (i = 0; i < efiSysTableP->NumberOfTableEntries; i++) { if (!efi_guid_cmp(&confP[i].VendorGuid, &sal)) { machineFwG.ia64_sal_tableP = (sal_system_table_t*) - __va(SWAP((uint64_t) confP[i].VendorTable)); + __va((uint64_t) confP[i].VendorTable); PRINT_BV(" Found SalSystemTable at: 0x%lx\n", (uint64_t) machineFwG.ia64_sal_tableP); continue; } if (!efi_guid_cmp(&confP[i].VendorGuid, &acpi)) { machineFwG.ia64_efi_acpi_table = - __va(SWAP((uint64_t) confP[i].VendorTable)); + __va((uint64_t) confP[i].VendorTable); PRINT_BV(" Found AcpiTable at: 0x%lx\n", (uint64_t) machineFwG.ia64_efi_acpi_table); continue; } if (!efi_guid_cmp(&confP[i].VendorGuid, &acpi20)) { machineFwG.ia64_efi_acpi20_table = - __va(SWAP((uint64_t) confP[i].VendorTable)); + __va((uint64_t) confP[i].VendorTable); PRINT_BV(" Found Acpi20Table at: 0x%lx\n", (uint64_t) machineFwG.ia64_efi_acpi20_table); continue; diff --git a/extras/mini-os/arch/ia64/fw.S b/extras/mini-os/arch/ia64/fw.S index 48bb851e5d..ef2c4d2d2f 100644 --- a/extras/mini-os/arch/ia64/fw.S +++ b/extras/mini-os/arch/ia64/fw.S @@ -155,11 +155,6 @@ ENTRY(ia64_call_efi_physical) ld8 r14=[in0],8 // function address ;; ld8 gp=[in0] // function gp value -#if defined(BIG_ENDIAN) - mux1 r14=r14,@rev // swap because mini-os is in BE - mov ar.rsc=3 - ;; -#endif mov out0=in1 mov out1=in2 mov out2=in3 @@ -167,19 +162,7 @@ ENTRY(ia64_call_efi_physical) mov out4=in5 mov b6=r14 ;; -#if defined(BIG_ENDIAN) - mux1 gp=gp,@rev // swap because mini-os is in BE - rum IA64_PSR_BE - ;; -#endif - br.call.sptk.many rp=b6 // call EFI procedure - -#if defined(BIG_ENDIAN) - ;; - sum IA64_PSR_BE - mov ar.rsc=IA64_RSE_EAGER -#endif mov gp=loc3 // restore kernel gp mov r14=loc2 // psr to restore mode ;; @@ -227,16 +210,8 @@ psrsave = loc4 mov b0=palret rsm psr.i // disable interrupts ;; -#if defined(BIG_ENDIAN) - rum IA64_PSR_BE // set psr.be==0 - ;; -#endif br.cond.sptk b6 // call into firmware ;; -#if defined(BIG_ENDIAN) - sum IA64_PSR_BE // set psr.be==1 - ;; -#endif ssm psr.i // enable interrupts ;; 2: mov psr.l=psrsave @@ -271,25 +246,9 @@ ENTRY(ia64_call_efi_func) ;; ld8 gp=[in0] // function gp value ;; -#if defined(BIG_ENDIAN) - mux1 r14=r14,@rev // swap if mini-os is in BE - mux1 gp=gp,@rev // swap if mini-os is in BE -#endif - ;; mov b6=r14 - -#if defined(BIG_ENDIAN) - rum IA64_PSR_BE - ;; -#endif - br.call.sptk.many rp=b6 // call EFI procedure -#if defined(BIG_ENDIAN) - sum IA64_PSR_BE - ;; -#endif - mov ar.pfs=loc0 mov gp=loc1 mov rp=loc2 diff --git a/extras/mini-os/arch/ia64/ia64.S b/extras/mini-os/arch/ia64/ia64.S index 7ea9433199..adcf1769a2 100644 --- a/extras/mini-os/arch/ia64/ia64.S +++ b/extras/mini-os/arch/ia64/ia64.S @@ -205,10 +205,6 @@ ENTRY(_start) START_INFO_PFN_ld r14=[r15] // load the start_info_pfn add r16=7, r0 ;; -#if defined(BIG_ENDIAN) - mux1 r14=r14,@rev // swap because mini-os is in BE -#endif - ;; shl r15=r14,PAGE_SHIFT_XEN_16K // pfn << PAGE_SHIFT_XEN_16K shl r16=r16,IA64_RR_IDX_POS // (7<sal_entry_count); i++) { - switch (SWAP(*p)) { + for (i = 0; i < saltab->sal_entry_count; i++) { + switch (*p) { case SAL_DESC_ENTRYPOINT: // 0 { struct sal_entrypoint_descriptor *dp; dp = (struct sal_entrypoint_descriptor*)p; ia64_pal_entry = - IA64_PHYS_TO_RR7(SWAP(dp->sale_pal_proc)); + IA64_PHYS_TO_RR7(dp->sale_pal_proc); PRINT_BV(" PAL Proc at 0x%lx\n", ia64_pal_entry); sal_fdesc.func = - IA64_PHYS_TO_RR7(SWAP(dp->sale_sal_proc)); - sal_fdesc.gp = IA64_PHYS_TO_RR7(SWAP(dp->sale_sal_gp)); + IA64_PHYS_TO_RR7(dp->sale_sal_proc); + sal_fdesc.gp = IA64_PHYS_TO_RR7(dp->sale_sal_gp); PRINT_BV(" SAL Proc at 0x%lx, GP at 0x%lx\n", sal_fdesc.func, sal_fdesc.gp); ia64_sal_entry = (sal_entry_t *) &sal_fdesc; diff --git a/extras/mini-os/arch/ia64/time.c b/extras/mini-os/arch/ia64/time.c index baf9096330..6da27fb4d7 100644 --- a/extras/mini-os/arch/ia64/time.c +++ b/extras/mini-os/arch/ia64/time.c @@ -197,15 +197,6 @@ calculate_frequencies(void) struct ia64_pal_result pal_res; pal_res = ia64_call_pal_static(PAL_FREQ_RATIOS, 0, 0, 0); - //sal_res = ia64_sal_call(SAL_FREQ_BASE, 0, 0, 0, 0, 0, 0, 0); -#if defined(BIG_ENDIAN) -//#warning calculate_frequencies TODO - /* - * I have to do an own function with switching psr.be! - * Currently it's running because it's a break into the hypervisor - * behind the call.! - */ -#endif sal_res = ia64_sal_entry(SAL_FREQ_BASE, 0, 0, 0, 0, 0, 0, 0); if (sal_res.sal_status == 0 && pal_res.pal_status == 0) { @@ -260,9 +251,8 @@ init_time(void) if (efi_get_time(&tm)) { printk(" EFI-Time: %d.%d.%d %d:%d:%d\n", tm.Day, tm.Month, tm.Year, tm.Hour, tm.Minute, tm.Second); - os_time.tv_sec = _mktime(SWAP(tm.Year), SWAP(tm.Month), - SWAP(tm.Day), SWAP(tm.Hour), - SWAP(tm.Minute), SWAP(tm.Second)); + os_time.tv_sec = _mktime(tm.Year, tm.Month, + tm.Day, tm.Hour, tm.Minute, tm.Second); os_time.tv_nsec = tm.Nanosecond; } else printk("efi_get_time() failed\n"); diff --git a/extras/mini-os/arch/ia64/xencomm.c b/extras/mini-os/arch/ia64/xencomm.c index 9745b8f820..fccfee2f1e 100644 --- a/extras/mini-os/arch/ia64/xencomm.c +++ b/extras/mini-os/arch/ia64/xencomm.c @@ -95,7 +95,7 @@ xencomm_init_desc(struct xencomm_desc *desc, void *buffer, unsigned long bytes) return -EINVAL; } - desc->address[i++] = SWAP(paddr); + desc->address[i++] = paddr; recorded += chunksz; } if (recorded < bytes) { @@ -106,8 +106,8 @@ xencomm_init_desc(struct xencomm_desc *desc, void *buffer, unsigned long bytes) /* mark remaining addresses invalid (just for safety) */ while (i < desc->nr_addrs) - desc->address[i++] = SWAP(XENCOMM_INVALID); - desc->magic = SWAP(XENCOMM_MAGIC); + desc->address[i++] = XENCOMM_INVALID; + desc->magic = XENCOMM_MAGIC; return 0; } @@ -184,15 +184,14 @@ xencommize_mini_grant_table_op(struct xencomm_mini *xc_area, int *nbr_area, return -EINVAL; rc = xencomm_create_mini (xc_area, nbr_area, - (void*)SWAP((uint64_t) - xen_guest_handle(setup->frame_list)), - SWAP(setup->nr_frames) + (void*)(uint64_t) xen_guest_handle(setup->frame_list), + setup->nr_frames * sizeof(*xen_guest_handle(setup->frame_list)), &desc1); if (rc) return rc; set_xen_guest_handle(setup->frame_list, - (void *)SWAP((uint64_t)desc1)); + (void *)(uint64_t)desc1); break; } case GNTTABOP_dump_table: @@ -284,7 +283,7 @@ HYPERVISOR_suspend(unsigned long srec) { struct sched_shutdown arg; - arg.reason = (uint32_t)SWAP((uint32_t)SHUTDOWN_suspend); + arg.reason = (uint32_t)SHUTDOWN_suspend; return xencomm_arch_hypercall_suspend(xencomm_create_inline(&arg)); } @@ -300,7 +299,7 @@ HYPERVISOR_event_channel_op(int cmd, void *arg) if (unlikely(rc == -ENOSYS)) { struct evtchn_op op; - op.cmd = SWAP(cmd); + op.cmd = cmd; memcpy(&op.u, arg, sizeof(op.u)); rc = _hypercall1(int, event_channel_op_compat, &op); } diff --git a/extras/mini-os/include/ia64/atomic.h b/extras/mini-os/include/ia64/atomic.h index 618ff82abc..ba5aa16517 100644 --- a/extras/mini-os/include/ia64/atomic.h +++ b/extras/mini-os/include/ia64/atomic.h @@ -427,11 +427,10 @@ atomic_readandclear_64(volatile uint64_t* p) static inline void set_bit(int num, volatile void *addr) { - uint32_t bit, b, old, new; + uint32_t bit, old, new; volatile uint32_t *p; p = (volatile uint32_t *) addr + (num >> 5); - b = 1 << (num & 31); - bit = SWAP(b); + bit = 1 << (num & 31); do { old = *p; @@ -442,11 +441,10 @@ set_bit(int num, volatile void *addr) static __inline__ void clear_bit(int num, volatile void *addr) { - uint32_t mask, m, old, new; + uint32_t mask, old, new; volatile uint32_t *p; p = (volatile uint32_t *) addr + (num >> 5); - m = ~(1 << (num & 31)); - mask = SWAP(m); + mask = ~(1 << (num & 31)); do { old = *p; new = old & mask; @@ -456,7 +454,7 @@ clear_bit(int num, volatile void *addr) static __inline__ int test_bit(int num, const volatile void *addr) { - uint32_t val = SWAP(1); + uint32_t val = 1; return val & (((const volatile uint32_t *) addr)[num >> 5] >> (num & 31)); } @@ -468,12 +466,11 @@ test_bit(int num, const volatile void *addr) static inline int test_and_set_bit (int num, volatile void *addr) { - uint32_t bit, b, old, new; + uint32_t bit, old, new; volatile uint32_t *m; m = (volatile uint32_t *) addr + (num >> 5); - b = 1 << (num & 31); - bit = SWAP(b); + bit = 1 << (num & 31); do { old = *m; new = old | bit; @@ -489,12 +486,11 @@ test_and_set_bit (int num, volatile void *addr) static inline int test_and_clear_bit(int num, volatile unsigned long * addr) { - uint32_t bit, b, old, new; + uint32_t bit, old, new; volatile uint32_t* a; a = (volatile uint32_t *) addr + (num >> 5); - b = ~(1 << (num & 31)); - bit = SWAP(b); + bit = ~(1 << (num & 31)); do { old = *a; new = old & bit; diff --git a/extras/mini-os/include/ia64/endian.h b/extras/mini-os/include/ia64/endian.h deleted file mode 100644 index 1d036ffa29..0000000000 --- a/extras/mini-os/include/ia64/endian.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Done by Dietmar Hahn - * Parts are taken from FreeBSD. - * - **************************************************************************** - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - - -#if !defined(_ENDIAN_H_) -#define _ENDIAN_H_ - -#include - - -#if !defined(__ASSEMBLY__) - -#if defined(BIG_ENDIAN) - -static __inline uint64_t -__bswap64(uint64_t __x) -{ - uint64_t __r; - asm __volatile("mux1 %0=%1,@rev" : "=r" (__r) : "r"(__x)); - return __r; -} - -static __inline uint32_t -__bswap32(uint32_t __x) -{ - return (__bswap64(__x) >> 32); -} - -static __inline uint16_t -__bswap16(uint16_t __x) -{ - return (__bswap64(__x) >> 48); -} - -#define doswap(x,sz) ( \ - ((sz)==1)? (uint8_t)(x): \ - ((sz)==2)? __bswap16(x): \ - ((sz)==4)? __bswap32(x): \ - ((sz)==8)? __bswap64(x): \ - ~0l ) - -#define SWAP(x) doswap((x), sizeof((x))) - - -#else /* defined(BIG_ENDIAN) */ - -#define SWAP(x) (x) - -#endif /* defined(BIG_ENDIAN) */ - -#endif /* !defined(__ASSEMBLY__) */ - - -#endif /* !defined(_ENDIAN_H_) */ diff --git a/extras/mini-os/include/ia64/ia64_cpu.h b/extras/mini-os/include/ia64/ia64_cpu.h index f9ebf7329f..3e2e9147ed 100644 --- a/extras/mini-os/include/ia64/ia64_cpu.h +++ b/extras/mini-os/include/ia64/ia64_cpu.h @@ -134,23 +134,16 @@ #define IA64_PSR_IA 0x0000200000000000 -/* Endianess of mini-os. */ -#if defined(BIG_ENDIAN) -#define MOS_IA64_PSR_BE IA64_PSR_BE -#else -#define MOS_IA64_PSR_BE 0 -#endif - #define STARTUP_PSR (IA64_PSR_IT | IA64_PSR_PK | \ - IA64_PSR_DT | IA64_PSR_RT | MOS_IA64_PSR_BE | \ + IA64_PSR_DT | IA64_PSR_RT | \ IA64_PSR_BN | IA64_PSR_CPL_KERN | IA64_PSR_AC) #define MOS_SYS_PSR (IA64_PSR_IC | IA64_PSR_I | IA64_PSR_IT | \ - IA64_PSR_DT | IA64_PSR_RT | MOS_IA64_PSR_BE | \ + IA64_PSR_DT | IA64_PSR_RT | \ IA64_PSR_BN | IA64_PSR_CPL_KERN | IA64_PSR_AC) #define MOS_USR_PSR (IA64_PSR_IC | IA64_PSR_I | IA64_PSR_IT | \ - IA64_PSR_DT | IA64_PSR_RT | MOS_IA64_PSR_BE | \ + IA64_PSR_DT | IA64_PSR_RT | \ IA64_PSR_BN | IA64_PSR_CPL_USER | IA64_PSR_AC) /* @@ -193,14 +186,7 @@ #define IA64_DCR_MBZ1_V 0xffffffffffffULL - /* Endianess of DCR register. */ -#if defined(BIG_ENDIAN) -#define MOS_IA64_DCR_BE (1 << IA64_DCR_BE) -#else -#define MOS_IA64_DCR_BE (0 << IA64_DCR_BE) -#endif - -#define IA64_DCR_DEFAULT (MOS_IA64_DCR_BE) +#define IA64_DCR_DEFAULT (IA64_DCR_BE) /* * Vector numbers for various ia64 interrupts. @@ -262,18 +248,8 @@ #define IA64_RSC_MODE_LI (0x2) /* Load intensive */ #define IA64_RSC_MODE_EA (0x3) /* Eager */ -/* RSE endian mode. */ -#if defined(BIG_ENDIAN) -#define MOS_IA64_RSC_BE 1 /* Big endian rse. */ -#else -#define MOS_IA64_RSC_BE 0 /* Little endian rse. */ -#endif - -#define IA64_RSE_EAGER ((IA64_RSC_MODE_EA< -#include "endian.h" #include "ia64_cpu.h" #include "atomic.h" #include "efi.h" @@ -210,7 +209,7 @@ extern shared_info_t *HYPERVISOR_shared_info; do { \ vcpu_info_t *_vcpu; \ _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \ - _vcpu->evtchn_upcall_mask = SWAP(1); \ + _vcpu->evtchn_upcall_mask = 1; \ barrier(); \ } while (0) @@ -221,7 +220,7 @@ do { \ _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \ _vcpu->evtchn_upcall_mask = 0; \ barrier(); /* unmask then check (avoid races) */ \ - if (unlikely(SWAP(_vcpu->evtchn_upcall_pending))) \ + if (unlikely(_vcpu->evtchn_upcall_pending)) \ force_evtchn_callback(); \ } while (0) @@ -229,7 +228,7 @@ do { \ do { \ vcpu_info_t *_vcpu; \ _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \ - (x) = SWAP(_vcpu->evtchn_upcall_mask); \ + (x) = _vcpu->evtchn_upcall_mask; \ } while (0) #define __restore_flags(x) \ @@ -239,7 +238,7 @@ do { \ _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \ if ((_vcpu->evtchn_upcall_mask = (x)) == 0) { \ barrier(); /* unmask then check (avoid races) */ \ - if ( unlikely(SWAP(_vcpu->evtchn_upcall_pending)) ) \ + if ( unlikely(_vcpu->evtchn_upcall_pending) ) \ force_evtchn_callback(); \ }\ } while (0) @@ -250,8 +249,8 @@ do { \ do { \ vcpu_info_t *_vcpu; \ _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \ - (x) = SWAP(_vcpu->evtchn_upcall_mask); \ - _vcpu->evtchn_upcall_mask = SWAP(1); \ + (x) = _vcpu->evtchn_upcall_mask; \ + _vcpu->evtchn_upcall_mask = 1; \ barrier(); \ } while (0) @@ -262,7 +261,7 @@ do { \ #define local_irq_enable() __sti() #define irqs_disabled() \ - SWAP(HYPERVISOR_shared_info->vcpu_info[smp_processor_id()].evtchn_upcall_mask) + (HYPERVISOR_shared_info->vcpu_info[smp_processor_id()].evtchn_upcall_mask) /* This is a barrier for the compiler only, NOT the processor! */ #define barrier() __asm__ __volatile__("": : :"memory")