Skip to content

Commit e6d393d

Browse files
frankjaahuth
authored andcommitted
pc-bios: s390x: Get rid of magic offsets into the lowcore
If we have a lowcore struct that has members for offsets that we want to touch, why not use it? Signed-off-by: Janosch Frank <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Reviewed-by: Thomas Huth <[email protected]> Reviewed-by: Cornelia Huck <[email protected]> Message-Id: <[email protected]> Signed-off-by: Thomas Huth <[email protected]>
1 parent 12ea90d commit e6d393d

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

pc-bios/s390-ccw/cio.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,17 @@ typedef struct schib {
122122
} __attribute__ ((packed, aligned(4))) Schib;
123123

124124
typedef struct subchannel_id {
125-
__u32 cssid:8;
126-
__u32:4;
127-
__u32 m:1;
128-
__u32 ssid:2;
129-
__u32 one:1;
130-
__u32 sch_no:16;
125+
union {
126+
struct {
127+
__u16 cssid:8;
128+
__u16 reserved:4;
129+
__u16 m:1;
130+
__u16 ssid:2;
131+
__u16 one:1;
132+
};
133+
__u16 sch_id;
134+
};
135+
__u16 sch_no;
131136
} __attribute__ ((packed, aligned(4))) SubChannelId;
132137

133138
struct chsc_header {

pc-bios/s390-ccw/main.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@ LowCore *lowcore; /* Yes, this *is* a pointer to address 0 */
3636
*/
3737
void write_subsystem_identification(void)
3838
{
39-
SubChannelId *schid = (SubChannelId *) 184;
40-
uint32_t *zeroes = (uint32_t *) 188;
41-
42-
*schid = blk_schid;
43-
*zeroes = 0;
39+
lowcore->subchannel_id = blk_schid.sch_id;
40+
lowcore->subchannel_nr = blk_schid.sch_no;
41+
lowcore->io_int_parm = 0;
4442
}
4543

4644
void write_iplb_location(void)

0 commit comments

Comments
 (0)