s390-ccw.img: Detect devices with stsch.

stsch is the canonical way to detect devices. As a bonus, we can
abort the loop if we get cc 3, and we need to check only the valid
devices (dnv set).

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
Cornelia Huck 2013-04-26 02:12:52 +00:00 committed by Alexander Graf
parent dc03640b58
commit 22d67ab55a

View file

@ -22,7 +22,7 @@ void virtio_panic(const char *string)
static void virtio_setup(void) static void virtio_setup(void)
{ {
struct irb irb; struct schib schib;
int i; int i;
int r; int r;
bool found = false; bool found = false;
@ -31,8 +31,11 @@ static void virtio_setup(void)
for (i = 0; i < 0x10000; i++) { for (i = 0; i < 0x10000; i++) {
blk_schid.sch_no = i; blk_schid.sch_no = i;
r = tsch(blk_schid, &irb); r = stsch_err(blk_schid, &schib);
if (r != 3) { if (r == 3) {
break;
}
if (schib.pmcw.dnv) {
if (virtio_is_blk(blk_schid)) { if (virtio_is_blk(blk_schid)) {
found = true; found = true;
break; break;