40
40
41
41
#include "core.h"
42
42
#include "ohci.h"
43
+ #include "packet-header-definitions.h"
43
44
44
45
#define ohci_info (ohci , f , args ...) dev_info(ohci->card.device, f, ##args)
45
46
#define ohci_notice (ohci , f , args ...) dev_notice(ohci->card.device, f, ##args)
@@ -1550,12 +1551,6 @@ static int handle_at_packet(struct context *context,
1550
1551
return 1 ;
1551
1552
}
1552
1553
1553
- #define HEADER_GET_DESTINATION (q ) (((q) >> 16) & 0xffff)
1554
- #define HEADER_GET_TCODE (q ) (((q) >> 4) & 0x0f)
1555
- #define HEADER_GET_OFFSET_HIGH (q ) (((q) >> 0) & 0xffff)
1556
- #define HEADER_GET_DATA_LENGTH (q ) (((q) >> 16) & 0xffff)
1557
- #define HEADER_GET_EXTENDED_TCODE (q ) (((q) >> 0) & 0xffff)
1558
-
1559
1554
static u32 get_cycle_time (struct fw_ohci * ohci );
1560
1555
1561
1556
static void handle_local_rom (struct fw_ohci * ohci ,
@@ -1564,9 +1559,9 @@ static void handle_local_rom(struct fw_ohci *ohci,
1564
1559
struct fw_packet response ;
1565
1560
int tcode , length , i ;
1566
1561
1567
- tcode = HEADER_GET_TCODE (packet -> header [ 0 ] );
1562
+ tcode = async_header_get_tcode (packet -> header );
1568
1563
if (TCODE_IS_BLOCK_PACKET (tcode ))
1569
- length = HEADER_GET_DATA_LENGTH (packet -> header [ 3 ] );
1564
+ length = async_header_get_data_length (packet -> header );
1570
1565
else
1571
1566
length = 4 ;
1572
1567
@@ -1595,10 +1590,10 @@ static void handle_local_lock(struct fw_ohci *ohci,
1595
1590
__be32 * payload , lock_old ;
1596
1591
u32 lock_arg , lock_data ;
1597
1592
1598
- tcode = HEADER_GET_TCODE (packet -> header [ 0 ] );
1599
- length = HEADER_GET_DATA_LENGTH (packet -> header [ 3 ] );
1593
+ tcode = async_header_get_tcode (packet -> header );
1594
+ length = async_header_get_data_length (packet -> header );
1600
1595
payload = packet -> payload ;
1601
- ext_tcode = HEADER_GET_EXTENDED_TCODE (packet -> header [ 3 ] );
1596
+ ext_tcode = async_header_get_extended_tcode (packet -> header );
1602
1597
1603
1598
if (tcode == TCODE_LOCK_REQUEST &&
1604
1599
ext_tcode == EXTCODE_COMPARE_SWAP && length == 8 ) {
@@ -1646,10 +1641,7 @@ static void handle_local_request(struct context *ctx, struct fw_packet *packet)
1646
1641
packet -> callback (packet , & ctx -> ohci -> card , packet -> ack );
1647
1642
}
1648
1643
1649
- offset =
1650
- ((unsigned long long )
1651
- HEADER_GET_OFFSET_HIGH (packet -> header [1 ]) << 32 ) |
1652
- packet -> header [2 ];
1644
+ offset = async_header_get_offset (packet -> header );
1653
1645
csr = offset - CSR_REGISTER_BASE ;
1654
1646
1655
1647
/* Handle config rom reads. */
@@ -1683,7 +1675,7 @@ static void at_context_transmit(struct context *ctx, struct fw_packet *packet)
1683
1675
1684
1676
spin_lock_irqsave (& ctx -> ohci -> lock , flags );
1685
1677
1686
- if (HEADER_GET_DESTINATION (packet -> header [ 0 ] ) == ctx -> ohci -> node_id &&
1678
+ if (async_header_get_destination (packet -> header ) == ctx -> ohci -> node_id &&
1687
1679
ctx -> ohci -> generation == packet -> generation ) {
1688
1680
spin_unlock_irqrestore (& ctx -> ohci -> lock , flags );
1689
1681
0 commit comments