Index: /trunk/src/os2ahci/Makefile
===================================================================
--- /trunk/src/os2ahci/Makefile	(revision 33)
+++ /trunk/src/os2ahci/Makefile	(revision 34)
@@ -29,8 +29,9 @@
 MAPSYM     = $(DDK)\base\tools\mapsym.exe
 BLDLEVEL   = cmd.exe /c ..\..\tools\bldlvl.cmd
+BLDDATE    = cmd.exe /c ..\..\tools\blddate.cmd
 
 AFLAGS     = -Mb
 CFLAGS     = -c -nologo -Asnw -W2 -G2ms -Zlpd -Fc -Zi
-LFLAGS     = /noe /nod /packd /a:16 /batch /map /line 
+LFLAGS     = /noe /nod /packd /a:16 /batch /map /line
 
 ###############################################################################
@@ -88,5 +89,5 @@
 libc.obj:     libc.c     Makefile $(INCS)
 
-os2ahci.obj:  os2ahci.c  Makefile $(INCS)
+os2ahci.obj:  os2ahci.c  Makefile $(INCS) bldday.h
 
 pci.obj:      pci.c      Makefile $(INCS)
@@ -103,4 +104,7 @@
 # Action definitions (compile/link commands)
 
+bldday.h:
+	$(BLDDATE) > bldday.h
+
 .asm.obj:
 	$(AS) $(AFLAGS) $(AS_INCLUDE) $*.asm
Index: /trunk/src/os2ahci/ahci.c
===================================================================
--- /trunk/src/os2ahci/ahci.c	(revision 33)
+++ /trunk/src/os2ahci/ahci.c	(revision 34)
@@ -1396,4 +1396,6 @@
   ADJUNCT adj;
   HDEVICE dh;
+  char dev_name[RM_MAX_PREFIX_LEN+ATA_ID_PROD_LEN+1];
+  static u8 total_dev_cnt;
 
   if (ai->port_max < p) {
@@ -1436,15 +1438,28 @@
   memset(&adj, 0x00, sizeof(adj));
 
-  adj.pNextAdj           = NULL;
-  adj.AdjLength          = sizeof(adj);
-  adj.AdjType            = ADJ_ADD_UNIT;
-  adj.Add_Unit.ADDHandle = rm_drvh;
-
-  ds.DevDescriptName = ata_dev_name(id_buf);
+  adj.pNextAdj            = NULL;
+  adj.AdjLength           = sizeof(adj);
+  adj.AdjType             = ADJ_ADD_UNIT;
+  adj.Add_Unit.ADDHandle  = rm_drvh;
+  adj.Add_Unit.UnitHandle = (USHORT) total_dev_cnt;
+
+  /* create Resource Manager device key string;
+   * we distinguish only HDs and CD drives for now
+   */
+  if (ai->ports[p].devs[d].removable) {
+    sprintf(dev_name, RM_CD_PREFIX "%s", p, d, ata_dev_name(id_buf));
+  } else {
+    sprintf(dev_name, RM_HD_PREFIX "%s", p, d, ata_dev_name(id_buf));
+  }
+
+  ds.DevDescriptName = dev_name;
   ds.DevFlags        = (ai->ports[p].devs[d].removable) ? DS_REMOVEABLE_MEDIA
                                                         : DS_FIXED_LOGICALNAME;
   ds.DevType         = ai->ports[p].devs[d].dev_type;
+  ds.pAdjunctList    = &adj;
 
   RMCreateDevice(rm_drvh, &dh, &ds, ai->rm_adh, NULL);
+
+  total_dev_cnt++;
 
   /* try to detect virtualbox environment to enable a hack for IRQ routing */
Index: /trunk/src/os2ahci/ahci.h
===================================================================
--- /trunk/src/os2ahci/ahci.h	(revision 33)
+++ /trunk/src/os2ahci/ahci.h	(revision 34)
@@ -23,4 +23,15 @@
 
 /* -------------------------- macros and constants ------------------------- */
+
+/******************************************************************************
+ *  device prefix strings for Resource Manager
+ */
+#define RM_HD_PREFIX         "HD_(%d,%d) "
+#define RM_HD_PREFIX_LEN     (sizeof(RM_HD_PREFIX) - 1)
+#define RM_CD_PREFIX         "CD_(%d,%d) "
+#define RM_CD_PREFIX_LEN     (sizeof(RM_CD_PREFIX) - 1)
+#define RM_TAPE_PREFIX       "TAPE_(%d,%d) "
+#define RM_TAPE_PREFIX_LEN   (sizeof(RM_TAPE_PREFIX) - 1)
+#define RM_MAX_PREFIX_LEN    RM_TAPE_PREFIX_LEN
 
 /******************************************************************************
Index: /trunk/src/os2ahci/os2ahci.c
===================================================================
--- /trunk/src/os2ahci/os2ahci.c	(revision 33)
+++ /trunk/src/os2ahci/os2ahci.c	(revision 34)
@@ -21,4 +21,5 @@
 
 #include "os2ahci.h"
+#include "bldday.h"
 
 /* -------------------------- macros and constants ------------------------- */
@@ -66,5 +67,5 @@
   CMVERSION_MAJOR,                 /* RM interface version major */
   CMVERSION_MINOR,                 /* RM interface version minor */
-  2010, 4, 27,                     /* date */
+  BLD_YEAR, BLD_MONTH, BLD_DAY,    /* date */
   0,                               /* driver flags */
   DRT_ADDDM,                       /* driver type */
Index: /trunk/src/os2ahci/os2ahci.def
===================================================================
--- /trunk/src/os2ahci/os2ahci.def	(revision 33)
+++ /trunk/src/os2ahci/os2ahci.def	(revision 34)
@@ -1,4 +1,4 @@
 library os2ahci
-Description '$@#thi.guten (www.thiguten.de):1.00.20101001#@OS/2 AHCI Adapter Device Driver'
+Description '$@#thi.guten (www.thiguten.de):1.00.20101021#@OS/2 AHCI Adapter Device Driver'
 protmode
 
Index: /trunk/tools/blddate.cmd
===================================================================
--- /trunk/tools/blddate.cmd	(revision 34)
+++ /trunk/tools/blddate.cmd	(revision 34)
@@ -0,0 +1,17 @@
+/*
+ * blddate.cmd - REXX script to spit out a header file containing 
+ * #defines for the current day, month and year
+ *
+ * Used by os2ahci.add
+ *
+ * MT 08/2010
+ */
+
+d = DATE('S')
+
+say '/* auto generated by blddate.cmd */'
+say '#define BLD_YEAR  ' SUBSTR(d, 1, 4)
+say '#define BLD_MONTH ' SUBSTR(d, 5, 2)
+say '#define BLD_DAY   ' SUBSTR(d, 7, 2)
+
+
