diff options
-rw-r--r-- | extras/mini-os/arch/ia64/arch.mk | 11 | ||||
-rw-r--r-- | extras/mini-os/arch/ia64/common.c | 60 | ||||
-rw-r--r-- | extras/mini-os/arch/ia64/debug.c | 11 | ||||
-rw-r--r-- | extras/mini-os/arch/ia64/efi.c | 75 | ||||
-rw-r--r-- | extras/mini-os/arch/ia64/fw.S | 41 | ||||
-rw-r--r-- | extras/mini-os/arch/ia64/ia64.S | 4 | ||||
-rw-r--r-- | extras/mini-os/arch/ia64/ivt.S | 98 | ||||
-rw-r--r-- | extras/mini-os/arch/ia64/mm.c | 2 | ||||
-rw-r--r-- | extras/mini-os/arch/ia64/sal.c | 10 | ||||
-rw-r--r-- | extras/mini-os/arch/ia64/time.c | 14 | ||||
-rw-r--r-- | extras/mini-os/arch/ia64/xencomm.c | 17 | ||||
-rw-r--r-- | extras/mini-os/include/ia64/atomic.h | 22 | ||||
-rw-r--r-- | extras/mini-os/include/ia64/endian.h | 75 | ||||
-rw-r--r-- | extras/mini-os/include/ia64/ia64_cpu.h | 50 | ||||
-rw-r--r-- | extras/mini-os/include/ia64/os.h | 15 |
15 files changed, 95 insertions, 410 deletions
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<<IA64_RR_IDX_POS) ;; diff --git a/extras/mini-os/arch/ia64/ivt.S b/extras/mini-os/arch/ia64/ivt.S index 79971fef34..8971b3bee9 100644 --- a/extras/mini-os/arch/ia64/ivt.S +++ b/extras/mini-os/arch/ia64/ivt.S @@ -87,11 +87,6 @@ ENTRY(save_tf_rse_switch) ;; ld8 r21=[r21] // XEN.ipsr ld8 r22=[r22];; // XEN.iip -#if defined(BIG_ENDIAN) - mux1 r21=r21,@rev // swap because mini-os is in BE - mux1 r22=r22,@rev // swap because mini-os is in BE - ;; -#endif add r19=TF_IPSR,r18 add r20=TF_IIP,r18 ;; @@ -129,10 +124,6 @@ ENTRY(save_tf_rse_switch) //bsw.1 // switch to bank 1 for saving these registers. movl r30=XSI_BANKNUM // Switch to bank 1. mov r31=1;; -#if defined(BIG_ENDIAN) - mux1 r31=r31,@rev // swap because mini-os is in BE - ;; -#endif st4 [r30]=r31 ;; /* @@ -143,38 +134,13 @@ ENTRY(save_tf_rse_switch) movl r30=XSI_BANK1_R16; movl r31=XSI_BANK1_R16+8;; ld8 r16=[r30],16; ld8 r17=[r31],16;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r16=r16,@rev; mux1 r17=r17,@rev;; -#endif ld8 r18=[r30],16; ld8 r19=[r31],16;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r18=r18,@rev; mux1 r19=r19,@rev;; -#endif ld8 r20=[r30],16; ld8 r21=[r31],16;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r20=r20,@rev; mux1 r21=r21,@rev;; -#endif ld8 r22=[r30],16; ld8 r23=[r31],16;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r22=r22,@rev; mux1 r23=r23,@rev;; -#endif ld8 r24=[r30],16; ld8 r25=[r31],16;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r24=r24,@rev; mux1 r25=r25,@rev;; -#endif ld8 r26=[r30],16; ld8 r27=[r31],16;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r26=r26,@rev; mux1 r27=r27,@rev;; -#endif ld8 r28=[r30],16; ld8 r29=[r31],16;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r28=r28,@rev; mux1 r29=r29,@rev;; -#endif ld8 r30=[r30]; ld8 r31=[r31];; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r30=r30,@rev; mux1 r31=r31,@rev;; -#endif - add r2=TF_GREG16,r14 add r3=TF_GREG17,r14 ;; @@ -251,10 +217,6 @@ ENTRY(save_tf_rse_switch) ;; ld8 r21=[r8] ;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r21=r21,@rev - ;; -#endif st8 [r19]=r21 // store cr.ifs dep.z r22=r21,0,38 // copy ifm part from ifs.ifm ;; @@ -330,12 +292,6 @@ ENTRY(restore_tf_rse_switch) ;; ld8 r21=[r19] // load cr.ipsr ld8 r22=[r20] // load cr.iip -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - ;; - mux1 r21=r21,@rev - mux1 r22=r22,@rev - ;; -#endif movl r16=XSI_IPSR // XEN !! ;; st8 [r16]=r21,XSI_IIP_OFS-XSI_IPSR_OFS // XEN.ipsr @@ -353,9 +309,6 @@ ENTRY(restore_tf_rse_switch) ld8 r22=[r19] // ndirty ;; shl r21=r22,16 // value for ar.rsc - //mov r19=(MOS_IA64_RSC_BE << IA64_RSC_BE) - ;; - or r21=(MOS_IA64_RSC_BE << IA64_RSC_BE),r21 ;; mov ar.rsc=r21 // setup for loadrs ;; @@ -386,10 +339,6 @@ ENTRY(restore_tf_rse_switch) ld8 r21=[r19] // load ar.pfs ld8 r22=[r20] // load cr.ifs ;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r22=r22,@rev - ;; -#endif add r19=TF_RSC,r18 mov ar.pfs=r21 st8 [r16]=r22 // XEN.ifs @@ -429,10 +378,6 @@ ENTRY(restore_tf_rse_switch) // bsw.1 movl r30=XSI_BANKNUM // Switch to bank 1. mov r31=1;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r31=r31,@rev - ;; -#endif st4 [r30]=r31 ;; add r2=TF_GREG16,r14 @@ -455,51 +400,27 @@ ENTRY(restore_tf_rse_switch) movl r2=XSI_BANK1_R16 movl r3=XSI_BANK1_R16+8 ;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r16=r16,@rev; mux1 r17=r17,@rev;; -#endif .mem.offset 0,0; st8.spill [r2]=r16,16 .mem.offset 8,0; st8.spill [r3]=r17,16 ;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r18=r18,@rev; mux1 r19=r19,@rev;; -#endif .mem.offset 0,0; st8.spill [r2]=r18,16 .mem.offset 8,0; st8.spill [r3]=r19,16 ;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r20=r20,@rev; mux1 r21=r21,@rev;; -#endif .mem.offset 0,0; st8.spill [r2]=r20,16 .mem.offset 8,0; st8.spill [r3]=r21,16 ;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r22=r22,@rev; mux1 r23=r23,@rev;; -#endif .mem.offset 0,0; st8.spill [r2]=r22,16 .mem.offset 8,0; st8.spill [r3]=r23,16 ;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r24=r24,@rev; mux1 r25=r25,@rev;; -#endif .mem.offset 0,0; st8.spill [r2]=r24,16 .mem.offset 8,0; st8.spill [r3]=r25,16 ;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r26=r26,@rev; mux1 r27=r27,@rev;; -#endif .mem.offset 0,0; st8.spill [r2]=r26,16 .mem.offset 8,0; st8.spill [r3]=r27,16 ;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r28=r28,@rev; mux1 r29=r29,@rev;; -#endif .mem.offset 0,0; st8.spill [r2]=r28,16 .mem.offset 8,0; st8.spill [r3]=r29,16 ;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r30=r30,@rev; mux1 r31=r31,@rev;; -#endif .mem.offset 0,0; st8.spill [r2]=r30,16 .mem.offset 8,0; st8.spill [r3]=r31,16 ;; @@ -567,17 +488,11 @@ ENTRY(save_special_regs) add loc5=TF_IFA,in0 add loc6=TF_ISR,in0 ;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 loc3=loc3,@rev; mux1 loc4=loc4,@rev;; -#endif st8 [loc5]=loc3,TF_IIM-TF_IFA // store cr.ifa st8 [loc6]=loc4 // store cr.isr ;; ld8 loc3=[loc1] // load XEN.iim ;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 loc3=loc3,@rev;; -#endif st8 [loc5]=loc3 // store cr.iim ;; mov ar.pfs=loc0 @@ -605,9 +520,6 @@ ENTRY(hypervisor_callback) mov out0=r18 // the trap frame movl r22=XSI_PSR_IC mov r23=1;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r23=r23,@rev;; -#endif st8 [r22]=r23 // ssm psr.ic ;; br.call.sptk.few rp = do_hypervisor_callback @@ -649,9 +561,6 @@ ENTRY(trap_error) ;; movl r30=XSI_BANKNUM // bsw.1 mov r31=1;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r31=r31,@rev;; -#endif st4 [r30]=r31;; /* Save extra interrupt registers to the trap frame. */ @@ -664,9 +573,6 @@ ENTRY(trap_error) ld8 r23=[r23] mov r25=1 ;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r25=r25,@rev; mux1 r23=r23,@rev;; -#endif st4 [r22]=r25 // ssm psr.ic st1 [r23]=r0 // ssm psr.i ;; @@ -680,10 +586,6 @@ ENTRY(trap_error) ld8 r23=[r23] mov r25=1 ;; -#if defined(BIG_ENDIAN) // swap because mini-os is in BE - mux1 r25=r25,@rev;; - mux1 r25=r25,@rev; mux1 r23=r23,@rev;; -#endif st1 [r23]=r25 st4 [r22]=r0 // note: clears both vpsr.i and vpsr.ic! ;; diff --git a/extras/mini-os/arch/ia64/mm.c b/extras/mini-os/arch/ia64/mm.c index 916e2f610b..189b39addc 100644 --- a/extras/mini-os/arch/ia64/mm.c +++ b/extras/mini-os/arch/ia64/mm.c @@ -153,7 +153,7 @@ map_frames_ex(unsigned long* frames, unsigned long n, unsigned long stride, ASSERT(n == 1 || (stride == 0 && increment == 1)); ASSERT(id == DOMID_SELF); ASSERT(prot == 0); - return (void*) __va(SWAP(frames[0]) << PAGE_SHIFT); + return (void*) __va(frames[0] << PAGE_SHIFT); } void arch_init_p2m(unsigned long max_pfn) diff --git a/extras/mini-os/arch/ia64/sal.c b/extras/mini-os/arch/ia64/sal.c index d087053287..286e5be38c 100644 --- a/extras/mini-os/arch/ia64/sal.c +++ b/extras/mini-os/arch/ia64/sal.c @@ -76,19 +76,19 @@ ia64_sal_init(struct sal_system_table *saltab) return; } p = (uint8_t *) (saltab + 1); - for (i = 0; i < SWAP(saltab->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 <dietmar.hahn@fujitsu-siemens.com> - * 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 <mini-os/types.h> - - -#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<<IA64_RSC_MODE) | \ - (MOS_IA64_RSC_BE << IA64_RSC_BE) ) - -#define IA64_RSE_LAZY ((IA64_RSC_MODE_LY<<IA64_RSC_MODE) | \ - (MOS_IA64_RSC_BE << IA64_RSC_BE) ) +#define IA64_RSE_EAGER (IA64_RSC_MODE_EA<<IA64_RSC_MODE) +#define IA64_RSE_LAZY (IA64_RSC_MODE_LY<<IA64_RSC_MODE) @@ -719,19 +695,6 @@ typedef struct trap_frame trap_frame_t; */ typedef struct { -#if defined(BIG_ENDIAN) - uint64_t pte_ig :11; /* bits 53..63 */ - uint64_t pte_ed :1; /* bits 52..52 */ - uint64_t pte_rv2:2; /* bits 50..51 */ - uint64_t pte_ppn:38; /* bits 12..49 */ - uint64_t pte_ar :3; /* bits 9..11 */ - uint64_t pte_pl :2; /* bits 7..8 */ - uint64_t pte_d :1; /* bits 6..6 */ - uint64_t pte_a :1; /* bits 5..5 */ - uint64_t pte_ma :3; /* bits 2..4 */ - uint64_t pte_rv1:1; /* bits 1..1 */ - uint64_t pte_p :1; /* bits 0..0 */ -#else uint64_t pte_p :1; /* bits 0..0 */ uint64_t pte_rv1:1; /* bits 1..1 */ uint64_t pte_ma :3; /* bits 2..4 */ @@ -743,7 +706,6 @@ typedef struct uint64_t pte_rv2:2; /* bits 50..51 */ uint64_t pte_ed :1; /* bits 52..52 */ uint64_t pte_ig :11; /* bits 53..63 */ -#endif } ia64_pte_t; diff --git a/extras/mini-os/include/ia64/os.h b/extras/mini-os/include/ia64/os.h index 133893acbd..9a79e9bdc5 100644 --- a/extras/mini-os/include/ia64/os.h +++ b/extras/mini-os/include/ia64/os.h @@ -28,7 +28,6 @@ #if !defined(__ASSEMBLY__) #include <mini-os/types.h> -#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") |