Index: trunk/src/os2ahci/Makefile
===================================================================
--- trunk/src/os2ahci/Makefile	(revision 161)
+++ trunk/src/os2ahci/Makefile	(revision 162)
@@ -32,5 +32,5 @@
 BLD_MINOR=28 # must be 2 digits
 BLD_REV=0 # not used at this time
-FIXPACK=Test Build
+FIXPACK=
 
 !ifndef %WATCOM # if not defined in the environment
Index: trunk/src/os2ahci/README
===================================================================
--- trunk/src/os2ahci/README	(revision 161)
+++ trunk/src/os2ahci/README	(revision 162)
@@ -382,9 +382,12 @@
 ==========
 
-v.1.28 30-May-2013 - David Azarewicz
+v.1.28 01-Jun-2013 - David Azarewicz
   Reworked trap dump kernel exit
   Removed unused IDC entry point.
-  Some work on suspend/resume routines.
+  Reworked suspend/resume routines.
+  Implemented a temporary hack to make resume work reasonably well.
   Suspend/resume is only supported on eCS systems with ACPI.
+  Suspend/resume is known to not work reliably and cannot be further
+    addressed in this driver.
 
 v.1.27 23-Apr-2013 - David Azarewicz
Index: trunk/src/os2ahci/ahci.c
===================================================================
--- trunk/src/os2ahci/ahci.c	(revision 161)
+++ trunk/src/os2ahci/ahci.c	(revision 162)
@@ -1736,4 +1736,7 @@
   static u8 total_dev_cnt;
 
+  if (p >= AHCI_MAX_PORTS) return;
+  if (d >= AHCI_MAX_DEVS) return;
+
   if (ai->port_max < p) {
     ai->port_max = p;
Index: trunk/src/os2ahci/ahci.h
===================================================================
--- trunk/src/os2ahci/ahci.h	(revision 161)
+++ trunk/src/os2ahci/ahci.h	(revision 162)
@@ -58,4 +58,5 @@
 #define AHCI_PCI_BAR            5
 #define AHCI_MAX_PORTS          16 /* Spec says 32, but we only support 16 */
+#define AHCI_MAX_DEVS           8
 #define AHCI_MAX_SG             48 /* hardware max is 64K */
 #define AHCI_MAX_SG_ELEMENT_LEN (1UL << 22)
Index: trunk/src/os2ahci/apm.c
===================================================================
--- trunk/src/os2ahci/apm.c	(revision 161)
+++ trunk/src/os2ahci/apm.c	(revision 162)
@@ -133,4 +133,6 @@
     writel(ai->mmio + HOST_CTL, readl(ai->mmio + HOST_CTL) & ~HOST_IRQ_EN);
     readl(ai->mmio + HOST_CTL); /* flush */
+
+    /* TODO: put the device into the D3 state */
   }
 
@@ -138,6 +140,4 @@
   init_complete = 0;
 
-  /* TODO: put the device into the D3 state */
-
   suspended = 1;
   dprintf("suspend() finished\n");
@@ -155,8 +155,8 @@
   dprintf("resume()\n");
 
