Skip to content
Snippets Groups Projects
Select Git revision
  • 256e4be81489b1824328c58af54c39506db7c7a5
  • master default protected
  • early-display
  • variant-emmc-nvme-boot
  • 2023-01-25
  • v3
  • variant-emmc-nvme-boot
  • 2020-06-01
8 results

universe.h

Blame
  • Forked from Reform / reform-boundary-uboot
    Source project has a limited visibility.
    fsl_dpaa_fd.h 3.55 KiB
    /*
     * Copyright (C) 2014 Freescale Semiconductor
     *
     * SPDX-License-Identifier:	GPL-2.0+
     */
    #ifndef __FSL_DPAA_FD_H
    #define __FSL_DPAA_FD_H
    
    /* Place-holder for FDs, we represent it via the simplest form that we need for
     * now. Different overlays may be needed to support different options, etc. (It
     * is impractical to define One True Struct, because the resulting encoding
     * routines (lots of read-modify-writes) would be worst-case performance whether
     * or not circumstances required them.) */
    struct dpaa_fd {
    	union {
    		u32 words[8];
    		struct dpaa_fd_simple {
    			u32 addr_lo;
    			u32 addr_hi;
    			u32 len;
    			/* offset in the MS 16 bits, BPID in the LS 16 bits */
    			u32 bpid_offset;
    			u32 frc; /* frame context */
    			/* "err", "va", "cbmt", "asal", [...] */
    			u32 ctrl;
    			/* flow context */
    			u32 flc_lo;
    			u32 flc_hi;
    		} simple;
    	};
    };
    
    enum dpaa_fd_format {
    	dpaa_fd_single = 0,
    	dpaa_fd_list,
    	dpaa_fd_sg
    };
    
    static inline u64 ldpaa_fd_get_addr(const struct dpaa_fd *fd)
    {
    	return (u64)((((uint64_t)fd->simple.addr_hi) << 32)
    				+ fd->simple.addr_lo);
    }
    
    static inline void ldpaa_fd_set_addr(struct dpaa_fd *fd, u64 addr)
    {
    	fd->simple.addr_hi = upper_32_bits(addr);
    	fd->simple.addr_lo = lower_32_bits(addr);
    }
    
    static inline u32 ldpaa_fd_get_len(const struct dpaa_fd *fd)
    {
    	return fd->simple.len;
    }
    
    static inline void ldpaa_fd_set_len(struct dpaa_fd *fd, u32 len)
    {
    	fd->simple.len = len;
    }
    
    static inline uint16_t ldpaa_fd_get_offset(const struct dpaa_fd *fd)
    {
    	return (uint16_t)(fd->simple.bpid_offset >> 16) & 0x0FFF;
    }
    
    static inline void ldpaa_fd_set_offset(struct dpaa_fd *fd, uint16_t offset)
    {
    	fd->simple.bpid_offset &= 0xF000FFFF;
    	fd->simple.bpid_offset |= (u32)offset << 16;
    }