- Fix a command accounting bug.
- Don't use ID 0, since 1.x firmware may not like it.
This commit is contained in:
parent
c0f46c2a40
commit
25441c6b4a
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mlx.c,v 1.20 2002/09/06 13:18:43 gehenna Exp $ */
|
||||
/* $NetBSD: mlx.c,v 1.21 2002/09/22 18:59:00 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -74,7 +74,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mlx.c,v 1.20 2002/09/06 13:18:43 gehenna Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mlx.c,v 1.21 2002/09/22 18:59:00 ad Exp $");
|
||||
|
||||
#include "ld.h"
|
||||
|
||||
@ -495,9 +495,9 @@ mlx_init(struct mlx_softc *mlx, const char *intrstr)
|
||||
/* Set maximum number of queued commands for `regular' operations. */
|
||||
mlx->mlx_max_queuecnt =
|
||||
min(ci->ci_max_commands, MLX_MAX_QUEUECNT) -
|
||||
MLX_NCCBS_RESERVE;
|
||||
MLX_NCCBS_CONTROL;
|
||||
#ifdef DIAGNOSTIC
|
||||
if (mlx->mlx_max_queuecnt < MLX_NCCBS_RESERVE + MLX_MAX_DRIVES)
|
||||
if (mlx->mlx_max_queuecnt < MLX_NCCBS_CONTROL + MLX_MAX_DRIVES)
|
||||
printf("%s: WARNING: few CCBs available\n",
|
||||
mlx->mlx_dv.dv_xname);
|
||||
if (ci->ci_max_sg < MLX_MAX_SEGS) {
|
||||
@ -983,7 +983,7 @@ mlx_periodic_create(void *cookie)
|
||||
int rv;
|
||||
|
||||
rv = kthread_create1(mlx_periodic_thread, NULL, &mlx_periodic_proc,
|
||||
"mlxmonitor");
|
||||
"mlxtask");
|
||||
if (rv == 0)
|
||||
return;
|
||||
|
||||
@ -1002,7 +1002,7 @@ mlx_periodic_thread(void *cookie)
|
||||
if (mlx->mlx_ci.ci_iftype > 1)
|
||||
mlx_periodic(mlx);
|
||||
|
||||
tsleep(mlx_periodic_thread, PWAIT, "mlxzzz", hz);
|
||||
tsleep(mlx_periodic_thread, PWAIT, "mlxzzz", hz * 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1886,21 +1886,23 @@ mlx_user_command(struct mlx_softc *mlx, struct mlx_usercommand *mu)
|
||||
* Allocate and initialise a CCB.
|
||||
*/
|
||||
int
|
||||
mlx_ccb_alloc(struct mlx_softc *mlx, struct mlx_ccb **mcp, int special)
|
||||
mlx_ccb_alloc(struct mlx_softc *mlx, struct mlx_ccb **mcp, int control)
|
||||
{
|
||||
struct mlx_ccb *mc;
|
||||
int s;
|
||||
|
||||
s = splbio();
|
||||
if ((!special && mlx->mlx_nccbs_free < MLX_NCCBS_RESERVE) ||
|
||||
SLIST_FIRST(&mlx->mlx_ccb_freelist) == NULL) {
|
||||
splx(s);
|
||||
*mcp = NULL;
|
||||
return (EAGAIN);
|
||||
if (control) {
|
||||
if (mlx->mlx_nccbs_ctrl >= MLX_NCCBS_CONTROL) {
|
||||
splx(s);
|
||||
*mcp = NULL;
|
||||
return (EAGAIN);
|
||||
}
|
||||
mc->mc_flags |= MC_CONTROL;
|
||||
mlx->mlx_nccbs_ctrl++;
|
||||
}
|
||||
mc = SLIST_FIRST(&mlx->mlx_ccb_freelist);
|
||||
SLIST_REMOVE_HEAD(&mlx->mlx_ccb_freelist, mc_chain.slist);
|
||||
mlx->mlx_nccbs_free--;
|
||||
splx(s);
|
||||
|
||||
*mcp = mc;
|
||||
@ -1916,9 +1918,10 @@ mlx_ccb_free(struct mlx_softc *mlx, struct mlx_ccb *mc)
|
||||
int s;
|
||||
|
||||
s = splbio();
|
||||
if ((mc->mc_flags & MC_CONTROL) != 0)
|
||||
mlx->mlx_nccbs_ctrl--;
|
||||
mc->mc_flags = 0;
|
||||
SLIST_INSERT_HEAD(&mlx->mlx_ccb_freelist, mc, mc_chain.slist);
|
||||
mlx->mlx_nccbs_free++;
|
||||
splx(s);
|
||||
}
|
||||
|
||||
@ -2091,7 +2094,7 @@ mlx_ccb_submit(struct mlx_softc *mlx, struct mlx_ccb *mc)
|
||||
int i, s, r;
|
||||
|
||||
/* Save the ident so we can handle this command when complete. */
|
||||
mc->mc_mbox[1] = (u_int8_t)mc->mc_ident;
|
||||
mc->mc_mbox[1] = (u_int8_t)(mc->mc_ident + 1);
|
||||
|
||||
/* Mark the command as currently being processed. */
|
||||
mc->mc_status = MLX_STATUS_BUSY;
|
||||
@ -2155,6 +2158,7 @@ mlx_intr(void *cookie)
|
||||
|
||||
while ((*mlx->mlx_findcomplete)(mlx, &ident, &status) != 0) {
|
||||
result = 1;
|
||||
ident--;
|
||||
|
||||
if (ident >= MLX_MAX_QUEUECNT) {
|
||||
printf("%s: bad completion returned\n",
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mlxvar.h,v 1.6 2002/08/26 15:27:13 ad Exp $ */
|
||||
/* $NetBSD: mlxvar.h,v 1.7 2002/09/22 18:59:00 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -80,8 +80,8 @@
|
||||
/* Maximum queue depth, matching the older controllers. */
|
||||
#define MLX_MAX_QUEUECNT 63
|
||||
|
||||
/* Number of CCBs to reserve for `special' operations. */
|
||||
#define MLX_NCCBS_RESERVE 7
|
||||
/* Number of CCBs to reserve for control operations. */
|
||||
#define MLX_NCCBS_CONTROL 7
|
||||
|
||||
/* Structure describing a system drive as attached to the controller. */
|
||||
struct mlx_sysdrive {
|
||||
@ -120,6 +120,7 @@ struct mlx_ccb {
|
||||
#define MC_XFER_IN MU_XFER_IN /* Map describes inbound xfer */
|
||||
#define MC_XFER_OUT MU_XFER_OUT /* Map describes outbound xfer */
|
||||
#define MC_WAITING 0x0400 /* We have waiters */
|
||||
#define MC_CONTROL 0x0800 /* Control operation */
|
||||
|
||||
/*
|
||||
* Per-controller state.
|
||||
@ -137,7 +138,7 @@ struct mlx_softc {
|
||||
SIMPLEQ_HEAD(, mlx_ccb) mlx_ccb_queue;
|
||||
struct mlx_ccb *mlx_ccbs;
|
||||
int mlx_nccbs;
|
||||
int mlx_nccbs_free;
|
||||
int mlx_nccbs_ctrl;
|
||||
|
||||
caddr_t mlx_sgls;
|
||||
bus_addr_t mlx_sgls_paddr;
|
||||
@ -227,7 +228,7 @@ mlx_make_type1(struct mlx_ccb *mc, u_int8_t code, u_int16_t f1, u_int32_t f2,
|
||||
|
||||
mc->mc_mbox[0x0] = code;
|
||||
mc->mc_mbox[0x2] = f1;
|
||||
mc->mc_mbox[0x3] = (((f2 >> 24) & 0x3) << 6) | ((f1 >> 8) & 0x3f);
|
||||
mc->mc_mbox[0x3] = ((f2 >> 18) & 0xc0) | ((f1 >> 8) & 0x3f);
|
||||
mc->mc_mbox[0x4] = f2;
|
||||
mc->mc_mbox[0x5] = (f2 >> 8);
|
||||
mc->mc_mbox[0x6] = (f2 >> 16);
|
||||
|
Loading…
Reference in New Issue
Block a user