DAC960.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:144k
- typedef enum DAC960_MessageLevel
- {
- DAC960_AnnounceLevel = 0,
- DAC960_InfoLevel = 1,
- DAC960_NoticeLevel = 2,
- DAC960_WarningLevel = 3,
- DAC960_ErrorLevel = 4,
- DAC960_ProgressLevel = 5,
- DAC960_CriticalLevel = 6,
- DAC960_UserCriticalLevel = 7
- }
- DAC960_MessageLevel_T;
- static char
- *DAC960_MessageLevelMap[] =
- { KERN_NOTICE, KERN_NOTICE, KERN_NOTICE, KERN_WARNING,
- KERN_ERR, KERN_CRIT, KERN_CRIT, KERN_CRIT };
- /*
- Define Driver Message macros.
- */
- #define DAC960_Announce(Format, Arguments...)
- DAC960_Message(DAC960_AnnounceLevel, Format, ##Arguments)
- #define DAC960_Info(Format, Arguments...)
- DAC960_Message(DAC960_InfoLevel, Format, ##Arguments)
- #define DAC960_Notice(Format, Arguments...)
- DAC960_Message(DAC960_NoticeLevel, Format, ##Arguments)
- #define DAC960_Warning(Format, Arguments...)
- DAC960_Message(DAC960_WarningLevel, Format, ##Arguments)
- #define DAC960_Error(Format, Arguments...)
- DAC960_Message(DAC960_ErrorLevel, Format, ##Arguments)
- #define DAC960_Progress(Format, Arguments...)
- DAC960_Message(DAC960_ProgressLevel, Format, ##Arguments)
- #define DAC960_Critical(Format, Arguments...)
- DAC960_Message(DAC960_CriticalLevel, Format, ##Arguments)
- #define DAC960_UserCritical(Format, Arguments...)
- DAC960_Message(DAC960_UserCriticalLevel, Format, ##Arguments)
- /*
- Define types for some of the structures that interface with the rest
- of the Linux Kernel and I/O Subsystem.
- */
- typedef struct buffer_head BufferHeader_T;
- typedef struct file File_T;
- typedef struct block_device_operations BlockDeviceOperations_T;
- typedef struct completion Completion_T;
- typedef struct gendisk GenericDiskInfo_T;
- typedef struct hd_geometry DiskGeometry_T;
- typedef struct hd_struct DiskPartition_T;
- typedef struct inode Inode_T;
- typedef struct inode_operations InodeOperations_T;
- typedef kdev_t KernelDevice_T;
- typedef struct list_head ListHead_T;
- typedef struct notifier_block NotifierBlock_T;
- typedef struct pci_dev PCI_Device_T;
- typedef struct proc_dir_entry PROC_DirectoryEntry_T;
- typedef unsigned long ProcessorFlags_T;
- typedef struct pt_regs Registers_T;
- typedef struct request IO_Request_T;
- typedef request_queue_t RequestQueue_T;
- typedef struct super_block SuperBlock_T;
- typedef struct timer_list Timer_T;
- typedef wait_queue_head_t WaitQueue_T;
- /*
- Define the DAC960 V1 Firmware Controller Status Mailbox structure.
- */
- typedef union DAC960_V1_StatusMailbox
- {
- unsigned int Word; /* Word 0 */
- struct {
- DAC960_V1_CommandIdentifier_T CommandIdentifier; /* Byte 0 */
- unsigned char :7; /* Byte 1 Bits 0-6 */
- boolean Valid:1; /* Byte 1 Bit 7 */
- DAC960_V1_CommandStatus_T CommandStatus; /* Bytes 2-3 */
- } Fields;
- }
- DAC960_V1_StatusMailbox_T;
- /*
- Define the DAC960 V2 Firmware Controller Status Mailbox structure.
- */
- typedef union DAC960_V2_StatusMailbox
- {
- unsigned int Words[2]; /* Words 0-1 */
- struct {
- DAC960_V2_CommandIdentifier_T CommandIdentifier; /* Bytes 0-1 */
- DAC960_V2_CommandStatus_T CommandStatus; /* Byte 2 */
- unsigned char RequestSenseLength; /* Byte 3 */
- int DataTransferResidue; /* Bytes 4-7 */
- } Fields;
- }
- DAC960_V2_StatusMailbox_T;
- /*
- Define the DAC960 Driver Command Types.
- */
- typedef enum
- {
- DAC960_ReadCommand = 1,
- DAC960_WriteCommand = 2,
- DAC960_ReadRetryCommand = 3,
- DAC960_WriteRetryCommand = 4,
- DAC960_MonitoringCommand = 5,
- DAC960_ImmediateCommand = 6,
- DAC960_QueuedCommand = 7
- }
- DAC960_CommandType_T;
- /*
- Define the DAC960 Driver Command structure.
- */
- typedef struct DAC960_Command
- {
- int CommandIdentifier;
- DAC960_CommandType_T CommandType;
- struct DAC960_Controller *Controller;
- struct DAC960_Command *Next;
- Completion_T *Completion;
- unsigned int LogicalDriveNumber;
- unsigned int BlockNumber;
- unsigned int BlockCount;
- unsigned int SegmentCount;
- BufferHeader_T *BufferHeader;
- void *RequestBuffer;
- union {
- struct {
- DAC960_V1_CommandMailbox_T CommandMailbox;
- DAC960_V1_KernelCommand_T *KernelCommand;
- DAC960_V1_CommandStatus_T CommandStatus;
- DAC960_V1_ScatterGatherSegment_T
- ScatterGatherList[DAC960_V1_ScatterGatherLimit]
- __attribute__ ((aligned (sizeof(DAC960_V1_ScatterGatherSegment_T))));
- unsigned int EndMarker[0];
- } V1;
- struct {
- DAC960_V2_CommandMailbox_T CommandMailbox;
- DAC960_V2_KernelCommand_T *KernelCommand;
- DAC960_V2_CommandStatus_T CommandStatus;
- unsigned char RequestSenseLength;
- int DataTransferResidue;
- DAC960_V2_ScatterGatherSegment_T
- ScatterGatherList[DAC960_V2_ScatterGatherLimit]
- __attribute__ ((aligned (sizeof(DAC960_V2_ScatterGatherSegment_T))));
- DAC960_SCSI_RequestSense_T RequestSense
- __attribute__ ((aligned (sizeof(int))));
- unsigned int EndMarker[0];
- } V2;
- } FW;
- }
- DAC960_Command_T;
- /*
- Define the DAC960 Driver Controller structure.
- */
- typedef struct DAC960_Controller
- {
- void *BaseAddress;
- void *MemoryMappedAddress;
- DAC960_FirmwareType_T FirmwareType;
- DAC960_HardwareType_T HardwareType;
- DAC960_IO_Address_T IO_Address;
- DAC960_PCI_Address_T PCI_Address;
- unsigned char ControllerNumber;
- unsigned char ControllerName[4];
- unsigned char ModelName[20];
- unsigned char FullModelName[28];
- unsigned char FirmwareVersion[12];
- unsigned char Bus;
- unsigned char Device;
- unsigned char Function;
- unsigned char IRQ_Channel;
- unsigned char Channels;
- unsigned char Targets;
- unsigned char MemorySize;
- unsigned char LogicalDriveCount;
- unsigned short CommandAllocationGroupSize;
- unsigned short ControllerQueueDepth;
- unsigned short DriverQueueDepth;
- unsigned short MaxBlocksPerCommand;
- unsigned short ControllerScatterGatherLimit;
- unsigned short DriverScatterGatherLimit;
- unsigned int ControllerUsageCount;
- unsigned int CombinedStatusBufferLength;
- unsigned int InitialStatusLength;
- unsigned int CurrentStatusLength;
- unsigned int ProgressBufferLength;
- unsigned int UserStatusLength;
- unsigned long MemoryMailboxPagesAddress;
- unsigned long MemoryMailboxPagesOrder;
- unsigned long MonitoringTimerCount;
- unsigned long PrimaryMonitoringTime;
- unsigned long SecondaryMonitoringTime;
- unsigned long LastProgressReportTime;
- unsigned long LastCurrentStatusTime;
- boolean ControllerDetectionSuccessful;
- boolean ControllerInitialized;
- boolean MonitoringCommandDeferred;
- boolean EphemeralProgressMessage;
- boolean DriveSpinUpMessageDisplayed;
- boolean MonitoringAlertMode;
- boolean SuppressEnclosureMessages;
- Timer_T MonitoringTimer;
- GenericDiskInfo_T GenericDiskInfo;
- DAC960_Command_T *FreeCommands;
- unsigned char *CombinedStatusBuffer;
- unsigned char *CurrentStatusBuffer;
- RequestQueue_T *RequestQueue;
- WaitQueue_T CommandWaitQueue;
- WaitQueue_T HealthStatusWaitQueue;
- DAC960_Command_T InitialCommand;
- DAC960_Command_T *Commands[DAC960_MaxDriverQueueDepth];
- PROC_DirectoryEntry_T *ControllerProcEntry;
- unsigned int LogicalDriveUsageCount[DAC960_MaxLogicalDrives];
- boolean LogicalDriveInitiallyAccessible[DAC960_MaxLogicalDrives];
- void (*QueueCommand)(DAC960_Command_T *Command);
- boolean (*ReadControllerConfiguration)(struct DAC960_Controller *);
- boolean (*ReadDeviceConfiguration)(struct DAC960_Controller *);
- boolean (*ReportDeviceConfiguration)(struct DAC960_Controller *);
- void (*QueueReadWriteCommand)(DAC960_Command_T *Command);
- union {
- struct {
- unsigned char GeometryTranslationHeads;
- unsigned char GeometryTranslationSectors;
- unsigned char PendingRebuildFlag;
- unsigned short StripeSize;
- unsigned short SegmentSize;
- unsigned short NewEventLogSequenceNumber;
- unsigned short OldEventLogSequenceNumber;
- unsigned short DeviceStateChannel;
- unsigned short DeviceStateTargetID;
- boolean DualModeMemoryMailboxInterface;
- boolean BackgroundInitializationStatusSupported;
- boolean SAFTE_EnclosureManagementEnabled;
- boolean NeedLogicalDriveInformation;
- boolean NeedErrorTableInformation;
- boolean NeedDeviceStateInformation;
- boolean NeedDeviceInquiryInformation;
- boolean NeedDeviceSerialNumberInformation;
- boolean NeedRebuildProgress;
- boolean NeedConsistencyCheckProgress;
- boolean NeedBackgroundInitializationStatus;
- boolean StartDeviceStateScan;
- boolean RebuildProgressFirst;
- boolean RebuildFlagPending;
- boolean RebuildStatusPending;
- DAC960_V1_CommandMailbox_T *FirstCommandMailbox;
- DAC960_V1_CommandMailbox_T *LastCommandMailbox;
- DAC960_V1_CommandMailbox_T *NextCommandMailbox;
- DAC960_V1_CommandMailbox_T *PreviousCommandMailbox1;
- DAC960_V1_CommandMailbox_T *PreviousCommandMailbox2;
- DAC960_V1_StatusMailbox_T *FirstStatusMailbox;
- DAC960_V1_StatusMailbox_T *LastStatusMailbox;
- DAC960_V1_StatusMailbox_T *NextStatusMailbox;
- DAC960_V1_DCDB_T MonitoringDCDB;
- DAC960_V1_Enquiry_T Enquiry;
- DAC960_V1_Enquiry_T NewEnquiry;
- DAC960_V1_ErrorTable_T ErrorTable;
- DAC960_V1_ErrorTable_T NewErrorTable;
- DAC960_V1_EventLogEntry_T EventLogEntry;
- DAC960_V1_RebuildProgress_T RebuildProgress;
- DAC960_V1_CommandStatus_T LastRebuildStatus;
- DAC960_V1_CommandStatus_T PendingRebuildStatus;
- DAC960_V1_LogicalDriveInformationArray_T LogicalDriveInformation;
- DAC960_V1_LogicalDriveInformationArray_T NewLogicalDriveInformation;
- DAC960_V1_BackgroundInitializationStatus_T
- BackgroundInitializationStatus;
- DAC960_V1_BackgroundInitializationStatus_T
- LastBackgroundInitializationStatus;
- DAC960_V1_DeviceState_T
- DeviceState[DAC960_V1_MaxChannels][DAC960_V1_MaxTargets];
- DAC960_V1_DeviceState_T NewDeviceState;
- DAC960_SCSI_Inquiry_T
- InquiryStandardData[DAC960_V1_MaxChannels][DAC960_V1_MaxTargets];
- DAC960_SCSI_Inquiry_UnitSerialNumber_T
- InquiryUnitSerialNumber[DAC960_V1_MaxChannels][DAC960_V1_MaxTargets];
- int DeviceResetCount[DAC960_V1_MaxChannels][DAC960_V1_MaxTargets];
- boolean DirectCommandActive[DAC960_V1_MaxChannels][DAC960_V1_MaxTargets];
- } V1;
- struct {
- unsigned int StatusChangeCounter;
- unsigned int NextEventSequenceNumber;
- unsigned int PhysicalDeviceIndex;
- boolean NeedLogicalDeviceInformation;
- boolean NeedPhysicalDeviceInformation;
- boolean NeedDeviceSerialNumberInformation;
- boolean StartLogicalDeviceInformationScan;
- boolean StartPhysicalDeviceInformationScan;
- DAC960_V2_CommandMailbox_T *FirstCommandMailbox;
- DAC960_V2_CommandMailbox_T *LastCommandMailbox;
- DAC960_V2_CommandMailbox_T *NextCommandMailbox;
- DAC960_V2_CommandMailbox_T *PreviousCommandMailbox1;
- DAC960_V2_CommandMailbox_T *PreviousCommandMailbox2;
- DAC960_V2_StatusMailbox_T *FirstStatusMailbox;
- DAC960_V2_StatusMailbox_T *LastStatusMailbox;
- DAC960_V2_StatusMailbox_T *NextStatusMailbox;
- DAC960_V2_HealthStatusBuffer_T *HealthStatusBuffer;
- DAC960_V2_ControllerInfo_T ControllerInformation;
- DAC960_V2_ControllerInfo_T NewControllerInformation;
- DAC960_V2_LogicalDeviceInfo_T
- *LogicalDeviceInformation[DAC960_MaxLogicalDrives];
- DAC960_V2_LogicalDeviceInfo_T NewLogicalDeviceInformation;
- DAC960_V2_PhysicalDeviceInfo_T
- *PhysicalDeviceInformation[DAC960_V2_MaxPhysicalDevices];
- DAC960_V2_PhysicalDeviceInfo_T NewPhysicalDeviceInformation;
- DAC960_SCSI_Inquiry_UnitSerialNumber_T
- *InquiryUnitSerialNumber[DAC960_V2_MaxPhysicalDevices];
- DAC960_V2_PhysicalDevice_T
- LogicalDriveToVirtualDevice[DAC960_MaxLogicalDrives];
- DAC960_V2_Event_T Event;
- boolean LogicalDriveFoundDuringScan[DAC960_MaxLogicalDrives];
- } V2;
- } FW;
- DiskPartition_T DiskPartitions[DAC960_MinorCount];
- int PartitionSizes[DAC960_MinorCount];
- int BlockSizes[DAC960_MinorCount];
- int MaxSectorsPerRequest[DAC960_MinorCount];
- unsigned char ProgressBuffer[DAC960_ProgressBufferSize];
- unsigned char UserStatusBuffer[DAC960_UserMessageSize];
- }
- DAC960_Controller_T;
- /*
- Simplify access to Firmware Version Dependent Data Structure Components
- and Functions.
- */
- #define V1 FW.V1
- #define V2 FW.V2
- #define DAC960_QueueCommand(Command)
- (Controller->QueueCommand)(Command)
- #define DAC960_ReadControllerConfiguration(Controller)
- (Controller->ReadControllerConfiguration)(Controller)
- #define DAC960_ReadDeviceConfiguration(Controller)
- (Controller->ReadDeviceConfiguration)(Controller)
- #define DAC960_ReportDeviceConfiguration(Controller)
- (Controller->ReportDeviceConfiguration)(Controller)
- #define DAC960_QueueReadWriteCommand(Command)
- (Controller->QueueReadWriteCommand)(Command)
- /*
- DAC960_AcquireControllerLock acquires exclusive access to Controller.
- */
- static inline
- void DAC960_AcquireControllerLock(DAC960_Controller_T *Controller,
- ProcessorFlags_T *ProcessorFlags)
- {
- spin_lock_irqsave(&io_request_lock, *ProcessorFlags);
- }
- /*
- DAC960_ReleaseControllerLock releases exclusive access to Controller.
- */
- static inline
- void DAC960_ReleaseControllerLock(DAC960_Controller_T *Controller,
- ProcessorFlags_T *ProcessorFlags)
- {
- spin_unlock_irqrestore(&io_request_lock, *ProcessorFlags);
- }
- /*
- DAC960_AcquireControllerLockRF acquires exclusive access to Controller,
- but is only called from the request function with the io_request_lock held.
- */
- static inline
- void DAC960_AcquireControllerLockRF(DAC960_Controller_T *Controller,
- ProcessorFlags_T *ProcessorFlags)
- {
- }
- /*
- DAC960_ReleaseControllerLockRF releases exclusive access to Controller,
- but is only called from the request function with the io_request_lock held.
- */
- static inline
- void DAC960_ReleaseControllerLockRF(DAC960_Controller_T *Controller,
- ProcessorFlags_T *ProcessorFlags)
- {
- }
- /*
- DAC960_AcquireControllerLockIH acquires exclusive access to Controller,
- but is only called from the interrupt handler.
- */
- static inline
- void DAC960_AcquireControllerLockIH(DAC960_Controller_T *Controller,
- ProcessorFlags_T *ProcessorFlags)
- {
- spin_lock_irqsave(&io_request_lock, *ProcessorFlags);
- }
- /*
- DAC960_ReleaseControllerLockIH releases exclusive access to Controller,
- but is only called from the interrupt handler.
- */
- static inline
- void DAC960_ReleaseControllerLockIH(DAC960_Controller_T *Controller,
- ProcessorFlags_T *ProcessorFlags)
- {
- spin_unlock_irqrestore(&io_request_lock, *ProcessorFlags);
- }
- /*
- Virtual_to_Bus32 maps from Kernel Virtual Addresses to 32 Bit PCI Bus
- Addresses.
- */
- static inline DAC960_BusAddress32_T Virtual_to_Bus32(void *VirtualAddress)
- {
- return (DAC960_BusAddress32_T) virt_to_bus(VirtualAddress);
- }
- /*
- Bus32_to_Virtual maps from 32 Bit PCI Bus Addresses to Kernel Virtual
- Addresses.
- */
- static inline void *Bus32_to_Virtual(DAC960_BusAddress32_T BusAddress)
- {
- return (void *) bus_to_virt(BusAddress);
- }
- /*
- Virtual_to_Bus64 maps from Kernel Virtual Addresses to 64 Bit PCI Bus
- Addresses.
- */
- static inline DAC960_BusAddress64_T Virtual_to_Bus64(void *VirtualAddress)
- {
- return (DAC960_BusAddress64_T) virt_to_bus(VirtualAddress);
- }
- /*
- Define the DAC960 BA Series Controller Interface Register Offsets.
- */
- #define DAC960_BA_RegisterWindowSize 0x80
- typedef enum
- {
- DAC960_BA_InboundDoorBellRegisterOffset = 0x60,
- DAC960_BA_OutboundDoorBellRegisterOffset = 0x61,
- DAC960_BA_InterruptStatusRegisterOffset = 0x30,
- DAC960_BA_InterruptMaskRegisterOffset = 0x34,
- DAC960_BA_CommandMailboxBusAddressOffset = 0x50,
- DAC960_BA_CommandStatusOffset = 0x58,
- DAC960_BA_ErrorStatusRegisterOffset = 0x63
- }
- DAC960_BA_RegisterOffsets_T;
- /*
- Define the structure of the DAC960 BA Series Inbound Door Bell Register.
- */
- typedef union DAC960_BA_InboundDoorBellRegister
- {
- unsigned char All;
- struct {
- boolean HardwareMailboxNewCommand:1; /* Bit 0 */
- boolean AcknowledgeHardwareMailboxStatus:1; /* Bit 1 */
- boolean GenerateInterrupt:1; /* Bit 2 */
- boolean ControllerReset:1; /* Bit 3 */
- boolean MemoryMailboxNewCommand:1; /* Bit 4 */
- unsigned char :3; /* Bits 5-7 */
- } Write;
- struct {
- boolean HardwareMailboxEmpty:1; /* Bit 0 */
- boolean InitializationNotInProgress:1; /* Bit 1 */
- unsigned char :6; /* Bits 2-7 */
- } Read;
- }
- DAC960_BA_InboundDoorBellRegister_T;
- /*
- Define the structure of the DAC960 BA Series Outbound Door Bell Register.
- */
- typedef union DAC960_BA_OutboundDoorBellRegister
- {
- unsigned char All;
- struct {
- boolean AcknowledgeHardwareMailboxInterrupt:1; /* Bit 0 */
- boolean AcknowledgeMemoryMailboxInterrupt:1; /* Bit 1 */
- unsigned char :6; /* Bits 2-7 */
- } Write;
- struct {
- boolean HardwareMailboxStatusAvailable:1; /* Bit 0 */
- boolean MemoryMailboxStatusAvailable:1; /* Bit 1 */
- unsigned char :6; /* Bits 2-7 */
- } Read;
- }
- DAC960_BA_OutboundDoorBellRegister_T;
- /*
- Define the structure of the DAC960 BA Series Interrupt Mask Register.
- */
- typedef union DAC960_BA_InterruptMaskRegister
- {
- unsigned char All;
- struct {
- unsigned int :2; /* Bits 0-1 */
- boolean DisableInterrupts:1; /* Bit 2 */
- boolean DisableInterruptsI2O:1; /* Bit 3 */
- unsigned int :4; /* Bits 4-7 */
- } Bits;
- }
- DAC960_BA_InterruptMaskRegister_T;
- /*
- Define the structure of the DAC960 BA Series Error Status Register.
- */
- typedef union DAC960_BA_ErrorStatusRegister
- {
- unsigned char All;
- struct {
- unsigned int :2; /* Bits 0-1 */
- boolean ErrorStatusPending:1; /* Bit 2 */
- unsigned int :5; /* Bits 3-7 */
- } Bits;
- }
- DAC960_BA_ErrorStatusRegister_T;
- /*
- Define inline functions to provide an abstraction for reading and writing the
- DAC960 BA Series Controller Interface Registers.
- */
- static inline
- void DAC960_BA_HardwareMailboxNewCommand(void *ControllerBaseAddress)
- {
- DAC960_BA_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.HardwareMailboxNewCommand = true;
- writeb(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_BA_InboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_BA_AcknowledgeHardwareMailboxStatus(void *ControllerBaseAddress)
- {
- DAC960_BA_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.AcknowledgeHardwareMailboxStatus = true;
- writeb(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_BA_InboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_BA_GenerateInterrupt(void *ControllerBaseAddress)
- {
- DAC960_BA_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.GenerateInterrupt = true;
- writeb(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_BA_InboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_BA_ControllerReset(void *ControllerBaseAddress)
- {
- DAC960_BA_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.ControllerReset = true;
- writeb(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_BA_InboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_BA_MemoryMailboxNewCommand(void *ControllerBaseAddress)
- {
- DAC960_BA_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.MemoryMailboxNewCommand = true;
- writeb(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_BA_InboundDoorBellRegisterOffset);
- }
- static inline
- boolean DAC960_BA_HardwareMailboxFullP(void *ControllerBaseAddress)
- {
- DAC960_BA_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All =
- readb(ControllerBaseAddress + DAC960_BA_InboundDoorBellRegisterOffset);
- return !InboundDoorBellRegister.Read.HardwareMailboxEmpty;
- }
- static inline
- boolean DAC960_BA_InitializationInProgressP(void *ControllerBaseAddress)
- {
- DAC960_BA_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All =
- readb(ControllerBaseAddress + DAC960_BA_InboundDoorBellRegisterOffset);
- return !InboundDoorBellRegister.Read.InitializationNotInProgress;
- }
- static inline
- void DAC960_BA_AcknowledgeHardwareMailboxInterrupt(void *ControllerBaseAddress)
- {
- DAC960_BA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All = 0;
- OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true;
- writeb(OutboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_BA_OutboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_BA_AcknowledgeMemoryMailboxInterrupt(void *ControllerBaseAddress)
- {
- DAC960_BA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All = 0;
- OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true;
- writeb(OutboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_BA_OutboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_BA_AcknowledgeInterrupt(void *ControllerBaseAddress)
- {
- DAC960_BA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All = 0;
- OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true;
- OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true;
- writeb(OutboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_BA_OutboundDoorBellRegisterOffset);
- }
- static inline
- boolean DAC960_BA_HardwareMailboxStatusAvailableP(void *ControllerBaseAddress)
- {
- DAC960_BA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All =
- readb(ControllerBaseAddress + DAC960_BA_OutboundDoorBellRegisterOffset);
- return OutboundDoorBellRegister.Read.HardwareMailboxStatusAvailable;
- }
- static inline
- boolean DAC960_BA_MemoryMailboxStatusAvailableP(void *ControllerBaseAddress)
- {
- DAC960_BA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All =
- readb(ControllerBaseAddress + DAC960_BA_OutboundDoorBellRegisterOffset);
- return OutboundDoorBellRegister.Read.MemoryMailboxStatusAvailable;
- }
- static inline
- void DAC960_BA_EnableInterrupts(void *ControllerBaseAddress)
- {
- DAC960_BA_InterruptMaskRegister_T InterruptMaskRegister;
- InterruptMaskRegister.All = 0xFF;
- InterruptMaskRegister.Bits.DisableInterrupts = false;
- InterruptMaskRegister.Bits.DisableInterruptsI2O = true;
- writeb(InterruptMaskRegister.All,
- ControllerBaseAddress + DAC960_BA_InterruptMaskRegisterOffset);
- }
- static inline
- void DAC960_BA_DisableInterrupts(void *ControllerBaseAddress)
- {
- DAC960_BA_InterruptMaskRegister_T InterruptMaskRegister;
- InterruptMaskRegister.All = 0xFF;
- InterruptMaskRegister.Bits.DisableInterrupts = true;
- InterruptMaskRegister.Bits.DisableInterruptsI2O = true;
- writeb(InterruptMaskRegister.All,
- ControllerBaseAddress + DAC960_BA_InterruptMaskRegisterOffset);
- }
- static inline
- boolean DAC960_BA_InterruptsEnabledP(void *ControllerBaseAddress)
- {
- DAC960_BA_InterruptMaskRegister_T InterruptMaskRegister;
- InterruptMaskRegister.All =
- readb(ControllerBaseAddress + DAC960_BA_InterruptMaskRegisterOffset);
- return !InterruptMaskRegister.Bits.DisableInterrupts;
- }
- static inline
- void DAC960_BA_WriteCommandMailbox(DAC960_V2_CommandMailbox_T
- *MemoryCommandMailbox,
- DAC960_V2_CommandMailbox_T
- *CommandMailbox)
- {
- memcpy(&MemoryCommandMailbox->Words[1], &CommandMailbox->Words[1],
- sizeof(DAC960_V2_CommandMailbox_T) - sizeof(unsigned int));
- wmb();
- MemoryCommandMailbox->Words[0] = CommandMailbox->Words[0];
- mb();
- }
- static inline
- void DAC960_BA_WriteHardwareMailbox(void *ControllerBaseAddress,
- DAC960_V2_CommandMailbox_T *CommandMailbox)
- {
- #ifdef __ia64__
- writeq(Virtual_to_Bus64(CommandMailbox),
- ControllerBaseAddress + DAC960_BA_CommandMailboxBusAddressOffset);
- #else
- writel(Virtual_to_Bus32(CommandMailbox),
- ControllerBaseAddress + DAC960_BA_CommandMailboxBusAddressOffset);
- #endif
- }
- static inline DAC960_V2_CommandIdentifier_T
- DAC960_BA_ReadCommandIdentifier(void *ControllerBaseAddress)
- {
- return readw(ControllerBaseAddress + DAC960_BA_CommandStatusOffset);
- }
- static inline DAC960_V2_CommandStatus_T
- DAC960_BA_ReadCommandStatus(void *ControllerBaseAddress)
- {
- return readw(ControllerBaseAddress + DAC960_BA_CommandStatusOffset + 2);
- }
- static inline boolean
- DAC960_BA_ReadErrorStatus(void *ControllerBaseAddress,
- unsigned char *ErrorStatus,
- unsigned char *Parameter0,
- unsigned char *Parameter1)
- {
- DAC960_BA_ErrorStatusRegister_T ErrorStatusRegister;
- ErrorStatusRegister.All =
- readb(ControllerBaseAddress + DAC960_BA_ErrorStatusRegisterOffset);
- if (!ErrorStatusRegister.Bits.ErrorStatusPending) return false;
- ErrorStatusRegister.Bits.ErrorStatusPending = false;
- *ErrorStatus = ErrorStatusRegister.All;
- *Parameter0 =
- readb(ControllerBaseAddress + DAC960_BA_CommandMailboxBusAddressOffset + 0);
- *Parameter1 =
- readb(ControllerBaseAddress + DAC960_BA_CommandMailboxBusAddressOffset + 1);
- writeb(0xFF, ControllerBaseAddress + DAC960_BA_ErrorStatusRegisterOffset);
- return true;
- }
- /*
- Define the DAC960 LP Series Controller Interface Register Offsets.
- */
- #define DAC960_LP_RegisterWindowSize 0x80
- typedef enum
- {
- DAC960_LP_InboundDoorBellRegisterOffset = 0x20,
- DAC960_LP_OutboundDoorBellRegisterOffset = 0x2C,
- DAC960_LP_InterruptStatusRegisterOffset = 0x30,
- DAC960_LP_InterruptMaskRegisterOffset = 0x34,
- DAC960_LP_CommandMailboxBusAddressOffset = 0x10,
- DAC960_LP_CommandStatusOffset = 0x18,
- DAC960_LP_ErrorStatusRegisterOffset = 0x2E
- }
- DAC960_LP_RegisterOffsets_T;
- /*
- Define the structure of the DAC960 LP Series Inbound Door Bell Register.
- */
- typedef union DAC960_LP_InboundDoorBellRegister
- {
- unsigned char All;
- struct {
- boolean HardwareMailboxNewCommand:1; /* Bit 0 */
- boolean AcknowledgeHardwareMailboxStatus:1; /* Bit 1 */
- boolean GenerateInterrupt:1; /* Bit 2 */
- boolean ControllerReset:1; /* Bit 3 */
- boolean MemoryMailboxNewCommand:1; /* Bit 4 */
- unsigned char :3; /* Bits 5-7 */
- } Write;
- struct {
- boolean HardwareMailboxFull:1; /* Bit 0 */
- boolean InitializationInProgress:1; /* Bit 1 */
- unsigned char :6; /* Bits 2-7 */
- } Read;
- }
- DAC960_LP_InboundDoorBellRegister_T;
- /*
- Define the structure of the DAC960 LP Series Outbound Door Bell Register.
- */
- typedef union DAC960_LP_OutboundDoorBellRegister
- {
- unsigned char All;
- struct {
- boolean AcknowledgeHardwareMailboxInterrupt:1; /* Bit 0 */
- boolean AcknowledgeMemoryMailboxInterrupt:1; /* Bit 1 */
- unsigned char :6; /* Bits 2-7 */
- } Write;
- struct {
- boolean HardwareMailboxStatusAvailable:1; /* Bit 0 */
- boolean MemoryMailboxStatusAvailable:1; /* Bit 1 */
- unsigned char :6; /* Bits 2-7 */
- } Read;
- }
- DAC960_LP_OutboundDoorBellRegister_T;
- /*
- Define the structure of the DAC960 LP Series Interrupt Mask Register.
- */
- typedef union DAC960_LP_InterruptMaskRegister
- {
- unsigned char All;
- struct {
- unsigned int :2; /* Bits 0-1 */
- boolean DisableInterrupts:1; /* Bit 2 */
- unsigned int :5; /* Bits 3-7 */
- } Bits;
- }
- DAC960_LP_InterruptMaskRegister_T;
- /*
- Define the structure of the DAC960 LP Series Error Status Register.
- */
- typedef union DAC960_LP_ErrorStatusRegister
- {
- unsigned char All;
- struct {
- unsigned int :2; /* Bits 0-1 */
- boolean ErrorStatusPending:1; /* Bit 2 */
- unsigned int :5; /* Bits 3-7 */
- } Bits;
- }
- DAC960_LP_ErrorStatusRegister_T;
- /*
- Define inline functions to provide an abstraction for reading and writing the
- DAC960 LP Series Controller Interface Registers.
- */
- static inline
- void DAC960_LP_HardwareMailboxNewCommand(void *ControllerBaseAddress)
- {
- DAC960_LP_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.HardwareMailboxNewCommand = true;
- writeb(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_LP_InboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_LP_AcknowledgeHardwareMailboxStatus(void *ControllerBaseAddress)
- {
- DAC960_LP_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.AcknowledgeHardwareMailboxStatus = true;
- writeb(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_LP_InboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_LP_GenerateInterrupt(void *ControllerBaseAddress)
- {
- DAC960_LP_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.GenerateInterrupt = true;
- writeb(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_LP_InboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_LP_ControllerReset(void *ControllerBaseAddress)
- {
- DAC960_LP_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.ControllerReset = true;
- writeb(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_LP_InboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_LP_MemoryMailboxNewCommand(void *ControllerBaseAddress)
- {
- DAC960_LP_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.MemoryMailboxNewCommand = true;
- writeb(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_LP_InboundDoorBellRegisterOffset);
- }
- static inline
- boolean DAC960_LP_HardwareMailboxFullP(void *ControllerBaseAddress)
- {
- DAC960_LP_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All =
- readb(ControllerBaseAddress + DAC960_LP_InboundDoorBellRegisterOffset);
- return InboundDoorBellRegister.Read.HardwareMailboxFull;
- }
- static inline
- boolean DAC960_LP_InitializationInProgressP(void *ControllerBaseAddress)
- {
- DAC960_LP_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All =
- readb(ControllerBaseAddress + DAC960_LP_InboundDoorBellRegisterOffset);
- return InboundDoorBellRegister.Read.InitializationInProgress;
- }
- static inline
- void DAC960_LP_AcknowledgeHardwareMailboxInterrupt(void *ControllerBaseAddress)
- {
- DAC960_LP_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All = 0;
- OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true;
- writeb(OutboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_LP_OutboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_LP_AcknowledgeMemoryMailboxInterrupt(void *ControllerBaseAddress)
- {
- DAC960_LP_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All = 0;
- OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true;
- writeb(OutboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_LP_OutboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_LP_AcknowledgeInterrupt(void *ControllerBaseAddress)
- {
- DAC960_LP_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All = 0;
- OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true;
- OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true;
- writeb(OutboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_LP_OutboundDoorBellRegisterOffset);
- }
- static inline
- boolean DAC960_LP_HardwareMailboxStatusAvailableP(void *ControllerBaseAddress)
- {
- DAC960_LP_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All =
- readb(ControllerBaseAddress + DAC960_LP_OutboundDoorBellRegisterOffset);
- return OutboundDoorBellRegister.Read.HardwareMailboxStatusAvailable;
- }
- static inline
- boolean DAC960_LP_MemoryMailboxStatusAvailableP(void *ControllerBaseAddress)
- {
- DAC960_LP_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All =
- readb(ControllerBaseAddress + DAC960_LP_OutboundDoorBellRegisterOffset);
- return OutboundDoorBellRegister.Read.MemoryMailboxStatusAvailable;
- }
- static inline
- void DAC960_LP_EnableInterrupts(void *ControllerBaseAddress)
- {
- DAC960_LP_InterruptMaskRegister_T InterruptMaskRegister;
- InterruptMaskRegister.All = 0xFF;
- InterruptMaskRegister.Bits.DisableInterrupts = false;
- writeb(InterruptMaskRegister.All,
- ControllerBaseAddress + DAC960_LP_InterruptMaskRegisterOffset);
- }
- static inline
- void DAC960_LP_DisableInterrupts(void *ControllerBaseAddress)
- {
- DAC960_LP_InterruptMaskRegister_T InterruptMaskRegister;
- InterruptMaskRegister.All = 0xFF;
- InterruptMaskRegister.Bits.DisableInterrupts = true;
- writeb(InterruptMaskRegister.All,
- ControllerBaseAddress + DAC960_LP_InterruptMaskRegisterOffset);
- }
- static inline
- boolean DAC960_LP_InterruptsEnabledP(void *ControllerBaseAddress)
- {
- DAC960_LP_InterruptMaskRegister_T InterruptMaskRegister;
- InterruptMaskRegister.All =
- readb(ControllerBaseAddress + DAC960_LP_InterruptMaskRegisterOffset);
- return !InterruptMaskRegister.Bits.DisableInterrupts;
- }
- static inline
- void DAC960_LP_WriteCommandMailbox(DAC960_V2_CommandMailbox_T
- *MemoryCommandMailbox,
- DAC960_V2_CommandMailbox_T
- *CommandMailbox)
- {
- memcpy(&MemoryCommandMailbox->Words[1], &CommandMailbox->Words[1],
- sizeof(DAC960_V2_CommandMailbox_T) - sizeof(unsigned int));
- wmb();
- MemoryCommandMailbox->Words[0] = CommandMailbox->Words[0];
- mb();
- }
- static inline
- void DAC960_LP_WriteHardwareMailbox(void *ControllerBaseAddress,
- DAC960_V2_CommandMailbox_T *CommandMailbox)
- {
- #ifdef __ia64__
- writeq(Virtual_to_Bus64(CommandMailbox),
- ControllerBaseAddress + DAC960_LP_CommandMailboxBusAddressOffset);
- #else
- writel(Virtual_to_Bus32(CommandMailbox),
- ControllerBaseAddress + DAC960_LP_CommandMailboxBusAddressOffset);
- #endif
- }
- static inline DAC960_V2_CommandIdentifier_T
- DAC960_LP_ReadCommandIdentifier(void *ControllerBaseAddress)
- {
- return readw(ControllerBaseAddress + DAC960_LP_CommandStatusOffset);
- }
- static inline DAC960_V2_CommandStatus_T
- DAC960_LP_ReadCommandStatus(void *ControllerBaseAddress)
- {
- return readw(ControllerBaseAddress + DAC960_LP_CommandStatusOffset + 2);
- }
- static inline boolean
- DAC960_LP_ReadErrorStatus(void *ControllerBaseAddress,
- unsigned char *ErrorStatus,
- unsigned char *Parameter0,
- unsigned char *Parameter1)
- {
- DAC960_LP_ErrorStatusRegister_T ErrorStatusRegister;
- ErrorStatusRegister.All =
- readb(ControllerBaseAddress + DAC960_LP_ErrorStatusRegisterOffset);
- if (!ErrorStatusRegister.Bits.ErrorStatusPending) return false;
- ErrorStatusRegister.Bits.ErrorStatusPending = false;
- *ErrorStatus = ErrorStatusRegister.All;
- *Parameter0 =
- readb(ControllerBaseAddress + DAC960_LP_CommandMailboxBusAddressOffset + 0);
- *Parameter1 =
- readb(ControllerBaseAddress + DAC960_LP_CommandMailboxBusAddressOffset + 1);
- writeb(0xFF, ControllerBaseAddress + DAC960_LP_ErrorStatusRegisterOffset);
- return true;
- }
- /*
- Define the DAC960 LA Series Controller Interface Register Offsets.
- */
- #define DAC960_LA_RegisterWindowSize 0x80
- typedef enum
- {
- DAC960_LA_InboundDoorBellRegisterOffset = 0x60,
- DAC960_LA_OutboundDoorBellRegisterOffset = 0x61,
- DAC960_LA_InterruptMaskRegisterOffset = 0x34,
- DAC960_LA_CommandOpcodeRegisterOffset = 0x50,
- DAC960_LA_CommandIdentifierRegisterOffset = 0x51,
- DAC960_LA_MailboxRegister2Offset = 0x52,
- DAC960_LA_MailboxRegister3Offset = 0x53,
- DAC960_LA_MailboxRegister4Offset = 0x54,
- DAC960_LA_MailboxRegister5Offset = 0x55,
- DAC960_LA_MailboxRegister6Offset = 0x56,
- DAC960_LA_MailboxRegister7Offset = 0x57,
- DAC960_LA_MailboxRegister8Offset = 0x58,
- DAC960_LA_MailboxRegister9Offset = 0x59,
- DAC960_LA_MailboxRegister10Offset = 0x5A,
- DAC960_LA_MailboxRegister11Offset = 0x5B,
- DAC960_LA_MailboxRegister12Offset = 0x5C,
- DAC960_LA_StatusCommandIdentifierRegOffset = 0x5D,
- DAC960_LA_StatusRegisterOffset = 0x5E,
- DAC960_LA_ErrorStatusRegisterOffset = 0x63
- }
- DAC960_LA_RegisterOffsets_T;
- /*
- Define the structure of the DAC960 LA Series Inbound Door Bell Register.
- */
- typedef union DAC960_LA_InboundDoorBellRegister
- {
- unsigned char All;
- struct {
- boolean HardwareMailboxNewCommand:1; /* Bit 0 */
- boolean AcknowledgeHardwareMailboxStatus:1; /* Bit 1 */
- boolean GenerateInterrupt:1; /* Bit 2 */
- boolean ControllerReset:1; /* Bit 3 */
- boolean MemoryMailboxNewCommand:1; /* Bit 4 */
- unsigned char :3; /* Bits 5-7 */
- } Write;
- struct {
- boolean HardwareMailboxEmpty:1; /* Bit 0 */
- boolean InitializationNotInProgress:1; /* Bit 1 */
- unsigned char :6; /* Bits 2-7 */
- } Read;
- }
- DAC960_LA_InboundDoorBellRegister_T;
- /*
- Define the structure of the DAC960 LA Series Outbound Door Bell Register.
- */
- typedef union DAC960_LA_OutboundDoorBellRegister
- {
- unsigned char All;
- struct {
- boolean AcknowledgeHardwareMailboxInterrupt:1; /* Bit 0 */
- boolean AcknowledgeMemoryMailboxInterrupt:1; /* Bit 1 */
- unsigned char :6; /* Bits 2-7 */
- } Write;
- struct {
- boolean HardwareMailboxStatusAvailable:1; /* Bit 0 */
- boolean MemoryMailboxStatusAvailable:1; /* Bit 1 */
- unsigned char :6; /* Bits 2-7 */
- } Read;
- }
- DAC960_LA_OutboundDoorBellRegister_T;
- /*
- Define the structure of the DAC960 LA Series Interrupt Mask Register.
- */
- typedef union DAC960_LA_InterruptMaskRegister
- {
- unsigned char All;
- struct {
- unsigned char :2; /* Bits 0-1 */
- boolean DisableInterrupts:1; /* Bit 2 */
- unsigned char :5; /* Bits 3-7 */
- } Bits;
- }
- DAC960_LA_InterruptMaskRegister_T;
- /*
- Define the structure of the DAC960 LA Series Error Status Register.
- */
- typedef union DAC960_LA_ErrorStatusRegister
- {
- unsigned char All;
- struct {
- unsigned int :2; /* Bits 0-1 */
- boolean ErrorStatusPending:1; /* Bit 2 */
- unsigned int :5; /* Bits 3-7 */
- } Bits;
- }
- DAC960_LA_ErrorStatusRegister_T;
- /*
- Define inline functions to provide an abstraction for reading and writing the
- DAC960 LA Series Controller Interface Registers.
- */
- static inline
- void DAC960_LA_HardwareMailboxNewCommand(void *ControllerBaseAddress)
- {
- DAC960_LA_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.HardwareMailboxNewCommand = true;
- writeb(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_LA_InboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_LA_AcknowledgeHardwareMailboxStatus(void *ControllerBaseAddress)
- {
- DAC960_LA_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.AcknowledgeHardwareMailboxStatus = true;
- writeb(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_LA_InboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_LA_GenerateInterrupt(void *ControllerBaseAddress)
- {
- DAC960_LA_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.GenerateInterrupt = true;
- writeb(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_LA_InboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_LA_ControllerReset(void *ControllerBaseAddress)
- {
- DAC960_LA_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.ControllerReset = true;
- writeb(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_LA_InboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_LA_MemoryMailboxNewCommand(void *ControllerBaseAddress)
- {
- DAC960_LA_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.MemoryMailboxNewCommand = true;
- writeb(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_LA_InboundDoorBellRegisterOffset);
- }
- static inline
- boolean DAC960_LA_HardwareMailboxFullP(void *ControllerBaseAddress)
- {
- DAC960_LA_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All =
- readb(ControllerBaseAddress + DAC960_LA_InboundDoorBellRegisterOffset);
- return !InboundDoorBellRegister.Read.HardwareMailboxEmpty;
- }
- static inline
- boolean DAC960_LA_InitializationInProgressP(void *ControllerBaseAddress)
- {
- DAC960_LA_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All =
- readb(ControllerBaseAddress + DAC960_LA_InboundDoorBellRegisterOffset);
- return !InboundDoorBellRegister.Read.InitializationNotInProgress;
- }
- static inline
- void DAC960_LA_AcknowledgeHardwareMailboxInterrupt(void *ControllerBaseAddress)
- {
- DAC960_LA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All = 0;
- OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true;
- writeb(OutboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_LA_OutboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_LA_AcknowledgeMemoryMailboxInterrupt(void *ControllerBaseAddress)
- {
- DAC960_LA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All = 0;
- OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true;
- writeb(OutboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_LA_OutboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_LA_AcknowledgeInterrupt(void *ControllerBaseAddress)
- {
- DAC960_LA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All = 0;
- OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true;
- OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true;
- writeb(OutboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_LA_OutboundDoorBellRegisterOffset);
- }
- static inline
- boolean DAC960_LA_HardwareMailboxStatusAvailableP(void *ControllerBaseAddress)
- {
- DAC960_LA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All =
- readb(ControllerBaseAddress + DAC960_LA_OutboundDoorBellRegisterOffset);
- return OutboundDoorBellRegister.Read.HardwareMailboxStatusAvailable;
- }
- static inline
- boolean DAC960_LA_MemoryMailboxStatusAvailableP(void *ControllerBaseAddress)
- {
- DAC960_LA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All =
- readb(ControllerBaseAddress + DAC960_LA_OutboundDoorBellRegisterOffset);
- return OutboundDoorBellRegister.Read.MemoryMailboxStatusAvailable;
- }
- static inline
- void DAC960_LA_EnableInterrupts(void *ControllerBaseAddress)
- {
- DAC960_LA_InterruptMaskRegister_T InterruptMaskRegister;
- InterruptMaskRegister.All = 0xFF;
- InterruptMaskRegister.Bits.DisableInterrupts = false;
- writeb(InterruptMaskRegister.All,
- ControllerBaseAddress + DAC960_LA_InterruptMaskRegisterOffset);
- }
- static inline
- void DAC960_LA_DisableInterrupts(void *ControllerBaseAddress)
- {
- DAC960_LA_InterruptMaskRegister_T InterruptMaskRegister;
- InterruptMaskRegister.All = 0xFF;
- InterruptMaskRegister.Bits.DisableInterrupts = true;
- writeb(InterruptMaskRegister.All,
- ControllerBaseAddress + DAC960_LA_InterruptMaskRegisterOffset);
- }
- static inline
- boolean DAC960_LA_InterruptsEnabledP(void *ControllerBaseAddress)
- {
- DAC960_LA_InterruptMaskRegister_T InterruptMaskRegister;
- InterruptMaskRegister.All =
- readb(ControllerBaseAddress + DAC960_LA_InterruptMaskRegisterOffset);
- return !InterruptMaskRegister.Bits.DisableInterrupts;
- }
- static inline
- void DAC960_LA_WriteCommandMailbox(DAC960_V1_CommandMailbox_T
- *MemoryCommandMailbox,
- DAC960_V1_CommandMailbox_T
- *CommandMailbox)
- {
- MemoryCommandMailbox->Words[1] = CommandMailbox->Words[1];
- MemoryCommandMailbox->Words[2] = CommandMailbox->Words[2];
- MemoryCommandMailbox->Words[3] = CommandMailbox->Words[3];
- wmb();
- MemoryCommandMailbox->Words[0] = CommandMailbox->Words[0];
- mb();
- }
- static inline
- void DAC960_LA_WriteHardwareMailbox(void *ControllerBaseAddress,
- DAC960_V1_CommandMailbox_T *CommandMailbox)
- {
- writel(CommandMailbox->Words[0],
- ControllerBaseAddress + DAC960_LA_CommandOpcodeRegisterOffset);
- writel(CommandMailbox->Words[1],
- ControllerBaseAddress + DAC960_LA_MailboxRegister4Offset);
- writel(CommandMailbox->Words[2],
- ControllerBaseAddress + DAC960_LA_MailboxRegister8Offset);
- writeb(CommandMailbox->Bytes[12],
- ControllerBaseAddress + DAC960_LA_MailboxRegister12Offset);
- }
- static inline DAC960_V1_CommandIdentifier_T
- DAC960_LA_ReadStatusCommandIdentifier(void *ControllerBaseAddress)
- {
- return readb(ControllerBaseAddress
- + DAC960_LA_StatusCommandIdentifierRegOffset);
- }
- static inline DAC960_V1_CommandStatus_T
- DAC960_LA_ReadStatusRegister(void *ControllerBaseAddress)
- {
- return readw(ControllerBaseAddress + DAC960_LA_StatusRegisterOffset);
- }
- static inline boolean
- DAC960_LA_ReadErrorStatus(void *ControllerBaseAddress,
- unsigned char *ErrorStatus,
- unsigned char *Parameter0,
- unsigned char *Parameter1)
- {
- DAC960_LA_ErrorStatusRegister_T ErrorStatusRegister;
- ErrorStatusRegister.All =
- readb(ControllerBaseAddress + DAC960_LA_ErrorStatusRegisterOffset);
- if (!ErrorStatusRegister.Bits.ErrorStatusPending) return false;
- ErrorStatusRegister.Bits.ErrorStatusPending = false;
- *ErrorStatus = ErrorStatusRegister.All;
- *Parameter0 =
- readb(ControllerBaseAddress + DAC960_LA_CommandOpcodeRegisterOffset);
- *Parameter1 =
- readb(ControllerBaseAddress + DAC960_LA_CommandIdentifierRegisterOffset);
- writeb(0xFF, ControllerBaseAddress + DAC960_LA_ErrorStatusRegisterOffset);
- return true;
- }
- static inline
- void DAC960_LA_SaveMemoryMailboxInfo(DAC960_Controller_T *Controller)
- {
- #ifdef __i386__
- void *ControllerBaseAddress = Controller->BaseAddress;
- writel(0x743C485E,
- ControllerBaseAddress + DAC960_LA_CommandOpcodeRegisterOffset);
- writel((unsigned long) Controller->V1.FirstCommandMailbox,
- ControllerBaseAddress + DAC960_LA_MailboxRegister4Offset);
- writew(Controller->V1.NextCommandMailbox - Controller->V1.FirstCommandMailbox,
- ControllerBaseAddress + DAC960_LA_MailboxRegister8Offset);
- writew(Controller->V1.NextStatusMailbox - Controller->V1.FirstStatusMailbox,
- ControllerBaseAddress + DAC960_LA_MailboxRegister10Offset);
- #endif
- }
- static inline
- void DAC960_LA_RestoreMemoryMailboxInfo(DAC960_Controller_T *Controller,
- void **MemoryMailboxAddress,
- short *NextCommandMailboxIndex,
- short *NextStatusMailboxIndex)
- {
- #ifdef __i386__
- void *ControllerBaseAddress = Controller->BaseAddress;
- if (readl(ControllerBaseAddress
- + DAC960_LA_CommandOpcodeRegisterOffset) != 0x743C485E)
- return;
- *MemoryMailboxAddress =
- (void *) readl(ControllerBaseAddress + DAC960_LA_MailboxRegister4Offset);
- *NextCommandMailboxIndex =
- readw(ControllerBaseAddress + DAC960_LA_MailboxRegister8Offset);
- *NextStatusMailboxIndex =
- readw(ControllerBaseAddress + DAC960_LA_MailboxRegister10Offset);
- #endif
- }
- /*
- Define the DAC960 PG Series Controller Interface Register Offsets.
- */
- #define DAC960_PG_RegisterWindowSize 0x2000
- typedef enum
- {
- DAC960_PG_InboundDoorBellRegisterOffset = 0x0020,
- DAC960_PG_OutboundDoorBellRegisterOffset = 0x002C,
- DAC960_PG_InterruptMaskRegisterOffset = 0x0034,
- DAC960_PG_CommandOpcodeRegisterOffset = 0x1000,
- DAC960_PG_CommandIdentifierRegisterOffset = 0x1001,
- DAC960_PG_MailboxRegister2Offset = 0x1002,
- DAC960_PG_MailboxRegister3Offset = 0x1003,
- DAC960_PG_MailboxRegister4Offset = 0x1004,
- DAC960_PG_MailboxRegister5Offset = 0x1005,
- DAC960_PG_MailboxRegister6Offset = 0x1006,
- DAC960_PG_MailboxRegister7Offset = 0x1007,
- DAC960_PG_MailboxRegister8Offset = 0x1008,
- DAC960_PG_MailboxRegister9Offset = 0x1009,
- DAC960_PG_MailboxRegister10Offset = 0x100A,
- DAC960_PG_MailboxRegister11Offset = 0x100B,
- DAC960_PG_MailboxRegister12Offset = 0x100C,
- DAC960_PG_StatusCommandIdentifierRegOffset = 0x1018,
- DAC960_PG_StatusRegisterOffset = 0x101A,
- DAC960_PG_ErrorStatusRegisterOffset = 0x103F
- }
- DAC960_PG_RegisterOffsets_T;
- /*
- Define the structure of the DAC960 PG Series Inbound Door Bell Register.
- */
- typedef union DAC960_PG_InboundDoorBellRegister
- {
- unsigned int All;
- struct {
- boolean HardwareMailboxNewCommand:1; /* Bit 0 */
- boolean AcknowledgeHardwareMailboxStatus:1; /* Bit 1 */
- boolean GenerateInterrupt:1; /* Bit 2 */
- boolean ControllerReset:1; /* Bit 3 */
- boolean MemoryMailboxNewCommand:1; /* Bit 4 */
- unsigned int :27; /* Bits 5-31 */
- } Write;
- struct {
- boolean HardwareMailboxFull:1; /* Bit 0 */
- boolean InitializationInProgress:1; /* Bit 1 */
- unsigned int :30; /* Bits 2-31 */
- } Read;
- }
- DAC960_PG_InboundDoorBellRegister_T;
- /*
- Define the structure of the DAC960 PG Series Outbound Door Bell Register.
- */
- typedef union DAC960_PG_OutboundDoorBellRegister
- {
- unsigned int All;
- struct {
- boolean AcknowledgeHardwareMailboxInterrupt:1; /* Bit 0 */
- boolean AcknowledgeMemoryMailboxInterrupt:1; /* Bit 1 */
- unsigned int :30; /* Bits 2-31 */
- } Write;
- struct {
- boolean HardwareMailboxStatusAvailable:1; /* Bit 0 */
- boolean MemoryMailboxStatusAvailable:1; /* Bit 1 */
- unsigned int :30; /* Bits 2-31 */
- } Read;
- }
- DAC960_PG_OutboundDoorBellRegister_T;
- /*
- Define the structure of the DAC960 PG Series Interrupt Mask Register.
- */
- typedef union DAC960_PG_InterruptMaskRegister
- {
- unsigned int All;
- struct {
- unsigned int MessageUnitInterruptMask1:2; /* Bits 0-1 */
- boolean DisableInterrupts:1; /* Bit 2 */
- unsigned int MessageUnitInterruptMask2:5; /* Bits 3-7 */
- unsigned int Reserved0:24; /* Bits 8-31 */
- } Bits;
- }
- DAC960_PG_InterruptMaskRegister_T;
- /*
- Define the structure of the DAC960 PG Series Error Status Register.
- */
- typedef union DAC960_PG_ErrorStatusRegister
- {
- unsigned char All;
- struct {
- unsigned int :2; /* Bits 0-1 */
- boolean ErrorStatusPending:1; /* Bit 2 */
- unsigned int :5; /* Bits 3-7 */
- } Bits;
- }
- DAC960_PG_ErrorStatusRegister_T;
- /*
- Define inline functions to provide an abstraction for reading and writing the
- DAC960 PG Series Controller Interface Registers.
- */
- static inline
- void DAC960_PG_HardwareMailboxNewCommand(void *ControllerBaseAddress)
- {
- DAC960_PG_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.HardwareMailboxNewCommand = true;
- writel(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_PG_InboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_PG_AcknowledgeHardwareMailboxStatus(void *ControllerBaseAddress)
- {
- DAC960_PG_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.AcknowledgeHardwareMailboxStatus = true;
- writel(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_PG_InboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_PG_GenerateInterrupt(void *ControllerBaseAddress)
- {
- DAC960_PG_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.GenerateInterrupt = true;
- writel(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_PG_InboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_PG_ControllerReset(void *ControllerBaseAddress)
- {
- DAC960_PG_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.ControllerReset = true;
- writel(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_PG_InboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_PG_MemoryMailboxNewCommand(void *ControllerBaseAddress)
- {
- DAC960_PG_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.MemoryMailboxNewCommand = true;
- writel(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_PG_InboundDoorBellRegisterOffset);
- }
- static inline
- boolean DAC960_PG_HardwareMailboxFullP(void *ControllerBaseAddress)
- {
- DAC960_PG_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All =
- readl(ControllerBaseAddress + DAC960_PG_InboundDoorBellRegisterOffset);
- return InboundDoorBellRegister.Read.HardwareMailboxFull;
- }
- static inline
- boolean DAC960_PG_InitializationInProgressP(void *ControllerBaseAddress)
- {
- DAC960_PG_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All =
- readl(ControllerBaseAddress + DAC960_PG_InboundDoorBellRegisterOffset);
- return InboundDoorBellRegister.Read.InitializationInProgress;
- }
- static inline
- void DAC960_PG_AcknowledgeHardwareMailboxInterrupt(void *ControllerBaseAddress)
- {
- DAC960_PG_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All = 0;
- OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true;
- writel(OutboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_PG_OutboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_PG_AcknowledgeMemoryMailboxInterrupt(void *ControllerBaseAddress)
- {
- DAC960_PG_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All = 0;
- OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true;
- writel(OutboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_PG_OutboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_PG_AcknowledgeInterrupt(void *ControllerBaseAddress)
- {
- DAC960_PG_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All = 0;
- OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true;
- OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true;
- writel(OutboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_PG_OutboundDoorBellRegisterOffset);
- }
- static inline
- boolean DAC960_PG_HardwareMailboxStatusAvailableP(void *ControllerBaseAddress)
- {
- DAC960_PG_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All =
- readl(ControllerBaseAddress + DAC960_PG_OutboundDoorBellRegisterOffset);
- return OutboundDoorBellRegister.Read.HardwareMailboxStatusAvailable;
- }
- static inline
- boolean DAC960_PG_MemoryMailboxStatusAvailableP(void *ControllerBaseAddress)
- {
- DAC960_PG_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All =
- readl(ControllerBaseAddress + DAC960_PG_OutboundDoorBellRegisterOffset);
- return OutboundDoorBellRegister.Read.MemoryMailboxStatusAvailable;
- }
- static inline
- void DAC960_PG_EnableInterrupts(void *ControllerBaseAddress)
- {
- DAC960_PG_InterruptMaskRegister_T InterruptMaskRegister;
- InterruptMaskRegister.All = 0;
- InterruptMaskRegister.Bits.MessageUnitInterruptMask1 = 0x3;
- InterruptMaskRegister.Bits.DisableInterrupts = false;
- InterruptMaskRegister.Bits.MessageUnitInterruptMask2 = 0x1F;
- writel(InterruptMaskRegister.All,
- ControllerBaseAddress + DAC960_PG_InterruptMaskRegisterOffset);
- }
- static inline
- void DAC960_PG_DisableInterrupts(void *ControllerBaseAddress)
- {
- DAC960_PG_InterruptMaskRegister_T InterruptMaskRegister;
- InterruptMaskRegister.All = 0;
- InterruptMaskRegister.Bits.MessageUnitInterruptMask1 = 0x3;
- InterruptMaskRegister.Bits.DisableInterrupts = true;
- InterruptMaskRegister.Bits.MessageUnitInterruptMask2 = 0x1F;
- writel(InterruptMaskRegister.All,
- ControllerBaseAddress + DAC960_PG_InterruptMaskRegisterOffset);
- }
- static inline
- boolean DAC960_PG_InterruptsEnabledP(void *ControllerBaseAddress)
- {
- DAC960_PG_InterruptMaskRegister_T InterruptMaskRegister;
- InterruptMaskRegister.All =
- readl(ControllerBaseAddress + DAC960_PG_InterruptMaskRegisterOffset);
- return !InterruptMaskRegister.Bits.DisableInterrupts;
- }
- static inline
- void DAC960_PG_WriteCommandMailbox(DAC960_V1_CommandMailbox_T
- *MemoryCommandMailbox,
- DAC960_V1_CommandMailbox_T
- *CommandMailbox)
- {
- MemoryCommandMailbox->Words[1] = CommandMailbox->Words[1];
- MemoryCommandMailbox->Words[2] = CommandMailbox->Words[2];
- MemoryCommandMailbox->Words[3] = CommandMailbox->Words[3];
- wmb();
- MemoryCommandMailbox->Words[0] = CommandMailbox->Words[0];
- mb();
- }
- static inline
- void DAC960_PG_WriteHardwareMailbox(void *ControllerBaseAddress,
- DAC960_V1_CommandMailbox_T *CommandMailbox)
- {
- writel(CommandMailbox->Words[0],
- ControllerBaseAddress + DAC960_PG_CommandOpcodeRegisterOffset);
- writel(CommandMailbox->Words[1],
- ControllerBaseAddress + DAC960_PG_MailboxRegister4Offset);
- writel(CommandMailbox->Words[2],
- ControllerBaseAddress + DAC960_PG_MailboxRegister8Offset);
- writeb(CommandMailbox->Bytes[12],
- ControllerBaseAddress + DAC960_PG_MailboxRegister12Offset);
- }
- static inline DAC960_V1_CommandIdentifier_T
- DAC960_PG_ReadStatusCommandIdentifier(void *ControllerBaseAddress)
- {
- return readb(ControllerBaseAddress
- + DAC960_PG_StatusCommandIdentifierRegOffset);
- }
- static inline DAC960_V1_CommandStatus_T
- DAC960_PG_ReadStatusRegister(void *ControllerBaseAddress)
- {
- return readw(ControllerBaseAddress + DAC960_PG_StatusRegisterOffset);
- }
- static inline boolean
- DAC960_PG_ReadErrorStatus(void *ControllerBaseAddress,
- unsigned char *ErrorStatus,
- unsigned char *Parameter0,
- unsigned char *Parameter1)
- {
- DAC960_PG_ErrorStatusRegister_T ErrorStatusRegister;
- ErrorStatusRegister.All =
- readb(ControllerBaseAddress + DAC960_PG_ErrorStatusRegisterOffset);
- if (!ErrorStatusRegister.Bits.ErrorStatusPending) return false;
- ErrorStatusRegister.Bits.ErrorStatusPending = false;
- *ErrorStatus = ErrorStatusRegister.All;
- *Parameter0 =
- readb(ControllerBaseAddress + DAC960_PG_CommandOpcodeRegisterOffset);
- *Parameter1 =
- readb(ControllerBaseAddress + DAC960_PG_CommandIdentifierRegisterOffset);
- writeb(0, ControllerBaseAddress + DAC960_PG_ErrorStatusRegisterOffset);
- return true;
- }
- static inline
- void DAC960_PG_SaveMemoryMailboxInfo(DAC960_Controller_T *Controller)
- {
- #ifdef __i386__
- void *ControllerBaseAddress = Controller->BaseAddress;
- writel(0x743C485E,
- ControllerBaseAddress + DAC960_PG_CommandOpcodeRegisterOffset);
- writel((unsigned long) Controller->V1.FirstCommandMailbox,
- ControllerBaseAddress + DAC960_PG_MailboxRegister4Offset);
- writew(Controller->V1.NextCommandMailbox - Controller->V1.FirstCommandMailbox,
- ControllerBaseAddress + DAC960_PG_MailboxRegister8Offset);
- writew(Controller->V1.NextStatusMailbox - Controller->V1.FirstStatusMailbox,
- ControllerBaseAddress + DAC960_PG_MailboxRegister10Offset);
- #endif
- }
- static inline
- void DAC960_PG_RestoreMemoryMailboxInfo(DAC960_Controller_T *Controller,
- void **MemoryMailboxAddress,
- short *NextCommandMailboxIndex,
- short *NextStatusMailboxIndex)
- {
- #ifdef __i386__
- void *ControllerBaseAddress = Controller->BaseAddress;
- if (readl(ControllerBaseAddress
- + DAC960_PG_CommandOpcodeRegisterOffset) != 0x743C485E)
- return;
- *MemoryMailboxAddress =
- (void *) readl(ControllerBaseAddress + DAC960_PG_MailboxRegister4Offset);
- *NextCommandMailboxIndex =
- readw(ControllerBaseAddress + DAC960_PG_MailboxRegister8Offset);
- *NextStatusMailboxIndex =
- readw(ControllerBaseAddress + DAC960_PG_MailboxRegister10Offset);
- #endif
- }
- /*
- Define the DAC960 PD Series Controller Interface Register Offsets.
- */
- #define DAC960_PD_RegisterWindowSize 0x80
- typedef enum
- {
- DAC960_PD_CommandOpcodeRegisterOffset = 0x00,
- DAC960_PD_CommandIdentifierRegisterOffset = 0x01,
- DAC960_PD_MailboxRegister2Offset = 0x02,
- DAC960_PD_MailboxRegister3Offset = 0x03,
- DAC960_PD_MailboxRegister4Offset = 0x04,
- DAC960_PD_MailboxRegister5Offset = 0x05,
- DAC960_PD_MailboxRegister6Offset = 0x06,
- DAC960_PD_MailboxRegister7Offset = 0x07,
- DAC960_PD_MailboxRegister8Offset = 0x08,
- DAC960_PD_MailboxRegister9Offset = 0x09,
- DAC960_PD_MailboxRegister10Offset = 0x0A,
- DAC960_PD_MailboxRegister11Offset = 0x0B,
- DAC960_PD_MailboxRegister12Offset = 0x0C,
- DAC960_PD_StatusCommandIdentifierRegOffset = 0x0D,
- DAC960_PD_StatusRegisterOffset = 0x0E,
- DAC960_PD_ErrorStatusRegisterOffset = 0x3F,
- DAC960_PD_InboundDoorBellRegisterOffset = 0x40,
- DAC960_PD_OutboundDoorBellRegisterOffset = 0x41,
- DAC960_PD_InterruptEnableRegisterOffset = 0x43
- }
- DAC960_PD_RegisterOffsets_T;
- /*
- Define the structure of the DAC960 PD Series Inbound Door Bell Register.
- */
- typedef union DAC960_PD_InboundDoorBellRegister
- {
- unsigned char All;
- struct {
- boolean NewCommand:1; /* Bit 0 */
- boolean AcknowledgeStatus:1; /* Bit 1 */
- boolean GenerateInterrupt:1; /* Bit 2 */
- boolean ControllerReset:1; /* Bit 3 */
- unsigned char :4; /* Bits 4-7 */
- } Write;
- struct {
- boolean MailboxFull:1; /* Bit 0 */
- boolean InitializationInProgress:1; /* Bit 1 */
- unsigned char :6; /* Bits 2-7 */
- } Read;
- }
- DAC960_PD_InboundDoorBellRegister_T;
- /*
- Define the structure of the DAC960 PD Series Outbound Door Bell Register.
- */
- typedef union DAC960_PD_OutboundDoorBellRegister
- {
- unsigned char All;
- struct {
- boolean AcknowledgeInterrupt:1; /* Bit 0 */
- unsigned char :7; /* Bits 1-7 */
- } Write;
- struct {
- boolean StatusAvailable:1; /* Bit 0 */
- unsigned char :7; /* Bits 1-7 */
- } Read;
- }
- DAC960_PD_OutboundDoorBellRegister_T;
- /*
- Define the structure of the DAC960 PD Series Interrupt Enable Register.
- */
- typedef union DAC960_PD_InterruptEnableRegister
- {
- unsigned char All;
- struct {
- boolean EnableInterrupts:1; /* Bit 0 */
- unsigned char :7; /* Bits 1-7 */
- } Bits;
- }
- DAC960_PD_InterruptEnableRegister_T;
- /*
- Define the structure of the DAC960 PD Series Error Status Register.
- */
- typedef union DAC960_PD_ErrorStatusRegister
- {
- unsigned char All;
- struct {
- unsigned int :2; /* Bits 0-1 */
- boolean ErrorStatusPending:1; /* Bit 2 */
- unsigned int :5; /* Bits 3-7 */
- } Bits;
- }
- DAC960_PD_ErrorStatusRegister_T;
- /*
- Define inline functions to provide an abstraction for reading and writing the
- DAC960 PD Series Controller Interface Registers.
- */
- static inline
- void DAC960_PD_NewCommand(void *ControllerBaseAddress)
- {
- DAC960_PD_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.NewCommand = true;
- writeb(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_PD_InboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_PD_AcknowledgeStatus(void *ControllerBaseAddress)
- {
- DAC960_PD_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.AcknowledgeStatus = true;
- writeb(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_PD_InboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_PD_GenerateInterrupt(void *ControllerBaseAddress)
- {
- DAC960_PD_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.GenerateInterrupt = true;
- writeb(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_PD_InboundDoorBellRegisterOffset);
- }
- static inline
- void DAC960_PD_ControllerReset(void *ControllerBaseAddress)
- {
- DAC960_PD_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All = 0;
- InboundDoorBellRegister.Write.ControllerReset = true;
- writeb(InboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_PD_InboundDoorBellRegisterOffset);
- }
- static inline
- boolean DAC960_PD_MailboxFullP(void *ControllerBaseAddress)
- {
- DAC960_PD_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All =
- readb(ControllerBaseAddress + DAC960_PD_InboundDoorBellRegisterOffset);
- return InboundDoorBellRegister.Read.MailboxFull;
- }
- static inline
- boolean DAC960_PD_InitializationInProgressP(void *ControllerBaseAddress)
- {
- DAC960_PD_InboundDoorBellRegister_T InboundDoorBellRegister;
- InboundDoorBellRegister.All =
- readb(ControllerBaseAddress + DAC960_PD_InboundDoorBellRegisterOffset);
- return InboundDoorBellRegister.Read.InitializationInProgress;
- }
- static inline
- void DAC960_PD_AcknowledgeInterrupt(void *ControllerBaseAddress)
- {
- DAC960_PD_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All = 0;
- OutboundDoorBellRegister.Write.AcknowledgeInterrupt = true;
- writeb(OutboundDoorBellRegister.All,
- ControllerBaseAddress + DAC960_PD_OutboundDoorBellRegisterOffset);
- }
- static inline
- boolean DAC960_PD_StatusAvailableP(void *ControllerBaseAddress)
- {
- DAC960_PD_OutboundDoorBellRegister_T OutboundDoorBellRegister;
- OutboundDoorBellRegister.All =
- readb(ControllerBaseAddress + DAC960_PD_OutboundDoorBellRegisterOffset);
- return OutboundDoorBellRegister.Read.StatusAvailable;
- }
- static inline
- void DAC960_PD_EnableInterrupts(void *ControllerBaseAddress)
- {
- DAC960_PD_InterruptEnableRegister_T InterruptEnableRegister;
- InterruptEnableRegister.All = 0;
- InterruptEnableRegister.Bits.EnableInterrupts = true;
- writeb(InterruptEnableRegister.All,
- ControllerBaseAddress + DAC960_PD_InterruptEnableRegisterOffset);
- }
- static inline
- void DAC960_PD_DisableInterrupts(void *ControllerBaseAddress)
- {
- DAC960_PD_InterruptEnableRegister_T InterruptEnableRegister;
- InterruptEnableRegister.All = 0;
- InterruptEnableRegister.Bits.EnableInterrupts = false;
- writeb(InterruptEnableRegister.All,
- ControllerBaseAddress + DAC960_PD_InterruptEnableRegisterOffset);
- }
- static inline
- boolean DAC960_PD_InterruptsEnabledP(void *ControllerBaseAddress)
- {
- DAC960_PD_InterruptEnableRegister_T InterruptEnableRegister;
- InterruptEnableRegister.All =
- readb(ControllerBaseAddress + DAC960_PD_InterruptEnableRegisterOffset);
- return InterruptEnableRegister.Bits.EnableInterrupts;
- }
- static inline
- void DAC960_PD_WriteCommandMailbox(void *ControllerBaseAddress,
- DAC960_V1_CommandMailbox_T *CommandMailbox)
- {
- writel(CommandMailbox->Words[0],
- ControllerBaseAddress + DAC960_PD_CommandOpcodeRegisterOffset);
- writel(CommandMailbox->Words[1],
- ControllerBaseAddress + DAC960_PD_MailboxRegister4Offset);
- writel(CommandMailbox->Words[2],
- ControllerBaseAddress + DAC960_PD_MailboxRegister8Offset);
- writeb(CommandMailbox->Bytes[12],
- ControllerBaseAddress + DAC960_PD_MailboxRegister12Offset);
- }
- static inline DAC960_V1_CommandIdentifier_T
- DAC960_PD_ReadStatusCommandIdentifier(void *ControllerBaseAddress)
- {
- return readb(ControllerBaseAddress
- + DAC960_PD_StatusCommandIdentifierRegOffset);
- }
- static inline DAC960_V1_CommandStatus_T
- DAC960_PD_ReadStatusRegister(void *ControllerBaseAddress)
- {
- return readw(ControllerBaseAddress + DAC960_PD_StatusRegisterOffset);
- }
- static inline boolean
- DAC960_PD_ReadErrorStatus(void *ControllerBaseAddress,
- unsigned char *ErrorStatus,
- unsigned char *Parameter0,
- unsigned char *Parameter1)
- {
- DAC960_PD_ErrorStatusRegister_T ErrorStatusRegister;
- ErrorStatusRegister.All =
- readb(ControllerBaseAddress + DAC960_PD_ErrorStatusRegisterOffset);
- if (!ErrorStatusRegister.Bits.ErrorStatusPending) return false;
- ErrorStatusRegister.Bits.ErrorStatusPending = false;
- *ErrorStatus = ErrorStatusRegister.All;
- *Parameter0 =
- readb(ControllerBaseAddress + DAC960_PD_CommandOpcodeRegisterOffset);
- *Parameter1 =
- readb(ControllerBaseAddress + DAC960_PD_CommandIdentifierRegisterOffset);
- writeb(0, ControllerBaseAddress + DAC960_PD_ErrorStatusRegisterOffset);
- return true;
- }
- static inline void DAC960_P_To_PD_TranslateEnquiry(void *Enquiry)
- {
- memcpy(Enquiry + 132, Enquiry + 36, 64);
- memset(Enquiry + 36, 0, 96);
- }
- static inline void DAC960_P_To_PD_TranslateDeviceState(void *DeviceState)
- {
- memcpy(DeviceState + 2, DeviceState + 3, 1);
- memcpy(DeviceState + 4, DeviceState + 5, 2);
- memcpy(DeviceState + 6, DeviceState + 8, 4);
- }
- static inline
- void DAC960_PD_To_P_TranslateReadWriteCommand(DAC960_V1_CommandMailbox_T
- *CommandMailbox)
- {
- int LogicalDriveNumber = CommandMailbox->Type5.LD.LogicalDriveNumber;
- CommandMailbox->Bytes[3] &= 0x7;
- CommandMailbox->Bytes[3] |= CommandMailbox->Bytes[7] << 6;
- CommandMailbox->Bytes[7] = LogicalDriveNumber;
- }
- static inline
- void DAC960_P_To_PD_TranslateReadWriteCommand(DAC960_V1_CommandMailbox_T
- *CommandMailbox)
- {
- int LogicalDriveNumber = CommandMailbox->Bytes[7];
- CommandMailbox->Bytes[7] = CommandMailbox->Bytes[3] >> 6;
- CommandMailbox->Bytes[3] &= 0x7;
- CommandMailbox->Bytes[3] |= LogicalDriveNumber << 3;
- }
- /*
- Define prototypes for the forward referenced DAC960 Driver Internal Functions.
- */
- static void DAC960_FinalizeController(DAC960_Controller_T *);
- static int DAC960_Notifier(NotifierBlock_T *, unsigned long, void *);
- static void DAC960_V1_QueueReadWriteCommand(DAC960_Command_T *);
- static void DAC960_V2_QueueReadWriteCommand(DAC960_Command_T *);
- static void DAC960_RequestFunction(RequestQueue_T *);
- static void DAC960_BA_InterruptHandler(int, void *, Registers_T *);
- static void DAC960_LP_InterruptHandler(int, void *, Registers_T *);
- static void DAC960_LA_InterruptHandler(int, void *, Registers_T *);
- static void DAC960_PG_InterruptHandler(int, void *, Registers_T *);
- static void DAC960_PD_InterruptHandler(int, void *, Registers_T *);
- static void DAC960_P_InterruptHandler(int, void *, Registers_T *);
- static void DAC960_V1_QueueMonitoringCommand(DAC960_Command_T *);
- static void DAC960_V2_QueueMonitoringCommand(DAC960_Command_T *);
- static void DAC960_MonitoringTimerFunction(unsigned long);
- static int DAC960_Open(Inode_T *, File_T *);
- static int DAC960_Release(Inode_T *, File_T *);
- static int DAC960_IOCTL(Inode_T *, File_T *, unsigned int, unsigned long);
- static int DAC960_UserIOCTL(Inode_T *, File_T *, unsigned int, unsigned long);
- static void DAC960_Message(DAC960_MessageLevel_T, unsigned char *,
- DAC960_Controller_T *, ...);
- static void DAC960_CreateProcEntries(void);
- static void DAC960_DestroyProcEntries(void);
- /*
- Export the Kernel Mode IOCTL interface.
- */
- EXPORT_SYMBOL(DAC960_KernelIOCTL);
- #endif /* DAC960_DriverVersion */