Browse Source

Kernel: Specify I/O size for BMIDEChannel

Gunnar Beutner 4 years ago
parent
commit
a0c1af4327
2 changed files with 3 additions and 1 deletions
  1. 2 0
      Kernel/IO.h
  2. 1 1
      Kernel/Storage/BMIDEChannel.cpp

+ 2 - 0
Kernel/IO.h

@@ -82,6 +82,7 @@ public:
     template<typename T>
     template<typename T>
     ALWAYS_INLINE T in()
     ALWAYS_INLINE T in()
     {
     {
+        static_assert(sizeof(T) <= 4);
         if constexpr (sizeof(T) == 4)
         if constexpr (sizeof(T) == 4)
             return IO::in32(get());
             return IO::in32(get());
         if constexpr (sizeof(T) == 2)
         if constexpr (sizeof(T) == 2)
@@ -94,6 +95,7 @@ public:
     template<typename T>
     template<typename T>
     ALWAYS_INLINE void out(T value)
     ALWAYS_INLINE void out(T value)
     {
     {
+        static_assert(sizeof(T) <= 4);
         if constexpr (sizeof(T) == 4) {
         if constexpr (sizeof(T) == 4) {
             IO::out32(get(), value);
             IO::out32(get(), value);
             return;
             return;

+ 1 - 1
Kernel/Storage/BMIDEChannel.cpp

@@ -212,7 +212,7 @@ void BMIDEChannel::ata_read_sectors(bool slave_request, u16 capabilities)
     m_io_group.bus_master_base().value().out<u8>(0);
     m_io_group.bus_master_base().value().out<u8>(0);
 
 
     // Write the PRDT location
     // Write the PRDT location
-    m_io_group.bus_master_base().value().offset(4).out(m_prdt_page->paddr().get());
+    m_io_group.bus_master_base().value().offset(4).out<u32>(m_prdt_page->paddr().get());
 
 
     // Set transfer direction
     // Set transfer direction
     m_io_group.bus_master_base().value().out<u8>(0x8);
     m_io_group.bus_master_base().value().out<u8>(0x8);