/* Some controllers don't interrupt, the clock will wake us up. */
#define WAKEUP_SECS 32 /* drive may be out for 31 seconds max */
-#define WAKEUP_TICKS (WAKEUP_SECS*HZ)
+#define WAKEUP_TICKS (WAKEUP_SECS*system_hz)
/* Miscellaneous. */
#define MAX_DRIVES 8
/* Timeouts and max retries. */
int timeout_ticks = DEF_TIMEOUT_TICKS, max_errors = MAX_ERRORS;
long w_standard_timeouts = 0, w_pci_debug = 0, w_instance = 0,
- disable_dma = 0, atapi_debug = 0, w_identify_wakeup_ticks = WAKEUP_TICKS,
- wakeup_ticks = WAKEUP_TICKS;
+ disable_dma = 0, atapi_debug = 0, w_identify_wakeup_ticks, wakeup_ticks;
int w_testing = 0, w_silent = 0;
/* Install signal handlers. Ask PM to transform signal into message. */
struct sigaction sa;
+ system_hz = sys_hz();
+
init_buffer();
+ w_identify_wakeup_ticks = WAKEUP_TICKS;
+ wakeup_ticks = WAKEUP_TICKS;
+
sa.sa_handler = SIG_MESS;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
env_parse("ata_id_timeout", "d", WAKEUP_SECS, &wakeup_secs, 1, 60);
env_parse("atapi_debug", "d", 0, &atapi_debug, 0, 1);
- w_identify_wakeup_ticks = wakeup_secs * HZ;
+ w_identify_wakeup_ticks = wakeup_secs * system_hz;
if(atapi_debug)
panic("at_wini", "atapi_debug", NO_NUM);
save_wakeup = wakeup_ticks;
if (!w_standard_timeouts) {
- timeout_ticks = HZ * 4;
- wakeup_ticks = HZ * 6;
+ timeout_ticks = system_hz * 4;
+ wakeup_ticks = system_hz * 6;
max_errors = 3;
}
#if ENABLE_3C503
-#define MILLIS_TO_TICKS(m) (((m)*HZ/1000)+1)
+extern u32_t system_hz;
+
+#define MILLIS_TO_TICKS(m) (((m)*system_hz/1000)+1)
_PROTOTYPE(static void el2_init, (dpeth_t *dep));
_PROTOTYPE(static void el2_stop, (dpeth_t *dep));
static u16_t eth_ign_proto;
static char *progname;
+u32_t system_hz;
+
/* Configuration */
typedef struct dp_conf
{
dpeth_t *dep;
long v;
+ system_hz = sys_hz();
+
if (argc < 1)
{
panic("DP8390",
#define N 100
-#define MILLIS_TO_TICKS(m) (((m)*HZ/1000)+1)
+extern u32_t system_hz;
+
+#define MILLIS_TO_TICKS(m) (((m)*system_hz/1000)+1)
_PROTOTYPE( typedef int (*testf_t), (dpeth_t *dep, int pos, u8_t *pat) );
#define MAX_SECTORS 18 /* largest # sectors per track */
#define DTL 0xFF /* determines data length (sector size) */
#define SPEC2 0x02 /* second parameter to SPECIFY */
-#define MOTOR_OFF (3*HZ) /* how long to wait before stopping motor */
-#define WAKEUP (2*HZ) /* timeout on I/O, FDC won't quit. */
+#define MOTOR_OFF (3*system_hz) /* how long to wait before stopping motor */
+#define WAKEUP (2*system_hz) /* timeout on I/O, FDC won't quit. */
/* Error codes */
#define ERR_SEEK (-1) /* bad seek */
u8_t steps; /* steps per cylinder (2 = double step) */
u8_t test; /* sector to try for density test */
u8_t rate; /* data rate (2=250, 1=300, 0=500 kbps) */
- clock_t start; /* motor start (clock ticks) */
+ clock_t start_ms; /* motor start (milliseconds) */
u8_t gap; /* gap size */
u8_t spec1; /* first specify byte (SRT/HUT) */
} fdensity[NT] = {
- { 9, 40, 1, 4*9, 2, 4*HZ/8, 0x2A, 0xDF }, /* 360K / 360K */
- { 15, 80, 1, 14, 0, 4*HZ/8, 0x1B, 0xDF }, /* 1.2M / 1.2M */
- { 9, 40, 2, 2*9, 2, 4*HZ/8, 0x2A, 0xDF }, /* 360K / 720K */
- { 9, 80, 1, 4*9, 2, 6*HZ/8, 0x2A, 0xDF }, /* 720K / 720K */
- { 9, 40, 2, 2*9, 1, 4*HZ/8, 0x23, 0xDF }, /* 360K / 1.2M */
- { 9, 80, 1, 4*9, 1, 4*HZ/8, 0x23, 0xDF }, /* 720K / 1.2M */
- { 18, 80, 1, 17, 0, 6*HZ/8, 0x1B, 0xCF }, /* 1.44M / 1.44M */
+ { 9, 40, 1, 4*9, 2, 500, 0x2A, 0xDF }, /* 360K / 360K */
+ { 15, 80, 1, 14, 0, 500, 0x1B, 0xDF }, /* 1.2M / 1.2M */
+ { 9, 40, 2, 2*9, 2, 500, 0x2A, 0xDF }, /* 360K / 720K */
+ { 9, 80, 1, 4*9, 2, 750, 0x2A, 0xDF }, /* 720K / 720K */
+ { 9, 40, 2, 2*9, 1, 500, 0x23, 0xDF }, /* 360K / 1.2M */
+ { 9, 80, 1, 4*9, 1, 500, 0x23, 0xDF }, /* 720K / 1.2M */
+ { 18, 80, 1, 17, 0, 750, 0x1B, 0xCF }, /* 1.44M / 1.44M */
};
/* The following table is used with the test_sector array to recognize a
/* Set an alarm timer to force a timeout if the hardware does not interrupt
* in time. Expect HARD_INT message, but check for SYN_ALARM timeout.
*/
- f_set_timer(&f_tmr_timeout, f_dp->start, f_timeout);
+ f_set_timer(&f_tmr_timeout, f_dp->start_ms * system_hz / 1000, f_timeout);
f_busy = BSY_IO;
do {
receive(ANY, &mess);
/* Set a synchronous alarm to force a timeout if the hardware does
* not interrupt. Expect HARD_INT, but check for SYN_ALARM timeout.
*/
- f_set_timer(&f_tmr_timeout, HZ/30, f_timeout);
+ f_set_timer(&f_tmr_timeout, system_hz/30, f_timeout);
f_busy = BSY_IO;
do {
receive(ANY, &mess);
extern int errno;
+u32_t system_hz;
+
#define fxp_inb(port, offset) (do_inb((port) + (offset)))
#define fxp_inw(port, offset) (do_inw((port) + (offset)))
#define fxp_inl(port, offset) (do_inl((port) + (offset)))
long v;
vir_bytes ft = sizeof(*fxp_table)*FXP_PORT_NR;
+ system_hz = sys_hz();
+
if (argc < 1)
panic("FXP", "A head which at this time has no name", NO_NUM);
(progname=strrchr(argv[0],'/')) ? progname++ : (progname=argv[0]);
tmra_inittimer(&fxp_watchdog);
tmr_arg(&fxp_watchdog)->ta_int= 0;
- fxp_set_timer(&fxp_watchdog, HZ, fxp_watchdog_f);
+ fxp_set_timer(&fxp_watchdog, system_hz, fxp_watchdog_f);
}
port = mp->DL_PORT;
fxp_t *fp;
tmr_arg(&fxp_watchdog)->ta_int= 0;
- fxp_set_timer(&fxp_watchdog, HZ, fxp_watchdog_f);
+ fxp_set_timer(&fxp_watchdog, system_hz, fxp_watchdog_f);
for (i= 0, fp = &fxp_table[0]; i<FXP_PORT_NR; i++, fp++)
{
int r, proc_nr;
message mess;
+ system_hz = sys_hz();
+
/* Init MQ library. */
mq_init();
extern u8_t tmp_buf[]; /* the DMA buffer */
#endif
extern phys_bytes tmp_phys; /* phys address of DMA buffer */
+
+u32_t system_hz;
#include <sys/ioc_memory.h>
#include <env.h>
#include <minix/ds.h>
+#include <minix/vm.h>
+#include <sys/mman.h>
#include "../../kernel/const.h"
#include "../../kernel/config.h"
#include "../../kernel/type.h"
NULL
};
+#if 0
/* One page of temporary mapping area - enough to be able to page-align
* one page.
*/
static char pagedata_buf[2*I386_PAGE_SIZE];
vir_bytes pagedata_aligned;
+#endif
/* Buffer for the /dev/zero null byte feed. */
#define ZERO_BUF_SIZE 1024
u32_t pagestart, page_off;
static u32_t pagestart_mapped;
static int any_mapped = 0;
+ static char *vaddr;
int r;
u32_t subcount;
* Don't have to map same page over and over.
*/
if(!any_mapped || pagestart_mapped != pagestart) {
-#if 0
- if((r=sys_vm_map(SELF, 1, pagedata_aligned,
- I386_PAGE_SIZE, pagestart)) != OK) {
-#else
- if(1) {
-#endif
- printf("memory: sys_vm_map failed: %d\n", r);
+ if(any_mapped) {
+ if(vm_unmap_phys(SELF, vaddr, I386_PAGE_SIZE) != OK)
+ panic("MEM","vm_unmap_phys failed",NO_NUM);
+ any_mapped = 0;
+ }
+ vaddr = vm_map_phys(SELF, (void *) pagestart, I386_PAGE_SIZE);
+ if(vaddr == MAP_FAILED)
+ r = ENOMEM;
+ else
+ r = OK;
+ if(r != OK) {
+ printf("memory: vm_map_phys failed\n");
return r;
}
any_mapped = 1;
if (opcode == DEV_GATHER_S) { /* copy data */
s=sys_safecopyto(proc_nr, user_vir,
- vir_offset, pagedata_aligned+page_off, subcount, D);
+ vir_offset, (vir_bytes) vaddr+page_off, subcount, D);
} else {
s=sys_safecopyfrom(proc_nr, user_vir,
- vir_offset, pagedata_aligned+page_off, subcount, D);
+ vir_offset, (vir_bytes) vaddr+page_off, subcount, D);
}
if(s != OK)
return s;
dev_zero[i] = '\0';
}
+#if 0
/* Page-align page pointer. */
pagedata_aligned = (u32_t) pagedata_buf + I386_PAGE_SIZE;
pagedata_aligned -= pagedata_aligned % I386_PAGE_SIZE;
+#endif
/* Set up memory range for /dev/mem. */
m_geom[MEM_DEV].dv_size = cvul64(0xffffffff);
#!/bin/sh
set -e
+
+exec >/dev/log
+exec 2>/dev/log
+exec </dev/null
+
/bin/service up /bin/pci -config /etc/drivers.conf
/bin/service -c up /bin/floppy -config /etc/drivers.conf -dev /dev/fd0
if [ X`/bin/sysenv bios_wini` = Xyes ]
PRIVATE message m;
PRIVATE int int_event_check; /* set to TRUE if events arrived */
+u32_t system_hz;
+
static char *progname;
extern int errno;
long v = 0;
t_or *orp;
+ system_hz = sys_hz();
+
(progname=strrchr(argv[0],'/')) ? progname++ : (progname=argv[0]);
env_setargs(argc, argv);
if (OK != (r = getuptime(&now)))
panic(__FILE__, "orinoco: getuptime() failed:", r);
- if(now - last_reset < HZ * 10) {
+ if(now - last_reset < system_hz * 10) {
printf("Resetting card too often. Going to reset driver\n");
exit(1);
}
tmra_inittimer(&or_watchdog);
/* Use a synchronous alarm instead of a watchdog timer. */
- sys_setalarm(HZ, 0);
+ sys_setalarm(system_hz, 0);
}
port = mp->DL_PORT;
t_or *orp;
/* Use a synchronous alarm instead of a watchdog timer. */
- sys_setalarm(HZ, 0);
+ sys_setalarm(system_hz, 0);
for (i= 0, orp = &or_table[0]; i<OR_PORT_NR; i++, orp++) {
if (orp->or_mode != OR_M_ENABLED)
*===========================================================================*/
PRIVATE void complete_bars()
{
+#if 0
int i, j, r, bar_nr, reg;
u32_t memgap_low, memgap_high, iogap_low, iogap_high, io_high,
base, size, v32, diff1, diff2;
printf("should allocate resources for device %d\n", i);
}
}
+#endif
}
/*===========================================================================*
do_printer_output();
return;
}
- tickdelay(HZ/2); /* wait before retry */
+ micro_delay(500000); /* wait before retry */
}
/* If we reach this point, the printer was not online in time. */
done_status = status;
printf("printer: sys_outb of %x failed\n", port_base+2);
panic(__FILE__, "do_initialize: sys_outb init failed", NO_NUM);
}
- tickdelay(HZ/20); /* easily satisfies Centronics minimum */
+ micro_delay(1000000/20); /* easily satisfies Centronics minimum */
if(sys_outb(port_base + 2, PR_SELECT) != OK) {
printf("printer: sys_outb of %x failed\n", port_base+2);
panic(__FILE__, "do_initialize: sys_outb select failed", NO_NUM);