diff options
author | Dave Jiang <dave.jiang@intel.com> | 2011-02-22 23:39:32 (GMT) |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 10:55:28 (GMT) |
commit | f7885c8490717b010115d6413b339702c64d8a3b (patch) | |
tree | 281176f92d4bd8372205002c4feb48c44200c1c1 /drivers | |
parent | b3824292cb93d4e45b87fe76d8774cbde9e43200 (diff) | |
download | linux-fsl-qoriq-f7885c8490717b010115d6413b339702c64d8a3b.tar.xz |
isci: Removed special macros that does 64bit address math
These macros are not necessary. We can do 64bit math directly.
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/isci/core/sci_util.h | 39 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_unsolicited_frame_control.c | 73 |
2 files changed, 39 insertions, 73 deletions
diff --git a/drivers/scsi/isci/core/sci_util.h b/drivers/scsi/isci/core/sci_util.h index 8f2ba35..9748c76 100644 --- a/drivers/scsi/isci/core/sci_util.h +++ b/drivers/scsi/isci/core/sci_util.h @@ -85,45 +85,6 @@ #define sci_cb_make_physical_address(physical_addr, addr_upper, addr_lower) \ ((physical_addr) = (addr_lower) | ((u64)addr_upper) << 32) - -/** - * sci_physical_address_add() - - * - * This macro simply performs addition on an dma_addr_t type. The - * lower u32 value is "clipped" or "wrapped" back through 0. When this occurs - * the upper 32-bits are incremented by 1. - */ -#define sci_physical_address_add(physical_address, value) \ - { \ - u32 lower = lower_32_bits((physical_address)); \ - u32 upper = upper_32_bits((physical_address)); \ - \ - if (lower + (value) < lower) \ - upper += 1; \ - \ - lower += (value); \ - sci_cb_make_physical_address(physical_address, upper, lower); \ - } - -/** - * sci_physical_address_subtract() - - * - * This macro simply performs subtraction on an dma_addr_t type. The - * lower u32 value is "clipped" or "wrapped" back through 0. When this occurs - * the upper 32-bits are decremented by 1. - */ -#define sci_physical_address_subtract(physical_address, value) \ - { \ - u32 lower = lower_32_bits((physical_address)); \ - u32 upper = upper_32_bits((physical_address)); \ - \ - if (lower - (value) > lower) \ - upper -= 1; \ - \ - lower -= (value); \ - sci_cb_make_physical_address(physical_address, upper, lower); \ - } - /** * scic_word_copy_with_swap() - Copy the data from source to destination and * swap the bytes during the copy. diff --git a/drivers/scsi/isci/core/scic_sds_unsolicited_frame_control.c b/drivers/scsi/isci/core/scic_sds_unsolicited_frame_control.c index 7ca2f17..7274812 100644 --- a/drivers/scsi/isci/core/scic_sds_unsolicited_frame_control.c +++ b/drivers/scsi/isci/core/scic_sds_unsolicited_frame_control.c @@ -109,7 +109,7 @@ void scic_sds_unsolicited_frame_control_set_address_table_count( static void scic_sds_unsolicited_frame_control_construct_frames( struct scic_sds_unsolicited_frame_control *uf_control, dma_addr_t uf_buffer_phys_address, - unsigned long uf_buffer_virt_address, + void *uf_buffer_virt_address, u32 unused_uf_header_entries, u32 used_uf_header_entries) { @@ -118,7 +118,8 @@ static void scic_sds_unsolicited_frame_control_construct_frames( /* * Program the unused buffers into the UF address table and the - * controller's array of UFs. */ + * controller's array of UFs. + */ for (index = 0; index < unused_uf_header_entries; index++) { uf = &uf_control->buffers.array[index]; @@ -132,7 +133,8 @@ static void scic_sds_unsolicited_frame_control_construct_frames( /* * Program the actual used UF buffers into the UF address table and - * the controller's array of UFs. */ + * the controller's array of UFs. + */ for (index = unused_uf_header_entries; index < unused_uf_header_entries + used_uf_header_entries; index++) { @@ -140,17 +142,17 @@ static void scic_sds_unsolicited_frame_control_construct_frames( uf_control->address_table.array[index] = uf_buffer_phys_address; - uf->buffer = (void *)uf_buffer_virt_address; + uf->buffer = uf_buffer_virt_address; uf->header = &uf_control->headers.array[index]; uf->state = UNSOLICITED_FRAME_EMPTY; /* - * Increment the address of the physical and virtual memory pointers - * Everything is aligned on 1k boundary with an increment of 1k */ + * Increment the address of the physical and virtual memory + * pointers. Everything is aligned on 1k boundary with an + * increment of 1k. + */ uf_buffer_virt_address += SCU_UNSOLICITED_FRAME_BUFFER_SIZE; - sci_physical_address_add( - uf_buffer_phys_address, SCU_UNSOLICITED_FRAME_BUFFER_SIZE - ); + uf_buffer_phys_address += SCU_UNSOLICITED_FRAME_BUFFER_SIZE; } } @@ -177,6 +179,7 @@ void scic_sds_unsolicited_frame_control_construct( u32 unused_uf_header_bytes; u32 used_uf_header_bytes; dma_addr_t uf_buffer_phys_address; + void *uf_buffer_virt_address; /* * Prepare all of the memory sizes for the UF headers, UF address @@ -193,9 +196,11 @@ void scic_sds_unsolicited_frame_control_construct( /* * The Unsolicited Frame buffers are set at the start of the UF - * memory descriptor entry. The headers and address table will be - * placed after the buffers. */ + * memory descriptor entry. The headers and address table will be + * placed after the buffers. + */ uf_buffer_phys_address = mde->physical_address; + uf_buffer_virt_address = mde->virtual_address; /* * Program the location of the UF header table into the SCU. @@ -205,34 +210,34 @@ void scic_sds_unsolicited_frame_control_construct( * - Program unused header entries to overlap with the last * unsolicited frame. The silicon will never DMA to these unused * headers, since we program the UF address table pointers to - * NULL. */ - uf_control->headers.physical_address = uf_buffer_phys_address; - sci_physical_address_add( - uf_control->headers.physical_address, used_uf_buffer_bytes); - sci_physical_address_subtract( - uf_control->headers.physical_address, unused_uf_header_bytes); - uf_control->headers.array - = (struct scu_unsolicited_frame_header *) - scic_cb_get_virtual_address( - controller, uf_control->headers.physical_address - ); + * NULL. + */ + uf_control->headers.physical_address = + uf_buffer_phys_address + + used_uf_buffer_bytes - + unused_uf_header_bytes; + + uf_control->headers.array = + uf_buffer_virt_address + + used_uf_buffer_bytes - + unused_uf_header_bytes; /* * Program the location of the UF address table into the SCU. * Notes: * - The address must align on a 64-bit boundary. Guaranteed to be on 64 * byte boundary already due to above programming headers being on a - * 64-bit boundary and headers are on a 64-bytes in size. */ - uf_control->address_table.physical_address = uf_buffer_phys_address; - sci_physical_address_add( - uf_control->address_table.physical_address, used_uf_buffer_bytes); - sci_physical_address_add( - uf_control->address_table.physical_address, used_uf_header_bytes); - uf_control->address_table.array - = (dma_addr_t *) - scic_cb_get_virtual_address( - controller, uf_control->address_table.physical_address - ); + * 64-bit boundary and headers are on a 64-bytes in size. + */ + uf_control->address_table.physical_address = + uf_buffer_phys_address + + used_uf_buffer_bytes + + used_uf_header_bytes; + + uf_control->address_table.array = + uf_buffer_virt_address + + used_uf_buffer_bytes + + used_uf_header_bytes; uf_control->get = 0; @@ -250,7 +255,7 @@ void scic_sds_unsolicited_frame_control_construct( scic_sds_unsolicited_frame_control_construct_frames( uf_control, uf_buffer_phys_address, - (unsigned long)mde->virtual_address, + mde->virtual_address, unused_uf_header_entries, used_uf_header_entries ); |