type stringclasses 5
values | content stringlengths 9 163k |
|---|---|
defines | #define IOC_IBASE 0x300 /* IO TLB */ |
defines | #define IOC_IMASK 0x308 |
defines | #define IOC_PCOM 0x310 |
defines | #define IOC_TCNFG 0x318 |
defines | #define IOC_PDIR_BASE 0x320 |
defines | #define ZX1_SBA_IOMMU_COOKIE 0x0000badbadc0ffeeUL |
defines | #define SBA_SEARCH_SAMPLE 0x100 |
defines | #define sba_sg_address(sg) (page_address((sg)->page) + (sg)->offset) |
defines | #define sba_sg_address(sg) ((sg)->address ? (sg)->address : \ |
defines | #define DMA_CHUNK_SIZE (BITS_PER_LONG*iovp_size) |
defines |
#define ROUNDUP(x,y) ((x + ((y)-1)) & ~((y)-1)) |
defines | #define READ_REG(addr) __raw_readq(addr) |
defines | #define WRITE_REG(val, addr) __raw_writeq(val, addr) |
defines | #define PAGES_PER_RANGE 1 /* could increase this to 4 or 8 if needed */ |
defines | #define SBA_IOVA(ioc,iovp,offset,hint_reg) ((ioc->ibase) | (iovp) | (offset)) |
defines | #define SBA_IOVP(ioc,iova) ((iova) & ~(ioc->ibase)) |
defines |
#define PDIR_ENTRY_SIZE sizeof(u64) |
defines |
#define PDIR_INDEX(iovp) ((iovp)>>iovp_shift) |
defines |
#define RESMAP_MASK(n) ~(~0UL << (n)) |
defines | #define RESMAP_IDX_MASK (sizeof(unsigned long) - 1) |
defines |
#define SBA_DMA_HINT(ioc, val) ((val) << (ioc)->hint_shift_pdir) |
defines | #define sba_io_pdir_entry(pdir_ptr, vba) *pdir_ptr = ((vba & ~0xE000000000000FFFULL) \ |
defines | #define PIDE_FLAG 0x1UL |
defines | #define DMA_CONTIG(__X, __Y) \ |
structs | struct ioc_iommu {
u32 func_id;
char *name;
initfunc *init;
}; |
functions | void
sba_dump_tlb(char *hpa)
{
DBG_INIT("IO TLB at 0x%p\n", (void *)hpa);
DBG_INIT("IOC_IBASE : %016lx\n", READ_REG(hpa+IOC_IBASE));
DBG_INIT("IOC_IMASK : %016lx\n", READ_REG(hpa+IOC_IMASK));
DBG_INIT("IOC_TCNFG : %016lx\n", READ_REG(hpa+IOC_TCNFG));
DBG_INIT("IOC_PDIR_BASE: %016lx\n", READ_REG(hpa+IOC_PD... |
functions | void
sba_dump_pdir_entry(struct ioc *ioc, char *msg, uint pide)
{
/* start printing from lowest pde in rval */
u64 *ptr = &ioc->pdir_base[pide & ~(BITS_PER_LONG - 1)];
unsigned long *rptr = (unsigned long *) &ioc->res_map[(pide >>3) & -sizeof(unsigned long)];
uint rcnt;
printk(KERN_DEBUG "SBA: %s rp %p bit %d rv... |
functions | int
sba_check_pdir(struct ioc *ioc, char *msg)
{
u64 *rptr_end = (u64 *) &(ioc->res_map[ioc->res_size]);
u64 *rptr = (u64 *) ioc->res_map; /* resource map ptr */
u64 *pptr = ioc->pdir_base; /* pdir ptr */
uint pide = 0;
while (rptr < rptr_end) {
u64 rval;
int rcnt; /* number of bits we might check */
rval ... |
functions | void
sba_dump_sg( struct ioc *ioc, struct scatterlist *startsg, int nents)
{
while (nents-- > 0) {
printk(KERN_DEBUG " %d : DMA %08lx/%05x CPU %p\n", nents,
startsg->dma_address, startsg->dma_length,
sba_sg_address(startsg));
startsg++;
} |
functions | void
sba_check_sg( struct ioc *ioc, struct scatterlist *startsg, int nents)
{
struct scatterlist *the_sg = startsg;
int the_nents = nents;
while (the_nents-- > 0) {
if (sba_sg_address(the_sg) == 0x0UL)
sba_dump_sg(NULL, startsg, nents);
the_sg++;
} |
functions | int
get_iovp_order (unsigned long size)
{
long double d = size - 1;
long order;
__asm__ ("getf.exp %0=%1" : "=r"(order) : "f"(d));
order = order - iovp_shift - 0xffff + 1;
if (order < 0)
order = 0;
return order;
} |
functions | long
sba_search_bitmap(struct ioc *ioc, unsigned long bits_wanted)
{
unsigned long *res_ptr = ioc->res_hint;
unsigned long *res_end = (unsigned long *) &(ioc->res_map[ioc->res_size]);
unsigned long pide = ~0UL;
ASSERT(((unsigned long) ioc->res_hint & (sizeof(unsigned long) - 1UL)) == 0);
ASSERT(res_ptr < res_end)... |
functions | int
sba_alloc_range(struct ioc *ioc, size_t size)
{
unsigned int pages_needed = size >> iovp_shift;
#ifdef PDIR_SEARCH_TIMING
unsigned long itc_start = ia64_get_itc();
#endif
unsigned long pide;
ASSERT(pages_needed);
ASSERT(pages_needed <= BITS_PER_LONG);
ASSERT(0 == (size & ~iovp_mask));
/*
** "seek and ye s... |
functions | void
sba_free_range(struct ioc *ioc, dma_addr_t iova, size_t size)
{
unsigned long iovp = SBA_IOVP(ioc, iova);
unsigned int pide = PDIR_INDEX(iovp);
unsigned int ridx = pide >> 3; /* convert bit to byte address */
unsigned long *res_ptr = (unsigned long *) &((ioc)->res_map[ridx & ~RESMAP_IDX_MASK]);
int bits_not_... |
functions | SBA_INLINE
sba_io_pdir_entry(u64 *pdir_ptr, unsigned long vba)
{
*pdir_ptr = ((vba & ~0xE000000000000FFFULL) | 0x80000000000000FFULL);
} |
functions | void
mark_clean (void *addr, size_t size)
{
unsigned long pg_addr, end;
pg_addr = PAGE_ALIGN((unsigned long) addr);
end = (unsigned long) addr + size;
while (pg_addr + PAGE_SIZE <= end) {
struct page *page = virt_to_page((void *)pg_addr);
set_bit(PG_arch_1, &page->flags);
pg_addr += PAGE_SIZE;
} |
functions | void
sba_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)
{
u32 iovp = (u32) SBA_IOVP(ioc,iova);
int off = PDIR_INDEX(iovp);
/* Must be non-zero and rounded up */
ASSERT(byte_cnt > 0);
ASSERT(0 == (byte_cnt & ~iovp_mask));
#ifdef ASSERT_PDIR_SANITY
/* Assert first pdir entry is set */
if (!(ioc... |
functions | endif
if (byte_cnt <= iovp_size)
{
ASSERT(off < ioc->pdir_size);
iovp |= iovp_shift; /* set "size" field for PCOM */
#ifndef FULL_VALID_PDIR
/*
** clear I/O PDIR entry "valid" bit
** Do NOT clear the rest - save it for debugging.
** We should only clear bits that have previously
** been enabled.
... |
functions | dma_addr_t
sba_map_single(struct pci_dev *dev, void *addr, size_t size, int dir)
{
struct ioc *ioc;
unsigned long flags;
dma_addr_t iovp;
dma_addr_t offset;
u64 *pdir_start;
int pide;
#ifdef ALLOW_IOV_BYPASS
unsigned long pci_addr = virt_to_phys(addr);
#endif
ioc = GET_IOC(dev);
ASSERT(ioc);
#ifdef ALLOW_IOV... |
functions | void sba_unmap_single(struct pci_dev *dev, dma_addr_t iova, size_t size, int dir)
{
struct ioc *ioc;
#if DELAYED_RESOURCE_CNT > 0
struct sba_dma_pair *d;
#endif
unsigned long flags;
dma_addr_t offset;
ioc = GET_IOC(dev);
ASSERT(ioc);
#ifdef ALLOW_IOV_BYPASS
if ((iova & ioc->imask) != ioc->ibase) {
/*
** Ad... |
functions | ENABLE_MARK_CLEAN
if (dir == PCI_DMA_FROMDEVICE) {
u32 iovp = (u32) SBA_IOVP(ioc,iova);
int off = PDIR_INDEX(iovp);
void *addr;
if (size <= iovp_size) {
addr = phys_to_virt(ioc->pdir_base[off] &
~0xE000000000000FFFULL);
mark_clean(addr, size);
} |
functions | void sba_free_coherent (struct pci_dev *dev, size_t size, void *vaddr, dma_addr_t dma_handle)
{
sba_unmap_single(dev, dma_handle, size, 0);
free_pages((unsigned long) vaddr, get_order(size));
} |
functions | int
sba_fill_pdir(
struct ioc *ioc,
struct scatterlist *startsg,
int nents)
{
struct scatterlist *dma_sg = startsg; /* pointer to current DMA */
int n_mappings = 0;
u64 *pdirp = 0;
unsigned long dma_offset = 0;
dma_sg--;
while (nents-- > 0) {
int cnt = startsg->dma_length;
startsg->dma_length = 0;
#i... |
functions | int
sba_coalesce_chunks( struct ioc *ioc,
struct scatterlist *startsg,
int nents)
{
struct scatterlist *vcontig_sg; /* VCONTIG chunk head */
unsigned long vcontig_len; /* len of VCONTIG chunk */
unsigned long vcontig_end;
struct scatterlist *dma_sg; /* next DMA stream head */
unsigned long dma_... |
functions | int sba_map_sg(struct pci_dev *dev, struct scatterlist *sglist, int nents, int dir)
{
struct ioc *ioc;
int coalesced, filled = 0;
unsigned long flags;
#ifdef ALLOW_IOV_BYPASS
struct scatterlist *sg;
#endif
DBG_RUN_SG("%s() START %d entries\n", __FUNCTION__, nents);
ioc = GET_IOC(dev);
ASSERT(ioc);
#ifdef ALLOW... |
functions | void sba_unmap_sg (struct pci_dev *dev, struct scatterlist *sglist, int nents, int dir)
{
struct ioc *ioc;
#ifdef ASSERT_PDIR_SANITY
unsigned long flags;
#endif
DBG_RUN_SG("%s() START %d entries, %p,%x\n",
__FUNCTION__, nents, sba_sg_address(sglist), sglist->length);
ioc = GET_IOC(dev);
ASSERT(ioc);
#ifdef A... |
functions | __init
ioc_iova_init(struct ioc *ioc)
{
int tcnfg;
int agp_found = 0;
struct pci_dev *device = NULL;
#ifdef FULL_VALID_PDIR
unsigned long index;
#endif
/*
** Firmware programs the base and size of a "safe IOVA space"
** (one that doesn't overlap memory or LMMIO space) in the
** IBASE and IMASK registers.
*/
... |
functions | __init
ioc_resource_init(struct ioc *ioc)
{
spin_lock_init(&ioc->res_lock);
/* resource map size dictated by pdir_size */
ioc->res_size = ioc->pdir_size / PDIR_ENTRY_SIZE; /* entries */
ioc->res_size >>= 3; /* convert bit count to byte count */
DBG_INIT("%s() res_size 0x%x\n", __FUNCTION__, ioc->res_size);
ioc... |
functions | __init
ioc_sac_init(struct ioc *ioc)
{
struct pci_dev *sac = NULL;
struct pci_controller *controller = NULL;
/*
* pci_alloc_coherent() must return a DMA address which is
* SAC (single address cycle) addressable, so allocate a
* pseudo-device to enforce that.
*/
sac = kmalloc(sizeof(*sac), GFP_KERNEL);
if ... |
functions | __init
ioc_zx1_init(struct ioc *ioc)
{
if (ioc->rev < 0x20)
panic(PFX "IOC 2.0 or later required for IOMMU support\n");
ioc->dma_mask = 0xFFFFFFFFFFUL;
if (!iovp_shift) {
/* 64k is max iommu page size */
iovp_shift = min(PAGE_SHIFT, 16);
iovp_size = (1 << iovp_shift);
iovp_mask = ~(iovp_size - 1);
} |
functions | __init
ioc_sx1000_init(struct ioc *ioc)
{
if (!iovp_shift) {
iovp_shift = 12; /* 4K for now */
iovp_size = (1 << iovp_shift);
iovp_mask = ~(iovp_size - 1);
} |
functions | __init
ioc_init(u64 hpa, void *handle)
{
struct ioc *ioc;
struct ioc_iommu *info;
ioc = kmalloc(sizeof(*ioc), GFP_KERNEL);
if (!ioc)
return NULL;
memset(ioc, 0, sizeof(*ioc));
ioc->next = ioc_list;
ioc_list = ioc;
ioc->handle = handle;
ioc->ioc_hpa = ioremap(hpa, 0x1000);
ioc->func_id = READ_REG(ioc->i... |
functions | void
ioc_stop(struct seq_file *s, void *v)
{
} |
functions | int
ioc_show(struct seq_file *s, void *v)
{
struct ioc *ioc = v;
unsigned long *res_ptr = (unsigned long *)ioc->res_map;
int i, used = 0;
seq_printf(s, "Hewlett Packard %s IOC rev %d.%d\n",
ioc->name, ((ioc->rev >> 4) & 0xF), (ioc->rev & 0xF));
seq_printf(s, "IOVA size : %d MB\n", ioc->iov_size/(1024*1024... |
functions | int
ioc_open(struct inode *inode, struct file *file)
{
return seq_open(file, &ioc_seq_ops);
} |
functions | __init
ioc_proc_init(void)
{
struct proc_dir_entry *dir, *entry;
dir = proc_mkdir("bus/mckinley", 0);
if (!dir)
return;
entry = create_proc_entry(ioc_list->name, 0, dir);
if (entry)
entry->proc_fops = &ioc_fops;
} |
functions | void
sba_connect_bus(struct pci_bus *bus)
{
acpi_handle handle, parent;
acpi_status status;
struct ioc *ioc;
if (!PCI_CONTROLLER(bus))
panic(PFX "no sysdata on bus %d!\n", bus->number);
if (PCI_CONTROLLER(bus)->iommu)
return;
handle = PCI_CONTROLLER(bus)->acpi_handle;
if (!handle)
return;
/*
* The I... |
functions | __init
acpi_sba_ioc_add(struct acpi_device *device)
{
struct ioc *ioc;
acpi_status status;
u64 hpa, length;
struct acpi_buffer buffer;
struct acpi_device_info *dev_info;
status = acpi_hp_csr_space(device->handle, &hpa, &length);
if (ACPI_FAILURE(status))
return 1;
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;... |
functions | __init
sba_init(void)
{
acpi_bus_register_driver(&acpi_sba_ioc_driver);
if (!ioc_list)
return;
#ifdef CONFIG_PCI
{
struct pci_bus *b = NULL;
pci_for_each_bus(b)
sba_connect_bus(b);
} |
functions | __init
nosbagart(char *str)
{
reserve_sba_gart = 0;
return 1;
} |
functions | int
sba_dma_supported (struct pci_dev *dev, u64 mask)
{
/* make sure it's at least 32bit capable */
return ((mask & 0xFFFFFFFFUL) == 0xFFFFFFFFUL);
} |
functions | __init
sba_page_override(char *str)
{
unsigned long page_size;
page_size = memparse(str, &str);
switch (page_size) {
case 4096:
case 8192:
case 16384:
case 65536:
iovp_shift = ffs(page_size) - 1;
break;
default:
printk("%s: unknown/unsupported iommu page size %ld\n",
__FUNCTION__, page_... |
includes |
#include <stdio.h> |
includes | #include <stdlib.h> |
includes | #include <string.h> |
defines |
#define SHA256_DIGEST_SIZE 32 |
functions | int
collect_crypto_bytes (const char * in_file, const char * section_name, unsigned long offset,
unsigned long size, const char * out_file)
{
FILE * in_fp = NULL;
FILE * out_fp = NULL;
unsigned int i = 0;
unsigned char data = 0;
if (!in_file || !section_name || !offset || !size || !ou... |
functions | int
update_crypto_hmac (const char * vmlinux_path, const char * hmac_path, unsigned long offset)
{
FILE * vmlinux_fp = NULL;
FILE * hmac_fp = NULL;
int i = 0, j = 0;
unsigned char hmac[SHA256_DIGEST_SIZE];
if (!vmlinux_path || !hmac_path || !offset)
{
printf ("FIPS update_crypto_hmac : Invalid Params");
retu... |
main | int main (int argc, char **argv)
{
if (argc < 2)
{
printf ("\nUsage : \n");
printf ("fips_crypto_utils -u vmlinux_file hmac_file offset");
printf ("fips_crypto_utils -g vmlinux_file section_name offset size out_file");
printf ("\n");
return -1;
} |
includes |
#include <stdio.h> |
includes | #include <winsock2.h> |
includes | #include <Ws2tcpip.h> |
includes | #include <Wspiapi.h> |
includes | #include <stdlib.h> |
structs | struct w32polldata {
HANDLE setme;
HANDLE event;
HANDLE waiter;
struct pollfd *polldata;
}; |
functions | void wsock2errno() {
switch(WSAGetLastError()) {
case WSA_INVALID_HANDLE:
case WSA_INVALID_PARAMETER:
case WSAVERNOTSUPPORTED:
case WSANOTINITIALISED:
case WSAEINVALIDPROCTABLE:
case WSAEINVALIDPROVIDER:
case WSAEPROVIDERFAILEDINIT:
case WSASYSCALLFAILURE:
case WSASERVICE_NOT_FOUND:
case WSATYPE_NOT_... |
functions | int w32_socket(int domain, int type, int protocol) {
SOCKET s = socket(domain, type, protocol);
if(s == INVALID_SOCKET) {
wsock2errno();
return -1;
} |
functions | int w32_getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen) {
if(getsockopt((SOCKET)sockfd, level, optname, (char *)optval, optlen) == SOCKET_ERROR) {
wsock2errno();
return -1;
} |
functions | int w32_setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen) {
if(setsockopt((SOCKET)sockfd, level, optname, (const char*)optval, optlen) == SOCKET_ERROR) {
wsock2errno();
return -1;
} |
functions | int w32_bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen) {
if(bind((SOCKET)sockfd, addr, addrlen) == SOCKET_ERROR) {
wsock2errno();
return -1;
} |
functions | int w32_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) {
if(connect((SOCKET)sockfd, addr, addrlen)) {
wsock2errno();
return -1;
} |
functions | ssize_t w32_send(int sockfd, const void *buf, size_t len, int flags) {
int ret = send((SOCKET)sockfd, (const char *)buf, (int)len, flags);
if(ret == SOCKET_ERROR) {
wsock2errno();
return -1;
} |
functions | ssize_t w32_recv(int sockfd, void *buf, size_t len, int flags) {
int ret = recv((SOCKET)sockfd, (char *)buf, len, flags);
if(ret == SOCKET_ERROR) {
wsock2errno();
return -1;
} |
functions | int w32_getpeername(int s, struct sockaddr *name, int *namelen)
{
int ret = getpeername((SOCKET)s, name, namelen);
if (ret == SOCKET_ERROR) {
wsock2errno();
return -1;
} |
functions | int w32_closesocket(int sockfd) {
if(closesocket((SOCKET)sockfd) == SOCKET_ERROR) {
wsock2errno();
return -1;
} |
functions | int w32_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res) {
int ret = getaddrinfo(node, service, hints, res);
if(ret) wsock2errno();
return ret;
} |
functions | void w32_freeaddrinfo(struct addrinfo *res) {
freeaddrinfo(res);
} |
functions | int w32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) {
int ret = select(nfds, readfds, writefds, exceptfds, timeout);
if(ret == SOCKET_ERROR) {
wsock2errno();
return -1;
} |
functions | int w32_accept(SOCKET sockfd, const struct sockaddr *addr, socklen_t *addrlen) {
if((sockfd = accept(sockfd, addr, addrlen)) == INVALID_SOCKET) {
wsock2errno();
return -1;
} |
functions | int w32_listen(int sockfd, int backlog) {
if(listen((SOCKET)sockfd, backlog)) {
wsock2errno();
return -1;
} |
functions | int w32_shutdown(int sockfd, int how) {
if(shutdown((SOCKET)sockfd, how)) {
wsock2errno();
return -1;
} |
functions | CALLBACK poll_cb(PVOID param, BOOLEAN timedout) {
WSANETWORKEVENTS evt;
struct w32polldata *item = (struct w32polldata *)param;
if(!timedout) {
unsigned int i;
WSAEnumNetworkEvents(item->polldata->fd, item->event, &evt);
if(evt.lNetworkEvents & FD_ACCEPT) {
item->polldata->revents |= POLLIN;
if... |
functions | int poll_with_event(struct pollfd *fds, int nfds, int timeout, HANDLE event) {
HANDLE *setme, cankill;
struct w32polldata *items;
unsigned int i, ret = 0, reallywait = 1;
if(timeout <0) timeout = INFINITE;
if(!nfds) {
if(event) {
if(WaitForSingleObject(event, timeout) == WAIT_OBJECT_0)
retu... |
functions | int fcntl(int fd, int cmd, ...) {
va_list ap;
va_start(ap, cmd);
if(cmd == F_GETFL)
return 0;
if(cmd == F_SETFL) {
u_long arg = va_arg(ap, long) == O_NONBLOCK;
if(ioctlsocket((SOCKET)fd, FIONBIO, &arg)) {
wsock2errno();
return -1;
} |
includes |
#include <linux/device.h> |
includes | #include <linux/mutex.h> |
includes | #include <linux/pm_wakeup.h> |
includes | #include <linux/wakelock.h> |
includes | #include <linux/powersuspend.h> |
defines | #define SBO_SLEEP_MSEC 1100 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.