Re: [PATCH rtems-libbsd 1/2] microblaze: Add AXI Ethernet support

2022-01-21 Thread Chris Johns
On 21/1/22 8:18 am, Alex White wrote:
> On Thu, Jan 20, 2022 at 12:30 AM Chris Johns  wrote:
>>
>> On 20/1/22 2:54 pm, Alex White wrote:
>>> From: Jennifer Averett 
>>>  rtemsbsd/rtems/rtems-kernel-vmem.c|   17 +
>>> diff --git a/rtemsbsd/rtems/rtems-kernel-vmem.c 
>>> b/rtemsbsd/rtems/rtems-kernel-vmem.c
>>> index f64fbd17..70708902 100644
>>> --- a/rtemsbsd/rtems/rtems-kernel-vmem.c
>>> +++ b/rtemsbsd/rtems/rtems-kernel-vmem.c
>>> @@ -41,6 +41,11 @@
>>>
>>>  static MALLOC_DEFINE(M_VMEM, "vmem", "VMEM buffers");
>>>
>>> +int vmem_add(vmem_t *vm, vmem_addr_t addr, vmem_size_t size, int flags)
>>> +{
>>> + return 0;
>>> +}
>>> +
>>>  int
>>>  vmem_alloc(vmem_t *vm, vmem_size_t size, int flags, vmem_addr_t *addrp)
>>>  {
>>> @@ -48,6 +53,18 @@ vmem_alloc(vmem_t *vm, vmem_size_t size, int flags, 
>>> vmem_addr_t *addrp)
>>>   return 0;
>>>  }
>>>
>>> +static int dummy_vmem;
>>> +
>>> +vmem_t *vmem_create(const char *name, vmem_addr_t base,
>>> +vmem_size_t size, vmem_size_t quantum, vmem_size_t qcache_max, int 
>>> flags)
>>> +{
>>> + return &dummy_vmem;
>>> +}
>>> +
>>> +void vmem_destroy(vmem_t *vm)
>>> +{
>>> +}
>>> +
>>>  void
>>>  vmem_free(vmem_t *vm, vmem_addr_t addr, vmem_size_t size)
>>>  {
>>
>> What is pulling this interface in?
> 
> The added vmem functions are pulled in by freebsd/sys/dev/xdma/xdma.c

So how can it be an empty stub and the XDMA driver operate? Is the allocator
being called?

>>
>> Why have they been stubbed out?
> 
> They were stubbed out to provide the minimal implementation needed to get 
> xdma working, and xdma is ultimately used by the AXI Ethernet subsystem.
> 
> The alternatives we saw were to pull in the full FreeBSD vmem implementation 
> (overkill) or modify
> freebsd/sys/dev/xdma/xdma.c to not use vmem functions.

What sort of memory does this allocator allocate? Can some heap memory be used?

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH rtems-libbsd 1/2] microblaze: Add AXI Ethernet support

