├── .circleci ├── .config ├── config.yml └── lib.config ├── .gitignore ├── Dockerfile ├── Kconfig ├── LICENSE ├── Makefile ├── README.md ├── archlib ├── Makefile ├── armv6 │ └── archsup.S ├── armv7 │ ├── archlib.c │ ├── archsup.S │ └── regacces.c ├── build.ck ├── x86 │ ├── Makefile.inc │ ├── archlib.c │ ├── archsup.S │ ├── ioport.S │ └── regacces.c └── x86_64 │ ├── Makefile.inc │ ├── archlib.c │ ├── archsup.S │ ├── ioport.S │ └── regacces.c ├── build.ck ├── configs └── defconfig ├── core ├── Makefile ├── Makefile.inc ├── acpi.c ├── acpitabs.c ├── armv7 │ ├── commsup.S │ ├── inttable.S │ └── prochw.c ├── basepe.c ├── bds.h ├── bdsboot.c ├── bdscon.c ├── bdsentry.c ├── bdsutil.c ├── blockdev.c ├── build.ck ├── cfgtable.c ├── crc32.c ├── dbgser.c ├── devpath.h ├── devpathu.c ├── diskio.c ├── dispatch.c ├── div.c ├── drvsup.c ├── emptyrd │ ├── Makefile │ └── emptyrd.S ├── event.c ├── fatdev.c ├── fatfs.c ├── fatfs.h ├── fsvars.c ├── fvblock.c ├── fvsect.c ├── fwvol.c ├── fwvolio.c ├── fwvolp.h ├── handle.c ├── handle.h ├── image.c ├── image.h ├── imagep.h ├── init.c ├── intr.c ├── locate.c ├── lock.c ├── lock.h ├── main.c ├── memory.c ├── memory.h ├── part.c ├── part.h ├── partelto.c ├── partfmt.h ├── partgpt.c ├── partmbr.c ├── pool.c ├── ramdisk.c ├── rtlib │ ├── Makefile │ ├── Makefile.inc │ ├── build.ck │ ├── init.c │ ├── rtlib.h │ ├── time.c │ └── var.c ├── runtime │ ├── Makefile │ ├── Makefile.inc │ ├── build.ck │ └── runtime.c ├── serialcon.c ├── smbios.c ├── stubs.c ├── timer.c ├── tpl.c ├── ueficore.h ├── util.c ├── varback.h ├── version.c ├── vidcon.c └── x86 │ ├── Makefile.inc │ ├── archsup.S │ └── prochw.c ├── dev ├── Makefile ├── Makefile.inc ├── ahci │ ├── Makefile.inc │ └── ahci.c ├── bcm2709 │ ├── Makefile │ ├── build.ck │ ├── gpio.c │ ├── init.c │ ├── intr.c │ ├── mailbox.c │ ├── memmap.c │ ├── sd.c │ ├── serial.c │ ├── timer.c │ ├── usb.c │ └── video.c ├── common ├── gic │ ├── Makefile │ ├── build.ck │ └── gic.c ├── gt │ ├── Makefile │ ├── build.ck │ ├── gt.c │ └── gta.S ├── ide │ ├── Makefile.inc │ └── ide_new.c ├── ns16550 │ ├── Makefile │ ├── build.ck │ └── ns16550.c ├── omap4 │ ├── Makefile │ ├── build.ck │ └── clock.c ├── omapuart │ ├── Makefile │ ├── build.ck │ └── omapuart.c ├── pl031 │ ├── Makefile │ ├── build.ck │ └── pl031.c ├── pl11 │ ├── Makefile │ ├── build.ck │ └── pl11.c ├── pl110 │ ├── Makefile │ ├── build.ck │ └── pl110.c └── sd │ ├── Makefile │ ├── core │ ├── Makefile │ ├── build.ck │ ├── sd.c │ ├── sdp.h │ └── sdstd.c │ └── dwc │ ├── Makefile │ ├── build.ck │ └── sddwc.c ├── include ├── blockdev │ ├── blockdev.h │ ├── container_of.h │ ├── list.h │ └── stream.h ├── dev │ ├── ahci.h │ ├── ata.h │ ├── bcm2709.h │ ├── gic.h │ ├── gt.h │ ├── hdreg.h │ ├── ide_new.h │ ├── ns16550.h │ ├── omap4.h │ ├── omapuart.h │ ├── pl031.h │ ├── pl11.h │ ├── pl110.h │ ├── sd.h │ ├── sddwc.h │ └── tirom.h ├── efiffs.h ├── efiimg.h ├── fileinfo.h ├── fs.h ├── fv2.h ├── fvblock.h ├── fwvol.h ├── hii.h ├── kdp.h ├── link_arm.x ├── link_x86.x ├── minoca │ ├── debug │ │ ├── dbgext.h │ │ ├── dbgproto.h │ │ └── spproto.h │ ├── devinfo │ │ ├── net.h │ │ ├── onering.h │ │ ├── part.h │ │ └── test.h │ ├── dma │ │ ├── dma.h │ │ ├── dmab2709.h │ │ ├── dmahost.h │ │ └── edma3.h │ ├── fw │ │ ├── acpitabs.h │ │ └── smbios.h │ ├── gpio │ │ ├── gpio.h │ │ └── gpiohost.h │ ├── intrface │ │ ├── acpi.h │ │ ├── disk.h │ │ ├── pci.h │ │ ├── random.h │ │ ├── rk808.h │ │ └── tps65217.h │ ├── kernel │ │ ├── acpi.h │ │ ├── arch.h │ │ ├── arm.h │ │ ├── arm.inc │ │ ├── bootload.h │ │ ├── crash.h │ │ ├── crashdmp.h │ │ ├── devres.h │ │ ├── driver.h │ │ ├── hl.h │ │ ├── hmod.h │ │ ├── io.h │ │ ├── ioport.h │ │ ├── kdebug.h │ │ ├── kdusb.h │ │ ├── ke.h │ │ ├── kernel.h │ │ ├── knet.h │ │ ├── ksignals.h │ │ ├── mm.h │ │ ├── ob.h │ │ ├── pm.h │ │ ├── ps.h │ │ ├── regacces.h │ │ ├── sp.h │ │ ├── syscall.h │ │ ├── sysres.h │ │ ├── x64.inc │ │ ├── x86.h │ │ └── x86.inc │ ├── lib │ │ ├── basevid.h │ │ ├── bconf.h │ │ ├── chalk.h │ │ ├── chalk │ │ │ ├── app.h │ │ │ └── bundle.h │ │ ├── crypto.h │ │ ├── fat │ │ │ ├── fat.h │ │ │ └── fatlib.h │ │ ├── im.h │ │ ├── lzma.h │ │ ├── minocaos.h │ │ ├── mlibc.h │ │ ├── netlink.h │ │ ├── partlib.h │ │ ├── rtl.h │ │ ├── status.h │ │ ├── termlib.h │ │ ├── tty.h │ │ ├── types.h │ │ ├── tzfmt.h │ │ ├── yy.h │ │ └── yygen.h │ ├── net │ │ ├── igmp.h │ │ ├── ip4.h │ │ ├── mii.h │ │ ├── net80211.h │ │ ├── net8022.h │ │ ├── netdrv.h │ │ └── netlink.h │ ├── sd │ │ ├── sd.h │ │ ├── sddwc.h │ │ └── sdstd.h │ ├── soc │ │ ├── am335x.h │ │ ├── b2709os.h │ │ ├── bcm2709.h │ │ ├── omap4.h │ │ └── rk32xx.h │ ├── spb │ │ ├── spb.h │ │ └── spbhost.h │ ├── storage │ │ └── ata.h │ ├── uefi │ │ ├── arm │ │ │ └── procdef.h │ │ ├── guid │ │ │ ├── acpi.h │ │ │ ├── coninct.h │ │ │ ├── eventgrp.h │ │ │ └── globlvar.h │ │ ├── protocol │ │ │ ├── blockio.h │ │ │ ├── devpath.h │ │ │ ├── devpathu.h │ │ │ ├── diskio.h │ │ │ ├── drvbind.h │ │ │ ├── drvbusov.h │ │ │ ├── drvfamov.h │ │ │ ├── drvplato.h │ │ │ ├── graphout.h │ │ │ ├── loadfil.h │ │ │ ├── loadfil2.h │ │ │ ├── loadimg.h │ │ │ ├── ramdisk.h │ │ │ ├── serio.h │ │ │ ├── sfilesys.h │ │ │ ├── stextin.h │ │ │ ├── stextinx.h │ │ │ └── stextout.h │ │ ├── spec.h │ │ ├── types.h │ │ ├── uefi.h │ │ ├── x64 │ │ │ └── procdef.h │ │ └── x86 │ │ │ └── procdef.h │ ├── usb │ │ ├── usb.h │ │ ├── usbhid.h │ │ └── usbhost.h │ ├── usrinput │ │ └── usrinput.h │ └── video │ │ └── fb.h ├── peimage.h ├── rtlp.h ├── runtime.h ├── shortcut.h ├── uboot.h └── uefifw.h ├── lib ├── Makefile.inc ├── basevid │ ├── Makefile │ ├── Makefile.inc │ ├── basevidp.h │ ├── build.ck │ ├── fontdata.c │ └── textvid.c ├── blockdev │ ├── Makefile.inc │ └── list.c ├── fatlib │ ├── Makefile │ ├── Makefile.inc │ ├── build.ck │ ├── build │ │ └── Makefile │ ├── fat.c │ ├── fatcache.c │ ├── fatlibp.h │ ├── fatsup.c │ ├── fattest │ │ ├── Makefile │ │ ├── build.ck │ │ ├── fatdev.c │ │ └── fattest.c │ ├── idtodir.c │ └── sources └── rtl │ ├── Makefile.inc │ └── base │ ├── Makefile │ ├── Makefile.inc │ ├── armv7 │ ├── aeabisfp.c │ ├── intrinsa.S │ ├── intrinsc.c │ ├── rtlarch.S │ └── rtlmem.S │ ├── boot │ ├── Makefile │ └── armv7 │ │ └── rtlarch.S │ ├── build.ck │ ├── build │ └── Makefile │ ├── crc32.c │ ├── fp2int.c │ ├── heap.c │ ├── heapprof.c │ ├── intrins │ └── Makefile │ ├── math.c │ ├── print.c │ ├── rbtree.c │ ├── scan.c │ ├── softfp.c │ ├── softfp.h │ ├── sources │ ├── string.c │ ├── time.c │ ├── time.h │ ├── timezone.c │ ├── version.c │ ├── wchar.c │ ├── wide │ └── Makefile │ ├── wprint.c │ ├── wscan.c │ ├── wstring.c │ ├── wtime.c │ ├── x64 │ ├── rtlarch.S │ └── rtlmem.S │ └── x86 │ ├── intrinsc.c │ ├── rtlarch.S │ └── rtlmem.S ├── plat ├── Makefile ├── Makefile.inc ├── beagbone │ ├── Makefile │ ├── acpi │ │ ├── Makefile │ │ ├── am33.asl │ │ ├── build.ck │ │ ├── dbg2.asl │ │ ├── dsdt.asl │ │ ├── facp.asl │ │ └── facs.asl │ ├── armv7 │ │ └── entry.S │ ├── bbonefw.h │ ├── bbonefwv.S │ ├── build.ck │ ├── clock.c │ ├── debug.c │ ├── fwvol.c │ ├── i2c.c │ ├── init │ │ ├── Makefile │ │ ├── armv7 │ │ │ └── start.S │ │ ├── bbonefwb │ │ │ ├── Makefile │ │ │ └── fwbuild.c │ │ ├── boot.c │ │ ├── build.ck │ │ ├── clock.c │ │ ├── init.h │ │ ├── mux.c │ │ ├── power.c │ │ └── serial.c │ ├── intr.c │ ├── main.c │ ├── memmap.c │ ├── ramdenum.c │ ├── ramdisk.S │ ├── runtime │ │ ├── Makefile │ │ ├── build.ck │ │ ├── reboot.c │ │ ├── rtc.c │ │ └── runtime.c │ ├── sd.c │ ├── serial.c │ ├── smbios.c │ ├── timer.c │ └── video.c ├── bios │ ├── Makefile │ ├── acpi.c │ ├── bioscall.c │ ├── biosfw.h │ ├── biosfwv.S │ ├── build.ck │ ├── debug.c │ ├── disk.c │ ├── fwvol.c │ ├── intr.c │ ├── main.c │ ├── memmap.c │ ├── runtime │ │ ├── Makefile │ │ ├── build.ck │ │ ├── reboot.c │ │ └── runtime.c │ ├── timer.c │ ├── video.c │ └── x86 │ │ ├── entry.S │ │ └── realmexe.S ├── cb │ ├── Makefile.inc │ ├── acpi.c │ ├── cbfw.h │ ├── disk.c │ ├── fwvol.c │ ├── main.c │ ├── memmap.c │ ├── runtime │ │ ├── reboot.c │ │ └── runtime.c │ └── timer.c ├── common ├── integcp │ ├── Makefile │ ├── acpi │ │ ├── Makefile │ │ ├── build.ck │ │ ├── dbg2.asl │ │ ├── dsdt.asl │ │ ├── facp.asl │ │ ├── facs.asl │ │ └── incp.asl │ ├── armv7 │ │ └── entry.S │ ├── build.ck │ ├── debug.c │ ├── fwvol.c │ ├── integfw.h │ ├── integfwv.S │ ├── intr.c │ ├── main.c │ ├── memmap.c │ ├── ramdenum.c │ ├── ramdisk.S │ ├── runtime │ │ ├── Makefile │ │ ├── build.ck │ │ ├── rtc.c │ │ └── runtime.c │ ├── serial.c │ ├── smbios.c │ ├── timer.c │ └── video.c ├── panda │ ├── Makefile │ ├── acpi │ │ ├── Makefile │ │ ├── apic.asl │ │ ├── build.ck │ │ ├── dbg2.asl │ │ ├── dsdt.asl │ │ ├── facp.asl │ │ ├── facs.asl │ │ └── omp4.asl │ ├── armv7 │ │ ├── entry.S │ │ └── smpa.S │ ├── build.ck │ ├── debug.c │ ├── fwvol.c │ ├── init │ │ ├── Makefile │ │ ├── armv7 │ │ │ └── start.S │ │ ├── boot.c │ │ ├── build.ck │ │ ├── clock.c │ │ ├── crc32.c │ │ ├── fatboot.c │ │ ├── fwbuild │ │ │ ├── Makefile │ │ │ └── fwbuild.c │ │ ├── gpio.c │ │ ├── id.c │ │ ├── init.h │ │ ├── mux.c │ │ ├── rommem.c │ │ ├── romusb.c │ │ ├── serial.c │ │ └── util.h │ ├── intr.c │ ├── main.c │ ├── memmap.c │ ├── omap4usb.c │ ├── pandafw.h │ ├── pandafwv.S │ ├── ramdenum.c │ ├── ramdisk.S │ ├── runtime │ │ ├── Makefile │ │ ├── build.ck │ │ ├── i2c.c │ │ ├── pmic.c │ │ ├── reboot.c │ │ ├── rtc.c │ │ └── runtime.c │ ├── sd.c │ ├── serial.c │ ├── smbios.c │ ├── smp.c │ ├── timer.c │ ├── twl6030.h │ └── video.c ├── rpi │ ├── Makefile │ ├── acpi │ │ ├── Makefile │ │ ├── bcm2.asl │ │ ├── build.ck │ │ ├── dbg2.asl │ │ ├── dsdt.asl │ │ ├── facp.asl │ │ └── facs.asl │ ├── armv6 │ │ └── entry.S │ ├── blobs │ │ └── Makefile │ ├── build.ck │ ├── debug.c │ ├── fwvol.c │ ├── intr.c │ ├── main.c │ ├── memmap.c │ ├── ramdenum.c │ ├── rpifw.h │ ├── rpifwv.S │ ├── runtime │ │ ├── Makefile │ │ ├── build.ck │ │ └── runtime.c │ ├── smbios.c │ └── timer.c ├── rpi2 │ ├── Makefile │ ├── acpi │ │ ├── Makefile │ │ ├── bcm2.asl │ │ ├── build.ck │ │ ├── dbg2.asl │ │ ├── dsdt.asl │ │ ├── facp.asl │ │ ├── facs.asl │ │ └── gtdt.asl │ ├── armv7 │ │ ├── entry.S │ │ ├── smpa.S │ │ └── timera.S │ ├── blobs │ │ ├── LICENCE.broadcom │ │ ├── Makefile │ │ ├── bootcode.bin │ │ ├── build.ck │ │ ├── config.txt │ │ ├── fixup.dat │ │ └── start.elf │ ├── build.ck │ ├── debug.c │ ├── fwvol.c │ ├── intr.c │ ├── main.c │ ├── memmap.c │ ├── ramdenum.c │ ├── rpi2fw.h │ ├── rpi2fwv.S │ ├── runtime │ │ ├── Makefile │ │ ├── build.ck │ │ └── runtime.c │ ├── smbios.c │ ├── smp.c │ └── timer.c └── veyron │ ├── Makefile │ ├── acpi │ ├── Makefile │ ├── apic.asl │ ├── build.ck │ ├── dbg2.asl │ ├── dsdt.asl │ ├── facp.asl │ ├── facs.asl │ ├── gtdt.asl │ └── rk32.asl │ ├── armv7 │ ├── entry.S │ ├── minttbl.S │ ├── smp.inc │ └── smpa.S │ ├── build.ck │ ├── debug.c │ ├── fwbuild │ ├── Makefile │ ├── build.ck │ └── fwbuild.c │ ├── fwvol.c │ ├── intr.c │ ├── main.c │ ├── memmap.c │ ├── ramdenum.c │ ├── runtime │ ├── Makefile │ ├── build.ck │ ├── i2c.c │ ├── pmic.c │ ├── reboot.c │ ├── rtc.c │ └── runtime.c │ ├── sd.c │ ├── serial.c │ ├── smbios.c │ ├── smp.c │ ├── timer.c │ ├── usb.c │ ├── veyron.kbk │ ├── veyron.pem │ ├── veyronfw.h │ ├── veyronfwv.S │ └── video.c ├── tools ├── Makefile ├── build.ck ├── elfconv │ ├── Makefile │ ├── build.ck │ ├── elfc32.c │ ├── elfconv.c │ ├── elfconv.h │ └── elfimage.h ├── genffs │ ├── Makefile │ ├── build.ck │ └── genffs.c ├── genfv │ ├── Makefile │ ├── build.ck │ └── genfv.c └── mkuboot │ ├── Makefile │ ├── build.ck │ └── mkuboot.c └── util ├── artecimage.c ├── kconfig ├── Makefile ├── POTFILES.in ├── check.sh ├── conf.c ├── confdata.c ├── expr.c ├── expr.h ├── gconf.c ├── gconf.glade ├── images.c ├── kconfig_load.c ├── kxgettext.c ├── lex.zconf.c_shipped ├── lkc.h ├── lkc_proto.h ├── lxdialog │ ├── BIG.FAT.WARNING │ ├── check-lxdialog.sh │ ├── checklist.c │ ├── dialog.h │ ├── inputbox.c │ ├── menubox.c │ ├── textbox.c │ ├── util.c │ └── yesno.c ├── mconf.c ├── menu.c ├── qconf.cc ├── qconf.h ├── regex.c ├── regex.h ├── symbol.c ├── util.c ├── zconf.gperf ├── zconf.hash.c_shipped ├── zconf.l ├── zconf.tab.c_shipped └── zconf.y └── xcompile └── xcompile /.circleci/.config: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated make config: don't edit 3 | # FILO version: 0.0.1 4 | # Tue Jul 11 17:46:21 2017 5 | # 6 | CONFIG_TARGET_I386=y 7 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | working_directory: /root 5 | docker: 6 | - image: retrage/coreboot:4.6 7 | steps: 8 | - run: 9 | name: Setup directories 10 | command: | 11 | mkdir -p /home/coreboot/Dropbox/src/minoca/os/ 12 | - run: 13 | name: Clone repositories 14 | command: | 15 | git clone --depth 1 -b circleci \ 16 | https://github.com/yabits/uefi.git \ 17 | ~/Dropbox/src/minoca/os/uefi 18 | - run: 19 | name: Setup files 20 | command: | 21 | cp ~/Dropbox/src/minoca/os/uefi/.circleci/.config \ 22 | ~/Dropbox/src/minoca/os/uefi/; 23 | cp ~/Dropbox/src/minoca/os/uefi/.circleci/lib.config \ 24 | ~/Dropbox/src/minoca/os/uefi/; 25 | - run: 26 | name: Build yabits/uefi 27 | command: | 28 | make -C ~/Dropbox/src/minoca/os/uefi 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .xcompile 2 | build/* 3 | *.o 4 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:17.04 2 | 3 | RUN apt update &&\ 4 | apt install -y bison build-essential curl flex git gnat-5 \ 5 | libncurses5-dev m4 zlib1g-dev && \ 6 | mkdir -p /root/src && \ 7 | git clone --depth 1 -b 4.6 \ 8 | https://github.com/coreboot/coreboot.git ~/src/coreboot && \ 9 | make -C ~/src/coreboot crossgcc-i386 CPUS=$(nproc) 10 | -------------------------------------------------------------------------------- /Kconfig: -------------------------------------------------------------------------------- 1 | ## 2 | ## Copyright (C) 2008-2009 coresystems GmbH 3 | ## 4 | 5 | mainmenu "FILO Configuration" 6 | 7 | choice 8 | prompt "Build for architecture" 9 | default TARGET_I386 10 | 11 | config TARGET_I386 12 | bool "x86" 13 | 14 | config TARGET_X64 15 | bool "x64" 16 | 17 | endchoice 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # yabits/uefi [![CircleCI](https://circleci.com/gh/yabits/uefi.svg?style=shield)](https://circleci.com/gh/yabits/uefi) 2 | 3 | > :warning: yabits/uefi is no longer maintained. This repository is archived. 4 | 5 | A minoca based UEFI coreboot payload (WIP) 6 | 7 | [yabits/uefi](https://github.com/yabits/uefi) is an UEFI coreboot payload. 8 | The code is based on the part of [Minoca OS](https://github.com/minoca/os). 9 | Minoca OS has minimal UEFI implementation for some platforms, 10 | like BeagleBone Black, Paspberry Pi and Legacy BIOS. 11 | This project is trying to port the code base to coreboot as a payload. 12 | Our goal is running Linux, \*BSDs and other bootloaders from this firmware. 13 | 14 | ## Building 15 | 16 | Before building, clone 17 | [coreboot](http://review.coreboot.org/p/coreboot) 18 | and build 19 | [Libpayload](https://www.coreboot.org/Libpayload). 20 | 21 | ``` 22 | $ git clone https://github.com/yabits/uefi.git 23 | $ cd uefi 24 | $ make menuconfig 25 | $ make 26 | ``` 27 | 28 | ## License 29 | 30 | Most of the code comes from Minoca OS, licensed under 31 | the terms of GNU General Public License, version 3. 32 | Some code is from [FILO](http://review.coreboot.org/p/filo.git), 33 | licensed under the terms of GNU Public License, version 2. 34 | See the header of source code files for more details. 35 | -------------------------------------------------------------------------------- /archlib/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # Architecture support 13 | # 14 | # Abstract: 15 | # 16 | # This module contains architecure-specific UEFI core support functions. 17 | # 18 | # Author: 19 | # 20 | # Evan Green 27-Mar-2014 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | BINARY = uefiarch.a 29 | 30 | BINARYTYPE = library 31 | 32 | INCLUDES += $(SRCROOT)/os/uefi/include;$(SRCROOT)/os/uefi/core; 33 | 34 | X86_OBJS = x86/archlib.o \ 35 | x86/archsup.o \ 36 | x86/ioport.o \ 37 | x86/regacces.o \ 38 | 39 | ARMV7_OBJS = armv7/archlib.o \ 40 | armv7/archsup.o \ 41 | armv7/regacces.o \ 42 | 43 | ARMV6_OBJS = armv7/archlib.o \ 44 | armv6/archsup.o \ 45 | armv7/regacces.o \ 46 | 47 | EXTRA_SRC_DIRS = x86 armv7 armv6 48 | 49 | include $(SRCROOT)/os/minoca.mk 50 | 51 | CFLAGS += -fshort-wchar 52 | 53 | -------------------------------------------------------------------------------- /archlib/x86/Makefile.inc: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 by coresystems GmbH 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 | # 18 | 19 | TARGETS-y += archlib/x86/archlib.o archlib/x86/regacces.o 20 | TARGETS-y += archlib/x86/archsup.S.o archlib/x86/ioport.S.o 21 | -------------------------------------------------------------------------------- /archlib/x86/archlib.c: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | archlib.c 13 | 14 | Abstract: 15 | 16 | This module implements the UEFI architecture support library C routines. 17 | 18 | Author: 19 | 20 | Evan Green 27-Mar-2014 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | // 29 | // ------------------------------------------------------------------- Includes 30 | // 31 | 32 | #include "ueficore.h" 33 | 34 | // 35 | // ---------------------------------------------------------------- Definitions 36 | // 37 | 38 | // 39 | // ------------------------------------------------------ Data Type Definitions 40 | // 41 | 42 | // 43 | // ----------------------------------------------- Internal Function Prototypes 44 | // 45 | 46 | // 47 | // -------------------------------------------------------------------- Globals 48 | // 49 | 50 | // 51 | // ------------------------------------------------------------------ Functions 52 | // 53 | 54 | VOID 55 | EfiCoreInvalidateInstructionCacheRange ( 56 | VOID *Address, 57 | UINTN Length 58 | ) 59 | 60 | /*++ 61 | 62 | Routine Description: 63 | 64 | This routine invalidates a region of memory in the instruction cache. 65 | 66 | Arguments: 67 | 68 | Address - Supplies the address to invalidate. If translation is enabled, 69 | this is a virtual address. 70 | 71 | Length - Supplies the number of bytes in the region to invalidate. 72 | 73 | Return Value: 74 | 75 | None. 76 | 77 | --*/ 78 | 79 | { 80 | 81 | return; 82 | } 83 | 84 | // 85 | // --------------------------------------------------------- Internal Functions 86 | // 87 | 88 | -------------------------------------------------------------------------------- /archlib/x86/archsup.S: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | archsup.S 13 | 14 | Abstract: 15 | 16 | This module architecture specific support routines. 17 | 18 | Author: 19 | 20 | Evan Green 7-Apr-2014 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | ## 29 | ## ------------------------------------------------------------------ Includes 30 | ## 31 | 32 | #include 33 | 34 | ## 35 | ## ---------------------------------------------------------------------- Code 36 | ## 37 | 38 | ## 39 | ## .text specifies that this code belongs in the executable section. 40 | ## 41 | ## .code32 specifies that this is 32-bit protected mode code. 42 | ## 43 | 44 | .text 45 | .code32 46 | 47 | ## 48 | ## VOID 49 | ## EfiMemoryBarrier ( 50 | ## VOID 51 | ## ) 52 | ## 53 | 54 | /*++ 55 | 56 | Routine Description: 57 | 58 | This routine provides a full memory barrier, ensuring that all memory 59 | accesses occurring before this function complete before any memory accesses 60 | after this function start. 61 | 62 | Arguments: 63 | 64 | None. 65 | 66 | Return Value: 67 | 68 | None. 69 | 70 | --*/ 71 | 72 | FUNCTION(EfiMemoryBarrier) 73 | sub $4, %esp 74 | lock add $1, (%esp) 75 | add $4, %esp 76 | ret 77 | 78 | END_FUNCTION(EfiMemoryBarrier) 79 | 80 | ## 81 | ## --------------------------------------------------------- Internal Functions 82 | ## 83 | 84 | -------------------------------------------------------------------------------- /archlib/x86_64/Makefile.inc: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 by coresystems GmbH 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 | # 18 | 19 | TARGETS-y += archlib/x86_64/archlib.o archlib/x86_64/regacces.o 20 | TARGETS-y += archlib/x86_64/archsup.S.o archlib/x86_64/ioport.S.o 21 | -------------------------------------------------------------------------------- /archlib/x86_64/archlib.c: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | archlib.c 13 | 14 | Abstract: 15 | 16 | This module implements the UEFI architecture support library C routines. 17 | 18 | Author: 19 | 20 | Evan Green 27-Mar-2014 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | // 29 | // ------------------------------------------------------------------- Includes 30 | // 31 | 32 | #include "ueficore.h" 33 | 34 | // 35 | // ---------------------------------------------------------------- Definitions 36 | // 37 | 38 | // 39 | // ------------------------------------------------------ Data Type Definitions 40 | // 41 | 42 | // 43 | // ----------------------------------------------- Internal Function Prototypes 44 | // 45 | 46 | // 47 | // -------------------------------------------------------------------- Globals 48 | // 49 | 50 | // 51 | // ------------------------------------------------------------------ Functions 52 | // 53 | 54 | VOID 55 | EfiCoreInvalidateInstructionCacheRange ( 56 | VOID *Address, 57 | UINTN Length 58 | ) 59 | 60 | /*++ 61 | 62 | Routine Description: 63 | 64 | This routine invalidates a region of memory in the instruction cache. 65 | 66 | Arguments: 67 | 68 | Address - Supplies the address to invalidate. If translation is enabled, 69 | this is a virtual address. 70 | 71 | Length - Supplies the number of bytes in the region to invalidate. 72 | 73 | Return Value: 74 | 75 | None. 76 | 77 | --*/ 78 | 79 | { 80 | 81 | return; 82 | } 83 | 84 | // 85 | // --------------------------------------------------------- Internal Functions 86 | // 87 | 88 | -------------------------------------------------------------------------------- /archlib/x86_64/archsup.S: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2017 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | archsup.S 13 | 14 | Abstract: 15 | 16 | This module implements x64 architecture specific support routines. 17 | 18 | Author: 19 | 20 | Evan Green 11-Aug-2017 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | // 29 | // ------------------------------------------------------------------ Includes 30 | // 31 | 32 | #include 33 | 34 | // 35 | // ---------------------------------------------------------------------- Code 36 | // 37 | 38 | ASSEMBLY_FILE_HEADER 39 | 40 | // 41 | // VOID 42 | // EfiMemoryBarrier ( 43 | // VOID 44 | // ) 45 | // 46 | 47 | /*++ 48 | 49 | Routine Description: 50 | 51 | This routine provides a full memory barrier, ensuring that all memory 52 | accesses occurring before this function complete before any memory accesses 53 | after this function start. 54 | 55 | Arguments: 56 | 57 | None. 58 | 59 | Return Value: 60 | 61 | None. 62 | 63 | --*/ 64 | 65 | FUNCTION(EfiMemoryBarrier) 66 | lock orq $0, (%rsp) 67 | retq 68 | 69 | END_FUNCTION(EfiMemoryBarrier) 70 | 71 | // 72 | // --------------------------------------------------------- Internal Functions 73 | // 74 | 75 | -------------------------------------------------------------------------------- /build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | UEFI 13 | 14 | Abstract: 15 | 16 | This directory builds UEFI firmware images for several platforms. 17 | 18 | Author: 19 | 20 | Evan Green 26-Feb-2014 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | from menv import group, mconfig; 29 | 30 | function build() { 31 | var arch = mconfig.arch; 32 | var entries; 33 | var platfw; 34 | 35 | if (arch == "armv7") { 36 | platfw = [ 37 | "uefi/plat/beagbone:bbonefw", 38 | "uefi/plat/beagbone/init:bbonemlo", 39 | "uefi/plat/panda/init:omap4mlo", 40 | "uefi/plat/panda:pandafw", 41 | "uefi/plat/rpi2:rpi2fw", 42 | "uefi/plat/veyron:veyronfw", 43 | ]; 44 | 45 | } else if (arch == "armv6") { 46 | platfw = [ 47 | "uefi/plat/rpi:rpifw" 48 | ]; 49 | 50 | } else if (arch == "x86") { 51 | platfw = [ 52 | "uefi/plat/bios:biosfw", 53 | ]; 54 | } 55 | 56 | entries = group("platfw", platfw); 57 | return entries; 58 | } 59 | 60 | -------------------------------------------------------------------------------- /configs/defconfig: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated make config: don't edit 3 | # FILO version: 0.6.0 4 | # Thu Jul 7 11:47:53 2011 5 | # 6 | CONFIG_TARGET_I386=y 7 | -------------------------------------------------------------------------------- /core/Makefile.inc: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 by coresystems GmbH 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 | # 18 | 19 | include core/rtlib/Makefile.inc 20 | include core/runtime/Makefile.inc 21 | include core/x86/Makefile.inc 22 | 23 | TARGETS-y += core/acpi.o core/acpitabs.o 24 | TARGETS-y += core/basepe.o core/bdsboot.o 25 | TARGETS-y += core/bdscon.o core/bdsentry.o 26 | TARGETS-y += core/bdsutil.o core/cfgtable.o 27 | TARGETS-y += core/crc32.o 28 | #TARGETS-y += core/dbgser.o core/devpathu.o 29 | TARGETS-y += core/devpathu.o 30 | TARGETS-y += core/diskio.o core/dispatch.o 31 | TARGETS-y += core/div.o core/drvsup.o 32 | TARGETS-y += core/event.o core/fatdev.o 33 | TARGETS-y += core/fatfs.o core/fsvars.o 34 | TARGETS-y += core/fvblock.o core/fvsect.o 35 | TARGETS-y += core/fwvol.o core/fwvolio.o 36 | TARGETS-y += core/handle.o core/image.o 37 | TARGETS-y += core/init.o core/intr.o 38 | TARGETS-y += core/locate.o core/lock.o 39 | TARGETS-y += core/memory.o core/part.o 40 | TARGETS-y += core/partelto.o core/partgpt.o 41 | TARGETS-y += core/partmbr.o core/pool.o 42 | TARGETS-y += core/ramdisk.o core/smbios.o 43 | # TARGETS-y += core/stubs.o core/tpl.o 44 | TARGETS-y += core/tpl.o 45 | TARGETS-y += core/timer.o core/util.o 46 | TARGETS-y += core/version.o core/vidcon.o 47 | #TARGETS-y += core/main.o 48 | TARGETS-y += core/blockdev.o 49 | TARGETS-y += core/serialcon.o 50 | -------------------------------------------------------------------------------- /core/armv7/inttable.S: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2013 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | inttable.S 13 | 14 | Abstract: 15 | 16 | This module implements the interrupt jump vector table for ARM processors. 17 | 18 | Author: 19 | 20 | Evan Green 14-Aug-2013 21 | 22 | Environment: 23 | 24 | Boot 25 | 26 | --*/ 27 | 28 | ## 29 | ## ---------------------------------------------------------------- Definitions 30 | ## 31 | 32 | #include 33 | 34 | ## 35 | ## ----------------------------------------------------------------------- Code 36 | ## 37 | 38 | ASSEMBLY_FILE_HEADER 39 | 40 | ## 41 | ## .global allows this label to be visible to the linker. 42 | ## 43 | 44 | .global EfiArmInterruptTable 45 | 46 | ## 47 | ## This address must be aligned to a 32 byte address so that it can be set in 48 | ## the VBAR register. 49 | ## 50 | 51 | .balign 32 52 | 53 | EfiArmInterruptTable: 54 | ldr %pc, EfiArmResetVector 55 | ldr %pc, EfiArmUndefinedInstructionVector 56 | ldr %pc, EfiArmSoftwareInterruptVector 57 | ldr %pc, EfiArmPrefetchAbortVector 58 | ldr %pc, EfiArmDataAbortVector 59 | .word 0 60 | ldr %pc, EfiArmIrqInterruptVector 61 | ldr %pc, EfiArmFiqInterruptVector 62 | 63 | EfiArmUndefinedInstructionVector: 64 | .word 0 65 | 66 | EfiArmSoftwareInterruptVector: 67 | .word 0 68 | 69 | EfiArmPrefetchAbortVector: 70 | .word 0 71 | 72 | EfiArmDataAbortVector: 73 | .word 0 74 | 75 | EfiArmIrqInterruptVector: 76 | .word 0 77 | 78 | EfiArmFiqInterruptVector: 79 | .word 0 80 | 81 | EfiArmResetVector: 82 | .word 0 83 | 84 | -------------------------------------------------------------------------------- /core/emptyrd/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # Empty RAM Disk 13 | # 14 | # Abstract: 15 | # 16 | # This file contains the symbols for a RAM disk image, but with nothing 17 | # in them. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 5-Oct-2016 22 | # 23 | # Environment: 24 | # 25 | # Firmware 26 | # 27 | ################################################################################ 28 | 29 | BINARY = emptyrd.a 30 | 31 | BINARYTYPE = library 32 | 33 | INCLUDES += $(SRCROOT)/os/uefi/include;.; 34 | 35 | OBJS = emptyrd.o \ 36 | 37 | include $(SRCROOT)/os/minoca.mk 38 | 39 | CFLAGS += -fshort-wchar 40 | 41 | -------------------------------------------------------------------------------- /core/emptyrd/emptyrd.S: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2016 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | emptyrd.S 13 | 14 | Abstract: 15 | 16 | This module adds the symbols for an empty RAM disk. 17 | 18 | Author: 19 | 20 | Evan Green 5-Oct-2016 21 | 22 | Environment: 23 | 24 | Any 25 | 26 | --*/ 27 | 28 | ## 29 | ## ---------------------------------------------------------------------- Code 30 | ## 31 | 32 | .text 33 | 34 | .global _binary_ramdisk_start 35 | _binary_ramdisk_start: 36 | .global _binary_ramdisk_end 37 | _binary_ramdisk_end: 38 | .byte 0 39 | 40 | -------------------------------------------------------------------------------- /core/main.c: -------------------------------------------------------------------------------- 1 | #include "ueficore.h" 2 | #include 3 | 4 | int main() 5 | { 6 | // all arguments are dummy 7 | EfiCoreMain( 8 | CONFIG_LP_BASE_ADDRESS, 9 | CONFIG_LP_BASE_ADDRESS, 10 | 4096, 11 | "UEFI", 12 | 4096, 13 | CONFIG_LP_STACK_SIZE 14 | ); 15 | 16 | // do not reach here 17 | halt(); 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /core/rtlib/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # UEFI Runtime Library 13 | # 14 | # Abstract: 15 | # 16 | # This file is responsible for building the core UEFI Runtime support, 17 | # which is compiled into most platform runtime images. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 18-Mar-2014 22 | # 23 | # Environment: 24 | # 25 | # Firmware 26 | # 27 | ################################################################################ 28 | 29 | BINARY = rtlib.a 30 | 31 | BINARYTYPE = library 32 | 33 | INCLUDES += $(SRCROOT)/os/uefi/include;$(SRCDIR)/..; 34 | 35 | OBJS = crc32.o \ 36 | div.o \ 37 | init.o \ 38 | time.o \ 39 | util.o \ 40 | var.o \ 41 | 42 | include $(SRCROOT)/os/minoca.mk 43 | 44 | VPATH += $(SRCDIR)/..: 45 | 46 | CFLAGS += -fshort-wchar 47 | 48 | -------------------------------------------------------------------------------- /core/rtlib/Makefile.inc: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 by coresystems GmbH 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 | # 18 | 19 | TARGETS-y += core/rtlib/init.o core/rtlib/time.o 20 | TARGETS-y += core/rtlib/var.o 21 | -------------------------------------------------------------------------------- /core/rtlib/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | UEFI Runtime Library 13 | 14 | Abstract: 15 | 16 | This file is responsible for building the core UEFI Runtime support, 17 | which is compiled into most platform runtime images. 18 | 19 | Author: 20 | 21 | Evan Green 18-Mar-2014 22 | 23 | Environment: 24 | 25 | Firmware 26 | 27 | --*/ 28 | 29 | from menv import staticLibrary; 30 | 31 | function build() { 32 | var entries; 33 | var includes; 34 | var lib; 35 | var sources; 36 | var sourcesConfig; 37 | 38 | sources = [ 39 | "uefi/core:crc32.o", 40 | "uefi/core:div.o", 41 | "init.c", 42 | "time.c", 43 | "uefi/core:util.o", 44 | "var.c" 45 | ]; 46 | 47 | includes = [ 48 | "$S/uefi/include", 49 | "$S/uefi/core" 50 | ]; 51 | 52 | sourcesConfig = { 53 | "CFLAGS": ["-fshort-wchar"], 54 | }; 55 | 56 | lib = { 57 | "label": "rtlib", 58 | "inputs": sources, 59 | "sources_config": sourcesConfig, 60 | "includes": includes 61 | }; 62 | 63 | entries = staticLibrary(lib); 64 | return entries; 65 | } 66 | 67 | -------------------------------------------------------------------------------- /core/runtime/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # Runtime Core 13 | # 14 | # Abstract: 15 | # 16 | # This module implements the UEFI core runtime support, which only 17 | # supports setting the virtual address map. It is implemented as a 18 | # separate runtime binary to avoid the paradox of ExitBootServices 19 | # and SetVirtualAddressMap trying to tear down or change themselves. 20 | # 21 | # Author: 22 | # 23 | # Evan Green 10-Mar-2014 24 | # 25 | # Environment: 26 | # 27 | # Firmware 28 | # 29 | ################################################################################ 30 | 31 | BINARY = rtbase.elf 32 | 33 | BINARYTYPE = staticapp 34 | 35 | BINPLACE = bin 36 | 37 | INCLUDES += $(SRCROOT)/os/uefi/include;..; 38 | 39 | OBJS = ../crc32.o \ 40 | runtime.o \ 41 | 42 | VPATH += $(BINROOT): 43 | 44 | ENTRY = EfiRuntimeDriverEntry 45 | 46 | LDFLAGS += -pie -nodefaultlibs -nostartfiles -nostdlib 47 | 48 | ifeq ($(ARCH), armv7) 49 | LINKER_SCRIPT = $(SRCROOT)/os/uefi/include/link_arm.x 50 | endif 51 | 52 | ifeq ($(ARCH), armv6) 53 | LINKER_SCRIPT = $(SRCROOT)/os/uefi/include/link_arm.x 54 | endif 55 | 56 | TARGETLIBS = $(OBJROOT)/os/uefi/archlib/uefiarch.a \ 57 | 58 | ## 59 | ## On architectures that produce ELF binaries, convert it to a PE image. 60 | ## 61 | 62 | postbuild: rtbase.ffs 63 | 64 | rtbase.ffs: rtbase 65 | @genffs -s -i $< -r EFI_SECTION_PE32 \ 66 | -i $< -r EFI_SECTION_USER_INTERFACE -t EFI_FV_FILETYPE_DRIVER -o $@ 67 | 68 | rtbase: $(BINARY) 69 | @elfconv -o $@ -t efiruntimedriver $< 70 | 71 | include $(SRCROOT)/os/minoca.mk 72 | 73 | CFLAGS += -fshort-wchar 74 | 75 | -------------------------------------------------------------------------------- /core/runtime/Makefile.inc: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 by coresystems GmbH 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 | # 18 | 19 | TARGETS-y += core/runtime/runtime.o 20 | -------------------------------------------------------------------------------- /core/x86/Makefile.inc: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 by coresystems GmbH 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 | # 18 | 19 | TARGETS-y += core/x86/archsup.S.o core/x86/prochw.o 20 | -------------------------------------------------------------------------------- /dev/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # Devices 13 | # 14 | # Abstract: 15 | # 16 | # This directory builds UEFI device support libraries. 17 | # 18 | # Author: 19 | # 20 | # Evan Green 27-Feb-2014 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | ifeq ($(ARCH), x86) 29 | 30 | DIRS += ns16550 \ 31 | 32 | endif 33 | 34 | ifeq ($(ARCH), armv7) 35 | 36 | DIRS += bcm2709 \ 37 | gic \ 38 | gt \ 39 | ns16550 \ 40 | omap4 \ 41 | omapuart \ 42 | pl031 \ 43 | pl11 \ 44 | pl110 \ 45 | sd \ 46 | 47 | endif 48 | 49 | ifeq ($(ARCH), armv6) 50 | 51 | DIRS += bcm2709 \ 52 | pl11 \ 53 | sd \ 54 | 55 | endif 56 | 57 | include $(SRCROOT)/os/minoca.mk 58 | 59 | -------------------------------------------------------------------------------- /dev/Makefile.inc: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 by coresystems GmbH 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 | # 18 | 19 | include dev/ide/Makefile.inc 20 | include dev/ahci/Makefile.inc 21 | -------------------------------------------------------------------------------- /dev/ahci/Makefile.inc: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 by coresystems GmbH 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 | # 18 | 19 | TARGETS-y += dev/ahci/ahci.o 20 | 21 | -------------------------------------------------------------------------------- /dev/bcm2709/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2015 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # BCM2709 UEFI Device Library 13 | # 14 | # Abstract: 15 | # 16 | # This library contains support for the BCM2709 SoC's devices. 17 | # 18 | # Author: 19 | # 20 | # Chris Stevens 18-Mar-2015 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | include $(SRCDIR)/../common 29 | 30 | BINARY = bcm2709.a 31 | 32 | BINARYTYPE = library 33 | 34 | OBJS = gpio.o \ 35 | init.o \ 36 | intr.o \ 37 | mailbox.o \ 38 | memmap.o \ 39 | sd.o \ 40 | serial.o \ 41 | timer.o \ 42 | usb.o \ 43 | video.o \ 44 | 45 | include $(SRCROOT)/os/minoca.mk 46 | 47 | -------------------------------------------------------------------------------- /dev/bcm2709/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2015 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | BCM2709 UEFI Device Library 13 | 14 | Abstract: 15 | 16 | This library contains support for the BCM2709 SoC's devices. 17 | 18 | Author: 19 | 20 | Chris Stevens 18-Mar-2015 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | from menv import staticLibrary; 29 | 30 | function build() { 31 | var entries; 32 | var includes; 33 | var lib; 34 | var sources; 35 | var sourcesConfig; 36 | 37 | sources = [ 38 | "gpio.c", 39 | "init.c", 40 | "intr.c", 41 | "mailbox.c", 42 | "memmap.c", 43 | "sd.c", 44 | "serial.c", 45 | "timer.c", 46 | "usb.c", 47 | "video.c", 48 | ]; 49 | 50 | includes = [ 51 | "$S/uefi/include" 52 | ]; 53 | 54 | sourcesConfig = { 55 | "CFLAGS": ["-fshort-wchar"], 56 | }; 57 | 58 | lib = { 59 | "label": "bcm2709", 60 | "inputs": sources, 61 | "sources_config": sourcesConfig, 62 | "includes": includes 63 | }; 64 | 65 | entries = staticLibrary(lib); 66 | return entries; 67 | } 68 | 69 | -------------------------------------------------------------------------------- /dev/common: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # Common UEFI device sources 13 | # 14 | # Abstract: 15 | # 16 | # This file includes common build arguments for all UEFI device libraries. 17 | # 18 | # Author: 19 | # 20 | # Evan Green 27-Feb-2014 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | INCLUDES += $(SRCROOT)/os/uefi/include; 29 | 30 | -------------------------------------------------------------------------------- /dev/gic/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # ARM GIC Interrupt Controller 13 | # 14 | # Abstract: 15 | # 16 | # This library contains the ARM Generic Interrupt Controller UEFI device. 17 | # 18 | # Author: 19 | # 20 | # Evan Green 3-Mar-2014 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | include $(SRCDIR)/../common 29 | 30 | BINARY = gic.a 31 | 32 | BINARYTYPE = library 33 | 34 | OBJS = gic.o \ 35 | 36 | include $(SRCROOT)/os/minoca.mk 37 | 38 | -------------------------------------------------------------------------------- /dev/gic/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | ARM GIC Interrupt Controller 13 | 14 | Abstract: 15 | 16 | This library contains the ARM Generic Interrupt Controller UEFI device. 17 | 18 | Author: 19 | 20 | Evan Green 3-Mar-2014 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | from menv import staticLibrary; 29 | 30 | function build() { 31 | var entries; 32 | var includes; 33 | var lib; 34 | var sources; 35 | var sourcesConfig; 36 | 37 | sources = [ 38 | "gic.c" 39 | ]; 40 | 41 | includes = [ 42 | "$S/uefi/include" 43 | ]; 44 | 45 | sourcesConfig = { 46 | "CFLAGS": ["-fshort-wchar"], 47 | }; 48 | 49 | lib = { 50 | "label": "gic", 51 | "inputs": sources, 52 | "sources_config": sourcesConfig, 53 | "includes": includes 54 | }; 55 | 56 | entries = staticLibrary(lib); 57 | return entries; 58 | } 59 | 60 | -------------------------------------------------------------------------------- /dev/gt/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2016 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # ARM Generic Timer 13 | # 14 | # Abstract: 15 | # 16 | # This library contains the ARM Generic Timer UEFI device. 17 | # 18 | # Author: 19 | # 20 | # Chris Stevens 9-Jun-2016 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | include $(SRCDIR)/../common 29 | 30 | BINARY = gt.a 31 | 32 | BINARYTYPE = library 33 | 34 | OBJS = gt.o \ 35 | gta.o \ 36 | 37 | include $(SRCROOT)/os/minoca.mk 38 | 39 | -------------------------------------------------------------------------------- /dev/gt/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2016 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | ARM Generic Timer 13 | 14 | Abstract: 15 | 16 | This library contains the ARM Generic Timer UEFI device. 17 | 18 | Author: 19 | 20 | Chris Stevens 9-Jun-2016 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | from menv import staticLibrary; 29 | 30 | function build() { 31 | var entries; 32 | var includes; 33 | var lib; 34 | var sources; 35 | var sourcesConfig; 36 | 37 | sources = [ 38 | "gt.c", 39 | "gta.S", 40 | ]; 41 | 42 | includes = [ 43 | "$S/uefi/include" 44 | ]; 45 | 46 | sourcesConfig = { 47 | "CFLAGS": ["-fshort-wchar"], 48 | }; 49 | 50 | lib = { 51 | "label": "gt", 52 | "inputs": sources, 53 | "sources_config": sourcesConfig, 54 | "includes": includes 55 | }; 56 | 57 | entries = staticLibrary(lib); 58 | return entries; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /dev/ide/Makefile.inc: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 by coresystems GmbH 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 | # 18 | 19 | TARGETS-y += dev/ide/ide_new.o 20 | 21 | -------------------------------------------------------------------------------- /dev/ns16550/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2015 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # NS 16550 UART 13 | # 14 | # Abstract: 15 | # 16 | # This library contains the NS 16550 UART controller library. 17 | # 18 | # Author: 19 | # 20 | # Chris Stevens 10-Jul-2015 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | include $(SRCDIR)/../common 29 | 30 | BINARY = ns16550.a 31 | 32 | BINARYTYPE = library 33 | 34 | OBJS = ns16550.o \ 35 | 36 | include $(SRCROOT)/os/minoca.mk 37 | 38 | -------------------------------------------------------------------------------- /dev/ns16550/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2015 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | NS 16550 UART 13 | 14 | Abstract: 15 | 16 | This library contains the NS 16550 UART controller library. 17 | 18 | Author: 19 | 20 | Chris Stevens 10-Jul-2015 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | from menv import staticLibrary; 29 | 30 | function build() { 31 | var entries; 32 | var includes; 33 | var lib; 34 | var sources; 35 | var sourcesConfig; 36 | 37 | sources = [ 38 | "ns16550.c" 39 | ]; 40 | 41 | includes = [ 42 | "$S/uefi/include" 43 | ]; 44 | 45 | sourcesConfig = { 46 | "CFLAGS": ["-fshort-wchar"], 47 | }; 48 | 49 | lib = { 50 | "label": "ns16550", 51 | "inputs": sources, 52 | "sources_config": sourcesConfig, 53 | "includes": includes 54 | }; 55 | 56 | entries = staticLibrary(lib); 57 | return entries; 58 | } 59 | 60 | -------------------------------------------------------------------------------- /dev/omap4/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # TI OMAP4 13 | # 14 | # Abstract: 15 | # 16 | # This library contains the OMAP4 UEFI device support. 17 | # 18 | # Author: 19 | # 20 | # Evan Green 3-Mar-2014 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | include $(SRCDIR)/../common 29 | 30 | BINARY = omap4.a 31 | 32 | BINARYTYPE = library 33 | 34 | OBJS = clock.o \ 35 | 36 | include $(SRCROOT)/os/minoca.mk 37 | 38 | -------------------------------------------------------------------------------- /dev/omap4/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | TI OMAP4 13 | 14 | Abstract: 15 | 16 | This library contains the OMAP4 UEFI device support. 17 | 18 | Author: 19 | 20 | Evan Green 3-Mar-2014 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | from menv import staticLibrary; 29 | 30 | function build() { 31 | var entries; 32 | var includes; 33 | var lib; 34 | var sources; 35 | var sourcesConfig; 36 | 37 | sources = [ 38 | "clock.c" 39 | ]; 40 | 41 | includes = [ 42 | "$S/uefi/include" 43 | ]; 44 | 45 | sourcesConfig = { 46 | "CFLAGS": ["-fshort-wchar"], 47 | }; 48 | 49 | lib = { 50 | "label": "omap4", 51 | "inputs": sources, 52 | "sources_config": sourcesConfig, 53 | "includes": includes 54 | }; 55 | 56 | entries = staticLibrary(lib); 57 | return entries; 58 | } 59 | 60 | -------------------------------------------------------------------------------- /dev/omapuart/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # OMAP UART 13 | # 14 | # Abstract: 15 | # 16 | # This library contains the UART controller library used in Texas 17 | # Instruments OMAP3 and OMAP4 SoCs. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 27-Feb-2014 22 | # 23 | # Environment: 24 | # 25 | # Firmware 26 | # 27 | ################################################################################ 28 | 29 | include $(SRCDIR)/../common 30 | 31 | BINARY = omapuart.a 32 | 33 | BINARYTYPE = library 34 | 35 | OBJS = omapuart.o \ 36 | 37 | include $(SRCROOT)/os/minoca.mk 38 | 39 | -------------------------------------------------------------------------------- /dev/omapuart/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | OMAP UART 13 | 14 | Abstract: 15 | 16 | This library contains the UART controller library used in Texas 17 | Instruments OMAP3 and OMAP4 SoCs. 18 | 19 | Author: 20 | 21 | Evan Green 27-Feb-2014 22 | 23 | Environment: 24 | 25 | Firmware 26 | 27 | --*/ 28 | 29 | from menv import staticLibrary; 30 | 31 | function build() { 32 | var entries; 33 | var includes; 34 | var lib; 35 | var sources; 36 | var sourcesConfig; 37 | 38 | sources = [ 39 | "omapuart.c" 40 | ]; 41 | 42 | includes = [ 43 | "$S/uefi/include" 44 | ]; 45 | 46 | sourcesConfig = { 47 | "CFLAGS": ["-fshort-wchar"], 48 | }; 49 | 50 | lib = { 51 | "label": "omapuart", 52 | "inputs": sources, 53 | "sources_config": sourcesConfig, 54 | "includes": includes 55 | }; 56 | 57 | entries = staticLibrary(lib); 58 | return entries; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /dev/pl031/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # PL-031 RTC 13 | # 14 | # Abstract: 15 | # 16 | # This library contains the ARM PrimeCell PL-031 Real Time Clock 17 | # device support. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 7-Apr-2014 22 | # 23 | # Environment: 24 | # 25 | # Firmware 26 | # 27 | ################################################################################ 28 | 29 | include $(SRCDIR)/../common 30 | 31 | BINARY = pl031.a 32 | 33 | BINARYTYPE = library 34 | 35 | OBJS = pl031.o \ 36 | 37 | include $(SRCROOT)/os/minoca.mk 38 | 39 | -------------------------------------------------------------------------------- /dev/pl031/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | PL-031 RTC 13 | 14 | Abstract: 15 | 16 | This library contains the ARM PrimeCell PL-031 Real Time Clock 17 | device support. 18 | 19 | Author: 20 | 21 | Evan Green 7-Apr-2014 22 | 23 | Environment: 24 | 25 | Firmware 26 | 27 | --*/ 28 | 29 | from menv import staticLibrary; 30 | 31 | function build() { 32 | var entries; 33 | var includes; 34 | var lib; 35 | var sources; 36 | var sourcesConfig; 37 | 38 | sources = [ 39 | "pl031.c" 40 | ]; 41 | 42 | includes = [ 43 | "$S/uefi/include" 44 | ]; 45 | 46 | sourcesConfig = { 47 | "CFLAGS": ["-fshort-wchar"], 48 | }; 49 | 50 | lib = { 51 | "label": "pl031", 52 | "inputs": sources, 53 | "sources_config": sourcesConfig, 54 | "includes": includes 55 | }; 56 | 57 | entries = staticLibrary(lib); 58 | return entries; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /dev/pl11/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # PL-011 UART 13 | # 14 | # Abstract: 15 | # 16 | # This library contains the ARM PrimeCell PL-011 UART controller library. 17 | # 18 | # Author: 19 | # 20 | # Evan Green 27-Feb-2014 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | include $(SRCDIR)/../common 29 | 30 | BINARY = pl11.a 31 | 32 | BINARYTYPE = library 33 | 34 | OBJS = pl11.o \ 35 | 36 | include $(SRCROOT)/os/minoca.mk 37 | 38 | -------------------------------------------------------------------------------- /dev/pl11/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | PL-011 UART 13 | 14 | Abstract: 15 | 16 | This library contains the ARM PrimeCell PL-011 UART controller library. 17 | 18 | Author: 19 | 20 | Evan Green 27-Feb-2014 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | from menv import staticLibrary; 29 | 30 | function build() { 31 | var entries; 32 | var includes; 33 | var lib; 34 | var sources; 35 | var sourcesConfig; 36 | 37 | sources = [ 38 | "pl11.c" 39 | ]; 40 | 41 | includes = [ 42 | "$S/uefi/include" 43 | ]; 44 | 45 | sourcesConfig = { 46 | "CFLAGS": ["-fshort-wchar"], 47 | }; 48 | 49 | lib = { 50 | "label": "pl11", 51 | "inputs": sources, 52 | "sources_config": sourcesConfig, 53 | "includes": includes 54 | }; 55 | 56 | entries = staticLibrary(lib); 57 | return entries; 58 | } 59 | 60 | -------------------------------------------------------------------------------- /dev/pl110/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # PL-110 Video 13 | # 14 | # Abstract: 15 | # 16 | # This library contains the ARM PL-110 Video Controller device support. 17 | # 18 | # Author: 19 | # 20 | # Evan Green 7-Apr-2014 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | include $(SRCDIR)/../common 29 | 30 | BINARY = pl110.a 31 | 32 | BINARYTYPE = library 33 | 34 | OBJS = pl110.o \ 35 | 36 | include $(SRCROOT)/os/minoca.mk 37 | 38 | -------------------------------------------------------------------------------- /dev/pl110/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | PL-110 Video 13 | 14 | Abstract: 15 | 16 | This library contains the ARM PL-110 Video Controller device support. 17 | 18 | Author: 19 | 20 | Evan Green 7-Apr-2014 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | from menv import staticLibrary; 29 | 30 | function build() { 31 | var entries; 32 | var includes; 33 | var lib; 34 | var sources; 35 | var sourcesConfig; 36 | 37 | sources = [ 38 | "pl110.c" 39 | ]; 40 | 41 | includes = [ 42 | "$S/uefi/include" 43 | ]; 44 | 45 | sourcesConfig = { 46 | "CFLAGS": ["-fshort-wchar"], 47 | }; 48 | 49 | lib = { 50 | "label": "pl110", 51 | "inputs": sources, 52 | "sources_config": sourcesConfig, 53 | "includes": includes 54 | }; 55 | 56 | entries = staticLibrary(lib); 57 | return entries; 58 | } 59 | 60 | -------------------------------------------------------------------------------- /dev/sd/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2015 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # SD Devices 13 | # 14 | # Abstract: 15 | # 16 | # This directory builds UEFI SD device support libraries. 17 | # 18 | # Author: 19 | # 20 | # Chris Stevens 17-Jul-2015 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | DIRS += core \ 29 | dwc \ 30 | 31 | include $(SRCROOT)/os/minoca.mk 32 | 33 | -------------------------------------------------------------------------------- /dev/sd/core/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # SD 13 | # 14 | # Abstract: 15 | # 16 | # This library contains the generic Secure Digital (card) controller 17 | # device. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 20-Mar-2014 22 | # 23 | # Environment: 24 | # 25 | # Firmware 26 | # 27 | ################################################################################ 28 | 29 | include $(SRCDIR)/../../common 30 | 31 | BINARY = sd.a 32 | 33 | BINARYTYPE = library 34 | 35 | OBJS = sd.o \ 36 | sdstd.o \ 37 | 38 | include $(SRCROOT)/os/minoca.mk 39 | 40 | -------------------------------------------------------------------------------- /dev/sd/core/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | SD Core 13 | 14 | Abstract: 15 | 16 | This library contains the generic Secure Digital (card) controller 17 | device. 18 | 19 | Author: 20 | 21 | Evan Green 20-Mar-2014 22 | 23 | Environment: 24 | 25 | Firmware 26 | 27 | --*/ 28 | 29 | from menv import staticLibrary; 30 | 31 | function build() { 32 | var entries; 33 | var includes; 34 | var lib; 35 | var sources; 36 | var sourcesConfig; 37 | 38 | sources = [ 39 | "sd.c", 40 | "sdstd.c" 41 | ]; 42 | 43 | includes = [ 44 | "$S/uefi/include" 45 | ]; 46 | 47 | sourcesConfig = { 48 | "CFLAGS": ["-fshort-wchar"], 49 | }; 50 | 51 | lib = { 52 | "label": "sd", 53 | "inputs": sources, 54 | "sources_config": sourcesConfig, 55 | "includes": includes 56 | }; 57 | 58 | entries = staticLibrary(lib); 59 | return entries; 60 | } 61 | 62 | -------------------------------------------------------------------------------- /dev/sd/dwc/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2015 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # SD DesignWare 13 | # 14 | # Abstract: 15 | # 16 | # This library contains the DesignWare Secure Digital (card) controller 17 | # device. 18 | # 19 | # Author: 20 | # 21 | # Chris Stevens 16-Jul-2015 22 | # 23 | # Environment: 24 | # 25 | # Firmware 26 | # 27 | ################################################################################ 28 | 29 | include $(SRCDIR)/../../common 30 | 31 | BINARY = sddwc.a 32 | 33 | BINARYTYPE = library 34 | 35 | OBJS = sddwc.o \ 36 | 37 | include $(SRCROOT)/os/minoca.mk 38 | 39 | -------------------------------------------------------------------------------- /dev/sd/dwc/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2015 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | SD DesignWare 13 | 14 | Abstract: 15 | 16 | This library contains the DesignWare Secure Digital (card) controller 17 | device. 18 | 19 | Author: 20 | 21 | Chris Stevens 16-Jul-2015 22 | 23 | Environment: 24 | 25 | Firmware 26 | 27 | --*/ 28 | 29 | from menv import staticLibrary; 30 | 31 | function build() { 32 | var entries; 33 | var includes; 34 | var lib; 35 | var sources; 36 | var sourcesConfig; 37 | 38 | sources = [ 39 | "sddwc.c" 40 | ]; 41 | 42 | includes = [ 43 | "$S/uefi/include" 44 | ]; 45 | 46 | sourcesConfig = { 47 | "CFLAGS": ["-fshort-wchar"], 48 | }; 49 | 50 | lib = { 51 | "label": "sddwc", 52 | "inputs": sources, 53 | "sources_config": sourcesConfig, 54 | "includes": includes 55 | }; 56 | 57 | entries = staticLibrary(lib); 58 | return entries; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /include/blockdev/container_of.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * See file CREDITS for list of people who contributed to this 5 | * project. 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License as 9 | * published by the Free Software Foundation; either version 2 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but without any warranty; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | */ 17 | 18 | #ifndef __BASE_CONTAINER_OF_H__ 19 | #define __BASE_CONTAINER_OF_H__ 20 | 21 | #include 22 | #include 23 | 24 | #define container_of(ptr, type, member) ({ \ 25 | const typeof(((type *)0)->member) *__mptr = (ptr); \ 26 | (type *)((uint8_t *)__mptr - offsetof(type, member) );}) \ 27 | 28 | #endif /* __BASE_CONTAINER_OF_H__ */ 29 | -------------------------------------------------------------------------------- /include/blockdev/list.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * See file CREDITS for list of people who contributed to this 5 | * project. 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License as 9 | * published by the Free Software Foundation; either version 2 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but without any warranty; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | */ 17 | 18 | #ifndef __BASE_LIST_H__ 19 | #define __BASE_LIST_H__ 20 | 21 | #include 22 | #include 23 | 24 | #include "blockdev/container_of.h" 25 | 26 | typedef struct ListNode { 27 | struct ListNode *next; 28 | struct ListNode *prev; 29 | } ListNode; 30 | 31 | // Remove ListNode node from the doubly linked list it's a part of. 32 | void list_remove(ListNode *node); 33 | // Insert ListNode node after ListNode after in a doubly linked list. 34 | void list_insert_after(ListNode *node, ListNode *after); 35 | // Insert ListNode node before ListNode before in a doubly linked list. 36 | void list_insert_before(ListNode *node, ListNode *before); 37 | 38 | #define list_for_each(ptr, head, member) \ 39 | for ((ptr) = container_of((head).next, typeof(*(ptr)), member); \ 40 | &((ptr)->member); \ 41 | (ptr) = container_of((ptr)->member.next, \ 42 | typeof(*(ptr)), member)) 43 | 44 | #endif /* __BASE_LIST_H__ */ 45 | -------------------------------------------------------------------------------- /include/blockdev/stream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Google Inc. 3 | * 4 | * See file CREDITS for list of people who contributed to this 5 | * project. 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License as 9 | * published by the Free Software Foundation; either version 2 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but without any warranty; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | */ 17 | 18 | #ifndef __DRIVERS_STORAGE_STREAM_H__ 19 | #define __DRIVERS_STORAGE_STREAM_H__ 20 | 21 | #include 22 | 23 | /* 24 | * StreamOps is a single-use stream. You open it from a StreamCtrlr with a 25 | * particular offset and size, and do successive reads to it until it is 26 | * exhausted. The offset and size are in terms of physical parameters for 27 | * the underlying medium and the size found in practice may be smaller, 28 | * e.g., due to skipping bad blocks on NAND. 29 | */ 30 | typedef struct StreamOps { 31 | uint64_t (*read)(struct StreamOps *me, uint64_t count, 32 | void *buffer); 33 | void (*close)(struct StreamOps *me); 34 | } StreamOps; 35 | 36 | /* Lazily initialized representation of a device; factory for streams to 37 | * read part of the device */ 38 | typedef struct StreamCtrlr { 39 | /* Create a new StreamOps */ 40 | StreamOps *(*open)(struct StreamCtrlr *me, uint64_t offset, 41 | uint64_t size); 42 | /* Get the size of the underlying device in bytes, i.e., the upper 43 | * bound for offset+size in open() calls */ 44 | uint64_t (*size)(struct StreamCtrlr *me); 45 | } StreamCtrlr; 46 | 47 | #endif /* __DRIVERS_STORAGE_STREAM_H__ */ 48 | 49 | -------------------------------------------------------------------------------- /include/dev/omap4.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | omap4.h 13 | 14 | Abstract: 15 | 16 | This header contains definitions for the TI OMAP4 UEFI device library. 17 | 18 | Author: 19 | 20 | Evan Green 3-Mar-2014 21 | 22 | --*/ 23 | 24 | // 25 | // ------------------------------------------------------------------- Includes 26 | // 27 | 28 | // 29 | // ---------------------------------------------------------------- Definitions 30 | // 31 | 32 | // 33 | // Define the OMAP4 SD vendor specific interrupt status bits. 34 | // 35 | 36 | #define SD_OMAP4_INTERRUPT_STATUS_CARD_ERROR (1 << 28) 37 | #define SD_OMAP4_INTERRUPT_STATUS_BAD_ACCESS_ERROR (1 << 29) 38 | 39 | // 40 | // Define the OMAP4 SD vendor specific interrupt signal and status enable bits. 41 | // 42 | 43 | #define SD_OMAP4_INTERRUPT_ENABLE_ERROR_CARD (1 << 28) 44 | #define SD_OMAP4_INTERRUPT_ENABLE_ERROR_BAD_ACCESS (1 << 29) 45 | 46 | // 47 | // ------------------------------------------------------ Data Type Definitions 48 | // 49 | 50 | // 51 | // -------------------------------------------------------------------- Globals 52 | // 53 | 54 | // 55 | // -------------------------------------------------------- Function Prototypes 56 | // 57 | 58 | VOID 59 | EfipOmap4InitializePowerAndClocks ( 60 | VOID 61 | ); 62 | 63 | /*++ 64 | 65 | Routine Description: 66 | 67 | This routine initializes the PRCM and turns on clocks and power domains 68 | needed by the system. 69 | 70 | Arguments: 71 | 72 | None. 73 | 74 | Return Value: 75 | 76 | Status code. 77 | 78 | --*/ 79 | 80 | -------------------------------------------------------------------------------- /include/dev/pl110.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | pl110.h 13 | 14 | Abstract: 15 | 16 | This header contains definitions for the ARM PL110 LCD Controller library. 17 | 18 | Author: 19 | 20 | Evan Green 7-Apr-2014 21 | 22 | --*/ 23 | 24 | // 25 | // ------------------------------------------------------------------- Includes 26 | // 27 | 28 | // 29 | // ---------------------------------------------------------------- Definitions 30 | // 31 | 32 | // 33 | // ------------------------------------------------------ Data Type Definitions 34 | // 35 | 36 | // 37 | // -------------------------------------------------------------------- Globals 38 | // 39 | 40 | // 41 | // -------------------------------------------------------- Function Prototypes 42 | // 43 | 44 | EFI_STATUS 45 | EfipPl110Initialize ( 46 | EFI_PHYSICAL_ADDRESS Controller, 47 | EFI_PHYSICAL_ADDRESS FrameBufferBase, 48 | UINT32 FrameBufferWidth, 49 | UINT32 FrameBufferHeight 50 | ); 51 | 52 | /*++ 53 | 54 | Routine Description: 55 | 56 | This routine initialize the PrimeCell PL110 display controller found in 57 | the Integrator/CP. 58 | 59 | Arguments: 60 | 61 | Controller - Supplies the physical address of the PL110 registers. 62 | 63 | FrameBufferBase - Supplies the base of the frame buffer memory to set. 64 | 65 | FrameBufferWidth - Supplies the desired width. 66 | 67 | FrameBufferHeight - Supplies the desired height. 68 | 69 | Return Value: 70 | 71 | EFI status code. 72 | 73 | --*/ 74 | 75 | -------------------------------------------------------------------------------- /include/hii.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | hii.h 13 | 14 | Abstract: 15 | 16 | This header contains definitions for HII resources. 17 | 18 | Author: 19 | 20 | Evan Green 13-Mar-2014 21 | 22 | --*/ 23 | 24 | // 25 | // ------------------------------------------------------------------- Includes 26 | // 27 | 28 | // 29 | // ---------------------------------------------------------------- Definitions 30 | // 31 | 32 | #define EFI_HII_PACKAGE_LIST_PROTOCOL_GUID \ 33 | { \ 34 | 0x6A1EE763, 0xD47A, 0x43B4, \ 35 | {0xAA, 0xBE, 0xEF, 0x1D, 0xE2, 0xAB, 0x56, 0xFC} \ 36 | } 37 | 38 | // 39 | // ------------------------------------------------------ Data Type Definitions 40 | // 41 | 42 | // 43 | // -------------------------------------------------------------------- Globals 44 | // 45 | 46 | // 47 | // -------------------------------------------------------- Function Prototypes 48 | // 49 | -------------------------------------------------------------------------------- /include/minoca/devinfo/test.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2015 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | test.h 13 | 14 | Abstract: 15 | 16 | This header contains definitions for test devices. 17 | 18 | Author: 19 | 20 | Chris Stevens 13-Jan-2015 21 | 22 | --*/ 23 | 24 | // 25 | // ------------------------------------------------------------------- Includes 26 | // 27 | 28 | // 29 | // ---------------------------------------------------------------- Definitions 30 | // 31 | 32 | #define TEST_DEVICE_INFORMATION_UUID \ 33 | {{0x88193972, 0x9b7c11e4, 0xa78e0401, 0x0fdd7401}} 34 | 35 | #define TEST_DEVICE_INFORMATION_VERSION 0x00010000 36 | 37 | // 38 | // ------------------------------------------------------ Data Type Definitions 39 | // 40 | 41 | typedef enum _TEST_DEVICE_TYPE { 42 | TestDeviceInvalid, 43 | TestDeviceKernel, 44 | } TEST_DEVICE_TYPE, *PTEST_DEVICE_TYPE; 45 | 46 | /*++ 47 | 48 | Structure Description: 49 | 50 | This structure stores the device information published by the device. 51 | 52 | Members: 53 | 54 | Version - Stores the table version. Future revisions will be backwards 55 | compatible. Set to TEST_DEVICE_INFORMATION_VERSION. 56 | 57 | DeviceType - Stores the device type. 58 | 59 | --*/ 60 | 61 | typedef struct _TEST_DEVICE_INFORMATION { 62 | ULONG Version; 63 | TEST_DEVICE_TYPE DeviceType; 64 | } TEST_DEVICE_INFORMATION, *PTEST_DEVICE_INFORMATION; 65 | 66 | // 67 | // -------------------------------------------------------------------- Globals 68 | // 69 | 70 | // 71 | // -------------------------------------------------------- Function Prototypes 72 | // 73 | -------------------------------------------------------------------------------- /include/minoca/intrface/acpi.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2012 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | acpi.h 13 | 14 | Abstract: 15 | 16 | This header contains ACPI device interfaces. 17 | 18 | Author: 19 | 20 | Evan Green 19-Sep-2012 21 | 22 | --*/ 23 | 24 | // 25 | // ------------------------------------------------------------------- Includes 26 | // 27 | 28 | // 29 | // ---------------------------------------------------------------- Definitions 30 | // 31 | 32 | // 33 | // Interface UUID for getting the ACPI bus address. 34 | // 35 | 36 | #define UUID_ACPI_BUS_ADDRESS \ 37 | {{0x73696D6F, 0x74207365, 0x656B206F, 0x61207065}} 38 | 39 | // 40 | // ------------------------------------------------------ Data Type Definitions 41 | // 42 | 43 | /*++ 44 | 45 | Structure Description: 46 | 47 | This structure defines the interface for returning a device's ACPI bus 48 | address. 49 | 50 | Members: 51 | 52 | BusAddress - Stores the bus address of the device in the ACPI _ADR format. 53 | This format is bus-specific to the types of buses that ACPI knows about. 54 | 55 | --*/ 56 | 57 | typedef struct _INTERFACE_ACPI_BUS_ADDRESS { 58 | ULONGLONG BusAddress; 59 | } INTERFACE_ACPI_BUS_ADDRESS, *PINTERFACE_ACPI_BUS_ADDRESS; 60 | 61 | // 62 | // -------------------------------------------------------------------- Globals 63 | // 64 | 65 | // 66 | // -------------------------------------------------------- Function Prototypes 67 | // 68 | 69 | -------------------------------------------------------------------------------- /include/minoca/kernel/driver.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2012 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | driver.h 13 | 14 | Abstract: 15 | 16 | This header contains all kernel definitions used by drivers. 17 | 18 | Author: 19 | 20 | Evan Green 16-Sep-2012 21 | 22 | --*/ 23 | 24 | // 25 | // ------------------------------------------------------------------- Includes 26 | // 27 | 28 | #define KERNEL_API __DLLIMPORT 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | // 48 | // ---------------------------------------------------------------- Definitions 49 | // 50 | 51 | // 52 | // ------------------------------------------------------ Data Type Definitions 53 | // 54 | 55 | // 56 | // -------------------------------------------------------------------- Globals 57 | // 58 | 59 | // 60 | // -------------------------------------------------------- Function Prototypes 61 | // 62 | -------------------------------------------------------------------------------- /include/minoca/kernel/kernel.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2012 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | kernel.h 13 | 14 | Abstract: 15 | 16 | This header contains the kernel's internal API. 17 | 18 | Author: 19 | 20 | Evan Green 6-Aug-2012 21 | 22 | --*/ 23 | 24 | // 25 | // ------------------------------------------------------------------- Includes 26 | // 27 | 28 | #define KERNEL_API __DLLPROTECTED 29 | #define CRYPTO_API __DLLPROTECTED 30 | 31 | #ifndef RTL_API 32 | 33 | #define RTL_API __DLLPROTECTED 34 | 35 | #endif 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | 55 | // 56 | // ---------------------------------------------------------------- Definitions 57 | // 58 | 59 | // 60 | // ------------------------------------------------------ Data Type Definitions 61 | // 62 | 63 | // 64 | // -------------------------------------------------------------------- Globals 65 | // 66 | 67 | // 68 | // -------------------------------------------------------- Function Prototypes 69 | // 70 | 71 | -------------------------------------------------------------------------------- /include/minoca/lib/chalk/app.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2016 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | app.h 13 | 14 | Abstract: 15 | 16 | This header contains definitions for the Chalk app module. 17 | 18 | Author: 19 | 20 | Evan Green 19-Oct-2016 21 | 22 | --*/ 23 | 24 | // 25 | // ------------------------------------------------------------------- Includes 26 | // 27 | 28 | // 29 | // ---------------------------------------------------------------- Definitions 30 | // 31 | 32 | // 33 | // ------------------------------------------------------ Data Type Definitions 34 | // 35 | 36 | // 37 | // -------------------------------------------------------------------- Globals 38 | // 39 | 40 | // 41 | // Define the pointer to the app arguments. This must be set before the app 42 | // module is imported. 43 | // 44 | 45 | extern INT CkAppArgc; 46 | extern PSTR *CkAppArgv; 47 | 48 | // 49 | // Define the original application name. 50 | // 51 | 52 | extern PCSTR CkAppExecName; 53 | 54 | // 55 | // -------------------------------------------------------- Function Prototypes 56 | // 57 | 58 | BOOL 59 | CkPreloadAppModule ( 60 | PCK_VM Vm 61 | ); 62 | 63 | /*++ 64 | 65 | Routine Description: 66 | 67 | This routine preloads the app module. It is called to make the presence of 68 | the module known in cases where the module is statically linked. 69 | 70 | Arguments: 71 | 72 | Vm - Supplies a pointer to the virtual machine. 73 | 74 | Return Value: 75 | 76 | TRUE on success. 77 | 78 | FALSE on failure. 79 | 80 | --*/ 81 | 82 | -------------------------------------------------------------------------------- /include/minoca/uefi/guid/coninct.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | coninct.h 13 | 14 | Abstract: 15 | 16 | This header contains UEFI GUID definitions for the event group that is 17 | signaled on the first attempt to check for a keystroke for a console input 18 | (ConIn) device. 19 | 20 | Author: 21 | 22 | Evan Green 17-Mar-2014 23 | 24 | --*/ 25 | 26 | // 27 | // ------------------------------------------------------------------- Includes 28 | // 29 | 30 | // 31 | // ---------------------------------------------------------------- Definitions 32 | // 33 | 34 | #define CONNECT_CONIN_EVENT_GUID \ 35 | { \ 36 | 0xDB4E8151, 0x57ED, 0x4BED, \ 37 | {0x88, 0x33, 0x67, 0x51, 0xB5, 0xD1, 0xA8, 0xD7} \ 38 | } 39 | 40 | // 41 | // ------------------------------------------------------ Data Type Definitions 42 | // 43 | 44 | // 45 | // -------------------------------------------------------------------- Globals 46 | // 47 | 48 | // 49 | // -------------------------------------------------------- Function Prototypes 50 | // 51 | -------------------------------------------------------------------------------- /include/minoca/uefi/guid/globlvar.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | globlvar.h 13 | 14 | Abstract: 15 | 16 | This header contains UEFI GUID definitions for EFI variable services. 17 | 18 | Author: 19 | 20 | Evan Green 17-Mar-2014 21 | 22 | --*/ 23 | 24 | // 25 | // ------------------------------------------------------------------- Includes 26 | // 27 | 28 | // 29 | // ---------------------------------------------------------------- Definitions 30 | // 31 | 32 | #define EFI_GLOBAL_VARIABLE_GUID \ 33 | { \ 34 | 0x8BE4DF61, 0x93CA, 0x11D2, \ 35 | {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C} \ 36 | } 37 | 38 | // 39 | // ------------------------------------------------------ Data Type Definitions 40 | // 41 | 42 | // 43 | // -------------------------------------------------------------------- Globals 44 | // 45 | 46 | // 47 | // -------------------------------------------------------- Function Prototypes 48 | // 49 | -------------------------------------------------------------------------------- /include/minoca/uefi/protocol/ramdisk.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | ramdisk.h 13 | 14 | Abstract: 15 | 16 | This header contains definitions for the Minoca-specific UEFI Ram Disk 17 | protocol. 18 | 19 | Author: 20 | 21 | Evan Green 3-Apr-2014 22 | 23 | --*/ 24 | 25 | // 26 | // ------------------------------------------------------------------- Includes 27 | // 28 | 29 | // 30 | // ---------------------------------------------------------------- Definitions 31 | // 32 | 33 | #define EFI_RAM_DISK_PROTOCOL_GUID \ 34 | { \ 35 | 0x5B1349F8, 0x3FE0, 0x46D7, \ 36 | {0xB0, 0x6F, 0xF1, 0xDB, 0x38, 0x95, 0x72, 0xD8} \ 37 | } 38 | 39 | #define EFI_RAM_DISK_PROTOCOL_REVISION 0x00010000 40 | 41 | // 42 | // ------------------------------------------------------ Data Type Definitions 43 | // 44 | 45 | /*++ 46 | 47 | Structure Description: 48 | 49 | This structure defines the RAM Disk protocol structure. 50 | 51 | Members: 52 | 53 | Revision - Stores the protocol revision number. All future revisions are 54 | backwards compatible. 55 | 56 | Base - Stores the base of the RAM disk. 57 | 58 | Length - Stores the size of the RAM disk in bytes. 59 | 60 | --*/ 61 | 62 | typedef struct _EFI_RAM_DISK_PROTOCOL { 63 | UINT64 Revision; 64 | EFI_PHYSICAL_ADDRESS Base; 65 | UINT64 Length; 66 | } EFI_RAM_DISK_PROTOCOL, *PEFI_RAM_DISK_PROTOCOL; 67 | 68 | // 69 | // -------------------------------------------------------------------- Globals 70 | // 71 | 72 | // 73 | // -------------------------------------------------------- Function Prototypes 74 | // 75 | -------------------------------------------------------------------------------- /include/minoca/uefi/uefi.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | uefi.h 13 | 14 | Abstract: 15 | 16 | This header contains standard definitions for the Unified Extensible 17 | Firmware Interface. 18 | 19 | Author: 20 | 21 | Evan Green 7-Feb-2014 22 | 23 | --*/ 24 | 25 | // 26 | // ------------------------------------------------------------------- Includes 27 | // 28 | 29 | #include 30 | #include 31 | 32 | // 33 | // ---------------------------------------------------------------- Definitions 34 | // 35 | 36 | // 37 | // ------------------------------------------------------ Data Type Definitions 38 | // 39 | 40 | // 41 | // -------------------------------------------------------------------- Globals 42 | // 43 | 44 | // 45 | // -------------------------------------------------------- Function Prototypes 46 | // 47 | -------------------------------------------------------------------------------- /lib/Makefile.inc: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 by coresystems GmbH 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 | # 18 | 19 | include lib/basevid/Makefile.inc 20 | include lib/blockdev/Makefile.inc 21 | include lib/fatlib/Makefile.inc 22 | #include lib/kd/Makefile.inc 23 | include lib/rtl/Makefile.inc 24 | 25 | -------------------------------------------------------------------------------- /lib/basevid/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2013 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # Base Video Library 13 | # 14 | # Abstract: 15 | # 16 | # This module implements basic support for video output via a linear 17 | # framebuffer. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 30-Jan-2013 22 | # 23 | # Environment: 24 | # 25 | # Any 26 | # 27 | ################################################################################ 28 | 29 | BINARY = basevid.a 30 | 31 | BINARYTYPE = library 32 | 33 | OBJS = fontdata.o \ 34 | textvid.o \ 35 | 36 | include $(SRCROOT)/os/minoca.mk 37 | -------------------------------------------------------------------------------- /lib/basevid/Makefile.inc: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 by coresystems GmbH 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 | # 18 | 19 | TARGETS-y += lib/basevid/textvid.o lib/basevid/fontdata.o 20 | 21 | -------------------------------------------------------------------------------- /lib/basevid/basevidp.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2016 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | basevidp.h 13 | 14 | Abstract: 15 | 16 | This header contains internal definitions for the base video library. 17 | 18 | Author: 19 | 20 | Evan Green 5-Mar-2016 21 | 22 | --*/ 23 | 24 | // 25 | // ------------------------------------------------------------------- Includes 26 | // 27 | 28 | #define RTL_API __DLLEXPORT 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | // 35 | // ---------------------------------------------------------------- Definitions 36 | // 37 | 38 | // 39 | // ------------------------------------------------------ Data Type Definitions 40 | // 41 | 42 | // 43 | // -------------------------------------------------------------------- Globals 44 | // 45 | 46 | // 47 | // -------------------------------------------------------- Function Prototypes 48 | // 49 | -------------------------------------------------------------------------------- /lib/basevid/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2013 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | Base Video Library 13 | 14 | Abstract: 15 | 16 | This module implements basic support for video output via a linear 17 | framebuffer. 18 | 19 | 20 | Author: 21 | 22 | Evan Green 30-Jan-2015 23 | 24 | Environment: 25 | 26 | Any 27 | 28 | --*/ 29 | 30 | from menv import staticLibrary; 31 | 32 | function build() { 33 | var buildLib; 34 | var entries; 35 | var lib; 36 | var sources; 37 | 38 | sources = [ 39 | "fontdata.c", 40 | "textvid.c" 41 | ]; 42 | 43 | lib = { 44 | "label": "basevid", 45 | "inputs": sources, 46 | }; 47 | 48 | buildLib = { 49 | "label": "build_basevid", 50 | "output": "basevid", 51 | "inputs": sources, 52 | "build": true, 53 | "prefix": "build" 54 | }; 55 | 56 | entries = staticLibrary(lib); 57 | entries += staticLibrary(buildLib); 58 | return entries; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /lib/blockdev/Makefile.inc: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 by coresystems GmbH 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 | # 18 | 19 | TARGETS-y += lib/blockdev/list.o 20 | 21 | -------------------------------------------------------------------------------- /lib/blockdev/list.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * See file CREDITS for list of people who contributed to this 5 | * project. 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License as 9 | * published by the Free Software Foundation; either version 2 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but without any warranty; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | */ 17 | 18 | #include "blockdev/list.h" 19 | 20 | void list_remove(ListNode *node) 21 | { 22 | if (node->prev) 23 | node->prev->next = node->next; 24 | if (node->next) 25 | node->next->prev = node->prev; 26 | } 27 | 28 | void list_insert_after(ListNode *node, ListNode *after) 29 | { 30 | node->next = after->next; 31 | node->prev = after; 32 | after->next = node; 33 | if (node->next) 34 | node->next->prev = node; 35 | } 36 | 37 | void list_insert_before(ListNode *node, ListNode *before) 38 | { 39 | node->prev = before->prev; 40 | node->next = before; 41 | before->prev = node; 42 | if (node->prev) 43 | node->prev->next = node; 44 | } 45 | -------------------------------------------------------------------------------- /lib/fatlib/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2012 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # FAT Library 13 | # 14 | # Abstract: 15 | # 16 | # This module implements support for the FAT file system. 17 | # 18 | # Author: 19 | # 20 | # Evan Green 23-Sep-2012 21 | # 22 | # Environment: 23 | # 24 | # Any 25 | # 26 | ################################################################################ 27 | 28 | BINARY = fat.a 29 | 30 | BINARYTYPE = library 31 | 32 | include $(SRCDIR)/sources 33 | 34 | DIRS = build 35 | 36 | TESTDIRS = fattest 37 | 38 | include $(SRCROOT)/os/minoca.mk 39 | 40 | fattest: build 41 | 42 | -------------------------------------------------------------------------------- /lib/fatlib/Makefile.inc: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 by coresystems GmbH 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 | # 18 | 19 | TARGETS-y += lib/fatlib/fat.o lib/fatlib/fatcache.o 20 | TARGETS-y += lib/fatlib/fatsup.o lib/fatlib/idtodir.o 21 | 22 | -------------------------------------------------------------------------------- /lib/fatlib/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2012 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | FAT Library 13 | 14 | Abstract: 15 | 16 | This module implements support for the FAT file system. 17 | 18 | Author: 19 | 20 | Evan Green 23-Sep-2012 21 | 22 | Environment: 23 | 24 | Any 25 | 26 | --*/ 27 | 28 | from menv import staticLibrary; 29 | 30 | function build() { 31 | var buildLib; 32 | var entries; 33 | var lib; 34 | var sources; 35 | 36 | sources = [ 37 | "fat.c", 38 | "fatcache.c", 39 | "fatsup.c", 40 | "idtodir.c" 41 | ]; 42 | 43 | lib = { 44 | "label": "fat", 45 | "inputs": sources, 46 | }; 47 | 48 | buildLib = { 49 | "label": "build_fat", 50 | "output": "fat", 51 | "inputs": sources, 52 | "build": true, 53 | "prefix": "build" 54 | }; 55 | 56 | entries = staticLibrary(lib); 57 | entries += staticLibrary(buildLib); 58 | return entries; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /lib/fatlib/build/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2012 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # Fat Library (Build) 13 | # 14 | # Abstract: 15 | # 16 | # This module builds the FAT library targeted to the build machine. 17 | # 18 | # Author: 19 | # 20 | # Evan Green 23-Sep-2012 21 | # 22 | # Environment: 23 | # 24 | # Build 25 | # 26 | ################################################################################ 27 | 28 | BINARY = fat.a 29 | 30 | BINARYTYPE = library 31 | 32 | BUILD = yes 33 | 34 | VPATH += $(SRCDIR)/..: 35 | 36 | include $(SRCDIR)/../sources 37 | 38 | include $(SRCROOT)/os/minoca.mk 39 | 40 | -------------------------------------------------------------------------------- /lib/fatlib/fattest/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2012 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # FAT Test 13 | # 14 | # Abstract: 15 | # 16 | # This program tests the FAT file system library. 17 | # 18 | # Author: 19 | # 20 | # Evan Green 9-Oct-2012 21 | # 22 | # Environment: 23 | # 24 | # Test 25 | # 26 | ################################################################################ 27 | 28 | BINARY = fattest 29 | 30 | BINARYTYPE = build 31 | 32 | BUILD = yes 33 | 34 | BINPLACE = testbin 35 | 36 | TARGETLIBS = $(OBJROOT)/os/lib/rtl/base/build/basertl.a \ 37 | $(OBJROOT)/os/lib/rtl/rtlc/build/rtlc.a \ 38 | $(OBJROOT)/os/lib/fatlib/build/fat.a \ 39 | 40 | OBJS = fattest.o \ 41 | fatdev.o \ 42 | 43 | include $(SRCROOT)/os/minoca.mk 44 | 45 | -------------------------------------------------------------------------------- /lib/fatlib/fattest/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2012 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | FAT Test 13 | 14 | Abstract: 15 | 16 | This program tests the FAT file system library in an application. 17 | 18 | Author: 19 | 20 | Evan Green 9-Oct-2012 21 | 22 | Environment: 23 | 24 | Test 25 | 26 | --*/ 27 | 28 | from menv import application; 29 | 30 | function build() { 31 | var buildApp; 32 | var buildLibs; 33 | var entries; 34 | var sources; 35 | 36 | sources = [ 37 | "fatdev.c", 38 | "fattest.c" 39 | ]; 40 | 41 | buildLibs = [ 42 | "lib/fatlib:build_fat", 43 | "lib/rtl/rtlc:build_rtlc", 44 | "lib/rtl/base:build_basertl" 45 | ]; 46 | 47 | buildApp = { 48 | "label": "build_fattest", 49 | "output": "fattest", 50 | "inputs": sources + buildLibs, 51 | "build": true, 52 | "prefix": "build" 53 | }; 54 | 55 | entries = application(buildApp); 56 | return entries; 57 | } 58 | 59 | -------------------------------------------------------------------------------- /lib/fatlib/sources: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2012 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # File Name: 11 | # 12 | # sources 13 | # 14 | # Abstract: 15 | # 16 | # This module defines the sources files for the FAT32 file system. 17 | # 18 | # Author: 19 | # 20 | # Evan Green 23-Sep-2012 21 | # 22 | # Environment: 23 | # 24 | # Boot Environment, Build Environment, and Kernel Mode 25 | # 26 | ################################################################################ 27 | 28 | OBJS = fat.o \ 29 | fatcache.o \ 30 | fatsup.o \ 31 | idtodir.o \ 32 | 33 | -------------------------------------------------------------------------------- /lib/rtl/Makefile.inc: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 by coresystems GmbH 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 | # 18 | 19 | include lib/rtl/base/Makefile.inc 20 | 21 | -------------------------------------------------------------------------------- /lib/rtl/base/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2012 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # Base Runtime Library 13 | # 14 | # Abstract: 15 | # 16 | # This library contains the base Runtime Library that is shared between 17 | # kernel and user modes. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 26-Jul-2012 22 | # 23 | # Environment: 24 | # 25 | # Any 26 | # 27 | ################################################################################ 28 | 29 | BINARY = basertl.a 30 | 31 | BINARYTYPE = library 32 | 33 | INCLUDES += $(SRCDIR)/..; 34 | 35 | include $(SRCDIR)/sources 36 | 37 | EXTRA_SRC_DIRS = x86 x64 armv7 38 | 39 | DIRS = boot \ 40 | build \ 41 | intrins \ 42 | wide \ 43 | 44 | include $(SRCROOT)/os/minoca.mk 45 | 46 | -------------------------------------------------------------------------------- /lib/rtl/base/Makefile.inc: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 by coresystems GmbH 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 | # 18 | 19 | #TARGETS-y += lib/rtl/base/crc32.o lib/rtl/base/fp2int.o 20 | #TARGETS-y += lib/rtl/base/heap.o lib/rtl/base/heapprof.o 21 | TARGETS-y += lib/rtl/base/math.o lib/rtl/base/print.o 22 | TARGETS-y += lib/rtl/base/rbtree.o lib/rtl/base/scan.o 23 | #TARGETS-y += lib/rtl/base/softfp.o lib/rtl/base/string.o 24 | TARGETS-y += lib/rtl/base/string.o 25 | TARGETS-y += lib/rtl/base/time.o lib/rtl/base/timezone.o 26 | #TARGETS-y += lib/rtl/base/version.o lib/rtl/base/wchar.o 27 | TARGETS-y += lib/rtl/base/wchar.o 28 | #TARGETS-y += lib/rtl/base/wprint.o lib/rtl/base/wscan.o 29 | #TARGETS-y += lib/rtl/base/wstring.o lib/rtl/base/wstring.o 30 | #TARGETS-y += lib/rtl/base/wtime.o 31 | TARGETS-y += lib/rtl/base/x86/rtlmem.S.o lib/rtl/base/x86/rtlarch.S.o 32 | 33 | -------------------------------------------------------------------------------- /lib/rtl/base/boot/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # Boot Runtime Library 13 | # 14 | # Abstract: 15 | # 16 | # This directory builds a subset of the Runtime Library for use in the 17 | # boot environment. 18 | # 19 | # Author: 20 | # 21 | # Chris Stevens 18-Mar-2014 22 | # 23 | # Environment: 24 | # 25 | # Boot 26 | # 27 | ################################################################################ 28 | 29 | BINARY = basertlb.a 30 | 31 | BINARYTYPE = library 32 | 33 | INCLUDES += $(SRCDIR)/../..; 34 | 35 | VPATH += $(SRCDIR)/..: 36 | 37 | include $(SRCDIR)/../sources 38 | 39 | ## 40 | ## Compiling in eabisfp.c (and its dependency softfp.c) isn't necessary, but 41 | ## until there's a need for soft float (ie Cortex-M) compile it in so that it 42 | ## gets exercise. 43 | ## 44 | 45 | ARMV7_OBJS = armv7/aeabisfp.o \ 46 | armv7/intrinsa.o \ 47 | armv7/intrinsc.o \ 48 | armv7/rtlmem.o \ 49 | boot/armv7/rtlarch.o \ 50 | fp2int.o \ 51 | softfp.o \ 52 | 53 | ARMV6_OBJS = $(ARMV7_OBJS) 54 | 55 | ## 56 | ## This must be non-lto because otherwise for reasons not fully understood the 57 | ## intrinsic functions (like __aeabi_uidiv and __divdi3) get optimized away 58 | ## and leave the linker with undefined references to them. 59 | ## 60 | 61 | LTO_OPT = -fno-lto 62 | 63 | EXTRA_SRC_DIRS = x86 x64 armv7 boot/armv7 64 | 65 | include $(SRCROOT)/os/minoca.mk 66 | 67 | -------------------------------------------------------------------------------- /lib/rtl/base/build/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2012 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # Base Runtime Library (Build) 13 | # 14 | # Abstract: 15 | # 16 | # This library contains the base Runtime Library that is shared between 17 | # kernel and user modes, compiled to target the build machine. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 26-Jul-2012 22 | # 23 | # Environment: 24 | # 25 | # Build 26 | # 27 | ################################################################################ 28 | 29 | BINARY = basertl.a 30 | 31 | BINARYTYPE = library 32 | 33 | BUILD = yes 34 | 35 | INCLUDES += $(SRCDIR)/../..; 36 | 37 | VPATH += $(SRCDIR)/..: 38 | 39 | include $(SRCDIR)/../sources 40 | 41 | OBJS := $(OBJS) \ 42 | $(OBJS_WIDE) \ 43 | 44 | ## 45 | ## Make sure softfp is in there. On an ARM build system it would be. 46 | ## 47 | 48 | ifeq (, $(filter fp2int.o,$(OBJS))) 49 | OBJS += fp2int.o \ 50 | softfp.o 51 | 52 | endif 53 | 54 | EXTRA_SRC_DIRS = x86 x64 armv7 55 | 56 | include $(SRCROOT)/os/minoca.mk 57 | 58 | -------------------------------------------------------------------------------- /lib/rtl/base/intrins/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2012 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # Intrinsics 13 | # 14 | # Abstract: 15 | # 16 | # This library contains functions in the runtime library emitted by the 17 | # compiler directly. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 12-Nov-2014 22 | # 23 | # Environment: 24 | # 25 | # Any 26 | # 27 | ################################################################################ 28 | 29 | BINARY = intrins.a 30 | 31 | BINARYTYPE = library 32 | 33 | INCLUDES += $(SRCDIR)/../..; 34 | 35 | VPATH += $(SRCDIR)/..: 36 | 37 | ARMV7_OBJS = armv7/intrinsa.o \ 38 | armv7/intrinsc.o \ 39 | 40 | ARMV6_OBJS = $(ARMV7_OBJS) 41 | 42 | X86_OBJS = x86/intrinsc.o \ 43 | 44 | ## 45 | ## The library is being compiled such that the rest of Rtl is in another binary. 46 | ## 47 | 48 | EXTRA_CFLAGS += -DRTL_API=__DLLIMPORT 49 | 50 | EXTRA_SRC_DIRS = x86 armv7 51 | 52 | include $(SRCROOT)/os/minoca.mk 53 | 54 | -------------------------------------------------------------------------------- /lib/rtl/base/sources: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2013 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # File Name: 11 | # 12 | # sources 13 | # 14 | # Abstract: 15 | # 16 | # This file contains the common object files for the Runtime Library base 17 | # layer. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 23-Oct-2013 22 | # 23 | # Environment: 24 | # 25 | # Build 26 | # 27 | ################################################################################ 28 | 29 | OBJS = crc32.o \ 30 | heap.o \ 31 | heapprof.o \ 32 | math.o \ 33 | print.o \ 34 | rbtree.o \ 35 | scan.o \ 36 | string.o \ 37 | time.o \ 38 | timezone.o \ 39 | version.o \ 40 | wchar.o \ 41 | 42 | OBJS_WIDE = wprint.o \ 43 | wscan.o \ 44 | wstring.o \ 45 | wtime.o \ 46 | 47 | ARMV7_OBJS = armv7/intrinsa.o \ 48 | armv7/intrinsc.o \ 49 | armv7/rtlarch.o \ 50 | armv7/rtlmem.o \ 51 | fp2int.o \ 52 | 53 | ARMV6_OBJS = $(ARMV7_OBJS) 54 | 55 | X86_OBJS = x86/intrinsc.o \ 56 | x86/rtlarch.o \ 57 | x86/rtlmem.o \ 58 | 59 | X64_OBJS = x64/rtlarch.o \ 60 | x64/rtlmem.o \ 61 | 62 | -------------------------------------------------------------------------------- /lib/rtl/base/wide/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2015 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # Base Runtime Library (Wide) 13 | # 14 | # Abstract: 15 | # 16 | # This library contains the wide character support supplement to the base 17 | # runtime library. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 31-Aug-2015 22 | # 23 | # Environment: 24 | # 25 | # Any 26 | # 27 | ################################################################################ 28 | 29 | BINARY = basertlw.a 30 | 31 | BINARYTYPE = library 32 | 33 | INCLUDES += $(SRCDIR)/../..; 34 | 35 | VPATH += $(SRCDIR)/..: 36 | 37 | include $(SRCDIR)/../sources 38 | 39 | OBJS := $(OBJS_WIDE) 40 | 41 | ARMV7_OBJS := 42 | 43 | ARMV6_OBJS := 44 | 45 | X86_OBJS := 46 | 47 | X64_OBJS := 48 | 49 | include $(SRCROOT)/os/minoca.mk 50 | 51 | -------------------------------------------------------------------------------- /plat/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2012 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # Platform Support 13 | # 14 | # Abstract: 15 | # 16 | # This directory contains platform-specific targets for UEFI firmware. 17 | # 18 | # Author: 19 | # 20 | # Evan Green 26-Feb-2014 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | ifeq ($(ARCH), x86) 29 | 30 | DIRS += bios \ 31 | 32 | endif 33 | 34 | ifeq ($(ARCH), armv7) 35 | 36 | DIRS += beagbone \ 37 | integcp \ 38 | panda \ 39 | rpi2 \ 40 | veyron \ 41 | 42 | endif 43 | 44 | ifeq ($(ARCH), armv6) 45 | 46 | DIRS += rpi \ 47 | 48 | endif 49 | 50 | include $(SRCROOT)/os/minoca.mk 51 | 52 | beagbone: panda 53 | 54 | -------------------------------------------------------------------------------- /plat/Makefile.inc: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 by coresystems GmbH 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 | # 18 | 19 | include plat/cb/Makefile.inc 20 | 21 | -------------------------------------------------------------------------------- /plat/beagbone/acpi/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2015 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # BeagleBone Black ACPI tables 13 | # 14 | # Abstract: 15 | # 16 | # This module compiles the BeagleBone Black ACPI tables. 17 | # 18 | # Author: 19 | # 20 | # Evan Green 6-Jan-2015 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | BINARY := acpi.ffs 29 | 30 | BINARYTYPE = none 31 | 32 | IASL = iasl 33 | 34 | IASL_OPTIONS = -we 35 | 36 | OBJS += am33.aml \ 37 | dbg2.aml \ 38 | dsdt.aml \ 39 | facp.aml \ 40 | facs.aml \ 41 | 42 | include $(SRCROOT)/os/minoca.mk 43 | 44 | $(BINARY): $(OBJS) 45 | @echo Generating - $@ 46 | @cd $(OBJROOT)/$(THISDIR) && \ 47 | genffs -g 7E374E25-8E01-4FEE-87F2-390C23C606CD -r EFI_SECTION_RAW \ 48 | -t EFI_FV_FILETYPE_FREEFORM -o $@ $^ 49 | 50 | %.aml:%.asl 51 | @echo Compiling ASL - $< 52 | @$(IASL) $(IASL_OPTIONS) -p $(OBJROOT)/$(THISDIR)/$@ $< > $(OBJROOT)/$(THISDIR)/iaslout.txt 53 | 54 | -------------------------------------------------------------------------------- /plat/beagbone/acpi/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2015 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | BeagleBone Black ACPI tables 13 | 14 | Abstract: 15 | 16 | This module compiles the BeagleBone Black ACPI tables. 17 | 18 | Author: 19 | 20 | Evan Green 6-Jan-2015 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | from menv import compiledAsl; 29 | 30 | function build() { 31 | var asl; 32 | var entries; 33 | var ffs; 34 | var ffsSources; 35 | var sources; 36 | 37 | sources = [ 38 | "am33.asl", 39 | "dbg2.asl", 40 | "dsdt.asl", 41 | "facp.asl", 42 | "facs.asl" 43 | ]; 44 | 45 | asl = compiledAsl(sources); 46 | entries = asl[1]; 47 | ffsSources = asl[0]; 48 | ffs = { 49 | "type": "target", 50 | "label": "acpi.ffs", 51 | "inputs": ffsSources, 52 | "implicit": ["uefi/tools/genffs:genffs"], 53 | "tool": "genffs_acpi" 54 | }; 55 | 56 | entries += [ffs]; 57 | return entries; 58 | } 59 | 60 | -------------------------------------------------------------------------------- /plat/beagbone/acpi/facs.asl: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | facs.asl 13 | 14 | Abstract: 15 | 16 | This module implements the Firmware ACPI Control Structure table. 17 | 18 | Author: 19 | 20 | Evan Green 26-Mar-2014 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | // 29 | // ---------------------------------------------------------------- Definitions 30 | // 31 | 32 | [0004] Signature : "FACS" 33 | [0004] Length : 00000040 34 | [0004] Hardware Signature : 00000000 35 | [0004] 32 Firmware Waking Vector : 00000000 36 | [0004] Global Lock : 00000000 37 | [0004] Flags (decoded below) : 00000000 38 | S4BIOS Support Present : 0 39 | 64-bit Wake Supported (V2) : 0 40 | [0008] 64 Firmware Waking Vector : 0000000000000000 41 | [0001] Version : 02 42 | [0003] Reserved : 000000 43 | [0004] OspmFlags (decoded below) : 00000000 44 | 64-bit Wake Env Required (V2) : 0 45 | -------------------------------------------------------------------------------- /plat/beagbone/bbonefwv.S: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2016 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | bbonefwv.S 13 | 14 | Abstract: 15 | 16 | This module includes the firmware volume binary directly. 17 | 18 | Author: 19 | 20 | Evan Green 4-Oct-2016 21 | 22 | Environment: 23 | 24 | Any 25 | 26 | --*/ 27 | 28 | ## 29 | ## ---------------------------------------------------------------- Definitions 30 | ## 31 | 32 | #if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__) 33 | 34 | #define LABEL(_Name) _##_Name 35 | 36 | #else 37 | 38 | #define LABEL(_Name) _Name 39 | 40 | #endif 41 | 42 | #define INCLUDE_BINARY(_Path, _Name) \ 43 | .align 4; \ 44 | .global LABEL(_Name##_start); \ 45 | LABEL(_Name##_start):; \ 46 | .incbin _Path; \ 47 | .global LABEL(_Name##_end); \ 48 | LABEL(_Name##_end): 49 | 50 | ## 51 | ## ---------------------------------------------------------------------- Code 52 | ## 53 | 54 | .text 55 | 56 | INCLUDE_BINARY("bbonefwv", _binary_bbonefwv) 57 | 58 | -------------------------------------------------------------------------------- /plat/beagbone/init/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # BeagleBone Stage 1 Loader 13 | # 14 | # Abstract: 15 | # 16 | # This module implements Texas Instruments AM335x first stage loader. 17 | # 18 | # Author: 19 | # 20 | # Evan Green 17-Dec-2014 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | BINARY := bbonemlo.elf 29 | 30 | BINARYTYPE = staticapp 31 | 32 | BINPLACE = bin 33 | 34 | VPATH += $(BINROOT): 35 | 36 | INCLUDES += $(SRCROOT)/os/uefi/include; 37 | INCLUDES += $(SRCDIR)/../../panda/init; 38 | 39 | LDFLAGS += -nodefaultlibs -nostartfiles -nostdlib -Wl,-zmax-page-size=1 40 | 41 | OBJS += boot.o \ 42 | clock.o \ 43 | crc32.o \ 44 | fatboot.o \ 45 | mux.o \ 46 | power.o \ 47 | serial.o \ 48 | rommem.o \ 49 | 50 | ARMV7_OBJS = armv7/start.o \ 51 | 52 | TEXT_ADDRESS := 0x402F0408 53 | 54 | EXTRA_SRC_DIRS = armv7 55 | 56 | DIRS = bbonefwb \ 57 | 58 | include $(SRCROOT)/os/minoca.mk 59 | 60 | VPATH += $(SRCDIR)/../../panda/init: 61 | 62 | postbuild: bbonemlo bbonemlo.bin 63 | 64 | bbonemlo: bbonemlo.bin 65 | @echo Generating - $@ 66 | @bbonefwb/bbonefwb $(TEXT_ADDRESS) $^ $@ 67 | @cp -p $@ $(BINROOT)/ 68 | 69 | bbonemlo.bin: $(BINARY) 70 | @echo Flattening - $(notdir $<) 71 | @$(OBJCOPY) -O binary $^ $@ 72 | 73 | -------------------------------------------------------------------------------- /plat/beagbone/init/bbonefwb/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # BboneFwb 13 | # 14 | # Abstract: 15 | # 16 | # This build utility adds the necessary header for creating the boot 17 | # region of an SD card on the TI AM335x. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 17-Dec-2014 22 | # 23 | # Environment: 24 | # 25 | # Build 26 | # 27 | ################################################################################ 28 | 29 | BINARY = bbonefwb 30 | 31 | BUILD = yes 32 | 33 | BINARYTYPE = build 34 | 35 | OBJS = fwbuild.o 36 | 37 | include $(SRCROOT)/os/minoca.mk 38 | 39 | -------------------------------------------------------------------------------- /plat/beagbone/ramdisk.S: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2016 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | ramdisk.S 13 | 14 | Abstract: 15 | 16 | This module embeds the RAM disk image directly in the firmware image. 17 | 18 | Author: 19 | 20 | Evan Green 4-Oct-2016 21 | 22 | Environment: 23 | 24 | Any 25 | 26 | --*/ 27 | 28 | ## 29 | ## ---------------------------------------------------------------- Definitions 30 | ## 31 | 32 | #if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__) 33 | 34 | #define LABEL(_Name) _##_Name 35 | 36 | #else 37 | 38 | #define LABEL(_Name) _Name 39 | 40 | #endif 41 | 42 | #define INCLUDE_BINARY(_Path, _Name) \ 43 | .align 4; \ 44 | .global LABEL(_Name##_start); \ 45 | LABEL(_Name##_start):; \ 46 | .incbin _Path; \ 47 | .global LABEL(_Name##_end); \ 48 | LABEL(_Name##_end): 49 | 50 | ## 51 | ## ---------------------------------------------------------------------- Code 52 | ## 53 | 54 | .text 55 | 56 | INCLUDE_BINARY("ramdisk", _binary_ramdisk) 57 | 58 | -------------------------------------------------------------------------------- /plat/beagbone/runtime/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2015 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | BeagleBone UEFI Runtime 13 | 14 | Abstract: 15 | 16 | This module implements the BeagleBone runtime firmware, which continues 17 | to be loaded and provide services to the OS kernel even after the boot 18 | environment has been destroyed. It is never unloaded. 19 | 20 | Author: 21 | 22 | Evan Green 6-Jan-2015 23 | 24 | Environment: 25 | 26 | Firmware 27 | 28 | --*/ 29 | 30 | from menv import executable, uefiRuntimeFfs; 31 | 32 | function build() { 33 | var elf; 34 | var entries; 35 | var includes; 36 | var libs; 37 | var linkConfig; 38 | var linkLdflags; 39 | var sources; 40 | var sourcesConfig; 41 | 42 | sources = [ 43 | "reboot.c", 44 | "rtc.c", 45 | "runtime.c" 46 | ]; 47 | 48 | libs = [ 49 | "uefi/core/rtlib:rtlib", 50 | "uefi/archlib:uefiarch" 51 | ]; 52 | 53 | includes = [ 54 | "$S/uefi/include" 55 | ]; 56 | 57 | sourcesConfig = { 58 | "CFLAGS": ["-fshort-wchar"], 59 | }; 60 | 61 | linkLdflags = [ 62 | "-pie", 63 | "-nostdlib", 64 | "-Wl,--no-wchar-size-warning", 65 | "-static" 66 | ]; 67 | 68 | linkConfig = { 69 | "LDFLAGS": linkLdflags 70 | }; 71 | 72 | elf = { 73 | "label": "bbonert.elf", 74 | "inputs": sources + libs, 75 | "sources_config": sourcesConfig, 76 | "includes": includes, 77 | "entry": "EfiRuntimeCoreEntry", 78 | "linker_script": "$S/uefi/include/link_arm.x", 79 | "config": linkConfig 80 | }; 81 | 82 | entries = executable(elf); 83 | entries += uefiRuntimeFfs("bbonert"); 84 | return entries; 85 | } 86 | 87 | -------------------------------------------------------------------------------- /plat/bios/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2012 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # BIOS UEFI Firmware 13 | # 14 | # Abstract: 15 | # 16 | # This module implements a UEFI-compatible firmware layer on top of a 17 | # legacy PC/AT BIOS. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 26-Feb-2014 22 | # 23 | # Environment: 24 | # 25 | # Firmware 26 | # 27 | ################################################################################ 28 | 29 | include $(SRCDIR)/../common 30 | 31 | BINARY := biosfw.elf 32 | 33 | BINARYTYPE = staticapp 34 | 35 | BINPLACE = bin 36 | 37 | VPATH += $(BINROOT): 38 | 39 | LDFLAGS += -nodefaultlibs -nostartfiles -nostdlib 40 | 41 | OBJS += acpi.o \ 42 | bioscall.o \ 43 | biosfwv.o \ 44 | disk.o \ 45 | debug.o \ 46 | fwvol.o \ 47 | intr.o \ 48 | main.o \ 49 | memmap.o \ 50 | timer.o \ 51 | video.o \ 52 | 53 | X86_OBJS = x86/entry.o \ 54 | x86/realmexe.o \ 55 | 56 | TEXT_ADDRESS := 0x100000 57 | 58 | TARGETLIBS += $(OBJROOT)/os/uefi/dev/ns16550/ns16550.a \ 59 | 60 | EXTRA_SRC_DIRS = x86 61 | 62 | DIRS = runtime 63 | 64 | include $(SRCROOT)/os/minoca.mk 65 | 66 | postbuild: biosfw.bin 67 | 68 | biosfw.bin: $(BINARY) 69 | @echo Flattening - $(notdir $<) 70 | @$(OBJCOPY) -O binary $< $@ 71 | @cp -p $@ $(BINROOT)/ 72 | 73 | ## 74 | ## Define the target that creates the firmware volume object file. 75 | ## 76 | 77 | FWVOL_IMAGES = $(RTBASE) runtime/biosrt.ffs 78 | 79 | biosfwv.o: biosfwv 80 | 81 | biosfwv: $(FWVOL_IMAGES) 82 | @echo Generating - $@ 83 | @genfv -o $@ $^ 84 | 85 | runtime/biosrt.ffs: runtime 86 | 87 | -------------------------------------------------------------------------------- /plat/bios/biosfwv.S: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2016 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | biosfwv.S 13 | 14 | Abstract: 15 | 16 | This module includes the firmware volume binary directly. 17 | 18 | Author: 19 | 20 | Evan Green 4-Oct-2016 21 | 22 | Environment: 23 | 24 | Any 25 | 26 | --*/ 27 | 28 | ## 29 | ## ---------------------------------------------------------------- Definitions 30 | ## 31 | 32 | #if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__) 33 | 34 | #define LABEL(_Name) _##_Name 35 | 36 | #else 37 | 38 | #define LABEL(_Name) _Name 39 | 40 | #endif 41 | 42 | #define INCLUDE_BINARY(_Path, _Name) \ 43 | .align 4; \ 44 | .global LABEL(_Name##_start); \ 45 | LABEL(_Name##_start):; \ 46 | .incbin _Path; \ 47 | .global LABEL(_Name##_end); \ 48 | LABEL(_Name##_end): 49 | 50 | ## 51 | ## ---------------------------------------------------------------------- Code 52 | ## 53 | 54 | .text 55 | 56 | INCLUDE_BINARY("biosfwv", _binary_biosfwv) 57 | 58 | -------------------------------------------------------------------------------- /plat/bios/runtime/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # PC/AT UEFI Runtime firmware 13 | # 14 | # Abstract: 15 | # 16 | # This module implements the PC/AT BIOS runtime firmware, which continues 17 | # to run even after ExitBootServices. It is never unloaded. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 18-Mar-2014 22 | # 23 | # Environment: 24 | # 25 | # Firmware 26 | # 27 | ################################################################################ 28 | 29 | BINARY = biosrt.elf 30 | 31 | BINARYTYPE = staticapp 32 | 33 | BINPLACE = bin 34 | 35 | INCLUDES += $(SRCROOT)/os/uefi/include;$(SRCDIR)/..; 36 | 37 | OBJS += reboot.o \ 38 | runtime.o \ 39 | 40 | ENTRY = EfiRuntimeCoreEntry 41 | 42 | LDFLAGS += -pie -nodefaultlibs -nostartfiles -nostdlib 43 | 44 | ifeq ($(ARCH), armv7) 45 | LINKER_SCRIPT = $(SRCROOT)/os/uefi/include/link_arm.x 46 | endif 47 | 48 | TARGETLIBS = $(OBJROOT)/os/uefi/core/rtlib/rtlib.a \ 49 | $(OBJROOT)/os/uefi/archlib/uefiarch.a \ 50 | 51 | include $(SRCROOT)/os/minoca.mk 52 | 53 | ## 54 | ## On architectures that produce ELF binaries, convert it to a PE image. 55 | ## 56 | 57 | postbuild: biosrt.ffs 58 | 59 | biosrt.ffs: biosrt 60 | @genffs -s -i $< -r EFI_SECTION_PE32 \ 61 | -i $< -r EFI_SECTION_USER_INTERFACE -t EFI_FV_FILETYPE_DRIVER -o $@ 62 | 63 | biosrt: $(BINARY) 64 | @echo Converting - $(notdir $<) 65 | @elfconv -o $@ -t efiruntimedriver $< 66 | 67 | CFLAGS += -fshort-wchar 68 | 69 | -------------------------------------------------------------------------------- /plat/bios/runtime/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | PC/AT UEFI Runtime firmware 13 | 14 | Abstract: 15 | 16 | This module implements the PC/AT BIOS runtime firmware, which continues 17 | to run even after ExitBootServices. It is never unloaded. 18 | 19 | Author: 20 | 21 | Evan Green 18-Mar-2014 22 | 23 | Environment: 24 | 25 | Firmware 26 | 27 | --*/ 28 | 29 | from menv import executable, uefiRuntimeFfs; 30 | 31 | function build() { 32 | var elf; 33 | var entries; 34 | var includes; 35 | var libs; 36 | var linkConfig; 37 | var linkLdflags; 38 | var sources; 39 | var sourcesConfig; 40 | 41 | sources = [ 42 | "reboot.c", 43 | "runtime.c" 44 | ]; 45 | 46 | libs = [ 47 | "uefi/core/rtlib:rtlib", 48 | "uefi/archlib:uefiarch" 49 | ]; 50 | 51 | includes = [ 52 | "$S/uefi/include" 53 | ]; 54 | 55 | sourcesConfig = { 56 | "CFLAGS": ["-fshort-wchar"], 57 | }; 58 | 59 | linkLdflags = [ 60 | "-pie", 61 | "-nostdlib", 62 | "-static" 63 | ]; 64 | 65 | linkConfig = { 66 | "LDFLAGS": linkLdflags 67 | }; 68 | 69 | elf = { 70 | "label": "biosrt.elf", 71 | "inputs": sources + libs, 72 | "sources_config": sourcesConfig, 73 | "includes": includes, 74 | "entry": "EfiRuntimeCoreEntry", 75 | "config": linkConfig 76 | }; 77 | 78 | entries = executable(elf); 79 | entries += uefiRuntimeFfs("biosrt"); 80 | return entries; 81 | } 82 | 83 | -------------------------------------------------------------------------------- /plat/bios/x86/entry.S: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2013 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | entry.S 13 | 14 | Abstract: 15 | 16 | This module implements the entry point for the loader. 17 | 18 | Author: 19 | 20 | Evan Green 18-Aug-2013 21 | 22 | Environment: 23 | 24 | Kernel mode 25 | 26 | --*/ 27 | 28 | ## 29 | ## ------------------------------------------------------------------ Includes 30 | ## 31 | 32 | #include 33 | 34 | ## 35 | ## ---------------------------------------------------------------------- Code 36 | ## 37 | 38 | ## 39 | ## .text specifies that this code belongs in the executable section. 40 | ## 41 | ## .code32 specifies that this is 32-bit protected mode code. 42 | ## 43 | 44 | .text 45 | .code32 46 | 47 | ## 48 | ## Stick this in the .init section so it ends up at the front of the binary. 49 | ## 50 | 51 | .section .init 52 | 53 | ## 54 | ## .globl allows this label to be visible to the linker. 55 | ## 56 | 57 | .globl _start 58 | 59 | ## 60 | ## void 61 | ## start ( 62 | ## ) 63 | ## 64 | 65 | /*++ 66 | 67 | Routine Description: 68 | 69 | This routine implements the entry point for the firmware. It jumps to the 70 | main C routine. It is called by the file system specific boot code. 71 | 72 | Arguments: 73 | 74 | None. 75 | 76 | Return Value: 77 | 78 | TRUE if interrupts are enabled in the processor. 79 | 80 | FALSE if interrupts are globally disabled. 81 | 82 | --*/ 83 | 84 | _start: 85 | jmp EfiBiosMain # Just do it. 86 | 87 | ## 88 | ## --------------------------------------------------------- Internal Functions 89 | ## 90 | 91 | -------------------------------------------------------------------------------- /plat/cb/Makefile.inc: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 by coresystems GmbH 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 | # 18 | 19 | TARGETS-y += plat/cb/acpi.o plat/cb/fwvol.o 20 | TARGETS-y += plat/cb/main.o plat/cb/memmap.o 21 | TARGETS-y += plat/cb/timer.o plat/cb/disk.o 22 | TARGETS-y += plat/cb/runtime/runtime.o plat/cb/runtime/reboot.o 23 | # TARGETS-y += plat/cb/disk.o plat/cb/video.o 24 | 25 | -------------------------------------------------------------------------------- /plat/common: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # Common UEFI platform sources 13 | # 14 | # Abstract: 15 | # 16 | # This file includes common build arguments for all UEFI platform targets. 17 | # 18 | # Author: 19 | # 20 | # Evan Green 26-Feb-2014 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | INCLUDES += $(SRCROOT)/os/uefi/include; 29 | 30 | RTBASE = $(OBJROOT)/os/uefi/core/runtime/rtbase.ffs 31 | 32 | TARGETLIBS = $(OBJROOT)/os/kernel/kd/boot/kdboot.a \ 33 | $(OBJROOT)/os/kernel/kd/kdusb/kdnousb/kdnousb.a \ 34 | $(OBJROOT)/os/lib/basevid/basevid.a \ 35 | $(OBJROOT)/os/lib/fatlib/fat.a \ 36 | $(OBJROOT)/os/uefi/core/ueficore.a \ 37 | $(OBJROOT)/os/uefi/archlib/uefiarch.a \ 38 | $(OBJROOT)/os/lib/rtl/base/boot/basertlb.a \ 39 | 40 | ifeq ($(ARCH), armv7) 41 | 42 | TARGETLIBS += $(OBJROOT)/os/kernel/$(ARCH)/boot/armboot.a \ 43 | 44 | endif 45 | 46 | ifeq ($(ARCH), armv6) 47 | 48 | TARGETLIBS += $(OBJROOT)/os/kernel/$(ARCH)/boot/armboot.a \ 49 | 50 | endif 51 | 52 | -------------------------------------------------------------------------------- /plat/integcp/acpi/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # Integrator/CP ACPI Tables 13 | # 14 | # Abstract: 15 | # 16 | # This module compiles the Integrator/CP ACPI tables. 17 | # 18 | # Author: 19 | # 20 | # Evan Green 7-Apr-2014 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | BINARY := acpi.ffs 29 | 30 | BINARYTYPE = none 31 | 32 | IASL = iasl 33 | 34 | IASL_OPTIONS = -we 35 | 36 | OBJS += dbg2.aml \ 37 | dsdt.aml \ 38 | facp.aml \ 39 | facs.aml \ 40 | incp.aml \ 41 | 42 | include $(SRCROOT)/os/minoca.mk 43 | 44 | $(BINARY): $(OBJS) 45 | @echo Generating - $@ 46 | @cd $(OBJROOT)/$(THISDIR) && \ 47 | genffs -g 7E374E25-8E01-4FEE-87F2-390C23C606CD -r EFI_SECTION_RAW \ 48 | -t EFI_FV_FILETYPE_FREEFORM -o $@ $^ 49 | 50 | %.aml:%.asl 51 | @echo Compiling ASL - $< 52 | @$(IASL) $(IASL_OPTIONS) -p $(OBJROOT)/$(THISDIR)/$@ $< > $(OBJROOT)/$(THISDIR)/iaslout.txt 53 | 54 | -------------------------------------------------------------------------------- /plat/integcp/acpi/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | Integrator/CP ACPI Tables 13 | 14 | Abstract: 15 | 16 | This module compiles the Integrator/CP ACPI tables. 17 | 18 | Author: 19 | 20 | Evan Green 7-Apr-2014 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | from menv import compiledAsl; 29 | 30 | function build() { 31 | var asl; 32 | var entries; 33 | var ffs; 34 | var ffsSources; 35 | var sources; 36 | 37 | sources = [ 38 | "dbg2.asl", 39 | "dsdt.asl", 40 | "facp.asl", 41 | "facs.asl", 42 | "incp.asl" 43 | ]; 44 | 45 | asl = compiledAsl(sources); 46 | entries = asl[1]; 47 | ffsSources = asl[0]; 48 | ffs = { 49 | "type": "target", 50 | "label": "acpi.ffs", 51 | "inputs": ffsSources, 52 | "implicit": ["uefi/tools/genffs:genffs"], 53 | "tool": "genffs_acpi" 54 | }; 55 | 56 | entries += [ffs]; 57 | return entries; 58 | } 59 | 60 | -------------------------------------------------------------------------------- /plat/integcp/acpi/facs.asl: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | facs.asl 13 | 14 | Abstract: 15 | 16 | This module implements the Firmware ACPI Control Structure table. 17 | 18 | Author: 19 | 20 | Evan Green 26-Mar-2014 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | // 29 | // ---------------------------------------------------------------- Definitions 30 | // 31 | 32 | [0004] Signature : "FACS" 33 | [0004] Length : 00000040 34 | [0004] Hardware Signature : 00000000 35 | [0004] 32 Firmware Waking Vector : 00000000 36 | [0004] Global Lock : 00000000 37 | [0004] Flags (decoded below) : 00000000 38 | S4BIOS Support Present : 0 39 | 64-bit Wake Supported (V2) : 0 40 | [0008] 64 Firmware Waking Vector : 0000000000000000 41 | [0001] Version : 02 42 | [0003] Reserved : 000000 43 | [0004] OspmFlags (decoded below) : 00000000 44 | 64-bit Wake Env Required (V2) : 0 45 | 46 | -------------------------------------------------------------------------------- /plat/integcp/integfwv.S: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2016 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | integfwv.S 13 | 14 | Abstract: 15 | 16 | This module includes the firmware volume binary directly. 17 | 18 | Author: 19 | 20 | Evan Green 4-Oct-2016 21 | 22 | Environment: 23 | 24 | Any 25 | 26 | --*/ 27 | 28 | ## 29 | ## ---------------------------------------------------------------- Definitions 30 | ## 31 | 32 | #if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__) 33 | 34 | #define LABEL(_Name) _##_Name 35 | 36 | #else 37 | 38 | #define LABEL(_Name) _Name 39 | 40 | #endif 41 | 42 | #define INCLUDE_BINARY(_Path, _Name) \ 43 | .align 4; \ 44 | .global LABEL(_Name##_start); \ 45 | LABEL(_Name##_start):; \ 46 | .incbin _Path; \ 47 | .global LABEL(_Name##_end); \ 48 | LABEL(_Name##_end): 49 | 50 | ## 51 | ## ---------------------------------------------------------------------- Code 52 | ## 53 | 54 | .text 55 | 56 | INCLUDE_BINARY("integfwv", _binary_integfwv) 57 | 58 | -------------------------------------------------------------------------------- /plat/integcp/ramdisk.S: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2016 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | ramdisk.S 13 | 14 | Abstract: 15 | 16 | This module embeds the RAM disk image directly in the firmware image. 17 | 18 | Author: 19 | 20 | Evan Green 4-Oct-2016 21 | 22 | Environment: 23 | 24 | Any 25 | 26 | --*/ 27 | 28 | ## 29 | ## ---------------------------------------------------------------- Definitions 30 | ## 31 | 32 | #if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__) 33 | 34 | #define LABEL(_Name) _##_Name 35 | 36 | #else 37 | 38 | #define LABEL(_Name) _Name 39 | 40 | #endif 41 | 42 | #define INCLUDE_BINARY(_Path, _Name) \ 43 | .align 4; \ 44 | .global LABEL(_Name##_start); \ 45 | LABEL(_Name##_start):; \ 46 | .incbin _Path; \ 47 | .global LABEL(_Name##_end); \ 48 | LABEL(_Name##_end): 49 | 50 | ## 51 | ## ---------------------------------------------------------------------- Code 52 | ## 53 | 54 | .text 55 | 56 | INCLUDE_BINARY("ramdisk", _binary_ramdisk) 57 | 58 | -------------------------------------------------------------------------------- /plat/integcp/runtime/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # Integrator UEFI Runtime 13 | # 14 | # Abstract: 15 | # 16 | # This module implements the Integrator runtime firmware, which continues 17 | # running even after boot services have been torn down. It is never 18 | # unloaded. 19 | # 20 | # Author: 21 | # 22 | # Evan Green 7-Apr-2014 23 | # 24 | # Environment: 25 | # 26 | # Firmware 27 | # 28 | ################################################################################ 29 | 30 | BINARY = integrt.elf 31 | 32 | BINARYTYPE = staticapp 33 | 34 | BINPLACE = bin 35 | 36 | INCLUDES += $(SRCROOT)/os/uefi/include;$(SRCDIR)/..; 37 | 38 | OBJS += rtc.o \ 39 | runtime.o \ 40 | 41 | VPATH += $(BINROOT): 42 | 43 | ENTRY = EfiRuntimeCoreEntry 44 | 45 | LDFLAGS += -pie -Wl,--no-wchar-size-warning 46 | LDFLAGS += -nodefaultlibs -nostartfiles -nostdlib 47 | 48 | ifeq ($(ARCH), armv7) 49 | LINKER_SCRIPT = $(SRCROOT)/os/uefi/include/link_arm.x 50 | endif 51 | 52 | TARGETLIBS = $(OBJROOT)/os/uefi/core/rtlib/rtlib.a \ 53 | $(OBJROOT)/os/uefi/archlib/uefiarch.a \ 54 | $(OBJROOT)/os/uefi/dev/pl031/pl031.a \ 55 | 56 | include $(SRCROOT)/os/minoca.mk 57 | 58 | ## 59 | ## On architectures that produce ELF binaries, convert it to a PE image. 60 | ## 61 | 62 | postbuild: integrt.ffs 63 | 64 | integrt.ffs: integrt 65 | @genffs -s -i $< -r EFI_SECTION_PE32 \ 66 | -i $< -r EFI_SECTION_USER_INTERFACE -t EFI_FV_FILETYPE_DRIVER -o $@ 67 | 68 | integrt: $(BINARY) 69 | @elfconv -o $@ -t efiruntimedriver $< 70 | 71 | CFLAGS += -fshort-wchar 72 | 73 | -------------------------------------------------------------------------------- /plat/integcp/runtime/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | Integrator UEFI Runtime 13 | 14 | Abstract: 15 | 16 | This module implements the Integrator runtime firmware, which continues 17 | running even after boot services have been torn down. It is never unloaded. 18 | 19 | Author: 20 | 21 | Evan Green 7-Apr-2014 22 | 23 | Environment: 24 | 25 | Firmware 26 | 27 | --*/ 28 | 29 | from menv import executable, uefiRuntimeFfs; 30 | 31 | function build() { 32 | var elf; 33 | var entries; 34 | var includes; 35 | var libs; 36 | var linkConfig; 37 | var linkLdflags; 38 | var sources; 39 | var sourcesConfig; 40 | 41 | sources = [ 42 | "rtc.c", 43 | "runtime.c" 44 | ]; 45 | 46 | libs = [ 47 | "uefi/dev/pl031:pl031", 48 | "uefi/core/rtlib:rtlib", 49 | "uefi/archlib:uefiarch", 50 | ]; 51 | 52 | includes = [ 53 | "$S/uefi/include" 54 | ]; 55 | 56 | sourcesConfig = { 57 | "CFLAGS": ["-fshort-wchar"], 58 | }; 59 | 60 | linkLdflags = [ 61 | "-pie", 62 | "-nostdlib", 63 | "-Wl,--no-wchar-size-warning", 64 | "-static" 65 | ]; 66 | 67 | linkConfig = { 68 | "LDFLAGS": linkLdflags 69 | }; 70 | 71 | elf = { 72 | "label": "integrt.elf", 73 | "inputs": sources + libs, 74 | "sources_config": sourcesConfig, 75 | "includes": includes, 76 | "entry": "EfiRuntimeCoreEntry", 77 | "linker_script": "$S/uefi/include/link_arm.x", 78 | "config": linkConfig 79 | }; 80 | 81 | entries = executable(elf); 82 | entries += uefiRuntimeFfs("integrt"); 83 | return entries; 84 | } 85 | 86 | -------------------------------------------------------------------------------- /plat/panda/acpi/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # PandaBoard ACPI tables 13 | # 14 | # Abstract: 15 | # 16 | # This module compiles the PandaBoard ACPI tables. 17 | # 18 | # Author: 19 | # 20 | # Evan Green 26-Mar-2014 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | BINARY := acpi.ffs 29 | 30 | BINARYTYPE = none 31 | 32 | IASL = iasl 33 | 34 | IASL_OPTIONS = -we 35 | 36 | OBJS += apic.aml \ 37 | dbg2.aml \ 38 | dsdt.aml \ 39 | facp.aml \ 40 | facs.aml \ 41 | omp4.aml \ 42 | 43 | include $(SRCROOT)/os/minoca.mk 44 | 45 | $(BINARY): $(OBJS) 46 | @echo Generating - $@ 47 | @cd $(OBJROOT)/$(THISDIR) && \ 48 | genffs -g 7E374E25-8E01-4FEE-87F2-390C23C606CD -r EFI_SECTION_RAW \ 49 | -t EFI_FV_FILETYPE_FREEFORM -o $@ $^ 50 | 51 | %.aml:%.asl 52 | @echo Compiling ASL - $< 53 | @$(IASL) $(IASL_OPTIONS) -p $(OBJROOT)/$(THISDIR)/$@ $< > $(OBJROOT)/$(THISDIR)/iaslout.txt 54 | 55 | -------------------------------------------------------------------------------- /plat/panda/acpi/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | PandaBoard ACPI tables 13 | 14 | Abstract: 15 | 16 | This module compiles the PandaBoard ACPI tables. 17 | 18 | Author: 19 | 20 | Evan Green 26-Mar-2014 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | from menv import compiledAsl; 29 | 30 | function build() { 31 | var asl; 32 | var entries; 33 | var ffs; 34 | var ffsSources; 35 | var sources; 36 | 37 | sources = [ 38 | "apic.asl", 39 | "dbg2.asl", 40 | "dsdt.asl", 41 | "facp.asl", 42 | "facs.asl", 43 | "omp4.asl" 44 | ]; 45 | 46 | asl = compiledAsl(sources); 47 | entries = asl[1]; 48 | ffsSources = asl[0]; 49 | ffs = { 50 | "type": "target", 51 | "label": "acpi.ffs", 52 | "inputs": ffsSources, 53 | "implicit": ["uefi/tools/genffs:genffs"], 54 | "tool": "genffs_acpi" 55 | }; 56 | 57 | entries += [ffs]; 58 | return entries; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /plat/panda/acpi/facs.asl: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | facs.asl 13 | 14 | Abstract: 15 | 16 | This module implements the Firmware ACPI Control Structure table. 17 | 18 | Author: 19 | 20 | Evan Green 26-Mar-2014 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | // 29 | // ---------------------------------------------------------------- Definitions 30 | // 31 | 32 | [0004] Signature : "FACS" 33 | [0004] Length : 00000040 34 | [0004] Hardware Signature : 00000000 35 | [0004] 32 Firmware Waking Vector : 00000000 36 | [0004] Global Lock : 00000000 37 | [0004] Flags (decoded below) : 00000000 38 | S4BIOS Support Present : 0 39 | 64-bit Wake Supported (V2) : 0 40 | [0008] 64 Firmware Waking Vector : 0000000000000000 41 | [0001] Version : 02 42 | [0003] Reserved : 000000 43 | [0004] OspmFlags (decoded below) : 00000000 44 | 64-bit Wake Env Required (V2) : 0 45 | -------------------------------------------------------------------------------- /plat/panda/init/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2012 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # PandaBoard Stage 1 Loader 13 | # 14 | # Abstract: 15 | # 16 | # This module implements OMAP4 first stage loader. 17 | # 18 | # Author: 19 | # 20 | # Evan Green 1-Apr-2014 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | BINARY := omap4mlo.elf 29 | 30 | BINARYTYPE = staticapp 31 | 32 | BINPLACE = bin 33 | 34 | VPATH += $(BINROOT): 35 | 36 | INCLUDES += $(SRCROOT)/os/uefi/include; 37 | 38 | LDFLAGS += -nodefaultlibs -nostartfiles -nostdlib -Wl,-zmax-page-size=1 39 | 40 | ## 41 | ## The first stage loader has to be built in ARM mode since the ROM code 42 | ## seems to reset if interrupts are enabled and the processor is in Thumb mode. 43 | ## 44 | 45 | EXTRA_CFLAGS += -marm 46 | 47 | OBJS += boot.o \ 48 | clock.o \ 49 | crc32.o \ 50 | fatboot.o \ 51 | gpio.o \ 52 | id.o \ 53 | mux.o \ 54 | serial.o \ 55 | rommem.o \ 56 | romusb.o \ 57 | 58 | ARMV7_OBJS = armv7/start.o \ 59 | 60 | TEXT_ADDRESS := 0x40308000 61 | 62 | EXTRA_SRC_DIRS = armv7 63 | 64 | DIRS = fwbuild \ 65 | 66 | include $(SRCROOT)/os/minoca.mk 67 | 68 | postbuild: omap4mlo 69 | 70 | omap4mlo: omap4mlo.bin 71 | @echo Generating - $@ 72 | @fwbuild/pandafwb 0x40300000 $^ $@ 73 | @cp -p $@ $(BINROOT)/ 74 | 75 | omap4mlo.bin: $(BINARY) 76 | @echo Flattening - $(notdir $<) 77 | @$(OBJCOPY) -O binary $^ $@ 78 | @cp -p $@ $(BINROOT)/ 79 | 80 | -------------------------------------------------------------------------------- /plat/panda/init/fwbuild/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # PandaFwb 13 | # 14 | # Abstract: 15 | # 16 | # This build utility adds the necessary header for USB booting the 17 | # init application on OMAP4 SoCs. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 1-Apr-2014 22 | # 23 | # Environment: 24 | # 25 | # Build 26 | # 27 | ################################################################################ 28 | 29 | BINARY = pandafwb 30 | 31 | BUILD = yes 32 | 33 | BINARYTYPE = build 34 | 35 | OBJS = fwbuild.o 36 | 37 | include $(SRCROOT)/os/minoca.mk 38 | 39 | -------------------------------------------------------------------------------- /plat/panda/pandafwv.S: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2016 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | pandafwv.S 13 | 14 | Abstract: 15 | 16 | This module includes the firmware volume binary directly. 17 | 18 | Author: 19 | 20 | Evan Green 4-Oct-2016 21 | 22 | Environment: 23 | 24 | Any 25 | 26 | --*/ 27 | 28 | ## 29 | ## ---------------------------------------------------------------- Definitions 30 | ## 31 | 32 | #if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__) 33 | 34 | #define LABEL(_Name) _##_Name 35 | 36 | #else 37 | 38 | #define LABEL(_Name) _Name 39 | 40 | #endif 41 | 42 | #define INCLUDE_BINARY(_Path, _Name) \ 43 | .align 4; \ 44 | .global LABEL(_Name##_start); \ 45 | LABEL(_Name##_start):; \ 46 | .incbin _Path; \ 47 | .global LABEL(_Name##_end); \ 48 | LABEL(_Name##_end): 49 | 50 | ## 51 | ## ---------------------------------------------------------------------- Code 52 | ## 53 | 54 | .text 55 | 56 | INCLUDE_BINARY("pandafwv", _binary_pandafwv) 57 | 58 | -------------------------------------------------------------------------------- /plat/panda/ramdisk.S: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2016 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | ramdisk.S 13 | 14 | Abstract: 15 | 16 | This module embeds the RAM disk image directly in the firmware image. 17 | 18 | Author: 19 | 20 | Evan Green 4-Oct-2016 21 | 22 | Environment: 23 | 24 | Any 25 | 26 | --*/ 27 | 28 | ## 29 | ## ---------------------------------------------------------------- Definitions 30 | ## 31 | 32 | #if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__) 33 | 34 | #define LABEL(_Name) _##_Name 35 | 36 | #else 37 | 38 | #define LABEL(_Name) _Name 39 | 40 | #endif 41 | 42 | #define INCLUDE_BINARY(_Path, _Name) \ 43 | .align 4; \ 44 | .global LABEL(_Name##_start); \ 45 | LABEL(_Name##_start):; \ 46 | .incbin _Path; \ 47 | .global LABEL(_Name##_end); \ 48 | LABEL(_Name##_end): 49 | 50 | ## 51 | ## ---------------------------------------------------------------------- Code 52 | ## 53 | 54 | .text 55 | 56 | INCLUDE_BINARY("ramdisk", _binary_ramdisk) 57 | 58 | -------------------------------------------------------------------------------- /plat/rpi/acpi/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # Raspberry Pi ACPI Tables 13 | # 14 | # Abstract: 15 | # 16 | # This module compiles the Raspberry Pi ACPI tables. 17 | # 18 | # Author: 19 | # 20 | # Chris Stevens 31-Dec-2014 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | BINARY := acpi.ffs 29 | 30 | BINARYTYPE = none 31 | 32 | IASL = iasl 33 | 34 | IASL_OPTIONS = -we 35 | 36 | OBJS += dbg2.aml \ 37 | dsdt.aml \ 38 | facp.aml \ 39 | facs.aml \ 40 | bcm2.aml \ 41 | 42 | include $(SRCROOT)/os/minoca.mk 43 | 44 | $(BINARY): $(OBJS) 45 | @echo Generating - $@ 46 | @cd $(OBJROOT)/$(THISDIR) && \ 47 | genffs -g 7E374E25-8E01-4FEE-87F2-390C23C606CD -r EFI_SECTION_RAW \ 48 | -t EFI_FV_FILETYPE_FREEFORM -o $@ $^ 49 | 50 | %.aml:%.asl 51 | @echo Compiling ASL - $< 52 | @$(IASL) $(IASL_OPTIONS) -p $(OBJROOT)/$(THISDIR)/$@ $< > $(OBJROOT)/$(THISDIR)/iaslout.txt 53 | 54 | -------------------------------------------------------------------------------- /plat/rpi/acpi/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | Raspberry Pi ACPI Tables 13 | 14 | Abstract: 15 | 16 | This module compiles the Raspberry Pi ACPI tables. 17 | 18 | Author: 19 | 20 | Chris Stevens 31-Dec-2014 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | from menv import compiledAsl; 29 | 30 | function build() { 31 | var asl; 32 | var entries; 33 | var ffs; 34 | var ffsSources; 35 | var sources; 36 | 37 | sources = [ 38 | "bcm2.asl", 39 | "dbg2.asl", 40 | "dsdt.asl", 41 | "facp.asl", 42 | "facs.asl" 43 | ]; 44 | 45 | asl = compiledAsl(sources); 46 | entries = asl[1]; 47 | ffsSources = asl[0]; 48 | ffs = { 49 | "type": "target", 50 | "label": "acpi.ffs", 51 | "inputs": ffsSources, 52 | "implicit": ["uefi/tools/genffs:genffs"], 53 | "tool": "genffs_acpi" 54 | }; 55 | 56 | entries += [ffs]; 57 | return entries; 58 | } 59 | 60 | -------------------------------------------------------------------------------- /plat/rpi/acpi/facs.asl: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | facs.asl 13 | 14 | Abstract: 15 | 16 | This module implements the Firmware ACPI Control Structure table. 17 | 18 | Author: 19 | 20 | Evan Green 26-Mar-2014 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | // 29 | // ---------------------------------------------------------------- Definitions 30 | // 31 | 32 | [0004] Signature : "FACS" 33 | [0004] Length : 00000040 34 | [0004] Hardware Signature : 00000000 35 | [0004] 32 Firmware Waking Vector : 00000000 36 | [0004] Global Lock : 00000000 37 | [0004] Flags (decoded below) : 00000000 38 | S4BIOS Support Present : 0 39 | 64-bit Wake Supported (V2) : 0 40 | [0008] 64 Firmware Waking Vector : 0000000000000000 41 | [0001] Version : 02 42 | [0003] Reserved : 000000 43 | [0004] OspmFlags (decoded below) : 00000000 44 | 64-bit Wake Env Required (V2) : 0 45 | 46 | -------------------------------------------------------------------------------- /plat/rpi/blobs/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2015 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # Blobs 13 | # 14 | # Abstract: 15 | # 16 | # This directory contains the binary blobs needed to boot the Raspberry 17 | # Pi. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 26-Oct-2015 22 | # 23 | # Environment: 24 | # 25 | # User Mode 26 | # 27 | ################################################################################ 28 | 29 | include $(SRCROOT)/os/minoca.mk 30 | 31 | all: 32 | @cd $(SRCROOT)/os/uefi/plat/rpi2/blobs && \ 33 | $(MAKE) SRCDIR=$(SRCROOT)/os/uefi/plat/rpi2/blobs 34 | 35 | -------------------------------------------------------------------------------- /plat/rpi/rpifwv.S: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2016 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | rpifwv.S 13 | 14 | Abstract: 15 | 16 | This module includes the firmware volume binary directly. 17 | 18 | Author: 19 | 20 | Evan Green 4-Oct-2016 21 | 22 | Environment: 23 | 24 | Any 25 | 26 | --*/ 27 | 28 | ## 29 | ## ---------------------------------------------------------------- Definitions 30 | ## 31 | 32 | #if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__) 33 | 34 | #define LABEL(_Name) _##_Name 35 | 36 | #else 37 | 38 | #define LABEL(_Name) _Name 39 | 40 | #endif 41 | 42 | #define INCLUDE_BINARY(_Path, _Name) \ 43 | .align 4; \ 44 | .global LABEL(_Name##_start); \ 45 | LABEL(_Name##_start):; \ 46 | .incbin _Path; \ 47 | .global LABEL(_Name##_end); \ 48 | LABEL(_Name##_end): 49 | 50 | ## 51 | ## ---------------------------------------------------------------------- Code 52 | ## 53 | 54 | .text 55 | 56 | INCLUDE_BINARY("rpifwv", _binary_rpifwv) 57 | 58 | -------------------------------------------------------------------------------- /plat/rpi/runtime/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2015 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # Raspberry Pi UEFI Runtime 13 | # 14 | # Abstract: 15 | # 16 | # This module implements the Raspberry Pi runtime firmware, which 17 | # continues running even after boot services have been torn down. It is 18 | # never unloaded. 19 | # 20 | # Author: 21 | # 22 | # Chris Stevens 5-Jan-2015 23 | # 24 | # Environment: 25 | # 26 | # Firmware 27 | # 28 | ################################################################################ 29 | 30 | BINARY = rpirt.elf 31 | 32 | BINARYTYPE = staticapp 33 | 34 | BINPLACE = bin 35 | 36 | INCLUDES += $(SRCROOT)/os/uefi/include;$(SRCDIR)/..; 37 | 38 | OBJS += runtime.o \ 39 | 40 | VPATH += $(BINROOT): 41 | 42 | ENTRY = EfiRuntimeCoreEntry 43 | 44 | LDFLAGS += -pie -Wl,--no-wchar-size-warning 45 | LDFLAGS += -nodefaultlibs -nostartfiles -nostdlib 46 | 47 | ifeq ($(ARCH), armv6) 48 | LINKER_SCRIPT = $(SRCROOT)/os/uefi/include/link_arm.x 49 | endif 50 | 51 | TARGETLIBS = $(OBJROOT)/os/uefi/core/rtlib/rtlib.a \ 52 | $(OBJROOT)/os/uefi/archlib/uefiarch.a \ 53 | 54 | include $(SRCROOT)/os/minoca.mk 55 | 56 | ## 57 | ## On architectures that produce ELF binaries, convert it to a PE image. 58 | ## 59 | 60 | postbuild: rpirt 61 | 62 | postbuild: rpirt.ffs 63 | 64 | rpirt.ffs: rpirt 65 | @genffs -s -i $< -r EFI_SECTION_PE32 \ 66 | -i $< -r EFI_SECTION_USER_INTERFACE -t EFI_FV_FILETYPE_DRIVER -o $@ 67 | 68 | rpirt: $(BINARY) 69 | @echo Converting - $(notdir $<) 70 | @elfconv -o $@ -t efiruntimedriver $< 71 | 72 | CFLAGS += -fshort-wchar 73 | 74 | -------------------------------------------------------------------------------- /plat/rpi/runtime/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2015 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | Raspberry Pi 2 UEFI Runtime 13 | 14 | Abstract: 15 | 16 | This module implements the Raspberry Pi 2 runtime firmware, which 17 | continues running even after boot services have been torn down. It is 18 | never unloaded. 19 | 20 | Author: 21 | 22 | Chris Stevens 17-Mar-2015 23 | 24 | Environment: 25 | 26 | Firmware 27 | 28 | --*/ 29 | 30 | from menv import executable, uefiRuntimeFfs; 31 | 32 | function build() { 33 | var elf; 34 | var entries; 35 | var includes; 36 | var libs; 37 | var linkConfig; 38 | var LinkLdflags; 39 | var sources; 40 | var sourcesConfig; 41 | 42 | sources = [ 43 | "runtime.c" 44 | ]; 45 | 46 | libs = [ 47 | "uefi/core/rtlib:rtlib", 48 | "uefi/archlib:uefiarch" 49 | ]; 50 | 51 | includes = [ 52 | "$S/uefi/include" 53 | ]; 54 | 55 | sourcesConfig = { 56 | "CFLAGS": ["-fshort-wchar"], 57 | }; 58 | 59 | LinkLdflags = [ 60 | "-pie", 61 | "-nostdlib", 62 | "-Wl,--no-wchar-size-warning", 63 | "-static" 64 | ]; 65 | 66 | linkConfig = { 67 | "LDFLAGS": LinkLdflags 68 | }; 69 | 70 | elf = { 71 | "label": "rpirt.elf", 72 | "inputs": sources + libs, 73 | "sources_config": sourcesConfig, 74 | "includes": includes, 75 | "entry": "EfiRuntimeCoreEntry", 76 | "linker_script": "$S/uefi/include/link_arm.x", 77 | "config": linkConfig 78 | }; 79 | 80 | entries = executable(elf); 81 | entries += uefiRuntimeFfs("rpirt"); 82 | return entries; 83 | } 84 | 85 | -------------------------------------------------------------------------------- /plat/rpi2/acpi/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # Raspberry Pi 2 ACPI Tables 13 | # 14 | # Abstract: 15 | # 16 | # This module compiles the Raspberry Pi 2 ACPI tables. 17 | # 18 | # Author: 19 | # 20 | # Chris Stevens 17-Mar-2015 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | BINARY := acpi.ffs 29 | 30 | BINARYTYPE = none 31 | 32 | IASL = iasl 33 | 34 | IASL_OPTIONS = -we 35 | 36 | OBJS += dbg2.aml \ 37 | dsdt.aml \ 38 | facp.aml \ 39 | facs.aml \ 40 | gtdt.aml \ 41 | bcm2.aml \ 42 | 43 | include $(SRCROOT)/os/minoca.mk 44 | 45 | $(BINARY): $(OBJS) 46 | @echo Generating - $@ 47 | @cd $(OBJROOT)/$(THISDIR) && \ 48 | genffs -g 7E374E25-8E01-4FEE-87F2-390C23C606CD -r EFI_SECTION_RAW \ 49 | -t EFI_FV_FILETYPE_FREEFORM -o $@ $^ 50 | 51 | %.aml:%.asl 52 | @echo Compiling ASL - $< 53 | @$(IASL) $(IASL_OPTIONS) -p $(OBJROOT)/$(THISDIR)/$@ $< > $(OBJROOT)/$(THISDIR)/iaslout.txt 54 | 55 | -------------------------------------------------------------------------------- /plat/rpi2/acpi/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2015 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | Raspberry Pi 2 ACPI Tables 13 | 14 | Abstract: 15 | 16 | This module compiles the Raspberry Pi 2 ACPI tables. 17 | 18 | Author: 19 | 20 | Chris Stevens 17-Mar-2015 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | from menv import compiledAsl; 29 | 30 | function build() { 31 | var asl; 32 | var entries; 33 | var ffs; 34 | var ffsSources; 35 | var sources; 36 | 37 | sources = [ 38 | "bcm2.asl", 39 | "dbg2.asl", 40 | "dsdt.asl", 41 | "facp.asl", 42 | "facs.asl", 43 | "gtdt.asl" 44 | ]; 45 | 46 | asl = compiledAsl(sources); 47 | entries = asl[1]; 48 | ffsSources = asl[0]; 49 | ffs = { 50 | "type": "target", 51 | "label": "acpi.ffs", 52 | "inputs": ffsSources, 53 | "implicit": ["uefi/tools/genffs:genffs"], 54 | "tool": "genffs_acpi" 55 | }; 56 | 57 | entries += [ffs]; 58 | return entries; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /plat/rpi2/acpi/facs.asl: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | facs.asl 13 | 14 | Abstract: 15 | 16 | This module implements the Firmware ACPI Control Structure table. 17 | 18 | Author: 19 | 20 | Evan Green 26-Mar-2014 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | // 29 | // ---------------------------------------------------------------- Definitions 30 | // 31 | 32 | [0004] Signature : "FACS" 33 | [0004] Length : 00000040 34 | [0004] Hardware Signature : 00000000 35 | [0004] 32 Firmware Waking Vector : 00000000 36 | [0004] Global Lock : 00000000 37 | [0004] Flags (decoded below) : 00000000 38 | S4BIOS Support Present : 0 39 | 64-bit Wake Supported (V2) : 0 40 | [0008] 64 Firmware Waking Vector : 0000000000000000 41 | [0001] Version : 02 42 | [0003] Reserved : 000000 43 | [0004] OspmFlags (decoded below) : 00000000 44 | 64-bit Wake Env Required (V2) : 0 45 | 46 | -------------------------------------------------------------------------------- /plat/rpi2/armv7/timera.S: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2016 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | timera.S 13 | 14 | Abstract: 15 | 16 | This module implements assembly routines for BCM2836 timers. 17 | 18 | Author: 19 | 20 | Chris Stevens 14-Jun-2016 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | ## 29 | ## ------------------------------------------------------------------ Includes 30 | ## 31 | 32 | #include 33 | 34 | ## 35 | ## --------------------------------------------------------------- Definitions 36 | ## 37 | 38 | ## 39 | ## ---------------------------------------------------------------------- Code 40 | ## 41 | 42 | ASSEMBLY_FILE_HEADER 43 | 44 | ## 45 | ## UINT32 46 | ## EfipBcm2836GetGtFrequency ( 47 | ## VOID 48 | ## ) 49 | ## 50 | 51 | /*++ 52 | 53 | Routine Description: 54 | 55 | This routine gets the ARM Generic Timer's frequency (CNTFRQ). 56 | 57 | Arguments: 58 | 59 | None. 60 | 61 | Return Value: 62 | 63 | Returns the value of the CNTFRQ. 64 | 65 | --*/ 66 | 67 | FUNCTION EfipBcm2836GetGtFrequency 68 | mrc p15, 0, %r0, %c14, %c0, 0 @ Get the CNTFRQ 69 | bx %lr @ 70 | 71 | END_FUNCTION EfipBcm2836GetGtFrequency 72 | 73 | ## 74 | ## --------------------------------------------------------- Internal Functions 75 | ## 76 | 77 | -------------------------------------------------------------------------------- /plat/rpi2/blobs/LICENCE.broadcom: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006, Broadcom Corporation. 2 | Copyright (c) 2015, Raspberry Pi (Trading) Ltd 3 | All rights reserved. 4 | 5 | Redistribution. Redistribution and use in binary form, without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | * This software may only be used for the purposes of developing for, 10 | running or using a Raspberry Pi device. 11 | * Redistributions must reproduce the above copyright notice and the 12 | following disclaimer in the documentation and/or other materials 13 | provided with the distribution. 14 | * Neither the name of Broadcom Corporation nor the names of its suppliers 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 19 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 20 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 21 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 25 | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 27 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 28 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 29 | DAMAGE. 30 | -------------------------------------------------------------------------------- /plat/rpi2/blobs/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2015 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # Blobs 13 | # 14 | # Abstract: 15 | # 16 | # This directory contains the binary blobs needed to boot the Raspberry 17 | # Pi and Raspberry Pi 2. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 26-Oct-2015 22 | # 23 | # Environment: 24 | # 25 | # User Mode 26 | # 27 | ################################################################################ 28 | 29 | include $(SRCROOT)/os/minoca.mk 30 | 31 | BINDIR = $(BINROOT)/rpi 32 | 33 | BINFILES = $(BINDIR)/bootcode.bin \ 34 | $(BINDIR)/config.txt \ 35 | $(BINDIR)/fixup.dat \ 36 | $(BINDIR)/start.elf \ 37 | $(BINDIR)/LICENCE.broadcom \ 38 | 39 | all: $(BINFILES) 40 | 41 | $(BINFILES): | $(BINDIR) 42 | 43 | $(BINDIR): 44 | @mkdir -p $@ 45 | 46 | $(BINDIR)/bootcode.bin: bootcode.bin 47 | @cp -pv $< $@ 48 | 49 | $(BINDIR)/config.txt: config.txt 50 | @cp -pv $< $@ 51 | 52 | $(BINDIR)/fixup.dat: fixup.dat 53 | @cp -pv $< $@ 54 | 55 | $(BINDIR)/start.elf: start.elf 56 | @cp -pv $< $@ 57 | 58 | $(BINDIR)/LICENCE.broadcom: LICENCE.broadcom 59 | @cp -pv $< $@ 60 | -------------------------------------------------------------------------------- /plat/rpi2/blobs/bootcode.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yabits/uefi/eac0b30161fb67de7fedf6ba24ebd3d2c0cc58f2/plat/rpi2/blobs/bootcode.bin -------------------------------------------------------------------------------- /plat/rpi2/blobs/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2015 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | Raspberry Pi Binary Blobs 13 | 14 | Abstract: 15 | 16 | This directory contains the binary blobs needed to boot the Raspberry 17 | Pi, Raspberry Pi 2, and Raspberry Pi 3 (in 32-bit mode). 18 | 19 | Author: 20 | 21 | Chris Stevens 26-Oct-2015 22 | 23 | Environment: 24 | 25 | Firmware 26 | 27 | --*/ 28 | 29 | from menv import copy, group, mconfig; 30 | 31 | function build() { 32 | var blobs; 33 | var blobTargets; 34 | var entries; 35 | var plat = "rpi2"; 36 | var rpibin; 37 | 38 | blobs = [ 39 | "bootcode.bin", 40 | "config.txt", 41 | "fixup.dat", 42 | "LICENCE.broadcom", 43 | "start.elf" 44 | ]; 45 | 46 | rpibin = mconfig.binroot + "/rpi/"; 47 | blobTargets = []; 48 | entries = []; 49 | for (blob in blobs) { 50 | entries += copy(blob, 51 | rpibin + "/" + blob, 52 | blob, 53 | null, 54 | null); 55 | 56 | blobTargets += [":" + blob]; 57 | } 58 | 59 | entries += group("blobs", blobTargets); 60 | return entries; 61 | } 62 | 63 | -------------------------------------------------------------------------------- /plat/rpi2/blobs/fixup.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yabits/uefi/eac0b30161fb67de7fedf6ba24ebd3d2c0cc58f2/plat/rpi2/blobs/fixup.dat -------------------------------------------------------------------------------- /plat/rpi2/blobs/start.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yabits/uefi/eac0b30161fb67de7fedf6ba24ebd3d2c0cc58f2/plat/rpi2/blobs/start.elf -------------------------------------------------------------------------------- /plat/rpi2/rpi2fwv.S: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2016 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | rpi2fwv.S 13 | 14 | Abstract: 15 | 16 | This module includes the firmware volume binary directly. 17 | 18 | Author: 19 | 20 | Evan Green 4-Oct-2016 21 | 22 | Environment: 23 | 24 | Any 25 | 26 | --*/ 27 | 28 | ## 29 | ## ---------------------------------------------------------------- Definitions 30 | ## 31 | 32 | #if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__) 33 | 34 | #define LABEL(_Name) _##_Name 35 | 36 | #else 37 | 38 | #define LABEL(_Name) _Name 39 | 40 | #endif 41 | 42 | #define INCLUDE_BINARY(_Path, _Name) \ 43 | .align 4; \ 44 | .global LABEL(_Name##_start); \ 45 | LABEL(_Name##_start):; \ 46 | .incbin _Path; \ 47 | .global LABEL(_Name##_end); \ 48 | LABEL(_Name##_end): 49 | 50 | ## 51 | ## ---------------------------------------------------------------------- Code 52 | ## 53 | 54 | .text 55 | 56 | INCLUDE_BINARY("rpi2fwv", _binary_rpi2fwv) 57 | 58 | -------------------------------------------------------------------------------- /plat/rpi2/runtime/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2015 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # Raspberry Pi 2 UEFI Runtime 13 | # 14 | # Abstract: 15 | # 16 | # This module implements the Raspberry Pi 2 runtime firmware, which 17 | # continues running even after boot services have been torn down. It is 18 | # never unloaded. 19 | # 20 | # Author: 21 | # 22 | # Chris Stevens 17-Mar-2015 23 | # 24 | # Environment: 25 | # 26 | # Firmware 27 | # 28 | ################################################################################ 29 | 30 | BINARY = rpi2rt.elf 31 | 32 | BINARYTYPE = staticapp 33 | 34 | BINPLACE = bin 35 | 36 | INCLUDES += $(SRCROOT)/os/uefi/include;$(SRCDIR)/..; 37 | 38 | OBJS += runtime.o \ 39 | 40 | VPATH += $(BINROOT): 41 | 42 | ENTRY = EfiRuntimeCoreEntry 43 | 44 | LDFLAGS += -pie -Wl,--no-wchar-size-warning 45 | LDFLAGS += -nodefaultlibs -nostartfiles -nostdlib 46 | 47 | ifeq ($(ARCH), armv7) 48 | LINKER_SCRIPT = $(SRCROOT)/os/uefi/include/link_arm.x 49 | endif 50 | 51 | TARGETLIBS = $(OBJROOT)/os/uefi/core/rtlib/rtlib.a \ 52 | $(OBJROOT)/os/uefi/archlib/uefiarch.a \ 53 | 54 | include $(SRCROOT)/os/minoca.mk 55 | 56 | ## 57 | ## On architectures that produce ELF binaries, convert it to a PE image. 58 | ## 59 | 60 | postbuild: rpi2rt 61 | 62 | postbuild: rpi2rt.ffs 63 | 64 | rpi2rt.ffs: rpi2rt 65 | @genffs -s -i $< -r EFI_SECTION_PE32 \ 66 | -i $< -r EFI_SECTION_USER_INTERFACE -t EFI_FV_FILETYPE_DRIVER -o $@ 67 | 68 | rpi2rt: $(BINARY) 69 | @echo Converting - $(notdir $<) 70 | @elfconv -o $@ -t efiruntimedriver $< 71 | 72 | CFLAGS += -fshort-wchar 73 | 74 | -------------------------------------------------------------------------------- /plat/rpi2/runtime/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2015 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | Raspberry Pi 2 UEFI Runtime 13 | 14 | Abstract: 15 | 16 | This module implements the Raspberry Pi 2 runtime firmware, which 17 | continues running even after boot services have been torn down. It is 18 | never unloaded. 19 | 20 | Author: 21 | 22 | Chris Stevens 17-Mar-2015 23 | 24 | Environment: 25 | 26 | Firmware 27 | 28 | --*/ 29 | 30 | from menv import executable, uefiRuntimeFfs; 31 | 32 | function build() { 33 | var elf; 34 | var entries; 35 | var includes; 36 | var libs; 37 | var linkConfig; 38 | var linkLdflags; 39 | var sources; 40 | var sources_config; 41 | 42 | sources = [ 43 | "runtime.c" 44 | ]; 45 | 46 | libs = [ 47 | "uefi/core/rtlib:rtlib", 48 | "uefi/archlib:uefiarch" 49 | ]; 50 | 51 | includes = [ 52 | "$S/uefi/include" 53 | ]; 54 | 55 | sources_config = { 56 | "CFLAGS": ["-fshort-wchar"], 57 | }; 58 | 59 | linkLdflags = [ 60 | "-pie", 61 | "-nostdlib", 62 | "-Wl,--no-wchar-size-warning", 63 | "-static" 64 | ]; 65 | 66 | linkConfig = { 67 | "LDFLAGS": linkLdflags 68 | }; 69 | 70 | elf = { 71 | "label": "rpi2rt.elf", 72 | "inputs": sources + libs, 73 | "sources_config": sources_config, 74 | "includes": includes, 75 | "entry": "EfiRuntimeCoreEntry", 76 | "linker_script": "$S/uefi/include/link_arm.x", 77 | "config": linkConfig 78 | }; 79 | 80 | entries = executable(elf); 81 | entries += uefiRuntimeFfs("rpi2rt"); 82 | return entries; 83 | } 84 | 85 | -------------------------------------------------------------------------------- /plat/veyron/acpi/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2015 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # Veyron ACPI tables 13 | # 14 | # Abstract: 15 | # 16 | # This module compiles the Veyron ACPI tables. 17 | # 18 | # Author: 19 | # 20 | # Evan Green 10-Jul-2015 21 | # 22 | # Environment: 23 | # 24 | # Firmware 25 | # 26 | ################################################################################ 27 | 28 | BINARY := acpi.ffs 29 | 30 | BINARYTYPE = none 31 | 32 | IASL = iasl 33 | 34 | IASL_OPTIONS = -we 35 | 36 | OBJS += apic.aml \ 37 | dbg2.aml \ 38 | dsdt.aml \ 39 | facp.aml \ 40 | facs.aml \ 41 | gtdt.aml \ 42 | rk32.aml \ 43 | 44 | include $(SRCROOT)/os/minoca.mk 45 | 46 | $(BINARY): $(OBJS) 47 | @echo Generating - $@ 48 | @cd $(OBJROOT)/$(THISDIR) && \ 49 | genffs -g 7E374E25-8E01-4FEE-87F2-390C23C606CD -r EFI_SECTION_RAW \ 50 | -t EFI_FV_FILETYPE_FREEFORM -o $@ $^ 51 | 52 | %.aml:%.asl 53 | @echo Compiling ASL - $< 54 | @$(IASL) $(IASL_OPTIONS) -p $(OBJROOT)/$(THISDIR)/$@ $< > $(OBJROOT)/$(THISDIR)/iaslout.txt 55 | 56 | -------------------------------------------------------------------------------- /plat/veyron/acpi/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2015 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | Veyron ACPI tables 13 | 14 | Abstract: 15 | 16 | This module compiles the Veyron ACPI tables. 17 | 18 | Author: 19 | 20 | Evan Green 10-Jul-2015 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | from menv import compiledAsl; 29 | 30 | function build() { 31 | var asl; 32 | var entries; 33 | var ffs; 34 | var ffsSources; 35 | var sources; 36 | 37 | sources = [ 38 | "apic.asl", 39 | "dbg2.asl", 40 | "dsdt.asl", 41 | "facp.asl", 42 | "facs.asl", 43 | "gtdt.asl", 44 | "rk32.asl" 45 | ]; 46 | 47 | asl = compiledAsl(sources); 48 | entries = asl[1]; 49 | ffsSources = asl[0]; 50 | ffs = { 51 | "type": "target", 52 | "label": "acpi.ffs", 53 | "inputs": ffsSources, 54 | "implicit": ["uefi/tools/genffs:genffs"], 55 | "tool": "genffs_acpi" 56 | }; 57 | 58 | entries += [ffs]; 59 | return entries; 60 | } 61 | 62 | -------------------------------------------------------------------------------- /plat/veyron/acpi/facs.asl: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2015 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | facs.asl 13 | 14 | Abstract: 15 | 16 | This module implements the Firmware ACPI Control Structure table. 17 | 18 | Author: 19 | 20 | Evan Green 10-Jul-2015 21 | 22 | Environment: 23 | 24 | Firmware 25 | 26 | --*/ 27 | 28 | // 29 | // ---------------------------------------------------------------- Definitions 30 | // 31 | 32 | [0004] Signature : "FACS" 33 | [0004] Length : 00000040 34 | [0004] Hardware Signature : 00000000 35 | [0004] 32 Firmware Waking Vector : 00000000 36 | [0004] Global Lock : 00000000 37 | [0004] Flags (decoded below) : 00000000 38 | S4BIOS Support Present : 0 39 | 64-bit Wake Supported (V2) : 0 40 | [0008] 64 Firmware Waking Vector : 0000000000000000 41 | [0001] Version : 02 42 | [0003] Reserved : 000000 43 | [0004] OspmFlags (decoded below) : 00000000 44 | 64-bit Wake Env Required (V2) : 0 45 | 46 | -------------------------------------------------------------------------------- /plat/veyron/fwbuild/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2015 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # VeyrnFwb 13 | # 14 | # Abstract: 15 | # 16 | # This build utility adds the necessary keyblock and preamble for booting 17 | # a firmware image on a Rk3288 Veyron SoC. 18 | # 19 | # Author: 20 | # 21 | # Chris Stevens 7-Jul-2015 22 | # 23 | # Environment: 24 | # 25 | # Build 26 | # 27 | ################################################################################ 28 | 29 | BINARY = veyrnfwb 30 | 31 | BUILD = yes 32 | 33 | BINARYTYPE = build 34 | 35 | INCLUDES += $(SRCROOT)/os/uefi/include; 36 | 37 | TARGETLIBS = $(OBJROOT)/os/lib/rtl/base/build/basertl.a \ 38 | $(OBJROOT)/os/lib/rtl/rtlc/build/rtlc.a \ 39 | $(OBJROOT)/os/lib/crypto/build/crypto.a \ 40 | $(OBJROOT)/os/lib/crypto/ssl/build/ssl.a \ 41 | 42 | OBJS = fwbuild.o 43 | 44 | include $(SRCROOT)/os/minoca.mk 45 | 46 | -------------------------------------------------------------------------------- /plat/veyron/fwbuild/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2015 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | Veyron Firmware Image Builder 13 | 14 | Abstract: 15 | 16 | This build utility adds the necessary keyblock and preamble for booting 17 | a firmware image on a Rk3288 Veyron SoC. 18 | 19 | Author: 20 | 21 | Chris Stevens 7-Jul-2015 22 | 23 | Environment: 24 | 25 | Build 26 | 27 | --*/ 28 | 29 | from menv import application; 30 | 31 | function build() { 32 | var app; 33 | var entries; 34 | var includes; 35 | var libs; 36 | var sources; 37 | var tool; 38 | 39 | sources = [ 40 | "fwbuild.c", 41 | ]; 42 | 43 | libs = [ 44 | "lib/crypto/ssl:build_ssl", 45 | "lib/crypto:build_crypto", 46 | "lib/rtl/base:build_basertl", 47 | "lib/rtl/rtlc:build_rtlc", 48 | ]; 49 | 50 | includes = [ 51 | "$S/uefi/include" 52 | ]; 53 | 54 | app = { 55 | "label": "veyrnfwb", 56 | "inputs": sources + libs, 57 | "includes": includes, 58 | "build": true 59 | }; 60 | 61 | entries = application(app); 62 | tool = { 63 | "type": "tool", 64 | "name": "veyrnfwb", 65 | "command": "$O/uefi/plat/veyron/fwbuild/veyrnfwb $text_address " 66 | "$IN $OUT", 67 | 68 | "description": "Creating Verified Boot Image - $OUT" 69 | }; 70 | 71 | entries += [tool]; 72 | return entries; 73 | } 74 | 75 | -------------------------------------------------------------------------------- /plat/veyron/veyron.kbk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yabits/uefi/eac0b30161fb67de7fedf6ba24ebd3d2c0cc58f2/plat/veyron/veyron.kbk -------------------------------------------------------------------------------- /plat/veyron/veyron.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEAy9ZUK7/sQiexPHCBcuLC0BIQUlOQ13IrkCO7Mh2GiSN7HJQF 3 | w9QG2egsXJxmSzjjEAQURSZ9SaiimIZl/iw95Bx22tra02o3iKLlIBGWQGsFAsUK 4 | XwnG5iDGAcZUCAsetKk/yWeB2SvQ3H2nl2+LeDO311IqQWlIaZaPxQobBogf++iw 5 | l71tPSiC/tVuoVcey0N+uhGMxWrwklN7siEm2/iMWhufHYGp6qSmg9bRzIrbr5lk 6 | bJ2Lg9GCROc6tJ9x0K8Vcm0cLkOMfU4B6XDMWce9ZSrwLIhGWmevr4oWmF5bPbqU 7 | DGUDnB14/iESpXI6wsQi3Mobm6fMzFNtD4YtHQIDAQABAoIBAE246p1H7/EFq3nt 8 | OB6zQi8ORDTv8jGEMgIi7bTdNzhBVCcAdfZGeVpLQecKJ6MVDNdFhukbFPiqGV1p 9 | GajB+9Nn2xX2Dyw/uu8ZlZ4VtqHXbLCyqxKz6qhC5N02X0I14z5lrpHAKu3A3EHG 10 | k8mVWau6pKWwibYpS9ge9bDe+pERVdad4aec8vSdf5ZJeqvpmgzLEFxn8B3zM4Su 11 | buS7p1eYmSvzHavsAaIuPBBc/+jMUEUhLwRp3QJbENZUNkxzDB7B/6xgXbwThOik 12 | vWbKyq9ViviHF5O/ZqSX6UeBA/pMMvbsegO7LTub6txsYX8FyC1QiekQPTwCsF0+ 13 | JXHSoeECgYEA9jx/FWMECtRo6NlLf7zKtYQBcREzTeEK6KeVzCNZGbWCqq7kkDOV 14 | IBr97442wVfelN2ZbxQMjjDg52Qzpx39mdxYSU5WgkPq2ffMGvUJOEz2h4+mQJbR 15 | gWK7SVNpVt9Khf1yNCFWo3vaUCSIxgsDlA3iAyo8Wt1z5wcBfd04gRkCgYEA0+ty 16 | P/abA4yr2UFHvmwHf9fL7r9FEx5TNdLkahPp2OP0KF7r2NKHYNynIdgzzspgUBuH 17 | v3GIkHFv3tszHTyxLxtBuFWhXKiycxs5aVyhV5suzQ1xQt8q009R3DVcFIYWuCKM 18 | czd6bLf+ARuoxfH/2tRjWIHhaq/CPbsXPyz5uKUCgYEA0R5rp1QiGLhwKGBymBdT 19 | 6HglaUr8UUWwKAo7U9UpVIYsZJyHjFfibBPAWXRj2Cux4qeYKRfT2eZ0+s7Ed0cn 20 | G0ZgzFD1c0gO6fJiqvozTFdAf7xlqzDq2IFrIUjvi1GzTrwCA3fUxp7mt21voxGz 21 | hkeMDLgP7fNo/WmbwLLhy/ECgYBGxtvhgPtEtDaw2JydfHcEu43grwDi4b3ovAaN 22 | Zxky1u80jH84axfLweYP56Vl6zE/j/JGfiSeGUTDqXHo0dxbXz8T0YWS7MSsrOr/ 23 | xXAdUjbPRS4Op3omGNe+NBQMxrvPw7okwOKibNDojdRQSAKrk0Oay8X9W7YD5/hb 24 | oSnGAQKBgA4YvACjgdrCyPsKvX+3f6EYf0m4MoNLcTVZUXvujk7SQqhsglf3NPaC 25 | Wel1eo8KjUYeoXehTLOehpMY3z77gdC8ZaKzgPCPcy+1xMADrCT6TwXjFil8/2PV 26 | Cgq912U6tV7nI/w9COpiwuNKu4ZaxZPXvLRMz894n1JuoUkh9yBC 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /plat/veyron/veyronfwv.S: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2016 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | veyronfwv.S 13 | 14 | Abstract: 15 | 16 | This module includes the firmware volume binary directly. 17 | 18 | Author: 19 | 20 | Evan Green 4-Oct-2016 21 | 22 | Environment: 23 | 24 | Any 25 | 26 | --*/ 27 | 28 | ## 29 | ## ---------------------------------------------------------------- Definitions 30 | ## 31 | 32 | #if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__) 33 | 34 | #define LABEL(_Name) _##_Name 35 | 36 | #else 37 | 38 | #define LABEL(_Name) _Name 39 | 40 | #endif 41 | 42 | #define INCLUDE_BINARY(_Path, _Name) \ 43 | .align 4; \ 44 | .global LABEL(_Name##_start); \ 45 | LABEL(_Name##_start):; \ 46 | .incbin _Path; \ 47 | .global LABEL(_Name##_end); \ 48 | LABEL(_Name##_end): 49 | 50 | ## 51 | ## ---------------------------------------------------------------------- Code 52 | ## 53 | 54 | .text 55 | 56 | INCLUDE_BINARY("veyronfwv", _binary_veyronfwv) 57 | 58 | -------------------------------------------------------------------------------- /tools/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Module Name: 11 | # 12 | # Tools 13 | # 14 | # Abstract: 15 | # 16 | # This directory compiles build-time tools used to generate final UEFI 17 | # images. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 6-Mar-2014 22 | # 23 | # Environment: 24 | # 25 | # Build 26 | # 27 | ################################################################################ 28 | 29 | DIRS = elfconv \ 30 | genffs \ 31 | genfv \ 32 | mkuboot \ 33 | 34 | include $(SRCROOT)/os/minoca.mk 35 | 36 | plat: core dev 37 | 38 | -------------------------------------------------------------------------------- /tools/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | UEFI Tools 13 | 14 | Abstract: 15 | 16 | This directory compiles build-time tools used to generate final UEFI 17 | images. 18 | 19 | Author: 20 | 21 | Evan Green 6-Mar-2014 22 | 23 | Environment: 24 | 25 | Build 26 | 27 | --*/ 28 | 29 | from menv import group; 30 | 31 | function build() { 32 | var apps; 33 | var toolNames; 34 | var toolsGroup; 35 | 36 | toolNames = [ 37 | "elfconv", 38 | "genffs", 39 | "genfv", 40 | "mkuboot", 41 | ]; 42 | 43 | apps = []; 44 | for (name in toolNames) { 45 | apps += ["uefi/tools/" + name + ":" + name]; 46 | } 47 | 48 | toolsGroup = group("uefitools", apps); 49 | return toolsGroup; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /tools/elfconv/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # ElfConv 13 | # 14 | # Abstract: 15 | # 16 | # This module builds the ElfConv utility, which converts an ELF image 17 | # into a PE image. UEFI exclusively loads PE images, which is why the 18 | # conversion is necessary. With certain restrictions (such as the lack 19 | # of dynamic libraries) conversion is doable, though not a lot of fun. 20 | # 21 | # Author: 22 | # 23 | # Evan Green 10-Mar-2014 24 | # 25 | # Environment: 26 | # 27 | # Build 28 | # 29 | ################################################################################ 30 | 31 | BINARY = elfconv 32 | 33 | BUILD = yes 34 | 35 | BINPLACE = tools/bin 36 | 37 | BINARYTYPE = build 38 | 39 | INCLUDES += $(SRCROOT)/os/uefi/include; 40 | 41 | OBJS = elfc32.o \ 42 | elfconv.o \ 43 | 44 | include $(SRCROOT)/os/minoca.mk 45 | 46 | -------------------------------------------------------------------------------- /tools/elfconv/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | ElfConv 13 | 14 | Abstract: 15 | 16 | This module builds the ElfConv utility, which converts an ELF image 17 | into a PE image. UEFI exclusively loads PE images, which is why the 18 | conversion is necessary. With certain restrictions (such as the lack 19 | of dynamic libraries) conversion is doable, though not a lot of fun. 20 | 21 | Author: 22 | 23 | Evan Green 10-Mar-2014 24 | 25 | Environment: 26 | 27 | Build 28 | 29 | --*/ 30 | 31 | from menv import application; 32 | 33 | function build() { 34 | var app; 35 | var entries; 36 | var includes; 37 | var sources; 38 | var tool; 39 | 40 | sources = [ 41 | "elfc32.c", 42 | "elfconv.c", 43 | ]; 44 | 45 | includes = [ 46 | "$S/uefi/include" 47 | ]; 48 | 49 | app = { 50 | "label": "elfconv", 51 | "inputs": sources, 52 | "includes": includes, 53 | "build": true 54 | }; 55 | 56 | entries = application(app); 57 | tool = { 58 | "type": "tool", 59 | "name": "elfconv", 60 | "command": "$O/uefi/tools/elfconv/elfconv $ELFCONV_FLAGS -o $OUT $IN", 61 | "description": "Converting to PE - $IN" 62 | }; 63 | 64 | return entries + [tool]; 65 | } 66 | 67 | -------------------------------------------------------------------------------- /tools/genffs/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # GenFFS 13 | # 14 | # Abstract: 15 | # 16 | # This module builds the GenFFS build utility, which can create a single 17 | # FFS file. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 6-Mar-2014 22 | # 23 | # Environment: 24 | # 25 | # Build 26 | # 27 | ################################################################################ 28 | 29 | BINARY = genffs 30 | 31 | BUILD = yes 32 | 33 | BINPLACE = tools/bin 34 | 35 | BINARYTYPE = build 36 | 37 | INCLUDES += $(SRCROOT)/os/uefi/include; 38 | 39 | OBJS = genffs.o 40 | 41 | include $(SRCROOT)/os/minoca.mk 42 | 43 | -------------------------------------------------------------------------------- /tools/genfv/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2014 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # GenFV 13 | # 14 | # Abstract: 15 | # 16 | # This module builds the GenFV build utility, which can create a FFS2 17 | # Firmware Volume out of one or more FFS files. 18 | # 19 | # Author: 20 | # 21 | # Evan Green 7-Mar-2014 22 | # 23 | # Environment: 24 | # 25 | # Build 26 | # 27 | ################################################################################ 28 | 29 | BINARY = genfv 30 | 31 | BUILD = yes 32 | 33 | BINPLACE = tools/bin 34 | 35 | BINARYTYPE = build 36 | 37 | INCLUDES += $(SRCROOT)/os/uefi/include; 38 | 39 | OBJS = genfv.o 40 | 41 | include $(SRCROOT)/os/minoca.mk 42 | 43 | -------------------------------------------------------------------------------- /tools/genfv/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2014 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | GenFV 13 | 14 | Abstract: 15 | 16 | This module builds the GenFV build utility, which can create a FFS2 17 | Firmware Volume out of one or more FFS files. 18 | 19 | Author: 20 | 21 | Evan Green 7-Mar-2014 22 | 23 | Environment: 24 | 25 | Build 26 | 27 | --*/ 28 | 29 | from menv import application; 30 | 31 | function build() { 32 | var app; 33 | var entries; 34 | var includes; 35 | var sources; 36 | var tool; 37 | 38 | sources = [ 39 | "genfv.c", 40 | ]; 41 | 42 | includes = [ 43 | "$S/uefi/include" 44 | ]; 45 | 46 | app = { 47 | "label": "genfv", 48 | "inputs": sources, 49 | "includes": includes, 50 | "build": true 51 | }; 52 | 53 | entries = application(app); 54 | tool = { 55 | "type": "tool", 56 | "name": "genfv", 57 | "command": "$O/uefi/tools/genfv/genfv $GENFV_FLAGS -o $OUT $IN", 58 | "description": "GenFV - $OUT" 59 | }; 60 | 61 | return entries + [tool]; 62 | } 63 | 64 | -------------------------------------------------------------------------------- /tools/mkuboot/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Copyright (c) 2015 Minoca Corp. 4 | # 5 | # This file is licensed under the terms of the GNU General Public License 6 | # version 3. Alternative licensing terms are available. Contact 7 | # info@minocacorp.com for details. See the LICENSE file at the root of this 8 | # project for complete licensing information. 9 | # 10 | # Binary Name: 11 | # 12 | # mkuboot 13 | # 14 | # Abstract: 15 | # 16 | # This module builds the mkuboot build utility, which can create a U-Boot 17 | # firmware images. 18 | # 19 | # Author: 20 | # 21 | # Chris Stevens 2-Jul-2015 22 | # 23 | # Environment: 24 | # 25 | # Build 26 | # 27 | ################################################################################ 28 | 29 | BINARY = mkuboot 30 | 31 | BUILD = yes 32 | 33 | BINPLACE = tools/bin 34 | 35 | BINARYTYPE = build 36 | 37 | INCLUDES += $(SRCROOT)/os/uefi/include; 38 | 39 | VPATH += $(SRCROOT)/os/uefi/core 40 | 41 | OBJS = mkuboot.o \ 42 | crc32.o \ 43 | 44 | include $(SRCROOT)/os/minoca.mk 45 | 46 | -------------------------------------------------------------------------------- /tools/mkuboot/build.ck: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2015 Minoca Corp. 4 | 5 | This file is licensed under the terms of the GNU General Public License 6 | version 3. Alternative licensing terms are available. Contact 7 | info@minocacorp.com for details. See the LICENSE file at the root of this 8 | project for complete licensing information. 9 | 10 | Module Name: 11 | 12 | mkuboot 13 | 14 | Abstract: 15 | 16 | This module builds the mkuboot build utility, which can create a U-Boot 17 | firmware images. 18 | 19 | Author: 20 | 21 | Chris Stevens 2-Jul-2015 22 | 23 | Environment: 24 | 25 | Build 26 | 27 | --*/ 28 | 29 | from menv import application; 30 | 31 | function build() { 32 | var app; 33 | var entries; 34 | var includes; 35 | var mkubootCommand; 36 | var sources; 37 | var tool; 38 | 39 | sources = [ 40 | "mkuboot.c", 41 | "../../core/crc32.c" 42 | ]; 43 | 44 | includes = [ 45 | "$S/uefi/include" 46 | ]; 47 | 48 | app = { 49 | "label": "mkuboot", 50 | "inputs": sources, 51 | "includes": includes, 52 | "build": true 53 | }; 54 | 55 | entries = application(app); 56 | 57 | // 58 | // Adjust crc32.o so it doesn't collide with the native version. 59 | // 60 | 61 | for (entry in entries) { 62 | if ((entry.get("output")) && (entry.output.endsWith("crc32.o"))) { 63 | entry.output = "crc32.o"; 64 | break; 65 | } 66 | } 67 | 68 | mkubootCommand = "$O/uefi/tools/mkuboot/mkuboot $MKUBOOT_FLAGS " + 69 | "-l $text_address -e $text_address -o $OUT $IN"; 70 | 71 | tool = { 72 | "type": "tool", 73 | "name": "mkuboot", 74 | "command": mkubootCommand, 75 | "description": "Creating U-Boot Image - $OUT" 76 | }; 77 | 78 | return entries + [tool]; 79 | } 80 | 81 | -------------------------------------------------------------------------------- /util/kconfig/POTFILES.in: -------------------------------------------------------------------------------- 1 | util/kconfig/lxdialog/checklist.c 2 | util/kconfig/lxdialog/inputbox.c 3 | util/kconfig/lxdialog/menubox.c 4 | util/kconfig/lxdialog/textbox.c 5 | util/kconfig/lxdialog/util.c 6 | util/kconfig/lxdialog/yesno.c 7 | util/kconfig/mconf.c 8 | util/kconfig/conf.c 9 | util/kconfig/confdata.c 10 | util/kconfig/gconf.c 11 | util/kconfig/gconf.glade.h 12 | util/kconfig/qconf.cc 13 | -------------------------------------------------------------------------------- /util/kconfig/check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Needed for systems without gettext 3 | $* -xc -o /dev/null - > /dev/null 2>&1 << EOF 4 | #include 5 | int main() 6 | { 7 | gettext(""); 8 | return 0; 9 | } 10 | EOF 11 | if [ ! "$?" -eq "0" ]; then 12 | echo -DKBUILD_NO_NLS; 13 | fi 14 | 15 | -------------------------------------------------------------------------------- /util/kconfig/kconfig_load.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "lkc.h" 6 | 7 | #define P(name,type,arg) type (*name ## _p) arg 8 | #include "lkc_proto.h" 9 | #undef P 10 | 11 | void kconfig_load(void) 12 | { 13 | void *handle; 14 | char *error; 15 | 16 | handle = dlopen("./libkconfig.so", RTLD_LAZY); 17 | if (!handle) { 18 | handle = dlopen("./util/kconfig/libkconfig.so", RTLD_LAZY); 19 | if (!handle) { 20 | fprintf(stderr, "%s\n", dlerror()); 21 | exit(1); 22 | } 23 | } 24 | 25 | #define P(name,type,arg) \ 26 | { \ 27 | name ## _p = dlsym(handle, #name); \ 28 | if ((error = dlerror())) { \ 29 | fprintf(stderr, "%s\n", error); \ 30 | exit(1); \ 31 | } \ 32 | } 33 | #include "lkc_proto.h" 34 | #undef P 35 | } 36 | -------------------------------------------------------------------------------- /util/kconfig/lxdialog/BIG.FAT.WARNING: -------------------------------------------------------------------------------- 1 | This is NOT the official version of dialog. This version has been 2 | significantly modified from the original. It is for use by the Linux 3 | kernel configuration script. Please do not bother Savio Lam with 4 | questions about this program. 5 | -------------------------------------------------------------------------------- /util/kconfig/lxdialog/check-lxdialog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Check ncurses compatibility 3 | 4 | # What library to link 5 | ldflags() 6 | { 7 | for ext in so a dylib ; do 8 | for lib in ncursesw ncurses curses ; do 9 | $cc -print-file-name=lib${lib}.${ext} | grep -q / 10 | if [ $? -eq 0 ]; then 11 | echo "-l${lib}" 12 | exit 13 | fi 14 | done 15 | done 16 | exit 1 17 | } 18 | 19 | # Where is ncurses.h? 20 | ccflags() 21 | { 22 | if [ -f /usr/include/ncurses/ncurses.h ]; then 23 | echo '-I/usr/include/ncurses -DCURSES_LOC=""' 24 | elif [ -f /usr/include/ncurses/curses.h ]; then 25 | echo '-I/usr/include/ncurses -DCURSES_LOC=""' 26 | elif [ -f /usr/include/ncurses.h ]; then 27 | echo '-DCURSES_LOC=""' 28 | else 29 | echo '-DCURSES_LOC=""' 30 | fi 31 | } 32 | 33 | # Temp file, try to clean up after us 34 | tmp=.lxdialog.tmp 35 | trap "rm -f $tmp" 0 1 2 3 15 36 | 37 | # Check if we can link to ncurses 38 | check() { 39 | echo -e " #include CURSES_LOC \n main() {}" | 40 | $cc -xc - -o $tmp 2> /dev/null 41 | if [ $? != 0 ]; then 42 | echo " *** Unable to find the ncurses libraries or the" 1>&2 43 | echo " *** required header files." 1>&2 44 | echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2 45 | echo " *** " 1>&2 46 | echo " *** Install ncurses (ncurses-devel) and try again." 1>&2 47 | echo " *** " 1>&2 48 | exit 1 49 | fi 50 | } 51 | 52 | usage() { 53 | printf "Usage: $0 [-check compiler options|-header|-library]\n" 54 | } 55 | 56 | if [ $# -eq 0 ]; then 57 | usage 58 | exit 1 59 | fi 60 | 61 | cc="" 62 | case "$1" in 63 | "-check") 64 | shift 65 | cc="$@" 66 | check 67 | ;; 68 | "-ccflags") 69 | ccflags 70 | ;; 71 | "-ldflags") 72 | shift 73 | cc="$@" 74 | ldflags 75 | ;; 76 | "*") 77 | usage 78 | exit 1 79 | ;; 80 | esac 81 | -------------------------------------------------------------------------------- /util/kconfig/zconf.gperf: -------------------------------------------------------------------------------- 1 | %language=ANSI-C 2 | %define hash-function-name kconf_id_hash 3 | %define lookup-function-name kconf_id_lookup 4 | %define string-pool-name kconf_id_strings 5 | %compare-strncmp 6 | %enum 7 | %pic 8 | %struct-type 9 | 10 | struct kconf_id; 11 | 12 | %% 13 | mainmenu, T_MAINMENU, TF_COMMAND 14 | menu, T_MENU, TF_COMMAND 15 | endmenu, T_ENDMENU, TF_COMMAND 16 | source, T_SOURCE, TF_COMMAND 17 | choice, T_CHOICE, TF_COMMAND 18 | endchoice, T_ENDCHOICE, TF_COMMAND 19 | comment, T_COMMENT, TF_COMMAND 20 | config, T_CONFIG, TF_COMMAND 21 | menuconfig, T_MENUCONFIG, TF_COMMAND 22 | help, T_HELP, TF_COMMAND 23 | if, T_IF, TF_COMMAND|TF_PARAM 24 | endif, T_ENDIF, TF_COMMAND 25 | depends, T_DEPENDS, TF_COMMAND 26 | optional, T_OPTIONAL, TF_COMMAND 27 | default, T_DEFAULT, TF_COMMAND, S_UNKNOWN 28 | prompt, T_PROMPT, TF_COMMAND 29 | tristate, T_TYPE, TF_COMMAND, S_TRISTATE 30 | def_tristate, T_DEFAULT, TF_COMMAND, S_TRISTATE 31 | bool, T_TYPE, TF_COMMAND, S_BOOLEAN 32 | boolean, T_TYPE, TF_COMMAND, S_BOOLEAN 33 | def_bool, T_DEFAULT, TF_COMMAND, S_BOOLEAN 34 | int, T_TYPE, TF_COMMAND, S_INT 35 | hex, T_TYPE, TF_COMMAND, S_HEX 36 | string, T_TYPE, TF_COMMAND, S_STRING 37 | select, T_SELECT, TF_COMMAND 38 | range, T_RANGE, TF_COMMAND 39 | option, T_OPTION, TF_COMMAND 40 | on, T_ON, TF_PARAM 41 | modules, T_OPT_MODULES, TF_OPTION 42 | defconfig_list, T_OPT_DEFCONFIG_LIST,TF_OPTION 43 | env, T_OPT_ENV, TF_OPTION 44 | %% 45 | --------------------------------------------------------------------------------