From 00359bf9234af62535f660ac2bc3e8b53d75be5b Mon Sep 17 00:00:00 2001 From: miod Date: Sat, 2 Aug 2008 13:48:09 +0000 Subject: [PATCH] Ignore the ata channel on 164SX when controller is the built-in one, when looking for the boot device; PR #5895 --- sys/arch/alpha/alpha/dec_eb164.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/sys/arch/alpha/alpha/dec_eb164.c b/sys/arch/alpha/alpha/dec_eb164.c index aa02493655a..32315c9a379 100644 --- a/sys/arch/alpha/alpha/dec_eb164.c +++ b/sys/arch/alpha/alpha/dec_eb164.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dec_eb164.c,v 1.15 2008/07/16 20:03:20 miod Exp $ */ +/* $OpenBSD: dec_eb164.c,v 1.16 2008/08/02 13:48:09 miod Exp $ */ /* $NetBSD: dec_eb164.c,v 1.33 2000/05/22 20:13:32 thorpej Exp $ */ /* @@ -250,6 +250,7 @@ dec_eb164_device_register(dev, aux) */ if (!strcmp(cd->cd_name, "wd")) { struct ata_atapi_attach *aa_link = aux; + int variation = hwrpb->rpb_variation & SV_ST_MASK; if ((strncmp("pciide", parent->dv_xname, 6) != 0)) return; @@ -260,10 +261,26 @@ dec_eb164_device_register(dev, aux) aa_link->aa_drv_data->drive, aa_link->aa_channel)); DR_VERBOSE(printf("Bootdev info: unit: %d, channel: %d\n", b->unit, b->channel)); - if (b->unit != aa_link->aa_drv_data->drive || - b->channel != aa_link->aa_channel) + if (b->unit != aa_link->aa_drv_data->drive) return; + /* + * On 164SX, the built-in IDE controller appears as + * two distinct pciide devices, both with a single + * channel. However SRM will nevertheless pretend + * the second channel is channel #1 of the second + * device, while it is really channel #0, so just + * ignore the channel number in this case. + */ + if (variation >= SV_ST_ALPHAPC164SX_400 && + variation <= SV_ST_ALPHAPC164SX_600 && + b->slot == 0 * 1000 + 2 * 100 + 8) { + /* nothing */ + } else { + if (b->channel != aa_link->aa_channel) + return; + } + /* we've found it! */ booted_device = dev; DR_VERBOSE(printf("booted_device = %s\n", dev->dv_xname)); -- 2.20.1