diff options
| author | Joerg Roedel <joerg.roedel@amd.com> | 2011-04-06 04:53:48 -0400 |
|---|---|---|
| committer | Joerg Roedel <joerg.roedel@amd.com> | 2011-04-06 04:53:48 -0400 |
| commit | ded467374a34eb80020c2213456b1d9ca946b88c (patch) | |
| tree | 723fe36eeb88eaa953ffd04cae39f0a06d176f7d | |
| parent | 6221f222c0ebf1acdf7abcf927178f40e1a65e2a (diff) | |
x86/amd-iommu: Move compl-wait command building to own function
This patch introduces a seperate function for building
completion-wait commands.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
| -rw-r--r-- | arch/x86/kernel/amd_iommu.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index 57ca77787220..eebd504519c6 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c | |||
| @@ -383,6 +383,13 @@ irqreturn_t amd_iommu_int_handler(int irq, void *data) | |||
| 383 | * | 383 | * |
| 384 | ****************************************************************************/ | 384 | ****************************************************************************/ |
| 385 | 385 | ||
| 386 | static void build_completion_wait(struct iommu_cmd *cmd) | ||
| 387 | { | ||
| 388 | memset(cmd, 0, sizeof(*cmd)); | ||
| 389 | cmd->data[0] = CMD_COMPL_WAIT_INT_MASK; | ||
| 390 | CMD_SET_TYPE(cmd, CMD_COMPL_WAIT); | ||
| 391 | } | ||
| 392 | |||
| 386 | /* | 393 | /* |
| 387 | * Writes the command to the IOMMUs command buffer and informs the | 394 | * Writes the command to the IOMMUs command buffer and informs the |
| 388 | * hardware about the new command. Must be called with iommu->lock held. | 395 | * hardware about the new command. Must be called with iommu->lock held. |
| @@ -458,9 +465,7 @@ static int __iommu_completion_wait(struct amd_iommu *iommu) | |||
| 458 | { | 465 | { |
| 459 | struct iommu_cmd cmd; | 466 | struct iommu_cmd cmd; |
| 460 | 467 | ||
| 461 | memset(&cmd, 0, sizeof(cmd)); | 468 | build_completion_wait(&cmd); |
| 462 | cmd.data[0] = CMD_COMPL_WAIT_INT_MASK; | ||
| 463 | CMD_SET_TYPE(&cmd, CMD_COMPL_WAIT); | ||
| 464 | 469 | ||
| 465 | return __iommu_queue_command(iommu, &cmd); | 470 | return __iommu_queue_command(iommu, &cmd); |
| 466 | } | 471 | } |
