Implement HlIoPortInShort(), HlIoPortInLong(), HlIoPortOutShort() and HlIoPortOutLong() routines
Some checks failed
ci/woodpecker/push/build Pipeline failed

This commit is contained in:
Rafal Kupiec 2022-12-27 22:26:45 +01:00
parent 5c5f0a6df9
commit 9828b23400
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
4 changed files with 224 additions and 8 deletions

View File

@ -34,11 +34,29 @@ XTCDECL
UCHAR
HlIoPortInByte(IN USHORT Port);
XTCDECL
UCHAR
HlIoPortInShort(IN USHORT Port);
XTCDECL
UCHAR
HlIoPortInLong(IN USHORT Port);
XTCDECL
VOID
HlIoPortOutByte(IN USHORT Port,
IN UCHAR Data);
XTCDECL
VOID
HlIoPortOutShort(IN USHORT Port,
IN USHORT Value);
XTCDECL
VOID
HlIoPortOutLong(IN USHORT Port,
IN UINT Value);
XTCDECL
ULONG_PTR
HlReadControlRegister(IN USHORT ControlRegister);

View File

@ -34,11 +34,29 @@ XTCDECL
UCHAR
HlIoPortInByte(IN USHORT Port);
XTCDECL
UCHAR
HlIoPortInShort(IN USHORT Port);
XTCDECL
UCHAR
HlIoPortInLong(IN USHORT Port);
XTCDECL
VOID
HlIoPortOutByte(IN USHORT Port,
IN UCHAR Data);
XTCDECL
VOID
HlIoPortOutShort(IN USHORT Port,
IN USHORT Value);
XTCDECL
VOID
HlIoPortOutLong(IN USHORT Port,
IN UINT Value);
XTCDECL
ULONG_PTR
HlReadControlRegister(IN USHORT ControlRegister);

View File

@ -83,10 +83,10 @@ HlHalt()
}
/**
* Reads the data from the specified I/O port.
* Reads the 8-bit data from the specified I/O port.
*
* @param Port
* Specifies the port number in the range of 0-0xFFFF.
* Specifies the address to read from, in the range of 0-0xFFFF.
*
* @return The value read from the port.
*
@ -104,10 +104,52 @@ HlIoPortInByte(IN USHORT Port)
}
/**
* Writes the data to the specified I/O port.
* Reads the 16-bit data from the specified I/O port.
*
* @param Port
* Specifies the port number in the range of 0-0xFFFF.
* Specifies the address to read from, in the range of 0-0xFFFF.
*
* @return The value read from the port.
*
* @since XT 1.0
*/
XTCDECL
UCHAR
HlIoPortInShort(IN USHORT Port)
{
UCHAR Value;
asm volatile("inw %1, %0"
: "=a"(Value)
: "Nd"(Port));
return Value;
}
/**
* Reads the 32-bit data from the specified I/O port.
*
* @param Port
* Specifies the address to read from, in the range of 0-0xFFFF.
*
* @return The value read from the port.
*
* @since XT 1.0
*/
XTCDECL
UCHAR
HlIoPortInLong(IN USHORT Port)
{
UCHAR Value;
asm volatile("inl %1, %0"
: "=a"(Value)
: "Nd"(Port));
return Value;
}
/**
* Writes the 8-bit data to the specified I/O port.
*
* @param Port
* Specifies the address to write to, in the range of 0-0xFFFF.
*
* @param Value
* Supplies the value to write.
@ -127,6 +169,54 @@ HlIoPortOutByte(IN USHORT Port,
"Nd"(Port));
}
/**
* Writes the 16-bit data to the specified I/O port.
*
* @param Port
* Specifies the address to write to, in the range of 0-0xFFFF.
*
* @param Value
* Supplies the value to write.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL
VOID
HlIoPortOutShort(IN USHORT Port,
IN USHORT Value)
{
asm volatile("outw %0, %1"
:
: "a"(Value),
"Nd"(Port));
}
/**
* Writes the 32-bit data to the specified I/O port.
*
* @param Port
* Specifies the address to write to, in the range of 0-0xFFFF.
*
* @param Value
* Supplies the value to write.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL
VOID
HlIoPortOutLong(IN USHORT Port,
IN UINT Value)
{
asm volatile("outl %0, %1"
:
: "a"(Value),
"Nd"(Port));
}
/**
* Reads the specified CPU control register and returns its value.
*

View File

@ -83,10 +83,10 @@ HlHalt()
}
/**
* Reads the data from the specified I/O port.
* Reads the 8-bit data from the specified I/O port.
*
* @param Port
* Specifies the port number in the range of 0-0xFFFF.
* Specifies the address to read from, in the range of 0-0xFFFF.
*
* @return The value read from the port.
*
@ -104,10 +104,52 @@ HlIoPortInByte(IN USHORT Port)
}
/**
* Writes the data to the specified I/O port.
* Reads the 16-bit data from the specified I/O port.
*
* @param Port
* Specifies the port number in the range of 0-0xFFFF.
* Specifies the address to read from, in the range of 0-0xFFFF.
*
* @return The value read from the port.
*
* @since XT 1.0
*/
XTCDECL
UCHAR
HlIoPortInShort(IN USHORT Port)
{
UCHAR Value;
asm volatile("inw %1, %0"
: "=a"(Value)
: "Nd"(Port));
return Value;
}
/**
* Reads the 32-bit data from the specified I/O port.
*
* @param Port
* Specifies the address to read from, in the range of 0-0xFFFF.
*
* @return The value read from the port.
*
* @since XT 1.0
*/
XTCDECL
UCHAR
HlIoPortInLong(IN USHORT Port)
{
UCHAR Value;
asm volatile("inl %1, %0"
: "=a"(Value)
: "Nd"(Port));
return Value;
}
/**
* Writes the 8-bit data to the specified I/O port.
*
* @param Port
* Specifies the address to write to, in the range of 0-0xFFFF.
*
* @param Value
* Supplies the value to write.
@ -127,6 +169,54 @@ HlIoPortOutByte(IN USHORT Port,
"Nd"(Port));
}
/**
* Writes the 16-bit data to the specified I/O port.
*
* @param Port
* Specifies the address to write to, in the range of 0-0xFFFF.
*
* @param Value
* Supplies the value to write.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL
VOID
HlIoPortOutShort(IN USHORT Port,
IN USHORT Value)
{
asm volatile("outw %0, %1"
:
: "a"(Value),
"Nd"(Port));
}
/**
* Writes the 32-bit data to the specified I/O port.
*
* @param Port
* Specifies the address to write to, in the range of 0-0xFFFF.
*
* @param Value
* Supplies the value to write.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL
VOID
HlIoPortOutLong(IN USHORT Port,
IN UINT Value)
{
asm volatile("outl %0, %1"
:
: "a"(Value),
"Nd"(Port));
}
/**
* Reads the specified CPU control register and returns its value.
*