Index: cpukit/libblock/src/bdbuf.c
===================================================================
--- cpukit/libblock/src/bdbuf.c	(revision 156e91e0f2ca3b7a21a21ec56446eee902a86ca5)
+++ cpukit/libblock/src/bdbuf.c	(revision 608940fe08eabe7d92a760ab9de89b7a06a7bc35)
@@ -139,48 +139,36 @@
 } rtems_bdbuf_cache;
 
-/**
- * Fatal errors
- */
-#define RTEMS_BLKDEV_FATAL_ERROR(n) \
-  (((uint32_t)'B' << 24) | ((uint32_t)(n) & (uint32_t)0x00FFFFFF))
-
-#define RTEMS_BLKDEV_FATAL_BDBUF_STATE_11      RTEMS_BLKDEV_FATAL_ERROR(1)
-#define RTEMS_BLKDEV_FATAL_BDBUF_STATE_4       RTEMS_BLKDEV_FATAL_ERROR(2)
-#define RTEMS_BLKDEV_FATAL_BDBUF_STATE_5       RTEMS_BLKDEV_FATAL_ERROR(3)
-#define RTEMS_BLKDEV_FATAL_BDBUF_STATE_6       RTEMS_BLKDEV_FATAL_ERROR(4)
-#define RTEMS_BLKDEV_FATAL_BDBUF_STATE_7       RTEMS_BLKDEV_FATAL_ERROR(5)
-#define RTEMS_BLKDEV_FATAL_BDBUF_STATE_8       RTEMS_BLKDEV_FATAL_ERROR(6)
-#define RTEMS_BLKDEV_FATAL_BDBUF_STATE_9       RTEMS_BLKDEV_FATAL_ERROR(7)
-#define RTEMS_BLKDEV_FATAL_BDBUF_STATE_10      RTEMS_BLKDEV_FATAL_ERROR(8)
-#define RTEMS_BLKDEV_FATAL_BDBUF_TREE_RM       RTEMS_BLKDEV_FATAL_ERROR(9)
-#define RTEMS_BLKDEV_FATAL_BDBUF_SWAPOUT       RTEMS_BLKDEV_FATAL_ERROR(10)
-
-/*
- * The lock/unlock fatal errors occur in case the bdbuf is not initialized with
- * rtems_bdbuf_init().  General system corruption like stack overflow etc. may
- * also trigger these fatal errors.
- */
-#define RTEMS_BLKDEV_FATAL_BDBUF_SYNC_LOCK     RTEMS_BLKDEV_FATAL_ERROR(11)
-#define RTEMS_BLKDEV_FATAL_BDBUF_SYNC_UNLOCK   RTEMS_BLKDEV_FATAL_ERROR(12)
-#define RTEMS_BLKDEV_FATAL_BDBUF_CACHE_LOCK    RTEMS_BLKDEV_FATAL_ERROR(13)
-#define RTEMS_BLKDEV_FATAL_BDBUF_CACHE_UNLOCK  RTEMS_BLKDEV_FATAL_ERROR(14)
-
-#define RTEMS_BLKDEV_FATAL_BDBUF_PREEMPT_DIS   RTEMS_BLKDEV_FATAL_ERROR(15)
-#define RTEMS_BLKDEV_FATAL_BDBUF_CACHE_WAIT_2  RTEMS_BLKDEV_FATAL_ERROR(16)
-#define RTEMS_BLKDEV_FATAL_BDBUF_PREEMPT_RST   RTEMS_BLKDEV_FATAL_ERROR(17)
-#define RTEMS_BLKDEV_FATAL_BDBUF_CACHE_WAIT_TO RTEMS_BLKDEV_FATAL_ERROR(18)
-#define RTEMS_BLKDEV_FATAL_BDBUF_CACHE_WAKE    RTEMS_BLKDEV_FATAL_ERROR(19)
-#define RTEMS_BLKDEV_FATAL_BDBUF_SO_WAKE       RTEMS_BLKDEV_FATAL_ERROR(20)
-#define RTEMS_BLKDEV_FATAL_BDBUF_SO_NOMEM      RTEMS_BLKDEV_FATAL_ERROR(21)
-#define RTEMS_BLKDEV_FATAL_BDBUF_SO_WK_CREATE  RTEMS_BLKDEV_FATAL_ERROR(22)
-#define BLKDEV_FATAL_BDBUF_SWAPOUT_RE          RTEMS_BLKDEV_FATAL_ERROR(24)
-#define BLKDEV_FATAL_BDBUF_SWAPOUT_TS          RTEMS_BLKDEV_FATAL_ERROR(25)
-#define RTEMS_BLKDEV_FATAL_BDBUF_WAIT_EVNT     RTEMS_BLKDEV_FATAL_ERROR(26)
-#define RTEMS_BLKDEV_FATAL_BDBUF_RECYCLE       RTEMS_BLKDEV_FATAL_ERROR(27)
-#define RTEMS_BLKDEV_FATAL_BDBUF_STATE_0       RTEMS_BLKDEV_FATAL_ERROR(28)
-#define RTEMS_BLKDEV_FATAL_BDBUF_STATE_1       RTEMS_BLKDEV_FATAL_ERROR(29)
-#define RTEMS_BLKDEV_FATAL_BDBUF_STATE_2       RTEMS_BLKDEV_FATAL_ERROR(30)
-#define RTEMS_BLKDEV_FATAL_BDBUF_RA_WAKE_UP    RTEMS_BLKDEV_FATAL_ERROR(31)
-#define RTEMS_BLKDEV_FATAL_BDBUF_WAIT_TRANS_EVNT RTEMS_BLKDEV_FATAL_ERROR(32)
+typedef enum {
+  RTEMS_BDBUF_FATAL_CACHE_LOCK,
+  RTEMS_BDBUF_FATAL_CACHE_UNLOCK,
+  RTEMS_BDBUF_FATAL_CACHE_WAIT_2,
+  RTEMS_BDBUF_FATAL_CACHE_WAIT_TO,
+  RTEMS_BDBUF_FATAL_CACHE_WAKE,
+  RTEMS_BDBUF_FATAL_PREEMPT_DIS,
+  RTEMS_BDBUF_FATAL_PREEMPT_RST,
+  RTEMS_BDBUF_FATAL_RA_WAKE_UP,
+  RTEMS_BDBUF_FATAL_RECYCLE,
+  RTEMS_BDBUF_FATAL_SO_REQ_NOMEM,
+  RTEMS_BDBUF_FATAL_SO_WK_NOMEM,
+  RTEMS_BDBUF_FATAL_SO_WAKE_1,
+  RTEMS_BDBUF_FATAL_SO_WAKE_2,
+  RTEMS_BDBUF_FATAL_SO_WK_CREATE,
+  RTEMS_BDBUF_FATAL_STATE_0,
+  RTEMS_BDBUF_FATAL_STATE_2,
+  RTEMS_BDBUF_FATAL_STATE_4,
+  RTEMS_BDBUF_FATAL_STATE_5,
+  RTEMS_BDBUF_FATAL_STATE_6,
+  RTEMS_BDBUF_FATAL_STATE_7,
+  RTEMS_BDBUF_FATAL_STATE_8,
+  RTEMS_BDBUF_FATAL_STATE_9,
+  RTEMS_BDBUF_FATAL_STATE_10,
+  RTEMS_BDBUF_FATAL_STATE_11,
+  RTEMS_BDBUF_FATAL_SWAPOUT_RE,
+  RTEMS_BDBUF_FATAL_SYNC_LOCK,
+  RTEMS_BDBUF_FATAL_SYNC_UNLOCK,
+  RTEMS_BDBUF_FATAL_TREE_RM,
+  RTEMS_BDBUF_FATAL_WAIT_EVNT,
+  RTEMS_BDBUF_FATAL_WAIT_TRANS_EVNT
+} rtems_bdbuf_fatal_code;
 
 /**
@@ -317,7 +305,14 @@
 
 static void
-rtems_bdbuf_fatal (rtems_bdbuf_buf_state state, uint32_t error)
-{
-  rtems_fatal_error_occurred ((((uint32_t) state) << 16) | error);
+rtems_bdbuf_fatal (rtems_fatal_code error)
+{
+  rtems_fatal (RTEMS_FATAL_SOURCE_BDBUF, error);
+}
+
+static void
+rtems_bdbuf_fatal_with_state (rtems_bdbuf_buf_state state,
+                              rtems_bdbuf_fatal_code error)
+{
+  rtems_bdbuf_fatal ((((uint32_t) state) << 16) | error);
 }
 
@@ -844,5 +839,5 @@
                                                  RTEMS_NO_TIMEOUT);
   if (sc != RTEMS_SUCCESSFUL)
-    rtems_fatal_error_occurred (fatal_error_code);
+    rtems_bdbuf_fatal (fatal_error_code);
 }
 
@@ -858,5 +853,5 @@
   rtems_status_code sc = rtems_semaphore_release (lock);
   if (sc != RTEMS_SUCCESSFUL)
-    rtems_fatal_error_occurred (fatal_error_code);
+    rtems_bdbuf_fatal (fatal_error_code);
 }
 
@@ -867,5 +862,5 @@
 rtems_bdbuf_lock_cache (void)
 {
-  rtems_bdbuf_lock (bdbuf_cache.lock, RTEMS_BLKDEV_FATAL_BDBUF_CACHE_LOCK);
+  rtems_bdbuf_lock (bdbuf_cache.lock, RTEMS_BDBUF_FATAL_CACHE_LOCK);
 }
 
@@ -876,5 +871,5 @@
 rtems_bdbuf_unlock_cache (void)
 {
-  rtems_bdbuf_unlock (bdbuf_cache.lock, RTEMS_BLKDEV_FATAL_BDBUF_CACHE_UNLOCK);
+  rtems_bdbuf_unlock (bdbuf_cache.lock, RTEMS_BDBUF_FATAL_CACHE_UNLOCK);
 }
 
@@ -885,5 +880,5 @@
 rtems_bdbuf_lock_sync (void)
 {
-  rtems_bdbuf_lock (bdbuf_cache.sync_lock, RTEMS_BLKDEV_FATAL_BDBUF_SYNC_LOCK);
+  rtems_bdbuf_lock (bdbuf_cache.sync_lock, RTEMS_BDBUF_FATAL_SYNC_LOCK);
 }
 
@@ -895,5 +890,5 @@
 {
   rtems_bdbuf_unlock (bdbuf_cache.sync_lock,
-                      RTEMS_BLKDEV_FATAL_BDBUF_SYNC_UNLOCK);
+                      RTEMS_BDBUF_FATAL_SYNC_UNLOCK);
 }
 
@@ -918,5 +913,5 @@
   sc = rtems_task_mode (RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &prev_mode);
   if (sc != RTEMS_SUCCESSFUL)
-    rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_PREEMPT_DIS);
+    rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_PREEMPT_DIS);
 
   return prev_mode;
@@ -930,5 +925,5 @@
   sc = rtems_task_mode (prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode);
   if (sc != RTEMS_SUCCESSFUL)
-    rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_PREEMPT_RST);
+    rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_PREEMPT_RST);
 }
 
@@ -979,8 +974,8 @@
 
   if (sc == RTEMS_TIMEOUT)
-    rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_CACHE_WAIT_TO);
+    rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_CACHE_WAIT_TO);
 
   if (sc != RTEMS_UNSATISFIED)
-    rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_CACHE_WAIT_2);
+    rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_CACHE_WAIT_2);
 
   rtems_bdbuf_lock_cache ();
@@ -1014,5 +1009,5 @@
     sc = rtems_semaphore_flush (waiters->sema);
     if (sc != RTEMS_SUCCESSFUL)
-      rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_CACHE_WAKE);
+      rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_CACHE_WAKE);
   }
 }
@@ -1024,5 +1019,5 @@
                                            RTEMS_BDBUF_SWAPOUT_SYNC);
   if (sc != RTEMS_SUCCESSFUL)
-    rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_SO_WAKE);
+    rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_SO_WAKE_1);
 }
 
@@ -1037,5 +1032,5 @@
 {
   if (rtems_bdbuf_avl_remove (&bdbuf_cache.tree, bd) != 0)
-    rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_TREE_RM);
+    rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_TREE_RM);
 }
 
@@ -1051,5 +1046,5 @@
       break;
     default:
-      rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_10);
+      rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_STATE_10);
   }
 
@@ -1231,5 +1226,5 @@
 
   if (rtems_bdbuf_avl_insert (&bdbuf_cache.tree, bd) != 0)
-    rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_RECYCLE);
+    rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_RECYCLE);
 
   rtems_bdbuf_make_empty (bd);
@@ -1546,5 +1541,5 @@
 
   if (sc != RTEMS_SUCCESSFUL || out != event)
-    rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_WAIT_EVNT);
+    rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_WAIT_EVNT);
 }
 
@@ -1556,5 +1551,5 @@
   sc = rtems_event_transient_receive (RTEMS_WAIT, RTEMS_NO_TIMEOUT);
   if (sc != RTEMS_SUCCESSFUL)
-    rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_WAIT_TRANS_EVNT);
+    rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_WAIT_TRANS_EVNT);
 }
 
@@ -1586,5 +1581,5 @@
         break;
       default:
-        rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_7);
+        rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_STATE_7);
     }
   }
@@ -1645,5 +1640,5 @@
         break;
       default:
-        rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_8);
+        rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_STATE_8);
     }
   }
@@ -1671,5 +1666,5 @@
         break;
       default:
-        rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_9);
+        rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_STATE_9);
     }
   }
@@ -1844,5 +1839,5 @@
         break;
       default:
-        rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_2);
+        rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_STATE_2);
         break;
     }
@@ -2052,5 +2047,5 @@
                              RTEMS_BDBUF_READ_AHEAD_WAKE_UP);
       if (sc != RTEMS_SUCCESSFUL)
-        rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_RA_WAKE_UP);
+        rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_RA_WAKE_UP);
     }
 
@@ -2116,5 +2111,5 @@
         break;
       default:
-        rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_4);
+        rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_STATE_4);
         break;
     }
@@ -2167,5 +2162,5 @@
       break;
     default:
-      rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_0);
+      rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_STATE_0);
       break;
   }
@@ -2199,5 +2194,5 @@
       break;
     default:
-      rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_6);
+      rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_STATE_6);
       break;
   }
@@ -2231,5 +2226,5 @@
       break;
     default:
-      rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_5);
+      rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_STATE_5);
       break;
   }
@@ -2601,5 +2596,5 @@
                                                RTEMS_BDBUF_SWAPOUT_SYNC);
       if (sc != RTEMS_SUCCESSFUL)
-        rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_SO_WAKE);
+        rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_SO_WAKE_2);
     }
     else
@@ -2645,5 +2640,5 @@
 
   if (!write_req)
-    rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_SO_NOMEM);
+    rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_SO_REQ_NOMEM);
 
   write_req->req = RTEMS_BLKDEV_REQ_WRITE;
@@ -2704,5 +2699,5 @@
     worker = malloc (sizeof (rtems_bdbuf_swapout_worker));
     if (!worker)
-      rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_SO_NOMEM);
+      rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_SO_WK_NOMEM);
 
     rtems_chain_append_unprotected (&bdbuf_cache.swapout_workers, &worker->link);
@@ -2720,5 +2715,5 @@
                                   &worker->id);
     if (sc != RTEMS_SUCCESSFUL)
-      rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_SO_WK_CREATE);
+      rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_SO_WK_CREATE);
   }
 
@@ -2829,5 +2824,5 @@
 
     if ((sc != RTEMS_SUCCESSFUL) && (sc != RTEMS_TIMEOUT))
-      rtems_fatal_error_occurred (BLKDEV_FATAL_BDBUF_SWAPOUT_RE);
+      rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_SWAPOUT_RE);
   }
 
@@ -2899,5 +2894,5 @@
           break;
         default:
-          rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_STATE_11);
+          rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_STATE_11);
       }
     }
Index: cpukit/score/include/rtems/score/interr.h
===================================================================
--- cpukit/score/include/rtems/score/interr.h	(revision 156e91e0f2ca3b7a21a21ec56446eee902a86ca5)
+++ cpukit/score/include/rtems/score/interr.h	(revision 608940fe08eabe7d92a760ab9de89b7a06a7bc35)
@@ -45,4 +45,11 @@
   INTERNAL_ERROR_RTEMS_API,
   INTERNAL_ERROR_POSIX_API,
+
+  /**
+   * @brief Fatal source for the block device cache.
+   *
+   * @see rtems_bdbuf_fatal_code.
+   */
+  RTEMS_FATAL_SOURCE_BDBUF,
 
   /**
