case DAC960_GEM_Controller: while (DAC960_GEM_HardwareMailboxFullP(ControllerBaseAddress)) udelay(1); DAC960_GEM_WriteHardwareMailbox(ControllerBaseAddress, CommandMailboxDMA); DAC960_GEM_HardwareMailboxNewCommand(ControllerBaseAddress); while (!DAC960_GEM_HardwareMailboxStatusAvailableP(ControllerBaseAddress)) udelay(1); CommandStatus = DAC960_GEM_ReadCommandStatus(ControllerBaseAddress); DAC960_GEM_AcknowledgeHardwareMailboxInterrupt(ControllerBaseAddress); DAC960_GEM_AcknowledgeHardwareMailboxStatus(ControllerBaseAddress); break; 
static boolean DAC960_V2_EnableMemoryMailboxInterface(DAC960_Controller_T						      *Controller){  void __iomem *ControllerBaseAddress = Controller->BaseAddress;  struct pci_dev *PCI_Device = Controller->PCIDevice;  struct dma_loaf *DmaPages = &Controller->DmaPages;  size_t DmaPagesSize;  size_t CommandMailboxesSize;  size_t StatusMailboxesSize;  DAC960_V2_CommandMailbox_T *CommandMailboxesMemory;  dma_addr_t CommandMailboxesMemoryDMA;  DAC960_V2_StatusMailbox_T *StatusMailboxesMemory;  dma_addr_t StatusMailboxesMemoryDMA;  DAC960_V2_CommandMailbox_T *CommandMailbox;  dma_addr_t	CommandMailboxDMA;  DAC960_V2_CommandStatus_T CommandStatus;  if (pci_set_dma_mask(Controller->PCIDevice, DAC690_V2_PciDmaMask))	return DAC960_Failure(Controller, "DMA mask out of range");  Controller->BounceBufferLimit = DAC690_V2_PciDmaMask;  /* This is a temporary dma mapping, used only in the scope of this function */  CommandMailbox =	  (DAC960_V2_CommandMailbox_T *)pci_alloc_consistent( PCI_Device,		sizeof(DAC960_V2_CommandMailbox_T), &CommandMailboxDMA);  if (CommandMailbox == NULL)	  return false;  CommandMailboxesSize = DAC960_V2_CommandMailboxCount * sizeof(DAC960_V2_CommandMailbox_T);  StatusMailboxesSize = DAC960_V2_StatusMailboxCount * sizeof(DAC960_V2_StatusMailbox_T);  DmaPagesSize =    CommandMailboxesSize + StatusMailboxesSize +    sizeof(DAC960_V2_HealthStatusBuffer_T) +    sizeof(DAC960_V2_ControllerInfo_T) +    sizeof(DAC960_V2_LogicalDeviceInfo_T) +    sizeof(DAC960_V2_PhysicalDeviceInfo_T) +    sizeof(DAC960_SCSI_Inquiry_UnitSerialNumber_T) +    sizeof(DAC960_V2_Event_T) +    sizeof(DAC960_V2_PhysicalToLogicalDevice_T);  if (!init_dma_loaf(PCI_Device, DmaPages, DmaPagesSize)) {  	pci_free_consistent(PCI_Device, sizeof(DAC960_V2_CommandMailbox_T),					CommandMailbox, CommandMailboxDMA);	return false;  }  CommandMailboxesMemory = slice_dma_loaf(DmaPages,		CommandMailboxesSize, &CommandMailboxesMemoryDMA);  /* These are the base addresses for the command memory mailbox array */  Controller->V2.FirstCommandMailbox = CommandMailboxesMemory;  Controller->V2.FirstCommandMailboxDMA = CommandMailboxesMemoryDMA;  CommandMailboxesMemory += DAC960_V2_CommandMailboxCount - 1;  Controller->V2.LastCommandMailbox = CommandMailboxesMemory;  Controller->V2.NextCommandMailbox = Controller->V2.FirstCommandMailbox;  Controller->V2.PreviousCommandMailbox1 = Controller->V2.LastCommandMailbox;  Controller->V2.PreviousCommandMailbox2 =    					Controller->V2.LastCommandMailbox - 1;  /* These are the base addresses for the status memory mailbox array */  StatusMailboxesMemory = slice_dma_loaf(DmaPages,		StatusMailboxesSize, &StatusMailboxesMemoryDMA);  Controller->V2.FirstStatusMailbox = StatusMailboxesMemory;  Controller->V2.FirstStatusMailboxDMA = StatusMailboxesMemoryDMA;  StatusMailboxesMemory += DAC960_V2_StatusMailboxCount - 1;  Controller->V2.LastStatusMailbox = StatusMailboxesMemory;  Controller->V2.NextStatusMailbox = Controller->V2.FirstStatusMailbox;  Controller->V2.HealthStatusBuffer = slice_dma_loaf(DmaPages,		sizeof(DAC960_V2_HealthStatusBuffer_T),		&Controller->V2.HealthStatusBufferDMA);  Controller->V2.NewControllerInformation = slice_dma_loaf(DmaPages,                sizeof(DAC960_V2_ControllerInfo_T),                 &Controller->V2.NewControllerInformationDMA);  Controller->V2.NewLogicalDeviceInformation =  slice_dma_loaf(DmaPages,                sizeof(DAC960_V2_LogicalDeviceInfo_T),                &Controller->V2.NewLogicalDeviceInformationDMA);  Controller->V2.NewPhysicalDeviceInformation = slice_dma_loaf(DmaPages,                sizeof(DAC960_V2_PhysicalDeviceInfo_T),                &Controller->V2.NewPhysicalDeviceInformationDMA);  Controller->V2.NewInquiryUnitSerialNumber = slice_dma_loaf(DmaPages,                sizeof(DAC960_SCSI_Inquiry_UnitSerialNumber_T),                &Controller->V2.NewInquiryUnitSerialNumberDMA);  Controller->V2.Event = slice_dma_loaf(DmaPages,                sizeof(DAC960_V2_Event_T),                &Controller->V2.EventDMA);  Controller->V2.PhysicalToLogicalDevice = slice_dma_loaf(DmaPages,                sizeof(DAC960_V2_PhysicalToLogicalDevice_T),                &Controller->V2.PhysicalToLogicalDeviceDMA);  /*    Enable the Memory Mailbox Interface.        I don't know why we can't just use one of the memory mailboxes    we just allocated to do this, instead of using this temporary one.    Try this change later.  */  memset(CommandMailbox, 0, sizeof(DAC960_V2_CommandMailbox_T));  CommandMailbox->SetMemoryMailbox.CommandIdentifier = 1;  CommandMailbox->SetMemoryMailbox.CommandOpcode = DAC960_V2_IOCTL;  CommandMailbox->SetMemoryMailbox.CommandControlBits.NoAutoRequestSense = true;  CommandMailbox->SetMemoryMailbox.FirstCommandMailboxSizeKB =    (DAC960_V2_CommandMailboxCount * sizeof(DAC960_V2_CommandMailbox_T)) >> 10;  CommandMailbox->SetMemoryMailbox.FirstStatusMailboxSizeKB =    (DAC960_V2_StatusMailboxCount * sizeof(DAC960_V2_StatusMailbox_T)) >> 10;  CommandMailbox->SetMemoryMailbox.SecondCommandMailboxSizeKB = 0;  CommandMailbox->SetMemoryMailbox.SecondStatusMailboxSizeKB = 0;  CommandMailbox->SetMemoryMailbox.RequestSenseSize = 0;  CommandMailbox->SetMemoryMailbox.IOCTL_Opcode = DAC960_V2_SetMemoryMailbox;  CommandMailbox->SetMemoryMailbox.HealthStatusBufferSizeKB = 1;  CommandMailbox->SetMemoryMailbox.HealthStatusBufferBusAddress =    					Controller->V2.HealthStatusBufferDMA;  CommandMailbox->SetMemoryMailbox.FirstCommandMailboxBusAddress =    					Controller->V2.FirstCommandMailboxDMA;  CommandMailbox->SetMemoryMailbox.FirstStatusMailboxBusAddress =    					Controller->V2.FirstStatusMailboxDMA;  switch (Controller->HardwareType)    {    case DAC960_BA_Controller:      while (DAC960_BA_HardwareMailboxFullP(ControllerBaseAddress))	udelay(1);      DAC960_BA_WriteHardwareMailbox(ControllerBaseAddress, CommandMailboxDMA);      DAC960_BA_HardwareMailboxNewCommand(ControllerBaseAddress);      while (!DAC960_BA_HardwareMailboxStatusAvailableP(ControllerBaseAddress))	udelay(1);      CommandStatus = DAC960_BA_ReadCommandStatus(ControllerBaseAddress);      DAC960_BA_AcknowledgeHardwareMailboxInterrupt(ControllerBaseAddress);      DAC960_BA_AcknowledgeHardwareMailboxStatus(ControllerBaseAddress);      break;    case DAC960_LP_Controller:      while (DAC960_LP_HardwareMailboxFullP(ControllerBaseAddress))	udelay(1);      DAC960_LP_WriteHardwareMailbox(ControllerBaseAddress, CommandMailboxDMA);      DAC960_LP_HardwareMailboxNewCommand(ControllerBaseAddress);      while (!DAC960_LP_HardwareMailboxStatusAvailableP(ControllerBaseAddress))	udelay(1);      CommandStatus = DAC960_LP_ReadCommandStatus(ControllerBaseAddress);      DAC960_LP_AcknowledgeHardwareMailboxInterrupt(ControllerBaseAddress);      DAC960_LP_AcknowledgeHardwareMailboxStatus(ControllerBaseAddress);      break;    default:      DAC960_Failure(Controller, "Unknown Controller Type\n");      CommandStatus = DAC960_V2_AbormalCompletion;      break;    }  pci_free_consistent(PCI_Device, sizeof(DAC960_V2_CommandMailbox_T),					CommandMailbox, CommandMailboxDMA);  return (CommandStatus == DAC960_V2_NormalCompletion);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/5b76ffd5d9f12ba850fc988188f55056204ad4e2/DAC960.c/buggy/drivers/block/DAC960.c