diff options
author | Christoph Hellwig <hch@lst.de> | 2005-05-05 19:15:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-05 19:36:43 -0400 |
commit | 5b76ffd5d9f12ba850fc988188f55056204ad4e2 (patch) | |
tree | d7d694c32ce2b8caa468d12970b6602e0ffbeb55 /drivers | |
parent | c835a388968f5437491e3fe6e9b0332bc3c52e0e (diff) |
[PATCH] DAC960: add support for Mylex AcceleRAID 4/5/600
This patch adds support for a new class of DAC960 controllers. It's based
on the GPLed idac320 driver from IBM for Linux 2.4.18. That driver is a
fork of the 2.4.18 version of DAC960 that adds support for this new type of
controllers (internally called "GEM Series"), that differ from other DAC960
V2 firmware controllers only in the register offsets and removes support
for all others.
This patch instead integrates support for these controllers into the DAC960
driver.
Thanks to Anders Norrbring for pointing me to the idac320 driver and
testing this patch.
No Signed-Off: line because all code is either copy & pasted from IBM's
idac320 driver or support for other controllers in the 2.6 DAC960 driver.
Note: the really odd formating matches the rest of the DAC960 driver.
Cc: Dave Olien <dmo@osdl.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/DAC960.c | 132 | ||||
-rw-r--r-- | drivers/block/DAC960.h | 317 |
2 files changed, 448 insertions, 1 deletions
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 423bbf2000d2..3760edfdc65c 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -3,6 +3,7 @@ | |||
3 | Linux Driver for Mylex DAC960/AcceleRAID/eXtremeRAID PCI RAID Controllers | 3 | Linux Driver for Mylex DAC960/AcceleRAID/eXtremeRAID PCI RAID Controllers |
4 | 4 | ||
5 | Copyright 1998-2001 by Leonard N. Zubkoff <lnz@dandelion.com> | 5 | Copyright 1998-2001 by Leonard N. Zubkoff <lnz@dandelion.com> |
6 | Portions Copyright 2002 by Mylex (An IBM Business Unit) | ||
6 | 7 | ||
7 | This program is free software; you may redistribute and/or modify it under | 8 | This program is free software; you may redistribute and/or modify it under |
8 | the terms of the GNU General Public License Version 2 as published by the | 9 | the terms of the GNU General Public License Version 2 as published by the |
@@ -532,6 +533,34 @@ static void DAC960_WaitForCommand(DAC960_Controller_T *Controller) | |||
532 | spin_lock_irq(&Controller->queue_lock); | 533 | spin_lock_irq(&Controller->queue_lock); |
533 | } | 534 | } |
534 | 535 | ||
536 | /* | ||
537 | DAC960_GEM_QueueCommand queues Command for DAC960 GEM Series Controllers. | ||
538 | */ | ||
539 | |||
540 | static void DAC960_GEM_QueueCommand(DAC960_Command_T *Command) | ||
541 | { | ||
542 | DAC960_Controller_T *Controller = Command->Controller; | ||
543 | void __iomem *ControllerBaseAddress = Controller->BaseAddress; | ||
544 | DAC960_V2_CommandMailbox_T *CommandMailbox = &Command->V2.CommandMailbox; | ||
545 | DAC960_V2_CommandMailbox_T *NextCommandMailbox = | ||
546 | Controller->V2.NextCommandMailbox; | ||
547 | |||
548 | CommandMailbox->Common.CommandIdentifier = Command->CommandIdentifier; | ||
549 | DAC960_GEM_WriteCommandMailbox(NextCommandMailbox, CommandMailbox); | ||
550 | |||
551 | if (Controller->V2.PreviousCommandMailbox1->Words[0] == 0 || | ||
552 | Controller->V2.PreviousCommandMailbox2->Words[0] == 0) | ||
553 | DAC960_GEM_MemoryMailboxNewCommand(ControllerBaseAddress); | ||
554 | |||
555 | Controller->V2.PreviousCommandMailbox2 = | ||
556 | Controller->V2.PreviousCommandMailbox1; | ||
557 | Controller->V2.PreviousCommandMailbox1 = NextCommandMailbox; | ||
558 | |||
559 | if (++NextCommandMailbox > Controller->V2.LastCommandMailbox) | ||
560 | NextCommandMailbox = Controller->V2.FirstCommandMailbox; | ||
561 | |||
562 | Controller->V2.NextCommandMailbox = NextCommandMailbox; | ||
563 | } | ||
535 | 564 | ||
536 | /* | 565 | /* |
537 | DAC960_BA_QueueCommand queues Command for DAC960 BA Series Controllers. | 566 | DAC960_BA_QueueCommand queues Command for DAC960 BA Series Controllers. |
@@ -1464,6 +1493,17 @@ static boolean DAC960_V2_EnableMemoryMailboxInterface(DAC960_Controller_T | |||
1464 | Controller->V2.FirstStatusMailboxDMA; | 1493 | Controller->V2.FirstStatusMailboxDMA; |
1465 | switch (Controller->HardwareType) | 1494 | switch (Controller->HardwareType) |
1466 | { | 1495 | { |
1496 | case DAC960_GEM_Controller: | ||
1497 | while (DAC960_GEM_HardwareMailboxFullP(ControllerBaseAddress)) | ||
1498 | udelay(1); | ||
1499 | DAC960_GEM_WriteHardwareMailbox(ControllerBaseAddress, CommandMailboxDMA); | ||
1500 | DAC960_GEM_HardwareMailboxNewCommand(ControllerBaseAddress); | ||
1501 | while (!DAC960_GEM_HardwareMailboxStatusAvailableP(ControllerBaseAddress)) | ||
1502 | udelay(1); | ||
1503 | CommandStatus = DAC960_GEM_ReadCommandStatus(ControllerBaseAddress); | ||
1504 | DAC960_GEM_AcknowledgeHardwareMailboxInterrupt(ControllerBaseAddress); | ||
1505 | DAC960_GEM_AcknowledgeHardwareMailboxStatus(ControllerBaseAddress); | ||
1506 | break; | ||
1467 | case DAC960_BA_Controller: | 1507 | case DAC960_BA_Controller: |
1468 | while (DAC960_BA_HardwareMailboxFullP(ControllerBaseAddress)) | 1508 | while (DAC960_BA_HardwareMailboxFullP(ControllerBaseAddress)) |
1469 | udelay(1); | 1509 | udelay(1); |
@@ -2627,6 +2667,9 @@ static void DAC960_DetectCleanup(DAC960_Controller_T *Controller) | |||
2627 | if (Controller->MemoryMappedAddress) { | 2667 | if (Controller->MemoryMappedAddress) { |
2628 | switch(Controller->HardwareType) | 2668 | switch(Controller->HardwareType) |
2629 | { | 2669 | { |
2670 | case DAC960_GEM_Controller: | ||
2671 | DAC960_GEM_DisableInterrupts(Controller->BaseAddress); | ||
2672 | break; | ||
2630 | case DAC960_BA_Controller: | 2673 | case DAC960_BA_Controller: |
2631 | DAC960_BA_DisableInterrupts(Controller->BaseAddress); | 2674 | DAC960_BA_DisableInterrupts(Controller->BaseAddress); |
2632 | break; | 2675 | break; |
@@ -2705,6 +2748,9 @@ DAC960_DetectController(struct pci_dev *PCI_Device, | |||
2705 | 2748 | ||
2706 | switch (Controller->HardwareType) | 2749 | switch (Controller->HardwareType) |
2707 | { | 2750 | { |
2751 | case DAC960_GEM_Controller: | ||
2752 | Controller->PCI_Address = pci_resource_start(PCI_Device, 0); | ||
2753 | break; | ||
2708 | case DAC960_BA_Controller: | 2754 | case DAC960_BA_Controller: |
2709 | Controller->PCI_Address = pci_resource_start(PCI_Device, 0); | 2755 | Controller->PCI_Address = pci_resource_start(PCI_Device, 0); |
2710 | break; | 2756 | break; |
@@ -2756,6 +2802,36 @@ DAC960_DetectController(struct pci_dev *PCI_Device, | |||
2756 | BaseAddress = Controller->BaseAddress; | 2802 | BaseAddress = Controller->BaseAddress; |
2757 | switch (Controller->HardwareType) | 2803 | switch (Controller->HardwareType) |
2758 | { | 2804 | { |
2805 | case DAC960_GEM_Controller: | ||
2806 | DAC960_GEM_DisableInterrupts(BaseAddress); | ||
2807 | DAC960_GEM_AcknowledgeHardwareMailboxStatus(BaseAddress); | ||
2808 | udelay(1000); | ||
2809 | while (DAC960_GEM_InitializationInProgressP(BaseAddress)) | ||
2810 | { | ||
2811 | if (DAC960_GEM_ReadErrorStatus(BaseAddress, &ErrorStatus, | ||
2812 | &Parameter0, &Parameter1) && | ||
2813 | DAC960_ReportErrorStatus(Controller, ErrorStatus, | ||
2814 | Parameter0, Parameter1)) | ||
2815 | goto Failure; | ||
2816 | udelay(10); | ||
2817 | } | ||
2818 | if (!DAC960_V2_EnableMemoryMailboxInterface(Controller)) | ||
2819 | { | ||
2820 | DAC960_Error("Unable to Enable Memory Mailbox Interface " | ||
2821 | "for Controller at\n", Controller); | ||
2822 | goto Failure; | ||
2823 | } | ||
2824 | DAC960_GEM_EnableInterrupts(BaseAddress); | ||
2825 | Controller->QueueCommand = DAC960_GEM_QueueCommand; | ||
2826 | Controller->ReadControllerConfiguration = | ||
2827 | DAC960_V2_ReadControllerConfiguration; | ||
2828 | Controller->ReadDeviceConfiguration = | ||
2829 | DAC960_V2_ReadDeviceConfiguration; | ||
2830 | Controller->ReportDeviceConfiguration = | ||
2831 | DAC960_V2_ReportDeviceConfiguration; | ||
2832 | Controller->QueueReadWriteCommand = | ||
2833 | DAC960_V2_QueueReadWriteCommand; | ||
2834 | break; | ||
2759 | case DAC960_BA_Controller: | 2835 | case DAC960_BA_Controller: |
2760 | DAC960_BA_DisableInterrupts(BaseAddress); | 2836 | DAC960_BA_DisableInterrupts(BaseAddress); |
2761 | DAC960_BA_AcknowledgeHardwareMailboxStatus(BaseAddress); | 2837 | DAC960_BA_AcknowledgeHardwareMailboxStatus(BaseAddress); |
@@ -5189,6 +5265,47 @@ static void DAC960_V2_ProcessCompletedCommand(DAC960_Command_T *Command) | |||
5189 | wake_up(&Controller->CommandWaitQueue); | 5265 | wake_up(&Controller->CommandWaitQueue); |
5190 | } | 5266 | } |
5191 | 5267 | ||
5268 | /* | ||
5269 | DAC960_GEM_InterruptHandler handles hardware interrupts from DAC960 GEM Series | ||
5270 | Controllers. | ||
5271 | */ | ||
5272 | |||
5273 | static irqreturn_t DAC960_GEM_InterruptHandler(int IRQ_Channel, | ||
5274 | void *DeviceIdentifier, | ||
5275 | struct pt_regs *InterruptRegisters) | ||
5276 | { | ||
5277 | DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier; | ||
5278 | void __iomem *ControllerBaseAddress = Controller->BaseAddress; | ||
5279 | DAC960_V2_StatusMailbox_T *NextStatusMailbox; | ||
5280 | unsigned long flags; | ||
5281 | |||
5282 | spin_lock_irqsave(&Controller->queue_lock, flags); | ||
5283 | DAC960_GEM_AcknowledgeInterrupt(ControllerBaseAddress); | ||
5284 | NextStatusMailbox = Controller->V2.NextStatusMailbox; | ||
5285 | while (NextStatusMailbox->Fields.CommandIdentifier > 0) | ||
5286 | { | ||
5287 | DAC960_V2_CommandIdentifier_T CommandIdentifier = | ||
5288 | NextStatusMailbox->Fields.CommandIdentifier; | ||
5289 | DAC960_Command_T *Command = Controller->Commands[CommandIdentifier-1]; | ||
5290 | Command->V2.CommandStatus = NextStatusMailbox->Fields.CommandStatus; | ||
5291 | Command->V2.RequestSenseLength = | ||
5292 | NextStatusMailbox->Fields.RequestSenseLength; | ||
5293 | Command->V2.DataTransferResidue = | ||
5294 | NextStatusMailbox->Fields.DataTransferResidue; | ||
5295 | NextStatusMailbox->Words[0] = 0; | ||
5296 | if (++NextStatusMailbox > Controller->V2.LastStatusMailbox) | ||
5297 | NextStatusMailbox = Controller->V2.FirstStatusMailbox; | ||
5298 | DAC960_V2_ProcessCompletedCommand(Command); | ||
5299 | } | ||
5300 | Controller->V2.NextStatusMailbox = NextStatusMailbox; | ||
5301 | /* | ||
5302 | Attempt to remove additional I/O Requests from the Controller's | ||
5303 | I/O Request Queue and queue them to the Controller. | ||
5304 | */ | ||
5305 | DAC960_ProcessRequest(Controller); | ||
5306 | spin_unlock_irqrestore(&Controller->queue_lock, flags); | ||
5307 | return IRQ_HANDLED; | ||
5308 | } | ||
5192 | 5309 | ||
5193 | /* | 5310 | /* |
5194 | DAC960_BA_InterruptHandler handles hardware interrupts from DAC960 BA Series | 5311 | DAC960_BA_InterruptHandler handles hardware interrupts from DAC960 BA Series |
@@ -6962,6 +7079,14 @@ static void DAC960_gam_cleanup(void) | |||
6962 | 7079 | ||
6963 | #endif /* DAC960_GAM_MINOR */ | 7080 | #endif /* DAC960_GAM_MINOR */ |
6964 | 7081 | ||
7082 | static struct DAC960_privdata DAC960_GEM_privdata = { | ||
7083 | .HardwareType = DAC960_GEM_Controller, | ||
7084 | .FirmwareType = DAC960_V2_Controller, | ||
7085 | .InterruptHandler = DAC960_GEM_InterruptHandler, | ||
7086 | .MemoryWindowSize = DAC960_GEM_RegisterWindowSize, | ||
7087 | }; | ||
7088 | |||
7089 | |||
6965 | static struct DAC960_privdata DAC960_BA_privdata = { | 7090 | static struct DAC960_privdata DAC960_BA_privdata = { |
6966 | .HardwareType = DAC960_BA_Controller, | 7091 | .HardwareType = DAC960_BA_Controller, |
6967 | .FirmwareType = DAC960_V2_Controller, | 7092 | .FirmwareType = DAC960_V2_Controller, |
@@ -7007,6 +7132,13 @@ static struct DAC960_privdata DAC960_P_privdata = { | |||
7007 | static struct pci_device_id DAC960_id_table[] = { | 7132 | static struct pci_device_id DAC960_id_table[] = { |
7008 | { | 7133 | { |
7009 | .vendor = PCI_VENDOR_ID_MYLEX, | 7134 | .vendor = PCI_VENDOR_ID_MYLEX, |
7135 | .device = PCI_DEVICE_ID_MYLEX_DAC960_GEM, | ||
7136 | .subvendor = PCI_ANY_ID, | ||
7137 | .subdevice = PCI_ANY_ID, | ||
7138 | .driver_data = (unsigned long) &DAC960_GEM_privdata, | ||
7139 | }, | ||
7140 | { | ||
7141 | .vendor = PCI_VENDOR_ID_MYLEX, | ||
7010 | .device = PCI_DEVICE_ID_MYLEX_DAC960_BA, | 7142 | .device = PCI_DEVICE_ID_MYLEX_DAC960_BA, |
7011 | .subvendor = PCI_ANY_ID, | 7143 | .subvendor = PCI_ANY_ID, |
7012 | .subdevice = PCI_ANY_ID, | 7144 | .subdevice = PCI_ANY_ID, |
diff --git a/drivers/block/DAC960.h b/drivers/block/DAC960.h index d5e8e7190c90..a82f37f749a5 100644 --- a/drivers/block/DAC960.h +++ b/drivers/block/DAC960.h | |||
@@ -2114,7 +2114,8 @@ typedef enum | |||
2114 | DAC960_LA_Controller = 3, /* DAC1164P */ | 2114 | DAC960_LA_Controller = 3, /* DAC1164P */ |
2115 | DAC960_PG_Controller = 4, /* DAC960PTL/PJ/PG */ | 2115 | DAC960_PG_Controller = 4, /* DAC960PTL/PJ/PG */ |
2116 | DAC960_PD_Controller = 5, /* DAC960PU/PD/PL/P */ | 2116 | DAC960_PD_Controller = 5, /* DAC960PU/PD/PL/P */ |
2117 | DAC960_P_Controller = 6 /* DAC960PU/PD/PL/P */ | 2117 | DAC960_P_Controller = 6, /* DAC960PU/PD/PL/P */ |
2118 | DAC960_GEM_Controller = 7, /* AcceleRAID 4/5/600 */ | ||
2118 | } | 2119 | } |
2119 | DAC960_HardwareType_T; | 2120 | DAC960_HardwareType_T; |
2120 | 2121 | ||
@@ -2541,6 +2542,320 @@ void dma_addr_writeql(dma_addr_t addr, void __iomem *write_address) | |||
2541 | } | 2542 | } |
2542 | 2543 | ||
2543 | /* | 2544 | /* |
2545 | Define the DAC960 GEM Series Controller Interface Register Offsets. | ||
2546 | */ | ||
2547 | |||
2548 | #define DAC960_GEM_RegisterWindowSize 0x600 | ||
2549 | |||
2550 | typedef enum | ||
2551 | { | ||
2552 | DAC960_GEM_InboundDoorBellRegisterReadSetOffset = 0x214, | ||
2553 | DAC960_GEM_InboundDoorBellRegisterClearOffset = 0x218, | ||
2554 | DAC960_GEM_OutboundDoorBellRegisterReadSetOffset = 0x224, | ||
2555 | DAC960_GEM_OutboundDoorBellRegisterClearOffset = 0x228, | ||
2556 | DAC960_GEM_InterruptStatusRegisterOffset = 0x208, | ||
2557 | DAC960_GEM_InterruptMaskRegisterReadSetOffset = 0x22C, | ||
2558 | DAC960_GEM_InterruptMaskRegisterClearOffset = 0x230, | ||
2559 | DAC960_GEM_CommandMailboxBusAddressOffset = 0x510, | ||
2560 | DAC960_GEM_CommandStatusOffset = 0x518, | ||
2561 | DAC960_GEM_ErrorStatusRegisterReadSetOffset = 0x224, | ||
2562 | DAC960_GEM_ErrorStatusRegisterClearOffset = 0x228, | ||
2563 | } | ||
2564 | DAC960_GEM_RegisterOffsets_T; | ||
2565 | |||
2566 | /* | ||
2567 | Define the structure of the DAC960 GEM Series Inbound Door Bell | ||
2568 | */ | ||
2569 | |||
2570 | typedef union DAC960_GEM_InboundDoorBellRegister | ||
2571 | { | ||
2572 | unsigned int All; | ||
2573 | struct { | ||
2574 | unsigned int :24; | ||
2575 | boolean HardwareMailboxNewCommand:1; | ||
2576 | boolean AcknowledgeHardwareMailboxStatus:1; | ||
2577 | boolean GenerateInterrupt:1; | ||
2578 | boolean ControllerReset:1; | ||
2579 | boolean MemoryMailboxNewCommand:1; | ||
2580 | unsigned int :3; | ||
2581 | } Write; | ||
2582 | struct { | ||
2583 | unsigned int :24; | ||
2584 | boolean HardwareMailboxFull:1; | ||
2585 | boolean InitializationInProgress:1; | ||
2586 | unsigned int :6; | ||
2587 | } Read; | ||
2588 | } | ||
2589 | DAC960_GEM_InboundDoorBellRegister_T; | ||
2590 | |||
2591 | /* | ||
2592 | Define the structure of the DAC960 GEM Series Outbound Door Bell Register. | ||
2593 | */ | ||
2594 | typedef union DAC960_GEM_OutboundDoorBellRegister | ||
2595 | { | ||
2596 | unsigned int All; | ||
2597 | struct { | ||
2598 | unsigned int :24; | ||
2599 | boolean AcknowledgeHardwareMailboxInterrupt:1; | ||
2600 | boolean AcknowledgeMemoryMailboxInterrupt:1; | ||
2601 | unsigned int :6; | ||
2602 | } Write; | ||
2603 | struct { | ||
2604 | unsigned int :24; | ||
2605 | boolean HardwareMailboxStatusAvailable:1; | ||
2606 | boolean MemoryMailboxStatusAvailable:1; | ||
2607 | unsigned int :6; | ||
2608 | } Read; | ||
2609 | } | ||
2610 | DAC960_GEM_OutboundDoorBellRegister_T; | ||
2611 | |||
2612 | /* | ||
2613 | Define the structure of the DAC960 GEM Series Interrupt Mask Register. | ||
2614 | */ | ||
2615 | typedef union DAC960_GEM_InterruptMaskRegister | ||
2616 | { | ||
2617 | unsigned int All; | ||
2618 | struct { | ||
2619 | unsigned int :16; | ||
2620 | unsigned int :8; | ||
2621 | unsigned int HardwareMailboxInterrupt:1; | ||
2622 | unsigned int MemoryMailboxInterrupt:1; | ||
2623 | unsigned int :6; | ||
2624 | } Bits; | ||
2625 | } | ||
2626 | DAC960_GEM_InterruptMaskRegister_T; | ||
2627 | |||
2628 | /* | ||
2629 | Define the structure of the DAC960 GEM Series Error Status Register. | ||
2630 | */ | ||
2631 | |||
2632 | typedef union DAC960_GEM_ErrorStatusRegister | ||
2633 | { | ||
2634 | unsigned int All; | ||
2635 | struct { | ||
2636 | unsigned int :24; | ||
2637 | unsigned int :5; | ||
2638 | boolean ErrorStatusPending:1; | ||
2639 | unsigned int :2; | ||
2640 | } Bits; | ||
2641 | } | ||
2642 | DAC960_GEM_ErrorStatusRegister_T; | ||
2643 | |||
2644 | /* | ||
2645 | Define inline functions to provide an abstraction for reading and writing the | ||
2646 | DAC960 GEM Series Controller Interface Registers. | ||
2647 | */ | ||
2648 | |||
2649 | static inline | ||
2650 | void DAC960_GEM_HardwareMailboxNewCommand(void __iomem *ControllerBaseAddress) | ||
2651 | { | ||
2652 | DAC960_GEM_InboundDoorBellRegister_T InboundDoorBellRegister; | ||
2653 | InboundDoorBellRegister.All = 0; | ||
2654 | InboundDoorBellRegister.Write.HardwareMailboxNewCommand = true; | ||
2655 | writel(InboundDoorBellRegister.All, | ||
2656 | ControllerBaseAddress + DAC960_GEM_InboundDoorBellRegisterReadSetOffset); | ||
2657 | } | ||
2658 | |||
2659 | static inline | ||
2660 | void DAC960_GEM_AcknowledgeHardwareMailboxStatus(void __iomem *ControllerBaseAddress) | ||
2661 | { | ||
2662 | DAC960_GEM_InboundDoorBellRegister_T InboundDoorBellRegister; | ||
2663 | InboundDoorBellRegister.All = 0; | ||
2664 | InboundDoorBellRegister.Write.AcknowledgeHardwareMailboxStatus = true; | ||
2665 | writel(InboundDoorBellRegister.All, | ||
2666 | ControllerBaseAddress + DAC960_GEM_InboundDoorBellRegisterClearOffset); | ||
2667 | } | ||
2668 | |||
2669 | static inline | ||
2670 | void DAC960_GEM_GenerateInterrupt(void __iomem *ControllerBaseAddress) | ||
2671 | { | ||
2672 | DAC960_GEM_InboundDoorBellRegister_T InboundDoorBellRegister; | ||
2673 | InboundDoorBellRegister.All = 0; | ||
2674 | InboundDoorBellRegister.Write.GenerateInterrupt = true; | ||
2675 | writel(InboundDoorBellRegister.All, | ||
2676 | ControllerBaseAddress + DAC960_GEM_InboundDoorBellRegisterReadSetOffset); | ||
2677 | } | ||
2678 | |||
2679 | static inline | ||
2680 | void DAC960_GEM_ControllerReset(void __iomem *ControllerBaseAddress) | ||
2681 | { | ||
2682 | DAC960_GEM_InboundDoorBellRegister_T InboundDoorBellRegister; | ||
2683 | InboundDoorBellRegister.All = 0; | ||
2684 | InboundDoorBellRegister.Write.ControllerReset = true; | ||
2685 | writel(InboundDoorBellRegister.All, | ||
2686 | ControllerBaseAddress + DAC960_GEM_InboundDoorBellRegisterReadSetOffset); | ||
2687 | } | ||
2688 | |||
2689 | static inline | ||
2690 | void DAC960_GEM_MemoryMailboxNewCommand(void __iomem *ControllerBaseAddress) | ||
2691 | { | ||
2692 | DAC960_GEM_InboundDoorBellRegister_T InboundDoorBellRegister; | ||
2693 | InboundDoorBellRegister.All = 0; | ||
2694 | InboundDoorBellRegister.Write.MemoryMailboxNewCommand = true; | ||
2695 | writel(InboundDoorBellRegister.All, | ||
2696 | ControllerBaseAddress + DAC960_GEM_InboundDoorBellRegisterReadSetOffset); | ||
2697 | } | ||
2698 | |||
2699 | static inline | ||
2700 | boolean DAC960_GEM_HardwareMailboxFullP(void __iomem *ControllerBaseAddress) | ||
2701 | { | ||
2702 | DAC960_GEM_InboundDoorBellRegister_T InboundDoorBellRegister; | ||
2703 | InboundDoorBellRegister.All = | ||
2704 | readl(ControllerBaseAddress + | ||
2705 | DAC960_GEM_InboundDoorBellRegisterReadSetOffset); | ||
2706 | return InboundDoorBellRegister.Read.HardwareMailboxFull; | ||
2707 | } | ||
2708 | |||
2709 | static inline | ||
2710 | boolean DAC960_GEM_InitializationInProgressP(void __iomem *ControllerBaseAddress) | ||
2711 | { | ||
2712 | DAC960_GEM_InboundDoorBellRegister_T InboundDoorBellRegister; | ||
2713 | InboundDoorBellRegister.All = | ||
2714 | readl(ControllerBaseAddress + | ||
2715 | DAC960_GEM_InboundDoorBellRegisterReadSetOffset); | ||
2716 | return InboundDoorBellRegister.Read.InitializationInProgress; | ||
2717 | } | ||
2718 | |||
2719 | static inline | ||
2720 | void DAC960_GEM_AcknowledgeHardwareMailboxInterrupt(void __iomem *ControllerBaseAddress) | ||
2721 | { | ||
2722 | DAC960_GEM_OutboundDoorBellRegister_T OutboundDoorBellRegister; | ||
2723 | OutboundDoorBellRegister.All = 0; | ||
2724 | OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true; | ||
2725 | writel(OutboundDoorBellRegister.All, | ||
2726 | ControllerBaseAddress + DAC960_GEM_OutboundDoorBellRegisterClearOffset); | ||
2727 | } | ||
2728 | |||
2729 | static inline | ||
2730 | void DAC960_GEM_AcknowledgeMemoryMailboxInterrupt(void __iomem *ControllerBaseAddress) | ||
2731 | { | ||
2732 | DAC960_GEM_OutboundDoorBellRegister_T OutboundDoorBellRegister; | ||
2733 | OutboundDoorBellRegister.All = 0; | ||
2734 | OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true; | ||
2735 | writel(OutboundDoorBellRegister.All, | ||
2736 | ControllerBaseAddress + DAC960_GEM_OutboundDoorBellRegisterClearOffset); | ||
2737 | } | ||
2738 | |||
2739 | static inline | ||
2740 | void DAC960_GEM_AcknowledgeInterrupt(void __iomem *ControllerBaseAddress) | ||
2741 | { | ||
2742 | DAC960_GEM_OutboundDoorBellRegister_T OutboundDoorBellRegister; | ||
2743 | OutboundDoorBellRegister.All = 0; | ||
2744 | OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true; | ||
2745 | OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true; | ||
2746 | writel(OutboundDoorBellRegister.All, | ||
2747 | ControllerBaseAddress + DAC960_GEM_OutboundDoorBellRegisterClearOffset); | ||
2748 | } | ||
2749 | |||
2750 | static inline | ||
2751 | boolean DAC960_GEM_HardwareMailboxStatusAvailableP(void __iomem *ControllerBaseAddress) | ||
2752 | { | ||
2753 | DAC960_GEM_OutboundDoorBellRegister_T OutboundDoorBellRegister; | ||
2754 | OutboundDoorBellRegister.All = | ||
2755 | readl(ControllerBaseAddress + | ||
2756 | DAC960_GEM_OutboundDoorBellRegisterReadSetOffset); | ||
2757 | return OutboundDoorBellRegister.Read.HardwareMailboxStatusAvailable; | ||
2758 | } | ||
2759 | |||
2760 | static inline | ||
2761 | boolean DAC960_GEM_MemoryMailboxStatusAvailableP(void __iomem *ControllerBaseAddress) | ||
2762 | { | ||
2763 | DAC960_GEM_OutboundDoorBellRegister_T OutboundDoorBellRegister; | ||
2764 | OutboundDoorBellRegister.All = | ||
2765 | readl(ControllerBaseAddress + | ||
2766 | DAC960_GEM_OutboundDoorBellRegisterReadSetOffset); | ||
2767 | return OutboundDoorBellRegister.Read.MemoryMailboxStatusAvailable; | ||
2768 | } | ||
2769 | |||
2770 | static inline | ||
2771 | void DAC960_GEM_EnableInterrupts(void __iomem *ControllerBaseAddress) | ||
2772 | { | ||
2773 | DAC960_GEM_InterruptMaskRegister_T InterruptMaskRegister; | ||
2774 | InterruptMaskRegister.All = 0; | ||
2775 | InterruptMaskRegister.Bits.HardwareMailboxInterrupt = true; | ||
2776 | InterruptMaskRegister.Bits.MemoryMailboxInterrupt = true; | ||
2777 | writel(InterruptMaskRegister.All, | ||
2778 | ControllerBaseAddress + DAC960_GEM_InterruptMaskRegisterClearOffset); | ||
2779 | } | ||
2780 | |||
2781 | static inline | ||
2782 | void DAC960_GEM_DisableInterrupts(void __iomem *ControllerBaseAddress) | ||
2783 | { | ||
2784 | DAC960_GEM_InterruptMaskRegister_T InterruptMaskRegister; | ||
2785 | InterruptMaskRegister.All = 0; | ||
2786 | InterruptMaskRegister.Bits.HardwareMailboxInterrupt = true; | ||
2787 | InterruptMaskRegister.Bits.MemoryMailboxInterrupt = true; | ||
2788 | writel(InterruptMaskRegister.All, | ||
2789 | ControllerBaseAddress + DAC960_GEM_InterruptMaskRegisterReadSetOffset); | ||
2790 | } | ||
2791 | |||
2792 | static inline | ||
2793 | boolean DAC960_GEM_InterruptsEnabledP(void __iomem *ControllerBaseAddress) | ||
2794 | { | ||
2795 | DAC960_GEM_InterruptMaskRegister_T InterruptMaskRegister; | ||
2796 | InterruptMaskRegister.All = | ||
2797 | readl(ControllerBaseAddress + | ||
2798 | DAC960_GEM_InterruptMaskRegisterReadSetOffset); | ||
2799 | return !(InterruptMaskRegister.Bits.HardwareMailboxInterrupt || | ||
2800 | InterruptMaskRegister.Bits.MemoryMailboxInterrupt); | ||
2801 | } | ||
2802 | |||
2803 | static inline | ||
2804 | void DAC960_GEM_WriteCommandMailbox(DAC960_V2_CommandMailbox_T | ||
2805 | *MemoryCommandMailbox, | ||
2806 | DAC960_V2_CommandMailbox_T | ||
2807 | *CommandMailbox) | ||
2808 | { | ||
2809 | memcpy(&MemoryCommandMailbox->Words[1], &CommandMailbox->Words[1], | ||
2810 | sizeof(DAC960_V2_CommandMailbox_T) - sizeof(unsigned int)); | ||
2811 | wmb(); | ||
2812 | MemoryCommandMailbox->Words[0] = CommandMailbox->Words[0]; | ||
2813 | mb(); | ||
2814 | } | ||
2815 | |||
2816 | static inline | ||
2817 | void DAC960_GEM_WriteHardwareMailbox(void __iomem *ControllerBaseAddress, | ||
2818 | dma_addr_t CommandMailboxDMA) | ||
2819 | { | ||
2820 | dma_addr_writeql(CommandMailboxDMA, | ||
2821 | ControllerBaseAddress + | ||
2822 | DAC960_GEM_CommandMailboxBusAddressOffset); | ||
2823 | } | ||
2824 | |||
2825 | static inline DAC960_V2_CommandIdentifier_T | ||
2826 | DAC960_GEM_ReadCommandIdentifier(void __iomem *ControllerBaseAddress) | ||
2827 | { | ||
2828 | return readw(ControllerBaseAddress + DAC960_GEM_CommandStatusOffset); | ||
2829 | } | ||
2830 | |||
2831 | static inline DAC960_V2_CommandStatus_T | ||
2832 | DAC960_GEM_ReadCommandStatus(void __iomem *ControllerBaseAddress) | ||
2833 | { | ||
2834 | return readw(ControllerBaseAddress + DAC960_GEM_CommandStatusOffset + 2); | ||
2835 | } | ||
2836 | |||
2837 | static inline boolean | ||
2838 | DAC960_GEM_ReadErrorStatus(void __iomem *ControllerBaseAddress, | ||
2839 | unsigned char *ErrorStatus, | ||
2840 | unsigned char *Parameter0, | ||
2841 | unsigned char *Parameter1) | ||
2842 | { | ||
2843 | DAC960_GEM_ErrorStatusRegister_T ErrorStatusRegister; | ||
2844 | ErrorStatusRegister.All = | ||
2845 | readl(ControllerBaseAddress + DAC960_GEM_ErrorStatusRegisterReadSetOffset); | ||
2846 | if (!ErrorStatusRegister.Bits.ErrorStatusPending) return false; | ||
2847 | ErrorStatusRegister.Bits.ErrorStatusPending = false; | ||
2848 | *ErrorStatus = ErrorStatusRegister.All; | ||
2849 | *Parameter0 = | ||
2850 | readb(ControllerBaseAddress + DAC960_GEM_CommandMailboxBusAddressOffset + 0); | ||
2851 | *Parameter1 = | ||
2852 | readb(ControllerBaseAddress + DAC960_GEM_CommandMailboxBusAddressOffset + 1); | ||
2853 | writel(0x03000000, ControllerBaseAddress + | ||
2854 | DAC960_GEM_ErrorStatusRegisterClearOffset); | ||
2855 | return true; | ||
2856 | } | ||
2857 | |||
2858 | /* | ||
2544 | Define the DAC960 BA Series Controller Interface Register Offsets. | 2859 | Define the DAC960 BA Series Controller Interface Register Offsets. |
2545 | */ | 2860 | */ |
2546 | 2861 | ||