Signed-off-by: Fotis Xenakis <[email protected]>
---
 drivers/pci-function.cc | 31 +++++++++++++------------------
 drivers/pci-function.hh | 19 ++++++++-----------
 2 files changed, 21 insertions(+), 29 deletions(-)

diff --git a/drivers/pci-function.cc b/drivers/pci-function.cc
index ac585bc6..369f22e9 100644
--- a/drivers/pci-function.cc
+++ b/drivers/pci-function.cc
@@ -20,16 +20,6 @@ namespace pci {
           _addr_lo(0), _addr_hi(0), _addr_64(0), _addr_size(0),
           _addr_mmio(mmio_nullptr),
           _is_mmio(false), _is_64(false), _is_prefetchable(false)
-    {
-        init();
-    }
-
-    bar::~bar()
-    {
-
-    }
-
-    void bar::init()
     {
         u32 val = _dev->pci_readl(_pos);
 
@@ -56,6 +46,11 @@ namespace pci {
         _addr_64 = ((u64)_addr_hi << 32) | (u64)(_addr_lo);
     }
 
+    bar::~bar()
+    {
+
+    }
+
     u64 bar::read_bar_size()
     {
         u32 lo_orig = _dev->pci_readl(_pos);
@@ -110,7 +105,7 @@ namespace pci {
         return _addr_mmio;
     }
 
-    u64 bar::readq(u32 offset)
+    u64 bar::readq(u64 offset)
     {
         if (_is_mmio) {
             return mmio_getq(_addr_mmio + offset);
@@ -119,7 +114,7 @@ namespace pci {
         }
     }
 
-    u32 bar::readl(u32 offset)
+    u32 bar::readl(u64 offset)
     {
         if (_is_mmio) {
             return mmio_getl(_addr_mmio + offset);
@@ -128,7 +123,7 @@ namespace pci {
         }
     }
 
-    u16 bar::readw(u32 offset)
+    u16 bar::readw(u64 offset)
     {
         if (_is_mmio) {
             return mmio_getw(_addr_mmio + offset);
@@ -137,7 +132,7 @@ namespace pci {
         }
     }
 
-    u8 bar::readb(u32 offset)
+    u8 bar::readb(u64 offset)
     {
         if (_is_mmio) {
             return mmio_getb(_addr_mmio + offset);
@@ -146,7 +141,7 @@ namespace pci {
         }
     }
 
-    void bar::writeq(u32 offset, u64 val)
+    void bar::writeq(u64 offset, u64 val)
     {
         if (_is_mmio) {
             mmio_setq(_addr_mmio + offset, val);
@@ -155,7 +150,7 @@ namespace pci {
         }
     }
 
-    void bar::writel(u32 offset, u32 val)
+    void bar::writel(u64 offset, u32 val)
     {
         if (_is_mmio) {
             mmio_setl(_addr_mmio + offset, val);
@@ -164,7 +159,7 @@ namespace pci {
         }
     }
 
-    void bar::writew(u32 offset, u16 val)
+    void bar::writew(u64 offset, u16 val)
     {
         if (_is_mmio) {
             mmio_setw(_addr_mmio + offset, val);
@@ -173,7 +168,7 @@ namespace pci {
         }
     }
 
-    void bar::writeb(u32 offset, u8 val)
+    void bar::writeb(u64 offset, u8 val)
     {
         if (_is_mmio) {
             mmio_setb(_addr_mmio + offset, val);
diff --git a/drivers/pci-function.hh b/drivers/pci-function.hh
index 06ec96f6..59d57a1e 100644
--- a/drivers/pci-function.hh
+++ b/drivers/pci-function.hh
@@ -77,19 +77,16 @@ namespace pci {
         mmioaddr_t get_mmio();
 
         // Access the pio or mmio bar
-        u64 readq(u32 offset);
-        u32 readl(u32 offset);
-        u16 readw(u32 offset);
-        u8 readb(u32 offset);
-        void writeq(u32 offset, u64 val);
-        void writel(u32 offset, u32 val);
-        void writew(u32 offset, u16 val);
-        void writeb(u32 offset, u8 val);
+        u64 readq(u64 offset);
+        u32 readl(u64 offset);
+        u16 readw(u64 offset);
+        u8 readb(u64 offset);
+        void writeq(u64 offset, u64 val);
+        void writel(u64 offset, u32 val);
+        void writew(u64 offset, u16 val);
+        void writeb(u64 offset, u8 val);
 
     private:
-
-        void init();
-
         /* Architecture-specific hook on bar creation, which allows
          * rewriting the bar registers. Returns the bar register.
          */
-- 
2.25.1

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/VI1PR03MB4383D028B2BD9554569BFE69A6E10%40VI1PR03MB4383.eurprd03.prod.outlook.com.

Reply via email to