extern struct machine machine;
-PRIVATE unsigned pci_inb(u16_t port) {
- unsigned long value;
+PRIVATE u32_t pci_inb(u16_t port) {
+ u32_t value;
int s;
if ((s=sys_inb(port, &value)) !=OK)
printf("ACPI: warning, sys_inb failed: %d\n", s);
return value;
}
-PRIVATE unsigned pci_inw(u16_t port) {
- unsigned long value;
+PRIVATE u32_t pci_inw(u16_t port) {
+ u32_t value;
int s;
if ((s=sys_inw(port, &value)) !=OK)
printf("ACPI: warning, sys_inw failed: %d\n", s);
return value;
}
-PRIVATE unsigned pci_inl(u16_t port) {
- unsigned long value;
+PRIVATE u32_t pci_inl(u16_t port) {
+ u32_t value;
int s;
if ((s=sys_inl(port, &value)) !=OK)
printf("ACPI: warning, sys_inl failed: %d\n", s);
*Value = 0;
switch (Width) {
case 8:
- sys_inb(Address, (unsigned long *)Value);
+ sys_inb(Address, Value);
break;
case 16:
- sys_inw(Address, (unsigned long *)Value);
+ sys_inw(Address, Value);
break;
case 32:
- sys_inl(Address, (unsigned long *)Value);
+ sys_inl(Address, Value);
break;
}
return AE_OK;
#undef sys_inb
#undef sys_outl
-FORWARD _PROTOTYPE( int at_out, (int line, u32_t port, unsigned long value,
+FORWARD _PROTOTYPE( int at_out, (int line, u32_t port, u32_t value,
char *typename, int type));
-FORWARD _PROTOTYPE( int at_in, (int line, u32_t port, unsigned long *value,
+FORWARD _PROTOTYPE( int at_in, (int line, u32_t port, u32_t *value,
char *typename, int type));
#define sys_outb(p, v) at_out(__LINE__, (p), (v), "outb", _DIO_BYTE)
PRIVATE void
check_dma(struct wini *wn)
{
- unsigned long dma_status = 0;
- u32_t dma_base;
+ u32_t dma_status, dma_base;
int id_dma, ultra_dma;
u16_t w;
PRIVATE int error_dma(const struct wini *wn)
{
int r;
- unsigned long v;
+ u32_t v;
#define DMAERR(msg) \
printf("at_wini%ld: bad DMA: %s. Disabling DMA for drive %d.\n", \
struct wini *wn;
iovec_t *iop, *iov_end = iov + nr_req;
int n, r, s, errors, do_dma;
- unsigned long block, w_status;
+ unsigned long block;
+ u32_t w_status;
u64_t dv_size;
unsigned nbytes;
unsigned dma_buf_offset;
phys_bytes user_phys;
unsigned n, offset, size;
int i, j, r;
- unsigned long v;
+ u32_t v;
struct wini *wn = w_wn;
int verbose = 0;
/* Wait for a task completion interrupt. */
int r;
- unsigned long w_status;
+ u32_t w_status;
message m;
int ipc_status;
{
/* Wait for an interrupt, study the status bits and return error/success. */
int r, s;
- unsigned long inbval;
+ u32_t inbval;
w_intr_wait();
if ((w_wn->w_status & (STATUS_BSY | STATUS_WF | STATUS_ERR)) == 0) {
{
/* Wait until controller is in the required state. Return zero on timeout.
*/
- unsigned long w_status;
+ u32_t w_status;
spin_t spin;
int s;
{
/* Wait until controller is in the required state. Return zero on timeout.
*/
- unsigned long w_status;
+ u32_t w_status;
spin_t spin;
int s;
PRIVATE void ack_irqs(unsigned int irqs)
{
unsigned int drive;
- unsigned long w_status;
+ u32_t w_status;
for (drive = 0; drive < MAX_DRIVES; drive++) {
if (!(wini[drive].state & IGNORING) && wini[drive].irq_need_ack &&
panic("sys_vinb failed");
}
-PRIVATE int at_out(int line, u32_t port, unsigned long value,
- char *typename, int type)
+PRIVATE int at_out(int line, u32_t port, u32_t value, char *typename, int type)
{
int s;
s = sys_out(port, value, type);
if(s == OK)
return OK;
- printf("at_wini%ld: line %d: %s failed: %d; %lx -> %x\n",
+ printf("at_wini%ld: line %d: %s failed: %d; %x -> %x\n",
w_instance, line, typename, s, value, port);
panic("sys_out failed");
}
-PRIVATE int at_in(int line, u32_t port, unsigned long *value,
- char *typename, int type)
+PRIVATE int at_in(int line, u32_t port, u32_t *value, char *typename, int type)
{
int s;
s = sys_in(port, value, type);
/*===========================================================================*
* helper functions for I/O *
*===========================================================================*/
-PUBLIC unsigned pci_inb(u16_t port) {
- unsigned long value;
+PUBLIC u32_t pci_inb(u16_t port) {
+ u32_t value;
int s;
if ((s=sys_inb(port, &value)) !=OK)
printf("%s: warning, sys_inb failed: %d\n", DRIVER_NAME, s);
}
-PUBLIC unsigned pci_inw(u16_t port) {
- unsigned long value;
+PUBLIC u32_t pci_inw(u16_t port) {
+ u32_t value;
int s;
if ((s=sys_inw(port, &value)) !=OK)
printf("%s: warning, sys_inw failed: %d\n", DRIVER_NAME, s);
}
-PUBLIC unsigned pci_inl(u16_t port) {
- unsigned long value;
+PUBLIC u32_t pci_inl(u16_t port) {
+ u32_t value;
int s;
if ((s=sys_inl(port, &value)) !=OK)
printf("%s: warning, sys_inl failed: %d\n", DRIVER_NAME, s);
/*===========================================================================*
* helper functions for I/O *
*===========================================================================*/
-PUBLIC unsigned pci_inb(u16_t port) {
- unsigned long value;
+PUBLIC u32_t pci_inb(u16_t port) {
+ u32_t value;
int s;
if ((s=sys_inb(port, &value)) !=OK)
printf("%s: warning, sys_inb failed: %d\n", DRIVER_NAME, s);
}
-PUBLIC unsigned pci_inw(u16_t port) {
- unsigned long value;
+PUBLIC u32_t pci_inw(u16_t port) {
+ u32_t value;
int s;
if ((s=sys_inw(port, &value)) !=OK)
printf("%s: warning, sys_inw failed: %d\n", DRIVER_NAME, s);
}
-PUBLIC unsigned pci_inl(u16_t port) {
- unsigned long value;
+PUBLIC u32_t pci_inl(u16_t port) {
+ u32_t value;
int s;
if ((s=sys_inl(port, &value)) !=OK)
printf("%s: warning, sys_inl failed: %d\n", DRIVER_NAME, s);
PUBLIC int sb16_inb(int port) {
int s;
- unsigned long value;
+ u32_t value;
if ((s=sys_inb(port, &value)) != OK)
panic("sys_inb() failed: %d", s);
u16_t inw(port_t port)
{
int r;
- unsigned long value;
+ u32_t value;
r= sys_inw(port, &value);
if (r != OK)
next = header.dr_next;
if (length < ETH_MIN_PACK_SIZE || length > ETH_MAX_PACK_SIZE) {
- printf("%s: packet with strange length arrived: %d\n", dep->de_name, length);
+ printf("%s: packet with strange length arrived: %ld\n",
+ dep->de_name, length);
dep->de_stat.ets_recvErr += 1;
next = curr;
*/
PUBLIC unsigned int inb(unsigned short port)
{
- unsigned long value;
+ u32_t value;
int rc;
if ((rc = sys_inb(port, &value)) != OK) warning("inb", rc);
*/
PUBLIC unsigned int inw(unsigned short port)
{
- unsigned long value;
+ u32_t value;
int rc;
if ((rc = sys_inw(port, &value)) != OK) warning("inw", rc);
*/
int s, result_nr;
- unsigned long status;
+ u32_t status;
spin_t spin;
/* Extract bytes from FDC until it says it has no more. The loop is
panic("Sys_inb in fdc_results() failed: %d", s);
status &= (MASTER | DIRECTION | CTL_BUSY);
if (status == (MASTER | DIRECTION | CTL_BUSY)) {
- unsigned long tmp_r;
+ u32_t tmp_r;
if (result_nr >= MAX_RESULTS) break; /* too many results */
if ((s=sys_inb(FDC_DATA, &tmp_r)) != OK)
panic("Sys_inb in fdc_results() failed: %d", s);
*/
spin_t spin;
int s;
- unsigned long status;
+ u32_t status;
if (need_reset) return; /* if controller is not listening, return */
{
int i, r, isr;
port_t port;
- u32_t bus_addr;
+ phys_bytes bus_addr;
port= fp->fxp_base_port;
{
size_t rx_totbufsize, tx_totbufsize, tot_bufsize, alloc_bufsize;
char *alloc_buf;
- phys_bytes buf;
+ phys_bytes buf, bus_addr;
int i, r;
struct rfd *rfdp;
struct tx *txp;
fp->fxp_rx_buf= (struct rfd *)&tmpbufp[1];
r= sys_umap(SELF, VM_D, (vir_bytes)fp->fxp_rx_buf, rx_totbufsize,
- &fp->fxp_rx_busaddr);
+ &bus_addr);
if (r != OK)
panic("sys_umap failed: %d", r);
+ fp->fxp_rx_busaddr= bus_addr;
#if 0
printf("fxp_init_buf: got phys 0x%x for vir 0x%x\n",
if (i != fp->fxp_rx_nbuf-1)
{
r= sys_umap(SELF, VM_D, (vir_bytes)&rfdp[1],
- sizeof(rfdp[1]), &rfdp->rfd_linkaddr);
+ sizeof(rfdp[1]), &bus_addr);
if (r != OK)
panic("sys_umap failed: %d", r);
+ rfdp->rfd_linkaddr= bus_addr;
}
else
{
if (i != fp->fxp_tx_nbuf-1)
{
r= sys_umap(SELF, VM_D, (vir_bytes)&txp[1],
- (phys_bytes)sizeof(txp[1]),
- &txp->tx_linkaddr);
+ (phys_bytes)sizeof(txp[1]), &bus_addr);
if (r != OK)
panic("sys_umap failed: %d", r);
+ txp->tx_linkaddr= bus_addr;
}
else
{
static char eakey[]= FXP_ENVVAR "#_EA";
static char eafmt[]= "x:x:x:x:x:x";
int i, r;
- u32_t bus_addr;
+ phys_bytes bus_addr;
long v;
/* User defined ethernet address? */
fxp_t *fp;
{
int r;
- u32_t bus_addr;
+ phys_bytes bus_addr;
/* Configure device */
tmpbufp->cc.cc_status= 0;
}
if (!(reg & HERMES_EV_CMD)) {
- printf("hermes @ %lx: Timeout waiting for card to reset\n",
+ printf("hermes @ %x: Timeout waiting for card to reset\n",
hw->iobase);
return -ETIMEDOUT;
}
/* Was the status, the result of the issued command, ok? */
/* The expression below should be zero. Non-zero means an error */
if (status & HERMES_STATUS_RESULT) {
- printf("Hermes:Result of INIT_CMD wrong.error value: 0x%lx\n",
+ printf("Hermes:Result of INIT_CMD wrong.error value: 0x%x\n",
(status & HERMES_STATUS_RESULT) >> 8);
err = -EIO;
}
err = hermes_issue_cmd (hw, cmd, parm0);
if (err) {
- printf("hermes @ %lx: Error %d issuing command.\n",
+ printf("hermes @ %x: Error %d issuing command.\n",
hw->iobase, err);
return err;
}
/* check for a timeout: has the command still not completed? */
if (!(reg & HERMES_EV_CMD)) {
- printf("hermes @ %lx: Timeout waiting for command \
+ printf("hermes @ %x: Timeout waiting for command \
completion.\n", hw->iobase);
err = -ETIMEDOUT;
return err;
/* tired of waiting to complete. Abort. */
if (!(reg & HERMES_EV_ALLOC)) {
- printf("hermes @ %lx:Timeout waiting for frame allocation\n",
+ printf("hermes @ %x:Timeout waiting for frame allocation\n",
hw->iobase);
return -ETIMEDOUT;
}
*length = rlength;
if (rtype != rid) {
- printf("hermes @ %lx: hermes_read_ltv(): rid (0x%04x)",
+ printf("hermes @ %x: hermes_read_ltv(): rid (0x%04x)",
hw->iobase, rid);
printf("does not match type (0x%04x)\n", rtype);
}
if (HERMES_RECLEN_TO_BYTES (rlength) > bufsize) {
- printf("hermes @ %lx: Truncating LTV record from ",
+ printf("hermes @ %x: Truncating LTV record from ",
hw->iobase);
printf("%d to %d bytes. (rid=0x%04x, len=0x%04x)\n",
HERMES_RECLEN_TO_BYTES (rlength), bufsize, rid,
HERMES_16BIT_REGSPACING);
if (debug) {
- printf ("%s: using I/O space address 0x%lx, IRQ %d\n",
+ printf ("%s: using I/O space address 0x%x, IRQ %d\n",
orp->or_name, bar, orp->or_irq);
}
if (debug){
printf ("%s: using shared memory address",
orp->or_name);
- printf (" 0x%lx, IRQ %d\n", bar, orp->or_irq);
+ printf (" 0x%x, IRQ %d\n", bar, orp->or_irq);
}
return bar;
register int r = SUSPEND;
int retries;
- unsigned long status;
+ u32_t status;
/* Reject command if last write is not yet finished, the count is not
* positive, or the user address is bad.
* IRQ yet!
*/
- unsigned long status;
+ u32_t status;
pvb_pair_t char_out[3];
if (oleft == 0) {
if (!(rxstat & RL_RXS_ROK))
{
- printf("rxstat = 0x%08lx\n", rxstat);
- printf("d_start: 0x%x, d_end: 0x%x, rxstat: 0x%lx\n",
+ printf("rxstat = 0x%08x\n", rxstat);
+ printf("d_start: 0x%x, d_end: 0x%x, rxstat: 0x%x\n",
d_start, d_end, rxstat);
panic("received packet not OK");
}
{
/* Someting went wrong */
printf(
- "rl_readv: bad length (%u) in status 0x%08lx at offset 0x%x\n",
+ "rl_readv: bad length (%u) in status 0x%08x at offset 0x%x\n",
totlen, rxstat, d_start);
printf(
- "d_start: 0x%x, d_end: 0x%x, totlen: %d, rxstat: 0x%lx\n",
+ "d_start: 0x%x, d_end: 0x%x, totlen: %d, rxstat: 0x%x\n",
d_start, d_end, totlen, rxstat);
panic(NULL);
}
}
else
{
- printf("TSD%d = 0x%04lx\n", i, tsd);
+ printf("TSD%d = 0x%04x\n", i, tsd);
/* Set head and tail to this buffer */
rep->re_tx_head= rep->re_tx_tail= i;
rep->re_stat.ets_carrSense++;
if (tsd & RL_TSD_TABT)
{
- printf("rl_handler, TABT, TSD%d = 0x%04lx\n",
+ printf("rl_handler, TABT, TSD%d = 0x%04x\n",
tx_tail, tsd);
assert(0); /* CLRABT is not all that
* effective, why not?
ertxth &= RL_TSD_ERTXTH_M;
if (debug && ertxth > rep->re_ertxth)
{
- printf("%s: new ertxth: %ld bytes\n",
+ printf("%s: new ertxth: %d bytes\n",
rep->re_name,
(ertxth >> RL_TSD_ERTXTH_S) *
32);
if ((s = sys_irqenable(&rep->re_hook_id)) != OK)
printf("RTL8169: error, couldn't enable interrupts: %d\n", s);
- printf("%s: model: %s mac: 0x%08lx\n",
+ printf("%s: model: %s mac: 0x%08x\n",
rep->re_name, rep->re_model, rep->re_mac);
rl_confaddr(rep);
totlen = rxstat & DESC_RX_LENMASK;
if (totlen < 8 || totlen > 2 * ETH_MAX_PACK_SIZE) {
/* Someting went wrong */
- printf("rl_readv_s: bad length (%u) in status 0x%08lx\n",
+ printf("rl_readv_s: bad length (%u) in status 0x%08x\n",
totlen, rxstat);
panic(NULL);
}
unsigned *val; /* 16-bit value to set it to */
{
char v1, v2;
- unsigned long v;
+ u32_t v;
/* Get a register pair inside the 6845. */
sys_outb(vid_port + INDEX, reg);
sys_inb(vid_port + DATA, &v);
*/
static timer_t tmr_stop_beep;
pvb_pair_t char_out[3];
- unsigned long port_b_val;
+ u32_t port_b_val;
/* Set timer in advance to prevent beeping delay. */
set_timer(&tmr_stop_beep, B_TIME, stop_beep, 0);
*/
static timer_t tmr_stop_beep;
pvb_pair_t char_out[3];
- unsigned long port_b_val;
+ u32_t port_b_val;
unsigned long ival= TIMER_FREQ / freq;
if (ival == 0 || ival > 0xffff)
PRIVATE void stop_beep(timer_t *UNUSED(tmrp))
{
/* Turn off the beeper by turning off bits 0 and 1 in PORT_B. */
- unsigned long port_b_val;
+ u32_t port_b_val;
if (sys_inb(PORT_B, &port_b_val)==OK &&
sys_outb(PORT_B, (port_b_val & ~3))==OK)
beeping = FALSE;
*===========================================================================*/
PRIVATE void kbd_send()
{
- unsigned long sb;
+ u32_t sb;
int r;
if (!kbdout.avail)
}
if (sb & (KB_OUT_FULL|KB_IN_FULL))
{
- printf("not sending 1: sb = 0x%lx\n", sb);
+ printf("not sending 1: sb = 0x%x\n", sb);
return;
}
micro_delay(KBC_IN_DELAY);
}
if (sb & (KB_OUT_FULL|KB_IN_FULL))
{
- printf("not sending 2: sb = 0x%lx\n", sb);
+ printf("not sending 2: sb = 0x%x\n", sb);
return;
}
printf("sending byte 0x%x to keyboard\n", kbdout.buf[kbdout.offset]);
#endif
if((r=sys_outb(KEYBD, kbdout.buf[kbdout.offset])) != OK) {
- printf("kbd_send: 3 sys_inb() failed: %d\n", r);
+ printf("kbd_send: 3 sys_outb() failed: %d\n", r);
}
kbdout.offset++;
kbdout.avail--;
PRIVATE int kbc_read()
{
int i;
- unsigned long byte, st;
+ u32_t byte, st;
#if 0
struct micro_state ms;
#endif
* the kbd controller, return -1 on a timeout.
*/
for (i= 0; i<1000000; i++)
- #if 0
+#if 0
micro_start(&ms);
do
#endif
if(sys_inb(KEYBD, &byte) != OK)
printf("kbc_read: 2 sys_inb failed\n");
if (st & KB_AUX_BYTE)
- printf("kbc_read: aux byte 0x%lx\n", byte);
+ printf("kbc_read: aux byte 0x%x\n", byte);
#if DEBUG
- printf("keyboard`kbc_read: returning byte 0x%lx\n",
+ printf("keyboard`kbc_read: returning byte 0x%x\n",
byte);
#endif
return byte;
/* Wait until the controller is ready; return zero if this times out. */
int retries;
- unsigned long status;
+ u32_t status;
int s, isaux;
unsigned char byte;
/* Wait until kbd acknowledges last command; return zero if this times out. */
int retries, s;
- unsigned long u8val;
-
+ u32_t u8val;
retries = MAX_KB_ACK_RETRIES + 1;
do {
unsigned char *bp;
int *isauxp;
{
- unsigned long b, sb;
+ u32_t b, sb;
if(sys_inb(KB_STATUS, &sb) != OK)
printf("scan_keyboard: sys_inb failed\n");
PRIVATE int my_inb(port_t port)
{
int r;
- unsigned long v = 0;
+ u32_t v = 0;
r = sys_inb(port, &v);
if (r != OK)
printf("RS232 warning: failed inb 0x%x\n", port);
PUBLIC void rs_init(tty_t *tp)
/* tp which TTY */
{
- unsigned long dummy;
+ u32_t dummy;
/* Initialize RS232 for one line. */
register rs232_t *rs;
{
/* Generate a break condition by setting the BREAK bit for 0.4 sec. */
rs232_t *rs = tp->tty_priv;
- unsigned long line_controls;
+ u32_t line_controls;
sys_inb(rs->line_ctl_port, &line_controls);
sys_outb(rs->line_ctl_port, line_controls | LC_BREAK);
/* Interrupt hander for RS232. */
while (TRUE) {
- unsigned long v;
+ u32_t v;
/* Loop to pick up ALL pending interrupts for device.
* This usually just wastes time unless the hardware has a buffer
* (and then we have to worry about being stuck in the loop too long).
* Set a flag for the clock interrupt handler to eventually notify TTY.
*/
- unsigned long c;
+ u32_t c;
#if 0 /* Enable this if you want serial input in the kernel */
return;
{
/* Check for and record errors. */
- unsigned long s;
+ u32_t s;
sys_inb(rs->line_status_port, &s);
rs->lstatus = s;
if (rs->lstatus & LS_FRAMING_ERR) ++rs->framing_errors;
_PROTOTYPE(int sys_vinl, (pvl_pair_t *pvl_pairs, int nr_ports) );
/* Shorthands for sys_out() system call. */
-#define sys_outb(p,v) sys_out((p), (unsigned long) (v), _DIO_BYTE)
-#define sys_outw(p,v) sys_out((p), (unsigned long) (v), _DIO_WORD)
-#define sys_outl(p,v) sys_out((p), (unsigned long) (v), _DIO_LONG)
-_PROTOTYPE(int sys_out, (int port, unsigned long value, int type) );
+#define sys_outb(p,v) sys_out((p), (u32_t) (v), _DIO_BYTE)
+#define sys_outw(p,v) sys_out((p), (u32_t) (v), _DIO_WORD)
+#define sys_outl(p,v) sys_out((p), (u32_t) (v), _DIO_LONG)
+_PROTOTYPE(int sys_out, (int port, u32_t value, int type) );
/* Shorthands for sys_in() system call. */
#define sys_inb(p,v) sys_in((p), (v), _DIO_BYTE)
#define sys_inw(p,v) sys_in((p), (v), _DIO_WORD)
#define sys_inl(p,v) sys_in((p), (v), _DIO_LONG)
-_PROTOTYPE(int sys_in, (int port, unsigned long *value, int type) );
+_PROTOTYPE(int sys_in, (int port, u32_t *value, int type) );
/* pci.c */
_PROTOTYPE( void pci_init, (void) );
#include <sys/types.h>
#include <stdlib.h>
+#include <minix/sysutil.h>
void
__assert13(file, line, function, failedexpr)
*===========================================================================*/
PUBLIC void ser_putc(char c)
{
- unsigned long b;
+ u32_t b;
int i;
int lsr, thr;
*===========================================================================*/
PUBLIC int sys_in(port, value, type)
int port; /* port address to read from */
-unsigned long *value; /* pointer where to store value */
+u32_t *value; /* pointer where to store value */
int type; /* byte, word, long */
{
message m_io;
*===========================================================================*/
PUBLIC int sys_out(port, value, type)
int port; /* port address to write to */
-unsigned long value; /* value to write */
+u32_t value; /* value to write */
int type; /* byte, word, long */
{
message m_io;