mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-27 05:20:50 +00:00
s390 update:
- various fixes - cleanup in the s390x-ccw bios -----BEGIN PGP SIGNATURE----- iQJGBAABCAAwFiEEw9DWbcNiT/aowBjO3s9rk8bwL68FAl7/ApgSHGNvaHVja0By ZWRoYXQuY29tAAoJEN7Pa5PG8C+vcJwP/3+kYTaPZ04Lzi2b6C5c65520GU1JcrS FfE1PQMn8DNv2JO175Y5fGqRmvYk0uLVHMWGWDAyImtaEjcxxwD73JOkWTFymC1R pGpyFnkB1W5lzwu6lZk3MKMVjjN64emLWbNUK27xTFt1P5sxIrdsJBh6fzI831KN 1Z0wzhtkxxpbNfa6vZek5IlzUKebqBLIBuZx0tMp0gZsLlUWeHgyCD3/VvSgTXNk Wiesk+Mk4hBnP0v7u1JLihuwAkL9gfrpdOLozPCwkQwdc/YMxNR4aoMZtUvS8NPS 6/e1EZdcyNFrWuIr9MQM8vc+XQNTmenExHeiSuBAt1jwI280olsJKn+ToiV7BEC7 VOTIpWaWYnV+PNOpCZNOq247z/pC+0DsYCv6Oomj+ogVd5pWauFhSXNoYp9/Ctim 2g7PY0GGJkX8rIuYlawW+k8U1sLg/PafyAxps904Ow3ZdJBaRZ2d59dUpoEAqr3i cS+h/r17y+JUGknVF/YmNV6oIIoUIsP4A5wExhN3ab6SUSzW9Z0FsveOvuJizr4n QwQWN2C1WxHoJFuDauVMSCDLfqRGO+uMaXqtCx5PdQ46hAx9EtpwbMUUSibJcdUX W/tbeOje5/KXcqRjOKhkujMQjE9YUP0KOaBrt0PdBkl2z/Ex1npI5mSUb80ZuT54 Wx+MYApzxhQC =Mvqj -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20200703' into staging s390 update: - various fixes - cleanup in the s390x-ccw bios # gpg: Signature made Fri 03 Jul 2020 11:04:08 BST # gpg: using RSA key C3D0D66DC3624FF6A8C018CEDECF6B93C6F02FAF # gpg: issuer "cohuck@redhat.com" # gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>" [marginal] # gpg: aka "Cornelia Huck <huckc@linux.vnet.ibm.com>" [full] # gpg: aka "Cornelia Huck <cornelia.huck@de.ibm.com>" [full] # gpg: aka "Cornelia Huck <cohuck@kernel.org>" [marginal] # gpg: aka "Cornelia Huck <cohuck@redhat.com>" [marginal] # Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0 18CE DECF 6B93 C6F0 2FAF * remotes/cohuck/tags/s390x-20200703: s390x/pci: fix set_ind_atomic virtio-ccw: fix virtio_set_ind_atomic target/s390x: Fix SQXBR pc-bios/s390: Update s390-ccw bios binaries with the latest changes pc-bios/s390-ccw: Generate and include dependency files in the Makefile pc-bios: s390x: Make u32 ptr check explicit pc-bios: s390x: Use ebcdic2ascii table pc-bios: s390x: Move panic() into header and add infinite loop pc-bios: s390x: Use PSW masks where possible and introduce PSW_MASK_SHORT_ADDR pc-bios: s390x: Rename PSW_MASK_ZMODE to PSW_MASK_64 pc-bios: s390x: Get rid of magic offsets into the lowcore pc-bios: s390x: Move sleep and yield to helper.h pc-bios: s390x: Consolidate timing functions into time.h pc-bios: s390x: cio.c cleanup and compile fix Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
21d0bafbfe
@ -637,22 +637,24 @@ static AddressSpace *s390_pci_dma_iommu(PCIBus *bus, void *opaque, int devfn)
|
||||
|
||||
static uint8_t set_ind_atomic(uint64_t ind_loc, uint8_t to_be_set)
|
||||
{
|
||||
uint8_t ind_old, ind_new;
|
||||
uint8_t expected, actual;
|
||||
hwaddr len = 1;
|
||||
uint8_t *ind_addr;
|
||||
/* avoid multiple fetches */
|
||||
uint8_t volatile *ind_addr;
|
||||
|
||||
ind_addr = cpu_physical_memory_map(ind_loc, &len, true);
|
||||
if (!ind_addr) {
|
||||
s390_pci_generate_error_event(ERR_EVENT_AIRERR, 0, 0, 0, 0);
|
||||
return -1;
|
||||
}
|
||||
actual = *ind_addr;
|
||||
do {
|
||||
ind_old = *ind_addr;
|
||||
ind_new = ind_old | to_be_set;
|
||||
} while (atomic_cmpxchg(ind_addr, ind_old, ind_new) != ind_old);
|
||||
cpu_physical_memory_unmap(ind_addr, len, 1, len);
|
||||
expected = actual;
|
||||
actual = atomic_cmpxchg(ind_addr, expected, expected | to_be_set);
|
||||
} while (actual != expected);
|
||||
cpu_physical_memory_unmap((void *)ind_addr, len, 1, len);
|
||||
|
||||
return ind_old;
|
||||
return actual;
|
||||
}
|
||||
|
||||
static void s390_msi_ctrl_write(void *opaque, hwaddr addr, uint64_t data,
|
||||
|
@ -786,9 +786,10 @@ static inline VirtioCcwDevice *to_virtio_ccw_dev_fast(DeviceState *d)
|
||||
static uint8_t virtio_set_ind_atomic(SubchDev *sch, uint64_t ind_loc,
|
||||
uint8_t to_be_set)
|
||||
{
|
||||
uint8_t ind_old, ind_new;
|
||||
uint8_t expected, actual;
|
||||
hwaddr len = 1;
|
||||
uint8_t *ind_addr;
|
||||
/* avoid multiple fetches */
|
||||
uint8_t volatile *ind_addr;
|
||||
|
||||
ind_addr = cpu_physical_memory_map(ind_loc, &len, true);
|
||||
if (!ind_addr) {
|
||||
@ -796,14 +797,15 @@ static uint8_t virtio_set_ind_atomic(SubchDev *sch, uint64_t ind_loc,
|
||||
__func__, sch->cssid, sch->ssid, sch->schid);
|
||||
return -1;
|
||||
}
|
||||
actual = *ind_addr;
|
||||
do {
|
||||
ind_old = *ind_addr;
|
||||
ind_new = ind_old | to_be_set;
|
||||
} while (atomic_cmpxchg(ind_addr, ind_old, ind_new) != ind_old);
|
||||
trace_virtio_ccw_set_ind(ind_loc, ind_old, ind_new);
|
||||
cpu_physical_memory_unmap(ind_addr, len, 1, len);
|
||||
expected = actual;
|
||||
actual = atomic_cmpxchg(ind_addr, expected, expected | to_be_set);
|
||||
} while (actual != expected);
|
||||
trace_virtio_ccw_set_ind(ind_loc, actual, actual | to_be_set);
|
||||
cpu_physical_memory_unmap((void *)ind_addr, len, 1, len);
|
||||
|
||||
return ind_old;
|
||||
return actual;
|
||||
}
|
||||
|
||||
static void virtio_ccw_notify(DeviceState *d, uint16_t vector)
|
||||
|
Binary file not shown.
@ -38,5 +38,8 @@ s390-netboot.img:
|
||||
@echo "s390-netboot.img not built since roms/SLOF/ is not available."
|
||||
endif
|
||||
|
||||
ALL_OBJS = $(sort $(OBJECTS) $(NETOBJS) $(LIBCOBJS) $(LIBNETOBJS))
|
||||
-include $(ALL_OBJS:%.o=%.d)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.d *.img *.elf *~ *.a
|
||||
|
@ -328,9 +328,7 @@ static void print_eckd_ldl_msg(ECKD_IPL_mode_t mode)
|
||||
msg[0] = '2';
|
||||
break;
|
||||
default:
|
||||
msg[0] = vlbl->LDL_version;
|
||||
msg[0] &= 0x0f; /* convert EBCDIC */
|
||||
msg[0] |= 0x30; /* to ASCII (digit) */
|
||||
msg[0] = ebc2asc[vlbl->LDL_version];
|
||||
msg[1] = '?';
|
||||
break;
|
||||
}
|
||||
|
@ -49,13 +49,13 @@ void enable_subchannel(SubChannelId schid)
|
||||
|
||||
uint16_t cu_type(SubChannelId schid)
|
||||
{
|
||||
Ccw1 sense_id_ccw;
|
||||
SenseId sense_data;
|
||||
|
||||
sense_id_ccw.cmd_code = CCW_CMD_SENSE_ID;
|
||||
sense_id_ccw.cda = ptr2u32(&sense_data);
|
||||
sense_id_ccw.count = sizeof(sense_data);
|
||||
sense_id_ccw.flags |= CCW_FLAG_SLI;
|
||||
Ccw1 sense_id_ccw = {
|
||||
.cmd_code = CCW_CMD_SENSE_ID,
|
||||
.flags = CCW_FLAG_SLI,
|
||||
.count = sizeof(sense_data),
|
||||
.cda = ptr2u32(&sense_data),
|
||||
};
|
||||
|
||||
if (do_cio(schid, CU_TYPE_UNKNOWN, ptr2u32(&sense_id_ccw), CCW_FMT1)) {
|
||||
panic("Failed to run SenseID CCw\n");
|
||||
@ -67,13 +67,13 @@ uint16_t cu_type(SubChannelId schid)
|
||||
int basic_sense(SubChannelId schid, uint16_t cutype, void *sense_data,
|
||||
uint16_t data_size)
|
||||
{
|
||||
Ccw1 senseCcw;
|
||||
Ccw1 senseCcw = {
|
||||
.cmd_code = CCW_CMD_BASIC_SENSE,
|
||||
.count = data_size,
|
||||
.cda = ptr2u32(sense_data),
|
||||
};
|
||||
Irb irb;
|
||||
|
||||
senseCcw.cmd_code = CCW_CMD_BASIC_SENSE;
|
||||
senseCcw.cda = ptr2u32(sense_data);
|
||||
senseCcw.count = data_size;
|
||||
|
||||
return __do_cio(schid, ptr2u32(&senseCcw), CCW_FMT1, &irb);
|
||||
}
|
||||
|
||||
@ -314,7 +314,17 @@ static void print_irb_err(Irb *irb)
|
||||
*/
|
||||
static int __do_cio(SubChannelId schid, uint32_t ccw_addr, int fmt, Irb *irb)
|
||||
{
|
||||
CmdOrb orb = {};
|
||||
/*
|
||||
* QEMU's CIO implementation requires prefetch and 64-bit idaws. We
|
||||
* allow all paths.
|
||||
*/
|
||||
CmdOrb orb = {
|
||||
.fmt = fmt,
|
||||
.pfch = 1,
|
||||
.c64 = 1,
|
||||
.lpm = 0xFF,
|
||||
.cpa = ccw_addr,
|
||||
};
|
||||
int rc;
|
||||
|
||||
IPL_assert(fmt == 0 || fmt == 1, "Invalid ccw format");
|
||||
@ -324,12 +334,6 @@ static int __do_cio(SubChannelId schid, uint32_t ccw_addr, int fmt, Irb *irb)
|
||||
IPL_assert(ccw_addr <= 0xFFFFFF - 8, "Invalid ccw address");
|
||||
}
|
||||
|
||||
orb.fmt = fmt;
|
||||
orb.pfch = 1; /* QEMU's cio implementation requires prefetch */
|
||||
orb.c64 = 1; /* QEMU's cio implementation requires 64-bit idaws */
|
||||
orb.lpm = 0xFF; /* All paths allowed */
|
||||
orb.cpa = ccw_addr;
|
||||
|
||||
rc = ssch(schid, &orb);
|
||||
if (rc == 1 || rc == 2) {
|
||||
/* Subchannel status pending or busy. Eat status and ask for retry. */
|
||||
|
@ -122,12 +122,17 @@ typedef struct schib {
|
||||
} __attribute__ ((packed, aligned(4))) Schib;
|
||||
|
||||
typedef struct subchannel_id {
|
||||
__u32 cssid:8;
|
||||
__u32:4;
|
||||
__u32 m:1;
|
||||
__u32 ssid:2;
|
||||
__u32 one:1;
|
||||
__u32 sch_no:16;
|
||||
union {
|
||||
struct {
|
||||
__u16 cssid:8;
|
||||
__u16 reserved:4;
|
||||
__u16 m:1;
|
||||
__u16 ssid:2;
|
||||
__u16 one:1;
|
||||
};
|
||||
__u16 sch_id;
|
||||
};
|
||||
__u16 sch_no;
|
||||
} __attribute__ ((packed, aligned(4))) SubChannelId;
|
||||
|
||||
struct chsc_header {
|
||||
|
@ -14,11 +14,12 @@
|
||||
#define S390_CCW_HELPER_H
|
||||
|
||||
#include "s390-ccw.h"
|
||||
#include "s390-time.h"
|
||||
|
||||
/* Avoids compiler warnings when casting a pointer to a u32 */
|
||||
static inline uint32_t ptr2u32(void *ptr)
|
||||
{
|
||||
IPL_assert((uint64_t)ptr <= 0xffffffff, "ptr2u32: ptr too large");
|
||||
IPL_assert((uint64_t)ptr <= 0xffffffffull, "ptr2u32: ptr too large");
|
||||
return (uint32_t)(uint64_t)ptr;
|
||||
}
|
||||
|
||||
@ -28,4 +29,20 @@ static inline void *u32toptr(uint32_t n)
|
||||
return (void *)(uint64_t)n;
|
||||
}
|
||||
|
||||
static inline void yield(void)
|
||||
{
|
||||
asm volatile ("diag 0,0,0x44"
|
||||
: :
|
||||
: "memory", "cc");
|
||||
}
|
||||
|
||||
static inline void sleep(unsigned int seconds)
|
||||
{
|
||||
ulong target = get_time_seconds() + seconds;
|
||||
|
||||
while (get_time_seconds() < target) {
|
||||
yield();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -8,12 +8,10 @@
|
||||
|
||||
#include "libc.h"
|
||||
#include "s390-ccw.h"
|
||||
#include "s390-arch.h"
|
||||
|
||||
#define KERN_IMAGE_START 0x010000UL
|
||||
#define PSW_MASK_64 0x0000000100000000ULL
|
||||
#define PSW_MASK_32 0x0000000080000000ULL
|
||||
#define PSW_MASK_SHORTPSW 0x0008000000000000ULL
|
||||
#define RESET_PSW_MASK (PSW_MASK_SHORTPSW | PSW_MASK_32 | PSW_MASK_64)
|
||||
#define RESET_PSW_MASK (PSW_MASK_SHORTPSW | PSW_MASK_64)
|
||||
|
||||
typedef struct ResetInfo {
|
||||
uint64_t ipl_psw;
|
||||
@ -54,7 +52,7 @@ void jump_to_IPL_code(uint64_t address)
|
||||
|
||||
current->ipl_psw = (uint64_t) &jump_to_IPL_2;
|
||||
current->ipl_psw |= RESET_PSW_MASK;
|
||||
current->ipl_continue = address & 0x7fffffff;
|
||||
current->ipl_continue = address & PSW_MASK_SHORT_ADDR;
|
||||
|
||||
debug_print_int("set IPL addr to", current->ipl_continue);
|
||||
|
||||
@ -86,7 +84,7 @@ void jump_to_low_kernel(void)
|
||||
|
||||
/* Trying to get PSW at zero address */
|
||||
if (*((uint64_t *)0) & RESET_PSW_MASK) {
|
||||
jump_to_IPL_code((*((uint64_t *)0)) & 0x7fffffff);
|
||||
jump_to_IPL_code((*((uint64_t *)0)) & PSW_MASK_SHORT_ADDR);
|
||||
}
|
||||
|
||||
/* No other option left, so use the Linux kernel start address */
|
||||
|
@ -36,11 +36,9 @@ LowCore *lowcore; /* Yes, this *is* a pointer to address 0 */
|
||||
*/
|
||||
void write_subsystem_identification(void)
|
||||
{
|
||||
SubChannelId *schid = (SubChannelId *) 184;
|
||||
uint32_t *zeroes = (uint32_t *) 188;
|
||||
|
||||
*schid = blk_schid;
|
||||
*zeroes = 0;
|
||||
lowcore->subchannel_id = blk_schid.sch_id;
|
||||
lowcore->subchannel_nr = blk_schid.sch_no;
|
||||
lowcore->io_int_parm = 0;
|
||||
}
|
||||
|
||||
void write_iplb_location(void)
|
||||
@ -48,13 +46,6 @@ void write_iplb_location(void)
|
||||
lowcore->ptr_iplb = ptr2u32(&iplb);
|
||||
}
|
||||
|
||||
void panic(const char *string)
|
||||
{
|
||||
sclp_print(string);
|
||||
disabled_wait();
|
||||
while (1) { }
|
||||
}
|
||||
|
||||
unsigned int get_loadparm_index(void)
|
||||
{
|
||||
return atoui(loadparm_str);
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "libc.h"
|
||||
#include "s390-ccw.h"
|
||||
#include "sclp.h"
|
||||
#include "s390-time.h"
|
||||
|
||||
#define KEYCODE_NO_INP '\0'
|
||||
#define KEYCODE_ESCAPE '\033'
|
||||
|
@ -1,8 +1,7 @@
|
||||
|
||||
SLOF_DIR := $(SRC_PATH)/roms/SLOF
|
||||
|
||||
NETOBJS := start.o sclp.o cio.o virtio.o virtio-net.o jump2ipl.o netmain.o \
|
||||
libnet.a libc.a
|
||||
NETOBJS := start.o sclp.o cio.o virtio.o virtio-net.o jump2ipl.o netmain.o
|
||||
|
||||
LIBC_INC := -nostdinc -I$(SLOF_DIR)/lib/libc/include
|
||||
LIBNET_INC := -I$(SLOF_DIR)/lib/libnet
|
||||
@ -11,15 +10,16 @@ NETLDFLAGS := $(LDFLAGS) -Ttext=0x7800000
|
||||
|
||||
$(NETOBJS): QEMU_CFLAGS += $(LIBC_INC) $(LIBNET_INC)
|
||||
|
||||
s390-netboot.elf: $(NETOBJS)
|
||||
$(call quiet-command,$(CC) $(NETLDFLAGS) -o $@ $(NETOBJS),"BUILD","$(TARGET_DIR)$@")
|
||||
s390-netboot.elf: $(NETOBJS) libnet.a libc.a
|
||||
$(call quiet-command,$(CC) $(NETLDFLAGS) -o $@ $^,"BUILD","$(TARGET_DIR)$@")
|
||||
|
||||
s390-netboot.img: s390-netboot.elf
|
||||
$(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,"STRIP","$(TARGET_DIR)$@")
|
||||
|
||||
# libc files:
|
||||
|
||||
LIBC_CFLAGS := $(QEMU_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC)
|
||||
LIBC_CFLAGS = $(QEMU_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \
|
||||
-MMD -MP -MT $@ -MF $(@:%.o=%.d)
|
||||
|
||||
CTYPE_OBJS = isdigit.o isxdigit.o toupper.o
|
||||
%.o : $(SLOF_DIR)/lib/libc/ctype/%.c
|
||||
@ -52,7 +52,8 @@ libc.a: $(LIBCOBJS)
|
||||
|
||||
LIBNETOBJS := args.o dhcp.o dns.o icmpv6.o ipv6.o tcp.o udp.o bootp.o \
|
||||
dhcpv6.o ethernet.o ipv4.o ndp.o tftp.o pxelinux.o
|
||||
LIBNETCFLAGS := $(QEMU_CFLAGS) $(CFLAGS) -DDHCPARCH=0x1F $(LIBC_INC) $(LIBNET_INC)
|
||||
LIBNETCFLAGS = $(QEMU_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \
|
||||
-DDHCPARCH=0x1F -MMD -MP -MT $@ -MF $(@:%.o=%.d)
|
||||
|
||||
%.o : $(SLOF_DIR)/lib/libnet/%.c
|
||||
$(call quiet-command,$(CC) $(LIBNETCFLAGS) -c -o $@ $<,"CC","$(TARGET_DIR)$@")
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "s390-ccw.h"
|
||||
#include "cio.h"
|
||||
#include "virtio.h"
|
||||
#include "s390-time.h"
|
||||
|
||||
#define DEFAULT_BOOT_RETRIES 10
|
||||
#define DEFAULT_TFTP_RETRIES 20
|
||||
@ -57,24 +58,14 @@ static SubChannelId net_schid = { .one = 1 };
|
||||
static uint8_t mac[6];
|
||||
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 incremented each microsecond */
|
||||
return (clk >> (63 - 51)) / 1000;
|
||||
}
|
||||
|
||||
void set_timer(int val)
|
||||
{
|
||||
dest_timer = get_timer_ms() + val;
|
||||
dest_timer = get_time_ms() + val;
|
||||
}
|
||||
|
||||
int get_timer(void)
|
||||
{
|
||||
return dest_timer - get_timer_ms();
|
||||
return dest_timer - get_time_ms();
|
||||
}
|
||||
|
||||
int get_sec_ticks(void)
|
||||
@ -448,14 +439,6 @@ static int net_try_direct_tftp_load(filename_ip_t *fn_ip)
|
||||
return rc;
|
||||
}
|
||||
|
||||
void panic(const char *string)
|
||||
{
|
||||
sclp_print(string);
|
||||
for (;;) {
|
||||
disabled_wait();
|
||||
}
|
||||
}
|
||||
|
||||
void write_subsystem_identification(void)
|
||||
{
|
||||
SubChannelId *schid = (SubChannelId *) 184;
|
||||
|
@ -26,10 +26,12 @@ _Static_assert(sizeof(struct PSWLegacy) == 8, "PSWLegacy size incorrect");
|
||||
|
||||
/* s390 psw bit masks */
|
||||
#define PSW_MASK_IOINT 0x0200000000000000ULL
|
||||
#define PSW_MASK_SHORTPSW 0x0008000000000000ULL
|
||||
#define PSW_MASK_WAIT 0x0002000000000000ULL
|
||||
#define PSW_MASK_EAMODE 0x0000000100000000ULL
|
||||
#define PSW_MASK_BAMODE 0x0000000080000000ULL
|
||||
#define PSW_MASK_ZMODE (PSW_MASK_EAMODE | PSW_MASK_BAMODE)
|
||||
#define PSW_MASK_SHORT_ADDR 0x000000007fffffffULL
|
||||
#define PSW_MASK_64 (PSW_MASK_EAMODE | PSW_MASK_BAMODE)
|
||||
|
||||
/* Low core mapping */
|
||||
typedef struct LowCore {
|
||||
|
@ -50,12 +50,11 @@ typedef unsigned long long __u64;
|
||||
#include "iplb.h"
|
||||
|
||||
/* start.s */
|
||||
void disabled_wait(void);
|
||||
void disabled_wait(void) __attribute__ ((__noreturn__));
|
||||
void consume_sclp_int(void);
|
||||
void consume_io_int(void);
|
||||
|
||||
/* main.c */
|
||||
void panic(const char *string);
|
||||
void write_subsystem_identification(void);
|
||||
void write_iplb_location(void);
|
||||
extern char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE)));
|
||||
@ -74,8 +73,6 @@ unsigned long virtio_load_direct(ulong rec_list1, ulong rec_list2,
|
||||
bool virtio_is_supported(SubChannelId schid);
|
||||
void virtio_blk_setup_device(SubChannelId schid);
|
||||
int virtio_read(ulong sector, void *load_addr);
|
||||
u64 get_clock(void);
|
||||
ulong get_second(void);
|
||||
|
||||
/* bootmap.c */
|
||||
void zipl_load(void);
|
||||
@ -93,6 +90,12 @@ bool menu_is_enabled_enum(void);
|
||||
|
||||
#define MAX_BOOT_ENTRIES 31
|
||||
|
||||
static inline void panic(const char *string)
|
||||
{
|
||||
sclp_print(string);
|
||||
disabled_wait();
|
||||
}
|
||||
|
||||
static inline void fill_hex(char *out, unsigned char val)
|
||||
{
|
||||
const char hex[] = "0123456789abcdef";
|
||||
@ -144,24 +147,8 @@ static inline void debug_print_addr(const char *desc, void *p)
|
||||
#define KVM_S390_VIRTIO_SET_STATUS 2
|
||||
#define KVM_S390_VIRTIO_CCW_NOTIFY 3
|
||||
|
||||
static inline void yield(void)
|
||||
{
|
||||
asm volatile ("diag 0,0,0x44"
|
||||
: :
|
||||
: "memory", "cc");
|
||||
}
|
||||
|
||||
#define MAX_SECTOR_SIZE 4096
|
||||
|
||||
static inline void sleep(unsigned int seconds)
|
||||
{
|
||||
ulong target = get_second() + seconds;
|
||||
|
||||
while (get_second() < target) {
|
||||
yield();
|
||||
}
|
||||
}
|
||||
|
||||
static inline void IPL_assert(bool term, const char *message)
|
||||
{
|
||||
if (!term) {
|
||||
|
23
pc-bios/s390-ccw/s390-time.h
Normal file
23
pc-bios/s390-ccw/s390-time.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef TIME_H
|
||||
#define TIME_H
|
||||
|
||||
static inline u64 get_clock(void)
|
||||
{
|
||||
u64 r;
|
||||
|
||||
asm volatile("stck %0" : "=Q" (r) : : "cc");
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline u64 get_time_ms(void)
|
||||
{
|
||||
/* Bit 51 is incremented each microsecond */
|
||||
return (get_clock() >> 12) / 1000;
|
||||
}
|
||||
|
||||
static inline u64 get_time_seconds(void)
|
||||
{
|
||||
return get_time_ms() / 1000;
|
||||
}
|
||||
|
||||
#endif
|
@ -47,8 +47,9 @@ memsetxc:
|
||||
*/
|
||||
.globl disabled_wait
|
||||
disabled_wait:
|
||||
larl %r1,disabled_wait_psw
|
||||
lpswe 0(%r1)
|
||||
larl %r1,disabled_wait_psw
|
||||
lpswe 0(%r1)
|
||||
1: j 1b
|
||||
|
||||
|
||||
/*
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include <ethernet.h>
|
||||
#include "s390-ccw.h"
|
||||
#include "virtio.h"
|
||||
#include "s390-time.h"
|
||||
#include "helper.h"
|
||||
|
||||
#ifndef DEBUG_VIRTIO_NET
|
||||
#define DEBUG_VIRTIO_NET 0
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include "virtio.h"
|
||||
#include "scsi.h"
|
||||
#include "virtio-scsi.h"
|
||||
#include "s390-time.h"
|
||||
#include "helper.h"
|
||||
|
||||
static ScsiDevice default_scsi_device;
|
||||
static VirtioScsiCmdReq req;
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "virtio-scsi.h"
|
||||
#include "bswap.h"
|
||||
#include "helper.h"
|
||||
#include "s390-time.h"
|
||||
|
||||
#define VRING_WAIT_REPLY_TIMEOUT 30
|
||||
|
||||
@ -157,19 +158,6 @@ void vring_send_buf(VRing *vr, void *p, int len, int flags)
|
||||
}
|
||||
}
|
||||
|
||||
u64 get_clock(void)
|
||||
{
|
||||
u64 r;
|
||||
|
||||
asm volatile("stck %0" : "=Q" (r) : : "cc");
|
||||
return r;
|
||||
}
|
||||
|
||||
ulong get_second(void)
|
||||
{
|
||||
return (get_clock() >> 12) / 1000000;
|
||||
}
|
||||
|
||||
int vr_poll(VRing *vr)
|
||||
{
|
||||
if (vr->used->idx == vr->used_idx) {
|
||||
@ -194,7 +182,7 @@ int vr_poll(VRing *vr)
|
||||
*/
|
||||
int vring_wait_reply(void)
|
||||
{
|
||||
ulong target_second = get_second() + vdev.wait_reply_timeout;
|
||||
ulong target_second = get_time_seconds() + vdev.wait_reply_timeout;
|
||||
|
||||
/* Wait for any queue to be updated by the host */
|
||||
do {
|
||||
@ -207,7 +195,7 @@ int vring_wait_reply(void)
|
||||
if (r) {
|
||||
return 0;
|
||||
}
|
||||
} while (!vdev.wait_reply_timeout || (get_second() < target_second));
|
||||
} while (!vdev.wait_reply_timeout || (get_time_seconds() < target_second));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Binary file not shown.
@ -798,7 +798,7 @@
|
||||
/* SQUARE ROOT */
|
||||
F(0xb314, SQEBR, RRE, Z, 0, e2, new, e1, sqeb, 0, IF_BFP)
|
||||
F(0xb315, SQDBR, RRE, Z, 0, f2, new, f1, sqdb, 0, IF_BFP)
|
||||
F(0xb316, SQXBR, RRE, Z, x2h, x2l, new, x1, sqxb, 0, IF_BFP)
|
||||
F(0xb316, SQXBR, RRE, Z, x2h, x2l, new_P, x1, sqxb, 0, IF_BFP)
|
||||
F(0xed14, SQEB, RXE, Z, 0, m2_32u, new, e1, sqeb, 0, IF_BFP)
|
||||
F(0xed15, SQDB, RXE, Z, 0, m2_64, new, f1, sqdb, 0, IF_BFP)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user