mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
Remove the assumption that a bus_space_handle_t is an I/O address
from the SAB82532 and the Z8530 hardware drivers by introducing uart_cpu_busaddr(). The assumption is not true on pc98 where bus_space_handle_t is a pointer to a structure. The uart_cpu_busaddr() function will return the bus address corresponding the tag and handle given to it by the BAS. WARNING: the intend of the function is STRICTLY to allow hardware drivers to determine which logical channel they control and is NOT to be used for actual I/O. It is therefore EXPLICITLY allowed that uart_cpu_busaddr() returns only the lower 8 bits of the address and garbage in all other bits. No mistakes...
This commit is contained in:
parent
5abd21e1e6
commit
5cc705512d
9 changed files with 91 additions and 48 deletions
|
|
@ -67,8 +67,9 @@ struct uart_devinfo {
|
|||
void *cookie; /* Type dependent use. */
|
||||
};
|
||||
|
||||
int uart_cpu_getdev(int devtype, struct uart_devinfo *di);
|
||||
int uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2);
|
||||
bus_addr_t uart_cpu_busaddr(struct uart_bas *);
|
||||
int uart_cpu_eqres(struct uart_bas *, struct uart_bas *);
|
||||
int uart_cpu_getdev(int, struct uart_devinfo *);
|
||||
|
||||
void uart_add_sysdev(struct uart_devinfo*);
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,20 @@ __FBSDID("$FreeBSD$");
|
|||
#include <dev/uart/uart.h>
|
||||
#include <dev/uart/uart_cpu.h>
|
||||
|
||||
bus_addr_t
|
||||
uart_cpu_busaddr(struct uart_bas *bas)
|
||||
{
|
||||
|
||||
return (bas->bsh);
|
||||
}
|
||||
|
||||
int
|
||||
uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
|
||||
{
|
||||
|
||||
return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0);
|
||||
}
|
||||
|
||||
int
|
||||
uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
||||
{
|
||||
|
|
@ -102,10 +116,3 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
|||
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
int
|
||||
uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
|
||||
{
|
||||
|
||||
return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,20 @@ __FBSDID("$FreeBSD$");
|
|||
#include <dev/uart/uart.h>
|
||||
#include <dev/uart/uart_cpu.h>
|
||||
|
||||
bus_addr_t
|
||||
uart_cpu_busaddr(struct uart_bas *bas)
|
||||
{
|
||||
|
||||
return (bas->bsh);
|
||||
}
|
||||
|
||||
int
|
||||
uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
|
||||
{
|
||||
|
||||
return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0);
|
||||
}
|
||||
|
||||
int
|
||||
uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
||||
{
|
||||
|
|
@ -83,10 +97,3 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
|||
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
int
|
||||
uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
|
||||
{
|
||||
|
||||
return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,20 @@ __FBSDID("$FreeBSD$");
|
|||
#include <dev/uart/uart.h>
|
||||
#include <dev/uart/uart_cpu.h>
|
||||
|
||||
bus_addr_t
|
||||
uart_cpu_busaddr(struct uart_bas *bas)
|
||||
{
|
||||
|
||||
return (bas->bsh);
|
||||
}
|
||||
|
||||
int
|
||||
uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
|
||||
{
|
||||
|
||||
return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0);
|
||||
}
|
||||
|
||||
int
|
||||
uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
||||
{
|
||||
|
|
@ -83,10 +97,3 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
|||
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
int
|
||||
uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
|
||||
{
|
||||
|
||||
return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,20 @@ static int dig64_to_uart_parity[] = {
|
|||
UART_PARITY_ODD, UART_PARITY_MARK, UART_PARITY_SPACE
|
||||
};
|
||||
|
||||
bus_addr_t
|
||||
uart_cpu_busaddr(struct uart_bas *bas)
|
||||
{
|
||||
|
||||
return (bas->bsh);
|
||||
}
|
||||
|
||||
int
|
||||
uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
|
||||
{
|
||||
|
||||
return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0);
|
||||
}
|
||||
|
||||
int
|
||||
uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
||||
{
|
||||
|
|
@ -130,10 +144,3 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
|||
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
int
|
||||
uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
|
||||
{
|
||||
|
||||
return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,20 @@ __FBSDID("$FreeBSD$");
|
|||
#include <dev/uart/uart.h>
|
||||
#include <dev/uart/uart_cpu.h>
|
||||
|
||||
bus_addr_t
|
||||
uart_cpu_busaddr(struct uart_bas *bas)
|
||||
{
|
||||
|
||||
return (bas->bsh->bsh_base);
|
||||
}
|
||||
|
||||
int
|
||||
uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
|
||||
{
|
||||
|
||||
return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0);
|
||||
}
|
||||
|
||||
int
|
||||
uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
||||
{
|
||||
|
|
@ -87,10 +101,3 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
|||
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
int
|
||||
uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
|
||||
{
|
||||
|
||||
return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,20 @@ uart_cpu_channel(char *dev)
|
|||
return (alias[len - 1] - 'a');
|
||||
}
|
||||
|
||||
bus_addr_t
|
||||
uart_cpu_busaddr(struct uart_bas *bas)
|
||||
{
|
||||
|
||||
return (bas->bsh);
|
||||
}
|
||||
|
||||
int
|
||||
uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
|
||||
{
|
||||
|
||||
return ((b1->bsh == b2->bsh) ? 1 : 0);
|
||||
}
|
||||
|
||||
int
|
||||
uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
||||
{
|
||||
|
|
@ -147,10 +161,3 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
|||
(par == 'o') ? UART_PARITY_ODD : UART_PARITY_EVEN;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
|
||||
{
|
||||
|
||||
return ((b1->bsh == b2->bsh) ? 1 : 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ __FBSDID("$FreeBSD$");
|
|||
|
||||
#define DEFAULT_RCLK 29491200
|
||||
|
||||
#define IS_CHANNEL_A(bas) (((bas)->bsh & 0x40) == 0x00)
|
||||
#define IS_CHANNEL_B(bas) (((bas)->bsh & 0x40) == 0x40)
|
||||
#define IS_CHANNEL_A(bas) ((uart_cpu_busaddr(bas) & 0x40) == 0x00)
|
||||
#define IS_CHANNEL_B(bas) ((uart_cpu_busaddr(bas) & 0x40) == 0x40)
|
||||
|
||||
/*
|
||||
* NOTE: To allow us to read the baudrate divisor from the chip, we
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ __FBSDID("$FreeBSD$");
|
|||
|
||||
#define DEFAULT_RCLK 307200
|
||||
|
||||
#define IS_CHANNEL_A(bas) (((bas)->bsh & 7) != 0)
|
||||
#define IS_CHANNEL_B(bas) (((bas)->bsh & 7) == 0)
|
||||
#define IS_CHANNEL_A(bas) ((uart_cpu_busaddr(bas) & 7) != 0)
|
||||
#define IS_CHANNEL_B(bas) ((uart_cpu_busaddr(bas) & 7) == 0)
|
||||
|
||||
/* Multiplexed I/O. */
|
||||
static __inline void
|
||||
|
|
|
|||
Loading…
Reference in a new issue