Changes in / [db8568a:5773e82] in mainline


Ignore:
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    rdb8568a r5773e82  
    1414/Makefile.config
    1515/PKG
    16 /QEMU_EFI_ARM64.fd
    1716/common.h
    1817/config.h
  • boot/arch/arm64/src/main.c

    rdb8568a r5773e82  
    191191
    192192        /* Statically check PAGE_SIZE and BOOT_OFFSET. */
    193 #if PAGE_SIZE != 4096
    194 #error Unsupported PAGE_SIZE
    195 #endif
    196 #if !IS_ALIGNED(BOOT_OFFSET, PAGE_SIZE)
    197 #error Unsupported BOOT_OFFSET
    198 #endif
     193        _Static_assert(PAGE_SIZE == 4096, "PAGE_SIZE must be equal to 4096");
     194        _Static_assert(IS_ALIGNED(BOOT_OFFSET, PAGE_SIZE),
     195            "BOOT_OFFSET must be a multiple of PAGE_SIZE");
     196
    199197        /*
    200198         * Dynamically check the memory base. The condition should be always
  • kernel/arch/arm64/src/interrupt.c

    rdb8568a r5773e82  
    5353        DAIF_write(daif | DAIF_IRQ_FLAG);
    5454
    55         return (daif >> DAIF_IRQ_SHIFT) & 1;
     55        return daif & DAIF_IRQ_FLAG;
    5656}
    5757
     
    6666        DAIF_write(daif & ~DAIF_IRQ_FLAG);
    6767
    68         return (daif >> DAIF_IRQ_SHIFT) & 1;
     68        return daif & DAIF_IRQ_FLAG;
    6969}
    7070
     
    7777        uint64_t daif = DAIF_read();
    7878
    79         DAIF_write((daif & ~DAIF_IRQ_FLAG) |
    80             ((ipl & 1) << DAIF_IRQ_SHIFT));
     79        DAIF_write((daif & ~DAIF_IRQ_FLAG) | (ipl & DAIF_IRQ_FLAG));
    8180}
    8281
     
    8786ipl_t interrupts_read(void)
    8887{
    89         return (DAIF_read() >> DAIF_IRQ_SHIFT) & 1;
     88        return DAIF_read() & DAIF_IRQ_FLAG;
    9089}
    9190
  • tools/ew.py

    rdb8568a r5773e82  
    8989        return '-cpu 4Kc'
    9090
     91def find_firmware(name, environ_var, default_paths, extra_info=None):
     92        """Find firmware image(s)."""
     93
     94        if environ_var in os.environ:
     95                return os.environ[environ_var]
     96
     97        for path in default_paths:
     98                if os.path.exists(path):
     99                        return path
     100
     101        sys.stderr.write("Cannot find %s binary image(s)!\n" % name)
     102        sys.stderr.write(
     103            "Either set %s environment variable accordingly or place the image(s) in one of the default locations: %s.\n" %
     104            (environ_var, ", ".join(default_paths)))
     105        if extra_info is not None:
     106                sys.stderr.write(extra_info)
     107        return None
     108
    91109def platform_to_qemu_options(platform, machine, processor):
    92110        if platform == 'amd64':
     
    95113                return 'system-arm', '-M integratorcp'
    96114        elif platform == 'arm64':
    97                 # Check that ROM image is present. Provide the user with
    98                 # appropriate steps to fix this problem.
    99                 if not os.path.exists('QEMU_EFI_ARM64.fd'):
    100                         sys.stderr.write('Could not find ' +
    101                             '\'QEMU_EFI_ARM64.fd\' which is expected to ' +
    102                             'contain EDK2 firmware image.\n')
    103                         sys.stderr.write('Pre-built image can be obtained by ' +
    104                             'running the following command:\n')
    105                         sys.stderr.write('$ wget http://snapshots.linaro.org/' +
    106                             'components/kernel/leg-virt-tianocore-edk2-' +
    107                             'upstream/latest/QEMU-AARCH64/RELEASE_GCC49/' +
    108                             'QEMU_EFI.fd -O QEMU_EFI_ARM64.fd\n')
     115                # Search for the EDK2 firmware image
     116                default_paths = (
     117                        '/usr/local/qemu-efi-aarch64/QEMU_EFI.fd', # Custom
     118                        '/usr/share/edk2/aarch64/QEMU_EFI.fd',     # Fedora
     119                        '/usr/share/qemu-efi-aarch64/QEMU_EFI.fd', # Ubuntu
     120                )
     121                extra_info = ("Pre-compiled binary can be obtained from "
     122                    "http://snapshots.linaro.org/components/kernel/leg-virt-tianocore-edk2-upstream/latest/QEMU-AARCH64/RELEASE_GCC49/QEMU_EFI.fd.\n")
     123                efi_path = find_firmware(
     124                    "EDK2", 'EW_QEMU_EFI_AARCH64', default_paths, extra_info)
     125                if efi_path is None:
    109126                        raise Exception
     127
    110128                return 'system-aarch64', \
    111                     '-M virt -cpu cortex-a57 -m 1024 -bios QEMU_EFI_ARM64.fd'
     129                    '-M virt -cpu cortex-a57 -m 1024 -bios %s' % efi_path
    112130        elif platform == 'ia32':
    113131                return 'system-i386', pc_options(32)
     
    124142                if processor == 'us':
    125143                        return 'system-sparc64', '-M sun4u --prom-env boot-args="console=devices/\\hw\\pci0\\01:01.0\\com1\\a"'
    126                 elif processor == 'sun4v':
    127                         default_path = '/usr/local/opensparc/image/'
    128                 try:
    129                         if os.path.exists(default_path):
    130                                 opensparc_bins = default_path
    131                         elif os.path.exists(os.environ['OPENSPARC_BINARIES']):
    132                                 opensparc_bins = os.environ['OPENSPARC_BINARIES']
    133                         else:
    134                                 raise Exception
    135                 except:
    136                         print("Cannot find OpenSPARC binary images!")
    137                         print("Either set OPENSPARC_BINARIES environment variable accordingly or place the images in %s." % (default_path))
     144
     145                # processor = 'sun4v'
     146                opensparc_bins = find_firmware(
     147                    "OpenSPARC", 'OPENSPARC_BINARIES',
     148                    ('/usr/local/opensparc/image/', ))
     149                if opensparc_bins is None:
    138150                        raise Exception
    139151
Note: See TracChangeset for help on using the changeset viewer.