static void write_reg(int function, int index, u32_t value);
static void init_domain(int index);
static void init_map(unsigned int ix);
-static int do_add4pci(message *m);
+static int do_add4pci(const message *m);
static void add_range(phys_bytes busaddr, phys_bytes size);
static void del_range(phys_bytes busaddr, phys_bytes size);
static void report_exceptions(void);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
+PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the amddev driver. */
int r, n_maps, n_domains, revision;
-static int do_add4pci(message *m)
+static int do_add4pci(const message *m)
{
int r, pci_bus, pci_dev, pci_func;
endpoint_t proc;
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
+PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the at_wini driver. */
system_hz = sys_hz();
/*===========================================================================*
* do_transfer *
*===========================================================================*/
-PRIVATE int do_transfer(struct wini *wn, unsigned int precomp,
+PRIVATE int do_transfer(const struct wini *wn, unsigned int precomp,
unsigned int count, unsigned int sector,
unsigned int opcode, int do_dma)
{
return com_out(&cmd);
}
-PRIVATE void stop_dma(struct wini *wn)
+PRIVATE void stop_dma(const struct wini *wn)
{
int r;
if (r != 0) panic("stop_dma: sys_outb failed: %d", r);
}
-PRIVATE void start_dma(struct wini *wn, int do_write)
+PRIVATE void start_dma(const struct wini *wn, int do_write)
{
u32_t v;
int r;
if (r != 0) panic("start_dma: sys_outb failed: %d", r);
}
-PRIVATE int error_dma(struct wini *wn)
+PRIVATE int error_dma(const struct wini *wn)
{
int r;
u32_t v;
/*===========================================================================*
* atl2_readv *
*===========================================================================*/
-PRIVATE void atl2_readv(message *m, int from_int)
+PRIVATE void atl2_readv(const message *m, int from_int)
{
/* Read packet data.
*/
/*===========================================================================*
* atl2_writev *
*===========================================================================*/
-PRIVATE void atl2_writev(message *m, int from_int)
+PRIVATE void atl2_writev(const message *m, int from_int)
{
/* Write packet data.
*/
/*===========================================================================*
* atl2_intr *
*===========================================================================*/
-PRIVATE void atl2_intr(message *m)
+PRIVATE void atl2_intr(const message *m)
{
/* Interrupt received.
*/
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
+PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the atl2 driver.
*/
FORWARD _PROTOTYPE( int msg_open, (int minor_dev_nr) );
FORWARD _PROTOTYPE( int msg_close, (int minor_dev_nr) );
-FORWARD _PROTOTYPE( int msg_ioctl, (message *m_ptr) );
-FORWARD _PROTOTYPE( void msg_write, (message *m_ptr) );
+FORWARD _PROTOTYPE( int msg_ioctl, (const message *m_ptr) );
+FORWARD _PROTOTYPE( void msg_write, (const message *m_ptr) );
FORWARD _PROTOTYPE( void msg_read, (message *m_ptr) );
FORWARD _PROTOTYPE( void msg_hardware, (void) );
FORWARD _PROTOTYPE( void msg_status, (message *m_ptr) );
/* initialize hardware*/
if (drv_init_hw() != OK) {
- error("%s: Could not initialize hardware\n", drv.DriverName, 0);
+ error("%s: Could not initialize hardware\n", drv.DriverName);
return EIO;
}
/* get irq from device driver...*/
if (drv_get_irq(&irq) != OK) {
- error("%s: init driver couldn't get IRQ", drv.DriverName, i);
+ error("%s: init driver couldn't get IRQ", drv.DriverName);
return EIO;
}
- /* todo: execute the rest of this function only once
+ /* TODO: execute the rest of this function only once
we don't want to set irq policy twice */
if (executed) return OK;
executed = TRUE;
}
-PRIVATE int msg_ioctl(message *m_ptr)
+PRIVATE int msg_ioctl(const message *m_ptr)
{
int status, len, chan;
sub_dev_t *sub_dev_ptr;
}
-PRIVATE void msg_write(message *m_ptr)
+PRIVATE void msg_write(const message *m_ptr)
{
int chan; sub_dev_t *sub_dev_ptr;
special_file_t* special_file_ptr;
/* reg(n) will be the device specific addresses */
-#define reg(n) dev.base + n
+#define reg(n) (dev.base + (n))
/* prototypes of private functions */
FORWARD _PROTOTYPE( int AC97_read,
(DEV_STRUCT * pCC, u16_t wAddr, u16_t *data) );
FORWARD _PROTOTYPE( int AC97_write,
- (DEV_STRUCT * pCC, u16_t wAddr, u16_t wData) );
+ (const DEV_STRUCT * pCC, u16_t wAddr, u16_t wData) );
FORWARD _PROTOTYPE( void set_src_sync_state, (int state) );
FORWARD _PROTOTYPE( int AC97_write_unsynced,
- (DEV_STRUCT * pCC, u16_t wAddr, u16_t wData) );
+ (const DEV_STRUCT * pCC, u16_t wAddr, u16_t wData) );
FORWARD _PROTOTYPE( int AC97_read_unsynced,
- (DEV_STRUCT * pCC, u16_t wAddr, u16_t *data) );
+ (const DEV_STRUCT * pCC, u16_t wAddr, u16_t *data) );
FORWARD _PROTOTYPE( void set_nice_volume, (void) );
FORWARD _PROTOTYPE( int AC97_get_volume, (struct volume_level *level) );
-FORWARD _PROTOTYPE( int AC97_set_volume, (struct volume_level *level) );
+FORWARD _PROTOTYPE( int AC97_set_volume, (const struct volume_level *level) );
}
-PRIVATE int AC97_write (DEV_STRUCT * pCC, u16_t wAddr, u16_t wData)
+PRIVATE int AC97_write (const DEV_STRUCT * pCC, u16_t wAddr, u16_t wData)
{
u32_t dtemp, i;
u16_t wBaseAddr = pCC->base;
}
-PRIVATE int AC97_write_unsynced (DEV_STRUCT * pCC, u16_t wAddr, u16_t wData)
+PRIVATE int AC97_write_unsynced (const DEV_STRUCT * pCC, u16_t wAddr,
+ u16_t wData)
{
/* wait for WIP to go away */
if (WaitBitd (pCC->base + CODEC_READ, 30, 0, WIP_TIMEOUT))
}
-PRIVATE int AC97_read_unsynced (DEV_STRUCT * pCC, u16_t wAddr, u16_t *data)
+PRIVATE int AC97_read_unsynced (const DEV_STRUCT * pCC, u16_t wAddr,
+ u16_t *data)
{
u32_t dtemp;
}
-PRIVATE int AC97_set_volume(struct volume_level *level) {
+PRIVATE int AC97_set_volume(const struct volume_level *level) {
int cmd;
int left;
int right;
-FORWARD _PROTOTYPE( int src_reg_read, (DEV_STRUCT * DSP,
+FORWARD _PROTOTYPE( int src_reg_read, (const DEV_STRUCT * DSP,
u16_t reg, u16_t *data) );
-FORWARD _PROTOTYPE( int src_reg_write, (DEV_STRUCT * DSP,
+FORWARD _PROTOTYPE( int src_reg_write, (const DEV_STRUCT * DSP,
u16_t reg, u16_t val) );
}
-PRIVATE int src_reg_read(DEV_STRUCT * DSP, u16_t reg, u16_t *data) {
+PRIVATE int src_reg_read(const DEV_STRUCT * DSP, u16_t reg, u16_t *data) {
u32_t dtemp;
/* wait for ready */
}
-PRIVATE int src_reg_write(DEV_STRUCT * DSP, u16_t reg, u16_t val) {
+PRIVATE int src_reg_write(const DEV_STRUCT * DSP, u16_t reg, u16_t val) {
u32_t dtemp;
/* wait for ready */
PUBLIC int sb16_inb(int port) {
- int s, value = -1;
+ int s;
+ unsigned long value;
if ((s=sys_inb(port, &value)) != OK)
panic("sys_inb() failed: %d", s);
- return value;
+ return (int) value;
}
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
+PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the bios_wini driver. */
long v;
_PROTOTYPE( PRIVATE u32_t io_inl, (u16_t); );
_PROTOTYPE( PRIVATE void io_outl, (u16_t, u32_t); );
-_PROTOTYPE( PRIVATE void do_conf, (message *); );
+_PROTOTYPE( PRIVATE void do_conf, (const message *); );
_PROTOTYPE( PRIVATE void do_get_name, (message *); );
_PROTOTYPE( PRIVATE void do_get_stat_s, (message *); );
_PROTOTYPE( PRIVATE void do_interrupt, (dpeth_t *); );
_PROTOTYPE( PRIVATE void do_reply, (dpeth_t *, int, int); );
-_PROTOTYPE( PRIVATE void do_vread_s, (message *, int); );
+_PROTOTYPE( PRIVATE void do_vread_s, (const message *, int); );
_PROTOTYPE( PRIVATE void do_watchdog, (void *); );
_PROTOTYPE( PRIVATE void de_update_conf, (dpeth_t *); );
_PROTOTYPE( PRIVATE int de_probe, (dpeth_t *); );
_PROTOTYPE( PRIVATE void de_conf_addr, (dpeth_t *); );
_PROTOTYPE( PRIVATE void de_first_init, (dpeth_t *); );
-_PROTOTYPE( PRIVATE void de_reset, (dpeth_t *); );
-_PROTOTYPE( PRIVATE void de_hw_conf, (dpeth_t *); );
-_PROTOTYPE( PRIVATE void de_start, (dpeth_t *); );
+_PROTOTYPE( PRIVATE void de_reset, (const dpeth_t *); );
+_PROTOTYPE( PRIVATE void de_hw_conf, (const dpeth_t *); );
+_PROTOTYPE( PRIVATE void de_start, (const dpeth_t *); );
_PROTOTYPE( PRIVATE void de_setup_frame, (dpeth_t *); );
_PROTOTYPE( PRIVATE u16_t de_read_rom, (dpeth_t *, u8_t, u8_t); );
_PROTOTYPE( PRIVATE int de_calc_iov_size, (iovec_dat_s_t *); );
_PROTOTYPE( PRIVATE void de_next_iov, (iovec_dat_s_t *); );
-_PROTOTYPE( PRIVATE void do_vwrite_s, (message *, int); );
+_PROTOTYPE( PRIVATE void do_vwrite_s, (const message *, int); );
_PROTOTYPE( PRIVATE void de_get_userdata_s, (int, cp_grant_id_t,
vir_bytes, int, void *); );
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
+PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the DEC 21140A driver. */
int r;
(progname=strrchr(env_argv[0],'/')) ? progname++ : (progname=env_argv[0]);
/* Request function key for debug dumps */
- fkeys = sfkeys = 0; bit_set(sfkeys, DE_FKEY);
+ fkeys = sfkeys = 0;
+ bit_set(sfkeys, DE_FKEY);
if ((fkey_map(&fkeys, &sfkeys)) != OK)
printf("%s: error using Shift+F%d key(%d)\n", str_DevName, DE_FKEY, errno);
dep = &de_table[port];
dep->de_client = mp->DL_PROC;
- if ((rc = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0,
+ if ((rc = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0UL,
(vir_bytes)&dep->de_stat,
- (vir_bytes) sizeof(dep->de_stat), 0)) != OK)
+ sizeof(dep->de_stat), 0)) != OK)
panic(str_CopyErrMsg, rc);
mp->m_type = DL_STAT_REPLY;
return;
}
-PRIVATE void do_conf(message * mp)
+PRIVATE void do_conf(const message * mp)
{
- int port;
+ int port = mp->DL_PORT;
dpeth_t *dep;
message reply_mess;
- port = mp->DL_PORT;
if (port >= 0 && port < DE_PORT_NR) {
dep = &de_table[port];
default: break;
}
- } else /* Port number is out of range */
+ } else { /* Port number is out of range */
port = ENXIO;
+ }
reply_mess.m_type = DL_CONF_REPLY;
reply_mess.m3_i1 = port;
reply_mess.m3_i2 = DE_PORT_NR;
- *(ether_addr_t *) reply_mess.m3_ca1 = dep->de_address;
+ /* FIXME: if port number is out of range, this uses
+ * uninitialized variable 'dep'.
+ */
+ *(ether_addr_t *) reply_mess.m3_ca1 = dep->de_address;
if (send(mp->m_source, &reply_mess) != OK)
panic(str_SendErrMsg, mp->m_source);
return;
}
-PRIVATE void do_watchdog(void *message)
+PRIVATE void do_watchdog(void *UNUSED(message))
{
/* nothing here yet */
return;
return TRUE;
}
-PRIVATE u16_t de_read_rom(dpeth_t *dep, u8_t addr, u8_t nbAddrBits){
+PRIVATE u16_t de_read_rom(const dpeth_t *dep, u8_t addr, u8_t nbAddrBits){
u16_t retVal = 0;
int i;
u32_t csr = 0;
return;
}
-PRIVATE void do_vread_s(message * mp, int from_int)
+PRIVATE void do_vread_s(const message * mp, int from_int)
{
char *buffer;
u32_t size;
return;
}
-PRIVATE void de_reset(dpeth_t *dep){
+PRIVATE void de_reset(const dpeth_t *dep){
io_outl(CSR_ADDR(dep, CSR0), CSR0_SWR);
}
-PRIVATE void de_hw_conf(dpeth_t *dep){
+PRIVATE void de_hw_conf(const dpeth_t *dep){
u32_t val;
/* CSR0 - global host bus prop */
io_outl(CSR_ADDR(dep, CSR6), val);
}
-PRIVATE void de_start(dpeth_t *dep){
+PRIVATE void de_start(const dpeth_t *dep){
u32_t val;
val = io_inl(CSR_ADDR(dep, CSR6)) | CSR6_ST | CSR6_SR;
io_outl(CSR_ADDR(dep, CSR6), val);
return;
}
-PRIVATE void do_vwrite_s(message * mp, int from_int){
+PRIVATE void do_vwrite_s(const message * mp, int from_int){
static u8_t setupDone = 0;
int size, r, bytes, ix, totalsize;
- dpeth_t *dep = NULL;
+ dpeth_t *dep;
iovec_dat_s_t *iovp = NULL;
de_loc_descr_t *descr = NULL;
char *buffer = NULL;
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
+PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the dp8390 driver. */
int i, r, tasknr;
** Name: void el1_dumpstats(dpeth_t *dep, int port, vir_bytes size)
** Function: Dumps counter on screen (support for console display).
*/
-static void el1_dumpstats(dpeth_t * dep)
+static void el1_dumpstats(dpeth_t * UNUSED(dep))
{
return;
** Name: void el3_reset(dpeth_t *dep)
** Function: Reset function specific for Etherlink hardware.
*/
-static void el3_reset(dpeth_t * dep)
+static void el3_reset(dpeth_t * UNUSED(dep))
{
return; /* Done */
** Name: void ns_rw_setup(dpeth_t *dep, int mode, int size, u16_t offset);
** Function: Sets the board for reading/writing.
*/
-static void ns_rw_setup(dpeth_t *dep, int mode, int size, u16_t offset)
+static void ns_rw_setup(const dpeth_t *dep, int mode, int size, u16_t offset)
{
if (mode == CR_DM_RW) outb_reg0(dep, DP_ISR, ISR_RDC);
** Name: void ns_start_xmit(dpeth_t *dep, int size, int pageno);
** Function: Sets the board for for transmitting and fires it.
*/
-static void ns_start_xmit(dpeth_t * dep, int size, int pageno)
+static void ns_start_xmit(const dpeth_t * dep, int size, int pageno)
{
outb_reg0(dep, DP_TPSR, pageno);
_PROTOTYPE(void main, (void));
FORWARD _PROTOTYPE( int dsp_open, (void) );
FORWARD _PROTOTYPE( int dsp_close, (void) );
-FORWARD _PROTOTYPE( int dsp_ioctl, (message *m_ptr) );
-FORWARD _PROTOTYPE( void dsp_write, (message *m_ptr) );
+FORWARD _PROTOTYPE( int dsp_ioctl, (const message *m_ptr) );
+FORWARD _PROTOTYPE( void dsp_write, (const message *m_ptr) );
FORWARD _PROTOTYPE( void dsp_hardware_msg, (void) );
FORWARD _PROTOTYPE( void dsp_status, (message *m_ptr) );
*===========================================================================*/
PUBLIC void main()
{
- int r, caller, proc_nr;
+ int r;
+ endpoint_t caller;
+ int proc_nr;
message mess;
/* SEF local startup. */
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-PRIVATE void sef_local_startup()
+PRIVATE void sef_local_startup(void)
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
+PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the rtl8169 driver. */
unsigned left;
*/
#if (CHIP == INTEL)
DmaPtr = DmaBuffer;
- sys_umap(SELF, D, (vir_bytes)DmaBuffer, (phys_bytes)sizeof(DmaBuffer), &DmaPhys);
+ sys_umap(SELF, D, (vir_bytes)DmaBuffer, sizeof(DmaBuffer), &DmaPhys);
if((left = dma_bytes_left(DmaPhys)) < DMA_SIZE) {
/* First half of buffer crosses a 64K boundary, can't DMA into that */
/*===========================================================================*
* dsp_open
*===========================================================================*/
-PRIVATE int dsp_open()
+PRIVATE int dsp_open(void)
{
dprint("sb16_dsp.c: dsp_open()\n");
/*===========================================================================*
* dsp_close
*===========================================================================*/
-PRIVATE int dsp_close()
+PRIVATE int dsp_close(void)
{
dprint("sb16_dsp.c: dsp_close()\n");
/*===========================================================================*
* dsp_ioctl
*===========================================================================*/
-PRIVATE int dsp_ioctl(message *m_ptr)
+PRIVATE int dsp_ioctl(const message *m_ptr)
{
int status;
- phys_bytes user_phys;
unsigned int val;
dprint("sb16_dsp.c: dsp_ioctl()\n");
/*===========================================================================*
* dsp_write
*===========================================================================*/
-PRIVATE void dsp_write(message *m_ptr)
+PRIVATE void dsp_write(const message *m_ptr)
{
- int s;
message mess;
dprint("sb16_dsp.c: dsp_write()\n");
*===========================================================================*/
PRIVATE int dsp_command(int value)
{
- int i, status;
+ int i;
for (i = 0; i < SB_TIMEOUT; i++) {
if((sb16_inb(DSP_STATUS) & 0x80) == 0) {
_PROTOTYPE(void main, (void));
FORWARD _PROTOTYPE( int mixer_init, (void));
-FORWARD _PROTOTYPE( int mixer_open, (message *m_ptr));
-FORWARD _PROTOTYPE( int mixer_close, (message *m_ptr));
-FORWARD _PROTOTYPE( int mixer_ioctl, (message *m_ptr));
+FORWARD _PROTOTYPE( int mixer_open, (const message *m_ptr));
+FORWARD _PROTOTYPE( int mixer_close, (const message *m_ptr));
+FORWARD _PROTOTYPE( int mixer_ioctl, (const message *m_ptr));
FORWARD _PROTOTYPE( int mixer_get, (int reg));
-FORWARD _PROTOTYPE( int get_set_volume, (message *m_ptr, int flag));
-FORWARD _PROTOTYPE( int get_set_input, (message *m_ptr, int flag, int channel));
-FORWARD _PROTOTYPE( int get_set_output, (message *m_ptr, int flag));
+FORWARD _PROTOTYPE( int get_set_volume, (const message *m_ptr, int flag));
+FORWARD _PROTOTYPE( int get_set_input, (const message *m_ptr, int flag, int channel));
+FORWARD _PROTOTYPE( int get_set_output, (const message *m_ptr, int flag));
PRIVATE int mixer_avail = 0; /* Mixer exists? */
/*=========================================================================*
* mixer_open
*=========================================================================*/
-PRIVATE int mixer_open(message *m_ptr)
+PRIVATE int mixer_open(const message *m_ptr)
{
dprint("mixer_open\n");
/*=========================================================================*
* mixer_close
*=========================================================================*/
-PRIVATE int mixer_close(message *m_ptr)
+PRIVATE int mixer_close(const message *m_ptr)
{
dprint("mixer_close\n");
/*=========================================================================*
* mixer_ioctl
*=========================================================================*/
-PRIVATE int mixer_ioctl(message *m_ptr)
+PRIVATE int mixer_ioctl(const message *m_ptr)
{
int status;
/*=========================================================================*
* get_set_volume *
*=========================================================================*/
-PRIVATE int get_set_volume(message *m_ptr, int flag)
+PRIVATE int get_set_volume(const message *m_ptr, int flag)
/* flag 0 = get, 1 = set */
{
- phys_bytes user_phys;
struct volume_level level;
int cmd_left, cmd_right, shift, max_level;
/*=========================================================================*
* get_set_input *
*=========================================================================*/
-PRIVATE int get_set_input(message *m_ptr, int flag, int channel)
+PRIVATE int get_set_input(const message *m_ptr, int flag, int channel)
/*
* flag 0 = get, 1 = set
* channel 0 = left, 1 = right
*/
{
- phys_bytes user_phys;
struct inout_ctrl input;
int input_cmd, input_mask, mask, del_mask, shift;
/*=========================================================================*
* get_set_output *
*=========================================================================*/
-PRIVATE int get_set_output(message *m_ptr, int flag)
+PRIVATE int get_set_output(const message *m_ptr, int flag)
/* flag 0 = get, 1 = set */
{
- phys_bytes user_phys;
struct inout_ctrl output;
int output_mask, mask, del_mask, shift;
PUBLIC void osdep_eth_init()
{
int i, j, r, rport;
- endpoint_t tasknr;
+ u32_t tasknr;
struct eth_conf *ecp;
eth_port_t *eth_port, *rep;
message mess;