[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 09/11] pc-bios/s390-ccw: Add core files for t
From: |
Cornelia Huck |
Subject: |
Re: [Qemu-devel] [PATCH v4 09/11] pc-bios/s390-ccw: Add core files for the network bootloading program |
Date: |
Tue, 11 Jul 2017 16:30:11 +0200 |
On Tue, 11 Jul 2017 15:56:35 +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 | 137
> +++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 187 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..d604623
> --- /dev/null
> +++ b/pc-bios/s390-ccw/netmain.c
> @@ -0,0 +1,137 @@
(...)
> +static uint64_t get_timer_ms(void)
> +{
> + uint64_t clk;
> +
> + asm volatile(" stck %0 " : : "Q"(clk) : "memory");
> +
> + /* Bit 51 is incrememented each microsecond */
s/incrememented/incremented/
> + return (clk >> (63 - 51)) / 1000;
> +}
(...)
> +static bool find_net_dev(Schib *schib, int dev_no)
> +{
> + int i, r;
> +
> + for (i = 0; i < 0x10000; i++) {
> + net_schid.sch_no = i;
> + r = stsch_err(net_schid, schib);
> + if (r == 3 || r == -EIO) {
> + break;
> + }
> + if (!schib->pmcw.dnv) {
> + continue;
> + }
> + if (!virtio_is_supported(net_schid)) {
> + continue;
> + }
> + if (virtio_get_device_type() != VIRTIO_ID_NET) {
> + continue;
> + }
> + if (dev_no < 0 || schib->pmcw.dev == dev_no) {
> + return true;
> + }
> + }
> +
> + return false;
> +}
> +
> +static void virtio_setup(void)
> +{
> + Schib schib;
> + int ssid;
> + bool found = false;
> + uint16_t dev_no;
> +
> + /*
> + * We unconditionally enable mss support. In every sane configuration,
> + * this will succeed; and even if it doesn't, stsch_err() can deal
> + * with the consequences.
> + */
> + enable_mss_facility();
> +
> + if (store_iplb(&iplb)) {
> + IPL_assert(iplb.pbt == S390_IPL_TYPE_CCW, "IPL_TYPE_CCW expected");
> + dev_no = iplb.ccw.devno;
> + debug_print_int("device no. ", dev_no);
> + net_schid.ssid = iplb.ccw.ssid & 0x3;
> + debug_print_int("ssid ", net_schid.ssid);
> + found = find_net_dev(&schib, dev_no);
> + } else {
> + for (ssid = 0; ssid < 0x3; ssid++) {
> + net_schid.ssid = ssid;
> + found = find_net_dev(&schib, -1);
> + if (found) {
> + break;
> + }
> + }
> + }
> +
> + IPL_assert(found && virtio_get_device_type() == VIRTIO_ID_NET,
Is found && virtio_get_device_type() != VIRTIO_ID_NET even possible?
> + "No virtio net device found");
> +}
Anyway, otherwise
Reviewed-by: Cornelia Huck <address@hidden>
- [Qemu-devel] [PATCH v4 05/11] pc-bios/s390-ccw: Move byteswap functions to a separate header, (continued)
- [Qemu-devel] [PATCH v4 05/11] pc-bios/s390-ccw: Move byteswap functions to a separate header, Thomas Huth, 2017/07/11
- [Qemu-devel] [PATCH v4 03/11] pc-bios/s390-ccw: Move virtio-block related functions into a separate file, Thomas Huth, 2017/07/11
- [Qemu-devel] [PATCH v4 04/11] pc-bios/s390-ccw: Add a write() function for stdio, Thomas Huth, 2017/07/11
- [Qemu-devel] [PATCH v4 06/11] pc-bios/s390-ccw: Remove unused structs from virtio.h, Thomas Huth, 2017/07/11
- [Qemu-devel] [PATCH v4 07/11] pc-bios/s390-ccw: Add code for virtio feature negotiation, Thomas Huth, 2017/07/11
- [Qemu-devel] [PATCH v4 08/11] roms/SLOF: Update submodule to latest status, Thomas Huth, 2017/07/11
- [Qemu-devel] [PATCH v4 09/11] pc-bios/s390-ccw: Add core files for the network bootloading program, Thomas Huth, 2017/07/11
- Re: [Qemu-devel] [PATCH v4 09/11] pc-bios/s390-ccw: Add core files for the network bootloading program,
Cornelia Huck <=
- [Qemu-devel] [PATCH v4 10/11] pc-bios/s390-ccw: Add virtio-net driver code, Thomas Huth, 2017/07/11
- [Qemu-devel] [PATCH v4 11/11] pc-bios/s390-ccw: Link libnet into the netboot image and do the TFTP load, Thomas Huth, 2017/07/11
- Re: [Qemu-devel] [PATCH v4 00/11] Implement network booting in the s390-ccw BIOS, no-reply, 2017/07/11
- Re: [Qemu-devel] [PATCH v4 00/11] Implement network booting in the s390-ccw BIOS, Christian Borntraeger, 2017/07/12