bsp/i386/pc686: Clean up warnings

This commit is contained in:
Chris Johns
2023-10-04 13:17:13 +11:00
parent a1fc6555a6
commit 25a4dff56e
13 changed files with 65 additions and 33 deletions

View File

@@ -42,7 +42,9 @@ extern "C" {
#include <bsp/irq_asm.h>
#include <rtems.h>
#ifndef BSP_SHARED_HANDLER_SUPPORT
#define BSP_SHARED_HANDLER_SUPPORT 1
#endif
#include <rtems/irq.h>
#include <rtems/irq-extension.h>

View File

@@ -94,7 +94,7 @@ typedef struct {
/*
* Register Access Routines
*/
static uint8_t xr17d15x_get_register(uint32_t addr, uint8_t i)
static uint8_t xr17d15x_get_register(uintptr_t addr, uint8_t i)
{
uint8_t val = 0;
volatile uint8_t *reg = (volatile uint8_t *)(addr + i);
@@ -104,7 +104,7 @@ static uint8_t xr17d15x_get_register(uint32_t addr, uint8_t i)
return val;
}
static void xr17d15x_set_register(uint32_t addr, uint8_t i, uint8_t val)
static void xr17d15x_set_register(uintptr_t addr, uint8_t i, uint8_t val)
{
volatile uint8_t *reg = (volatile uint8_t *)(addr + i);
@@ -187,7 +187,7 @@ rtems_device_driver exar17d15x_initialize(
printk(
"Found Exar 17D15x %d at 0x%08lx IRQ %d with %d ports\n",
instance,
conf[instance].base,
(uintptr_t) conf[instance].base,
conf[instance].irq,
conf[instance].ports
);

View File

@@ -63,6 +63,17 @@
#define FB_VESA_NAME "FB_VESA_RM"
/*
* GCC complains that access to packed data may not be aligned and
* fair enough. The warning is:
*
* warning: taking address of packed member of 'struct <anonymous>' may
* result in an unaligned pointer value [-Waddress-of-packed-member]
*
* Disable the warning.
*/
#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
/**
* @brief Allows to enable initialization of VESA real mode driver from
* an application by setting the value of this variable to non null value in
@@ -788,7 +799,7 @@ void vesa_realmode_bootup_init(void)
(vbe_ret_val>>8)!=VBE_callSuccessful)
{
printk(FB_VESA_NAME " Cannot get mode info anymore. ax=0x%lx\n",
vbe_ret_val);
(uintptr_t) vbe_ret_val);
}
fb_var.xres = mib->XResolution;
@@ -970,9 +981,9 @@ frame_buffer_control(
{
rtems_libio_ioctl_args_t *args = arg;
printk( FB_VESA_NAME " ioctl called, cmd=%" PRIx32 "\n", args->command );
printk("fbxres %lu, fbyres %lu\n", fb_var.xres, fb_var.yres);
printk("fbbpp %lu\n", fb_var.bits_per_pixel);
printk( FB_VESA_NAME " ioctl called, cmd=%lx\n", (uintptr_t) args->command );
printk("fbxres %d, fbyres %d\n", (int) fb_var.xres, (int) fb_var.yres);
printk("fbbpp %d\n", (int) fb_var.bits_per_pixel);
switch (args->command)
{

View File

@@ -502,7 +502,7 @@ getpacket (char *buffer)
count = 0;
/* now, read until a # or end of buffer is found */
while (count < BUFMAX)
while (count < (BUFMAX - 1))
{
ch = getDebugChar () & 0x7f;
if (ch == '#')

View File

@@ -283,7 +283,13 @@ static int escaped = 0;
void
_IBMPC_initVideo(void)
{
unsigned char* pt = (unsigned char*) (VIDEO_MODE_ADDR);
/*
* See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578#c16
*/
unsigned char* volatile pt = (unsigned char*) (VIDEO_MODE_ADDR);
unsigned short* volatile crt_base = (unsigned short*) DISPLAY_CRT_BASE_IO_ADDR;
uint8_t* volatile nb_max_row = (uint8_t*) NB_MAX_ROW_ADDR;
uint16_t* volatile nb_max_col = (uint16_t*) NB_MAX_COL_ADDR;
if (*pt == VGAMODE7) {
bitMapBaseAddr = (unsigned short*) V_MONO;
@@ -291,9 +297,9 @@ _IBMPC_initVideo(void)
else {
bitMapBaseAddr = (unsigned short*) V_COLOR;
}
ioCrtBaseAddr = *(unsigned short*) DISPLAY_CRT_BASE_IO_ADDR;
maxCol = * (unsigned short*) NB_MAX_COL_ADDR;
maxRow = * (unsigned char*) NB_MAX_ROW_ADDR;
ioCrtBaseAddr = *crt_base;
maxCol = *nb_max_col;
maxRow = *nb_max_row;
column = 0;
row = 0;
attribute = ((BLACK << 4) | WHITE)<<8;

View File

@@ -49,7 +49,7 @@
#define RTD_CLOCK_RATE (460800 * 32)
uint8_t rtd316_com_get_register(uint32_t addr, uint8_t reg)
uint8_t rtd316_com_get_register(uintptr_t addr, uint8_t reg)
{
register uint8_t val = 0;
@@ -60,7 +60,7 @@ uint8_t rtd316_com_get_register(uint32_t addr, uint8_t reg)
return val;
}
void rtd316_com_set_register(uint32_t addr,uint8_t reg, uint8_t val)
void rtd316_com_set_register(uintptr_t addr, uint8_t reg, uint8_t val)
{
outport_byte( addr, reg );
/* It appears the no delay is needed between the accesses. */

View File

@@ -264,8 +264,8 @@ conSetAttr(int port, int minor, const struct termios *t)
stopbits = 0;
}
printk("Setting attributes, port=%X, baud=%" PRId32 ", linemode = 0x%02" PRIx32 "\n",
port, baud, databits | parity | stopbits );
printk("Setting attributes, port=%X, baud=%d, linemode = 0x%02x\n",
port, (int) baud, (int) (databits | parity | stopbits) );
BSP_uart_set_attributes(port, baud, databits, parity, stopbits);
return 0;
}

View File

@@ -260,7 +260,7 @@ typedef struct {
#define UART_PCI_IO (0)
static uint8_t pci_ns16550_mem_get_register(uint32_t addr, uint8_t i)
static uint8_t pci_ns16550_mem_get_register(uintptr_t addr, uint8_t i)
{
uint8_t val = 0;
volatile uint32_t *reg = (volatile uint32_t *)(addr + (i*4));
@@ -270,7 +270,7 @@ static uint8_t pci_ns16550_mem_get_register(uint32_t addr, uint8_t i)
return val;
}
static void pci_ns16550_mem_set_register(uint32_t addr, uint8_t i, uint8_t val)
static void pci_ns16550_mem_set_register(uintptr_t addr, uint8_t i, uint8_t val)
{
volatile uint32_t *reg = (volatile uint32_t *)(addr + (i*4));
if (UART_PCI_IO)
@@ -281,7 +281,7 @@ static void pci_ns16550_mem_set_register(uint32_t addr, uint8_t i, uint8_t val)
/*
* IO Register Access Routines
*/
static uint8_t pci_ns16550_io_get_register(uint32_t addr, uint8_t i)
static uint8_t pci_ns16550_io_get_register(uintptr_t addr, uint8_t i)
{
uint8_t val = rtems_inb(addr + i);
if (UART_PCI_IO)
@@ -289,7 +289,7 @@ static uint8_t pci_ns16550_io_get_register(uint32_t addr, uint8_t i)
return val;
}
static void pci_ns16550_io_set_register(uint32_t addr, uint8_t i, uint8_t val)
static void pci_ns16550_io_set_register(uintptr_t addr, uint8_t i, uint8_t val)
{
if (UART_PCI_IO)
printk( "WR(%p <- 0x%02x) ", (void*) addr + i, val );
@@ -452,11 +452,11 @@ void pci_uart_probe(void)
port_p->ulIntVector = conf[b].irq;
printk(
"%s:%d:%s,%s:0x%lx%s%s,irq:%d,clk:%lu\n", /* */
printk(
"%s:%d:%s,%s:0x%lx%s%s,irq:%d,clk:%lu\n", /* */
name, b, conf[b].desc,
io ? "io" : "mem", base, locatable, prefectable,
conf[b].irq, conf[b].clock
io ? "io" : "mem", (uintptr_t) base, locatable, prefectable,
conf[b].irq, (uintptr_t) conf[b].clock
);

View File

@@ -170,8 +170,12 @@ bool vgacons_probe(
rtems_status_code status;
static bool firstTime = true;
if ((*(unsigned char*) NB_MAX_ROW_ADDR == 0) &&
(*(unsigned short*)NB_MAX_COL_ADDR == 0)) {
/*
* See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578#c16
*/
const uint8_t* volatile nb_max_row = (const uint8_t*) NB_MAX_ROW_ADDR;
const uint16_t* volatile nb_max_col = (const uint16_t*) NB_MAX_COL_ADDR;
if ((*nb_max_row == 0) && (*nb_max_col == 0)) {
return false;
}

View File

@@ -76,7 +76,7 @@ rtems_device_driver rtd316_initialize(
*
* @return This method returns the value of the register.
*/
uint8_t rtd316_com_get_register(uint32_t addr, uint8_t reg);
uint8_t rtd316_com_get_register(uintptr_t addr, uint8_t reg);
/**
* @brief RTD316 Set Register Helper
@@ -86,7 +86,7 @@ uint8_t rtd316_com_get_register(uint32_t addr, uint8_t reg);
* @param[in] addr is the base address
* @param[in] reg is the register number
*/
void rtd316_com_set_register(uint32_t addr,uint8_t reg, uint8_t val);
void rtd316_com_set_register(uintptr_t addr,uint8_t reg, uint8_t val);
#ifdef __cplusplus
}

View File

@@ -27,7 +27,7 @@
#define MUST_WAIT_FOR_INTERRUPT 0
#define Install_tm27_vector(handler)
#define Install_tm27_vector(handler) (void) handler
#define Cause_tm27_intr() __asm__ volatile("int $0x90" : :);

View File

@@ -89,7 +89,16 @@ typedef struct {
*
* @note Struct members not necessarily used in C. This serves also as
* layout of memory and it is used within inline assembler.
*
* @note GCC complains that access to packed data may not be aligned and
* fair enough. The warning is:
*
* warning: taking address of packed member of 'struct <anonymous>' may
* result in an unaligned pointer value [-Waddress-of-packed-member]
*
* Disable the warning.
*/
#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
typedef struct {
/** spot for backup protected mode interrupt descriptor table register */
uint16_t idtr_lim_bkp;

View File

@@ -2,9 +2,9 @@
/**
* @file
*
*
* @brief Intel I386 CPU Dependent Source
*
*
* This include file contains information pertaining to the Intel
* i386 processor.
*/
@@ -51,7 +51,7 @@ extern "C" {
#include <rtems/score/paravirt.h>
#endif
#include <rtems/score/i386.h>
/**
* @defgroup RTEMSScoreCPUi386 i386 Specific Support
*
@@ -163,7 +163,7 @@ typedef struct {
} Context_Control;
#define _CPU_Context_Get_SP( _context ) \
(_context)->esp
(uintptr_t) (_context)->esp
#ifdef RTEMS_SMP
static inline bool _CPU_Context_Get_is_executing(