64-bit fixes:

(1) fix printf formats.
(2) Prefer FreeBSD's MIPS_PHYS_TO_KSEG0 to hand-rolled one from Cavium.
(3) Mark a few 64-bit cleanliness issues (possible).
(4) Minor formatting fixes.
This commit is contained in:
Warner Losh 2009-07-06 18:15:57 +00:00
parent 9d7dcb83db
commit 4df29a25aa
4 changed files with 17 additions and 47 deletions

View File

@ -168,7 +168,7 @@ static inline void octeon_fpa_free (void *ptr, u_int pool,
{
octeon_addr_t free_ptr;
free_ptr.word64 = (uint64_t) OCTEON_PTR2PHYS(ptr);
free_ptr.word64 = (uint64_t)OCTEON_PTR2PHYS(ptr);
free_ptr.sfilldidspace.didspace = OCTEON_ADDR_DIDSPACE(
OCTEON_ADDR_FULL_DID(OCTEON_DID_FPA, pool));
@ -200,16 +200,15 @@ static inline void *octeon_fpa_alloc (u_int pool)
/*
* 32 bit FPA pointers only
*/
/*
* We only use 32 bit pointers at this time
*/
return ((void *) OCTEON_PHYS2PTR(address & 0xffffffff));
/*XXX mips64 issue */
return ((void *) MIPS_PHYS_TO_KSEG0(address & 0xffffffff));
}
return (NULL);
}
static inline uint64_t octeon_fpa_alloc_phys (u_int pool)
{
@ -217,30 +216,4 @@ static inline uint64_t octeon_fpa_alloc_phys (u_int pool)
pool))));
}
#if 0
/*
* octeon_fpa_alloc
*
* Allocate a new block from the FPA
*
* Buffer passes away from FPA management to SW control
*/
static inline void *octeon_fpa_alloc (u_int pool)
{
uint64_t address;
address = oct_read64(OCTEON_ADDR_DID(OCTEON_ADDR_FULL_DID(OCTEON_DID_FPA,
pool)));
if (address) {
return ((void *) (oct_ptr_size) OCTEON_PHYS2PTR(address));
}
return (NULL);
}
#endif
#endif /* ___OCTEON_FPA__H___ */

View File

