[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 08/10] pc-bios/s390-ccw: Add core files for t
From: |
Cornelia Huck |
Subject: |
Re: [Qemu-devel] [PATCH v3 08/10] pc-bios/s390-ccw: Add core files for the network bootloading program |
Date: |
Tue, 11 Jul 2017 10:52:24 +0200 |
On Mon, 10 Jul 2017 17:32:38 +0200
Thomas Huth <address@hidden> wrote:
> This is just a preparation for the next steps: Add a makefile and a
> stripped down copy of pc-bios/s390-ccw/main.c as a basis for the network
> bootloader program, linked against the libc from SLOF already (which we
> will need for SLOF's libnet). The networking code is not included yet.
>
> Signed-off-by: Thomas Huth <address@hidden>
> ---
> pc-bios/s390-ccw/Makefile | 11 +++-
> pc-bios/s390-ccw/netboot.mak | 41 +++++++++++++
> pc-bios/s390-ccw/netmain.c | 140
> +++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 190 insertions(+), 2 deletions(-)
> create mode 100644 pc-bios/s390-ccw/netboot.mak
> create mode 100644 pc-bios/s390-ccw/netmain.c
>
> diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c
> new file mode 100644
> index 0000000..fcdd7a1
> --- /dev/null
> +++ b/pc-bios/s390-ccw/netmain.c
> @@ -0,0 +1,140 @@
> +/*
> + * S390 virtio-ccw network boot loading program
> + *
> + * Copyright 2017 Thomas Huth, Red Hat Inc.
> + *
> + * Based on the S390 virtio-ccw loading program (main.c)
> + * Copyright (c) 2013 Alexander Graf <address@hidden>
> + *
> + * This code is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or (at your
> + * option) any later version.
> + */
> +
> +#include <stdint.h>
> +#include <stdbool.h>
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <unistd.h>
> +#include <time.h>
> +
> +#include "s390-ccw.h"
> +#include "virtio.h"
> +
> +extern char _start[];
> +
> +char stack[PAGE_SIZE * 8] __attribute__((aligned(PAGE_SIZE)));
> +IplParameterBlock iplb __attribute__((aligned(PAGE_SIZE)));
> +
> +static SubChannelId blk_schid = { .one = 1 };
Call that net_schid instead? ;)
> +static uint64_t dest_timer;
> +
> +static uint64_t get_timer_ms(void)
> +{
> + uint64_t clk;
> +
> + asm volatile(" stck %0 " : : "Q"(clk) : "memory");
> +
> + /* Bit 51 is incrememented each microsecond */
> + return (clk >> (63 - 51)) / 1000;
> +}
> +
> +void set_timer(int val)
> +{
> + dest_timer = get_timer_ms() + val;
> +}
> +
> +int get_timer(void)
> +{
> + return dest_timer - get_timer_ms();
> +}
> +
> +int get_sec_ticks(void)
> +{
> + return 1000; /* number of ticks in 1 second */
> +}
> +
> +void panic(const char *string)
> +{
> + sclp_print(string);
> + for (;;) {
> + disabled_wait();
> + }
> +}
> +
> +static bool find_dev(Schib *schib, int dev_no)
> +{
> + int i, r;
> +
> + for (i = 0; i < 0x10000; i++) {
> + blk_schid.sch_no = i;
> + r = stsch_err(blk_schid, schib);
> + if (r == 3 || r == -EIO) {
> + break;
> + }
> + if (!schib->pmcw.dnv) {
> + continue;
> + }
> + if (!virtio_is_supported(blk_schid)) {
> + continue;
> + }
> + /* Skip net devices since no IPLB is created and therefore no
> + * no network bootloader has been loaded
> + */
> + if (virtio_get_device_type() == VIRTIO_ID_NET && dev_no < 0) {
> + continue;
Don't you explicitly want to find net devices here? Confused.
> + }
> + if (dev_no < 0 || schib->pmcw.dev == dev_no) {
> + return true;
> + }
> + }
> +
> + return false;
> +}
> +
- Re: [Qemu-devel] [PATCH v3 04/10] pc-bios/s390-ccw: Add a write() function for stdio, (continued)
- [Qemu-devel] [PATCH v3 07/10] roms/SLOF: Update submodule to latest status, Thomas Huth, 2017/07/10
- [Qemu-devel] [PATCH v3 06/10] pc-bios/s390-ccw: Add code for virtio feature negotiation, Thomas Huth, 2017/07/10
- [Qemu-devel] [PATCH v3 08/10] pc-bios/s390-ccw: Add core files for the network bootloading program, Thomas Huth, 2017/07/10
- Re: [Qemu-devel] [PATCH v3 08/10] pc-bios/s390-ccw: Add core files for the network bootloading program,
Cornelia Huck <=
- [Qemu-devel] [PATCH v3 09/10] pc-bios/s390-ccw: Add virtio-net driver code, Thomas Huth, 2017/07/10
- [Qemu-devel] [PATCH v3 10/10] pc-bios/s390-ccw: Link libnet into the netboot image and do the TFTP load, Thomas Huth, 2017/07/10
- Re: [Qemu-devel] [PATCH v3 00/10] Implement network booting directly into the s390-ccw BIOS, Christian Borntraeger, 2017/07/11
- Re: [Qemu-devel] [PATCH v3 00/10] Implement network booting directly into the s390-ccw BIOS, no-reply, 2017/07/11
- Re: [Qemu-devel] [PATCH v3 00/10] Implement network booting directly into the s390-ccw BIOS, no-reply, 2017/07/11