diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index 59c1a265e1cf..d77f91f4d4b1 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -377,7 +377,9 @@ aac_get_container_info(struct aac_softc *sc, struct aac_fib *fib, int cid) struct aac_mntinfo *mi; mi = (struct aac_mntinfo *)&fib->data[0]; - mi->Command = VM_NameServe; + /* use 64-bit LBA if enabled */ + mi->Command = (sc->flags & AAC_FLAGS_LBA_64BIT) ? + VM_NameServe64 : VM_NameServe; mi->MntType = FT_FILESYS; mi->MntCount = cid; @@ -1802,6 +1804,11 @@ aac_check_firmware(struct aac_softc *sc) sc->flags |= AAC_FLAGS_RAW_IO; device_printf(sc->aac_dev, "Enable Raw I/O\n"); } + if ((sc->flags & AAC_FLAGS_RAW_IO) && + (sc->flags & AAC_FLAGS_ARRAY_64BIT)) { + sc->flags |= AAC_FLAGS_LBA_64BIT; + device_printf(sc->aac_dev, "Enable 64-bit array\n"); + } return (0); } diff --git a/sys/dev/aac/aac_disk.c b/sys/dev/aac/aac_disk.c index 24b0771971b7..6568a0d35be8 100644 --- a/sys/dev/aac/aac_disk.c +++ b/sys/dev/aac/aac_disk.c @@ -343,6 +343,9 @@ aac_disk_attach(device_t dev) * disk! */ sc->ad_size = sc->ad_container->co_mntobj.Capacity; + if (sc->ad_controller->flags & AAC_FLAGS_LBA_64BIT) + sc->ad_size += (u_int64_t) + sc->ad_container->co_mntobj.CapacityHigh << 32; if (sc->ad_size >= (2 * 1024 * 1024)) { /* 2GB */ sc->ad_heads = 255; sc->ad_sectors = 63; @@ -355,9 +358,9 @@ aac_disk_attach(device_t dev) } sc->ad_cylinders = (sc->ad_size / (sc->ad_heads * sc->ad_sectors)); - device_printf(dev, "%uMB (%u sectors)\n", - sc->ad_size / ((1024 * 1024) / AAC_BLOCK_SIZE), - sc->ad_size); + device_printf(dev, "%juMB (%ju sectors)\n", + (intmax_t)sc->ad_size / ((1024 * 1024) / AAC_BLOCK_SIZE), + (intmax_t)sc->ad_size); /* attach a generic disk device to ourselves */ sc->unit = device_get_unit(dev); diff --git a/sys/dev/aac/aacreg.h b/sys/dev/aac/aacreg.h index dae21a48b5cf..5221bb26d7f7 100644 --- a/sys/dev/aac/aacreg.h +++ b/sys/dev/aac/aacreg.h @@ -1140,6 +1140,7 @@ struct aac_mntobj { u_int32_t pad[8]; } ObjExtension; u_int32_t AlterEgoId; + u_int32_t CapacityHigh; } __packed; struct aac_mntinfo { diff --git a/sys/dev/aac/aacvar.h b/sys/dev/aac/aacvar.h index c39d7c95d219..2b204723f88e 100644 --- a/sys/dev/aac/aacvar.h +++ b/sys/dev/aac/aacvar.h @@ -133,7 +133,7 @@ struct aac_disk int ad_cylinders; int ad_heads; int ad_sectors; - u_int32_t ad_size; + u_int64_t ad_size; int unit; }; @@ -392,6 +392,7 @@ struct aac_softc #define AAC_FLAGS_NEW_COMM (1 << 11) /* New comm. interface supported */ #define AAC_FLAGS_RAW_IO (1 << 12) /* Raw I/O interface */ #define AAC_FLAGS_ARRAY_64BIT (1 << 13) /* 64-bit array size */ +#define AAC_FLAGS_LBA_64BIT (1 << 14) /* 64-bit LBA support */ u_int32_t supported_options; u_int32_t scsi_method_id;