@ -174,7 +174,9 @@ static void octeon_pko_doorbell_data_dump (uint64_t port)
octeon_pko_get_port_status(port, 0, &status);
printf("\n Port #%lld Pkts %ld Bytes %lld DoorBell %lld",
port, status.packets, status.octets, status.doorbell);
(unsigned long long)port, status.packets,
(unsigned long long)status.octets,
(unsigned long long)status.doorbell);
}
/*
@ -229,7 +231,7 @@ void octeon_pko_show (u_int start_port, u_int end_port)
printf("\n Port # %d Queue %3d [%d] BufPtr: 0x%llX Mask: %X%s",
octeon_pko_queue_cfg.bits.port, octeon_pko_queue_cfg.bits.queue,
octeon_pko_queue_cfg.bits.index,
(uint64_t)octeon_pko_queue_cfg.bits.buf_ptr,
(unsigned long long)octeon_pko_queue_cfg.bits.buf_ptr,
octeon_pko_queue_cfg.bits.qos_mask,
(octeon_pko_queue_cfg.bits.tail)? " Last":"");
}
@ -238,8 +240,6 @@ void octeon_pko_show (u_int start_port, u_int end_port)
for (port = start_port; port < (end_port + 1); port++) {
octeon_pko_get_port_status(port, 0, &status);
printf("\n Port #%d Packets %ld Bytes %lld DoorBell %lld",
port, status.packets, status.octets, status.doorbell);
octeon_pko_doorbell_data_dump(port);
}

View File

@ -696,7 +696,7 @@ static struct mbuf *octeon_rgmx_build_new_rx_mbuf (struct ifnet *ifp, void *data
}
if (m == m0) {
newdata = (caddr_t) ALIGN(m->m_data + ETHER_HDR_LEN) - ETHER_HDR_LEN;
newdata = (caddr_t)ALIGN(m->m_data + ETHER_HDR_LEN) - ETHER_HDR_LEN;
len -= newdata - m->m_data;
m->m_data = newdata;
}
@ -969,7 +969,7 @@ static u_int octeon_rgmx_pko_xmit_packet (struct rgmx_softc_dev *sc, void *out_b
#ifdef DEBUG_TX
printf(" temp: 0x%X ", temp);
#endif
xmit_cmd_ptr = (uint64_t *) OCTEON_PHYS2PTR(temp);
xmit_cmd_ptr = (uint64_t *) MIPS_PHYS_TO_KSEG0(temp);
xmit_cmd_index = xmit_cmd_state & OCTEON_PKO_INDEX_MASK;
xmit_cmd_ptr += xmit_cmd_index;

View File

@ -423,7 +423,7 @@ static inline octeon_wqe_t *octeon_pow_work_request_sync_nocheck (octeon_pow_wai
if (result.s_work.no_work || !result.s_work.addr) {
return NULL;
}
return (octeon_wqe_t *) OCTEON_PHYS2PTR(result.s_work.addr);
return (octeon_wqe_t *) MIPS_PHYS_TO_KSEG0(result.s_work.addr);
}
static inline octeon_wqe_t *octeon_pow_work_request_sync_nocheck_debug (octeon_pow_wait_t wait)
@ -440,13 +440,14 @@ static inline octeon_wqe_t *octeon_pow_work_request_sync_nocheck_debug (octeon_p
result.word64 = oct_read64(ptr.word64);
printf("WQE Result: 0x%llX No-work %X Addr %llX Ptr: %p\n",
result.word64, result.s_work.no_work, (uint64_t)result.s_work.addr,
OCTEON_PHYS2PTR(result.s_work.addr));
(unsigned long long)result.word64, result.s_work.no_work,
(unsigned long long)result.s_work.addr,
(void *)MIPS_PHYS_TO_KSEG0(result.s_work.addr));
if (result.s_work.no_work || !result.s_work.addr) {
return NULL;
}
return (octeon_wqe_t *) OCTEON_PHYS2PTR(result.s_work.addr);
return (octeon_wqe_t *) MIPS_PHYS_TO_KSEG0(result.s_work.addr);
}
static inline octeon_wqe_t *octeon_pow_work_request_sync (octeon_pow_wait_t wait)
@ -482,7 +483,7 @@ static inline octeon_wqe_t *octeon_pow_work_response_async(int scratch_addr)
if (result.s_work.no_work) {
return NULL;
}
return (octeon_wqe_t*) OCTEON_PHYS2PTR(result.s_work.addr);
return (octeon_wqe_t*) MIPS_PHYS_TO_KSEG0(result.s_work.addr);
}
@ -493,18 +494,14 @@ static inline octeon_wqe_t *octeon_pow_work_response_async(int scratch_addr)
*/
static inline void *octeon_pow_pktptr_to_kbuffer (octeon_buf_ptr_t pkt_ptr)
{
return (OCTEON_PHYS2PTR(((pkt_ptr.bits.addr >> 7) - pkt_ptr.bits.back) << 7));
return ((void *)MIPS_PHYS_TO_KSEG0(
((pkt_ptr.bits.addr >> 7) - pkt_ptr.bits.back) << 7));
}
#define INTERFACE(port) (port >> 4) /* Ports 0-15 are interface 0, 16-31 are interface 1 */
#define INDEX(port) (port & 0xf)
#define OCTEON_RGMX_PRTX_CFG(index,interface) (0x8001180008000010ull+((index)*2048)+((interface)*0x8000000ull))
#define OCTEON_RGMX_SMACX(offset,block_id) (0x8001180008000230ull+((offset)*2048)+((block_id)*0x8000000ull))
#define OCTEON_RGMX_RXX_ADR_CAM0(offset,block_id) (0x8001180008000180ull+((offset)*2048)+((block_id)*0x8000000ull))