buffer: bugfixes and cleanups

- Added clarifying comments regarding the different offsets
- Fixed an instance in wraparoundRead where we updated the readPtr
  with the relative offset
- Added additional checks in initialization to check for buffer size
- Use the queueSize for buffer initialization opposed to the memory
  region size for the whole MMIO

Tested: Unit tested

Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: Ib175ed1c9c129c0f9d2b4f9737e2d394f160434d
diff --git a/include/buffer.hpp b/include/buffer.hpp
index 240845c..7738339 100644
--- a/include/buffer.hpp
+++ b/include/buffer.hpp
@@ -105,14 +105,16 @@
 
     /**
      * Write to the bufferHeader and update the read pointer
-     * @param[in] newReadPtr - read pointer to update to
+     * @param[in] newReadPtr - read pointer to update to.
+     *  "readPtr"s (including this one) are offset relative to the "Error Log
+     *  Queue region" = (sizeof(CircularBufferHeader) + UE reserved region)
      */
     virtual void updateReadPtr(const uint32_t newReadPtr) = 0;
 
     /**
      * Wrapper for the dataInterface->read, performs wraparound read
      *
-     * @param[in] offset - offset to read from
+     * @param[in] offset - offset relative to the beginning of MMIO space
      * @param[in] length - bytes to read
      * @param[in] additionalBoundaryCheck - bytes to add to the boundary check
      * for added restriction
@@ -124,7 +126,7 @@
     /**
      * Read the entry header from shared buffer
      *
-     * @param[in] offset - offset to read from
+     * @param[in] offset - offset relative to the beginning of MMIO space
      * @return the entry header
      */
     virtual struct QueueEntryHeader readEntryHeader(size_t offset) = 0;
@@ -132,7 +134,7 @@
     /**
      * Read the queue entry from the error log queue
      *
-     * @param[in] offset - offset to read from
+     * @param[in] offset - offset relative to the beginning of MMIO space
      * @return entry header and entry pair read from buffer
      */
     virtual EntryPair readEntry(size_t offset) = 0;