2022-01-20 Thread Alex White
On Thu, Jan 20, 2022 at 12:30 AM Chris Johns  wrote:
>
> On 20/1/22 2:54 pm, Alex White wrote:
> > From: Jennifer Averett 
> >  rtemsbsd/rtems/rtems-kernel-vmem.c|   17 +
> > diff --git a/rtemsbsd/rtems/rtems-kernel-vmem.c 
> > b/rtemsbsd/rtems/rtems-kernel-vmem.c
> > index f64fbd17..70708902 100644
> > --- a/rtemsbsd/rtems/rtems-kernel-vmem.c
> > +++ b/rtemsbsd/rtems/rtems-kernel-vmem.c
> > @@ -41,6 +41,11 @@
> >
> >  static MALLOC_DEFINE(M_VMEM, "vmem", "VMEM buffers");
> >
> > +int vmem_add(vmem_t *vm, vmem_addr_t addr, vmem_size_t size, int flags)
> > +{
> > + return 0;
> > +}
> > +
> >  int
> >  vmem_alloc(vmem_t *vm, vmem_size_t size, int flags, vmem_addr_t *addrp)
> >  {
> > @@ -48,6 +53,18 @@ vmem_alloc(vmem_t *vm, vmem_size_t size, int flags, 
> > vmem_addr_t *addrp)
> >   return 0;
> >  }
> >
> > +static int dummy_vmem;
> > +
> > +vmem_t *vmem_create(const char *name, vmem_addr_t base,
> > +vmem_size_t size, vmem_size_t quantum, vmem_size_t qcache_max, int 
> > flags)
> > +{
> > + return &dummy_vmem;
> > +}
> > +
> > +void vmem_destroy(vmem_t *vm)
> > +{
> > +}
> > +
> >  void
> >  vmem_free(vmem_t *vm, vmem_addr_t addr, vmem_size_t size)
> >  {
>
> What is pulling this interface in?

The added vmem functions are pulled in by freebsd/sys/dev/xdma/xdma.c

>
> Why have they been stubbed out?

They were stubbed out to provide the minimal implementation needed to get xdma 
working, and xdma
is ultimately used by the AXI Ethernet subsystem.

The alternatives we saw were to pull in the full FreeBSD vmem implementation 
(overkill) or modify
freebsd/sys/dev/xdma/xdma.c to not use vmem functions.

Alex

>
> Chris
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH rtems-libbsd 1/2] microblaze: Add AXI Ethernet support

2022-01-19 Thread Chris Johns
On 20/1/22 2:54 pm, Alex White wrote:
> From: Jennifer Averett 
>  rtemsbsd/rtems/rtems-kernel-vmem.c|   17 +
> diff --git a/rtemsbsd/rtems/rtems-kernel-vmem.c 
> b/rtemsbsd/rtems/rtems-kernel-vmem.c
> index f64fbd17..70708902 100644
> --- a/rtemsbsd/rtems/rtems-kernel-vmem.c
> +++ b/rtemsbsd/rtems/rtems-kernel-vmem.c
> @@ -41,6 +41,11 @@
>  
>  static MALLOC_DEFINE(M_VMEM, "vmem", "VMEM buffers");
>  
> +int vmem_add(vmem_t *vm, vmem_addr_t addr, vmem_size_t size, int flags)
> +{
> + return 0;
> +}
> +
>  int
>  vmem_alloc(vmem_t *vm, vmem_size_t size, int flags, vmem_addr_t *addrp)
>  {
> @@ -48,6 +53,18 @@ vmem_alloc(vmem_t *vm, vmem_size_t size, int flags, 
> vmem_addr_t *addrp)
>   return 0;
>  }
>  
> +static int dummy_vmem;
> +
> +vmem_t *vmem_create(const char *name, vmem_addr_t base,
> +vmem_size_t size, vmem_size_t quantum, vmem_size_t qcache_max, int flags)
> +{
> + return &dummy_vmem;
> +}
> +
> +void vmem_destroy(vmem_t *vm)
> +{
> +}
> +
>  void
>  vmem_free(vmem_t *vm, vmem_addr_t addr, vmem_size_t size)
>  {

What is pulling this interface in?

Why have they been stubbed out?

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH rtems-libbsd 1/2] microblaze: Add AXI Ethernet support

2022-01-19 Thread Alex White
From: Jennifer Averett 

