pc-bios/s390-ccw: make checkpatch happy
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>
This commit is contained in:
parent
ff4873cb8c
commit
abd696e4f7
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "s390-ccw.h"
|
#include "s390-ccw.h"
|
||||||
|
|
||||||
// #define DEBUG_FALLBACK
|
/* #define DEBUG_FALLBACK */
|
||||||
|
|
||||||
#ifdef DEBUG_FALLBACK
|
#ifdef DEBUG_FALLBACK
|
||||||
#define dputs(txt) \
|
#define dputs(txt) \
|
||||||
@ -47,13 +47,13 @@ struct mbr {
|
|||||||
struct scsi_blockptr blockptr;
|
struct scsi_blockptr blockptr;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
#define ZIPL_MAGIC "zIPL"
|
#define ZIPL_MAGIC "zIPL"
|
||||||
|
|
||||||
#define ZIPL_COMP_HEADER_IPL 0x00
|
#define ZIPL_COMP_HEADER_IPL 0x00
|
||||||
#define ZIPL_COMP_HEADER_DUMP 0x01
|
#define ZIPL_COMP_HEADER_DUMP 0x01
|
||||||
|
|
||||||
#define ZIPL_COMP_ENTRY_LOAD 0x02
|
#define ZIPL_COMP_ENTRY_LOAD 0x02
|
||||||
#define ZIPL_COMP_ENTRY_EXEC 0x01
|
#define ZIPL_COMP_ENTRY_EXEC 0x01
|
||||||
|
|
||||||
/* Scratch space */
|
/* Scratch space */
|
||||||
static uint8_t sec[SECTOR_SIZE] __attribute__((__aligned__(SECTOR_SIZE)));
|
static uint8_t sec[SECTOR_SIZE] __attribute__((__aligned__(SECTOR_SIZE)));
|
||||||
@ -107,8 +107,8 @@ static void jump_to_IPL_code(uint64_t address)
|
|||||||
/* Check for ZIPL magic. Returns 0 if not matched. */
|
/* Check for ZIPL magic. Returns 0 if not matched. */
|
||||||
static int zipl_magic(uint8_t *ptr)
|
static int zipl_magic(uint8_t *ptr)
|
||||||
{
|
{
|
||||||
uint32_t *p = (void*)ptr;
|
uint32_t *p = (void *)ptr;
|
||||||
uint32_t *z = (void*)ZIPL_MAGIC;
|
uint32_t *z = (void *)ZIPL_MAGIC;
|
||||||
|
|
||||||
if (*p != *z) {
|
if (*p != *z) {
|
||||||
debug_print_int("invalid magic", *p);
|
debug_print_int("invalid magic", *p);
|
||||||
@ -136,7 +136,7 @@ static inline bool unused_space(const void *p, unsigned int size)
|
|||||||
static int zipl_load_segment(struct component_entry *entry)
|
static int zipl_load_segment(struct component_entry *entry)
|
||||||
{
|
{
|
||||||
const int max_entries = (SECTOR_SIZE / sizeof(struct scsi_blockptr));
|
const int max_entries = (SECTOR_SIZE / sizeof(struct scsi_blockptr));
|
||||||
struct scsi_blockptr *bprs = (void*)sec;
|
struct scsi_blockptr *bprs = (void *)sec;
|
||||||
const int bprs_size = sizeof(sec);
|
const int bprs_size = sizeof(sec);
|
||||||
uint64_t blockno;
|
uint64_t blockno;
|
||||||
long address;
|
long address;
|
||||||
@ -156,16 +156,18 @@ static int zipl_load_segment(struct component_entry *entry)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0;; i++) {
|
for (i = 0;; i++) {
|
||||||
u64 *cur_desc = (void*)&bprs[i];
|
u64 *cur_desc = (void *)&bprs[i];
|
||||||
|
|
||||||
blockno = bprs[i].blockno;
|
blockno = bprs[i].blockno;
|
||||||
if (!blockno)
|
if (!blockno) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* we need the updated blockno for the next indirect entry in the
|
/* we need the updated blockno for the next indirect entry in the
|
||||||
chain, but don't want to advance address */
|
chain, but don't want to advance address */
|
||||||
if (i == (max_entries - 1))
|
if (i == (max_entries - 1)) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (bprs[i].blockct == 0 && unused_space(&bprs[i + 1],
|
if (bprs[i].blockct == 0 && unused_space(&bprs[i + 1],
|
||||||
sizeof(struct scsi_blockptr))) {
|
sizeof(struct scsi_blockptr))) {
|
||||||
@ -178,9 +180,10 @@ static int zipl_load_segment(struct component_entry *entry)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
address = virtio_load_direct(cur_desc[0], cur_desc[1], 0,
|
address = virtio_load_direct(cur_desc[0], cur_desc[1], 0,
|
||||||
(void*)address);
|
(void *)address);
|
||||||
if (address == -1)
|
if (address == -1) {
|
||||||
goto fail;
|
goto fail;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} while (blockno);
|
} while (blockno);
|
||||||
|
|
||||||
@ -220,7 +223,7 @@ static int zipl_run(struct scsi_blockptr *pte)
|
|||||||
|
|
||||||
entry++;
|
entry++;
|
||||||
|
|
||||||
if ((uint8_t*)(&entry[1]) > (tmp_sec + SECTOR_SIZE)) {
|
if ((uint8_t *)(&entry[1]) > (tmp_sec + SECTOR_SIZE)) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,7 +244,7 @@ fail:
|
|||||||
|
|
||||||
int zipl_load(void)
|
int zipl_load(void)
|
||||||
{
|
{
|
||||||
struct mbr *mbr = (void*)sec;
|
struct mbr *mbr = (void *)sec;
|
||||||
uint8_t *ns, *ns_end;
|
uint8_t *ns, *ns_end;
|
||||||
int program_table_entries = 0;
|
int program_table_entries = 0;
|
||||||
int pte_len = sizeof(struct scsi_blockptr);
|
int pte_len = sizeof(struct scsi_blockptr);
|
||||||
@ -249,7 +252,7 @@ int zipl_load(void)
|
|||||||
const char *error = "";
|
const char *error = "";
|
||||||
|
|
||||||
/* Grab the MBR */
|
/* Grab the MBR */
|
||||||
virtio_read(0, (void*)mbr);
|
virtio_read(0, (void *)mbr);
|
||||||
|
|
||||||
dputs("checking magic\n");
|
dputs("checking magic\n");
|
||||||
|
|
||||||
|
@ -34,10 +34,10 @@ typedef unsigned long long __u64;
|
|||||||
#define PAGE_SIZE 4096
|
#define PAGE_SIZE 4096
|
||||||
|
|
||||||
#ifndef EIO
|
#ifndef EIO
|
||||||
#define EIO 1
|
#define EIO 1
|
||||||
#endif
|
#endif
|
||||||
#ifndef EBUSY
|
#ifndef EBUSY
|
||||||
#define EBUSY 2
|
#define EBUSY 2
|
||||||
#endif
|
#endif
|
||||||
#ifndef NULL
|
#ifndef NULL
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
@ -57,7 +57,7 @@ void sclp_setup(void);
|
|||||||
|
|
||||||
/* virtio.c */
|
/* virtio.c */
|
||||||
unsigned long virtio_load_direct(ulong rec_list1, ulong rec_list2,
|
unsigned long virtio_load_direct(ulong rec_list1, ulong rec_list2,
|
||||||
ulong subchan_id, void *load_addr);
|
ulong subchan_id, void *load_addr);
|
||||||
bool virtio_is_blk(struct subchannel_id schid);
|
bool virtio_is_blk(struct subchannel_id schid);
|
||||||
void virtio_setup_block(struct subchannel_id schid);
|
void virtio_setup_block(struct subchannel_id schid);
|
||||||
int virtio_read(ulong sector, void *load_addr);
|
int virtio_read(ulong sector, void *load_addr);
|
||||||
@ -88,7 +88,7 @@ static inline void fill_hex(char *out, unsigned char val)
|
|||||||
|
|
||||||
static inline void print_int(const char *desc, u64 addr)
|
static inline void print_int(const char *desc, u64 addr)
|
||||||
{
|
{
|
||||||
unsigned char *addr_c = (unsigned char*)&addr;
|
unsigned char *addr_c = (unsigned char *)&addr;
|
||||||
char out[] = ": 0xffffffffffffffff\n";
|
char out[] = ": 0xffffffffffffffff\n";
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
@ -118,16 +118,16 @@ static inline void debug_print_addr(const char *desc, void *p)
|
|||||||
* Hypercall functions *
|
* Hypercall functions *
|
||||||
***********************************************/
|
***********************************************/
|
||||||
|
|
||||||
#define KVM_S390_VIRTIO_NOTIFY 0
|
#define KVM_S390_VIRTIO_NOTIFY 0
|
||||||
#define KVM_S390_VIRTIO_RESET 1
|
#define KVM_S390_VIRTIO_RESET 1
|
||||||
#define KVM_S390_VIRTIO_SET_STATUS 2
|
#define KVM_S390_VIRTIO_SET_STATUS 2
|
||||||
#define KVM_S390_VIRTIO_CCW_NOTIFY 3
|
#define KVM_S390_VIRTIO_CCW_NOTIFY 3
|
||||||
|
|
||||||
static inline void yield(void)
|
static inline void yield(void)
|
||||||
{
|
{
|
||||||
asm volatile ("diag 0,0,0x44"
|
asm volatile ("diag 0,0,0x44"
|
||||||
: :
|
: :
|
||||||
: "memory", "cc");
|
: "memory", "cc");
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SECTOR_SIZE 512
|
#define SECTOR_SIZE 512
|
||||||
|
@ -33,7 +33,7 @@ static int sclp_service_call(unsigned int command, void *sccb)
|
|||||||
|
|
||||||
static void sclp_set_write_mask(void)
|
static void sclp_set_write_mask(void)
|
||||||
{
|
{
|
||||||
WriteEventMask *sccb = (void*)_sccb;
|
WriteEventMask *sccb = (void *)_sccb;
|
||||||
|
|
||||||
sccb->h.length = sizeof(WriteEventMask);
|
sccb->h.length = sizeof(WriteEventMask);
|
||||||
sccb->mask_length = sizeof(unsigned int);
|
sccb->mask_length = sizeof(unsigned int);
|
||||||
@ -68,7 +68,7 @@ static void _memcpy(char *dest, const char *src, int len)
|
|||||||
void sclp_print(const char *str)
|
void sclp_print(const char *str)
|
||||||
{
|
{
|
||||||
int len = _strlen(str);
|
int len = _strlen(str);
|
||||||
WriteEventData *sccb = (void*)_sccb;
|
WriteEventData *sccb = (void *)_sccb;
|
||||||
|
|
||||||
sccb->h.length = sizeof(WriteEventData) + len;
|
sccb->h.length = sizeof(WriteEventData) + len;
|
||||||
sccb->h.function_code = SCLP_FC_NORMAL_WRITE;
|
sccb->h.function_code = SCLP_FC_NORMAL_WRITE;
|
||||||
|
@ -18,22 +18,22 @@ static char chsc_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
|
|||||||
static long kvm_hypercall(unsigned long nr, unsigned long param1,
|
static long kvm_hypercall(unsigned long nr, unsigned long param1,
|
||||||
unsigned long param2)
|
unsigned long param2)
|
||||||
{
|
{
|
||||||
register ulong r_nr asm("1") = nr;
|
register ulong r_nr asm("1") = nr;
|
||||||
register ulong r_param1 asm("2") = param1;
|
register ulong r_param1 asm("2") = param1;
|
||||||
register ulong r_param2 asm("3") = param2;
|
register ulong r_param2 asm("3") = param2;
|
||||||
register long retval asm("2");
|
register long retval asm("2");
|
||||||
|
|
||||||
asm volatile ("diag 2,4,0x500"
|
asm volatile ("diag 2,4,0x500"
|
||||||
: "=d" (retval)
|
: "=d" (retval)
|
||||||
: "d" (r_nr), "0" (r_param1), "r"(r_param2)
|
: "d" (r_nr), "0" (r_param1), "r"(r_param2)
|
||||||
: "memory", "cc");
|
: "memory", "cc");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void virtio_notify(struct subchannel_id schid)
|
static void virtio_notify(struct subchannel_id schid)
|
||||||
{
|
{
|
||||||
kvm_hypercall(KVM_S390_VIRTIO_CCW_NOTIFY, *(u32*)&schid, 0);
|
kvm_hypercall(KVM_S390_VIRTIO_CCW_NOTIFY, *(u32 *)&schid, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************
|
/***********************************************
|
||||||
@ -236,7 +236,7 @@ static int virtio_read_many(ulong sector, void *load_addr, int sec_num)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned long virtio_load_direct(ulong rec_list1, ulong rec_list2,
|
unsigned long virtio_load_direct(ulong rec_list1, ulong rec_list2,
|
||||||
ulong subchan_id, void *load_addr)
|
ulong subchan_id, void *load_addr)
|
||||||
{
|
{
|
||||||
u8 status;
|
u8 status;
|
||||||
int sec = rec_list1;
|
int sec = rec_list1;
|
||||||
@ -249,7 +249,7 @@ unsigned long virtio_load_direct(ulong rec_list1, ulong rec_list2,
|
|||||||
}
|
}
|
||||||
|
|
||||||
sclp_print(".");
|
sclp_print(".");
|
||||||
status = virtio_read_many(sec, (void*)addr, sec_num);
|
status = virtio_read_many(sec, (void *)addr, sec_num);
|
||||||
if (status) {
|
if (status) {
|
||||||
virtio_panic("I/O Error");
|
virtio_panic("I/O Error");
|
||||||
}
|
}
|
||||||
@ -274,7 +274,7 @@ void virtio_setup_block(struct subchannel_id schid)
|
|||||||
if (run_ccw(schid, CCW_CMD_READ_VQ_CONF, &config, sizeof(config))) {
|
if (run_ccw(schid, CCW_CMD_READ_VQ_CONF, &config, sizeof(config))) {
|
||||||
virtio_panic("Could not get block device configuration\n");
|
virtio_panic("Could not get block device configuration\n");
|
||||||
}
|
}
|
||||||
vring_init(&block, config.num, (void*)(100 * 1024 * 1024),
|
vring_init(&block, config.num, (void *)(100 * 1024 * 1024),
|
||||||
KVM_S390_VIRTIO_RING_ALIGN);
|
KVM_S390_VIRTIO_RING_ALIGN);
|
||||||
|
|
||||||
info.queue = (100ULL * 1024ULL* 1024ULL);
|
info.queue = (100ULL * 1024ULL* 1024ULL);
|
||||||
|
@ -66,7 +66,7 @@ struct virtio_dev {
|
|||||||
char *config;
|
char *config;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define KVM_S390_VIRTIO_RING_ALIGN 4096
|
#define KVM_S390_VIRTIO_RING_ALIGN 4096
|
||||||
|
|
||||||
#define VRING_USED_F_NO_NOTIFY 1
|
#define VRING_USED_F_NO_NOTIFY 1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user