summaryrefslogtreecommitdiff
path: root/pc-bios/s390-ccw/bootmap.c
AgeCommit message (Collapse)AuthorFilesLines
2018-03-08pc-bios/s390-ccw: Move string arrays from bootmap header to .c fileThomas Huth1-0/+20
bootmap.h can currently only be included once - otherwise the linker complains about multiple definitions of the "magic" strings. It's a bad style to define string arrays in header files, so let's better move these to the bootmap.c file instead where they are used. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <1520317081-5341-1-git-send-email-thuth@redhat.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2018-02-26s390-ccw: interactive boot menu for scsiCollin L. Walling1-0/+4
Interactive boot menu for scsi. This follows a similar procedure as the interactive menu for eckd dasd. An example follows: s390x Enumerated Boot Menu. 3 entries detected. Select from index 0 to 2. Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> [thuth: Added additional "break;" statement to avoid analyzer warnings] Signed-off-by: Thomas Huth <thuth@redhat.com>
2018-02-26s390-ccw: read stage2 boot loader data to find menuCollin L. Walling1-5/+89
Read the stage2 boot loader data block-by-block. We scan the current block for the string "zIPL" to detect the start of the boot menu banner. We then load the adjacent blocks (previous block and next block) to account for the possibility of menu data spanning multiple blocks. Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2018-02-26s390-ccw: update libcCollin L. Walling1-2/+2
Moved: memcmp from bootmap.h to libc.h (renamed from _memcmp) strlen from sclp.c to libc.h (renamed from _strlen) Added C standard functions: isdigit Added non C-standard function: uitoa atoui Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: Janosch Frank <frankja@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2018-02-26s390-ccw: refactor IPL structsCollin L. Walling1-6/+6
ECKD DASDs have different IPL structures for CDL and LDL formats. The current Ipl1 and Ipl2 structs follow the CDL format, so we prepend "EckdCdl" to them. Boot info for LDL has been moved to a new struct: EckdLdlIpl1. Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com> Acked-by: Janosch Frank <frankja@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2018-02-26s390-ccw: refactor eckd_block_num to use CHSCollin L. Walling1-14/+14
Add new cylinder/head/sector struct. Use it to calculate eckd block numbers instead of a BootMapPointer (which used eckd chs anyway). Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2018-02-26s390-ccw: refactor boot map table codeCollin L. Walling1-33/+27
Some ECKD bootmap code was using structs designed for SCSI. Even though this works, it confuses readability. Add a new BootMapTable struct to assist with readability in bootmap entry code. Also: - replace ScsiMbr in ECKD code with appropriate structs - fix read_block messages to reflect BootMapTable - fixup ipl_scsi to use BootMapTable (referred to as Program Table) - defined value for maximum table entries Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2017-07-14pc-bios/s390-ccw: Move byteswap functions to a separate headerThomas Huth1-0/+1
We'll need them in code that is not related to bootmap.h, so they should reside in an independent header. Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <1499863793-18627-6-git-send-email-thuth@redhat.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2017-07-14pc-bios/s390-ccw: Move libc functions to separate headerThomas Huth1-0/+1
The upcoming netboot code will use the libc from SLOF. To be able to still use s390-ccw.h there, the libc related functions in this header have to be moved to a different location. And while we're at it, remove the duplicate memcpy() function from sclp.c. Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <1499863793-18627-2-git-send-email-thuth@redhat.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2017-05-02pc-bios/s390-ccw: add boot entry selection to El Torito routineEugene (jno) Dvurechenski1-1/+6
If there is no LOADPARM given or '0' specified, then IPL the first matched entry. Otherwise IPL the matching entry of that number. Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2017-05-02pc-bios/s390-ccw: add boot entry selection for ECKD DASDFarhan Ali1-5/+11
1. change a bit definition of ScsiMbr to allow an array of pointers 2. add loadparm fetch to boot script processing 3. apply loadparm index to boot entry selection, if any Initial patch from Eugene (jno) Dvurechenski. Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2017-05-02pc-bios/s390-ccw: provide entry selection on LOADPARM for SCSI diskFarhan Ali1-5/+6
Fix SCSI bootmap interpreter to make use of any specified entry of the Program Table using the leftmost numeric value from the LOADPARM, if specified. Initial patch from Eugene (jno) Dvurechenski. Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2017-02-28pc-bios/s390-ccw: Use the ccw bios to start the network bootFarhan Ali1-1/+7
We want to use the ccw bios to start final network boot. To do this we use ccw bios to detect if the boot device is a virtio network device and retrieve the start address of the network boot image. Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2016-03-23pc-bios/s390-ccw: disambiguation of "No zIPL magic" messageEugene (jno) Dvurechenski1-3/+3
Don't indicate the same error message for different conditions. Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2016-03-23pc-bios/s390-ccw: enhance bootmap detectionEugene (jno) Dvurechenski1-35/+76
Improve the algorithm that tries to guess the disk layout: 1. Use CD-ROMs to read ISO only 2. Make explicit paths for -scsi and -blk virtio Acked-by: Maxim Samoylov <max7255@linux.vnet.ibm.com> Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2016-03-23pc-bios/s390-ccw: virtio_panic -> panicEugene (jno) Dvurechenski1-4/+4
This function has nothing to do with virtio. Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2016-03-23pc-bios/s390-ccw: add more disk layout checksEugene (jno) Dvurechenski1-0/+4
Experiments showed possibility of few more "misconfigurations" in disk layout. They are reported now. Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2016-03-10pc-bios/s390-ccw: fix old bug in ptr incrementEugene (jno) Dvurechenski1-1/+1
We need to increment by the size of the structure, whereas 'ns' is 'uint8_t *'. Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-11-11pc-bios/s390-ccw: El Torito 16-bit boot image size field workaroundMaxim Samoylov1-0/+90
Because of El Torito spec flaw boot image size needs to be verified. Boot catalog entry size field has 16-bit width, and specifies size in 512-byte units. Thus, boot image size cannot exceed 32M. We actually search for the file to get the file size. This is done by scanning the ISO directory tree for the ISO block number and reading the file size from the directory entry. Signed-off-by: Maxim Samoylov <max7255@linux.vnet.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-11-11pc-bios/s390-ccw: El Torito s390x boot entry checkMaxim Samoylov1-1/+10
Boot entry is considered compatible if boot image is Linux kernel with matching S390 Linux magic string. Empty boot images with sector_count == 0 are considered broken. Signed-off-by: Maxim Samoylov <max7255@linux.vnet.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-11-11pc-bios/s390-ccw: ISO-9660 El Torito boot implementationMaxim Samoylov1-0/+107
This patch enables boot from media formatted according to ISO-9660 and El Torito bootable CD specification. We try to boot from device as ISO-9660 media when SCSI IPL failed. The first boot catalog entry with bootable flag is used. ISO-9660 media with default 2048-bytes sector size only is supported. Signed-off-by: Maxim Samoylov <max7255@linux.vnet.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-02-03pc-bios/s390-ccw: fix sparse warningsChristian Borntraeger1-2/+2
Fix some sparse warnings in the s390-ccw bios. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-09-01pc-bios/s390-ccw: Do proper console setupChristian Borntraeger1-5/+5
The final newline/return must happen before we reset the sclp via diag 308. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2014-09-01pc-bios/s390-ccw: IPL from DASD with format variationsEugene (jno) Dvurechenski1-23/+29
There are two known cases of DASD format where signatures are incomplete or absent: 1. result of <dasdfmt -d ldl -L ...> (ECKD_LDL_UNLABELED) 2. CDL with zero keys in IPL1 and IPL2 records Now the code attempts to 1. find zIPL and use SCSI layout 2. find IPL1 and use CDL layout 3. find CMS1 and use LDL layout 3. find LNX1 and use LDL layout 4. find zIPL and use unlabeled LDL layout 5. find zIPL and use CDL layout 6. die in this sequence. Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2014-09-01pc-bios/s390-ccw Really big EAV ECKD DASD handlingEugene (jno) Dvurechenski1-16/+15
For EAV ECKD DASD, the cylinder count will have the magic value 0xfffeU. Therefore, use the block number to test for valid eckd addresses instead. Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2014-09-01pc-bios/s390-ccw Improve ECKD informational messageEugene (jno) Dvurechenski1-2/+20
Add block size display to ECKD scheme report. Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2014-07-08pc-bios/s390-ccw: store proper subsystem information wordChristian Borntraeger1-0/+2
POP chapter 17 requires to store a subsystem information word at 184 during IPL. Furthermore bytes 188-191 should be zero. The bootmap might contain data blocks that are written to the first page. We have to write these values after we processed the bootmap and before the final IPL. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-06-27pc-bios/s390-ccw: IPL from LDL/CMS-formatted ECKD DASDEugene (jno) Dvurechenski1-7/+85
Add code that allows us to start from two further ECKD DASD disk layouts: LDL (Linux disk layout) and CMS (cms-formatted disk). Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-06-27pc-bios/s390-ccw: IPL from CDL-formatted ECKD DASDEugene (jno) Dvurechenski1-0/+168
Add code that allows us to start from ECKD DASD using the z/OS compatible disk layout (CDL), which is the most common format for ECKD DASD. Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-06-27pc-bios/s390-ccw: factor out ipl codeEugene (jno) Dvurechenski1-38/+45
Move the scsi-disk specific ipl code from zipl_load() into a new function ipl_scsi(). This makes it easier to add ipl routines for other disk types. Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-06-27pc-bios/s390-ccw: Unify error handlingEugene (jno) Dvurechenski1-61/+21
Convert to IPL_assert and friends Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-06-27pc-bios/s390-ccw: add some utility codeEugene (jno) Dvurechenski1-14/+1
IPL_assert(term,message) is introduced to handle error conditions. ebcdic_to_ascii() to convert chars (mostly to print VOLSERs). read_block() provision for unified block-number handling. Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-06-27pc-bios/s390-ccw: handle different sector sizesEugene (jno) Dvurechenski1-5/+7
Use the virtio device's configuration to figure out the disk geometry and use a sector size based upon the layout. [CH: s/SECTOR_SIZE/MAX_SECTOR_SIZE/g] Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-06-27pc-bios/s390-ccw: cleanup and enhance bootmap defintionsEugene (jno) Dvurechenski1-51/+15
Add declarations to describe structure of different dasd IPL sources (eckd and fba). Move the structure definitions to a new header bootmap.h. While we are at it, change structs to typedefs. Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-06-27pc-bios/s390-ccw: make checkpatch happyEugene (jno) Dvurechenski1-17/+20
Remove tabs, tweak whitespace and comments. Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-06-23pc-bios/s390-ccw: fix for fragmented SCSI bootmapEugene (jno) Dvurechenski1-0/+27
We need to interpret the last entry of the bootmap with zero block count as "continuation pointer". The "last entry" is being detected by pre-filling of the scratch space with known values and respective look-ahead. Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-06-23pc-bios/s390-ccw: do a subsystem reset before running the guestChristian Borntraeger1-8/+47
The loader BIOS has already activated several devices. Let's do a subsystem reset before jumping into the guest. As there is no direct way of doing so, we use diagnose 308 to bring the system in a defined state. This is similar to what kdump on s390 uses. We have to define a small trampoline function that restores the low bytes to whatever the bootmap has written there. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2013-04-26S390: ccw firmware: Add bootmap interpreterAlexander Graf1-0/+235
On s390, there is an architected boot map format that we can read to boot a certain entry off the disk. Implement a simple reader for this that always boots the first (default) entry. Signed-off-by: Alexander Graf <agraf@suse.de>