---
 buildset/default.ini  |1 +
 freebsd/sys/dev/mii/tiphy.h   |   57 +
 freebsd/sys/dev/xdma/xdma.c   |  501 
 freebsd/sys/dev/xdma/xdma.h   |  285 +
 freebsd/sys/dev/xdma/xdma_bank.c  |  100 ++
 freebsd/sys/dev/xdma/xdma_mbuf.c  |  151 +++
 freebsd/sys/dev/xdma/xdma_queue.c |  126 ++
 freebsd/sys/dev/xdma/xdma_sg.c|  660 ++
 freebsd/sys/dev/xdma/xdma_sglist.c|  103 ++
 freebsd/sys/dev/xilinx/axidma.c   |  666 ++
 freebsd/sys/dev/xilinx/axidma.h   |   96 ++
 freebsd/sys/dev/xilinx/if_xae.c   |  +
 freebsd/sys/dev/xilinx/if_xaereg.h|  122 ++
 freebsd/sys/dev/xilinx/if_xaevar.h|   80 ++
 .../sys/microblaze/include/machine/in_cksum.h |   82 ++
 freebsd/sys/microblaze/microblaze/in_cksum.c  |  255 
 libbsd.py |   43 +
 rtemsbsd/include/bsp/nexus-devices.h  |   10 +-
 rtemsbsd/include/rtems/bsd/local/xdma_if.h|  144 +++
 rtemsbsd/local/xdma_if.c  |   57 +
 rtemsbsd/rtems/rtems-kernel-vmem.c|   17 +
 21 files changed, 4666 insertions(+), 1 deletion(-)
 create mode 100644 freebsd/sys/dev/mii/tiphy.h
 create mode 100644 freebsd/sys/dev/xdma/xdma.c
 create mode 100644 freebsd/sys/dev/xdma/xdma.h
 create mode 100644 freebsd/sys/dev/xdma/xdma_bank.c
 create mode 100644 freebsd/sys/dev/xdma/xdma_mbuf.c
 create mode 100644 freebsd/sys/dev/xdma/xdma_queue.c
 create mode 100644 freebsd/sys/dev/xdma/xdma_sg.c
 create mode 100644 freebsd/sys/dev/xdma/xdma_sglist.c
 create mode 100644 freebsd/sys/dev/xilinx/axidma.c
 create mode 100644 freebsd/sys/dev/xilinx/axidma.h
 create mode 100644 freebsd/sys/dev/xilinx/if_xae.c
 create mode 100644 freebsd/sys/dev/xilinx/if_xaereg.h
 create mode 100644 freebsd/sys/dev/xilinx/if_xaevar.h
 create mode 100644 freebsd/sys/microblaze/include/machine/in_cksum.h
 create mode 100644 freebsd/sys/microblaze/microblaze/in_cksum.c
 create mode 100644 rtemsbsd/include/rtems/bsd/local/xdma_if.h
 create mode 100644 rtemsbsd/local/xdma_if.c

diff --git a/buildset/default.ini b/buildset/default.ini
index 454cc74e..1113c26f 100644
--- a/buildset/default.ini
+++ b/buildset/default.ini
@@ -23,6 +23,7 @@ dev_nic = on
 dev_nic_broadcomm = on
 dev_nic_dc = on
 dev_nic_e1000 = on
+dev_nic_xilinx = on
 dev_nic_fxp = on
 dev_nic_re = on
 dev_nic_smc = on
diff --git a/freebsd/sys/dev/mii/tiphy.h b/freebsd/sys/dev/mii/tiphy.h
new file mode 100644
index ..d3c35575
--- /dev/null
+++ b/freebsd/sys/dev/mii/tiphy.h
@@ -0,0 +1,57 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2019 Ruslan Bukin 
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory (Department of Computer Science and
+ * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
+ * DARPA SSITH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Texas Instruments DP83867IR/CR Robust, High Immunity
+ * 10/100/1000 Ethernet Physical Layer Transceiver.
+ */
+
+#ifndef _DEV_MII_TIPHY_H_
+#define _DEV_MII_TIPHY_H_
+
+#defineDP83867_PHYCR   0x10/* PHY Control Register 
*/
+#define PHYCR_SGMII_EN (1 << 11)
+#defineDP83867_CFG20x14/* Configuration 
Register 2 */
+#define CFG2_SPEED_OPT_10M_EN  (1 << 6) /* Speed Optimization 
*/
+#define CFG2_SPEED_OPT_ENHANCED_EN (1 << 8)
+#define CFG2_SPEED_OPT_ATTEM