From owner-svn-src-user@FreeBSD.ORG Tue Jun 29 10:13:33 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1038F1065673; Tue, 29 Jun 2010 10:13:33 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F38718FC0C; Tue, 29 Jun 2010 10:13:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5TADWkd091062; Tue, 29 Jun 2010 10:13:32 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5TADWx7091057; Tue, 29 Jun 2010 10:13:32 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006291013.o5TADWx7091057@svn.freebsd.org> From: Juli Mallett Date: Tue, 29 Jun 2010 10:13:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209585 - user/jmallett/octeon/sys/mips/cavium/octe X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jun 2010 10:13:33 -0000 Author: jmallett Date: Tue Jun 29 10:13:32 2010 New Revision: 209585 URL: http://svn.freebsd.org/changeset/base/209585 Log: Remove unused and overwrought code related to (1) reusing mbufs from transmit for receive (2) intercepting incoming packets and dropping them or consuming them elsewhere, which is easily generically implementable on FreeBSD using e.g. netgraph. This should allow for some simplification of nearby code in the near future. Modified: user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c Modified: user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h Tue Jun 29 06:38:56 2010 (r209584) +++ user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h Tue Jun 29 10:13:32 2010 (r209585) @@ -40,47 +40,6 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS #include /** - * These enumerations are the return codes for the Ethernet - * driver intercept callback. Depending on the return code, - * the ethernet driver will continue processing in different - * ways. - */ -typedef enum { - CVM_OCT_PASS, /**< The ethernet driver will pass the packet - to the kernel, just as if the intercept - callback didn't exist */ - CVM_OCT_DROP, /**< The ethernet driver will drop the packet, - cleaning of the work queue entry and the - mbuf */ - CVM_OCT_TAKE_OWNERSHIP_WORK,/**< The intercept callback takes over - ownership of the work queue entry. It is - the responsibility of the callback to free - the work queue entry and all associated - packet buffers. The ethernet driver will - dispose of the mbuf without affecting the - work queue entry */ - CVM_OCT_TAKE_OWNERSHIP_SKB /**< The intercept callback takes over - ownership of the mbuf. The work queue - entry and packet buffer will be disposed of - in a way keeping the mbuf valid */ -} cvm_oct_callback_result_t; - - -/** - * The is the definition of the Ethernet driver intercept - * callback. The callback receives three parameters and - * returns a struct cvm_oct_callback_result code. - * - * The first parameter is the linux device for the ethernet - * port the packet came in on. - * The second parameter is the raw work queue entry from the - * hardware. - * Th third parameter is the packet converted into a Linux - * mbuf. - */ -typedef cvm_oct_callback_result_t (*cvm_oct_callback_t)(struct ifnet *ifp, void *work_queue_entry, struct mbuf *m); - -/** * This is the definition of the Ethernet driver's private * driver state stored in ifp->if_softc. */ @@ -92,8 +51,6 @@ typedef struct { int queue; /* PKO hardware queue for the port */ int fau; /* Hardware fetch and add to count outstanding tx buffers */ int imode; /* Type of port. This is one of the enums in cvmx_helper_interface_mode_t */ - /* Keeping intercept_cb close the the part of stats that is most often modified helps throughput. */ - cvm_oct_callback_t intercept_cb; /* Optional intecept callback defined above */ #if 0 struct ifnet_stats stats; /* Device statistics */ #endif @@ -125,23 +82,6 @@ typedef struct { /** - * Registers a intercept callback for the names ethernet - * device. It returns the Linux device structure for the - * ethernet port. Usign a callback of NULL will remove - * the callback. Note that this callback must not disturb - * scratch. It will be called with SYNCIOBDMAs in progress - * and userspace may be using scratch. It also must not - * disturb the group mask. - * - * @param device_name - * Device name to register for. (Example: "eth0") - * @param callback Intercept callback to set. - * @return Device structure for the ethernet port or NULL on failure. - */ -struct ifnet *cvm_oct_register_callback(const char *device_name, cvm_oct_callback_t callback); - - -/** * Free a work queue entry received in a intercept callback. * * @param work_queue_entry @@ -150,45 +90,4 @@ struct ifnet *cvm_oct_register_callback( */ int cvm_oct_free_work(void *work_queue_entry); - -/** - * Transmit a work queue entry out of the ethernet port. Both - * the work queue entry and the packet data can optionally be - * freed. The work will be freed on error as well. - * - * @param dev Device to transmit out. - * @param work_queue_entry - * Work queue entry to send - * @param do_free True if the work queue entry and packet data should be - * freed. If false, neither will be freed. - * @param qos Index into the queues for this port to transmit on. This - * is used to implement QoS if their are multiple queues per - * port. This parameter must be between 0 and the number of - * queues per port minus 1. Values outside of this range will - * be change to zero. - * - * @return Zero on success, negative on failure. - */ -int cvm_oct_transmit_qos(struct ifnet *ifp, void *work_queue_entry, int do_free, int qos); - - -/** - * Transmit a work queue entry out of the ethernet port. Both - * the work queue entry and the packet data can optionally be - * freed. The work will be freed on error as well. This simply - * wraps cvmx_oct_transmit_qos() for backwards compatability. - * - * @param dev Device to transmit out. - * @param work_queue_entry - * Work queue entry to send - * @param do_free True if the work queue entry and packet data should be - * freed. If false, neither will be freed. - * - * @return Zero on success, negative on failure. - */ -static inline int cvm_oct_transmit(struct ifnet *ifp, void *work_queue_entry, int do_free) -{ - return cvm_oct_transmit_qos(ifp, work_queue_entry, do_free, 0); -} - #endif Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h Tue Jun 29 06:38:56 2010 (r209584) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h Tue Jun 29 10:13:32 2010 (r209585) @@ -58,12 +58,6 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS * Use asynchronous IO access to hardware. This uses Octeon's asynchronous * IOBDMAs to issue IO accesses without stalling. Set this to zero * to disable this. Note that IOBDMAs require CVMSEG. - * REUSE_MBUFS_WITHOUT_FREE - * Allows the TX path to free an mbuf into the FPA hardware pool. This - * can significantly improve performance for forwarding and bridging, but - * may be somewhat dangerous. Checks are made, but if any buffer is reused - * without the proper Linux cleanup, the networking stack may have very - * bizarre bugs. */ #ifndef CONFIG_CAVIUM_RESERVE32 #define CONFIG_CAVIUM_RESERVE32 0 @@ -72,19 +66,9 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS #if CONFIG_CAVIUM_RESERVE32 #define USE_32BIT_SHARED 1 #define USE_MBUFS_IN_HW 0 - #define REUSE_MBUFS_WITHOUT_FREE 0 #else #define USE_32BIT_SHARED 0 #define USE_MBUFS_IN_HW 1 -#if 0 - #ifdef CONFIG_NETFILTER - #define REUSE_MBUFS_WITHOUT_FREE 0 - #else - #define REUSE_MBUFS_WITHOUT_FREE 1 - #endif -#else - #define REUSE_MBUFS_WITHOUT_FREE 0 -#endif #endif #define INTERRUPT_LIMIT 10000 /* Max interrupts per second per core */ Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c Tue Jun 29 06:38:56 2010 (r209584) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c Tue Jun 29 10:13:32 2010 (r209585) @@ -191,7 +191,6 @@ void cvm_oct_tasklet_rx(void *context, i while (1) { struct mbuf *m = NULL; - cvm_oct_callback_result_t callback_result; int mbuf_in_hw; cvmx_wqe_t *work; @@ -312,7 +311,6 @@ void cvm_oct_tasklet_rx(void *context, i if (((work->ipprt < TOTAL_NUMBER_OF_PORTS) && cvm_oct_device[work->ipprt])) { struct ifnet *ifp = cvm_oct_device[work->ipprt]; - cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; /* Only accept packets for devices that are currently up */ @@ -326,40 +324,9 @@ void cvm_oct_tasklet_rx(void *context, i m->m_pkthdr.csum_data = 0xffff; } - if (priv->intercept_cb) { - callback_result = priv->intercept_cb(ifp, work, m); + ifp->if_ipackets++; - switch (callback_result) { - case CVM_OCT_PASS: - ifp->if_ipackets++; - - (*ifp->if_input)(ifp, m); - break; - case CVM_OCT_DROP: - m_freem(m); - ifp->if_ierrors++; - break; - case CVM_OCT_TAKE_OWNERSHIP_WORK: - /* Interceptor stole our work, but - we need to free the mbuf */ - if (USE_MBUFS_IN_HW && (packet_not_copied)) { - /* We can't free the mbuf since its data is - the same as the work. In this case we don't - do anything */ - } else - m_freem(m); - break; - case CVM_OCT_TAKE_OWNERSHIP_SKB: - /* Interceptor stole our packet */ - break; - } - } else { - ifp->if_ipackets++; - - (*ifp->if_input)(ifp, m); - - callback_result = CVM_OCT_PASS; - } + (*ifp->if_input)(ifp, m); } else { /* Drop any packet received for a device that isn't up */ /* @@ -367,33 +334,26 @@ void cvm_oct_tasklet_rx(void *context, i if_name(ifp)); */ m_freem(m); - callback_result = CVM_OCT_DROP; } } else { /* Drop any packet received for a device that doesn't exist */ DEBUGPRINT("Port %d not controlled by Linux, packet dropped\n", work->ipprt); m_freem(m); - callback_result = CVM_OCT_DROP; } - /* We only need to free the work if the interceptor didn't - take over ownership of it */ - if (callback_result != CVM_OCT_TAKE_OWNERSHIP_WORK) { - - /* Check to see if the mbuf and work share - the same packet buffer */ - if (USE_MBUFS_IN_HW && (packet_not_copied)) { - /* This buffer needs to be replaced, increment - the number of buffers we need to free by one */ - cvmx_fau_atomic_add32( - FAU_NUM_PACKET_BUFFERS_TO_FREE, 1); - - cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, - DONT_WRITEBACK(1)); - } else - cvm_oct_free_work(work); - } + /* Check to see if the mbuf and work share + the same packet buffer */ + if (USE_MBUFS_IN_HW && (packet_not_copied)) { + /* This buffer needs to be replaced, increment + the number of buffers we need to free by one */ + cvmx_fau_atomic_add32( + FAU_NUM_PACKET_BUFFERS_TO_FREE, 1); + + cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, + DONT_WRITEBACK(1)); + } else + cvm_oct_free_work(work); } /* Restore the original POW group mask */ Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c Tue Jun 29 06:38:56 2010 (r209584) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c Tue Jun 29 10:13:32 2010 (r209585) @@ -71,9 +71,6 @@ int cvm_oct_xmit(struct mbuf *m, struct cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; int32_t in_use; int32_t buffers_to_free; -#if REUSE_MBUFS_WITHOUT_FREE - unsigned char *fpa_head; -#endif cvmx_wqe_t *work; /* Prefetch the private data structure. @@ -194,102 +191,6 @@ int cvm_oct_xmit(struct mbuf *m, struct pko_command.s.size0 = CVMX_FAU_OP_SIZE_32; pko_command.s.subone0 = 1; - pko_command.s.dontfree = 1; - pko_command.s.reg0 = priv->fau+qos*4; - - /* See if we can put this m in the FPA pool. Any strange behavior - from the Linux networking stack will most likely be caused by a bug - in the following code. If some field is in use by the network stack - and get carried over when a buffer is reused, bad thing may happen. - If in doubt and you dont need the absolute best performance, disable - the define REUSE_MBUFS_WITHOUT_FREE. The reuse of buffers has - shown a 25% increase in performance under some loads */ -#if REUSE_MBUFS_WITHOUT_FREE - fpa_head = m->head + 128 - ((unsigned long)m->head&0x7f); - if (__predict_false(m->data < fpa_head)) { - /* - printf("TX buffer beginning can't meet FPA alignment constraints\n"); - */ - goto dont_put_mbuf_in_hw; - } - if (__predict_false((m_end_pointer(m) - fpa_head) < CVMX_FPA_PACKET_POOL_SIZE)) { - /* - printf("TX buffer isn't large enough for the FPA\n"); - */ - goto dont_put_mbuf_in_hw; - } - if (__predict_false(m_shared(m))) { - /* - printf("TX buffer sharing data with someone else\n"); - */ - goto dont_put_mbuf_in_hw; - } - if (__predict_false(m_cloned(m))) { - /* - printf("TX buffer has been cloned\n"); - */ - goto dont_put_mbuf_in_hw; - } - if (__predict_false(m_header_cloned(m))) { - /* - printf("TX buffer header has been cloned\n"); - */ - goto dont_put_mbuf_in_hw; - } - if (__predict_false(m->destructor)) { - /* - printf("TX buffer has a destructor\n"); - */ - goto dont_put_mbuf_in_hw; - } - if (__predict_false(m_shinfo(m)->nr_frags)) { - /* - printf("TX buffer has fragments\n"); - */ - goto dont_put_mbuf_in_hw; - } - if (__predict_false(m->truesize != sizeof(*m) + m_end_pointer(m) - m->head)) { - /* - printf("TX buffer truesize has been changed\n"); - */ - goto dont_put_mbuf_in_hw; - } - - /* We can use this buffer in the FPA. - We don't need the FAU update anymore */ - pko_command.s.reg0 = 0; - pko_command.s.dontfree = 0; - - hw_buffer.s.back = (m->data - fpa_head)>>7; - *(struct mbuf **)(fpa_head-sizeof(void *)) = m; - - /* The mbuf will be reused without ever being freed. We must cleanup a - bunch of Linux stuff */ - dst_release(m->dst); - m->dst = NULL; -#ifdef CONFIG_XFRM - secpath_put(m->sp); - m->sp = NULL; -#endif - nf_reset(m); -#ifdef CONFIG_BRIDGE_NETFILTER - /* The next two lines are done in nf_reset() for 2.6.21. 2.6.16 needs - them. I'm leaving it for all versions since the compiler will - optimize them away when they aren't needed. It can tell that - m->nf_bridge was set to NULL in the inlined nf_reset(). */ - nf_bridge_put(m->nf_bridge); - m->nf_bridge = NULL; -#endif /* CONFIG_BRIDGE_NETFILTER */ -#ifdef CONFIG_NET_SCHED - m->tc_index = 0; -#ifdef CONFIG_NET_CLS_ACT - m->tc_verd = 0; -#endif /* CONFIG_NET_CLS_ACT */ -#endif /* CONFIG_NET_SCHED */ - -dont_put_mbuf_in_hw: -#endif /* REUSE_MBUFS_WITHOUT_FREE */ - /* Check if we can use the hardware checksumming */ if (USE_HW_TCPUDP_CHECKSUM && (m->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP)) != 0) { @@ -308,13 +209,6 @@ dont_put_mbuf_in_hw: buffers_to_free = cvmx_fau_fetch_and_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0); } - /* If we're sending faster than the receive can free them then don't do - the HW free */ - if ((buffers_to_free < -100) && !pko_command.s.dontfree) { - pko_command.s.dontfree = 1; - pko_command.s.reg0 = priv->fau+qos*4; - } - cvmx_pko_send_packet_prepare(priv->port, priv->queue + qos, CVMX_PKO_LOCK_CMD_QUEUE); /* Drop this packet if we have too many already queued to the HW */ @@ -339,18 +233,8 @@ dont_put_mbuf_in_hw: cvmx_fau_atomic_add32(priv->fau+qos*4, -1); ifp->if_oerrors++; } else { - if (USE_MBUFS_IN_HW) { - /* Put this packet on the queue to be freed later */ - if (pko_command.s.dontfree) - IF_ENQUEUE(&priv->tx_free_queue[qos], m); - else { - cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, -1); - cvmx_fau_atomic_add32(priv->fau+qos*4, -1); - } - } else { - /* Put this packet on the queue to be freed later */ - IF_ENQUEUE(&priv->tx_free_queue[qos], m); - } + /* Put this packet on the queue to be freed later */ + IF_ENQUEUE(&priv->tx_free_queue[qos], m); } if (work != NULL) cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, DONT_WRITEBACK(1)); @@ -496,96 +380,6 @@ int cvm_oct_xmit_pow(struct mbuf *m, str /** - * Transmit a work queue entry out of the ethernet port. Both - * the work queue entry and the packet data can optionally be - * freed. The work will be freed on error as well. - * - * @param dev Device to transmit out. - * @param work_queue_entry - * Work queue entry to send - * @param do_free True if the work queue entry and packet data should be - * freed. If false, neither will be freed. - * @param qos Index into the queues for this port to transmit on. This - * is used to implement QoS if their are multiple queues per - * port. This parameter must be between 0 and the number of - * queues per port minus 1. Values outside of this range will - * be change to zero. - * - * @return Zero on success, negative on failure. - */ -int cvm_oct_transmit_qos(struct ifnet *ifp, void *work_queue_entry, int do_free, int qos) -{ - cvmx_buf_ptr_t hw_buffer; - cvmx_pko_command_word0_t pko_command; - int dropped; - cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; - cvmx_wqe_t *work = work_queue_entry; - - if (!(ifp->if_flags & IFF_UP)) { - DEBUGPRINT("%s: Device not up\n", if_name(ifp)); - if (do_free) - cvm_oct_free_work(work); - return -1; - } - - /* The check on CVMX_PKO_QUEUES_PER_PORT_* is designed to completely - remove "qos" in the event neither interface supports - multiple queues per port */ - if ((CVMX_PKO_QUEUES_PER_PORT_INTERFACE0 > 1) || - (CVMX_PKO_QUEUES_PER_PORT_INTERFACE1 > 1)) { - if (qos <= 0) - qos = 0; - else if (qos >= cvmx_pko_get_num_queues(priv->port)) - qos = 0; - } else - qos = 0; - - /* Start off assuming no drop */ - dropped = 0; - - critical_enter(); - cvmx_pko_send_packet_prepare(priv->port, priv->queue + qos, CVMX_PKO_LOCK_CMD_QUEUE); - - /* Build the PKO buffer pointer */ - hw_buffer.u64 = 0; - hw_buffer.s.addr = work->packet_ptr.s.addr; - hw_buffer.s.pool = CVMX_FPA_PACKET_POOL; - hw_buffer.s.size = CVMX_FPA_PACKET_POOL_SIZE; - hw_buffer.s.back = work->packet_ptr.s.back; - - /* Build the PKO command */ - pko_command.u64 = 0; - pko_command.s.n2 = 1; /* Don't pollute L2 with the outgoing packet */ - pko_command.s.dontfree = !do_free; - pko_command.s.segs = work->word2.s.bufs; - pko_command.s.total_bytes = work->len; - - /* Check if we can use the hardware checksumming */ - if (__predict_false(work->word2.s.not_IP || work->word2.s.IP_exc)) - pko_command.s.ipoffp1 = 0; - else - pko_command.s.ipoffp1 = ETHER_HDR_LEN + 1; - - /* Send the packet to the output queue */ - if (__predict_false(cvmx_pko_send_packet_finish(priv->port, priv->queue + qos, pko_command, hw_buffer, CVMX_PKO_LOCK_CMD_QUEUE))) { - DEBUGPRINT("%s: Failed to send the packet\n", if_name(ifp)); - dropped = -1; - } - critical_exit(); - - if (__predict_false(dropped)) { - if (do_free) - cvm_oct_free_work(work); - ifp->if_oerrors++; - } else - if (do_free) - cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, DONT_WRITEBACK(1)); - - return dropped; -} - - -/** * This function frees all mbufs that are currenty queued for TX. * * @param dev Device being shutdown Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c Tue Jun 29 06:38:56 2010 (r209584) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c Tue Jun 29 10:13:32 2010 (r209585) @@ -252,40 +252,6 @@ static void cvm_oct_configure_common_hw( /** - * Registers a intercept callback for the names ethernet - * device. It returns the Linux device structure for the - * ethernet port. Usign a callback of NULL will remove - * the callback. Note that this callback must not disturb - * scratch. It will be called with SYNCIOBDMAs in progress - * and userspace may be using scratch. It also must not - * disturb the group mask. - * - * @param device_name - * Device name to register for. (Example: "eth0") - * @param callback Intercept callback to set. - * @return Device structure for the ethernet port or NULL on failure. - */ -#if 0 -struct ifnet *cvm_oct_register_callback(const char *device_name, cvm_oct_callback_t callback) -{ - int port; - - for (port = 0; port < TOTAL_NUMBER_OF_PORTS; port++) { - if (cvm_oct_device[port] && - (strcmp(device_name, cvm_oct_device[port]->name) == 0)) { - cvm_oct_private_t *priv = (cvm_oct_private_t *)cvm_oct_device[port]->if_softc; - priv->intercept_cb = callback; - wmb(); - return cvm_oct_device[port]; - } - } - - return NULL; -} -#endif - - -/** * Free a work queue entry received in a intercept callback. * * @param work_queue_entry @@ -426,7 +392,6 @@ int cvm_oct_init_module(device_t bus) priv->imode = imode; priv->port = port; priv->queue = cvmx_pko_get_base_queue(priv->port); - priv->intercept_cb = NULL; priv->fau = fau - cvmx_pko_get_num_queues(port) * 4; for (qos = 0; qos < cvmx_pko_get_num_queues(port); qos++) cvmx_fau_atomic_write32(priv->fau+qos*4, 0); From owner-svn-src-user@FreeBSD.ORG Tue Jun 29 10:21:34 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E3F2106564A; Tue, 29 Jun 2010 10:21:34 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8E9118FC19; Tue, 29 Jun 2010 10:21:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5TALYOo092901; Tue, 29 Jun 2010 10:21:34 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5TALYPl092899; Tue, 29 Jun 2010 10:21:34 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006291021.o5TALYPl092899@svn.freebsd.org> From: Juli Mallett Date: Tue, 29 Jun 2010 10:21:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209586 - user/jmallett/octeon/sys/mips/cavium/octe X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jun 2010 10:21:34 -0000 Author: jmallett Date: Tue Jun 29 10:21:34 2010 New Revision: 209586 URL: http://svn.freebsd.org/changeset/base/209586 Log: Check RXCSUM before setting checksum-valid flags on a packet. Probably not very useful, but why not? Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c Tue Jun 29 10:13:32 2010 (r209585) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c Tue Jun 29 10:21:34 2010 (r209586) @@ -317,11 +317,15 @@ void cvm_oct_tasklet_rx(void *context, i if ((ifp->if_flags & IFF_UP)) { m->m_pkthdr.rcvif = ifp; - if ((work->word2.s.not_IP || work->word2.s.IP_exc || work->word2.s.L4_error)) + if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) { + if ((work->word2.s.not_IP || work->word2.s.IP_exc || work->word2.s.L4_error)) + m->m_pkthdr.csum_flags = 0; /* XXX */ + else { + m->m_pkthdr.csum_flags = CSUM_IP_CHECKED | CSUM_IP_VALID | CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + m->m_pkthdr.csum_data = 0xffff; + } + } else { m->m_pkthdr.csum_flags = 0; /* XXX */ - else { - m->m_pkthdr.csum_flags = CSUM_IP_CHECKED | CSUM_IP_VALID | CSUM_DATA_VALID | CSUM_PSEUDO_HDR; - m->m_pkthdr.csum_data = 0xffff; } ifp->if_ipackets++; From owner-svn-src-user@FreeBSD.ORG Tue Jun 29 20:42:47 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D288B106566C; Tue, 29 Jun 2010 20:42:47 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C37B78FC1C; Tue, 29 Jun 2010 20:42:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5TKgldC031307; Tue, 29 Jun 2010 20:42:47 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5TKglIL031305; Tue, 29 Jun 2010 20:42:47 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006292042.o5TKglIL031305@svn.freebsd.org> From: Juli Mallett Date: Tue, 29 Jun 2010 20:42:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209593 - user/jmallett/octeon/sys/mips/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jun 2010 20:42:47 -0000 Author: jmallett Date: Tue Jun 29 20:42:47 2010 New Revision: 209593 URL: http://svn.freebsd.org/changeset/base/209593 Log: Sync OCTEON1 devices with OCTEON1-32. Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1 Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1 ============================================================================== --- user/jmallett/octeon/sys/mips/conf/OCTEON1 Tue Jun 29 20:41:52 2010 (r209592) +++ user/jmallett/octeon/sys/mips/conf/OCTEON1 Tue Jun 29 20:42:47 2010 (r209593) @@ -76,17 +76,32 @@ options INVARIANT_SUPPORT #Extra sanity #options WITNESS #Enable checks to detect deadlocks and cycles #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed -device miibus # MII bus support +# Pseudo devices. +device loop # Network loopback +device random # Entropy device +device ether # Ethernet support +device vlan # 802.1Q VLAN support +device tun # Packet tunnel. +device pty # BSD-style compatibility pseudo ttys +device md # Memory "disks" +device gif # IPv6 and IPv4 tunneling +device faith # IPv6-to-IPv4 relaying (translation) +device firmware # firmware assist module + #XXXimp device genclock -device loop -device ether -device md +device puc device uart device octe #options VERBOSE_SYSINIT -device bpf -device random +# The `bpf' device enables the Berkeley Packet Filter. +# Be aware of the administrative consequences of enabling this! +# Note that 'bpf' is required for DHCP. +device bpf # Berkeley packet filter + +device crypto +device cryptodev +device cryptocteon # Wireless NIC cards device wlan # 802.11 support @@ -103,21 +118,89 @@ options AH_SUPPORT_AR5416 # enable AR54 device ath_rate_sample # SampleRate tx rate control for ath # USB support +options USB_DEBUG # enable debug msgs +device octusb # Cavium Octeon USB Bus device uhci # UHCI PCI->USB interface device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface (USB 2.0) device usb # USB Bus (required) -device octusb # Cavium Octeon USB Bus +#device udbp # USB Double Bulk Pipe devices +device uhid # "Human Interface Devices" +device ulpt # Printer +device umass # Disks/Mass storage - Requires scbus and da +device urio # Diamond Rio 500 MP3 player +# USB Serial devices +device uark # Technologies ARK3116 based serial adapters +device ubsa # Belkin F5U103 and compatible serial adapters +device uftdi # For FTDI usb serial adapters +device uipaq # Some WinCE based devices +device uplcom # Prolific PL-2303 serial adapters +device uslcom # SI Labs CP2101/CP2102 serial adapters +device uvisor # Visor and Palm devices +device uvscom # USB serial support for DDI pocket's PHS +# USB Ethernet, requires miibus +device aue # ADMtek USB Ethernet +device axe # ASIX Electronics USB Ethernet +device cdce # Generic USB over Ethernet +device cue # CATC USB Ethernet +device kue # Kawasaki LSI USB Ethernet +device rue # RealTek RTL8150 USB Ethernet +device udav # Davicom DM9601E USB +# USB Wireless +device rum # Ralink Technology RT2501USB wireless NICs +device uath # Atheros AR5523 wireless NICs +device ural # Ralink Technology RT2500USB wireless NICs +device zyd # ZyDAS zb1211/zb1211b wireless NICs # ATA and ATAPI devices device ata device atadisk # ATA disk drives device ataraid # ATA RAID drives device atapicd # ATAPI CDROM drives +device atapifd # ATAPI floppy drives +device atapist # ATAPI tape drives options ATA_STATIC_ID # Static device numbering -# PCI Ethernet -device re +# SCSI peripherals +device scbus # SCSI bus (required for SCSI) +device ch # SCSI media changers +device da # Direct Access (disks) +device sa # Sequential Access (tape etc) +device cd # CD +device pass # Passthrough device (direct SCSI access) +device ses # SCSI Environmental Services (and SAF-TE) + +# PCI Ethernet NICs that use the common MII bus controller code. +# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! +device miibus # MII bus support +device ae # Attansic/Atheros L2 FastEthernet +device age # Attansic/Atheros L1 Gigabit Ethernet +device alc # Atheros AR8131/AR8132 Ethernet +device ale # Atheros AR8121/AR8113/AR8114 Ethernet +device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet +device bfe # Broadcom BCM440x 10/100 Ethernet +device bge # Broadcom BCM570xx Gigabit Ethernet +device dc # DEC/Intel 21143 and various workalikes +device et # Agere ET1310 10/100/Gigabit Ethernet +device fxp # Intel EtherExpress PRO/100B (82557, 82558) +device jme # JMicron JMC250 Gigabit/JMC260 Fast Ethernet +device lge # Level 1 LXT1001 gigabit Ethernet +device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet +device nge # NatSemi DP83820 gigabit Ethernet +device re # RealTek 8139C+/8169/8169S/8110S +device rl # RealTek 8129/8139 +device sf # Adaptec AIC-6915 (``Starfire'') +device sge # Silicon Integrated Systems SiS190/191 +device sis # Silicon Integrated Systems SiS 900/SiS 7016 +device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet +device ste # Sundance ST201 (D-Link DFE-550TX) +device stge # Sundance/Tamarack TC9021 gigabit Ethernet +device tl # Texas Instruments ThunderLAN +device tx # SMC EtherPower II (83c170 ``EPIC'') +device vge # VIA VT612x gigabit Ethernet +device vr # VIA Rhine, Rhine II +device wb # Winbond W89C840F +device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') # # Use the following for Compact Flash file-system From owner-svn-src-user@FreeBSD.ORG Wed Jun 30 19:51:19 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C98A51065672; Wed, 30 Jun 2010 19:51:19 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B93698FC16; Wed, 30 Jun 2010 19:51:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5UJpJNN043766; Wed, 30 Jun 2010 19:51:19 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5UJpJm5043764; Wed, 30 Jun 2010 19:51:19 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006301951.o5UJpJm5043764@svn.freebsd.org> From: Juli Mallett Date: Wed, 30 Jun 2010 19:51:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209615 - user/jmallett/octeon/sys/mips/cavium/octe X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jun 2010 19:51:19 -0000 Author: jmallett Date: Wed Jun 30 19:51:19 2010 New Revision: 209615 URL: http://svn.freebsd.org/changeset/base/209615 Log: Set interface capabilities. Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/octe.c Wed Jun 30 18:34:45 2010 (r209614) +++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c Wed Jun 30 19:51:19 2010 (r209615) @@ -474,6 +474,15 @@ octe_ioctl(struct ifnet *ifp, u_long cmd } priv->if_flags = ifp->if_flags; return (0); + + case SIOCSIFCAP: + /* + * Just change the capabilities in software, currently none + * require reprogramming hardware, they just toggle whether we + * make use of already-present facilities in software. + */ + ifp->if_capenable = ifr->ifr_reqcap; + return (0); case SIOCSIFMTU: error = cvm_oct_common_change_mtu(ifp, ifr->ifr_mtu); From owner-svn-src-user@FreeBSD.ORG Thu Jul 1 14:55:38 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7DBD1065670; Thu, 1 Jul 2010 14:55:38 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E63C8FC15; Thu, 1 Jul 2010 14:55:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o61EtcVT099520; Thu, 1 Jul 2010 14:55:38 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o61EtcOf099519; Thu, 1 Jul 2010 14:55:38 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201007011455.o61EtcOf099519@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 1 Jul 2010 14:55:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209626 - user/nwhitehorn X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2010 14:55:38 -0000 Author: nwhitehorn Date: Thu Jul 1 14:55:38 2010 New Revision: 209626 URL: http://svn.freebsd.org/changeset/base/209626 Log: Add a user directory for myself. Added: user/nwhitehorn/ From owner-svn-src-user@FreeBSD.ORG Thu Jul 1 14:55:54 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B67B01065670; Thu, 1 Jul 2010 14:55:54 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8CED78FC08; Thu, 1 Jul 2010 14:55:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o61EtswF099624; Thu, 1 Jul 2010 14:55:54 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o61Ets1v099623; Thu, 1 Jul 2010 14:55:54 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201007011455.o61Ets1v099623@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 1 Jul 2010 14:55:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209627 - user/nwhitehorn/ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2010 14:55:54 -0000 Author: nwhitehorn Date: Thu Jul 1 14:55:54 2010 New Revision: 209627 URL: http://svn.freebsd.org/changeset/base/209627 Log: While waiting to merge projects/ppc64, branch projects/ppc64/sys to experiment with PowerPC hypervisors and bring up the Playstation 3 port. Added: - copied from r209626, projects/ppc64/sys/ Directory Properties: user/nwhitehorn/ps3/ (props changed) From owner-svn-src-user@FreeBSD.ORG Thu Jul 1 15:04:36 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D101B106566C; Thu, 1 Jul 2010 15:04:36 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C09CE8FC17; Thu, 1 Jul 2010 15:04:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o61F4aI8001756; Thu, 1 Jul 2010 15:04:36 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o61F4aqs001755; Thu, 1 Jul 2010 15:04:36 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201007011504.o61F4aqs001755@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 1 Jul 2010 15:04:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209629 - user/nwhitehorn/ps3/arm/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2010 15:04:36 -0000 Author: nwhitehorn Date: Thu Jul 1 15:04:36 2010 New Revision: 209629 URL: http://svn.freebsd.org/changeset/base/209629 Log: Record the merge of the PS3 loader deletion from projects/ppc64, but don't actually delete it here, so I don't merge it by accident in the future. Modified: Directory Properties: user/nwhitehorn/ps3/ (props changed) user/nwhitehorn/ps3/amd64/include/xen/ (props changed) user/nwhitehorn/ps3/arm/conf/SHEEVAPLUG (props changed) user/nwhitehorn/ps3/cddl/contrib/opensolaris/ (props changed) user/nwhitehorn/ps3/contrib/dev/acpica/ (props changed) user/nwhitehorn/ps3/contrib/pf/ (props changed) user/nwhitehorn/ps3/contrib/x86emu/ (props changed) user/nwhitehorn/ps3/dev/xen/xenpci/ (props changed) From owner-svn-src-user@FreeBSD.ORG Thu Jul 1 15:20:16 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37C2C1065670; Thu, 1 Jul 2010 15:20:16 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 268E58FC1F; Thu, 1 Jul 2010 15:20:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o61FKGtt005290; Thu, 1 Jul 2010 15:20:16 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o61FKGE4005286; Thu, 1 Jul 2010 15:20:16 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201007011520.o61FKGE4005286@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 1 Jul 2010 15:20:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209630 - user/nwhitehorn/ps3/powerpc/ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2010 15:20:16 -0000 Author: nwhitehorn Date: Thu Jul 1 15:20:15 2010 New Revision: 209630 URL: http://svn.freebsd.org/changeset/base/209630 Log: Add the skeleton of the PS3 hypercall interface, and some scripts to generate the actual hypercall routines in a flexible way. Discussed with: grehan Obtained from: Linux, ps2dev wiki Added: user/nwhitehorn/ps3/powerpc/ps3/ user/nwhitehorn/ps3/powerpc/ps3/ps3-hv-asm.awk (contents, props changed) user/nwhitehorn/ps3/powerpc/ps3/ps3-hv-header.awk (contents, props changed) user/nwhitehorn/ps3/powerpc/ps3/ps3-hvcall.master (contents, props changed) Added: user/nwhitehorn/ps3/powerpc/ps3/ps3-hv-asm.awk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/nwhitehorn/ps3/powerpc/ps3/ps3-hv-asm.awk Thu Jul 1 15:20:15 2010 (r209630) @@ -0,0 +1,56 @@ +# This script generates the PS3 hypervisor call stubs from an HV +# interface definition file. The PS3 HV calling convention is very +# similar to the PAPR one, except that the function token is passed in +# r11 instead of r3. +# +# Invoke like so: awk -f ps3-hv-asm.awk < ps3-hvcall.master > ps3-hvcall.S +# + +# $FreeBSD$ + +BEGIN { + printf("#include \n\n"); + printf("#define hc .long 0x44000022\n\n"); +} + +/[ \/]\*.*/ { + print($0); +} + +/HVCALL.*/ { + code = $2; + ins = split($4, a, ",") + outs = split($5, a, ",") + + printf("ASENTRY(%s)\n",$3); + printf("\tmflr %%r0\n"); + printf("\tstd %%r0,16(%%r1)\n"); + printf("\tstdu %%r1,-%d(%%r1)\n", 48+8*outs); + + if ($4 == "UNUSED") + ins = 0 + + # Save output reg addresses to the stack + for (i = 0; i < outs; i++) { + if (ins+i >= 8) { + printf("\tld %%r11,%d(%%r1)\n", 48+8*outs + 48 + 8*i); + printf("\tstd %%r11,%d(%%r1)\n", 48+8*i); + } else { + printf("\tstd %%r%d,%d(%%r1)\n", 3+ins+i, 48+8*i); + } + } + + printf("\tli %%r11,%d\n", code); + printf("\thc\n"); + printf("\textsw %%r3,%%r3\n"); + + for (i = 0; i < outs; i++) { + printf("\tld %%r11,%d(%%r1)\n", 48+8*i); + printf("\tstd %%r%d,0(%%r11)\n", 4+i); + } + + printf("\tld %%r1,0(%%r1)\n"); + printf("\tld %%r0,16(%%r1)\n"); + printf("\tmtlr %%r0\n"); + printf("\tblr\n\n"); +} Added: user/nwhitehorn/ps3/powerpc/ps3/ps3-hv-header.awk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/nwhitehorn/ps3/powerpc/ps3/ps3-hv-header.awk Thu Jul 1 15:20:15 2010 (r209630) @@ -0,0 +1,39 @@ +# This script generates the PS3 hypervisor call header from a hypervisor +# interface definition file. All lines that do not begin with HVCALL +# or a bare # for comments are copied to the output header so that +# enums, constant, C comments and the like can be passed through into the +# header. +# +# Invoke like so: awk -f ps3-hv-header.awk < ps3-hvcall.master > ps3-hv.h +# + +# $FreeBSD$ + +!/HVCALL.*/ && (!/#.*/ || /#define.*/ || /#include.*/) { + print($0); +} + +/HVCALL.*/ { + split($5, outs, ",") + if ($4 == "UNUSED") + split("", ins, ",") + else + split($4, ins, ",") + + printf("int %s(",$3); + for (i = 1; i <= length(ins); i++) { + printf("uint64_t %s", ins[i]); + if (i < length(ins)) printf(", "); + } + + if (length(outs) > 0 && length(ins) > 0) + printf(", "); + + for (i = 1; i <= length(outs); i++) { + printf("uint64_t *%s", outs[i]); + if (i < length(outs)) printf(", "); + } + + printf(");\n"); +} + Added: user/nwhitehorn/ps3/powerpc/ps3/ps3-hvcall.master ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/nwhitehorn/ps3/powerpc/ps3/ps3-hvcall.master Thu Jul 1 15:20:15 2010 (r209630) @@ -0,0 +1,96 @@ +/* + * Playstation 3 LV1 hypercall interface + * + * $FreeBSD: head/sys/powerpc/powermac/cpcht.c 209310 2010-06-18 17:39:56Z nwhiteh + */ + +#include + +# Code Name Inputs Outputs +HVCALL 0 lv1_allocate_memory size,log_page_size,zero,flags base_addr,muid +HVCALL 1 lv1_write_htab_entry vas_id,slot,pte_hi,pte_lo +HVCALL 2 lv1_construct_virtual_address_space log_pteg_count,n_sizes,page_sizes vas_id,hv_pteg_count +HVCALL 4 lv1_get_virtual_address_space_id_of_ppe ppe_id vas_id +HVCALL 6 lv1_query_logical_partition_address_region_info lpar_id base_addr,size,access_right,max_page_size,flags +HVCALL 7 lv1_select_virtual_address_space vas_id +HVCALL 9 lv1_pause mode +HVCALL 10 lv1_destruct_virtual_address_space vas_id +HVCALL 11 lv1_configure_irq_state_bitmap ppe_id,cpu_id,bitmap_addr +HVCALL 12 lv1_connect_irq_plug_ext ppe_id,cpu_id,virq,outlet,zero +HVCALL 13 lv1_release_memory base_addr +HVCALL 15 lv1_put_iopte ioas_id,ioif_addr,lpar_addr,io_id,flags +HVCALL 17 lv1_disconnect_irq_plug_ext ppe_id,cpu_id,virq +HVCALL 18 lv1_construct_event_receive_port UNUSED outlet +HVCALL 19 lv1_destruct_event_receive_port outlet +HVCALL 24 lv1_send_event_locally outlet +HVCALL 27 lv1_end_of_interrupt irq +HVCALL 28 lv1_connect_irq_plug virq,irq +HVCALL 29 lv1_disconnect_irq_plus virq +HVCALL 30 lv1_end_of_interrupt_ext ppe_id,cpu_id,virq +HVCALL 31 lv1_did_update_interrupt_mask ppe_id,cpu_id +HVCALL 44 lv1_shutdown_logical_partition cmd +HVCALL 54 lv1_destruct_logical_spe spe_id +HVCALL 57 lv1_construct_logical_spe pshift1,pshift2,pshift3,pshift4,pshift5,vas_id,spe_type priv2_addr,problem_phys,local_store_phys,unused,shadow_addr,spe_id +HVCALL 61 lv1_set_spe_interrupt_mask spe_id,class,mask +HVCALL 65 lv1_disable_logical_spe spe_id,zero +HVCALL 66 lv1_clear_spe_interrupt_status spe_id,class,stat,zero +HVCALL 67 lv1_get_spe_interrupt_status spe_id,class stat +HVCALL 69 lv1_get_logical_ppe_id UNUSED ppe_id +HVCALL 74 lv1_get_logical_partition_id UNUSED lpar_id +HVCALL 78 lv1_get_spe_irq_outlet spe_id,class outlet +HVCALL 79 lv1_set_spe_privilege_state_area_1_register spe_id,offset,value +HVCALL 91 lv1_get_repository_node_value lpar_id,n1,n2,n3,n4 v1,v2 +HVCALL 96 lv1_set_dabr dabr,flags +HVCALL 116 lv1_allocate_io_segment ioas_id,seg_size,io_pagesize ioif_addr +HVCALL 117 lv1_release_io_segment ioas_id,ioif_addr +HVCALL 120 lv1_construct_io_irq_outlet interrupt_id outlet +HVCALL 121 lv1_destruct_io_irq_outlet outlet +HVCALL 122 lv1_map_htab lpar_id htab_addr +HVCALL 123 lv1_unmap_htab htab_addr +HVCALL 127 lv1_get_version_info UNUSED firm_vers +HVCALL 162 lv1_read_virtual_uart port,buffer,bytes bytes_read +HVCALL 163 lv1_write_virtual_uart port,buffer,bytes bytes_written +HVCALL 164 lv1_set_virtual_uart_param port,param,value +HVCALL 165 lv1_get_virtual_uart_param port,param value +HVCALL 166 lv1_configure_virtual_uart lpar_addr outlet +HVCALL 170 lv1_open_device bus,dev,zero +HVCALL 171 lv1_close_device bus,dev +HVCALL 172 lv1_map_device_mmio_region bus,dev,bus_addr,size,page_size lpar_addr +HVCALL 173 lv1_unmap_device_mmio_region bus,dev,lpar_addr +HVCALL 174 lv1_allocate_device_dma_region bus,dev,io_size,io_pagesize,flag dma_region +HVCALL 175 lv1_free_device_dma_region bus,dev,dma_region +HVCALL 176 lv1_map_device_dma_region bus,dev,lpar_addr,dma_region,size,flags +HVCALL 177 lv1_unmap_device_dma_region bus,dev,dma_region,size +HVCALL 178 lv1_read_pci_config ps3bus,bus,dev,func,offset,size result +HVCALL 179 lv1_write_pci_config ps3bus,bus,dev,func,offset,size,data +HVCALL 185 lv1_net_add_multicast_address bus,dev,addr,flags +HVCALL 186 lv1_net_remove_multicast_address bus,dev,zero,one +HVCALL 187 lv1_net_start_tx_dma bus,dev,bus_addr,zero +HVCALL 188 lv1_net_stop_tx_dma bus,dev,zero +HVCALL 189 lv1_net_start_rx_dma bus,dev,bus_addr,zero +HVCALL 190 lv1_net_stop_rx_dma bus,dev,zero +HVCALL 191 lv1_net_set_interrupt_status_indicator bus,dev,irq_status_addr,zero +HVCALL 193 lv1_net_set_interrupt_mask bus,dev,mask,zero +HVCALL 194 lv1_net_control bus,dev,p1,p2,p3,p4 v1,v2 +HVCALL 197 lv1_connect_interrupt_event_receive_port bus,dev,outlet,irq +HVCALL 198 lv1_disconnect_interrupt_event_receive_port bus,dev,outlet,irq +HVCALL 202 lv1_deconfigure_virtual_uart_irq +HVCALL 207 lv1_enable_logical_spe spe_id,resource_id +HVCALL 210 lv1_gpu_open zero +HVCALL 211 lv1_gpu_close +HVCALL 212 lv1_gpu_device_map dev lpar_addr,lpar_size +HVCALL 213 lv1_gpu_device_unmap dev +HVCALL 214 lv1_gpu_memory_allocate ddr_size,zero1,zero2,zero3,zero4 handle,ddr_lpar +HVCALL 216 lv1_gpu_memory_free handle +HVCALL 217 lv1_gpu_context_allocate handle, zero chandle,lpar_dma_control,lpar_driver_info,lpar_reports,lpar_reports_size +HVCALL 218 lv1_gpu_context_free chandle +HVCALL 221 lv1_gpu_context_iomap changle,gpu_ioif,xdr_lpar,fbsize,ioflags +HVCALL 225 lv1_gpu_context_attribute chandle,op,p1,p2,p3,p4 +HVCALL 227 lv1_gpu_context_intr chandle v1 +HVCALL 232 lv1_get_rtc UNUSED rtc_val,timebase +HVCALL 245 lv1_storage_read dev,region,sector,nsectors,flags,buf dma_tag +HVCALL 246 lv1_storage_write dev,region,sector,nsectors,flags,buf dma_tag +HVCALL 248 lv1_storage_send_device_command dev,cmd_id,cmd_block,cmd_size,data_buf,blocks dma_tag +HVCALL 249 lv1_storage_get_async_status dev dma_tag,status +HVCALL 254 lv1_storage_check_async_status dev,dma_tag status +HVCALL 255 lv1_panic howto From owner-svn-src-user@FreeBSD.ORG Thu Jul 1 15:23:30 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40E93106566B; Thu, 1 Jul 2010 15:23:30 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3097C8FC19; Thu, 1 Jul 2010 15:23:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o61FNUcZ006071; Thu, 1 Jul 2010 15:23:30 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o61FNUFP006069; Thu, 1 Jul 2010 15:23:30 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201007011523.o61FNUFP006069@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 1 Jul 2010 15:23:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209631 - user/nwhitehorn/ps3/powerpc/ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2010 15:23:30 -0000 Author: nwhitehorn Date: Thu Jul 1 15:23:29 2010 New Revision: 209631 URL: http://svn.freebsd.org/changeset/base/209631 Log: Fix the $FreeBSD$ in this file. Modified: user/nwhitehorn/ps3/powerpc/ps3/ps3-hvcall.master Modified: user/nwhitehorn/ps3/powerpc/ps3/ps3-hvcall.master ============================================================================== --- user/nwhitehorn/ps3/powerpc/ps3/ps3-hvcall.master Thu Jul 1 15:20:15 2010 (r209630) +++ user/nwhitehorn/ps3/powerpc/ps3/ps3-hvcall.master Thu Jul 1 15:23:29 2010 (r209631) @@ -1,7 +1,7 @@ /* * Playstation 3 LV1 hypercall interface * - * $FreeBSD: head/sys/powerpc/powermac/cpcht.c 209310 2010-06-18 17:39:56Z nwhiteh + * $FreeBSD$ */ #include From owner-svn-src-user@FreeBSD.ORG Sat Jul 3 09:41:13 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8286D1065670; Sat, 3 Jul 2010 09:41:13 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 58F428FC0A; Sat, 3 Jul 2010 09:41:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o639fDaq073325; Sat, 3 Jul 2010 09:41:13 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o639fD6e073324; Sat, 3 Jul 2010 09:41:13 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201007030941.o639fD6e073324@svn.freebsd.org> From: Juli Mallett Date: Sat, 3 Jul 2010 09:41:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209654 - user/jmallett/octeon/sys/mips/cavium X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jul 2010 09:41:13 -0000 Author: jmallett Date: Sat Jul 3 09:41:12 2010 New Revision: 209654 URL: http://svn.freebsd.org/changeset/base/209654 Log: Use Cavium's 64-bit cyclecounter. Modified: user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c Modified: user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c Fri Jul 2 22:17:13 2010 (r209653) +++ user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c Sat Jul 3 09:41:12 2010 (r209654) @@ -47,6 +47,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -111,8 +113,20 @@ static const struct octeon_feature_descr uint64_t ciu_get_en_reg_addr_new(int corenum, int intx, int enx, int ciu_ip); void ciu_dump_interrutps_enabled(int core_num, int intx, int enx, int ciu_ip); +static uint64_t octeon_get_ticks(void); +static unsigned octeon_get_timecount(struct timecounter *tc); + static void octeon_boot_params_init(register_t ptr); +static struct timecounter octeon_timecounter = { + octeon_get_timecount, /* get_timecount */ + 0, /* no poll_pps */ + 0xffffffffu, /* octeon_mask */ + 0, /* frequency */ + "Octeon", /* name */ + 900, /* quality (adjusted in code) */ +}; + void platform_cpu_init() { @@ -342,8 +356,14 @@ platform_start(__register_t a0, __regist kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger"); #endif platform_counter_freq = cvmx_sysinfo_get()->cpu_clock_hz; + + octeon_timecounter.tc_frequency = cvmx_sysinfo_get()->cpu_clock_hz; + platform_timecounter = &octeon_timecounter; + mips_timer_init_params(platform_counter_freq, 0); + set_cputicker(octeon_get_ticks, cvmx_sysinfo_get()->cpu_clock_hz, 1); + #ifdef SMP /* * Clear any pending IPIs. @@ -359,6 +379,21 @@ platform_start(__register_t a0, __regist printf("\n"); } +static uint64_t +octeon_get_ticks(void) +{ + uint64_t cvmcount; + + CVMX_MF_CYCLE(cvmcount); + return (cvmcount); +} + +static unsigned +octeon_get_timecount(struct timecounter *tc) +{ + return ((unsigned)octeon_get_ticks()); +} + /* impSTART: This stuff should move back into the Cavium SDK */ /* **************************************************************************************** From owner-svn-src-user@FreeBSD.ORG Sat Jul 3 20:48:44 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05128106566C; Sat, 3 Jul 2010 20:48:44 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E900B8FC12; Sat, 3 Jul 2010 20:48:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o63KmhVv021584; Sat, 3 Jul 2010 20:48:43 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o63KmhXe021581; Sat, 3 Jul 2010 20:48:43 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201007032048.o63KmhXe021581@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 3 Jul 2010 20:48:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209673 - user/nwhitehorn/ps3/dev/ofw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jul 2010 20:48:44 -0000 Author: nwhitehorn Date: Sat Jul 3 20:48:43 2010 New Revision: 209673 URL: http://svn.freebsd.org/changeset/base/209673 Log: We need Open Firmware and FDT to be able to coexist. Ideally, we would either kill the OFW iinfo stuff or the FDT duplicate version of it in favor of something unified, but for now at least don't break things. Modified: user/nwhitehorn/ps3/dev/ofw/ofw_bus_subr.c user/nwhitehorn/ps3/dev/ofw/openfirm.c Modified: user/nwhitehorn/ps3/dev/ofw/ofw_bus_subr.c ============================================================================== --- user/nwhitehorn/ps3/dev/ofw/ofw_bus_subr.c Sat Jul 3 20:26:33 2010 (r209672) +++ user/nwhitehorn/ps3/dev/ofw/ofw_bus_subr.c Sat Jul 3 20:48:43 2010 (r209673) @@ -193,7 +193,6 @@ ofw_bus_is_compatible_strict(device_t de return (0); } -#ifndef FDT void ofw_bus_setup_iinfo(phandle_t node, struct ofw_bus_iinfo *ii, int intrsz) { @@ -313,4 +312,3 @@ ofw_bus_search_intrmap(void *intr, int i } return (0); } -#endif /* !FDT */ Modified: user/nwhitehorn/ps3/dev/ofw/openfirm.c ============================================================================== --- user/nwhitehorn/ps3/dev/ofw/openfirm.c Sat Jul 3 20:26:33 2010 (r209672) +++ user/nwhitehorn/ps3/dev/ofw/openfirm.c Sat Jul 3 20:48:43 2010 (r209673) @@ -135,7 +135,6 @@ OF_init(void *cookie) return (rv); } -#ifndef FDT void OF_printf(const char *fmt, ...) { @@ -159,7 +158,6 @@ OF_test(const char *name) return (OFW_TEST(ofw_obj, name)); } -#endif int OF_interpret(const char *cmd, int nreturns, ...) @@ -321,7 +319,6 @@ OF_package_to_path(phandle_t package, ch return (OFW_PACKAGE_TO_PATH(ofw_obj, package, buf, len)); } -#ifndef FDT /* Call the method in the scope of a given instance. */ int OF_call_method(const char *method, ihandle_t instance, int nargs, int nreturns, @@ -435,4 +432,3 @@ OF_exit() for (;;) /* just in case */ ; } -#endif From owner-svn-src-user@FreeBSD.ORG Sat Jul 3 21:02:12 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1BAB31065672; Sat, 3 Jul 2010 21:02:12 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B6888FC17; Sat, 3 Jul 2010 21:02:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o63L2BYY024580; Sat, 3 Jul 2010 21:02:11 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o63L2Bl3024578; Sat, 3 Jul 2010 21:02:11 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201007032102.o63L2Bl3024578@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 3 Jul 2010 21:02:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209674 - user/nwhitehorn/ps3/dev/ofw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jul 2010 21:02:12 -0000 Author: nwhitehorn Date: Sat Jul 3 21:02:11 2010 New Revision: 209674 URL: http://svn.freebsd.org/changeset/base/209674 Log: "Fix" some things in ofw_fdt for 64-bit systems. The basic problem is that this code uses pointers into the device tree as package handles, but the PPC OF spec has package handles as 32-bit quantities. Maybe offsets into the DT blob could be used instead? In any case, this change is fine on powerpc64/aim, since device trees will always be loaded at boot time and thus are guaranteed to be in 32-bit accessible memory. Also, kill some dependence on things in /dev/fdt, which are unimplemented (and unnecessary) for the time being. Modified: user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c Modified: user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c ============================================================================== --- user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c Sat Jul 3 20:48:43 2010 (r209673) +++ user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c Sat Jul 3 21:02:11 2010 (r209674) @@ -39,7 +39,9 @@ __FBSDID("$FreeBSD$"); #include +#ifndef __powerpc__ #include +#endif #include #include @@ -120,11 +122,11 @@ fdt_phandle_offset(phandle_t p) dt_struct = (const char *)fdtp + fdt_off_dt_struct(fdtp); - if (((const char *)p < dt_struct) || - (const char *)p > (dt_struct + fdt_size_dt_struct(fdtp))) + if (((const char *)(uintptr_t)p < dt_struct) || + (const char *)(uintptr_t)p > (dt_struct + fdt_size_dt_struct(fdtp))) return (-1); - offset = (const char *)p - dt_struct; + offset = (const char *)(uintptr_t)p - dt_struct; if (offset < 0) return (-1); @@ -141,7 +143,8 @@ ofw_fdt_peer(ofw_t ofw, phandle_t node) if (node == 0) { /* Find root node */ offset = fdt_path_offset(fdtp, "/"); - p = (phandle_t)fdt_offset_ptr(fdtp, offset, sizeof(p)); + p = (phandle_t)(uintptr_t)fdt_offset_ptr(fdtp, + offset, sizeof(p)); return (p); } @@ -156,7 +159,8 @@ ofw_fdt_peer(ofw_t ofw, phandle_t node) if (depth < 0) return (0); if (depth == 1) { - p = (phandle_t)fdt_offset_ptr(fdtp, offset, sizeof(p)); + p = (phandle_t)(uintptr_t)fdt_offset_ptr(fdtp, + offset, sizeof(p)); return (p); } } @@ -181,7 +185,8 @@ ofw_fdt_child(ofw_t ofw, phandle_t node) if (depth < 0) return (0); if (depth == 1) { - p = (phandle_t)fdt_offset_ptr(fdtp, offset, sizeof(p)); + p = (phandle_t)(uintptr_t)fdt_offset_ptr(fdtp, + offset, sizeof(p)); return (p); } } @@ -201,7 +206,8 @@ ofw_fdt_parent(ofw_t ofw, phandle_t node return (0); paroffset = fdt_parent_offset(fdtp, offset); - p = (phandle_t)fdt_offset_ptr(fdtp, paroffset, sizeof(phandle_t)); + p = (phandle_t)(uintptr_t)fdt_offset_ptr(fdtp, paroffset, + sizeof(phandle_t)); return (p); } @@ -223,7 +229,8 @@ ofw_fdt_instance_to_package(ofw_t ofw, i if (offset < 0) return (0); - p = (phandle_t)fdt_offset_ptr(fdtp, offset, sizeof(phandle_t)); + p = (phandle_t)(uintptr_t)fdt_offset_ptr(fdtp, offset, + sizeof(phandle_t)); return (p); } @@ -326,7 +333,7 @@ ofw_fdt_nextprop(ofw_t ofw, phandle_t pa size_t size) { const struct fdt_property *prop; - int offset, rv; + long offset, rv; offset = fdt_phandle_offset(package); if (offset < 0) @@ -343,7 +350,7 @@ ofw_fdt_nextprop(ofw_t ofw, phandle_t pa if (prop == NULL) return (0); - offset = fdt_phandle_offset((phandle_t)prop); + offset = fdt_phandle_offset((phandle_t)(uintptr_t)prop); rv = fdt_nextprop(offset, buf, size); return (rv); } @@ -379,7 +386,7 @@ ofw_fdt_finddevice(ofw_t ofw, const char offset = fdt_path_offset(fdtp, device); - p = (phandle_t)fdt_offset_ptr(fdtp, offset, sizeof(p)); + p = (phandle_t)(uintptr_t)fdt_offset_ptr(fdtp, offset, sizeof(p)); return (p); } @@ -403,6 +410,7 @@ ofw_fdt_package_to_path(ofw_t ofw, phand static int ofw_fdt_fixup(ofw_t ofw) { +#ifndef __powerpc64__ #define FDT_MODEL_LEN 80 char model[FDT_MODEL_LEN]; phandle_t root; @@ -430,6 +438,7 @@ ofw_fdt_fixup(ofw_t ofw) if (fdt_fixup_table[i].handler != NULL) (*fdt_fixup_table[i].handler)(root); } +#endif return (0); }