| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: scsi_ctrl.h |
| 5 | * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. |
| 6 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. |
| 7 | * |
| 8 | * The above named program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public |
| 10 | * License version 2 as published by the Free Software Foundation. |
| 11 | * |
| 12 | * The above named program is distributed in the hope that it will be |
| 13 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public |
| 18 | * License along with this work; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. |
| 20 | * |
| 21 | * ========== Copyright Header End ============================================ |
| 22 | */ |
| 23 | /* |
| 24 | * Copyright (C) 2002 Sun Microsystems, Inc. |
| 25 | * All rights reserved. |
| 26 | */ |
| 27 | #pragma ident "@(#)1.6 04/01/09 scsi_ctrl.h" |
| 28 | |
| 29 | |
| 30 | #ifndef SCSI_CTRL_H_ |
| 31 | #define SCSI_CTRL_H_ |
| 32 | |
| 33 | #include <limits.h> |
| 34 | #include "types.h" |
| 35 | |
| 36 | struct sym_scsi_ctrl; |
| 37 | struct scsi_bus; |
| 38 | class ScsiDisk; |
| 39 | |
| 40 | #define SCSI_CTRL_TYPE_MAJOR(scsi_ctrl_type) ((scsi_ctrl_type >> 8) & 0xFF) |
| 41 | #define SCSI_CTRL_TYPE_MINOR(scsi_ctrl_type) ((scsi_ctrl_type >> 0) & 0xFF) |
| 42 | |
| 43 | #define SCSI_CTRL_TYPE_MAKE(major, minor) ((major << 8) | minor) |
| 44 | |
| 45 | |
| 46 | |
| 47 | uint32_t PCIA_SCSI_CTRL_PCI_DEV_ID_START; |
| 48 | uint32_t PCIA_SCSI_CTRL_INTR_OFFSET; |
| 49 | |
| 50 | uint32_t PCIA_SCSI_CTRL_COUNT; |
| 51 | uint32_t PCIA_SCSI_CTRL_BASE; |
| 52 | |
| 53 | |
| 54 | |
| 55 | #define PCIB_SCSI_CTRL_PCI_DEV_ID_START 0x00 |
| 56 | #define PCIB_SCSI_CTRL_INTR_OFFSET 0x19 |
| 57 | |
| 58 | uint32_t PCIB_SCSI_CTRL_COUNT; // 22 |
| 59 | |
| 60 | |
| 61 | |
| 62 | #define SCSI_CTRL_SIZE 0x02000 |
| 63 | |
| 64 | |
| 65 | #define PCIB_SCSI_CTRL_BASE 0x00000 |
| 66 | |
| 67 | #define SYMBIOS_SCSI_CTRL 1 |
| 68 | |
| 69 | |
| 70 | typedef int (*scsi_ctrl_reg_access_func_t)(void *handle, char *buf, |
| 71 | LWord paddr, Word size, bool_t wr); |
| 72 | |
| 73 | typedef int (*scsi_ctrl_ioctl_func_t)(void *handle, int func, int opcode, void *valuep); |
| 74 | |
| 75 | |
| 76 | #define SCP_IOCTL_GET_SCSI_BUS 1 |
| 77 | #define SCP_IOCTL_DUMP_DEBUG_INFO 2 |
| 78 | #define SCP_IOCTL_DEBUG_ENABLE 3 |
| 79 | #define SCP_IOCTL_DEBUG_DISABLE 4 |
| 80 | #define SCP_IOCTL_DUMP_STATE 5 |
| 81 | #define SCP_IOCTL_RESTORE_STATE 6 |
| 82 | #define SCP_IOCTL_DUMP_STATISTICS 7 |
| 83 | #define SCP_IOCTL_GET_STOP_SAFE 8 |
| 84 | #define MAX_SCP_IOCTL_OPCODE 8 |
| 85 | |
| 86 | |
| 87 | struct scsi_ctrl_ops { |
| 88 | scsi_ctrl_reg_access_func_t reg_access; |
| 89 | scsi_ctrl_ioctl_func_t ioctl; |
| 90 | }; |
| 91 | |
| 92 | #define SCSI_CONF_FNAME "scsidisk.init" |
| 93 | |
| 94 | typedef struct scsi_ctrl_ops scsi_ctrl_ops_t; |
| 95 | |
| 96 | extern int scsi_ctrl_get_controller_id(struct scsi_ctrl *scp, int *idp); |
| 97 | extern void scsi_ctrl_set_scsi_ctrl_ops(struct scsi_ctrl *scp, struct scsi_ctrl_ops *ops); |
| 98 | extern int scsi_ctrl_read_memory(struct scsi_ctrl *scp, char *buf, LWord vaddr, int len); |
| 99 | extern int scsi_ctrl_write_memory(struct scsi_ctrl *scp, char *buf, LWord vaddr, int len); |
| 100 | extern int scsi_ctrl_raise_interrupt(struct scsi_ctrl *scp); |
| 101 | extern bool_t scsi_ctrl_deassert_interrupt(struct scsi_ctrl *scp); |
| 102 | extern void scsi_ctrl_dump_debug_info_all(FILE *dbgfile); |
| 103 | extern uint64_t scsi_ctrl_get_timestamp(void); |
| 104 | |
| 105 | extern int scsi_ctrl_get_diskdelay(ScsiDisk *sdskp); |
| 106 | extern int scsi_ctrl_get_wrdiskdelay(ScsiDisk *sdskp); |
| 107 | extern uint64_t scsi_ctrl_get_globaltick_per_cpu(void); |
| 108 | extern void scsi_ctrl_sigcore_handler(void); |
| 109 | |
| 110 | #endif /* SCSI_CTRL_H_ */ |