Changeset 608940f in rtems


Ignore:
Timestamp:
Nov 14, 2012, 9:12:57 AM (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
038e2f4a
Parents:
156e91e
git-author:
Sebastian Huber <sebastian.huber@…> (11/14/12 09:12:57)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/15/12 14:33:12)
Message:

score: Add RTEMS_FATAL_SOURCE_BDBUF

Add rtems_bdbuf_fatal_code as a replacement for the previous fatal error
codes. Remove unused error codes. Add new error codes. Use
rtems_fatal() with RTEMS_FATAL_SOURCE_BDBUF as source.

Location:
cpukit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libblock/src/bdbuf.c

    r156e91e r608940f  
    139139} rtems_bdbuf_cache;
    140140
    141 /**
    142  * Fatal errors
    143  */
    144 #define RTEMS_BLKDEV_FATAL_ERROR(n) \
    145   (((uint32_t)'B' << 24) | ((uint32_t)(n) & (uint32_t)0x00FFFFFF))
    146 
    147 #define RTEMS_BLKDEV_FATAL_BDBUF_STATE_11      RTEMS_BLKDEV_FATAL_ERROR(1)
    148 #define RTEMS_BLKDEV_FATAL_BDBUF_STATE_4       RTEMS_BLKDEV_FATAL_ERROR(2)
    149 #define RTEMS_BLKDEV_FATAL_BDBUF_STATE_5       RTEMS_BLKDEV_FATAL_ERROR(3)
    150 #define RTEMS_BLKDEV_FATAL_BDBUF_STATE_6       RTEMS_BLKDEV_FATAL_ERROR(4)
    151 #define RTEMS_BLKDEV_FATAL_BDBUF_STATE_7       RTEMS_BLKDEV_FATAL_ERROR(5)
    152 #define RTEMS_BLKDEV_FATAL_BDBUF_STATE_8       RTEMS_BLKDEV_FATAL_ERROR(6)
    153 #define RTEMS_BLKDEV_FATAL_BDBUF_STATE_9       RTEMS_BLKDEV_FATAL_ERROR(7)
    154 #define RTEMS_BLKDEV_FATAL_BDBUF_STATE_10      RTEMS_BLKDEV_FATAL_ERROR(8)
    155 #define RTEMS_BLKDEV_FATAL_BDBUF_TREE_RM       RTEMS_BLKDEV_FATAL_ERROR(9)
    156 #define RTEMS_BLKDEV_FATAL_BDBUF_SWAPOUT       RTEMS_BLKDEV_FATAL_ERROR(10)
    157 
    158 /*
    159  * The lock/unlock fatal errors occur in case the bdbuf is not initialized with
    160  * rtems_bdbuf_init().  General system corruption like stack overflow etc. may
    161  * also trigger these fatal errors.
    162  */
    163 #define RTEMS_BLKDEV_FATAL_BDBUF_SYNC_LOCK     RTEMS_BLKDEV_FATAL_ERROR(11)
    164 #define RTEMS_BLKDEV_FATAL_BDBUF_SYNC_UNLOCK   RTEMS_BLKDEV_FATAL_ERROR(12)
    165 #define RTEMS_BLKDEV_FATAL_BDBUF_CACHE_LOCK    RTEMS_BLKDEV_FATAL_ERROR(13)
    166 #define RTEMS_BLKDEV_FATAL_BDBUF_CACHE_UNLOCK  RTEMS_BLKDEV_FATAL_ERROR(14)
    167 
    168 #define RTEMS_BLKDEV_FATAL_BDBUF_PREEMPT_DIS   RTEMS_BLKDEV_FATAL_ERROR(15)
    169 #define RTEMS_BLKDEV_FATAL_BDBUF_CACHE_WAIT_2  RTEMS_BLKDEV_FATAL_ERROR(16)
    170 #define RTEMS_BLKDEV_FATAL_BDBUF_PREEMPT_RST   RTEMS_BLKDEV_FATAL_ERROR(17)
    171 #define RTEMS_BLKDEV_FATAL_BDBUF_CACHE_WAIT_TO RTEMS_BLKDEV_FATAL_ERROR(18)
    172 #define RTEMS_BLKDEV_FATAL_BDBUF_CACHE_WAKE    RTEMS_BLKDEV_FATAL_ERROR(19)
    173 #define RTEMS_BLKDEV_FATAL_BDBUF_SO_WAKE       RTEMS_BLKDEV_FATAL_ERROR(20)
    174 #define RTEMS_BLKDEV_FATAL_BDBUF_SO_NOMEM      RTEMS_BLKDEV_FATAL_ERROR(21)
    175 #define RTEMS_BLKDEV_FATAL_BDBUF_SO_WK_CREATE  RTEMS_BLKDEV_FATAL_ERROR(22)
    176 #define BLKDEV_FATAL_BDBUF_SWAPOUT_RE          RTEMS_BLKDEV_FATAL_ERROR(24)
    177 #define BLKDEV_FATAL_BDBUF_SWAPOUT_TS          RTEMS_BLKDEV_FATAL_ERROR(25)
    178 #define RTEMS_BLKDEV_FATAL_BDBUF_WAIT_EVNT     RTEMS_BLKDEV_FATAL_ERROR(26)
    179 #define RTEMS_BLKDEV_FATAL_BDBUF_RECYCLE       RTEMS_BLKDEV_FATAL_ERROR(27)
    180 #define RTEMS_BLKDEV_FATAL_BDBUF_STATE_0       RTEMS_BLKDEV_FATAL_ERROR(28)
    181 #define RTEMS_BLKDEV_FATAL_BDBUF_STATE_1       RTEMS_BLKDEV_FATAL_ERROR(29)
    182 #define RTEMS_BLKDEV_FATAL_BDBUF_STATE_2       RTEMS_BLKDEV_FATAL_ERROR(30)
    183 #define RTEMS_BLKDEV_FATAL_BDBUF_RA_WAKE_UP    RTEMS_BLKDEV_FATAL_ERROR(31)
    184 #define RTEMS_BLKDEV_FATAL_BDBUF_WAIT_TRANS_EVNT RTEMS_BLKDEV_FATAL_ERROR(32)
     141typedef enum {
     142  RTEMS_BDBUF_FATAL_CACHE_LOCK,
     143  RTEMS_BDBUF_FATAL_CACHE_UNLOCK,
     144  RTEMS_BDBUF_FATAL_CACHE_WAIT_2,
     145  RTEMS_BDBUF_FATAL_CACHE_WAIT_TO,
     146  RTEMS_BDBUF_FATAL_CACHE_WAKE,
     147  RTEMS_BDBUF_FATAL_PREEMPT_DIS,
     148  RTEMS_BDBUF_FATAL_PREEMPT_RST,
     149  RTEMS_BDBUF_FATAL_RA_WAKE_UP,
     150  RTEMS_BDBUF_FATAL_RECYCLE,
     151  RTEMS_BDBUF_FATAL_SO_REQ_NOMEM,
     152  RTEMS_BDBUF_FATAL_SO_WK_NOMEM,
     153  RTEMS_BDBUF_FATAL_SO_WAKE_1,
     154  RTEMS_BDBUF_FATAL_SO_WAKE_2,
     155  RTEMS_BDBUF_FATAL_SO_WK_CREATE,
     156  RTEMS_BDBUF_FATAL_STATE_0,
     157  RTEMS_BDBUF_FATAL_STATE_2,
     158  RTEMS_BDBUF_FATAL_STATE_4,
     159  RTEMS_BDBUF_FATAL_STATE_5,
     160  RTEMS_BDBUF_FATAL_STATE_6,
     161  RTEMS_BDBUF_FATAL_STATE_7,
     162  RTEMS_BDBUF_FATAL_STATE_8,
     163  RTEMS_BDBUF_FATAL_STATE_9,
     164  RTEMS_BDBUF_FATAL_STATE_10,
     165  RTEMS_BDBUF_FATAL_STATE_11,
     166  RTEMS_BDBUF_FATAL_SWAPOUT_RE,
     167  RTEMS_BDBUF_FATAL_SYNC_LOCK,
     168  RTEMS_BDBUF_FATAL_SYNC_UNLOCK,
     169  RTEMS_BDBUF_FATAL_TREE_RM,
     170  RTEMS_BDBUF_FATAL_WAIT_EVNT,
     171  RTEMS_BDBUF_FATAL_WAIT_TRANS_EVNT
     172} rtems_bdbuf_fatal_code;
    185173
    186174/**
     
    317305
    318306static void
    319 rtems_bdbuf_fatal (rtems_bdbuf_buf_state state, uint32_t error)
    320 {
    321   rtems_fatal_error_occurred ((((uint32_t) state) << 16) | error);
     307rtems_bdbuf_fatal (rtems_fatal_code error)
     308{
     309  rtems_fatal (RTEMS_FATAL_SOURCE_BDBUF, error);
     310}
     311
     312static void
     313rtems_bdbuf_fatal_with_state (rtems_bdbuf_buf_state state,
     314                              rtems_bdbuf_fatal_code error)
     315{
     316  rtems_bdbuf_fatal ((((uint32_t) state) << 16) | error);
    322317}
    323318
     
    844839                                                 RTEMS_NO_TIMEOUT);
    845840  if (sc != RTEMS_SUCCESSFUL)
    846     rtems_fatal_error_occurred (fatal_error_code);
     841    rtems_bdbuf_fatal (fatal_error_code);
    847842}
    848843
     
    858853  rtems_status_code sc = rtems_semaphore_release (lock);
    859854  if (sc != RTEMS_SUCCESSFUL)
    860     rtems_fatal_error_occurred (fatal_error_code);
     855    rtems_bdbuf_fatal (fatal_error_code);
    861856}
    862857
     
    867862rtems_bdbuf_lock_cache (void)
    868863{
    869   rtems_bdbuf_lock (bdbuf_cache.lock, RTEMS_BLKDEV_FATAL_BDBUF_CACHE_LOCK);
     864  rtems_bdbuf_lock (bdbuf_cache.lock, RTEMS_BDBUF_FATAL_CACHE_LOCK);
    870865}
    871866
     
    876871rtems_bdbuf_unlock_cache (void)
    877872{
    878   rtems_bdbuf_unlock (bdbuf_cache.lock, RTEMS_BLKDEV_FATAL_BDBUF_CACHE_UNLOCK);
     873  rtems_bdbuf_unlock (bdbuf_cache.lock, RTEMS_BDBUF_FATAL_CACHE_UNLOCK);
    879874}
    880875
     
    885880rtems_bdbuf_lock_sync (void)
    886881{
    887   rtems_bdbuf_lock (bdbuf_cache.sync_lock, RTEMS_BLKDEV_FATAL_BDBUF_SYNC_LOCK);
     882  rtems_bdbuf_lock (bdbuf_cache.sync_lock, RTEMS_BDBUF_FATAL_SYNC_LOCK);
    888883}
    889884
     
    895890{
    896891  rtems_bdbuf_unlock (bdbuf_cache.sync_lock,
    897                       RTEMS_BLKDEV_FATAL_BDBUF_SYNC_UNLOCK);
     892                      RTEMS_BDBUF_FATAL_SYNC_UNLOCK);
    898893}
    899894
     
    918913  sc = rtems_task_mode (RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &prev_mode);
    919914  if (sc != RTEMS_SUCCESSFUL)
    920     rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_PREEMPT_DIS);
     915    rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_PREEMPT_DIS);
    921916
    922917  return prev_mode;
     
    930925  sc = rtems_task_mode (prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode);
    931926  if (sc != RTEMS_SUCCESSFUL)
    932     rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_PREEMPT_RST);
     927    rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_PREEMPT_RST);
    933928}
    934929
     
    979974
    980975  if (sc == RTEMS_TIMEOUT)
    981     rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_CACHE_WAIT_TO);
     976    rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_CACHE_WAIT_TO);
    982977
    983978  if (sc != RTEMS_UNSATISFIED)
    984     rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_CACHE_WAIT_2);
     979    rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_CACHE_WAIT_2);
    985980
    986981  rtems_bdbuf_lock_cache ();
     
    10141009    sc = rtems_semaphore_flush (waiters->sema);
    10151010    if (sc != RTEMS_SUCCESSFUL)
    1016       rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_CACHE_WAKE);
     1011      rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_CACHE_WAKE);
    10171012  }
    10181013}
     
    10241019                                           RTEMS_BDBUF_SWAPOUT_SYNC);
    10251020  if (sc != RTEMS_SUCCESSFUL)
    1026     rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_SO_WAKE);
     1021    rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_SO_WAKE_1);
    10271022}
    10281023
     
    10371032{
    10381033  if (rtems_bdbuf_avl_remove (&bdbuf_cache.tree, bd) != 0)
    1039     rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_TREE_RM);
     1034    rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_TREE_RM);
    10401035}
    10411036
     
    10511046      break;
    10521047    default:
    1053       rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_10);
     1048      rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_STATE_10);
    10541049  }
    10551050
     
    12311226
    12321227  if (rtems_bdbuf_avl_insert (&bdbuf_cache.tree, bd) != 0)
    1233     rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_RECYCLE);
     1228    rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_RECYCLE);
    12341229
    12351230  rtems_bdbuf_make_empty (bd);
     
    15461541
    15471542  if (sc != RTEMS_SUCCESSFUL || out != event)
    1548     rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_WAIT_EVNT);
     1543    rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_WAIT_EVNT);
    15491544}
    15501545
     
    15561551  sc = rtems_event_transient_receive (RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    15571552  if (sc != RTEMS_SUCCESSFUL)
    1558     rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_WAIT_TRANS_EVNT);
     1553    rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_WAIT_TRANS_EVNT);
    15591554}
    15601555
     
    15861581        break;
    15871582      default:
    1588         rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_7);
     1583        rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_STATE_7);
    15891584    }
    15901585  }
     
    16451640        break;
    16461641      default:
    1647         rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_8);
     1642        rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_STATE_8);
    16481643    }
    16491644  }
     
    16711666        break;
    16721667      default:
    1673         rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_9);
     1668        rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_STATE_9);
    16741669    }
    16751670  }
     
    18441839        break;
    18451840      default:
    1846         rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_2);
     1841        rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_STATE_2);
    18471842        break;
    18481843    }
     
    20522047                             RTEMS_BDBUF_READ_AHEAD_WAKE_UP);
    20532048      if (sc != RTEMS_SUCCESSFUL)
    2054         rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_RA_WAKE_UP);
     2049        rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_RA_WAKE_UP);
    20552050    }
    20562051
     
    21162111        break;
    21172112      default:
    2118         rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_4);
     2113        rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_STATE_4);
    21192114        break;
    21202115    }
     
    21672162      break;
    21682163    default:
    2169       rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_0);
     2164      rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_STATE_0);
    21702165      break;
    21712166  }
     
    21992194      break;
    22002195    default:
    2201       rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_6);
     2196      rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_STATE_6);
    22022197      break;
    22032198  }
     
    22312226      break;
    22322227    default:
    2233       rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_5);
     2228      rtems_bdbuf_fatal_with_state (bd->state, RTEMS_BDBUF_FATAL_STATE_5);
    22342229      break;
    22352230  }
     
    26012596                                               RTEMS_BDBUF_SWAPOUT_SYNC);
    26022597      if (sc != RTEMS_SUCCESSFUL)
    2603         rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_SO_WAKE);
     2598        rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_SO_WAKE_2);
    26042599    }
    26052600    else
     
    26452640
    26462641  if (!write_req)
    2647     rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_SO_NOMEM);
     2642    rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_SO_REQ_NOMEM);
    26482643
    26492644  write_req->req = RTEMS_BLKDEV_REQ_WRITE;
     
    27042699    worker = malloc (sizeof (rtems_bdbuf_swapout_worker));
    27052700    if (!worker)
    2706       rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_SO_NOMEM);
     2701      rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_SO_WK_NOMEM);
    27072702
    27082703    rtems_chain_append_unprotected (&bdbuf_cache.swapout_workers, &worker->link);
     
    27202715                                  &worker->id);
    27212716    if (sc != RTEMS_SUCCESSFUL)
    2722       rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_SO_WK_CREATE);
     2717      rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_SO_WK_CREATE);
    27232718  }
    27242719
     
    28292824
    28302825    if ((sc != RTEMS_SUCCESSFUL) && (sc != RTEMS_TIMEOUT))
    2831       rtems_fatal_error_occurred (BLKDEV_FATAL_BDBUF_SWAPOUT_RE);
     2826      rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_SWAPOUT_RE);
    28322827  }
    28332828
     
    28992894          break;
    29002895        default:
    2901           rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_STATE_11);
     2896          rtems_bdbuf_fatal (RTEMS_BDBUF_FATAL_STATE_11);
    29022897      }
    29032898    }
  • cpukit/score/include/rtems/score/interr.h

    r156e91e r608940f  
    4545  INTERNAL_ERROR_RTEMS_API,
    4646  INTERNAL_ERROR_POSIX_API,
     47
     48  /**
     49   * @brief Fatal source for the block device cache.
     50   *
     51   * @see rtems_bdbuf_fatal_code.
     52   */
     53  RTEMS_FATAL_SOURCE_BDBUF,
    4754
    4855  /**
Note: See TracChangeset for help on using the changeset viewer.