Deleted Added
full compact
isp_sbus.c (316084) isp_sbus.c (316145)
1/*-
2 * Copyright (c) 1997-2006 by Matthew Jacob
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24 * SUCH DAMAGE.
25 */
26/*
27 * SBus specific probe and attach routines for Qlogic ISP SCSI adapters.
28 * FreeBSD Version.
29 */
30
31#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1997-2006 by Matthew Jacob
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24 * SUCH DAMAGE.
25 */
26/*
27 * SBus specific probe and attach routines for Qlogic ISP SCSI adapters.
28 * FreeBSD Version.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: stable/11/sys/dev/isp/isp_sbus.c 316084 2017-03-28 10:11:00Z mav $");
32__FBSDID("$FreeBSD: stable/11/sys/dev/isp/isp_sbus.c 316145 2017-03-29 15:42:35Z mav $");
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/linker.h>
37#include <sys/firmware.h>
38#include <sys/bus.h>
39#include <sys/kernel.h>
40#include <sys/module.h>

--- 7 unchanged lines hidden (view full) ---

48#include <machine/resource.h>
49#include <sys/rman.h>
50#include <sparc64/sbus/sbusvar.h>
51
52#include <dev/isp/isp_freebsd.h>
53
54static uint32_t isp_sbus_rd_reg(ispsoftc_t *, int);
55static void isp_sbus_wr_reg(ispsoftc_t *, int, uint32_t);
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/linker.h>
37#include <sys/firmware.h>
38#include <sys/bus.h>
39#include <sys/kernel.h>
40#include <sys/module.h>

--- 7 unchanged lines hidden (view full) ---

48#include <machine/resource.h>
49#include <sys/rman.h>
50#include <sparc64/sbus/sbusvar.h>
51
52#include <dev/isp/isp_freebsd.h>
53
54static uint32_t isp_sbus_rd_reg(ispsoftc_t *, int);
55static void isp_sbus_wr_reg(ispsoftc_t *, int, uint32_t);
56static int isp_sbus_rd_isr(ispsoftc_t *, uint16_t *, uint16_t *, uint16_t *);
56static void isp_sbus_run_isr(ispsoftc_t *);
57static int isp_sbus_mbxdma(ispsoftc_t *);
58static void isp_sbus_mbxdmafree(ispsoftc_t *);
59static int isp_sbus_dmasetup(ispsoftc_t *, XS_T *, void *);
60static void isp_sbus_dumpregs(ispsoftc_t *, const char *);
61
62static struct ispmdvec mdvec = {
57static int isp_sbus_mbxdma(ispsoftc_t *);
58static void isp_sbus_mbxdmafree(ispsoftc_t *);
59static int isp_sbus_dmasetup(ispsoftc_t *, XS_T *, void *);
60static void isp_sbus_dumpregs(ispsoftc_t *, const char *);
61
62static struct ispmdvec mdvec = {
63 isp_sbus_rd_isr,
63 isp_sbus_run_isr,
64 isp_sbus_rd_reg,
65 isp_sbus_wr_reg,
66 isp_sbus_mbxdma,
67 isp_sbus_dmasetup,
68 isp_common_dmateardown,
69 NULL,
70 isp_sbus_dumpregs,
71 NULL,

--- 267 unchanged lines hidden (view full) ---

339}
340
341#define IspVirt2Off(a, x) \
342 (((struct isp_sbussoftc *)a)->sbus_poff[((x) & _BLK_REG_MASK) >> \
343 _BLK_REG_SHFT] + ((x) & 0xff))
344
345#define BXR2(isp, off) bus_read_2((isp)->isp_regs, (off))
346
64 isp_sbus_rd_reg,
65 isp_sbus_wr_reg,
66 isp_sbus_mbxdma,
67 isp_sbus_dmasetup,
68 isp_common_dmateardown,
69 NULL,
70 isp_sbus_dumpregs,
71 NULL,

--- 267 unchanged lines hidden (view full) ---

339}
340
341#define IspVirt2Off(a, x) \
342 (((struct isp_sbussoftc *)a)->sbus_poff[((x) & _BLK_REG_MASK) >> \
343 _BLK_REG_SHFT] + ((x) & 0xff))
344
345#define BXR2(isp, off) bus_read_2((isp)->isp_regs, (off))
346
347static int
348isp_sbus_rd_isr(ispsoftc_t *isp, uint16_t *isrp, uint16_t *semap, uint16_t *info)
347static void
348isp_sbus_run_isr(ispsoftc_t *isp)
349{
349{
350 uint16_t isr, sema;
350 uint16_t isr, sema, info;
351
352 isr = BXR2(isp, IspVirt2Off(isp, BIU_ISR));
353 sema = BXR2(isp, IspVirt2Off(isp, BIU_SEMA));
354 isp_prt(isp, ISP_LOGDEBUG3, "ISR 0x%x SEMA 0x%x", isr, sema);
355 isr &= INT_PENDING_MASK(isp);
356 sema &= BIU_SEMA_LOCK;
351
352 isr = BXR2(isp, IspVirt2Off(isp, BIU_ISR));
353 sema = BXR2(isp, IspVirt2Off(isp, BIU_SEMA));
354 isp_prt(isp, ISP_LOGDEBUG3, "ISR 0x%x SEMA 0x%x", isr, sema);
355 isr &= INT_PENDING_MASK(isp);
356 sema &= BIU_SEMA_LOCK;
357 if (isr == 0 && sema == 0) {
358 return (0);
359 }
360 *isrp = isr;
361 if ((*semap = sema) != 0)
362 *info = BXR2(isp, IspVirt2Off(isp, OUTMAILBOX0));
363 return (1);
357 if (isr == 0 && sema == 0)
358 return;
359 if (sema != 0) {
360 info = BXR2(isp, IspVirt2Off(isp, OUTMAILBOX0));
361 if (info & MBOX_COMMAND_COMPLETE)
362 isp_intr_mbox(isp, info);
363 else
364 isp_intr_async(isp, info);
365 if (isp->isp_state == ISP_RUNSTATE)
366 isp_intr_respq(isp);
367 } else
368 isp_intr_respq(isp);
369 ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT);
370 if (sema)
371 ISP_WRITE(isp, BIU_SEMA, 0);
364}
365
366static uint32_t
367isp_sbus_rd_reg(ispsoftc_t *isp, int regoff)
368{
369 uint16_t rval;
370 struct isp_sbussoftc *sbs = (struct isp_sbussoftc *) isp;
371 int offset = sbs->sbus_poff[(regoff & _BLK_REG_MASK) >> _BLK_REG_SHFT];

--- 325 unchanged lines hidden ---
372}
373
374static uint32_t
375isp_sbus_rd_reg(ispsoftc_t *isp, int regoff)
376{
377 uint16_t rval;
378 struct isp_sbussoftc *sbs = (struct isp_sbussoftc *) isp;
379 int offset = sbs->sbus_poff[(regoff & _BLK_REG_MASK) >> _BLK_REG_SHFT];

--- 325 unchanged lines hidden ---