v86 0.3.6 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +17 -6
- package/bios/seabios/.config +113 -0
- package/bios/seabios/.config.old +114 -0
- package/bios/seabios/.gitignore +4 -0
- package/bios/seabios/COPYING +674 -0
- package/bios/seabios/COPYING.LESSER +165 -0
- package/bios/seabios/Makefile +286 -0
- package/bios/seabios/README +17 -0
- package/bios/seabios/docs/Build_overview.md +104 -0
- package/bios/seabios/docs/Contributing.md +20 -0
- package/bios/seabios/docs/Debugging.md +111 -0
- package/bios/seabios/docs/Developer_Documentation.md +25 -0
- package/bios/seabios/docs/Developer_links.md +86 -0
- package/bios/seabios/docs/Download.md +27 -0
- package/bios/seabios/docs/Execution_and_code_flow.md +178 -0
- package/bios/seabios/docs/Linking_overview.md +160 -0
- package/bios/seabios/docs/Mailinglist.md +8 -0
- package/bios/seabios/docs/Memory_Model.md +253 -0
- package/bios/seabios/docs/README +5 -0
- package/bios/seabios/docs/Releases.md +482 -0
- package/bios/seabios/docs/Runtime_config.md +193 -0
- package/bios/seabios/docs/SeaBIOS.md +17 -0
- package/bios/seabios/docs/SeaVGABIOS.md +39 -0
- package/bios/seabios/out/autoconf.h +117 -0
- package/bios/seabios/out/include/config/acpi/dsdt.h +0 -0
- package/bios/seabios/out/include/config/acpi.h +0 -0
- package/bios/seabios/out/include/config/ahci.h +0 -0
- package/bios/seabios/out/include/config/apmbios.h +0 -0
- package/bios/seabios/out/include/config/ata/dma.h +0 -0
- package/bios/seabios/out/include/config/ata/pio32.h +0 -0
- package/bios/seabios/out/include/config/ata.h +0 -0
- package/bios/seabios/out/include/config/auto.conf +69 -0
- package/bios/seabios/out/include/config/auto.conf.cmd +9 -0
- package/bios/seabios/out/include/config/boot.h +0 -0
- package/bios/seabios/out/include/config/bootorder.h +0 -0
- package/bios/seabios/out/include/config/build/vgabios.h +0 -0
- package/bios/seabios/out/include/config/call32/smm.h +0 -0
- package/bios/seabios/out/include/config/cdrom/boot.h +0 -0
- package/bios/seabios/out/include/config/cdrom/emu.h +0 -0
- package/bios/seabios/out/include/config/debug/level.h +0 -0
- package/bios/seabios/out/include/config/drives.h +0 -0
- package/bios/seabios/out/include/config/entry/extrastack.h +0 -0
- package/bios/seabios/out/include/config/esp/scsi.h +0 -0
- package/bios/seabios/out/include/config/flash/floppy.h +0 -0
- package/bios/seabios/out/include/config/floppy.h +0 -0
- package/bios/seabios/out/include/config/fw/romfile/load.h +0 -0
- package/bios/seabios/out/include/config/hardware/irq.h +0 -0
- package/bios/seabios/out/include/config/kbd/call/int15/4f.h +0 -0
- package/bios/seabios/out/include/config/keyboard.h +0 -0
- package/bios/seabios/out/include/config/lpt.h +0 -0
- package/bios/seabios/out/include/config/lsi/scsi.h +0 -0
- package/bios/seabios/out/include/config/malloc/uppermemory.h +0 -0
- package/bios/seabios/out/include/config/megasas.h +0 -0
- package/bios/seabios/out/include/config/mouse.h +0 -0
- package/bios/seabios/out/include/config/mpt/scsi.h +0 -0
- package/bios/seabios/out/include/config/mptable.h +0 -0
- package/bios/seabios/out/include/config/mtrr/init.h +0 -0
- package/bios/seabios/out/include/config/optionroms.h +0 -0
- package/bios/seabios/out/include/config/override/pci/id.h +0 -0
- package/bios/seabios/out/include/config/pcibios.h +0 -0
- package/bios/seabios/out/include/config/pirtable.h +0 -0
- package/bios/seabios/out/include/config/pmm.h +0 -0
- package/bios/seabios/out/include/config/pmtimer.h +0 -0
- package/bios/seabios/out/include/config/pnpbios.h +0 -0
- package/bios/seabios/out/include/config/ps2port.h +0 -0
- package/bios/seabios/out/include/config/pvscsi.h +0 -0
- package/bios/seabios/out/include/config/qemu/hardware.h +0 -0
- package/bios/seabios/out/include/config/qemu.h +0 -0
- package/bios/seabios/out/include/config/rom/size.h +0 -0
- package/bios/seabios/out/include/config/rtc/timer.h +0 -0
- package/bios/seabios/out/include/config/s3/resume.h +0 -0
- package/bios/seabios/out/include/config/sdcard.h +0 -0
- package/bios/seabios/out/include/config/serial.h +0 -0
- package/bios/seabios/out/include/config/tcgbios.h +0 -0
- package/bios/seabios/out/include/config/threads.h +0 -0
- package/bios/seabios/out/include/config/tristate.conf +4 -0
- package/bios/seabios/out/include/config/tsc/timer.h +0 -0
- package/bios/seabios/out/include/config/use/smm.h +0 -0
- package/bios/seabios/out/include/config/vga/allocate/extra/stack.h +0 -0
- package/bios/seabios/out/include/config/vga/bochs/stdvga.h +0 -0
- package/bios/seabios/out/include/config/vga/bochs.h +0 -0
- package/bios/seabios/out/include/config/vga/did.h +0 -0
- package/bios/seabios/out/include/config/vga/extra/stack/size.h +0 -0
- package/bios/seabios/out/include/config/vga/fixup/asm.h +0 -0
- package/bios/seabios/out/include/config/vga/pci.h +0 -0
- package/bios/seabios/out/include/config/vga/stdvga/ports.h +0 -0
- package/bios/seabios/out/include/config/vga/vbe.h +0 -0
- package/bios/seabios/out/include/config/vga/vid.h +0 -0
- package/bios/seabios/out/include/config/vgahooks.h +0 -0
- package/bios/seabios/out/include/config/virtio/blk.h +0 -0
- package/bios/seabios/out/include/config/virtio/scsi.h +0 -0
- package/bios/seabios/out/include/config/xen.h +0 -0
- package/bios/seabios/out/scripts/kconfig/conf +0 -0
- package/bios/seabios/out/scripts/kconfig/conf.o +0 -0
- package/bios/seabios/out/scripts/kconfig/zconf.hash.c +289 -0
- package/bios/seabios/out/scripts/kconfig/zconf.lex.c +2420 -0
- package/bios/seabios/out/scripts/kconfig/zconf.tab.c +2538 -0
- package/bios/seabios/out/scripts/kconfig/zconf.tab.o +0 -0
- package/bios/seabios/scripts/acpi_extract.py +366 -0
- package/bios/seabios/scripts/acpi_extract_preprocess.py +41 -0
- package/bios/seabios/scripts/buildrom.py +56 -0
- package/bios/seabios/scripts/buildversion.py +134 -0
- package/bios/seabios/scripts/checkrom.py +95 -0
- package/bios/seabios/scripts/checkstack.py +226 -0
- package/bios/seabios/scripts/checksum.py +16 -0
- package/bios/seabios/scripts/encodeint.py +21 -0
- package/bios/seabios/scripts/gen-offsets.sh +17 -0
- package/bios/seabios/scripts/kconfig/.gitignore +22 -0
- package/bios/seabios/scripts/kconfig/Makefile +331 -0
- package/bios/seabios/scripts/kconfig/POTFILES.in +12 -0
- package/bios/seabios/scripts/kconfig/check.sh +13 -0
- package/bios/seabios/scripts/kconfig/conf.c +718 -0
- package/bios/seabios/scripts/kconfig/confdata.c +1250 -0
- package/bios/seabios/scripts/kconfig/expr.c +1168 -0
- package/bios/seabios/scripts/kconfig/expr.h +241 -0
- package/bios/seabios/scripts/kconfig/gconf.c +1542 -0
- package/bios/seabios/scripts/kconfig/gconf.glade +661 -0
- package/bios/seabios/scripts/kconfig/images.c +326 -0
- package/bios/seabios/scripts/kconfig/kxgettext.c +235 -0
- package/bios/seabios/scripts/kconfig/lex.zconf.c +2430 -0
- package/bios/seabios/scripts/kconfig/list.h +131 -0
- package/bios/seabios/scripts/kconfig/lkc.h +200 -0
- package/bios/seabios/scripts/kconfig/lkc_proto.h +57 -0
- package/bios/seabios/scripts/kconfig/lxdialog/.gitignore +4 -0
- package/bios/seabios/scripts/kconfig/lxdialog/BIG.FAT.WARNING +4 -0
- package/bios/seabios/scripts/kconfig/lxdialog/check-lxdialog.sh +87 -0
- package/bios/seabios/scripts/kconfig/lxdialog/checklist.c +332 -0
- package/bios/seabios/scripts/kconfig/lxdialog/dialog.h +257 -0
- package/bios/seabios/scripts/kconfig/lxdialog/inputbox.c +301 -0
- package/bios/seabios/scripts/kconfig/lxdialog/menubox.c +437 -0
- package/bios/seabios/scripts/kconfig/lxdialog/textbox.c +408 -0
- package/bios/seabios/scripts/kconfig/lxdialog/util.c +713 -0
- package/bios/seabios/scripts/kconfig/lxdialog/yesno.c +114 -0
- package/bios/seabios/scripts/kconfig/mconf.c +1036 -0
- package/bios/seabios/scripts/kconfig/menu.c +697 -0
- package/bios/seabios/scripts/kconfig/merge_config.sh +150 -0
- package/bios/seabios/scripts/kconfig/nconf.c +1556 -0
- package/bios/seabios/scripts/kconfig/nconf.gui.c +656 -0
- package/bios/seabios/scripts/kconfig/nconf.h +96 -0
- package/bios/seabios/scripts/kconfig/qconf.cc +1795 -0
- package/bios/seabios/scripts/kconfig/qconf.h +338 -0
- package/bios/seabios/scripts/kconfig/streamline_config.pl +647 -0
- package/bios/seabios/scripts/kconfig/symbol.c +1373 -0
- package/bios/seabios/scripts/kconfig/util.c +157 -0
- package/bios/seabios/scripts/kconfig/zconf.gperf +48 -0
- package/bios/seabios/scripts/kconfig/zconf.hash.c_shipped +289 -0
- package/bios/seabios/scripts/kconfig/zconf.l +363 -0
- package/bios/seabios/scripts/kconfig/zconf.lex.c_shipped +2420 -0
- package/bios/seabios/scripts/kconfig/zconf.tab.c_shipped +2538 -0
- package/bios/seabios/scripts/kconfig/zconf.y +733 -0
- package/bios/seabios/scripts/layoutrom.py +705 -0
- package/bios/seabios/scripts/python23compat.py +14 -0
- package/bios/seabios/scripts/readserial.py +190 -0
- package/bios/seabios/scripts/tarball.sh +36 -0
- package/bios/seabios/scripts/test-build.sh +90 -0
- package/bios/seabios/scripts/transdump.py +53 -0
- package/bios/seabios/scripts/vgafixup.py +96 -0
- package/bios/seabios/src/Kconfig +579 -0
- package/bios/seabios/src/apm.c +215 -0
- package/bios/seabios/src/asm-offsets.c +23 -0
- package/bios/seabios/src/biosvar.h +130 -0
- package/bios/seabios/src/block.c +623 -0
- package/bios/seabios/src/block.h +121 -0
- package/bios/seabios/src/bmp.c +117 -0
- package/bios/seabios/src/boot.c +793 -0
- package/bios/seabios/src/bootsplash.c +255 -0
- package/bios/seabios/src/bregs.h +80 -0
- package/bios/seabios/src/byteorder.h +71 -0
- package/bios/seabios/src/cdrom.c +322 -0
- package/bios/seabios/src/clock.c +506 -0
- package/bios/seabios/src/code16gcc.s +1 -0
- package/bios/seabios/src/config.h +108 -0
- package/bios/seabios/src/cp437.c +275 -0
- package/bios/seabios/src/cp437.h +1 -0
- package/bios/seabios/src/disk.c +779 -0
- package/bios/seabios/src/e820map.c +152 -0
- package/bios/seabios/src/e820map.h +26 -0
- package/bios/seabios/src/entryfuncs.S +165 -0
- package/bios/seabios/src/farptr.h +208 -0
- package/bios/seabios/src/font.c +139 -0
- package/bios/seabios/src/fw/acpi-dsdt-cpu-hotplug.dsl +78 -0
- package/bios/seabios/src/fw/acpi-dsdt-dbug.dsl +26 -0
- package/bios/seabios/src/fw/acpi-dsdt-hpet.dsl +36 -0
- package/bios/seabios/src/fw/acpi-dsdt-isa.dsl +102 -0
- package/bios/seabios/src/fw/acpi-dsdt-pci-crs.dsl +90 -0
- package/bios/seabios/src/fw/acpi-dsdt.dsl +342 -0
- package/bios/seabios/src/fw/acpi-dsdt.hex +554 -0
- package/bios/seabios/src/fw/acpi.c +685 -0
- package/bios/seabios/src/fw/biostables.c +491 -0
- package/bios/seabios/src/fw/coreboot.c +569 -0
- package/bios/seabios/src/fw/csm.c +347 -0
- package/bios/seabios/src/fw/dev-pci.h +52 -0
- package/bios/seabios/src/fw/dev-piix.h +29 -0
- package/bios/seabios/src/fw/dev-q35.h +52 -0
- package/bios/seabios/src/fw/lzmadecode.c +398 -0
- package/bios/seabios/src/fw/lzmadecode.h +67 -0
- package/bios/seabios/src/fw/mptable.c +197 -0
- package/bios/seabios/src/fw/mtrr.c +105 -0
- package/bios/seabios/src/fw/multiboot.c +111 -0
- package/bios/seabios/src/fw/paravirt.c +624 -0
- package/bios/seabios/src/fw/paravirt.h +63 -0
- package/bios/seabios/src/fw/pciinit.c +1187 -0
- package/bios/seabios/src/fw/pirtable.c +103 -0
- package/bios/seabios/src/fw/q35-acpi-dsdt.dsl +450 -0
- package/bios/seabios/src/fw/romfile_loader.c +259 -0
- package/bios/seabios/src/fw/romfile_loader.h +91 -0
- package/bios/seabios/src/fw/shadow.c +208 -0
- package/bios/seabios/src/fw/smbios.c +585 -0
- package/bios/seabios/src/fw/smm.c +269 -0
- package/bios/seabios/src/fw/smp.c +194 -0
- package/bios/seabios/src/fw/ssdt-misc.dsl +104 -0
- package/bios/seabios/src/fw/ssdt-misc.hex +88 -0
- package/bios/seabios/src/fw/ssdt-pcihp.dsl +36 -0
- package/bios/seabios/src/fw/ssdt-pcihp.hex +38 -0
- package/bios/seabios/src/fw/ssdt-proc.dsl +48 -0
- package/bios/seabios/src/fw/ssdt-proc.hex +35 -0
- package/bios/seabios/src/fw/xen.c +149 -0
- package/bios/seabios/src/fw/xen.h +125 -0
- package/bios/seabios/src/gen-defs.h +19 -0
- package/bios/seabios/src/hw/ahci.c +697 -0
- package/bios/seabios/src/hw/ahci.h +201 -0
- package/bios/seabios/src/hw/ata.c +1046 -0
- package/bios/seabios/src/hw/ata.h +163 -0
- package/bios/seabios/src/hw/blockcmd.c +372 -0
- package/bios/seabios/src/hw/blockcmd.h +114 -0
- package/bios/seabios/src/hw/dma.c +67 -0
- package/bios/seabios/src/hw/esp-scsi.c +241 -0
- package/bios/seabios/src/hw/esp-scsi.h +8 -0
- package/bios/seabios/src/hw/floppy.c +741 -0
- package/bios/seabios/src/hw/lsi-scsi.c +221 -0
- package/bios/seabios/src/hw/lsi-scsi.h +8 -0
- package/bios/seabios/src/hw/megasas.c +405 -0
- package/bios/seabios/src/hw/megasas.h +8 -0
- package/bios/seabios/src/hw/mpt-scsi.c +319 -0
- package/bios/seabios/src/hw/mpt-scsi.h +8 -0
- package/bios/seabios/src/hw/nvme-int.h +199 -0
- package/bios/seabios/src/hw/nvme.c +708 -0
- package/bios/seabios/src/hw/nvme.h +17 -0
- package/bios/seabios/src/hw/pci.c +133 -0
- package/bios/seabios/src/hw/pci.h +47 -0
- package/bios/seabios/src/hw/pci_ids.h +2632 -0
- package/bios/seabios/src/hw/pci_regs.h +556 -0
- package/bios/seabios/src/hw/pcidevice.c +192 -0
- package/bios/seabios/src/hw/pcidevice.h +76 -0
- package/bios/seabios/src/hw/pic.c +115 -0
- package/bios/seabios/src/hw/pic.h +60 -0
- package/bios/seabios/src/hw/ps2port.c +543 -0
- package/bios/seabios/src/hw/ps2port.h +67 -0
- package/bios/seabios/src/hw/pvscsi.c +333 -0
- package/bios/seabios/src/hw/pvscsi.h +8 -0
- package/bios/seabios/src/hw/ramdisk.c +108 -0
- package/bios/seabios/src/hw/rtc.c +100 -0
- package/bios/seabios/src/hw/rtc.h +75 -0
- package/bios/seabios/src/hw/sdcard.c +572 -0
- package/bios/seabios/src/hw/serialio.c +113 -0
- package/bios/seabios/src/hw/serialio.h +29 -0
- package/bios/seabios/src/hw/timer.c +259 -0
- package/bios/seabios/src/hw/tpm_drivers.c +636 -0
- package/bios/seabios/src/hw/tpm_drivers.h +127 -0
- package/bios/seabios/src/hw/usb-ehci.c +650 -0
- package/bios/seabios/src/hw/usb-ehci.h +177 -0
- package/bios/seabios/src/hw/usb-hid.c +442 -0
- package/bios/seabios/src/hw/usb-hid.h +29 -0
- package/bios/seabios/src/hw/usb-hub.c +205 -0
- package/bios/seabios/src/hw/usb-hub.h +64 -0
- package/bios/seabios/src/hw/usb-msc.c +222 -0
- package/bios/seabios/src/hw/usb-msc.h +10 -0
- package/bios/seabios/src/hw/usb-ohci.c +568 -0
- package/bios/seabios/src/hw/usb-ohci.h +144 -0
- package/bios/seabios/src/hw/usb-uas.c +289 -0
- package/bios/seabios/src/hw/usb-uas.h +9 -0
- package/bios/seabios/src/hw/usb-uhci.c +571 -0
- package/bios/seabios/src/hw/usb-uhci.h +128 -0
- package/bios/seabios/src/hw/usb-xhci.c +1161 -0
- package/bios/seabios/src/hw/usb-xhci.h +133 -0
- package/bios/seabios/src/hw/usb.c +499 -0
- package/bios/seabios/src/hw/usb.h +254 -0
- package/bios/seabios/src/hw/virtio-blk.c +211 -0
- package/bios/seabios/src/hw/virtio-blk.h +43 -0
- package/bios/seabios/src/hw/virtio-pci.c +501 -0
- package/bios/seabios/src/hw/virtio-pci.h +151 -0
- package/bios/seabios/src/hw/virtio-ring.c +147 -0
- package/bios/seabios/src/hw/virtio-ring.h +121 -0
- package/bios/seabios/src/hw/virtio-scsi.c +220 -0
- package/bios/seabios/src/hw/virtio-scsi.h +47 -0
- package/bios/seabios/src/jpeg.c +1055 -0
- package/bios/seabios/src/kbd.c +599 -0
- package/bios/seabios/src/list.h +91 -0
- package/bios/seabios/src/malloc.c +561 -0
- package/bios/seabios/src/malloc.h +70 -0
- package/bios/seabios/src/memmap.h +21 -0
- package/bios/seabios/src/misc.c +195 -0
- package/bios/seabios/src/mouse.c +342 -0
- package/bios/seabios/src/optionroms.c +475 -0
- package/bios/seabios/src/output.c +584 -0
- package/bios/seabios/src/output.h +68 -0
- package/bios/seabios/src/pcibios.c +241 -0
- package/bios/seabios/src/pmm.c +176 -0
- package/bios/seabios/src/pnpbios.c +88 -0
- package/bios/seabios/src/post.c +337 -0
- package/bios/seabios/src/resume.c +157 -0
- package/bios/seabios/src/romfile.c +146 -0
- package/bios/seabios/src/romfile.h +21 -0
- package/bios/seabios/src/romlayout.S +698 -0
- package/bios/seabios/src/sercon.c +677 -0
- package/bios/seabios/src/serial.c +317 -0
- package/bios/seabios/src/sha1.c +147 -0
- package/bios/seabios/src/sha1.h +8 -0
- package/bios/seabios/src/stacks.c +771 -0
- package/bios/seabios/src/stacks.h +68 -0
- package/bios/seabios/src/std/LegacyBios.h +985 -0
- package/bios/seabios/src/std/acpi.h +323 -0
- package/bios/seabios/src/std/bda.h +174 -0
- package/bios/seabios/src/std/disk.h +175 -0
- package/bios/seabios/src/std/mptable.h +77 -0
- package/bios/seabios/src/std/multiboot.h +260 -0
- package/bios/seabios/src/std/optionrom.h +59 -0
- package/bios/seabios/src/std/pirtable.h +35 -0
- package/bios/seabios/src/std/pmm.h +19 -0
- package/bios/seabios/src/std/pnpbios.h +24 -0
- package/bios/seabios/src/std/smbios.h +167 -0
- package/bios/seabios/src/std/tcg.h +554 -0
- package/bios/seabios/src/std/vbe.h +156 -0
- package/bios/seabios/src/std/vga.h +63 -0
- package/bios/seabios/src/string.c +251 -0
- package/bios/seabios/src/string.h +31 -0
- package/bios/seabios/src/system.c +357 -0
- package/bios/seabios/src/tcgbios.c +2014 -0
- package/bios/seabios/src/tcgbios.h +19 -0
- package/bios/seabios/src/types.h +156 -0
- package/bios/seabios/src/util.h +251 -0
- package/bios/seabios/src/version.c +5 -0
- package/bios/seabios/src/vgahooks.c +355 -0
- package/bios/seabios/src/x86.c +23 -0
- package/bios/seabios/src/x86.h +277 -0
- package/bios/seabios/vgasrc/Kconfig +211 -0
- package/bios/seabios/vgasrc/bochsdisplay.c +59 -0
- package/bios/seabios/vgasrc/bochsvga.c +447 -0
- package/bios/seabios/vgasrc/bochsvga.h +57 -0
- package/bios/seabios/vgasrc/cbvga.c +337 -0
- package/bios/seabios/vgasrc/clext.c +627 -0
- package/bios/seabios/vgasrc/geodevga.c +434 -0
- package/bios/seabios/vgasrc/geodevga.h +89 -0
- package/bios/seabios/vgasrc/ramfb.c +163 -0
- package/bios/seabios/vgasrc/stdvga.c +485 -0
- package/bios/seabios/vgasrc/stdvga.h +81 -0
- package/bios/seabios/vgasrc/stdvgaio.c +186 -0
- package/bios/seabios/vgasrc/stdvgamodes.c +534 -0
- package/bios/seabios/vgasrc/swcursor.c +96 -0
- package/bios/seabios/vgasrc/vbe.c +432 -0
- package/bios/seabios/vgasrc/vgabios.c +1131 -0
- package/bios/seabios/vgasrc/vgabios.h +88 -0
- package/bios/seabios/vgasrc/vgaentry.S +161 -0
- package/bios/seabios/vgasrc/vgafb.c +661 -0
- package/bios/seabios/vgasrc/vgafb.h +42 -0
- package/bios/seabios/vgasrc/vgafonts.c +785 -0
- package/bios/seabios/vgasrc/vgahw.h +152 -0
- package/bios/seabios/vgasrc/vgainit.c +202 -0
- package/bios/seabios/vgasrc/vgalayout.lds.S +23 -0
- package/bios/seabios/vgasrc/vgautil.h +103 -0
- package/bios/seabios/vgasrc/vgaversion.c +6 -0
- package/build/binaries.js +1 -1
- package/build/index-debug.cjs +1 -1
- package/build/index-debug.js +1 -1
- package/build/index.cjs +1 -1
- package/build/index.js +1 -1
- package/build/v86-debug.wasm +0 -0
- package/build/v86.wasm +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
// (qemu-emulated) lsi53c895a boot support.
|
|
2
|
+
//
|
|
3
|
+
// Copyright (C) 2012 Red Hat Inc.
|
|
4
|
+
//
|
|
5
|
+
// Authors:
|
|
6
|
+
// Gerd Hoffmann <kraxel@redhat.com>
|
|
7
|
+
//
|
|
8
|
+
// based on virtio-scsi.c which is written by:
|
|
9
|
+
// Paolo Bonzini <pbonzini@redhat.com>
|
|
10
|
+
//
|
|
11
|
+
// This file may be distributed under the terms of the GNU LGPLv3 license.
|
|
12
|
+
|
|
13
|
+
#include "biosvar.h" // GET_GLOBALFLAT
|
|
14
|
+
#include "block.h" // struct drive_s
|
|
15
|
+
#include "blockcmd.h" // scsi_drive_setup
|
|
16
|
+
#include "config.h" // CONFIG_*
|
|
17
|
+
#include "fw/paravirt.h" // runningOnQEMU
|
|
18
|
+
#include "malloc.h" // free
|
|
19
|
+
#include "output.h" // dprintf
|
|
20
|
+
#include "pcidevice.h" // foreachpci
|
|
21
|
+
#include "pci_ids.h" // PCI_DEVICE_ID_VIRTIO_BLK
|
|
22
|
+
#include "pci_regs.h" // PCI_VENDOR_ID
|
|
23
|
+
#include "stacks.h" // run_thread
|
|
24
|
+
#include "std/disk.h" // DISK_RET_SUCCESS
|
|
25
|
+
#include "string.h" // memset
|
|
26
|
+
#include "util.h" // usleep
|
|
27
|
+
|
|
28
|
+
#define LSI_REG_DSTAT 0x0c
|
|
29
|
+
#define LSI_REG_ISTAT0 0x14
|
|
30
|
+
#define LSI_REG_DSP0 0x2c
|
|
31
|
+
#define LSI_REG_DSP1 0x2d
|
|
32
|
+
#define LSI_REG_DSP2 0x2e
|
|
33
|
+
#define LSI_REG_DSP3 0x2f
|
|
34
|
+
#define LSI_REG_SIST0 0x42
|
|
35
|
+
#define LSI_REG_SIST1 0x43
|
|
36
|
+
|
|
37
|
+
#define LSI_ISTAT0_DIP 0x01
|
|
38
|
+
#define LSI_ISTAT0_SIP 0x02
|
|
39
|
+
#define LSI_ISTAT0_INTF 0x04
|
|
40
|
+
#define LSI_ISTAT0_CON 0x08
|
|
41
|
+
#define LSI_ISTAT0_SEM 0x10
|
|
42
|
+
#define LSI_ISTAT0_SIGP 0x20
|
|
43
|
+
#define LSI_ISTAT0_SRST 0x40
|
|
44
|
+
#define LSI_ISTAT0_ABRT 0x80
|
|
45
|
+
|
|
46
|
+
struct lsi_lun_s {
|
|
47
|
+
struct drive_s drive;
|
|
48
|
+
struct pci_device *pci;
|
|
49
|
+
u32 iobase;
|
|
50
|
+
u8 target;
|
|
51
|
+
u8 lun;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
int
|
|
55
|
+
lsi_scsi_process_op(struct disk_op_s *op)
|
|
56
|
+
{
|
|
57
|
+
if (!CONFIG_LSI_SCSI)
|
|
58
|
+
return DISK_RET_EBADTRACK;
|
|
59
|
+
struct lsi_lun_s *llun_gf =
|
|
60
|
+
container_of(op->drive_fl, struct lsi_lun_s, drive);
|
|
61
|
+
u16 target = GET_GLOBALFLAT(llun_gf->target);
|
|
62
|
+
u16 lun = GET_GLOBALFLAT(llun_gf->lun);
|
|
63
|
+
u8 cdbcmd[16];
|
|
64
|
+
int blocksize = scsi_fill_cmd(op, cdbcmd, sizeof(cdbcmd));
|
|
65
|
+
if (blocksize < 0)
|
|
66
|
+
return default_process_op(op);
|
|
67
|
+
u32 iobase = GET_GLOBALFLAT(llun_gf->iobase);
|
|
68
|
+
u32 dma = ((scsi_is_read(op) ? 0x01000000 : 0x00000000) |
|
|
69
|
+
(op->count * blocksize));
|
|
70
|
+
u8 msgout[] = {
|
|
71
|
+
0x80 | lun, // select lun
|
|
72
|
+
0x08,
|
|
73
|
+
};
|
|
74
|
+
u8 status = 0xff;
|
|
75
|
+
u8 msgin_tmp[2];
|
|
76
|
+
u8 msgin = 0xff;
|
|
77
|
+
|
|
78
|
+
u32 script[] = {
|
|
79
|
+
/* select target, send scsi command */
|
|
80
|
+
0x40000000 | target << 16, // select target
|
|
81
|
+
0x00000000,
|
|
82
|
+
0x06000001, // msgout
|
|
83
|
+
(u32)MAKE_FLATPTR(GET_SEG(SS), &msgout),
|
|
84
|
+
0x02000010, // scsi command
|
|
85
|
+
(u32)MAKE_FLATPTR(GET_SEG(SS), cdbcmd),
|
|
86
|
+
|
|
87
|
+
/* handle disconnect */
|
|
88
|
+
0x87820000, // phase == msgin ?
|
|
89
|
+
0x00000018,
|
|
90
|
+
0x07000002, // msgin
|
|
91
|
+
(u32)MAKE_FLATPTR(GET_SEG(SS), &msgin_tmp),
|
|
92
|
+
0x50000000, // re-select
|
|
93
|
+
0x00000000,
|
|
94
|
+
0x07000002, // msgin
|
|
95
|
+
(u32)MAKE_FLATPTR(GET_SEG(SS), &msgin_tmp),
|
|
96
|
+
|
|
97
|
+
/* dma data, get status, raise irq */
|
|
98
|
+
dma, // dma data
|
|
99
|
+
(u32)op->buf_fl,
|
|
100
|
+
0x03000001, // status
|
|
101
|
+
(u32)MAKE_FLATPTR(GET_SEG(SS), &status),
|
|
102
|
+
0x07000001, // msgin
|
|
103
|
+
(u32)MAKE_FLATPTR(GET_SEG(SS), &msgin),
|
|
104
|
+
0x98080000, // dma irq
|
|
105
|
+
0x00000000,
|
|
106
|
+
};
|
|
107
|
+
u32 dsp = (u32)MAKE_FLATPTR(GET_SEG(SS), &script);
|
|
108
|
+
|
|
109
|
+
outb(dsp & 0xff, iobase + LSI_REG_DSP0);
|
|
110
|
+
outb((dsp >> 8) & 0xff, iobase + LSI_REG_DSP1);
|
|
111
|
+
outb((dsp >> 16) & 0xff, iobase + LSI_REG_DSP2);
|
|
112
|
+
outb((dsp >> 24) & 0xff, iobase + LSI_REG_DSP3);
|
|
113
|
+
|
|
114
|
+
for (;;) {
|
|
115
|
+
u8 dstat = inb(iobase + LSI_REG_DSTAT);
|
|
116
|
+
u8 sist0 = inb(iobase + LSI_REG_SIST0);
|
|
117
|
+
u8 sist1 = inb(iobase + LSI_REG_SIST1);
|
|
118
|
+
if (sist0 || sist1) {
|
|
119
|
+
goto fail;
|
|
120
|
+
}
|
|
121
|
+
if (dstat & 0x04) {
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
usleep(5);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (msgin == 0 && status == 0) {
|
|
128
|
+
return DISK_RET_SUCCESS;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
fail:
|
|
132
|
+
return DISK_RET_EBADTRACK;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
static void
|
|
136
|
+
lsi_scsi_init_lun(struct lsi_lun_s *llun, struct pci_device *pci, u32 iobase,
|
|
137
|
+
u8 target, u8 lun)
|
|
138
|
+
{
|
|
139
|
+
memset(llun, 0, sizeof(*llun));
|
|
140
|
+
llun->drive.type = DTYPE_LSI_SCSI;
|
|
141
|
+
llun->drive.cntl_id = pci->bdf;
|
|
142
|
+
llun->pci = pci;
|
|
143
|
+
llun->target = target;
|
|
144
|
+
llun->lun = lun;
|
|
145
|
+
llun->iobase = iobase;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
static int
|
|
149
|
+
lsi_scsi_add_lun(u32 lun, struct drive_s *tmpl_drv)
|
|
150
|
+
{
|
|
151
|
+
struct lsi_lun_s *tmpl_llun =
|
|
152
|
+
container_of(tmpl_drv, struct lsi_lun_s, drive);
|
|
153
|
+
struct lsi_lun_s *llun = malloc_fseg(sizeof(*llun));
|
|
154
|
+
if (!llun) {
|
|
155
|
+
warn_noalloc();
|
|
156
|
+
return -1;
|
|
157
|
+
}
|
|
158
|
+
lsi_scsi_init_lun(llun, tmpl_llun->pci, tmpl_llun->iobase,
|
|
159
|
+
tmpl_llun->target, lun);
|
|
160
|
+
|
|
161
|
+
char *name = znprintf(MAXDESCSIZE, "lsi %pP %d:%d",
|
|
162
|
+
llun->pci, llun->target, llun->lun);
|
|
163
|
+
int prio = bootprio_find_scsi_device(llun->pci, llun->target, llun->lun);
|
|
164
|
+
int ret = scsi_drive_setup(&llun->drive, name, prio);
|
|
165
|
+
free(name);
|
|
166
|
+
if (ret)
|
|
167
|
+
goto fail;
|
|
168
|
+
return 0;
|
|
169
|
+
|
|
170
|
+
fail:
|
|
171
|
+
free(llun);
|
|
172
|
+
return -1;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
static void
|
|
176
|
+
lsi_scsi_scan_target(struct pci_device *pci, u32 iobase, u8 target)
|
|
177
|
+
{
|
|
178
|
+
struct lsi_lun_s llun0;
|
|
179
|
+
|
|
180
|
+
lsi_scsi_init_lun(&llun0, pci, iobase, target, 0);
|
|
181
|
+
|
|
182
|
+
if (scsi_rep_luns_scan(&llun0.drive, lsi_scsi_add_lun) < 0)
|
|
183
|
+
scsi_sequential_scan(&llun0.drive, 8, lsi_scsi_add_lun);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
static void
|
|
187
|
+
init_lsi_scsi(void *data)
|
|
188
|
+
{
|
|
189
|
+
struct pci_device *pci = data;
|
|
190
|
+
u32 iobase = pci_enable_iobar(pci, PCI_BASE_ADDRESS_0);
|
|
191
|
+
if (!iobase)
|
|
192
|
+
return;
|
|
193
|
+
pci_enable_busmaster(pci);
|
|
194
|
+
|
|
195
|
+
dprintf(1, "found lsi53c895a at %pP, io @ %x\n", pci, iobase);
|
|
196
|
+
|
|
197
|
+
// reset
|
|
198
|
+
outb(LSI_ISTAT0_SRST, iobase + LSI_REG_ISTAT0);
|
|
199
|
+
|
|
200
|
+
int i;
|
|
201
|
+
for (i = 0; i < 7; i++)
|
|
202
|
+
lsi_scsi_scan_target(pci, iobase, i);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
void
|
|
206
|
+
lsi_scsi_setup(void)
|
|
207
|
+
{
|
|
208
|
+
ASSERT32FLAT();
|
|
209
|
+
if (!CONFIG_LSI_SCSI || !runningOnQEMU())
|
|
210
|
+
return;
|
|
211
|
+
|
|
212
|
+
dprintf(3, "init lsi53c895a\n");
|
|
213
|
+
|
|
214
|
+
struct pci_device *pci;
|
|
215
|
+
foreachpci(pci) {
|
|
216
|
+
if (pci->vendor != PCI_VENDOR_ID_LSI_LOGIC
|
|
217
|
+
|| pci->device != PCI_DEVICE_ID_LSI_53C895A)
|
|
218
|
+
continue;
|
|
219
|
+
run_thread(init_lsi_scsi, pci);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
// MegaRAID SAS boot support.
|
|
2
|
+
//
|
|
3
|
+
// Copyright (C) 2012 Hannes Reinecke, SUSE Linux Products GmbH
|
|
4
|
+
//
|
|
5
|
+
// Authors:
|
|
6
|
+
// Hannes Reinecke <hare@suse.de>
|
|
7
|
+
//
|
|
8
|
+
// based on virtio-scsi.c which is written by:
|
|
9
|
+
// Paolo Bonzini <pbonzini@redhat.com>
|
|
10
|
+
//
|
|
11
|
+
// This file may be distributed under the terms of the GNU LGPLv3 license.
|
|
12
|
+
|
|
13
|
+
#include "biosvar.h" // GET_GLOBALFLAT
|
|
14
|
+
#include "block.h" // struct drive_s
|
|
15
|
+
#include "blockcmd.h" // scsi_drive_setup
|
|
16
|
+
#include "config.h" // CONFIG_*
|
|
17
|
+
#include "malloc.h" // free
|
|
18
|
+
#include "output.h" // dprintf
|
|
19
|
+
#include "pci.h" // pci_config_readl
|
|
20
|
+
#include "pcidevice.h" // foreachpci
|
|
21
|
+
#include "pci_ids.h" // PCI_DEVICE_ID_XXX
|
|
22
|
+
#include "pci_regs.h" // PCI_VENDOR_ID
|
|
23
|
+
#include "stacks.h" // yield
|
|
24
|
+
#include "std/disk.h" // DISK_RET_SUCCESS
|
|
25
|
+
#include "string.h" // memset
|
|
26
|
+
#include "util.h" // timer_calc
|
|
27
|
+
|
|
28
|
+
#define MFI_DB 0x0 // Doorbell
|
|
29
|
+
#define MFI_OMSG0 0x18 // Outbound message 0
|
|
30
|
+
#define MFI_IDB 0x20 // Inbound doorbell
|
|
31
|
+
#define MFI_ODB 0x2c // Outbound doorbell
|
|
32
|
+
#define MFI_IQP 0x40 // Inbound queue port
|
|
33
|
+
#define MFI_OSP0 0xb0 // Outbound scratch pad0
|
|
34
|
+
#define MFI_IQPL 0xc0 // Inbound queue port (low bytes)
|
|
35
|
+
#define MFI_IQPH 0xc4 // Inbound queue port (high bytes)
|
|
36
|
+
|
|
37
|
+
#define MFI_STATE_MASK 0xf0000000
|
|
38
|
+
#define MFI_STATE_WAIT_HANDSHAKE 0x60000000
|
|
39
|
+
#define MFI_STATE_BOOT_MESSAGE_PENDING 0x90000000
|
|
40
|
+
#define MFI_STATE_READY 0xb0000000
|
|
41
|
+
#define MFI_STATE_OPERATIONAL 0xc0000000
|
|
42
|
+
#define MFI_STATE_FAULT 0xf0000000
|
|
43
|
+
|
|
44
|
+
/* MFI Commands */
|
|
45
|
+
typedef enum {
|
|
46
|
+
MFI_CMD_INIT = 0x00,
|
|
47
|
+
MFI_CMD_LD_READ,
|
|
48
|
+
MFI_CMD_LD_WRITE,
|
|
49
|
+
MFI_CMD_LD_SCSI_IO,
|
|
50
|
+
MFI_CMD_PD_SCSI_IO,
|
|
51
|
+
MFI_CMD_DCMD,
|
|
52
|
+
MFI_CMD_ABORT,
|
|
53
|
+
MFI_CMD_SMP,
|
|
54
|
+
MFI_CMD_STP
|
|
55
|
+
} mfi_cmd_t;
|
|
56
|
+
|
|
57
|
+
struct megasas_cmd_frame {
|
|
58
|
+
u8 cmd; /*00h */
|
|
59
|
+
u8 sense_len; /*01h */
|
|
60
|
+
u8 cmd_status; /*02h */
|
|
61
|
+
u8 scsi_status; /*03h */
|
|
62
|
+
|
|
63
|
+
u8 target_id; /*04h */
|
|
64
|
+
u8 lun; /*05h */
|
|
65
|
+
u8 cdb_len; /*06h */
|
|
66
|
+
u8 sge_count; /*07h */
|
|
67
|
+
|
|
68
|
+
u32 context; /*08h */
|
|
69
|
+
u32 context_64; /*0Ch */
|
|
70
|
+
|
|
71
|
+
u16 flags; /*10h */
|
|
72
|
+
u16 timeout; /*12h */
|
|
73
|
+
u32 data_xfer_len; /*14h */
|
|
74
|
+
|
|
75
|
+
union {
|
|
76
|
+
struct {
|
|
77
|
+
u32 opcode; /*18h */
|
|
78
|
+
u8 mbox[12]; /*1Ch */
|
|
79
|
+
u32 sgl_addr; /*28h */
|
|
80
|
+
u32 sgl_len; /*32h */
|
|
81
|
+
u32 pad; /*34h */
|
|
82
|
+
} dcmd;
|
|
83
|
+
struct {
|
|
84
|
+
u32 sense_buf_lo; /*18h */
|
|
85
|
+
u32 sense_buf_hi; /*1Ch */
|
|
86
|
+
u8 cdb[16]; /*20h */
|
|
87
|
+
u32 sgl_addr; /*30h */
|
|
88
|
+
u32 sgl_len; /*34h */
|
|
89
|
+
} pthru;
|
|
90
|
+
struct {
|
|
91
|
+
u8 pad[22]; /*18h */
|
|
92
|
+
} gen;
|
|
93
|
+
};
|
|
94
|
+
} __attribute__ ((packed));
|
|
95
|
+
|
|
96
|
+
struct mfi_ld_list_s {
|
|
97
|
+
u32 count;
|
|
98
|
+
u32 reserved_0;
|
|
99
|
+
struct {
|
|
100
|
+
u8 target;
|
|
101
|
+
u8 lun;
|
|
102
|
+
u16 seq;
|
|
103
|
+
u8 state;
|
|
104
|
+
u8 reserved_1[3];
|
|
105
|
+
u64 size;
|
|
106
|
+
} lds[64];
|
|
107
|
+
} __attribute__ ((packed));
|
|
108
|
+
|
|
109
|
+
#define MEGASAS_POLL_TIMEOUT 60000 // 60 seconds polling timeout
|
|
110
|
+
|
|
111
|
+
struct megasas_lun_s {
|
|
112
|
+
struct drive_s drive;
|
|
113
|
+
struct megasas_cmd_frame *frame;
|
|
114
|
+
u32 iobase;
|
|
115
|
+
u16 pci_id;
|
|
116
|
+
u8 target;
|
|
117
|
+
u8 lun;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
static int megasas_fire_cmd(u16 pci_id, u32 ioaddr,
|
|
121
|
+
struct megasas_cmd_frame *frame)
|
|
122
|
+
{
|
|
123
|
+
u32 frame_addr = (u32)frame;
|
|
124
|
+
int frame_count = 1;
|
|
125
|
+
u8 cmd_state;
|
|
126
|
+
|
|
127
|
+
dprintf(2, "Frame 0x%x\n", frame_addr);
|
|
128
|
+
if (pci_id == PCI_DEVICE_ID_LSI_SAS2004 ||
|
|
129
|
+
pci_id == PCI_DEVICE_ID_LSI_SAS2008) {
|
|
130
|
+
outl(0, ioaddr + MFI_IQPH);
|
|
131
|
+
outl(frame_addr | frame_count << 1 | 1, ioaddr + MFI_IQPL);
|
|
132
|
+
} else if (pci_id == PCI_DEVICE_ID_DELL_PERC5 ||
|
|
133
|
+
pci_id == PCI_DEVICE_ID_LSI_SAS1064R ||
|
|
134
|
+
pci_id == PCI_DEVICE_ID_LSI_VERDE_ZCR) {
|
|
135
|
+
outl(frame_addr >> 3 | frame_count, ioaddr + MFI_IQP);
|
|
136
|
+
} else {
|
|
137
|
+
outl(frame_addr | frame_count << 1 | 1, ioaddr + MFI_IQP);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
u32 end = timer_calc(MEGASAS_POLL_TIMEOUT);
|
|
141
|
+
do {
|
|
142
|
+
for (;;) {
|
|
143
|
+
cmd_state = GET_LOWFLAT(frame->cmd_status);
|
|
144
|
+
if (cmd_state != 0xff)
|
|
145
|
+
break;
|
|
146
|
+
if (timer_check(end)) {
|
|
147
|
+
warn_timeout();
|
|
148
|
+
return -1;
|
|
149
|
+
}
|
|
150
|
+
yield();
|
|
151
|
+
}
|
|
152
|
+
} while (cmd_state == 0xff);
|
|
153
|
+
|
|
154
|
+
if (cmd_state == 0 || cmd_state == 0x2d)
|
|
155
|
+
return 0;
|
|
156
|
+
dprintf(1, "ERROR: Frame 0x%x, status 0x%x\n", frame_addr, cmd_state);
|
|
157
|
+
return -1;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
int
|
|
161
|
+
megasas_process_op(struct disk_op_s *op)
|
|
162
|
+
{
|
|
163
|
+
if (!CONFIG_MEGASAS)
|
|
164
|
+
return DISK_RET_EBADTRACK;
|
|
165
|
+
u8 cdb[16];
|
|
166
|
+
int blocksize = scsi_fill_cmd(op, cdb, sizeof(cdb));
|
|
167
|
+
if (blocksize < 0)
|
|
168
|
+
return default_process_op(op);
|
|
169
|
+
struct megasas_lun_s *mlun_gf =
|
|
170
|
+
container_of(op->drive_fl, struct megasas_lun_s, drive);
|
|
171
|
+
struct megasas_cmd_frame *frame = GET_GLOBALFLAT(mlun_gf->frame);
|
|
172
|
+
u16 pci_id = GET_GLOBALFLAT(mlun_gf->pci_id);
|
|
173
|
+
int i;
|
|
174
|
+
|
|
175
|
+
memset_fl(frame, 0, sizeof(*frame));
|
|
176
|
+
SET_LOWFLAT(frame->cmd, MFI_CMD_LD_SCSI_IO);
|
|
177
|
+
SET_LOWFLAT(frame->cmd_status, 0xFF);
|
|
178
|
+
SET_LOWFLAT(frame->target_id, GET_GLOBALFLAT(mlun_gf->target));
|
|
179
|
+
SET_LOWFLAT(frame->lun, GET_GLOBALFLAT(mlun_gf->lun));
|
|
180
|
+
SET_LOWFLAT(frame->flags, 0x0001);
|
|
181
|
+
SET_LOWFLAT(frame->data_xfer_len, op->count * blocksize);
|
|
182
|
+
SET_LOWFLAT(frame->cdb_len, 16);
|
|
183
|
+
|
|
184
|
+
for (i = 0; i < 16; i++) {
|
|
185
|
+
SET_LOWFLAT(frame->pthru.cdb[i], cdb[i]);
|
|
186
|
+
}
|
|
187
|
+
dprintf(2, "pthru cmd 0x%x count %d bs %d\n",
|
|
188
|
+
cdb[0], op->count, blocksize);
|
|
189
|
+
|
|
190
|
+
if (op->count) {
|
|
191
|
+
SET_LOWFLAT(frame->pthru.sgl_addr, (u32)op->buf_fl);
|
|
192
|
+
SET_LOWFLAT(frame->pthru.sgl_len, op->count * blocksize);
|
|
193
|
+
SET_LOWFLAT(frame->sge_count, 1);
|
|
194
|
+
}
|
|
195
|
+
SET_LOWFLAT(frame->context, (u32)frame);
|
|
196
|
+
|
|
197
|
+
if (megasas_fire_cmd(pci_id, GET_GLOBALFLAT(mlun_gf->iobase), frame) == 0)
|
|
198
|
+
return DISK_RET_SUCCESS;
|
|
199
|
+
|
|
200
|
+
dprintf(2, "pthru cmd 0x%x failed\n", cdb[0]);
|
|
201
|
+
return DISK_RET_EBADTRACK;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
static int
|
|
205
|
+
megasas_add_lun(struct pci_device *pci, u32 iobase, u8 target, u8 lun)
|
|
206
|
+
{
|
|
207
|
+
struct megasas_lun_s *mlun = malloc_fseg(sizeof(*mlun));
|
|
208
|
+
char *name;
|
|
209
|
+
int prio, ret = 0;
|
|
210
|
+
|
|
211
|
+
if (!mlun) {
|
|
212
|
+
warn_noalloc();
|
|
213
|
+
return -1;
|
|
214
|
+
}
|
|
215
|
+
memset(mlun, 0, sizeof(*mlun));
|
|
216
|
+
mlun->drive.type = DTYPE_MEGASAS;
|
|
217
|
+
mlun->drive.cntl_id = pci->bdf;
|
|
218
|
+
mlun->pci_id = pci->device;
|
|
219
|
+
mlun->target = target;
|
|
220
|
+
mlun->lun = lun;
|
|
221
|
+
mlun->iobase = iobase;
|
|
222
|
+
mlun->frame = memalign_low(256, sizeof(struct megasas_cmd_frame));
|
|
223
|
+
if (!mlun->frame) {
|
|
224
|
+
warn_noalloc();
|
|
225
|
+
free(mlun);
|
|
226
|
+
return -1;
|
|
227
|
+
}
|
|
228
|
+
name = znprintf(MAXDESCSIZE, "MegaRAID SAS (PCI %pP) LD %d:%d"
|
|
229
|
+
, pci, target, lun);
|
|
230
|
+
prio = bootprio_find_scsi_device(pci, target, lun);
|
|
231
|
+
ret = scsi_drive_setup(&mlun->drive, name, prio);
|
|
232
|
+
free(name);
|
|
233
|
+
if (ret) {
|
|
234
|
+
free(mlun->frame);
|
|
235
|
+
free(mlun);
|
|
236
|
+
ret = -1;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return ret;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
static void megasas_scan_target(struct pci_device *pci, u32 iobase)
|
|
243
|
+
{
|
|
244
|
+
struct mfi_ld_list_s ld_list;
|
|
245
|
+
struct megasas_cmd_frame *frame = memalign_tmp(256, sizeof(*frame));
|
|
246
|
+
if (!frame) {
|
|
247
|
+
warn_noalloc();
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
memset(&ld_list, 0, sizeof(ld_list));
|
|
252
|
+
memset_fl(frame, 0, sizeof(*frame));
|
|
253
|
+
|
|
254
|
+
frame->cmd = MFI_CMD_DCMD;
|
|
255
|
+
frame->cmd_status = 0xFF;
|
|
256
|
+
frame->sge_count = 1;
|
|
257
|
+
frame->flags = 0x0011;
|
|
258
|
+
frame->data_xfer_len = sizeof(ld_list);
|
|
259
|
+
frame->dcmd.opcode = 0x03010000;
|
|
260
|
+
frame->dcmd.sgl_addr = (u32)MAKE_FLATPTR(GET_SEG(SS), &ld_list);
|
|
261
|
+
frame->dcmd.sgl_len = sizeof(ld_list);
|
|
262
|
+
frame->context = (u32)frame;
|
|
263
|
+
|
|
264
|
+
if (megasas_fire_cmd(pci->device, iobase, frame) == 0) {
|
|
265
|
+
dprintf(2, "%d LD found\n", ld_list.count);
|
|
266
|
+
int i;
|
|
267
|
+
for (i = 0; i < ld_list.count; i++) {
|
|
268
|
+
dprintf(2, "LD %d:%d state 0x%x\n",
|
|
269
|
+
ld_list.lds[i].target, ld_list.lds[i].lun,
|
|
270
|
+
ld_list.lds[i].state);
|
|
271
|
+
if (ld_list.lds[i].state != 0) {
|
|
272
|
+
megasas_add_lun(pci, iobase,
|
|
273
|
+
ld_list.lds[i].target, ld_list.lds[i].lun);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
static int megasas_transition_to_ready(struct pci_device *pci, u32 ioaddr)
|
|
280
|
+
{
|
|
281
|
+
u32 fw_state = 0, new_state, mfi_flags = 0;
|
|
282
|
+
|
|
283
|
+
if (pci->device == PCI_DEVICE_ID_LSI_SAS1064R ||
|
|
284
|
+
pci->device == PCI_DEVICE_ID_DELL_PERC5)
|
|
285
|
+
new_state = inl(ioaddr + MFI_OMSG0) & MFI_STATE_MASK;
|
|
286
|
+
else
|
|
287
|
+
new_state = inl(ioaddr + MFI_OSP0) & MFI_STATE_MASK;
|
|
288
|
+
|
|
289
|
+
while (fw_state != new_state) {
|
|
290
|
+
switch (new_state) {
|
|
291
|
+
case MFI_STATE_FAULT:
|
|
292
|
+
dprintf(1, "ERROR: fw in fault state\n");
|
|
293
|
+
return -1;
|
|
294
|
+
break;
|
|
295
|
+
case MFI_STATE_WAIT_HANDSHAKE:
|
|
296
|
+
mfi_flags = 0x08;
|
|
297
|
+
/* fallthrough */
|
|
298
|
+
case MFI_STATE_BOOT_MESSAGE_PENDING:
|
|
299
|
+
mfi_flags |= 0x10;
|
|
300
|
+
if (pci->device == PCI_DEVICE_ID_LSI_SAS2004 ||
|
|
301
|
+
pci->device == PCI_DEVICE_ID_LSI_SAS2008 ||
|
|
302
|
+
pci->device == PCI_DEVICE_ID_LSI_SAS2208 ||
|
|
303
|
+
pci->device == PCI_DEVICE_ID_LSI_SAS3108) {
|
|
304
|
+
outl(mfi_flags, ioaddr + MFI_DB);
|
|
305
|
+
} else {
|
|
306
|
+
outl(mfi_flags, ioaddr + MFI_IDB);
|
|
307
|
+
}
|
|
308
|
+
break;
|
|
309
|
+
case MFI_STATE_OPERATIONAL:
|
|
310
|
+
mfi_flags = 0x07;
|
|
311
|
+
if (pci->device == PCI_DEVICE_ID_LSI_SAS2004 ||
|
|
312
|
+
pci->device == PCI_DEVICE_ID_LSI_SAS2008 ||
|
|
313
|
+
pci->device == PCI_DEVICE_ID_LSI_SAS2208 ||
|
|
314
|
+
pci->device == PCI_DEVICE_ID_LSI_SAS3108) {
|
|
315
|
+
outl(mfi_flags, ioaddr + MFI_DB);
|
|
316
|
+
if (pci->device == PCI_DEVICE_ID_LSI_SAS2208 ||
|
|
317
|
+
pci->device == PCI_DEVICE_ID_LSI_SAS3108) {
|
|
318
|
+
int j = 0;
|
|
319
|
+
u32 doorbell;
|
|
320
|
+
|
|
321
|
+
while (j < MEGASAS_POLL_TIMEOUT) {
|
|
322
|
+
doorbell = inl(ioaddr + MFI_DB) & 1;
|
|
323
|
+
if (!doorbell)
|
|
324
|
+
break;
|
|
325
|
+
msleep(20);
|
|
326
|
+
j++;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
} else {
|
|
330
|
+
outl(mfi_flags, ioaddr + MFI_IDB);
|
|
331
|
+
}
|
|
332
|
+
break;
|
|
333
|
+
case MFI_STATE_READY:
|
|
334
|
+
dprintf(2, "MegaRAID SAS fw ready\n");
|
|
335
|
+
return 0;
|
|
336
|
+
}
|
|
337
|
+
// The current state should not last longer than poll timeout
|
|
338
|
+
u32 end = timer_calc(MEGASAS_POLL_TIMEOUT);
|
|
339
|
+
for (;;) {
|
|
340
|
+
if (timer_check(end)) {
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
yield();
|
|
344
|
+
fw_state = new_state;
|
|
345
|
+
if (pci->device == PCI_DEVICE_ID_LSI_SAS1064R ||
|
|
346
|
+
pci->device == PCI_DEVICE_ID_DELL_PERC5)
|
|
347
|
+
new_state = inl(ioaddr + MFI_OMSG0) & MFI_STATE_MASK;
|
|
348
|
+
else
|
|
349
|
+
new_state = inl(ioaddr + MFI_OSP0) & MFI_STATE_MASK;
|
|
350
|
+
if (new_state != fw_state) {
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
dprintf(1, "ERROR: fw in state %x\n", new_state & MFI_STATE_MASK);
|
|
356
|
+
return -1;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
static void
|
|
360
|
+
init_megasas(void *data)
|
|
361
|
+
{
|
|
362
|
+
struct pci_device *pci = data;
|
|
363
|
+
u32 bar = PCI_BASE_ADDRESS_2;
|
|
364
|
+
if (!(pci_config_readl(pci->bdf, bar) & PCI_BASE_ADDRESS_IO_MASK))
|
|
365
|
+
bar = PCI_BASE_ADDRESS_0;
|
|
366
|
+
u32 iobase = pci_enable_iobar(pci, bar);
|
|
367
|
+
if (!iobase)
|
|
368
|
+
return;
|
|
369
|
+
pci_enable_busmaster(pci);
|
|
370
|
+
|
|
371
|
+
dprintf(1, "found MegaRAID SAS at %pP, io @ %x\n", pci, iobase);
|
|
372
|
+
|
|
373
|
+
// reset
|
|
374
|
+
if (megasas_transition_to_ready(pci, iobase) == 0)
|
|
375
|
+
megasas_scan_target(pci, iobase);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
void
|
|
379
|
+
megasas_setup(void)
|
|
380
|
+
{
|
|
381
|
+
ASSERT32FLAT();
|
|
382
|
+
if (!CONFIG_MEGASAS)
|
|
383
|
+
return;
|
|
384
|
+
|
|
385
|
+
dprintf(3, "init megasas\n");
|
|
386
|
+
|
|
387
|
+
struct pci_device *pci;
|
|
388
|
+
foreachpci(pci) {
|
|
389
|
+
if (pci->vendor != PCI_VENDOR_ID_LSI_LOGIC &&
|
|
390
|
+
pci->vendor != PCI_VENDOR_ID_DELL)
|
|
391
|
+
continue;
|
|
392
|
+
if (pci->device == PCI_DEVICE_ID_LSI_SAS1064R ||
|
|
393
|
+
pci->device == PCI_DEVICE_ID_LSI_SAS1078 ||
|
|
394
|
+
pci->device == PCI_DEVICE_ID_LSI_SAS1078DE ||
|
|
395
|
+
pci->device == PCI_DEVICE_ID_LSI_SAS2108 ||
|
|
396
|
+
pci->device == PCI_DEVICE_ID_LSI_SAS2108E ||
|
|
397
|
+
pci->device == PCI_DEVICE_ID_LSI_SAS2004 ||
|
|
398
|
+
pci->device == PCI_DEVICE_ID_LSI_SAS2008 ||
|
|
399
|
+
pci->device == PCI_DEVICE_ID_LSI_VERDE_ZCR ||
|
|
400
|
+
pci->device == PCI_DEVICE_ID_DELL_PERC5 ||
|
|
401
|
+
pci->device == PCI_DEVICE_ID_LSI_SAS2208 ||
|
|
402
|
+
pci->device == PCI_DEVICE_ID_LSI_SAS3108)
|
|
403
|
+
run_thread(init_megasas, pci);
|
|
404
|
+
}
|
|
405
|
+
}
|