summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrehan <grehan@FreeBSD.org>2014-07-15 00:27:08 +0000
committergrehan <grehan@FreeBSD.org>2014-07-15 00:27:08 +0000
commitbffc595f8bca1eef4ad7ab4cc2ff8388e4e96330 (patch)
treedd5f0a3a4f8b6ff4f4455de616c99d9583bd0710
parent4632b82c93114a279b2c7c3e219eed0eb566ddb7 (diff)
downloadFreeBSD-src-bffc595f8bca1eef4ad7ab4cc2ff8388e4e96330.zip
FreeBSD-src-bffc595f8bca1eef4ad7ab4cc2ff8388e4e96330.tar.gz
Use the blockif CHS routine to create fake CHS values,
and then populate them in the identity page. This fixes a divide-by-zero error at probe time with NetBSD. MFC after: 1 week.
-rw-r--r--usr.sbin/bhyve/pci_ahci.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/usr.sbin/bhyve/pci_ahci.c b/usr.sbin/bhyve/pci_ahci.c
index 9f61107..52724bb 100644
--- a/usr.sbin/bhyve/pci_ahci.c
+++ b/usr.sbin/bhyve/pci_ahci.c
@@ -598,10 +598,16 @@ handle_identify(struct ahci_port *p, int slot, uint8_t *cfis)
} else {
uint16_t buf[256];
uint64_t sectors;
+ uint16_t cyl;
+ uint8_t sech, heads;
sectors = blockif_size(p->bctx) / blockif_sectsz(p->bctx);
+ blockif_chs(p->bctx, &cyl, &heads, &sech);
memset(buf, 0, sizeof(buf));
buf[0] = 0x0040;
+ buf[1] = cyl;
+ buf[3] = heads;
+ buf[6] = sech;
/* TODO emulate different serial? */
ata_string((uint8_t *)(buf+10), "123456", 20);
ata_string((uint8_t *)(buf+23), "001", 8);
OpenPOWER on IntegriCloud