-  /* TODO: put the device into the D0 state */
-
-  for (a = 0; a < ad_info_cnt; a++) {
-    AD_INFO *ai = ad_infos + a;
+  for (a = 0; a < ad_info_cnt; a++) {
+    AD_INFO *ai = ad_infos + a;
+
+    /* TODO: put the device into the D0 state */
 
     //ahci_reset_controller(ai);
@@ -181,4 +181,9 @@
 
   /* restart engine to resume IORB processing */
+  /* The resume_sleep_flag and probably rearming the ctx hook is a temporary hack
+   * to make resume kind of work when I/O operations are outstanding or started
+   * during the suspend operation. This behavior may change with future versions
+   * of the ACPI software which will make this hack unnecessary.
+   */
   resume_sleep_flag = 5000;
   DevHelp_ArmCtxHook(0, engine_ctxhook_h);
Index: trunk/src/os2ahci/ata.c
===================================================================
--- trunk/src/os2ahci/ata.c	(revision 161)
+++ trunk/src/os2ahci/ata.c	(revision 162)
@@ -605,4 +605,9 @@
 
   if (is_lvm_geometry(iorb)) Method = "LVM";
+  ad_infos[a].ports[p].devs[0].dev_info.Cylinders = geometry->TotalCylinders;
+  ad_infos[a].ports[p].devs[0].dev_info.HeadsPerCylinder = geometry->NumHeads;
+  ad_infos[a].ports[p].devs[0].dev_info.SectorsPerTrack = geometry->SectorsPerTrack;
+  ad_infos[a].ports[p].devs[0].dev_info.TotalSectors = geometry->TotalSectors;
+  ad_infos[a].ports[p].devs[0].dev_info.Method = Method;
 
   dprintf("Drive geometry: %ld cylinders, %d heads, %d sectors per track (%ldMB) (%s)\n",
Index: trunk/src/os2ahci/os2ahci.c
===================================================================
--- trunk/src/os2ahci/os2ahci.c	(revision 161)
+++ trunk/src/os2ahci/os2ahci.c	(revision 162)
@@ -224,4 +224,5 @@
   suspended = 0;
   resume_sleep_flag = 0;
+  memset(ad_infos, 0, sizeof(ad_infos));
 
   /* set device helper entry point */
Index: trunk/src/os2ahci/os2ahci.h
===================================================================
--- trunk/src/os2ahci/os2ahci.h	(revision 161)
+++ trunk/src/os2ahci/os2ahci.h	(revision 162)
@@ -333,8 +333,16 @@
 } IORB_QUEUE;
 
+typedef struct {
+    USHORT Cylinders;
+    USHORT HeadsPerCylinder;
+    USHORT SectorsPerTrack;
+    ULONG  TotalSectors;
+    char *Method;
+} DEV_INFO;
+
 /* port information structure */
 typedef struct {
   IORB_QUEUE    iorb_queue;            /* IORB queue for this port */
-  unsigned      dev_max     : 4;       /* maximum device number on this port (0-15) */
+  unsigned      dev_max     : 4;       /* maximum device number on this port (0..AHCI_MAX_DEVS-1) */
   unsigned      cmd_slot    : 5;       /* current command slot index (using round-
                                         * robin indexes to prevent starvation) */
@@ -353,5 +361,6 @@
     unsigned    ncq_max   : 5;         /* maximum tag number for queued commands */
     UNITINFO _far *unit_info;          /* pointer to modified unit info */
-  } devs[15];
+    DEV_INFO    dev_info;
+  } devs[AHCI_MAX_DEVS];
 } P_INFO;
 
@@ -360,5 +369,5 @@
   PCI_ID       *pci;                   /* pointer to corresponding PCI ID */
 
-  unsigned      port_max : 5;          /* maximum port number (0-31) */
+  unsigned      port_max : 5;          /* maximum port number (0..AHCI_MAX_PORTS-1) */
   unsigned      cmd_max : 5;           /* maximum cmd slot number (0-31) */
   unsigned      port_scan_done : 1;    /* if != 0, port scan already done */
Index: trunk/src/os2ahci/trace.c
===================================================================
--- trunk/src/os2ahci/trace.c	(revision 161)
+++ trunk/src/os2ahci/trace.c	(revision 162)
@@ -246,5 +246,13 @@
       for (d = 0; d <= pi->dev_max; d++) {
         if (!pi->devs[d].present) continue;
-        ntprintf("    Drive %d: atapi=%d, removable=%d\n", d, pi->devs[d].atapi, pi->devs[d].removable);
+
+        ntprintf("    Drive %d:");
+        if (pi->devs[d].atapi) ntprintf(" atapi");
+        if (pi->devs[d].removable) ntprintf(" removable");
+        if (pi->devs[d].dev_info.Method != NULL)
+          ntprintf(" %d cylinders, %d heads, %d sectors per track (%ldMB) (%s)",
+            pi->devs[d].dev_info.Cylinders, pi->devs[d].dev_info.HeadsPerCylinder, pi->devs[d].dev_info.SectorsPerTrack,
+            pi->devs[d].dev_info.TotalSectors/2048, pi->devs[d].dev_info.Method);
+        ntprintf("\n");
       }
     }
