70 static int interface_port_count[4] = { 0, 0, 0, 0 };
122 if (interface == 3) {
153 mode.
u64 = cvmx_read_csr(CVMX_GMXX_INF_MODE(interface));
156 switch (mode.
cn56xx.mode) {
194 static int __cvmx_helper_port_setup_ipd(
int ipd_port)
203 port_config.s.qos = ipd_port & 0x7;
225 tag_config.s.grp = 0;
227 cvmx_pip_config_port(ipd_port, port_config, tag_config);
295 __cvmx_helper_loop_enumerate(interface);
388 static int __cvmx_helper_interface_setup_ipd(
int interface)
393 while (num_ports--) {
394 __cvmx_helper_port_setup_ipd(ipd_port);
406 static int __cvmx_helper_global_setup_ipd(
void)
431 static int __cvmx_helper_interface_setup_pko(
int interface)
446 { 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1 };
454 int num_ports = interface_port_count[
interface];
455 while (num_ports--) {
464 cvmx_pko_get_base_queue_per_core(ipd_port,
466 cvmx_pko_get_num_queues(ipd_port),
479 static int __cvmx_helper_global_setup_pko(
void)
487 fau_to.s.tout_val = 0xfff;
488 fau_to.s.tout_enb = 0;
498 static int __cvmx_helper_global_setup_backpressure(
void)
500 #if CVMX_HELPER_DISABLE_RGMII_BACKPRESSURE
505 for (interface = 0;
interface < num_interfaces; interface++) {
518 cvmx_gmx_set_backpressure_override(interface, 0xf);
538 static int __cvmx_helper_packet_hardware_enable(
int interface)
598 #define FIX_IPD_FIRST_BUFF_PAYLOAD_BYTES \
599 (CVMX_FPA_PACKET_POOL_SIZE-8-CVMX_HELPER_FIRST_MBUFF_SKIP)
600 #define FIX_IPD_NON_FIRST_BUFF_PAYLOAD_BYTES \
601 (CVMX_FPA_PACKET_POOL_SIZE-8-CVMX_HELPER_NOT_FIRST_MBUFF_SKIP)
602 #define FIX_IPD_OUTPORT 0
604 #define INTERFACE(port) (port >> 4)
605 #define INDEX(port) (port & 0xf)
610 int size, num_segs = 0, wqe_pcnt, pkt_pcnt;
619 cvmx_read_csr(CVMX_GMXX_PRTX_CFG
626 cvmx_read_csr(CVMX_GMXX_RXX_JABBER
641 cvmx_wait(100000000ull);
643 for (retry_loop_cnt = 0; retry_loop_cnt < 10; retry_loop_cnt++) {
646 pkt_pcnt = (wqe_pcnt >> 7) & 0x7f;
649 num_segs = (2 + pkt_pcnt - wqe_pcnt) & 3;
668 if (g_buffer.
s.addr == 0) {
670 "buffer allocation failure.\n");
675 g_buffer.
s.size = num_segs;
680 if (pkt_buffer.
s.addr == 0) {
682 "buffer allocation failure.\n");
689 p64 = (
uint64_t *) cvmx_phys_to_ptr(pkt_buffer.
s.addr);
690 p64[0] = 0xffffffffffff0000ull;
691 p64[1] = 0x08004510ull;
692 p64[2] = ((
uint64_t) (size - 14) << 48) | 0x5ae740004000ull;
693 p64[3] = 0x3a5fc0a81073c0a8ull;
695 for (i = 0; i < num_segs; i++) {
700 if (i == (num_segs - 1))
703 *(
uint64_t *) cvmx_phys_to_ptr(g_buffer.
s.addr +
704 8 * i) = pkt_buffer.
u64;
709 pko_command.
s.segs = num_segs;
710 pko_command.
s.total_bytes =
size;
711 pko_command.
s.dontfree = 0;
712 pko_command.
s.gather = 1;
715 cvmx_read_csr(CVMX_GMXX_PRTX_CFG
719 cvmx_write_csr(CVMX_GMXX_PRTX_CFG
727 cvmx_write_csr(CVMX_GMXX_RXX_JABBER
735 cvmx_pko_get_base_queue
739 cvmx_pko_get_base_queue
748 }
while ((work ==
NULL) && (retry_cnt > 0));
752 "get_work() timeout occurred.\n");
756 cvmx_helper_free_packet_data(work);
762 cvmx_write_csr(CVMX_GMXX_PRTX_CFG
769 cvmx_write_csr(CVMX_GMXX_RXX_JABBER
788 cvmx_dprintf(
"WARNING: FIX_IPD_PTR_ALIGNMENT failed.\n");
814 for (interface = 0;
interface < num_interfaces; interface++) {
816 __cvmx_helper_packet_hardware_enable(interface);
859 l2c_cfg.
s.lrf_arb_mode = 0;
860 l2c_cfg.
s.rfb_arb_mode = 0;
864 smix_en.
u64 = cvmx_read_csr(CVMX_SMIX_EN(0));
867 cvmx_write_csr(CVMX_SMIX_EN(0), smix_en.
u64);
874 smix_en.
u64 = cvmx_read_csr(CVMX_SMIX_EN(1));
877 cvmx_write_csr(CVMX_SMIX_EN(1), smix_en.
u64);
882 for (interface = 0;
interface < num_interfaces; interface++) {
891 result |= __cvmx_helper_interface_setup_ipd(interface);
892 result |= __cvmx_helper_interface_setup_pko(interface);
895 result |= __cvmx_helper_global_setup_ipd();
896 result |= __cvmx_helper_global_setup_pko();
899 result |= __cvmx_helper_global_setup_backpressure();
901 #if CVMX_HELPER_ENABLE_IPD
929 int interface = cvmx_helper_get_interface_num(ipd_port);
938 if (link_info.
u64 == port_link_info[ipd_port].
u64)
948 return port_link_info[ipd_port];
964 int interface = cvmx_helper_get_interface_num(ipd_port);
986 result.
s.full_duplex = 1;
987 result.
s.link_up = 1;
988 result.
s.speed = 1000;
1024 int interface = cvmx_helper_get_interface_num(ipd_port);
1060 port_link_info[ipd_port].
u64 = link_info.
u64;
1078 int enable_external)
1081 int interface = cvmx_helper_get_interface_num(ipd_port);