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 <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
static void virtio_setup(void)
{
- struct irb irb;
+ struct schib schib;
int i;
int r;
bool found = false;
for (i = 0; i < 0x10000; i++) {
blk_schid.sch_no = i;
- r = tsch(blk_schid, &irb);
- if (r != 3) {
+ r = stsch_err(blk_schid, &schib);
+ if (r == 3) {
+ break;
+ }
+ if (schib.pmcw.dnv) {
if (virtio_is_blk(blk_schid)) {
found = true;
break;