text
stringlengths
4
6.14k
/* * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. * All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __XFS_RTALLOC_H__ #define __XFS_RTALLOC_H__ /* kernel only definitions and functions */ struct xfs_mount; struct xfs_trans; struct xfs_rtalloc_rec { xfs_rtblock_t ar_startblock; xfs_rtblock_t ar_blockcount; }; typedef int (*xfs_rtalloc_query_range_fn)( struct xfs_trans *tp, struct xfs_rtalloc_rec *rec, void *priv); #ifdef CONFIG_XFS_RT /* * Function prototypes for exported functions. */ /* * Allocate an extent in the realtime subvolume, with the usual allocation * parameters. The length units are all in realtime extents, as is the * result block number. */ int /* error */ xfs_rtallocate_extent( struct xfs_trans *tp, /* transaction pointer */ xfs_rtblock_t bno, /* starting block number to allocate */ xfs_extlen_t minlen, /* minimum length to allocate */ xfs_extlen_t maxlen, /* maximum length to allocate */ xfs_extlen_t *len, /* out: actual length allocated */ int wasdel, /* was a delayed allocation extent */ xfs_extlen_t prod, /* extent product factor */ xfs_rtblock_t *rtblock); /* out: start block allocated */ /* * Free an extent in the realtime subvolume. Length is expressed in * realtime extents, as is the block number. */ int /* error */ xfs_rtfree_extent( struct xfs_trans *tp, /* transaction pointer */ xfs_rtblock_t bno, /* starting block number to free */ xfs_extlen_t len); /* length of extent freed */ /* * Initialize realtime fields in the mount structure. */ int /* error */ xfs_rtmount_init( struct xfs_mount *mp); /* file system mount structure */ void xfs_rtunmount_inodes( struct xfs_mount *mp); /* * Get the bitmap and summary inodes into the mount structure * at mount time. */ int /* error */ xfs_rtmount_inodes( struct xfs_mount *mp); /* file system mount structure */ /* * Pick an extent for allocation at the start of a new realtime file. * Use the sequence number stored in the atime field of the bitmap inode. * Translate this to a fraction of the rtextents, and return the product * of rtextents and the fraction. * The fraction sequence is 0, 1/2, 1/4, 3/4, 1/8, ..., 7/8, 1/16, ... */ int /* error */ xfs_rtpick_extent( struct xfs_mount *mp, /* file system mount point */ struct xfs_trans *tp, /* transaction pointer */ xfs_extlen_t len, /* allocation length (rtextents) */ xfs_rtblock_t *pick); /* result rt extent */ /* * Grow the realtime area of the filesystem. */ int xfs_growfs_rt( struct xfs_mount *mp, /* file system mount structure */ xfs_growfs_rt_t *in); /* user supplied growfs struct */ /* * From xfs_rtbitmap.c */ int xfs_rtbuf_get(struct xfs_mount *mp, struct xfs_trans *tp, xfs_rtblock_t block, int issum, struct xfs_buf **bpp); int xfs_rtcheck_range(struct xfs_mount *mp, struct xfs_trans *tp, xfs_rtblock_t start, xfs_extlen_t len, int val, xfs_rtblock_t *new, int *stat); int xfs_rtfind_back(struct xfs_mount *mp, struct xfs_trans *tp, xfs_rtblock_t start, xfs_rtblock_t limit, xfs_rtblock_t *rtblock); int xfs_rtfind_forw(struct xfs_mount *mp, struct xfs_trans *tp, xfs_rtblock_t start, xfs_rtblock_t limit, xfs_rtblock_t *rtblock); int xfs_rtmodify_range(struct xfs_mount *mp, struct xfs_trans *tp, xfs_rtblock_t start, xfs_extlen_t len, int val); int xfs_rtmodify_summary_int(struct xfs_mount *mp, struct xfs_trans *tp, int log, xfs_rtblock_t bbno, int delta, xfs_buf_t **rbpp, xfs_fsblock_t *rsb, xfs_suminfo_t *sum); int xfs_rtmodify_summary(struct xfs_mount *mp, struct xfs_trans *tp, int log, xfs_rtblock_t bbno, int delta, xfs_buf_t **rbpp, xfs_fsblock_t *rsb); int xfs_rtfree_range(struct xfs_mount *mp, struct xfs_trans *tp, xfs_rtblock_t start, xfs_extlen_t len, struct xfs_buf **rbpp, xfs_fsblock_t *rsb); int xfs_rtalloc_query_range(struct xfs_trans *tp, struct xfs_rtalloc_rec *low_rec, struct xfs_rtalloc_rec *high_rec, xfs_rtalloc_query_range_fn fn, void *priv); int xfs_rtalloc_query_all(struct xfs_trans *tp, xfs_rtalloc_query_range_fn fn, void *priv); bool xfs_verify_rtbno(struct xfs_mount *mp, xfs_rtblock_t rtbno); int xfs_rtalloc_extent_is_free(struct xfs_mount *mp, struct xfs_trans *tp, xfs_rtblock_t start, xfs_extlen_t len, bool *is_free); #else # define xfs_rtallocate_extent(t,b,min,max,l,f,p,rb) (ENOSYS) # define xfs_rtfree_extent(t,b,l) (ENOSYS) # define xfs_rtpick_extent(m,t,l,rb) (ENOSYS) # define xfs_growfs_rt(mp,in) (ENOSYS) # define xfs_rtalloc_query_range(t,l,h,f,p) (ENOSYS) # define xfs_rtalloc_query_all(t,f,p) (ENOSYS) # define xfs_rtbuf_get(m,t,b,i,p) (ENOSYS) # define xfs_verify_rtbno(m, r) (false) # define xfs_rtalloc_extent_is_free(m,t,s,l,i) (ENOSYS) static inline int /* error */ xfs_rtmount_init( xfs_mount_t *mp) /* file system mount structure */ { if (mp->m_sb.sb_rblocks == 0) return 0; xfs_warn(mp, "Not built with CONFIG_XFS_RT"); return -ENOSYS; } # define xfs_rtmount_inodes(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS)) # define xfs_rtunmount_inodes(m) #endif /* CONFIG_XFS_RT */ #endif /* __XFS_RTALLOC_H__ */
#include "ceph_debug.h" #include <linux/slab.h> #include "buffer.h" #include "decode.h" struct ceph_buffer *ceph_buffer_new(size_t len, gfp_t gfp) { struct ceph_buffer *b; b = kmalloc(sizeof(*b), gfp); if (!b) return NULL; b->vec.iov_base = kmalloc(len, gfp | __GFP_NOWARN); if (b->vec.iov_base) { b->is_vmalloc = false; } else { b->vec.iov_base = __vmalloc(len, gfp, PAGE_KERNEL); if (!b->vec.iov_base) { kfree(b); return NULL; } b->is_vmalloc = true; } kref_init(&b->kref); b->alloc_len = len; b->vec.iov_len = len; dout("buffer_new %p\n", b); return b; } void ceph_buffer_release(struct kref *kref) { struct ceph_buffer *b = container_of(kref, struct ceph_buffer, kref); dout("buffer_release %p\n", b); if (b->vec.iov_base) { if (b->is_vmalloc) vfree(b->vec.iov_base); else kfree(b->vec.iov_base); } kfree(b); } int ceph_buffer_alloc(struct ceph_buffer *b, int len, gfp_t gfp) { b->vec.iov_base = kmalloc(len, gfp | __GFP_NOWARN); if (b->vec.iov_base) { b->is_vmalloc = false; } else { b->vec.iov_base = __vmalloc(len, gfp, PAGE_KERNEL); b->is_vmalloc = true; } if (!b->vec.iov_base) return -ENOMEM; b->alloc_len = len; b->vec.iov_len = len; return 0; } int ceph_decode_buffer(struct ceph_buffer **b, void **p, void *end) { size_t len; ceph_decode_need(p, end, sizeof(u32), bad); len = ceph_decode_32(p); dout("decode_buffer len %d\n", (int)len); ceph_decode_need(p, end, len, bad); *b = ceph_buffer_new(len, GFP_NOFS); if (!*b) return -ENOMEM; ceph_decode_copy(p, (*b)->vec.iov_base, len); return 0; bad: return -EINVAL; }
//===-- ubsan_init.h --------------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // Initialization function for UBSan runtime. // //===----------------------------------------------------------------------===// #ifndef UBSAN_INIT_H #define UBSAN_INIT_H namespace __ubsan { // Get the full tool name for UBSan. const char *GetSanititizerToolName(); // Initialize UBSan as a standalone tool. Typically should be called early // during initialization. void InitAsStandalone(); // Initialize UBSan as a standalone tool, if it hasn't been initialized before. void InitAsStandaloneIfNecessary(); // Initializes UBSan as a plugin tool. This function should be called once // from "parent tool" (e.g. ASan) initialization. void InitAsPlugin(); } // namespace __ubsan #endif // UBSAN_INIT_H
/* * intc.c -- support for the old ColdFire interrupt controller * * (C) Copyright 2009, Greg Ungerer <gerg@snapgear.com> * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive * for more details. */ #include <linux/types.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/io.h> #include <asm/traps.h> #include <asm/coldfire.h> #include <asm/mcfsim.h> /* * The mapping of irq number to a mask register bit is not one-to-one. * The irq numbers are either based on "level" of interrupt or fixed * for an autovector-able interrupt. So we keep a local data structure * that maps from irq to mask register. Not all interrupts will have * an IMR bit. */ unsigned char mcf_irq2imr[NR_IRQS]; /* * Define the miniumun and maximum external interrupt numbers. * This is also used as the "level" interrupt numbers. */ #define EIRQ1 25 #define EIRQ7 31 /* * In the early version 2 core ColdFire parts the IMR register was 16 bits * in size. Version 3 (and later version 2) core parts have a 32 bit * sized IMR register. Provide some size independant methods to access the * IMR register. */ #ifdef MCFSIM_IMR_IS_16BITS void mcf_setimr(int index) { u16 imr; imr = __raw_readw(MCF_MBAR + MCFSIM_IMR); __raw_writew(imr | (0x1 << index), MCF_MBAR + MCFSIM_IMR); } void mcf_clrimr(int index) { u16 imr; imr = __raw_readw(MCF_MBAR + MCFSIM_IMR); __raw_writew(imr & ~(0x1 << index), MCF_MBAR + MCFSIM_IMR); } void mcf_maskimr(unsigned int mask) { u16 imr; imr = __raw_readw(MCF_MBAR + MCFSIM_IMR); imr |= mask; __raw_writew(imr, MCF_MBAR + MCFSIM_IMR); } #else void mcf_setimr(int index) { u32 imr; imr = __raw_readl(MCF_MBAR + MCFSIM_IMR); __raw_writel(imr | (0x1 << index), MCF_MBAR + MCFSIM_IMR); } void mcf_clrimr(int index) { u32 imr; imr = __raw_readl(MCF_MBAR + MCFSIM_IMR); __raw_writel(imr & ~(0x1 << index), MCF_MBAR + MCFSIM_IMR); } void mcf_maskimr(unsigned int mask) { u32 imr; imr = __raw_readl(MCF_MBAR + MCFSIM_IMR); imr |= mask; __raw_writel(imr, MCF_MBAR + MCFSIM_IMR); } #endif /* * Interrupts can be "vectored" on the ColdFire cores that support this old * interrupt controller. That is, the device raising the interrupt can also * supply the vector number to interrupt through. The AVR register of the * interrupt controller enables or disables this for each external interrupt, * so provide generic support for this. Setting this up is out-of-band for * the interrupt system API's, and needs to be done by the driver that * supports this device. Very few devices actually use this. */ void mcf_autovector(int irq) { #ifdef MCFSIM_AVR if ((irq >= EIRQ1) && (irq <= EIRQ7)) { u8 avec; avec = __raw_readb(MCF_MBAR + MCFSIM_AVR); avec |= (0x1 << (irq - EIRQ1 + 1)); __raw_writeb(avec, MCF_MBAR + MCFSIM_AVR); } #endif } static void intc_irq_mask(unsigned int irq) { if (mcf_irq2imr[irq]) mcf_setimr(mcf_irq2imr[irq]); } static void intc_irq_unmask(unsigned int irq) { if (mcf_irq2imr[irq]) mcf_clrimr(mcf_irq2imr[irq]); } static int intc_irq_set_type(unsigned int irq, unsigned int type) { return 0; } static struct irq_chip intc_irq_chip = { .name = "CF-INTC", .mask = intc_irq_mask, .unmask = intc_irq_unmask, .set_type = intc_irq_set_type, }; void __init init_IRQ(void) { int irq; init_vectors(); mcf_maskimr(0xffffffff); for (irq = 0; (irq < NR_IRQS); irq++) { irq_desc[irq].status = IRQ_DISABLED; irq_desc[irq].action = NULL; irq_desc[irq].depth = 1; irq_desc[irq].chip = &intc_irq_chip; intc_irq_set_type(irq, 0); } }
/** * @file * Application layered TCP connection API that executes a proxy-connect. * * This file provides a starting layer that executes a proxy-connect e.g. to * set up TLS connections through a http proxy. */ /* * Copyright (c) 2018 Simon Goldschmidt * All rights reserved. * * 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. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. * * This file is part of the lwIP TCP/IP stack. * * Author: Simon Goldschmidt <goldsimon@gmx.de> * */ #ifndef LWIP_HDR_APPS_ALTCP_PROXYCONNECT_H #define LWIP_HDR_APPS_ALTCP_PROXYCONNECT_H #include "lwip/opt.h" #if LWIP_ALTCP /* don't build if not configured for use in lwipopts.h */ #include "lwip/ip_addr.h" #ifdef __cplusplus extern "C" { #endif struct altcp_proxyconnect_config { ip_addr_t proxy_addr; u16_t proxy_port; }; struct altcp_pcb *altcp_proxyconnect_new(struct altcp_proxyconnect_config *config, struct altcp_pcb *inner_pcb); struct altcp_pcb *altcp_proxyconnect_new_tcp(struct altcp_proxyconnect_config *config, u8_t ip_type); struct altcp_pcb *altcp_proxyconnect_alloc(void *arg, u8_t ip_type); #if LWIP_ALTCP_TLS struct altcp_proxyconnect_tls_config { struct altcp_proxyconnect_config proxy; struct altcp_tls_config *tls_config; }; struct altcp_pcb *altcp_proxyconnect_tls_alloc(void *arg, u8_t ip_type); #endif /* LWIP_ALTCP_TLS */ #ifdef __cplusplus } #endif #endif /* LWIP_ALTCP */ #endif /* LWIP_HDR_APPS_ALTCP_PROXYCONNECT_H */
#include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { LAYOUT( KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_0 ), LAYOUT( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), LAYOUT( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), LAYOUT( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), LAYOUT( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), LAYOUT( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), LAYOUT( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), LAYOUT( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), LAYOUT( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), LAYOUT( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ) };
/* packet-wps.h * * Wifi Simple Config aka Wifi Protected Setup * * Written by Jens Braeuer using WiFi-Alliance Spec 1.0h and * parts of a patch by JP Jiang and Philippe Teuwen. November 2007 * * Spec: * https://www.wi-fi.org/knowledge_center_overview.php?type=4 * Patch: * http://wireshark.digimirror.nl/lists/wireshark-dev/200703/msg00121.html * * Copyright 2007 Jens Braeuer <jensb@cs.tu-berlin.de> * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef _packet_wps_h_ #define _packet_wps_h_ void dissect_exteap_wps(proto_tree *eap_tree, tvbuff_t *tvb, int offset, gint size, packet_info* pinfo); void dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, gint size, packet_info* pinfo); #endif
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef ASH_WM_OVERVIEW_TRANSPARENT_ACTIVATE_WINDOW_BUTTON_H_ #define ASH_WM_OVERVIEW_TRANSPARENT_ACTIVATE_WINDOW_BUTTON_H_ #include "base/macros.h" #include "ui/views/controls/button/button.h" namespace ash { // Transparent window that covers window selector items and handles mouse and // gestures on overview mode for them. class TransparentActivateWindowButton : public views::ButtonListener { public: explicit TransparentActivateWindowButton(aura::Window* activate_window); virtual ~TransparentActivateWindowButton(); // Sets the bounds of the transparent window. void SetBounds(const gfx::Rect& bounds); // Sends an a11y focus alert so that if chromevox is enabled, the window title // is read. void SendFocusAlert() const; // views::ButtonListener: virtual void ButtonPressed(views::Button* sender, const ui::Event& event) OVERRIDE; private: // The transparent window event handler widget itself. scoped_ptr<views::Widget> event_handler_widget_; // Pointer to the window that the button activates. aura::Window* activate_window_; DISALLOW_COPY_AND_ASSIGN(TransparentActivateWindowButton); }; } // namespace ash #endif // ASH_WM_OVERVIEW_TRANSPARENT_ACTIVATE_WINDOW_BUTTON_H_
/* { dg-do compile } */ /* { dg-options "-O3" } */ int a, b, c, d; int e[100]; void fn1 () { int *f = &d; c = 6; for (; c; c--) { b = 0; for (; b <= 5; b++) { short g = e[(b + 2) * 9 + c]; *f = *f == a && e[(b + 2) * 9 + c]; } } }
/* * Copyright (C) ST-Ericsson AB 2010 * Author: Sjur Brendeland * License terms: GNU General Public License (GPL) version 2 */ #define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__ #include <linux/kernel.h> #include <linux/types.h> #include <linux/slab.h> #include <linux/errno.h> #include <net/caif/caif_layer.h> #include <net/caif/cfsrvl.h> #include <net/caif/cfpkt.h> #define container_obj(layr) ((struct cfsrvl *) layr) static int cfvidl_receive(struct cflayer *layr, struct cfpkt *pkt); static int cfvidl_transmit(struct cflayer *layr, struct cfpkt *pkt); struct cflayer *cfvidl_create(u8 channel_id, struct dev_info *dev_info) { struct cfsrvl *vid = kzalloc(sizeof(struct cfsrvl), GFP_ATOMIC); if (!vid) return NULL; caif_assert(offsetof(struct cfsrvl, layer) == 0); cfsrvl_init(vid, channel_id, dev_info, false); vid->layer.receive = cfvidl_receive; vid->layer.transmit = cfvidl_transmit; snprintf(vid->layer.name, CAIF_LAYER_NAME_SZ - 1, "vid1"); return &vid->layer; } static int cfvidl_receive(struct cflayer *layr, struct cfpkt *pkt) { u32 videoheader; if (cfpkt_extr_head(pkt, &videoheader, 4) < 0) { pr_err("Packet is erroneous!\n"); cfpkt_destroy(pkt); return -EPROTO; } return layr->up->receive(layr->up, pkt); } static int cfvidl_transmit(struct cflayer *layr, struct cfpkt *pkt) { struct cfsrvl *service = container_obj(layr); struct caif_payload_info *info; u32 videoheader = 0; int ret; if (!cfsrvl_ready(service, &ret)) { cfpkt_destroy(pkt); return ret; } cfpkt_add_head(pkt, &videoheader, 4); /* Add info for MUX-layer to route the packet out */ info = cfpkt_info(pkt); info->channel_id = service->layer.id; info->dev_info = &service->dev_info; return layr->dn->transmit(layr->dn, pkt); }
/* * common UDP/RAW code * Linux INET implementation * * Authors: * Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #include <linux/types.h> #include <linux/module.h> #include <linux/ip.h> #include <linux/in.h> #include <net/ip.h> #include <net/sock.h> #include <net/route.h> #include <net/tcp_states.h> int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) { struct inet_sock *inet = inet_sk(sk); struct sockaddr_in *usin = (struct sockaddr_in *) uaddr; struct rtable *rt; __be32 saddr; int oif; int err; if (addr_len < sizeof(*usin)) return -EINVAL; if (usin->sin_family != AF_INET) return -EAFNOSUPPORT; sk_dst_reset(sk); oif = sk->sk_bound_dev_if; saddr = inet->saddr; if (ipv4_is_multicast(usin->sin_addr.s_addr)) { if (!oif) oif = inet->mc_index; if (!saddr) saddr = inet->mc_addr; } err = ip_route_connect(&rt, usin->sin_addr.s_addr, saddr, RT_CONN_FLAGS(sk), oif, sk->sk_protocol, inet->sport, usin->sin_port, sk, 1); if (err) { if (err == -ENETUNREACH) IP_INC_STATS_BH(sock_net(sk), IPSTATS_MIB_OUTNOROUTES); return err; } if ((rt->rt_flags & RTCF_BROADCAST) && !sock_flag(sk, SOCK_BROADCAST)) { ip_rt_put(rt); return -EACCES; } if (!inet->saddr) inet->saddr = rt->rt_src; /* Update source address */ if (!inet->rcv_saddr) inet->rcv_saddr = rt->rt_src; inet->daddr = rt->rt_dst; inet->dport = usin->sin_port; sk->sk_state = TCP_ESTABLISHED; inet->id = jiffies; sk_dst_set(sk, &rt->u.dst); return(0); } EXPORT_SYMBOL(ip4_datagram_connect);
// SPDX-License-Identifier: GPL-2.0 /* * Symbol USB barcode to serial driver * * Copyright (C) 2013 Johan Hovold <jhovold@gmail.com> * Copyright (C) 2009 Greg Kroah-Hartman <gregkh@suse.de> * Copyright (C) 2009 Novell Inc. */ #include <linux/kernel.h> #include <linux/tty.h> #include <linux/slab.h> #include <linux/tty_driver.h> #include <linux/tty_flip.h> #include <linux/module.h> #include <linux/usb.h> #include <linux/usb/serial.h> #include <linux/uaccess.h> static const struct usb_device_id id_table[] = { { USB_DEVICE(0x05e0, 0x0600) }, { }, }; MODULE_DEVICE_TABLE(usb, id_table); struct symbol_private { spinlock_t lock; /* protects the following flags */ bool throttled; bool actually_throttled; }; static void symbol_int_callback(struct urb *urb) { struct usb_serial_port *port = urb->context; struct symbol_private *priv = usb_get_serial_port_data(port); unsigned char *data = urb->transfer_buffer; int status = urb->status; unsigned long flags; int result; int data_length; switch (status) { case 0: /* success */ break; case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ dev_dbg(&port->dev, "%s - urb shutting down with status: %d\n", __func__, status); return; default: dev_dbg(&port->dev, "%s - nonzero urb status received: %d\n", __func__, status); goto exit; } usb_serial_debug_data(&port->dev, __func__, urb->actual_length, data); /* * Data from the device comes with a 1 byte header: * * <size of data> <data>... */ if (urb->actual_length > 1) { data_length = data[0]; if (data_length > (urb->actual_length - 1)) data_length = urb->actual_length - 1; tty_insert_flip_string(&port->port, &data[1], data_length); tty_flip_buffer_push(&port->port); } else { dev_dbg(&port->dev, "%s - short packet\n", __func__); } exit: spin_lock_irqsave(&priv->lock, flags); /* Continue trying to always read if we should */ if (!priv->throttled) { result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); if (result) dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", __func__, result); } else priv->actually_throttled = true; spin_unlock_irqrestore(&priv->lock, flags); } static int symbol_open(struct tty_struct *tty, struct usb_serial_port *port) { struct symbol_private *priv = usb_get_serial_port_data(port); unsigned long flags; int result = 0; spin_lock_irqsave(&priv->lock, flags); priv->throttled = false; priv->actually_throttled = false; spin_unlock_irqrestore(&priv->lock, flags); /* Start reading from the device */ result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); if (result) dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", __func__, result); return result; } static void symbol_close(struct usb_serial_port *port) { usb_kill_urb(port->interrupt_in_urb); } static void symbol_throttle(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct symbol_private *priv = usb_get_serial_port_data(port); spin_lock_irq(&priv->lock); priv->throttled = true; spin_unlock_irq(&priv->lock); } static void symbol_unthrottle(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct symbol_private *priv = usb_get_serial_port_data(port); int result; bool was_throttled; spin_lock_irq(&priv->lock); priv->throttled = false; was_throttled = priv->actually_throttled; priv->actually_throttled = false; spin_unlock_irq(&priv->lock); if (was_throttled) { result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); if (result) dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __func__, result); } } static int symbol_port_probe(struct usb_serial_port *port) { struct symbol_private *priv; priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; spin_lock_init(&priv->lock); usb_set_serial_port_data(port, priv); return 0; } static int symbol_port_remove(struct usb_serial_port *port) { struct symbol_private *priv = usb_get_serial_port_data(port); kfree(priv); return 0; } static struct usb_serial_driver symbol_device = { .driver = { .owner = THIS_MODULE, .name = "symbol", }, .id_table = id_table, .num_ports = 1, .num_interrupt_in = 1, .port_probe = symbol_port_probe, .port_remove = symbol_port_remove, .open = symbol_open, .close = symbol_close, .throttle = symbol_throttle, .unthrottle = symbol_unthrottle, .read_int_callback = symbol_int_callback, }; static struct usb_serial_driver * const serial_drivers[] = { &symbol_device, NULL }; module_usb_serial_driver(serial_drivers, id_table); MODULE_LICENSE("GPL v2");
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #include "pal_compiler.h" #include <stdint.h> #include "opensslshim.h" /* Creates and initializes an EVP_MD_CTX with the given args. Implemented by: 1) calling EVP_MD_CTX_create 2) calling EVP_DigestInit_ex on the new EVP_MD_CTX with the specified EVP_MD Returns new EVP_MD_CTX on success, nullptr on failure. */ DLLEXPORT EVP_MD_CTX* CryptoNative_EvpMdCtxCreate(const EVP_MD* type); /* Cleans up and deletes an EVP_MD_CTX instance created by EvpMdCtxCreate. Implemented by: 1) Calling EVP_MD_CTX_destroy No-op if ctx is null. The given EVP_MD_CTX pointer is invalid after this call. Always succeeds. */ DLLEXPORT void CryptoNative_EvpMdCtxDestroy(EVP_MD_CTX* ctx); /* Resets an EVP_MD_CTX instance for a new computation. */ DLLEXPORT int32_t CryptoNative_EvpDigestReset(EVP_MD_CTX* ctx, const EVP_MD* type); /* Function: EvpDigestUpdate Direct shim to EVP_DigestUpdate. */ DLLEXPORT int32_t CryptoNative_EvpDigestUpdate(EVP_MD_CTX* ctx, const void* d, size_t cnt); /* Function: EvpDigestFinalEx Direct shim to EVP_DigestFinal_ex. */ DLLEXPORT int32_t CryptoNative_EvpDigestFinalEx(EVP_MD_CTX* ctx, uint8_t* md, uint32_t* s); /* Function: EvpMdSize Direct shim to EVP_MD_size. */ DLLEXPORT int32_t CryptoNative_EvpMdSize(const EVP_MD* md); /* Function: EvpMd5 Direct shim to EVP_md5. */ DLLEXPORT const EVP_MD* CryptoNative_EvpMd5(void); /* Function: EvpSha1 Direct shim to EVP_sha1. */ DLLEXPORT const EVP_MD* CryptoNative_EvpSha1(void); /* Function: EvpSha256 Direct shim to EVP_sha256. */ DLLEXPORT const EVP_MD* CryptoNative_EvpSha256(void); /* Function: EvpSha384 Direct shim to EVP_sha384. */ DLLEXPORT const EVP_MD* CryptoNative_EvpSha384(void); /* Function: EvpSha512 Direct shim to EVP_sha512. */ DLLEXPORT const EVP_MD* CryptoNative_EvpSha512(void); /* Function: GetMaxMdSize Returns the maxium bytes for a message digest. */ DLLEXPORT int32_t CryptoNative_GetMaxMdSize(void);
/*************************************************************************** * Copyright (c) 2005-2009, Broadcom Corporation. * * Name: crystalhd_lnx . c * * Description: * BCM70012 Linux driver * * HISTORY: * ********************************************************************** * This file is part of the crystalhd device driver. * * This driver is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 2 of the License. * * This driver is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this driver. If not, see <http://www.gnu.org/licenses/>. **********************************************************************/ #ifndef _CRYSTALHD_LNX_H_ #define _CRYSTALHD_LNX_H_ #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/string.h> #include <linux/mm.h> #include <linux/tty.h> #include <linux/slab.h> #include <linux/delay.h> #include <linux/fb.h> #include <linux/pci.h> #include <linux/init.h> #include <linux/interrupt.h> #include <linux/pagemap.h> #include <linux/vmalloc.h> #include <asm/io.h> #include <asm/irq.h> #include <asm/pgtable.h> #include <asm/system.h> #include <asm/uaccess.h> #include "crystalhd_cmds.h" #define CRYSTAL_HD_NAME "Broadcom Crystal HD Decoder (BCM70012) Driver" /* OS specific PCI information structure and adapter information. */ struct crystalhd_adp { /* Hardware borad/PCI specifics */ char name[32]; struct pci_dev *pdev; unsigned long pci_mem_start; uint32_t pci_mem_len; void *addr; unsigned long pci_i2o_start; uint32_t pci_i2o_len; void *i2o_addr; unsigned int drv_data; unsigned int dmabits; /* 32 | 64 */ unsigned int registered; unsigned int present; unsigned int msi; spinlock_t lock; /* API Related */ unsigned int chd_dec_major; unsigned int cfg_users; crystalhd_ioctl_data *idata_free_head; /* ioctl data pool */ crystalhd_elem_t *elem_pool_head; /* Queue element pool */ struct crystalhd_cmd cmds; crystalhd_dio_req *ua_map_free_head; struct pci_pool *fill_byte_pool; }; struct crystalhd_adp *chd_get_adp(void); void chd_set_log_level(struct crystalhd_adp *adp, char *arg); #endif
/* * xtl_core.c * * core code including functions for generating log messages * * Copyright (c) 2010 Citrix * Part of a generic logging interface used by various dom0 userland libraries. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "xentoollog.h" #include <assert.h> #include <errno.h> #include <limits.h> static const char *level_strings[XTL_NUM_LEVELS]= { "[BUG:XTL_NONE]", "debug", "verbose", "detail", /* normally off by default */ "progress", "info", "notice", /* not a problem */ "warning", "error", "critical" /* problems and errors */ }; const char *xtl_level_to_string(xentoollog_level level) { assert(level >= 0 && level < XTL_NUM_LEVELS); return level_strings[level]; } void xtl_logv(struct xentoollog_logger *logger, xentoollog_level level, int errnoval /* or -1 */, const char *context /* eg "xc", "xenstore", "xl" */, const char *format /* does not contain \n */, va_list al) { int errno_save = errno; assert(level > XTL_NONE && level < XTL_NUM_LEVELS); logger->vmessage(logger,level,errnoval,context,format,al); errno = errno_save; } void xtl_log(struct xentoollog_logger *logger, xentoollog_level level, int errnoval /* or -1 */, const char *context /* eg "xc", "xenstore", "xl" */, const char *format /* does not contain \n */, ...) { va_list al; va_start(al,format); xtl_logv(logger,level,errnoval,context,format,al); va_end(al); } void xtl_progress(struct xentoollog_logger *logger, const char *context, const char *doing_what, unsigned long done, unsigned long total) { int percent; if (!logger->progress) return; percent = (total < LONG_MAX/100) ? (done * 100) / total : done / ((total + 99) / 100); logger->progress(logger, context, doing_what, percent, done, total); } void xtl_logger_destroy(struct xentoollog_logger *logger) { if (!logger) return; logger->destroy(logger); }
/* ldb database module Copyright (C) Stefan Metzmacher 2006 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* * Name: ldb * * Component: ldb winsdb module * * Description: verify winsdb records before they're written to disk * * Author: Stefan Metzmacher */ #include "includes.h" #include "lib/events/events.h" #include "nbt_server/nbt_server.h" #include "nbt_server/wins/winsdb.h" #include <ldb_module.h> #include "system/network.h" #include "lib/socket/netif.h" #include "param/param.h" static int wins_ldb_verify(struct ldb_module *module, struct ldb_request *req) { struct ldb_context *ldb = ldb_module_get_ctx(module); struct winsdb_handle *h = talloc_get_type(ldb_get_opaque(ldb, "winsdb_handle"), struct winsdb_handle); const struct ldb_message *msg; switch (req->operation) { case LDB_ADD: msg = req->op.add.message; break; case LDB_MODIFY: msg = req->op.mod.message; break; default: return ldb_next_request(module, req); } /* do not manipulate our control entries */ if (ldb_dn_is_special(msg->dn)) { return ldb_next_request(module, req); } if (!h) { ldb_debug_set(ldb, LDB_DEBUG_FATAL, "%s", "WINS_LDB: INTERNAL ERROR: no winsdb_handle present!"); return LDB_ERR_OTHER; } switch (h->caller) { case WINSDB_HANDLE_CALLER_NBTD: case WINSDB_HANDLE_CALLER_WREPL: /* we trust our nbt and wrepl code ... */ return ldb_next_request(module, req); case WINSDB_HANDLE_CALLER_ADMIN: ldb_debug(ldb, LDB_DEBUG_WARNING, "%s\n", "WINS_LDB: TODO verify add/modify for WINSDB_HANDLE_CALLER_ADMIN"); return ldb_next_request(module, req); } return LDB_ERR_OTHER; } static int wins_ldb_init(struct ldb_module *module) { struct ldb_context *ldb = ldb_module_get_ctx(module); struct winsdb_handle *h; const char *owner; struct loadparm_context *lp_ctx = ldb_get_opaque(ldb, "loadparm"); ldb_module_set_private(module, NULL); owner = lpcfg_parm_string(lp_ctx, NULL, "winsdb", "local_owner"); if (!owner) { struct interface *ifaces; load_interface_list(module, lp_ctx, &ifaces); owner = iface_list_first_v4(ifaces); if (!owner) { owner = "0.0.0.0"; } } h = talloc_zero(module, struct winsdb_handle); if (!h) goto failed; h->ldb = ldb; h->caller = WINSDB_HANDLE_CALLER_ADMIN; h->local_owner = talloc_strdup(h, owner); if (!h->local_owner) goto failed; return ldb_set_opaque(ldb, "winsdb_handle", h); failed: talloc_free(h); return LDB_ERR_OTHER; } static const struct ldb_module_ops ldb_wins_ldb_module_ops = { .name = "wins_ldb", .add = wins_ldb_verify, .modify = wins_ldb_verify, .init_context = wins_ldb_init }; int ldb_wins_ldb_module_init(const char *version) { LDB_MODULE_CHECK_VERSION(version); return ldb_register_module(&ldb_wins_ldb_module_ops); }
/* ** Garbage collector. ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_GC_H #define _LJ_GC_H #include "lj_obj.h" /* Garbage collector states. Order matters. */ enum { GCSpause, GCSpropagate, GCSatomic, GCSsweepstring, GCSsweep, GCSfinalize }; /* Bitmasks for marked field of GCobj. */ #define LJ_GC_WHITE0 0x01 #define LJ_GC_WHITE1 0x02 #define LJ_GC_BLACK 0x04 #define LJ_GC_FINALIZED 0x08 #define LJ_GC_WEAKKEY 0x08 #define LJ_GC_WEAKVAL 0x10 #define LJ_GC_CDATA_FIN 0x10 #define LJ_GC_FIXED 0x20 #define LJ_GC_SFIXED 0x40 #define LJ_GC_WHITES (LJ_GC_WHITE0 | LJ_GC_WHITE1) #define LJ_GC_COLORS (LJ_GC_WHITES | LJ_GC_BLACK) #define LJ_GC_WEAK (LJ_GC_WEAKKEY | LJ_GC_WEAKVAL) /* Macros to test and set GCobj colors. */ #define iswhite(x) ((x)->gch.marked & LJ_GC_WHITES) #define isblack(x) ((x)->gch.marked & LJ_GC_BLACK) #define isgray(x) (!((x)->gch.marked & (LJ_GC_BLACK|LJ_GC_WHITES))) #define tviswhite(x) (tvisgcv(x) && iswhite(gcV(x))) #define otherwhite(g) (g->gc.currentwhite ^ LJ_GC_WHITES) #define isdead(g, v) ((v)->gch.marked & otherwhite(g) & LJ_GC_WHITES) #define curwhite(g) ((g)->gc.currentwhite & LJ_GC_WHITES) #define newwhite(g, x) (obj2gco(x)->gch.marked = (uint8_t)curwhite(g)) #define makewhite(g, x) \ ((x)->gch.marked = ((x)->gch.marked & (uint8_t)~LJ_GC_COLORS) | curwhite(g)) #define flipwhite(x) ((x)->gch.marked ^= LJ_GC_WHITES) #define black2gray(x) ((x)->gch.marked &= (uint8_t)~LJ_GC_BLACK) #define fixstring(s) ((s)->marked |= LJ_GC_FIXED) #define markfinalized(x) ((x)->gch.marked |= LJ_GC_FINALIZED) /* Collector. */ LJ_FUNC size_t lj_gc_separateudata(global_State *g, int all); LJ_FUNC void lj_gc_finalize_udata(lua_State *L); #if LJ_HASFFI LJ_FUNC void lj_gc_finalize_cdata(lua_State *L); #else #define lj_gc_finalize_cdata(L) UNUSED(L) #endif LJ_FUNC void lj_gc_freeall(global_State *g); LJ_FUNCA int LJ_FASTCALL lj_gc_step(lua_State *L); LJ_FUNCA void LJ_FASTCALL lj_gc_step_fixtop(lua_State *L); #if LJ_HASJIT LJ_FUNC int LJ_FASTCALL lj_gc_step_jit(global_State *g, MSize steps); #endif LJ_FUNC void lj_gc_fullgc(lua_State *L); /* GC check: drive collector forward if the GC threshold has been reached. */ #define lj_gc_check(L) \ { if (LJ_UNLIKELY(G(L)->gc.total >= G(L)->gc.threshold)) \ lj_gc_step(L); } #define lj_gc_check_fixtop(L) \ { if (LJ_UNLIKELY(G(L)->gc.total >= G(L)->gc.threshold)) \ lj_gc_step_fixtop(L); } /* Write barriers. */ LJ_FUNC void lj_gc_barrierf(global_State *g, GCobj *o, GCobj *v); LJ_FUNCA void LJ_FASTCALL lj_gc_barrieruv(global_State *g, TValue *tv); LJ_FUNC void lj_gc_closeuv(global_State *g, GCupval *uv); #if LJ_HASJIT LJ_FUNC void lj_gc_barriertrace(global_State *g, uint32_t traceno); #endif /* Move the GC propagation frontier back for tables (make it gray again). */ static LJ_AINLINE void lj_gc_barrierback(global_State *g, GCtab *t) { GCobj *o = obj2gco(t); lua_assert(isblack(o) && !isdead(g, o)); lua_assert(g->gc.state != GCSfinalize && g->gc.state != GCSpause); black2gray(o); setgcrefr(t->gclist, g->gc.grayagain); setgcref(g->gc.grayagain, o); } /* Barrier for stores to table objects. TValue and GCobj variant. */ #define lj_gc_anybarriert(L, t) \ { if (LJ_UNLIKELY(isblack(obj2gco(t)))) lj_gc_barrierback(G(L), (t)); } #define lj_gc_barriert(L, t, tv) \ { if (tviswhite(tv) && isblack(obj2gco(t))) \ lj_gc_barrierback(G(L), (t)); } #define lj_gc_objbarriert(L, t, o) \ { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) \ lj_gc_barrierback(G(L), (t)); } /* Barrier for stores to any other object. TValue and GCobj variant. */ #define lj_gc_barrier(L, p, tv) \ { if (tviswhite(tv) && isblack(obj2gco(p))) \ lj_gc_barrierf(G(L), obj2gco(p), gcV(tv)); } #define lj_gc_objbarrier(L, p, o) \ { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \ lj_gc_barrierf(G(L), obj2gco(p), obj2gco(o)); } /* Allocator. */ LJ_FUNC void *lj_mem_realloc(lua_State *L, void *p, GCSize osz, GCSize nsz); LJ_FUNC void * LJ_FASTCALL lj_mem_newgco(lua_State *L, GCSize size); LJ_FUNC void *lj_mem_grow(lua_State *L, void *p, MSize *szp, MSize lim, MSize esz); #define lj_mem_new(L, s) lj_mem_realloc(L, NULL, 0, (s)) static LJ_AINLINE void lj_mem_free(global_State *g, void *p, size_t osize) { g->gc.total -= (GCSize)osize; g->allocf(g->allocd, p, osize, 0); } #define lj_mem_newvec(L, n, t) ((t *)lj_mem_new(L, (GCSize)((n)*sizeof(t)))) #define lj_mem_reallocvec(L, p, on, n, t) \ ((p) = (t *)lj_mem_realloc(L, p, (on)*sizeof(t), (GCSize)((n)*sizeof(t)))) #define lj_mem_growvec(L, p, n, m, t) \ ((p) = (t *)lj_mem_grow(L, (p), &(n), (m), (MSize)sizeof(t))) #define lj_mem_freevec(g, p, n, t) lj_mem_free(g, (p), (n)*sizeof(t)) #define lj_mem_newobj(L, t) ((t *)lj_mem_newgco(L, sizeof(t))) #define lj_mem_newt(L, s, t) ((t *)lj_mem_new(L, (s))) #define lj_mem_freet(g, p) lj_mem_free(g, (p), sizeof(*(p))) #endif
/* PR tree-optimization/68680 */ /* { dg-do compile } */ /* { dg-options "-O2 -fstack-protector-strong" } */ int foo (char *); int bar (unsigned long x) { char a[x]; return foo (a); } /* Verify that this function is stack protected. */ /* { dg-final { scan-assembler "stack_chk_fail" } } */
/* * This file is generally used by user-level software, so you need to * be a little careful about namespace pollution etc. Also, we cannot * assume GCC is being used. */ #ifndef __SPARC_POSIX_TYPES_H #define __SPARC_POSIX_TYPES_H #if defined(__sparc__) && defined(__arch64__) /* sparc 64 bit */ typedef unsigned short __kernel_old_uid_t; typedef unsigned short __kernel_old_gid_t; #define __kernel_old_uid_t __kernel_old_uid_t /* Note this piece of asymmetry from the v9 ABI. */ typedef int __kernel_suseconds_t; #define __kernel_suseconds_t __kernel_suseconds_t #else /* sparc 32 bit */ typedef unsigned int __kernel_size_t; typedef int __kernel_ssize_t; typedef long int __kernel_ptrdiff_t; #define __kernel_size_t __kernel_size_t typedef unsigned short __kernel_ipc_pid_t; #define __kernel_ipc_pid_t __kernel_ipc_pid_t typedef unsigned short __kernel_uid_t; typedef unsigned short __kernel_gid_t; #define __kernel_uid_t __kernel_uid_t typedef unsigned short __kernel_mode_t; #define __kernel_mode_t __kernel_mode_t typedef long __kernel_daddr_t; #define __kernel_daddr_t __kernel_daddr_t typedef unsigned short __kernel_old_dev_t; #define __kernel_old_dev_t __kernel_old_dev_t #endif /* defined(__sparc__) && defined(__arch64__) */ #include <asm-generic/posix_types.h> #endif /* __SPARC_POSIX_TYPES_H */
#ifndef __LINUX_BRIDGE_NETFILTER_H #define __LINUX_BRIDGE_NETFILTER_H /* bridge-specific defines for netfilter. */ #include <linux/netfilter.h> #include <linux/if_ether.h> #include <linux/if_vlan.h> #include <linux/if_pppox.h> /* Bridge Hooks */ /* After promisc drops, checksum checks. */ #define NF_BR_PRE_ROUTING 0 /* If the packet is destined for this box. */ #define NF_BR_LOCAL_IN 1 /* If the packet is destined for another interface. */ #define NF_BR_FORWARD 2 /* Packets coming from a local process. */ #define NF_BR_LOCAL_OUT 3 /* Packets about to hit the wire. */ #define NF_BR_POST_ROUTING 4 /* Not really a hook, but used for the ebtables broute table */ #define NF_BR_BROUTING 5 #define NF_BR_NUMHOOKS 6 #endif /* __LINUX_BRIDGE_NETFILTER_H */
/* -*- c++ -*- */ /* * Copyright 2012-2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_H #define INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_H #include <gnuradio/blocks/api.h> #include <gnuradio/sync_block.h> namespace gr { namespace blocks { /*! * \brief Detects a plateau and marks the middle. * \ingroup peak_detectors_blk * * \details * Detect a plateau of a-priori known height. Input is a stream of floats, * the output is a stream of bytes. Whenever a plateau is detected, the * middle of that plateau is marked with a '1' on the output stream (all * other samples are left at zero). * * You can use this in a Schmidl & Cox synchronisation algorithm to interpret * the output of the normalized correlator. Just pass the length of the cyclic * prefix (in samples) as the max_len parameter). * * Unlike the peak detectors, you must the now the absolute height of the plateau. * Whenever the amplitude exceeds the given threshold, it starts assuming the * presence of a plateau. * * An implicit hysteresis is provided by the fact that after detecting one plateau, * it waits at least max_len samples before the next plateau can be detected. */ class BLOCKS_API plateau_detector_fb : virtual public block { public: typedef boost::shared_ptr<plateau_detector_fb> sptr; /*! * \param max_len Maximum length of the plateau * \param threshold Anything above this value is considered a plateau */ static sptr make(int max_len, float threshold=0.9); }; } // namespace blocks } // namespace gr #endif /* INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_H */
// RUN: %clang_cc1 %s -triple powerpc64-unknown-linux-gnu -fasm-blocks -verify -fsyntax-only void f() { __asm nop // expected-error {{Unsupported architecture 'powerpc64' for MS-style inline assembly}} }
/* * Copyright (C) 2010-2012 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence. * * A copy of the licence is included with the program, and can also be obtained from Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /** * @file mali_osk_mali.c * Implementation of the OS abstraction layer which is specific for the Mali kernel device driver */ #include <linux/kernel.h> #include <asm/uaccess.h> #include "mali_kernel_common.h" /* MALI_xxx macros */ #include "mali_osk.h" /* kernel side OS functions */ #include "mali_uk_types.h" #include "config.h" /* contains the configuration of the arch we are compiling for */ _mali_osk_errcode_t _mali_osk_resources_init( _mali_osk_resource_t **arch_config, u32 *num_resources ) { *num_resources = sizeof(arch_configuration) / sizeof(arch_configuration[0]); *arch_config = arch_configuration; return _MALI_OSK_ERR_OK; } void _mali_osk_resources_term( _mali_osk_resource_t **arch_config, u32 num_resources ) { /* Nothing to do */ }
/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * gp8psk_fe driver */ #ifndef GP8PSK_FE_H #define GP8PSK_FE_H #include <linux/types.h> /* gp8psk commands */ #define GET_8PSK_CONFIG 0x80 /* in */ #define SET_8PSK_CONFIG 0x81 #define I2C_WRITE 0x83 #define I2C_READ 0x84 #define ARM_TRANSFER 0x85 #define TUNE_8PSK 0x86 #define GET_SIGNAL_STRENGTH 0x87 /* in */ #define LOAD_BCM4500 0x88 #define BOOT_8PSK 0x89 /* in */ #define START_INTERSIL 0x8A /* in */ #define SET_LNB_VOLTAGE 0x8B #define SET_22KHZ_TONE 0x8C #define SEND_DISEQC_COMMAND 0x8D #define SET_DVB_MODE 0x8E #define SET_DN_SWITCH 0x8F #define GET_SIGNAL_LOCK 0x90 /* in */ #define GET_FW_VERS 0x92 #define GET_SERIAL_NUMBER 0x93 /* in */ #define USE_EXTRA_VOLT 0x94 #define GET_FPGA_VERS 0x95 #define CW3K_INIT 0x9d /* PSK_configuration bits */ #define bm8pskStarted 0x01 #define bm8pskFW_Loaded 0x02 #define bmIntersilOn 0x04 #define bmDVBmode 0x08 #define bm22kHz 0x10 #define bmSEL18V 0x20 #define bmDCtuned 0x40 #define bmArmed 0x80 /* Satellite modulation modes */ #define ADV_MOD_DVB_QPSK 0 /* DVB-S QPSK */ #define ADV_MOD_TURBO_QPSK 1 /* Turbo QPSK */ #define ADV_MOD_TURBO_8PSK 2 /* Turbo 8PSK (also used for Trellis 8PSK) */ #define ADV_MOD_TURBO_16QAM 3 /* Turbo 16QAM (also used for Trellis 8PSK) */ #define ADV_MOD_DCII_C_QPSK 4 /* Digicipher II Combo */ #define ADV_MOD_DCII_I_QPSK 5 /* Digicipher II I-stream */ #define ADV_MOD_DCII_Q_QPSK 6 /* Digicipher II Q-stream */ #define ADV_MOD_DCII_C_OQPSK 7 /* Digicipher II offset QPSK */ #define ADV_MOD_DSS_QPSK 8 /* DSS (DIRECTV) QPSK */ #define ADV_MOD_DVB_BPSK 9 /* DVB-S BPSK */ /* firmware revision id's */ #define GP8PSK_FW_REV1 0x020604 #define GP8PSK_FW_REV2 0x020704 #define GP8PSK_FW_VERS(_fw_vers) \ ((_fw_vers)[2]<<0x10 | (_fw_vers)[1]<<0x08 | (_fw_vers)[0]) struct gp8psk_fe_ops { int (*in)(void *priv, u8 req, u16 value, u16 index, u8 *b, int blen); int (*out)(void *priv, u8 req, u16 value, u16 index, u8 *b, int blen); int (*reload)(void *priv); }; struct dvb_frontend *gp8psk_fe_attach(const struct gp8psk_fe_ops *ops, void *priv, bool is_rev1); #endif
#import "Base.h" namespace Cedar { namespace Matchers { template<typename T> class Contain : public Base<> { private: Contain & operator=(const Contain &); public: explicit Contain(const T & element); ~Contain(); // Allow default copy ctor. template<typename U> bool matches(const U &) const; protected: virtual NSString * failure_message_end() const; private: const T & element_; }; template<typename T> inline Contain<T> contain(const T & element) { return Contain<T>(element); } template<typename T> inline Contain<T>::Contain(const T & element) : Base<>(), element_(element) { } template<typename T> Contain<T>::~Contain() { } template<typename T> inline /*virtual*/ NSString * Contain<T>::failure_message_end() const { NSString * elementString = Stringifiers::string_for(element_); return [NSString stringWithFormat:@"contain <%@>", elementString]; } #pragma mark Generic template <typename T> template<typename U> bool Contain<T>::matches(const U & actualValue) const { return Comparators::compare_contains(actualValue, element_); } }}
/********************************************************************** * Copyright (c) 2015 Andrew Poelstra * * Distributed under the MIT software license, see the accompanying * * file COPYING or http://www.opensource.org/licenses/mit-license.php.* **********************************************************************/ #ifndef SECP256K1_MODULE_ECDH_MAIN_H #define SECP256K1_MODULE_ECDH_MAIN_H #include "include/secp256k1_ecdh.h" #include "ecmult_const_impl.h" int secp256k1_ecdh(const secp256k1_context* ctx, unsigned char *result, const secp256k1_pubkey *point, const unsigned char *scalar) { int ret = 0; int overflow = 0; secp256k1_gej res; secp256k1_ge pt; secp256k1_scalar s; VERIFY_CHECK(ctx != NULL); ARG_CHECK(result != NULL); ARG_CHECK(point != NULL); ARG_CHECK(scalar != NULL); secp256k1_pubkey_load(ctx, &pt, point); secp256k1_scalar_set_b32(&s, scalar, &overflow); if (overflow || secp256k1_scalar_is_zero(&s)) { ret = 0; } else { unsigned char x[32]; unsigned char y[1]; secp256k1_sha256_t sha; secp256k1_ecmult_const(&res, &pt, &s); secp256k1_ge_set_gej(&pt, &res); /* Compute a hash of the point in compressed form * Note we cannot use secp256k1_eckey_pubkey_serialize here since it does not * expect its output to be secret and has a timing sidechannel. */ secp256k1_fe_normalize(&pt.x); secp256k1_fe_normalize(&pt.y); secp256k1_fe_get_b32(x, &pt.x); y[0] = 0x02 | secp256k1_fe_is_odd(&pt.y); secp256k1_sha256_initialize(&sha); secp256k1_sha256_write(&sha, y, sizeof(y)); secp256k1_sha256_write(&sha, x, sizeof(x)); secp256k1_sha256_finalize(&sha, result); ret = 1; } secp256k1_scalar_clear(&s); return ret; } #endif /* SECP256K1_MODULE_ECDH_MAIN_H */
/* { dg-do compile } */ /* { dg-options "-O -fno-tree-fre -fdump-tree-cddce1" } */ int foo(int b) { int a[128]; a[b] = 1; if (b) { b = 2; a[2] = 0; } a[2] = 3; return a[2] + b; } /* Verify DCE removes all accesses to a but the last store and the read from a[2]. */ /* { dg-final { scan-tree-dump-times "a\\\[\[^\n\]\\\]" 2 "cddce1" } } */
/* Verify straight-line strength reduction for simple integer addition with casts thrown in. */ /* { dg-do compile } */ /* { dg-options "-O3 -fdump-tree-optimized" } */ long f (int s, long c) { int a1, a2, a3; long x1, x2, x3, x; a1 = 2 * s; x1 = c + a1; a2 = 4 * s; x2 = c + a2; a3 = 6 * s; x3 = c + a3; x = x1 + x2 + x3; return x; } /* { dg-final { scan-tree-dump-times " \\* " 1 "optimized" } } */
// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_WIN_H_ #define CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_WIN_H_ #include <windows.h> #include "chrome/browser/extensions/global_shortcut_listener.h" #include "ui/gfx/win/singleton_hwnd.h" namespace extensions { // Windows-specific implementation of the GlobalShortcutListener class that // listens for global shortcuts. Handles setting up a keyboard hook and // forwarding its output to the base class for processing. class GlobalShortcutListenerWin : public GlobalShortcutListener, public gfx::SingletonHwnd::Observer { public: GlobalShortcutListenerWin(); virtual ~GlobalShortcutListenerWin(); private: // The implementation of our Window Proc, called by SingletonHwnd. virtual void OnWndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) override; // GlobalShortcutListener implementation. virtual void StartListening() override; virtual void StopListening() override; virtual bool RegisterAcceleratorImpl( const ui::Accelerator& accelerator) override; virtual void UnregisterAcceleratorImpl( const ui::Accelerator& accelerator) override; // Whether this object is listening for global shortcuts. bool is_listening_; // A map of registered accelerators and their registration ids. typedef std::map<ui::Accelerator, int> HotkeyIdMap; HotkeyIdMap hotkey_ids_; DISALLOW_COPY_AND_ASSIGN(GlobalShortcutListenerWin); }; } // namespace extensions #endif // CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_WIN_H_
/** * Copyright (c) 2015-present, Parse, LLC. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ #import <Foundation/Foundation.h> #import <Parse/PFConstants.h> @class BFTask PF_GENERIC(__covariant BFGenericType); NS_ASSUME_NONNULL_BEGIN @protocol PFFileManagerProvider; @interface PFFileStagingController : NSObject @property (nonatomic, weak, readonly) id<PFFileManagerProvider> dataSource; @property (nonatomic, copy, readonly) NSString *stagedFilesDirectoryPath; ///-------------------------------------- /// @name Init ///-------------------------------------- - (instancetype)init NS_UNAVAILABLE; - (instancetype)initWithDataSource:(id<PFFileManagerProvider>)dataSource NS_DESIGNATED_INITIALIZER; + (instancetype)controllerWithDataSource:(id<PFFileManagerProvider>)dataSource; ///-------------------------------------- /// @name Staging ///-------------------------------------- /*! Moves a file from the specified path to the staging directory based off of the name and unique ID passed in. @param filePath The source path to stage @param name The name of the file to stage @param uniqueId A unique ID for this file to be used when differentiating between files with the same name. @return A task, which yields the path of the staged file on disk. */ - (BFTask *)stageFileAsyncAtPath:(NSString *)filePath name:(NSString *)name uniqueId:(uint64_t)uniqueId; /*! Creates a file from the specified data and places it into the staging directory based off of the name and unique ID passed in. @param fileData The data to stage @param name The name of the file to stage @param uniqueId The unique ID for this file to be used when differentiating between files with the same name. @return A task, which yields the path of the staged file on disk. */ - (BFTask *)stageFileAsyncWithData:(NSData *)fileData name:(NSString *)name uniqueId:(uint64_t)uniqueId; /*! Get the staged directory path for a file with the specified name and unique ID. @param name The name of the staged file @param uniqueId The unique ID of the staged file @return The path in the staged directory folder which contains the contents of the requested file. */ - (NSString *)stagedFilePathForFileWithName:(NSString *)name uniqueId:(uint64_t)uniqueId; @end NS_ASSUME_NONNULL_END
#include QMK_KEYBOARD_H #include <sendstring_norman.h> extern keymap_config_t keymap_config; // Each layer gets a name for readability, which is then used in the keymap matrix below. // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. enum layers { _NORMAN, _LOWER, _RAISE, _ADJUST }; enum custom_keycodes { QWERTY = SAFE_RANGE, LOWER, RAISE, ADJUST }; // Defines for task manager and such #define CALTDEL LCTL(LALT(KC_DEL)) #define TSKMGR LCTL(LSFT(KC_ESC)) #define DSK_LFT LGUI(LCTL(KC_LEFT)) #define DSK_RT LGUI(LCTL(KC_RIGHT)) const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_NORMAN] = LAYOUT( \ NM_Q, NM_W, NM_D, NM_F, NM_K, NM_J, NM_U, NM_R, NM_L, NM_SCLN, \ NM_A, NM_S, NM_E, NM_T, NM_G, NM_Y, NM_N, NM_I, NM_O, NM_H, \ NM_Z, NM_X, NM_C, NM_V, NM_B, NM_P, NM_M, NM_COMM, NM_DOT, NM_SLSH, \ LGUI_T(KC_ENT), LT(_RAISE, KC_ESC), SFT_T(KC_BSPC), CTL_T(KC_SPC), LT(_LOWER, KC_TAB), ALT_T(KC_ENT) \ ), [_RAISE] = LAYOUT( \ KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_PLUS, KC_7, KC_8, KC_9, KC_0, \ KC_CIRC, KC_AMPR, KC_TILD, KC_PIPE, KC_BSLS, KC_MINUS, KC_4, KC_5, KC_6, KC_EQL, \ KC_DQT, KC_QUOT, KC_UNDS, KC_GRV, _______, KC_ASTR, KC_1, KC_2, KC_3, _______, \ _______, _______, _______, _______, MO(_ADJUST), _______ \ ), [_LOWER] = LAYOUT( \ KC_ESC, KC_HOME, KC_UP, KC_END, _______, _______, KC_LPRN, KC_RPRN, _______, _______, KC_VOLU, KC_LEFT, KC_DOWN, KC_RIGHT, KC_PGUP, _______, KC_LBRC, KC_RBRC, _______, _______, \ KC_VOLD, KC_MPRV, KC_MPLY, KC_MNXT, KC_PGDN, _______, KC_LCBR, KC_RCBR, _______, _______, \ _______, MO(_ADJUST), _______, _______, _______, _______ \ ), [_ADJUST] = LAYOUT( \ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, \ _______, DSK_LFT, _______, DSK_RT, _______, TSKMGR, CALTDEL, _______, KC_F11, KC_F12, \ RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ _______, _______, _______, _______, _______, _______ \ ) }; void persistant_default_layer_set(uint16_t default_layer) { eeconfig_update_default_layer(default_layer); default_layer_set(default_layer); }
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_REGEX_CONSTANTS_H_ #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_REGEX_CONSTANTS_H_ namespace autofill { extern const char kAttentionIgnoredRe[]; extern const char kRegionIgnoredRe[]; extern const char kCompanyRe[]; extern const char kAddressLine1Re[]; extern const char kAddressLine1LabelRe[]; extern const char kAddressLine2Re[]; extern const char kAddressLine2LabelRe[]; extern const char kAddressLinesExtraRe[]; extern const char kCountryRe[]; extern const char kZipCodeRe[]; extern const char kZip4Re[]; extern const char kCityRe[]; extern const char kStateRe[]; extern const char kNameOnCardRe[]; extern const char kNameOnCardContextualRe[]; extern const char kCardNumberRe[]; extern const char kCardCvcRe[]; extern const char kCardTypeRe[]; extern const char kExpirationMonthRe[]; extern const char kExpirationYearRe[]; extern const char kExpirationDate2DigitYearRe[]; extern const char kExpirationDateRe[]; extern const char kCardIgnoredRe[]; extern const char kGiftCardRe[]; extern const char kEmailRe[]; extern const char kNameIgnoredRe[]; extern const char kNameRe[]; extern const char kNameSpecificRe[]; extern const char kFirstNameRe[]; extern const char kMiddleInitialRe[]; extern const char kMiddleNameRe[]; extern const char kLastNameRe[]; extern const char kPhoneRe[]; extern const char kCountryCodeRe[]; extern const char kAreaCodeNotextRe[]; extern const char kAreaCodeRe[]; extern const char kFaxRe[]; extern const char kPhonePrefixSeparatorRe[]; extern const char kPhoneSuffixSeparatorRe[]; extern const char kPhonePrefixRe[]; extern const char kPhoneSuffixRe[]; extern const char kPhoneExtensionRe[]; } // namespace autofill #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_REGEX_CONSTANTS_H_
/*************************************************************************/ /*! @File services_kernel_client.h @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved @License Dual MIT/GPLv2 The contents of this file are subject to the MIT license as set out below. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Alternatively, the contents of this file may be used under the terms of the GNU General Public License Version 2 ("GPL") in which case the provisions of GPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of GPL, and not to allow others to use your version of this file under the terms of the MIT license, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by GPL as set out in the file called "GPL-COPYING" included in this distribution. If you do not delete the provisions above, a recipient may use your version of this file under the terms of either the MIT license or GPL. This License is also included in this distribution in the file called "MIT-COPYING". EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ /* vi: set ts=8: */ /* This file contains a partial redefinition of the PowerVR Services 5 * interface for use by components which are checkpatch clean. This * header is included by the unrefined, non-checkpatch clean headers * to ensure that prototype/typedef/macro changes break the build. */ #ifndef __SERVICES_KERNEL_CLIENT__ #define __SERVICES_KERNEL_CLIENT__ #include "debug_request_ids.h" #include "pvrsrv_error.h" #include <linux/types.h> #ifndef __pvrsrv_defined_struct_enum__ /* pvrsrv_device_types.h */ enum PVRSRV_DEVICE_TYPE { PVRSRV_DEVICE_TYPE_RGX = 10, }; /* sync_external.h */ struct PVRSRV_CLIENT_SYNC_PRIM { volatile __u32 *pui32LinAddr; }; struct PVRSRV_CLIENT_SYNC_PRIM_OP { __u32 ui32Flags; struct pvrsrv_sync_prim *psSync; __u32 ui32FenceValue; __u32 ui32UpdateValue; }; #else /* __pvrsrv_defined_struct_enum__ */ enum PVRSRV_DEVICE_TYPE; struct PVRSRV_CLIENT_SYNC_PRIM; struct PVRSRV_CLIENT_SYNC_PRIM_OP; #endif /* __pvrsrv_defined_struct_enum__ */ struct SYNC_PRIM_CONTEXT; /* pvrsrv.h */ #define DEBUG_REQUEST_VERBOSITY_LOW 0 #define DEBUG_REQUEST_VERBOSITY_MEDIUM 1 #define DEBUG_REQUEST_VERBOSITY_HIGH 2 #define DEBUG_REQUEST_VERBOSITY_MAX (DEBUG_REQUEST_VERBOSITY_HIGH) typedef void (DUMPDEBUG_PRINTF_FUNC)(const char *fmt, ...) __printf(1, 2); extern DUMPDEBUG_PRINTF_FUNC *g_pfnDumpDebugPrintf; typedef void (*PFN_CMDCOMP_NOTIFY)(void *hCmdCompHandle); enum PVRSRV_ERROR PVRSRVRegisterCmdCompleteNotify(void **phNotify, PFN_CMDCOMP_NOTIFY pfnCmdCompleteNotify, void *hPrivData); enum PVRSRV_ERROR PVRSRVUnregisterCmdCompleteNotify(void *hNotify); typedef void (*PFN_DBGREQ_NOTIFY) (void *hDebugRequestHandle, __u32 ui32VerbLevel); enum PVRSRV_ERROR PVRSRVRegisterDbgRequestNotify(void **phNotify, PFN_DBGREQ_NOTIFY pfnDbgRequestNotify, __u32 ui32RequesterID, void *hDbgReqeustHandle); enum PVRSRV_ERROR PVRSRVUnregisterDbgRequestNotify(void *hNotify); enum PVRSRV_ERROR PVRSRVAcquireDeviceDataKM(__u32 ui32DevIndex, enum PVRSRV_DEVICE_TYPE eDeviceType, void **phDevCookie); enum PVRSRV_ERROR PVRSRVReleaseDeviceDataKM(void *hDevCookie); void PVRSRVCheckStatus(void *hCmdCompCallerHandle); enum PVRSRV_ERROR AcquireGlobalEventObjectServer(void **phGlobalEventObject); enum PVRSRV_ERROR ReleaseGlobalEventObjectServer(void *hGlobalEventObject); /* sync.h */ enum PVRSRV_ERROR SyncPrimContextCreate(void *hBridge, void *hDeviceNode, struct SYNC_PRIM_CONTEXT **phSyncPrimContext); void SyncPrimContextDestroy(struct SYNC_PRIM_CONTEXT *hSyncPrimContext); enum PVRSRV_ERROR SyncPrimAlloc(struct SYNC_PRIM_CONTEXT *hSyncPrimContext, struct PVRSRV_CLIENT_SYNC_PRIM **ppsSync, const char * pszClassName); void SyncPrimFree(struct PVRSRV_CLIENT_SYNC_PRIM *psSync); __u32 SyncPrimGetFirmwareAddr(struct PVRSRV_CLIENT_SYNC_PRIM *psSync); /* pdump_km.h */ #ifdef PDUMP enum PVRSRV_ERROR __printf(1, 2) PDumpComment(char *fmt, ...); #else static inline enum PVRSRV_ERROR __printf(1, 2) PDumpComment(char *fmt, ...) { return PVRSRV_OK; } #endif /* osfunc.h */ void OSAcquireBridgeLock(void); void OSReleaseBridgeLock(void); enum PVRSRV_ERROR OSEventObjectWait(void *hOSEventKM); enum PVRSRV_ERROR OSEventObjectOpen(void *hEventObject, void **phOSEventKM); enum PVRSRV_ERROR OSEventObjectClose(void *hOSEventKM); /* srvkm.h */ const char *PVRSRVGetErrorStringKM(enum PVRSRV_ERROR eError); #endif /* __SERVICES_KERNEL_CLIENT__ */
/* * driver for Android SensorHub SPI * * Copyright (c) 2013, Samsung Electronics. All rights reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ #include <linux/init.h> #include <linux/module.h> #include <linux/spi/spi.h> #include <linux/delay.h> #if defined(DEBUG_SSP_SPI) #define ssp_log(fmt, arg...) \ do { \ printk(KERN_ERR "[%s:%d] " fmt , \ __func__, __LINE__, ##arg); \ } \ while (0) #else #define ssp_log(fmt, arg...) #endif /* If AP can't change the endian to BIG */ /* for s5c73m ISP, this option must is required.*/ /* This option depends on SPI_DMA_MODE */ /* in camera driver file*/ /*#define CHANGE_ENDIAN */ int ssp_spi_write_sync(struct spi_device *spi, const u8 *addr, const int len) { int ret; #if defined(CHANGE_ENDIAN) u8 buf[8] = {0}; #endif struct spi_message msg; struct spi_transfer xfer = { .len = len, #if !defined(CHANGE_ENDIAN) .tx_buf = addr, /*QCTK ALRAN QUP_CONFIG 0-4 bits BIG ENDIAN*/ .bits_per_word = 8, #else .tx_buf = buf, #endif }; #if defined(CHANGE_ENDIAN) buf[0] = addr[3]; buf[1] = addr[2]; buf[2] = addr[1]; buf[3] = addr[0]; buf[4] = addr[7]; buf[5] = addr[6]; buf[6] = addr[5]; buf[7] = addr[4]; #endif spi_message_init(&msg); spi_message_add_tail(&xfer, &msg); ret = spi_sync(spi, &msg); if (ret < 0) ssp_log("error %d\n", ret); return ret; } int ssp_spi_read_sync(struct spi_device *spi, u8 *in_buf, size_t len) { int ret; u8 read_out_buf[2]; struct spi_message msg; struct spi_transfer xfer = { .tx_buf = read_out_buf, .rx_buf = in_buf, .len = len, .cs_change = 0, }; spi_message_init(&msg); spi_message_add_tail(&xfer, &msg); ret = spi_sync(spi, &msg); if (ret < 0) ssp_log("%s - error %d\n", __func__, ret); return ret; } int ssp_spi_sync(struct spi_device *spi, u8 *out_buf, size_t out_len, u8 *in_buf) { int ret; struct spi_message msg; struct spi_transfer xfer = { .tx_buf = out_buf, .rx_buf = in_buf, .len = out_len, .cs_change = 0, }; spi_message_init(&msg); spi_message_add_tail(&xfer, &msg); ret = spi_sync(spi, &msg); ssp_log("%s - received %d\n", __func__, xfer.len); if (ret < 0) ssp_log("%s - error %d\n", __func__, ret); return ret; } unsigned int g_flag_spirecv; void ssp_spi_async_complete(void *context) { g_flag_spirecv = 1; } int ssp_spi_async(struct spi_device *spi, u8 *out_buf, size_t out_len, u8 *in_buf) { int ret; struct spi_message msg; struct spi_transfer xfer = { .tx_buf = out_buf, .rx_buf = in_buf, .len = out_len, .cs_change = 0, }; spi_message_init(&msg); spi_message_add_tail(&xfer, &msg); msg.complete = ssp_spi_async_complete; ret = spi_async(spi, &msg); if (ret < 0) ssp_log("%s - error %d\n", __func__, ret); return ret; } int ssp_spi_read(struct spi_device *spi, u8 *buf, size_t len, const int rxSize) { int k; int ret = 0; u8 temp_buf[4] = {0}; u32 count = len/rxSize; u32 extra = len%rxSize; for (k = 0; k < count; k++) { ret = ssp_spi_read_sync(spi, &buf[rxSize*k], rxSize); if (ret < 0) { ssp_log("%s - error %d\n", __func__, ret); return -EINVAL; } } if (extra != 0) { ret = ssp_spi_read_sync(spi, &buf[rxSize*k], extra); if (ret < 0) { ssp_log("%s - error %d\n", __func__, ret); return -EINVAL; } } for (k = 0; k < len-3; k += 4) { memcpy(temp_buf, (char *)&buf[k], sizeof(temp_buf)); buf[k] = temp_buf[3]; buf[k+1] = temp_buf[2]; buf[k+2] = temp_buf[1]; buf[k+3] = temp_buf[0]; } return 0; } int ssp_spi_write(struct spi_device *spi, const u8 *addr, const int len, const int txSize) { int i, j = 0; int ret = 0; u8 paddingData[8]; u32 count = len/txSize; u32 extra = len%txSize; ssp_log("Entered\n"); ssp_log("count = %d extra = %d\n", count, extra); memset(paddingData, 0, sizeof(paddingData)); for (i = 0 ; i < count ; i++) { ret = ssp_spi_write_sync(spi, &addr[j], txSize); j += txSize; if (ret < 0) { ssp_log("failed to write ssp_spi_write_sync\n"); goto exit_err; } ssp_log("Delay!!!\n"); msleep(50); } if (extra) { ret = ssp_spi_write_sync(spi, &addr[j], extra); if (ret < 0) { ssp_log("failed to write ssp_spi_write_sync\n"); goto exit_err; } } for (i = 0; i < 4; i++) { memset(paddingData, 0, sizeof(paddingData)); ret = ssp_spi_write_sync(spi, paddingData, 8); if (ret < 0) { ssp_log("failed to write ssp_spi_write_sync\n"); goto exit_err; } } ssp_log("Finish!!\n"); exit_err: return ret; }
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_FACTORY_H_ #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_FACTORY_H_ #include "base/basictypes.h" #include "content/common/content_export.h" namespace content { class RenderFrameHostDelegate; class RenderViewHost; class RenderViewHostDelegate; class RenderWidgetHostDelegate; class SessionStorageNamespace; class SiteInstance; // A factory for creating RenderViewHosts. There is a global factory function // that can be installed for the purposes of testing to provide a specialized // RenderViewHost class. class RenderViewHostFactory { public: // Creates a RenderViewHost using the currently registered factory, or the // default one if no factory is registered. Ownership of the returned // pointer will be passed to the caller. static RenderViewHost* Create( SiteInstance* instance, RenderViewHostDelegate* delegate, RenderWidgetHostDelegate* widget_delegate, int routing_id, int main_frame_routing_id, bool swapped_out, bool hidden); // Returns true if there is currently a globally-registered factory. static bool has_factory() { return !!factory_; } protected: RenderViewHostFactory() {} virtual ~RenderViewHostFactory() {} // You can derive from this class and specify an implementation for this // function to create a different kind of RenderViewHost for testing. virtual RenderViewHost* CreateRenderViewHost( SiteInstance* instance, RenderViewHostDelegate* delegate, RenderWidgetHostDelegate* widget_delegate, int routing_id, int main_frame_routing_id, bool swapped_out) = 0; // Registers your factory to be called when new RenderViewHosts are created. // We have only one global factory, so there must be no factory registered // before the call. This class does NOT take ownership of the pointer. CONTENT_EXPORT static void RegisterFactory(RenderViewHostFactory* factory); // Unregister the previously registered factory. With no factory registered, // the default RenderViewHosts will be created. CONTENT_EXPORT static void UnregisterFactory(); private: // The current globally registered factory. This is NULL when we should // create the default RenderViewHosts. CONTENT_EXPORT static RenderViewHostFactory* factory_; DISALLOW_COPY_AND_ASSIGN(RenderViewHostFactory); }; } // namespace content #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_FACTORY_H_
#include <linux/vmalloc.h> #include <linux/module.h> #include <linux/fs.h> #include <linux/mm.h> #include <linux/sched.h> #include <asm/uaccess.h> #include "oss/sound_firmware.h" static int do_mod_firmware_load(const char *fn, char **fp) { struct file* filp; long l; char *dp; loff_t pos; filp = filp_open(fn, 0, 0); if (IS_ERR(filp)) { printk(KERN_INFO "Unable to load '%s'.\n", fn); return 0; } l = i_size_read(filp->f_path.dentry->d_inode); if (l <= 0 || l > 131072) { printk(KERN_INFO "Invalid firmware '%s'\n", fn); filp_close(filp, current->files); return 0; } dp = vmalloc(l); if (dp == NULL) { printk(KERN_INFO "Out of memory loading '%s'.\n", fn); filp_close(filp, current->files); return 0; } pos = 0; if (vfs_read(filp, dp, l, &pos) != l) { printk(KERN_INFO "Failed to read '%s'.\n", fn); vfree(dp); filp_close(filp, current->files); return 0; } filp_close(filp, current->files); *fp = dp; return (int) l; } /** * mod_firmware_load - load sound driver firmware * @fn: filename * @fp: return for the buffer. * * Load the firmware for a sound module (up to 128K) into a buffer. * The buffer is returned in *fp. It is allocated with vmalloc so is * virtually linear and not DMAable. The caller should free it with * vfree when finished. * * The length of the buffer is returned on a successful load, the * value zero on a failure. * * Caution: This API is not recommended. Firmware should be loaded via * request_firmware. */ int mod_firmware_load(const char *fn, char **fp) { int r; mm_segment_t fs = get_fs(); set_fs(get_ds()); r = do_mod_firmware_load(fn, fp); set_fs(fs); return r; } EXPORT_SYMBOL(mod_firmware_load); MODULE_LICENSE("GPL");
/* * Copyright 2010 Tilera Corporation. All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or * NON INFRINGEMENT. See the GNU General Public License for * more details. */ /** * @file * * ABI-related register definitions. */ #ifndef __ARCH_ABI_H__ #if !defined __need_int_reg_t && !defined __DOXYGEN__ # define __ARCH_ABI_H__ # include <arch/chip.h> #endif /* Provide the basic machine types. */ #ifndef __INT_REG_BITS /** Number of bits in a register. */ #if defined __tilegx__ # define __INT_REG_BITS 64 #elif defined __tilepro__ # define __INT_REG_BITS 32 #elif !defined __need_int_reg_t # include <arch/chip.h> # define __INT_REG_BITS CHIP_WORD_SIZE() #else # error Unrecognized architecture with __need_int_reg_t #endif #if __INT_REG_BITS == 64 #ifndef __ASSEMBLER__ /** Unsigned type that can hold a register. */ typedef unsigned long long __uint_reg_t; /** Signed type that can hold a register. */ typedef long long __int_reg_t; #endif /** String prefix to use for printf(). */ #define __INT_REG_FMT "ll" #else #ifndef __ASSEMBLER__ /** Unsigned type that can hold a register. */ typedef unsigned long __uint_reg_t; /** Signed type that can hold a register. */ typedef long __int_reg_t; #endif /** String prefix to use for printf(). */ #define __INT_REG_FMT "l" #endif #endif /* __INT_REG_BITS */ #ifndef __need_int_reg_t #ifndef __ASSEMBLER__ /** Unsigned type that can hold a register. */ typedef __uint_reg_t uint_reg_t; /** Signed type that can hold a register. */ typedef __int_reg_t int_reg_t; #endif /** String prefix to use for printf(). */ #define INT_REG_FMT __INT_REG_FMT /** Number of bits in a register. */ #define INT_REG_BITS __INT_REG_BITS /* Registers 0 - 55 are "normal", but some perform special roles. */ #define TREG_FP 52 /**< Frame pointer. */ #define TREG_TP 53 /**< Thread pointer. */ #define TREG_SP 54 /**< Stack pointer. */ #define TREG_LR 55 /**< Link to calling function PC. */ /** Index of last normal general-purpose register. */ #define TREG_LAST_GPR 55 /* Registers 56 - 62 are "special" network registers. */ #define TREG_SN 56 /**< Static network access. */ #define TREG_IDN0 57 /**< IDN demux 0 access. */ #define TREG_IDN1 58 /**< IDN demux 1 access. */ #define TREG_UDN0 59 /**< UDN demux 0 access. */ #define TREG_UDN1 60 /**< UDN demux 1 access. */ #define TREG_UDN2 61 /**< UDN demux 2 access. */ #define TREG_UDN3 62 /**< UDN demux 3 access. */ /* Register 63 is the "special" zero register. */ #define TREG_ZERO 63 /**< "Zero" register; always reads as "0". */ /** By convention, this register is used to hold the syscall number. */ #define TREG_SYSCALL_NR 10 /** Name of register that holds the syscall number, for use in assembly. */ #define TREG_SYSCALL_NR_NAME r10 /** * The ABI requires callers to allocate a caller state save area of * this many bytes at the bottom of each stack frame. */ #define C_ABI_SAVE_AREA_SIZE (2 * (INT_REG_BITS / 8)) /** * The operand to an 'info' opcode directing the backtracer to not * try to find the calling frame. */ #define INFO_OP_CANNOT_BACKTRACE 2 #endif /* !__need_int_reg_t */ /* Make sure we later can get all the definitions and declarations. */ #undef __need_int_reg_t #endif /* !__ARCH_ABI_H__ */
/* * Picvue PVC160206 display driver * * Brian Murphy <brian.murphy@eicon.com> * */ #include <linux/bug.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include <linux/errno.h> #include <linux/proc_fs.h> #include <linux/seq_file.h> #include <linux/interrupt.h> #include <linux/timer.h> #include <linux/mutex.h> #include "picvue.h" static DEFINE_MUTEX(pvc_mutex); static char pvc_lines[PVC_NLINES][PVC_LINELEN+1]; static int pvc_linedata[PVC_NLINES]; static struct proc_dir_entry *pvc_display_dir; static char *pvc_linename[PVC_NLINES] = {"line1", "line2"}; #define DISPLAY_DIR_NAME "display" static int scroll_dir, scroll_interval; static struct timer_list timer; static void pvc_display(unsigned long data) { int i; pvc_clear(); for (i = 0; i < PVC_NLINES; i++) pvc_write_string(pvc_lines[i], 0, i); } static DECLARE_TASKLET(pvc_display_tasklet, &pvc_display, 0); static int pvc_line_proc_show(struct seq_file *m, void *v) { int lineno = *(int *)m->private; if (lineno < 0 || lineno > PVC_NLINES) { printk(KERN_WARNING "proc_read_line: invalid lineno %d\n", lineno); return 0; } mutex_lock(&pvc_mutex); seq_printf(m, "%s\n", pvc_lines[lineno]); mutex_unlock(&pvc_mutex); return 0; } static int pvc_line_proc_open(struct inode *inode, struct file *file) { return single_open(file, pvc_line_proc_show, PDE(inode)->data); } static ssize_t pvc_line_proc_write(struct file *file, const char __user *buf, size_t count, loff_t *pos) { int lineno = *(int *)PDE(file_inode(file))->data; char kbuf[PVC_LINELEN]; size_t len; BUG_ON(lineno < 0 || lineno > PVC_NLINES); len = min(count, sizeof(kbuf) - 1); if (copy_from_user(kbuf, buf, len)) return -EFAULT; kbuf[len] = '\0'; if (len > 0 && kbuf[len - 1] == '\n') len--; mutex_lock(&pvc_mutex); strncpy(pvc_lines[lineno], kbuf, len); pvc_lines[lineno][len] = '\0'; mutex_unlock(&pvc_mutex); tasklet_schedule(&pvc_display_tasklet); return count; } static const struct file_operations pvc_line_proc_fops = { .owner = THIS_MODULE, .open = pvc_line_proc_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, .write = pvc_line_proc_write, }; static ssize_t pvc_scroll_proc_write(struct file *file, const char __user *buf, size_t count, loff_t *pos) { char kbuf[42]; size_t len; int cmd; len = min(count, sizeof(kbuf) - 1); if (copy_from_user(kbuf, buf, len)) return -EFAULT; kbuf[len] = '\0'; cmd = simple_strtol(kbuf, NULL, 10); mutex_lock(&pvc_mutex); if (scroll_interval != 0) del_timer(&timer); if (cmd == 0) { scroll_dir = 0; scroll_interval = 0; } else { if (cmd < 0) { scroll_dir = -1; scroll_interval = -cmd; } else { scroll_dir = 1; scroll_interval = cmd; } add_timer(&timer); } mutex_unlock(&pvc_mutex); return count; } static int pvc_scroll_proc_show(struct seq_file *m, void *v) { mutex_lock(&pvc_mutex); seq_printf(m, "%d\n", scroll_dir * scroll_interval); mutex_unlock(&pvc_mutex); return 0; } static int pvc_scroll_proc_open(struct inode *inode, struct file *file) { return single_open(file, pvc_scroll_proc_show, NULL); } static const struct file_operations pvc_scroll_proc_fops = { .owner = THIS_MODULE, .open = pvc_scroll_proc_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, .write = pvc_scroll_proc_write, }; void pvc_proc_timerfunc(unsigned long data) { if (scroll_dir < 0) pvc_move(DISPLAY|RIGHT); else if (scroll_dir > 0) pvc_move(DISPLAY|LEFT); timer.expires = jiffies + scroll_interval; add_timer(&timer); } static void pvc_proc_cleanup(void) { int i; for (i = 0; i < PVC_NLINES; i++) remove_proc_entry(pvc_linename[i], pvc_display_dir); remove_proc_entry("scroll", pvc_display_dir); remove_proc_entry(DISPLAY_DIR_NAME, NULL); del_timer(&timer); } static int __init pvc_proc_init(void) { struct proc_dir_entry *proc_entry; int i; pvc_display_dir = proc_mkdir(DISPLAY_DIR_NAME, NULL); if (pvc_display_dir == NULL) goto error; for (i = 0; i < PVC_NLINES; i++) { strcpy(pvc_lines[i], ""); pvc_linedata[i] = i; } for (i = 0; i < PVC_NLINES; i++) { proc_entry = proc_create_data(pvc_linename[i], 0644, pvc_display_dir, &pvc_line_proc_fops, &pvc_linedata[i]); if (proc_entry == NULL) goto error; } proc_entry = proc_create("scroll", 0644, pvc_display_dir, &pvc_scroll_proc_fops); if (proc_entry == NULL) goto error; init_timer(&timer); timer.function = pvc_proc_timerfunc; return 0; error: pvc_proc_cleanup(); return -ENOMEM; } module_init(pvc_proc_init); module_exit(pvc_proc_cleanup); MODULE_LICENSE("GPL");
/* * linux/kernel/irq/handle.c * * Copyright (C) 1992, 1998-2006 Linus Torvalds, Ingo Molnar * Copyright (C) 2005-2006, Thomas Gleixner, Russell King * * This file contains the core interrupt handling code. * * Detailed information is available in Documentation/DocBook/genericirq * */ #include <linux/irq.h> #include <linux/random.h> #include <linux/sched.h> #include <linux/interrupt.h> #include <linux/kernel_stat.h> #include <trace/events/irq.h> #include "internals.h" /** * handle_bad_irq - handle spurious and unhandled irqs * @irq: the interrupt number * @desc: description of the interrupt * * Handles spurious and unhandled IRQ's. It also prints a debugmessage. */ void handle_bad_irq(unsigned int irq, struct irq_desc *desc) { print_irq_desc(irq, desc); kstat_incr_irqs_this_cpu(desc); ack_bad_irq(irq); } /* * Special, empty irq handler: */ irqreturn_t no_action(int cpl, void *dev_id) { return IRQ_NONE; } EXPORT_SYMBOL_GPL(no_action); static void warn_no_thread(unsigned int irq, struct irqaction *action) { if (test_and_set_bit(IRQTF_WARNED, &action->thread_flags)) return; printk(KERN_WARNING "IRQ %d device %s returned IRQ_WAKE_THREAD " "but no thread function available.", irq, action->name); } void __irq_wake_thread(struct irq_desc *desc, struct irqaction *action) { /* * In case the thread crashed and was killed we just pretend that * we handled the interrupt. The hardirq handler has disabled the * device interrupt, so no irq storm is lurking. */ if (action->thread->flags & PF_EXITING) return; /* * Wake up the handler thread for this action. If the * RUNTHREAD bit is already set, nothing to do. */ if (test_and_set_bit(IRQTF_RUNTHREAD, &action->thread_flags)) return; /* * It's safe to OR the mask lockless here. We have only two * places which write to threads_oneshot: This code and the * irq thread. * * This code is the hard irq context and can never run on two * cpus in parallel. If it ever does we have more serious * problems than this bitmask. * * The irq threads of this irq which clear their "running" bit * in threads_oneshot are serialized via desc->lock against * each other and they are serialized against this code by * IRQS_INPROGRESS. * * Hard irq handler: * * spin_lock(desc->lock); * desc->state |= IRQS_INPROGRESS; * spin_unlock(desc->lock); * set_bit(IRQTF_RUNTHREAD, &action->thread_flags); * desc->threads_oneshot |= mask; * spin_lock(desc->lock); * desc->state &= ~IRQS_INPROGRESS; * spin_unlock(desc->lock); * * irq thread: * * again: * spin_lock(desc->lock); * if (desc->state & IRQS_INPROGRESS) { * spin_unlock(desc->lock); * while(desc->state & IRQS_INPROGRESS) * cpu_relax(); * goto again; * } * if (!test_bit(IRQTF_RUNTHREAD, &action->thread_flags)) * desc->threads_oneshot &= ~mask; * spin_unlock(desc->lock); * * So either the thread waits for us to clear IRQS_INPROGRESS * or we are waiting in the flow handler for desc->lock to be * released before we reach this point. The thread also checks * IRQTF_RUNTHREAD under desc->lock. If set it leaves * threads_oneshot untouched and runs the thread another time. */ desc->threads_oneshot |= action->thread_mask; /* * We increment the threads_active counter in case we wake up * the irq thread. The irq thread decrements the counter when * it returns from the handler or in the exit path and wakes * up waiters which are stuck in synchronize_irq() when the * active count becomes zero. synchronize_irq() is serialized * against this code (hard irq handler) via IRQS_INPROGRESS * like the finalize_oneshot() code. See comment above. */ atomic_inc(&desc->threads_active); wake_up_process(action->thread); } irqreturn_t handle_irq_event_percpu(struct irq_desc *desc, struct irqaction *action) { irqreturn_t retval = IRQ_NONE; unsigned int flags = 0, irq = desc->irq_data.irq; do { irqreturn_t res; trace_irq_handler_entry(irq, action); res = action->handler(irq, action->dev_id); trace_irq_handler_exit(irq, action, res); if (WARN_ONCE(!irqs_disabled(),"irq %u handler %pF enabled interrupts\n", irq, action->handler)) local_irq_disable(); switch (res) { case IRQ_WAKE_THREAD: /* * Catch drivers which return WAKE_THREAD but * did not set up a thread function */ if (unlikely(!action->thread_fn)) { warn_no_thread(irq, action); break; } __irq_wake_thread(desc, action); /* Fall through to add to randomness */ case IRQ_HANDLED: flags |= action->flags; break; default: break; } retval |= res; action = action->next; } while (action); add_interrupt_randomness(irq, flags); if (!noirqdebug) note_interrupt(desc, retval); return retval; } irqreturn_t handle_irq_event(struct irq_desc *desc) { struct irqaction *action = desc->action; irqreturn_t ret; desc->istate &= ~IRQS_PENDING; irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS); raw_spin_unlock(&desc->lock); ret = handle_irq_event_percpu(desc, action); raw_spin_lock(&desc->lock); irqd_clear(&desc->irq_data, IRQD_IRQ_INPROGRESS); return ret; }
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_COMMON_ZYGOTE_COMMANDS_LINUX_H_ #define CONTENT_COMMON_ZYGOTE_COMMANDS_LINUX_H_ #include "base/posix/global_descriptors.h" #include "ipc/ipc_descriptors.h" namespace content { // Contents of the initial message sent from the zygote to the browser right // after it starts. static const char kZygoteBootMessage[] = "ZYGOTE_BOOT"; // Contents of the initial message sent from the zygote to the browser when it // is ready to go. static const char kZygoteHelloMessage[] = "ZYGOTE_OK"; // Message sent by zygote children to the browser so the browser can discover // the sending child's process ID. static const char kZygoteChildPingMessage[] = "CHILD_PING"; // Maximum allowable length for messages sent to the zygote. const size_t kZygoteMaxMessageLength = 8192; // File descriptors initialized by the Zygote Host const int kZygoteSocketPairFd = kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor; // These are the command codes used on the wire between the browser and the // zygote. enum { // Fork off a new renderer. kZygoteCommandFork = 0, // Reap a renderer child. kZygoteCommandReap = 1, // Check what happened to a child process. kZygoteCommandGetTerminationStatus = 2, // Read a bitmask of kSandboxLinux* kZygoteCommandGetSandboxStatus = 3, // Not a real zygote command, but a subcommand used during the zygote fork // protocol. Sends the child's PID as seen from the browser process. kZygoteCommandForkRealPID = 4 }; } // namespace content #endif // CONTENT_COMMON_ZYGOTE_COMMANDS_LINUX_H_
/* Test AAPCS layout (alignment) for callee. */ /* { dg-do run { target arm_eabi } } */ /* { dg-require-effective-target arm32 } */ /* { dg-options "-O2 -fno-inline" } */ /* Test AAPCS layout (alignment) for callee. */ extern int memcmp (const void *s1, const void *s2, __SIZE_TYPE__ n); extern void abort (void); /* Struct will be aligned to 8. */ struct s { int x; /* 4 bytes padding here. */ __attribute__((aligned (8))) int y; /* 4 bytes padding here. */ }; typedef struct s __attribute__((aligned (4))) underaligned; underaligned a = { 1, 4 }; underaligned b = { 9, 16 }; void f (int r0, underaligned r2, int stack8, underaligned stack16) { if (r0 != 3 || stack8 != 6) abort (); if (memcmp ((void *) &r2, (void *)&a, sizeof (underaligned))) abort (); if (memcmp ((void *)&stack16, (void *)&b, sizeof (underaligned))) abort (); } int main (int argc, char **argv) { f (3, a, 6, b); return 0; }
#include "tacho_mb.h" #include "LPC21xx.h" uint32_t t_duration; /* INPUT CAPTURE CAP0.0 on P0.22*/ #define TACHO_MB_PINSEL PINSEL1 #define TACHO_MB_PINSEL_VAL 0x02 #define TACHO_MB_PINSEL_BIT 12 void tacho_mb_init(void) { /* select pin for capture */ TACHO_MB_PINSEL |= TACHO_MB_PINSEL_VAL << TACHO_MB_PINSEL_BIT; /* enable capture 0.2 on falling edge + trigger interrupt */ T0CCR |= TCCR_CR0_F | TCCR_CR0_I; }
/* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <nks/fsio.h> #include "apr_arch_file_io.h" apr_status_t apr_file_lock(apr_file_t *thefile, int type) { int fc; fc = (type & APR_FLOCK_NONBLOCK) ? NX_RANGE_LOCK_TRYLOCK : NX_RANGE_LOCK_CHECK; if(NXFileRangeLock(thefile->filedes,fc, 0, 0) == -1) return errno; return APR_SUCCESS; } apr_status_t apr_file_unlock(apr_file_t *thefile) { if(NXFileRangeUnlock(thefile->filedes,NX_RANGE_LOCK_CANCEL,0 , 0) == -1) return errno; return APR_SUCCESS; }
/* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef __PMIC8XXX_CCADC_H__ #define __PMIC8XXX_CCADC_H__ #include <linux/mfd/pm8xxx/core.h> #define PM8XXX_CCADC_DEV_NAME "pm8xxx-ccadc" struct pm8xxx_ccadc_platform_data { int r_sense; unsigned int calib_delay_ms; }; #define CCADC_READING_RESOLUTION_N 542535 #define CCADC_READING_RESOLUTION_D 100000 static inline s64 pm8xxx_ccadc_reading_to_microvolt(int revision, s64 cc) { return div_s64(cc * CCADC_READING_RESOLUTION_N, CCADC_READING_RESOLUTION_D); } #if defined(CONFIG_PM8XXX_CCADC) || defined(CONFIG_PM8XXX_CCADC_MODULE) s64 pm8xxx_cc_adjust_for_gain(s64 uv); void pm8xxx_calib_ccadc(void); int pm8xxx_ccadc_get_battery_current(int *bat_current); int pm8xxx_ccadc_dump_all(void); int pm8xxx_ccadc_get_attr_text(char *buf, int size); #else static inline s64 pm8xxx_cc_adjust_for_gain(s64 uv) { return -ENXIO; } static inline void pm8xxx_calib_ccadc(void) { } static inline int pm8xxx_ccadc_get_battery_current(int *bat_current) { return -ENXIO; } static inline int pm8xxx_ccadc_dump_all(void) { return -ENXIO; } static inline int pm8xxx_ccadc_get_attr_text(char *buf, int size) { return 0; } #endif #endif
/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef __ARCH_ARM_MACH_MSM_BOARD_MSM8930_H #define __ARCH_ARM_MACH_MSM_BOARD_MSM8930_H #include <linux/regulator/gpio-regulator.h> #include <linux/mfd/pm8xxx/pm8038.h> #include <linux/i2c.h> #include <linux/i2c/sx150x.h> #include <mach/irqs.h> #include <mach/rpm-regulator.h> #include <mach/msm_memtypes.h> /* * TODO: When physical 8930/PM8038 hardware becomes * available, remove this block. */ #ifndef MSM8930_PHASE_2 #include <linux/mfd/pm8xxx/pm8921.h> #define PM8921_GPIO_BASE NR_GPIO_IRQS #define PM8921_GPIO_PM_TO_SYS(pm_gpio) (pm_gpio - 1 + PM8921_GPIO_BASE) #define PM8921_MPP_BASE (PM8921_GPIO_BASE + PM8921_NR_GPIOS) #define PM8921_MPP_PM_TO_SYS(pm_gpio) (pm_gpio - 1 + PM8921_MPP_BASE) #endif /* Macros assume PMIC GPIOs and MPPs start at 1 */ #define PM8038_GPIO_BASE NR_GPIO_IRQS #define PM8038_GPIO_PM_TO_SYS(pm_gpio) (pm_gpio - 1 + PM8038_GPIO_BASE) #define PM8038_MPP_BASE (PM8038_GPIO_BASE + PM8038_NR_GPIOS) #define PM8038_MPP_PM_TO_SYS(pm_gpio) (pm_gpio - 1 + PM8038_MPP_BASE) #define PM8038_IRQ_BASE (NR_MSM_IRQS + NR_GPIO_IRQS) /* * TODO: When physical 8930/PM8038 hardware becomes * available, replace this block with 8930/pm8038 regulator * declarations. */ #ifndef MSM8930_PHASE_2 extern struct pm8xxx_regulator_platform_data msm_pm8921_regulator_pdata[] __devinitdata; extern int msm_pm8921_regulator_pdata_len __devinitdata; extern struct gpio_regulator_platform_data msm_gpio_regulator_pdata[] __devinitdata; extern struct rpm_regulator_platform_data msm_rpm_regulator_pdata __devinitdata; #define GPIO_VREG_ID_EXT_5V 0 #define GPIO_VREG_ID_EXT_L2 1 #define GPIO_VREG_ID_EXT_3P3V 2 #endif extern struct regulator_init_data msm8930_saw_regulator_core0_pdata; extern struct regulator_init_data msm8930_saw_regulator_core1_pdata; extern struct pm8xxx_regulator_platform_data msm8930_pm8038_regulator_pdata[] __devinitdata; extern int msm8930_pm8038_regulator_pdata_len __devinitdata; #define MSM8930_GPIO_VREG_ID_EXT_5V 0 #define MSM8930_GPIO_VREG_ID_EXT_OTG_SW 1 extern struct gpio_regulator_platform_data msm8930_gpio_regulator_pdata[] __devinitdata; #if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE) enum { GPIO_EXPANDER_IRQ_BASE = (PM8038_IRQ_BASE + PM8038_NR_IRQS), GPIO_EXPANDER_GPIO_BASE = (PM8038_MPP_BASE + PM8038_NR_MPPS), /* CAM Expander */ GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE, GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE, GPIO_CAM_GP_AFBUSY, GPIO_CAM_GP_STROBE_CE, GPIO_CAM_GP_CAM1MP_XCLR, GPIO_CAM_GP_CAMIF_RESET_N, GPIO_CAM_GP_XMT_FLASH_INT, GPIO_CAM_GP_LED_EN1, GPIO_CAM_GP_LED_EN2, }; #endif enum { SX150X_CAM, }; #endif extern struct sx150x_platform_data msm8930_sx150x_data[]; extern struct msm_camera_board_info msm8930_camera_board_info; void msm8930_init_cam(void); void msm8930_init_fb(void); void msm8930_init_pmic(void); /* * TODO: When physical 8930/PM8038 hardware becomes * available, remove this block or add the config * option. */ #ifndef MSM8930_PHASE_2 void msm8960_init_pmic(void); void msm8960_pm8921_gpio_mpp_init(void); #endif void msm8930_init_mmc(void); int msm8930_init_gpiomux(void); void msm8930_allocate_fb_region(void); void msm8930_pm8038_gpio_mpp_init(void); void msm8930_mdp_writeback(struct memtype_reserve *reserve_table); #define PLATFORM_IS_CHARM25() \ (machine_is_msm8930_cdp() && \ (socinfo_get_platform_subtype() == 1) \ ) #define MSM_8930_GSBI4_QUP_I2C_BUS_ID 4 #define MSM_8930_GSBI3_QUP_I2C_BUS_ID 3 #define MSM_8930_GSBI10_QUP_I2C_BUS_ID 10
/* src/include/port/darwin.h */ #define __darwin__ 1 #if HAVE_DECL_F_FULLFSYNC /* not present before OS X 10.3 */ #define HAVE_FSYNC_WRITETHROUGH #endif
/* * This header provides constants for configuring the I.MX25 ADC */ #ifndef _DT_BINDINGS_IIO_ADC_FS_IMX25_GCQ_H #define _DT_BINDINGS_IIO_ADC_FS_IMX25_GCQ_H #define MX25_ADC_REFP_YP 0 /* YP voltage reference */ #define MX25_ADC_REFP_XP 1 /* XP voltage reference */ #define MX25_ADC_REFP_EXT 2 /* External voltage reference */ #define MX25_ADC_REFP_INT 3 /* Internal voltage reference */ #define MX25_ADC_REFN_XN 0 /* XN ground reference */ #define MX25_ADC_REFN_YN 1 /* YN ground reference */ #define MX25_ADC_REFN_NGND 2 /* Internal ground reference */ #define MX25_ADC_REFN_NGND2 3 /* External ground reference */ #endif
/* * Copyright (C) 2010-2012 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence. * * A copy of the licence is included with the program, and can also be obtained from Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __MALI_OSK_PROFILING_H__ #define __MALI_OSK_PROFILING_H__ #if defined(CONFIG_MALI400_PROFILING) && defined (CONFIG_TRACEPOINTS) #include "mali_linux_trace.h" #include "mali_profiling_events.h" #define MALI_PROFILING_MAX_BUFFER_ENTRIES 1048576 #define MALI_PROFILING_NO_HW_COUNTER = ((u32)-1) /** @defgroup _mali_osk_profiling External profiling connectivity * @{ */ /** * Initialize the profiling module. * @return _MALI_OSK_ERR_OK on success, otherwise failure. */ _mali_osk_errcode_t _mali_osk_profiling_init(mali_bool auto_start); /* * Terminate the profiling module. */ void _mali_osk_profiling_term(void); /** * Start recording profiling data * * The specified limit will determine how large the capture buffer is. * MALI_PROFILING_MAX_BUFFER_ENTRIES determines the maximum size allowed by the device driver. * * @param limit The desired maximum number of events to record on input, the actual maximum on output. * @return _MALI_OSK_ERR_OK on success, otherwise failure. */ _mali_osk_errcode_t _mali_osk_profiling_start(u32 * limit); /** * Add an profiling event * * @param event_id The event identificator. * @param data0 First data parameter, depending on event_id specified. * @param data1 Second data parameter, depending on event_id specified. * @param data2 Third data parameter, depending on event_id specified. * @param data3 Fourth data parameter, depending on event_id specified. * @param data4 Fifth data parameter, depending on event_id specified. * @return _MALI_OSK_ERR_OK on success, otherwise failure. */ /* Call Linux tracepoint directly */ #define _mali_osk_profiling_add_event(event_id, data0, data1, data2, data3, data4) trace_mali_timeline_event((event_id), (data0), (data1), (data2), (data3), (data4)) /** * Report a hardware counter event. * * @param counter_id The ID of the counter. * @param value The value of the counter. */ /* Call Linux tracepoint directly */ #define _mali_osk_profiling_report_hw_counter(counter_id, value) trace_mali_hw_counter(counter_id, value) /** * Report SW counters * * @param counters array of counter values */ void _mali_osk_profiling_report_sw_counters(u32 *counters); /** * Stop recording profiling data * * @param count Returns the number of recorded events. * @return _MALI_OSK_ERR_OK on success, otherwise failure. */ _mali_osk_errcode_t _mali_osk_profiling_stop(u32 * count); /** * Retrieves the number of events that can be retrieved * * @return The number of recorded events that can be retrieved. */ u32 _mali_osk_profiling_get_count(void); /** * Retrieve an event * * @param index Event index (start with 0 and continue until this function fails to retrieve all events) * @param timestamp The timestamp for the retrieved event will be stored here. * @param event_id The event ID for the retrieved event will be stored here. * @param data The 5 data values for the retrieved event will be stored here. * @return _MALI_OSK_ERR_OK on success, otherwise failure. */ _mali_osk_errcode_t _mali_osk_profiling_get_event(u32 index, u64* timestamp, u32* event_id, u32 data[5]); /** * Clear the recorded buffer. * * This is needed in order to start another recording. * * @return _MALI_OSK_ERR_OK on success, otherwise failure. */ _mali_osk_errcode_t _mali_osk_profiling_clear(void); /** * Checks if a recording of profiling data is in progress * * @return MALI_TRUE if recording of profiling data is in progress, MALI_FALSE if not */ mali_bool _mali_osk_profiling_is_recording(void); /** * Checks if profiling data is available for retrival * * @return MALI_TRUE if profiling data is avaiable, MALI_FALSE if not */ mali_bool _mali_osk_profiling_have_recording(void); /** @} */ /* end group _mali_osk_profiling */ #else /* defined(CONFIG_MALI400_PROFILING) && defined(CONFIG_TRACEPOINTS) */ /* Dummy add_event, for when profiling is disabled. */ #define _mali_osk_profiling_add_event(event_id, data0, data1, data2, data3, data4) #endif /* defined(CONFIG_MALI400_PROFILING) && defined(CONFIG_TRACEPOINTS) */ #endif /* __MALI_OSK_PROFILING_H__ */
// SPDX-License-Identifier: GPL-2.0 /* * arch/alpha/lib/dec_and_lock.c * * ll/sc version of atomic_dec_and_lock() * */ #include <linux/spinlock.h> #include <linux/atomic.h> #include <linux/export.h> asm (".text \n\ .global _atomic_dec_and_lock \n\ .ent _atomic_dec_and_lock \n\ .align 4 \n\ _atomic_dec_and_lock: \n\ .prologue 0 \n\ 1: ldl_l $1, 0($16) \n\ subl $1, 1, $1 \n\ beq $1, 2f \n\ stl_c $1, 0($16) \n\ beq $1, 4f \n\ mb \n\ clr $0 \n\ ret \n\ 2: br $29, 3f \n\ 3: ldgp $29, 0($29) \n\ br $atomic_dec_and_lock_1..ng \n\ .subsection 2 \n\ 4: br 1b \n\ .previous \n\ .end _atomic_dec_and_lock"); static int __used atomic_dec_and_lock_1(atomic_t *atomic, spinlock_t *lock) { /* Slow path */ spin_lock(lock); if (atomic_dec_and_test(atomic)) return 1; spin_unlock(lock); return 0; } EXPORT_SYMBOL(_atomic_dec_and_lock);
// TR1 fenv.h -*- C++ -*- // Copyright (C) 2006-2014 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 3, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/fenv.h * This is a TR1 C++ Library header. */ #ifndef _TR1_FENV_H #define _TR1_FENV_H 1 #include <tr1/cfenv> #endif
/* * include/linux/nfsd/export.h * * Public declarations for NFS exports. The definitions for the * syscall interface are in nfsctl.h * * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> */ #ifndef _UAPINFSD_EXPORT_H #define _UAPINFSD_EXPORT_H # include <linux/types.h> /* * Important limits for the exports stuff. */ #define NFSCLNT_IDMAX 1024 #define NFSCLNT_ADDRMAX 16 #define NFSCLNT_KEYMAX 32 /* * Export flags. * * Please update the expflags[] array in fs/nfsd/export.c when adding * a new flag. */ #define NFSEXP_READONLY 0x0001 #define NFSEXP_INSECURE_PORT 0x0002 #define NFSEXP_ROOTSQUASH 0x0004 #define NFSEXP_ALLSQUASH 0x0008 #define NFSEXP_ASYNC 0x0010 #define NFSEXP_GATHERED_WRITES 0x0020 #define NFSEXP_NOREADDIRPLUS 0x0040 #define NFSEXP_SECURITY_LABEL 0x0080 /* 0x100 currently unused */ #define NFSEXP_NOHIDE 0x0200 #define NFSEXP_NOSUBTREECHECK 0x0400 #define NFSEXP_NOAUTHNLM 0x0800 /* Don't authenticate NLM requests - just trust */ #define NFSEXP_MSNFS 0x1000 /* do silly things that MS clients expect; no longer supported */ #define NFSEXP_FSID 0x2000 #define NFSEXP_CROSSMOUNT 0x4000 #define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */ /* * The NFSEXP_V4ROOT flag causes the kernel to give access only to NFSv4 * clients, and only to the single directory that is the root of the * export; further lookup and readdir operations are treated as if every * subdirectory was a mountpoint, and ignored if they are not themselves * exported. This is used by nfsd and mountd to construct the NFSv4 * pseudofilesystem, which provides access only to paths leading to each * exported filesystem. */ #define NFSEXP_V4ROOT 0x10000 #define NFSEXP_PNFS 0x20000 /* All flags that we claim to support. (Note we don't support NOACL.) */ #define NFSEXP_ALLFLAGS 0x3FEFF /* The flags that may vary depending on security flavor: */ #define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \ | NFSEXP_ALLSQUASH \ | NFSEXP_INSECURE_PORT) #endif /* _UAPINFSD_EXPORT_H */
/*- * Copyright (c) 2006 Joseph Koshy * All rights reserved. * * 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. */ #include <limits.h> #include "gelf.h" #include "libelf.h" #include "_libelf.h" Elf32_Phdr * elf32_getphdr(Elf *e) { return (_libelf_getphdr(e, ELFCLASS32)); } Elf64_Phdr * elf64_getphdr(Elf *e) { return (_libelf_getphdr(e, ELFCLASS64)); } GElf_Phdr * gelf_getphdr(Elf *e, int index, GElf_Phdr *d) { int ec; Elf32_Ehdr *eh32; Elf64_Ehdr *eh64; Elf32_Phdr *ep32; Elf64_Phdr *ep64; if (d == NULL || e == NULL || ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64) || (e->e_kind != ELF_K_ELF) || index < 0) { LIBELF_SET_ERROR(ARGUMENT, 0); return (NULL); } if (ec == ELFCLASS32) { if ((eh32 = _libelf_ehdr(e, ELFCLASS32, 0)) == NULL || ((ep32 = _libelf_getphdr(e, ELFCLASS32)) == NULL)) return (NULL); if (index >= eh32->e_phnum) { LIBELF_SET_ERROR(ARGUMENT, 0); return (NULL); } ep32 += index; d->p_type = ep32->p_type; d->p_offset = ep32->p_offset; d->p_vaddr = (Elf64_Addr) ep32->p_vaddr; d->p_paddr = (Elf64_Addr) ep32->p_paddr; d->p_filesz = (Elf64_Xword) ep32->p_filesz; d->p_memsz = (Elf64_Xword) ep32->p_memsz; d->p_flags = ep32->p_flags; d->p_align = (Elf64_Xword) ep32->p_align; } else { if ((eh64 = _libelf_ehdr(e, ELFCLASS64, 0)) == NULL || (ep64 = _libelf_getphdr(e, ELFCLASS64)) == NULL) return (NULL); if (index >= eh64->e_phnum) { LIBELF_SET_ERROR(ARGUMENT, 0); return (NULL); } ep64 += index; *d = *ep64; } return (d); } Elf32_Phdr * elf32_newphdr(Elf *e, size_t count) { return (_libelf_newphdr(e, ELFCLASS32, count)); } Elf64_Phdr * elf64_newphdr(Elf *e, size_t count) { return (_libelf_newphdr(e, ELFCLASS64, count)); } void * gelf_newphdr(Elf *e, size_t count) { if (e == NULL) { LIBELF_SET_ERROR(ARGUMENT, 0); return (NULL); } return (_libelf_newphdr(e, e->e_class, count)); } int gelf_update_phdr(Elf *e, int ndx, GElf_Phdr *s) { int ec, phnum; void *ehdr; Elf32_Phdr *ph32; Elf64_Phdr *ph64; if (s == NULL || e == NULL || e->e_kind != ELF_K_ELF || ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64)) { LIBELF_SET_ERROR(ARGUMENT, 0); return (0); } if (e->e_cmd == ELF_C_READ) { LIBELF_SET_ERROR(MODE, 0); return (0); } if ((ehdr = _libelf_ehdr(e, ec, 0)) == NULL) return (0); if (ec == ELFCLASS32) phnum = ((Elf32_Ehdr *) ehdr)->e_phnum; else phnum = ((Elf64_Ehdr *) ehdr)->e_phnum; if (ndx < 0 || ndx > phnum) { LIBELF_SET_ERROR(ARGUMENT, 0); return (0); } if (ec == ELFCLASS64) { ph64 = e->e_u.e_elf.e_phdr.e_phdr64 + ndx; *ph64 = *s; return (1); } ph32 = e->e_u.e_elf.e_phdr.e_phdr32 + ndx; ph32->p_type = s->p_type; ph32->p_flags = s->p_flags; LIBELF_COPY_U32(ph32, s, p_offset); LIBELF_COPY_U32(ph32, s, p_vaddr); LIBELF_COPY_U32(ph32, s, p_paddr); LIBELF_COPY_U32(ph32, s, p_filesz); LIBELF_COPY_U32(ph32, s, p_memsz); LIBELF_COPY_U32(ph32, s, p_align); (void) elf_flagphdr(e, ELF_C_SET, ELF_F_DIRTY); return (1); }
/* { dg-do compile { target powerpc*-*-* } } */ /* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-options "-O -maltivec -mno-vsx" } */ /* { dg-final { scan-assembler "lvx" } } */ #include <string.h> void bar (int *); void foo(void) { extern int x[8] __attribute__((aligned(128))); int y[8] __attribute__((aligned(128))); memcpy (y, x, sizeof (x)); bar (y); }
// SPDX-License-Identifier: GPL-2.0 #include <linux/arm-smccc.h> #include <linux/kernel.h> #include <linux/smp.h> #include <asm/cp15.h> #include <asm/cputype.h> #include <asm/proc-fns.h> #include <asm/system_misc.h> #ifdef CONFIG_HARDEN_BRANCH_PREDICTOR DEFINE_PER_CPU(harden_branch_predictor_fn_t, harden_branch_predictor_fn); extern void cpu_v7_iciallu_switch_mm(phys_addr_t pgd_phys, struct mm_struct *mm); extern void cpu_v7_bpiall_switch_mm(phys_addr_t pgd_phys, struct mm_struct *mm); extern void cpu_v7_smc_switch_mm(phys_addr_t pgd_phys, struct mm_struct *mm); extern void cpu_v7_hvc_switch_mm(phys_addr_t pgd_phys, struct mm_struct *mm); static void harden_branch_predictor_bpiall(void) { write_sysreg(0, BPIALL); } static void harden_branch_predictor_iciallu(void) { write_sysreg(0, ICIALLU); } static void __maybe_unused call_smc_arch_workaround_1(void) { arm_smccc_1_1_smc(ARM_SMCCC_ARCH_WORKAROUND_1, NULL); } static void __maybe_unused call_hvc_arch_workaround_1(void) { arm_smccc_1_1_hvc(ARM_SMCCC_ARCH_WORKAROUND_1, NULL); } static void cpu_v7_spectre_init(void) { const char *spectre_v2_method = NULL; int cpu = smp_processor_id(); if (per_cpu(harden_branch_predictor_fn, cpu)) return; switch (read_cpuid_part()) { case ARM_CPU_PART_CORTEX_A8: case ARM_CPU_PART_CORTEX_A9: case ARM_CPU_PART_CORTEX_A12: case ARM_CPU_PART_CORTEX_A17: case ARM_CPU_PART_CORTEX_A73: case ARM_CPU_PART_CORTEX_A75: per_cpu(harden_branch_predictor_fn, cpu) = harden_branch_predictor_bpiall; spectre_v2_method = "BPIALL"; break; case ARM_CPU_PART_CORTEX_A15: case ARM_CPU_PART_BRAHMA_B15: per_cpu(harden_branch_predictor_fn, cpu) = harden_branch_predictor_iciallu; spectre_v2_method = "ICIALLU"; break; #ifdef CONFIG_ARM_PSCI case ARM_CPU_PART_BRAHMA_B53: /* Requires no workaround */ break; default: /* Other ARM CPUs require no workaround */ if (read_cpuid_implementor() == ARM_CPU_IMP_ARM) break; /* fallthrough */ /* Cortex A57/A72 require firmware workaround */ case ARM_CPU_PART_CORTEX_A57: case ARM_CPU_PART_CORTEX_A72: { struct arm_smccc_res res; arm_smccc_1_1_invoke(ARM_SMCCC_ARCH_FEATURES_FUNC_ID, ARM_SMCCC_ARCH_WORKAROUND_1, &res); if ((int)res.a0 != 0) return; switch (arm_smccc_1_1_get_conduit()) { case SMCCC_CONDUIT_HVC: per_cpu(harden_branch_predictor_fn, cpu) = call_hvc_arch_workaround_1; cpu_do_switch_mm = cpu_v7_hvc_switch_mm; spectre_v2_method = "hypervisor"; break; case SMCCC_CONDUIT_SMC: per_cpu(harden_branch_predictor_fn, cpu) = call_smc_arch_workaround_1; cpu_do_switch_mm = cpu_v7_smc_switch_mm; spectre_v2_method = "firmware"; break; default: break; } } #endif } if (spectre_v2_method) pr_info("CPU%u: Spectre v2: using %s workaround\n", smp_processor_id(), spectre_v2_method); } #else static void cpu_v7_spectre_init(void) { } #endif static __maybe_unused bool cpu_v7_check_auxcr_set(bool *warned, u32 mask, const char *msg) { u32 aux_cr; asm("mrc p15, 0, %0, c1, c0, 1" : "=r" (aux_cr)); if ((aux_cr & mask) != mask) { if (!*warned) pr_err("CPU%u: %s", smp_processor_id(), msg); *warned = true; return false; } return true; } static DEFINE_PER_CPU(bool, spectre_warned); static bool check_spectre_auxcr(bool *warned, u32 bit) { return IS_ENABLED(CONFIG_HARDEN_BRANCH_PREDICTOR) && cpu_v7_check_auxcr_set(warned, bit, "Spectre v2: firmware did not set auxiliary control register IBE bit, system vulnerable\n"); } void cpu_v7_ca8_ibe(void) { if (check_spectre_auxcr(this_cpu_ptr(&spectre_warned), BIT(6))) cpu_v7_spectre_init(); } void cpu_v7_ca15_ibe(void) { if (check_spectre_auxcr(this_cpu_ptr(&spectre_warned), BIT(0))) cpu_v7_spectre_init(); } void cpu_v7_bugs_init(void) { cpu_v7_spectre_init(); }
/* * Copyright (c) 2000-2006 Silicon Graphics, Inc. * Copyright (c) 2012-2013 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "xfs.h" #include "xfs_fs.h" #include "xfs_format.h" #include "xfs_log_format.h" #include "xfs_shared.h" #include "xfs_trans_resv.h" #include "xfs_mount.h" #include "xfs_bmap_btree.h" #include "xfs_inode.h" #include "xfs_error.h" #include "xfs_trace.h" #include "xfs_symlink.h" #include "xfs_cksum.h" #include "xfs_trans.h" #include "xfs_buf_item.h" #include "xfs_log.h" /* * Each contiguous block has a header, so it is not just a simple pathlen * to FSB conversion. */ int xfs_symlink_blocks( struct xfs_mount *mp, int pathlen) { int buflen = XFS_SYMLINK_BUF_SPACE(mp, mp->m_sb.sb_blocksize); return (pathlen + buflen - 1) / buflen; } int xfs_symlink_hdr_set( struct xfs_mount *mp, xfs_ino_t ino, uint32_t offset, uint32_t size, struct xfs_buf *bp) { struct xfs_dsymlink_hdr *dsl = bp->b_addr; if (!xfs_sb_version_hascrc(&mp->m_sb)) return 0; memset(dsl, 0, sizeof(struct xfs_dsymlink_hdr)); dsl->sl_magic = cpu_to_be32(XFS_SYMLINK_MAGIC); dsl->sl_offset = cpu_to_be32(offset); dsl->sl_bytes = cpu_to_be32(size); uuid_copy(&dsl->sl_uuid, &mp->m_sb.sb_meta_uuid); dsl->sl_owner = cpu_to_be64(ino); dsl->sl_blkno = cpu_to_be64(bp->b_bn); bp->b_ops = &xfs_symlink_buf_ops; return sizeof(struct xfs_dsymlink_hdr); } /* * Checking of the symlink header is split into two parts. the verifier does * CRC, location and bounds checking, the unpacking function checks the path * parameters and owner. */ bool xfs_symlink_hdr_ok( xfs_ino_t ino, uint32_t offset, uint32_t size, struct xfs_buf *bp) { struct xfs_dsymlink_hdr *dsl = bp->b_addr; if (offset != be32_to_cpu(dsl->sl_offset)) return false; if (size != be32_to_cpu(dsl->sl_bytes)) return false; if (ino != be64_to_cpu(dsl->sl_owner)) return false; /* ok */ return true; } static bool xfs_symlink_verify( struct xfs_buf *bp) { struct xfs_mount *mp = bp->b_target->bt_mount; struct xfs_dsymlink_hdr *dsl = bp->b_addr; if (!xfs_sb_version_hascrc(&mp->m_sb)) return false; if (dsl->sl_magic != cpu_to_be32(XFS_SYMLINK_MAGIC)) return false; if (!uuid_equal(&dsl->sl_uuid, &mp->m_sb.sb_meta_uuid)) return false; if (bp->b_bn != be64_to_cpu(dsl->sl_blkno)) return false; if (be32_to_cpu(dsl->sl_offset) + be32_to_cpu(dsl->sl_bytes) >= MAXPATHLEN) return false; if (dsl->sl_owner == 0) return false; if (!xfs_log_check_lsn(mp, be64_to_cpu(dsl->sl_lsn))) return false; return true; } static void xfs_symlink_read_verify( struct xfs_buf *bp) { struct xfs_mount *mp = bp->b_target->bt_mount; /* no verification of non-crc buffers */ if (!xfs_sb_version_hascrc(&mp->m_sb)) return; if (!xfs_buf_verify_cksum(bp, XFS_SYMLINK_CRC_OFF)) xfs_buf_ioerror(bp, -EFSBADCRC); else if (!xfs_symlink_verify(bp)) xfs_buf_ioerror(bp, -EFSCORRUPTED); if (bp->b_error) xfs_verifier_error(bp); } static void xfs_symlink_write_verify( struct xfs_buf *bp) { struct xfs_mount *mp = bp->b_target->bt_mount; struct xfs_buf_log_item *bip = bp->b_fspriv; /* no verification of non-crc buffers */ if (!xfs_sb_version_hascrc(&mp->m_sb)) return; if (!xfs_symlink_verify(bp)) { xfs_buf_ioerror(bp, -EFSCORRUPTED); xfs_verifier_error(bp); return; } if (bip) { struct xfs_dsymlink_hdr *dsl = bp->b_addr; dsl->sl_lsn = cpu_to_be64(bip->bli_item.li_lsn); } xfs_buf_update_cksum(bp, XFS_SYMLINK_CRC_OFF); } const struct xfs_buf_ops xfs_symlink_buf_ops = { .verify_read = xfs_symlink_read_verify, .verify_write = xfs_symlink_write_verify, }; void xfs_symlink_local_to_remote( struct xfs_trans *tp, struct xfs_buf *bp, struct xfs_inode *ip, struct xfs_ifork *ifp) { struct xfs_mount *mp = ip->i_mount; char *buf; xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SYMLINK_BUF); if (!xfs_sb_version_hascrc(&mp->m_sb)) { bp->b_ops = NULL; memcpy(bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes); xfs_trans_log_buf(tp, bp, 0, ifp->if_bytes - 1); return; } /* * As this symlink fits in an inode literal area, it must also fit in * the smallest buffer the filesystem supports. */ ASSERT(BBTOB(bp->b_length) >= ifp->if_bytes + sizeof(struct xfs_dsymlink_hdr)); bp->b_ops = &xfs_symlink_buf_ops; buf = bp->b_addr; buf += xfs_symlink_hdr_set(mp, ip->i_ino, 0, ifp->if_bytes, bp); memcpy(buf, ifp->if_u1.if_data, ifp->if_bytes); xfs_trans_log_buf(tp, bp, 0, sizeof(struct xfs_dsymlink_hdr) + ifp->if_bytes - 1); }
#ifndef CHARGE_SENS_H #define CHARGE_SENS_H #include "std.h" void charge_sens_init(void); void charge_sens_periodic(void); void charge_sens_event(void); #endif
#include <stdio.h> #include <stdlib.h> #include <signal.h> #include "tests/sys_mman.h" void sig_hdlr ( int signo ) { printf ( "caught sig segv\n" ); exit(1); } int main ( void ) { char* badplace; printf ( "installing sig handler\n" ); signal(SIGSEGV, sig_hdlr); printf ( "doing bad thing\n" ); badplace = get_unmapped_page(); *(int*)badplace = 0; printf ( "exited normally ?!\n" ); return 0; }
/* * Driver for SJA1000 CAN controllers on the OpenFirmware platform bus * * Copyright (C) 2008-2009 Wolfgang Grandegger <wg@grandegger.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the version 2 of the GNU General Public License * as published by the Free Software Foundation * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This is a generic driver for SJA1000 chips on the OpenFirmware platform * bus found on embedded PowerPC systems. You need a SJA1000 CAN node * definition in your flattened device tree source (DTS) file similar to: * * can@3,100 { * compatible = "nxp,sja1000"; * reg = <3 0x100 0x80>; * interrupts = <2 0>; * interrupt-parent = <&mpic>; * nxp,external-clock-frequency = <16000000>; * }; * * See "Documentation/devicetree/bindings/net/can/sja1000.txt" for further * information. */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/interrupt.h> #include <linux/netdevice.h> #include <linux/delay.h> #include <linux/io.h> #include <linux/can/dev.h> #include <linux/of_platform.h> #include <asm/prom.h> #include "sja1000.h" #define DRV_NAME "sja1000_of_platform" MODULE_AUTHOR("Wolfgang Grandegger <wg@grandegger.com>"); MODULE_DESCRIPTION("Socket-CAN driver for SJA1000 on the OF platform bus"); MODULE_LICENSE("GPL v2"); #define SJA1000_OFP_CAN_CLOCK (16000000 / 2) #define SJA1000_OFP_OCR OCR_TX0_PULLDOWN #define SJA1000_OFP_CDR (CDR_CBP | CDR_CLK_OFF) static u8 sja1000_ofp_read_reg(const struct sja1000_priv *priv, int reg) { return in_8(priv->reg_base + reg); } static void sja1000_ofp_write_reg(const struct sja1000_priv *priv, int reg, u8 val) { out_8(priv->reg_base + reg, val); } static int __devexit sja1000_ofp_remove(struct platform_device *ofdev) { struct net_device *dev = dev_get_drvdata(&ofdev->dev); struct sja1000_priv *priv = netdev_priv(dev); struct device_node *np = ofdev->dev.of_node; struct resource res; dev_set_drvdata(&ofdev->dev, NULL); unregister_sja1000dev(dev); free_sja1000dev(dev); iounmap(priv->reg_base); irq_dispose_mapping(dev->irq); of_address_to_resource(np, 0, &res); release_mem_region(res.start, resource_size(&res)); return 0; } static int __devinit sja1000_ofp_probe(struct platform_device *ofdev) { struct device_node *np = ofdev->dev.of_node; struct net_device *dev; struct sja1000_priv *priv; struct resource res; const u32 *prop; int err, irq, res_size, prop_size; void __iomem *base; err = of_address_to_resource(np, 0, &res); if (err) { dev_err(&ofdev->dev, "invalid address\n"); return err; } res_size = resource_size(&res); if (!request_mem_region(res.start, res_size, DRV_NAME)) { dev_err(&ofdev->dev, "couldn't request %pR\n", &res); return -EBUSY; } base = ioremap_nocache(res.start, res_size); if (!base) { dev_err(&ofdev->dev, "couldn't ioremap %pR\n", &res); err = -ENOMEM; goto exit_release_mem; } irq = irq_of_parse_and_map(np, 0); if (irq == NO_IRQ) { dev_err(&ofdev->dev, "no irq found\n"); err = -ENODEV; goto exit_unmap_mem; } dev = alloc_sja1000dev(0); if (!dev) { err = -ENOMEM; goto exit_dispose_irq; } priv = netdev_priv(dev); priv->read_reg = sja1000_ofp_read_reg; priv->write_reg = sja1000_ofp_write_reg; prop = of_get_property(np, "nxp,external-clock-frequency", &prop_size); if (prop && (prop_size == sizeof(u32))) priv->can.clock.freq = *prop / 2; else priv->can.clock.freq = SJA1000_OFP_CAN_CLOCK; /* default */ prop = of_get_property(np, "nxp,tx-output-mode", &prop_size); if (prop && (prop_size == sizeof(u32))) priv->ocr |= *prop & OCR_MODE_MASK; else priv->ocr |= OCR_MODE_NORMAL; /* default */ prop = of_get_property(np, "nxp,tx-output-config", &prop_size); if (prop && (prop_size == sizeof(u32))) priv->ocr |= (*prop << OCR_TX_SHIFT) & OCR_TX_MASK; else priv->ocr |= OCR_TX0_PULLDOWN; /* default */ prop = of_get_property(np, "nxp,clock-out-frequency", &prop_size); if (prop && (prop_size == sizeof(u32)) && *prop) { u32 divider = priv->can.clock.freq * 2 / *prop; if (divider > 1) priv->cdr |= divider / 2 - 1; else priv->cdr |= CDR_CLKOUT_MASK; } else { priv->cdr |= CDR_CLK_OFF; /* default */ } prop = of_get_property(np, "nxp,no-comparator-bypass", NULL); if (!prop) priv->cdr |= CDR_CBP; /* default */ priv->irq_flags = IRQF_SHARED; priv->reg_base = base; dev->irq = irq; dev_info(&ofdev->dev, "reg_base=0x%p irq=%d clock=%d ocr=0x%02x cdr=0x%02x\n", priv->reg_base, dev->irq, priv->can.clock.freq, priv->ocr, priv->cdr); dev_set_drvdata(&ofdev->dev, dev); SET_NETDEV_DEV(dev, &ofdev->dev); err = register_sja1000dev(dev); if (err) { dev_err(&ofdev->dev, "registering %s failed (err=%d)\n", DRV_NAME, err); goto exit_free_sja1000; } return 0; exit_free_sja1000: free_sja1000dev(dev); exit_dispose_irq: irq_dispose_mapping(irq); exit_unmap_mem: iounmap(base); exit_release_mem: release_mem_region(res.start, res_size); return err; } static struct of_device_id __devinitdata sja1000_ofp_table[] = { {.compatible = "nxp,sja1000"}, {}, }; MODULE_DEVICE_TABLE(of, sja1000_ofp_table); static struct platform_driver sja1000_ofp_driver = { .driver = { .owner = THIS_MODULE, .name = DRV_NAME, .of_match_table = sja1000_ofp_table, }, .probe = sja1000_ofp_probe, .remove = __devexit_p(sja1000_ofp_remove), }; module_platform_driver(sja1000_ofp_driver);
/** * \file * * \brief Status code definitions. * * This file defines various status codes returned by functions, * indicating success or failure as well as what kind of failure. * * Copyright (c) 2009-2015 Atmel Corporation. All rights reserved. * * \asf_license_start * * \page License * * 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. * * 3. The name of Atmel may not be used to endorse or promote products derived * from this software without specific prior written permission. * * 4. This software may only be redistributed and used in connection with an * Atmel microcontroller product. * * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. * * \asf_license_stop * */ /* * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> */ #ifndef STATUS_CODES_H_INCLUDED #define STATUS_CODES_H_INCLUDED /** * \defgroup group_xmega_utils_status_codes Status Codes * * \ingroup group_xmega_utils * * \{ */ /* Note: this is a local workaround to avoid a pre-processor clash due to the * lwIP macro ERR_TIMEOUT. */ #if defined(__LWIP_ERR_H__) && defined(ERR_TIMEOUT) #if (ERR_TIMEOUT != -3) /* Internal check to make sure that the later restore of lwIP's ERR_TIMEOUT * macro is set to the correct value. Note that it is highly improbable that * this value ever changes in lwIP. */ #error ASF developers: check lwip err.h new value for ERR_TIMEOUT #endif #undef ERR_TIMEOUT #endif /** * Status code that may be returned by shell commands and protocol * implementations. * * \note Any change to these status codes and the corresponding * message strings is strictly forbidden. New codes can be added, * however, but make sure that any message string tables are updated * at the same time. */ enum status_code { STATUS_OK = 0, //!< Success ERR_IO_ERROR = -1, //!< I/O error ERR_FLUSHED = -2, //!< Request flushed from queue ERR_TIMEOUT = -3, //!< Operation timed out ERR_BAD_DATA = -4, //!< Data integrity check failed ERR_PROTOCOL = -5, //!< Protocol error ERR_UNSUPPORTED_DEV = -6, //!< Unsupported device ERR_NO_MEMORY = -7, //!< Insufficient memory ERR_INVALID_ARG = -8, //!< Invalid argument ERR_BAD_ADDRESS = -9, //!< Bad address ERR_BUSY = -10, //!< Resource is busy ERR_BAD_FORMAT = -11, //!< Data format not recognized ERR_NO_TIMER = -12, //!< No timer available ERR_TIMER_ALREADY_RUNNING = -13, //!< Timer already running ERR_TIMER_NOT_RUNNING = -14, //!< Timer not running /** * \brief Operation in progress * * This status code is for driver-internal use when an operation * is currently being performed. * * \note Drivers should never return this status code to any * callers. It is strictly for internal use. */ OPERATION_IN_PROGRESS = -128, }; typedef enum status_code status_code_t; #if defined(__LWIP_ERR_H__) #define ERR_TIMEOUT -3 #endif /** * \} */ #endif /* STATUS_CODES_H_INCLUDED */
/* * Support for Intel Camera Imaging ISP subsystem. * Copyright (c) 2015, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. */ #ifndef __IA_CSS_OB2_TYPES_H #define __IA_CSS_OB2_TYPES_H /** @file * CSS-API header file for Optical Black algorithm parameters. */ /** Optical Black configuration * * ISP2.6.1: OB2 is used. */ #include "ia_css_frac.h" struct ia_css_ob2_config { ia_css_u0_16 level_gr; /**< Black level for GR pixels. u0.16, [0,65535], default/ineffective 0 */ ia_css_u0_16 level_r; /**< Black level for R pixels. u0.16, [0,65535], default/ineffective 0 */ ia_css_u0_16 level_b; /**< Black level for B pixels. u0.16, [0,65535], default/ineffective 0 */ ia_css_u0_16 level_gb; /**< Black level for GB pixels. u0.16, [0,65535], default/ineffective 0 */ }; #endif /* __IA_CSS_OB2_TYPES_H */
/* * File: pep.h * * Phonet Pipe End Point sockets definitions * * Copyright (C) 2008 Nokia Corporation. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #ifndef NET_PHONET_PEP_H #define NET_PHONET_PEP_H struct pep_sock { struct pn_sock pn_sk; /* XXX: union-ify listening vs connected stuff ? */ /* Listening socket stuff: */ struct hlist_head ackq; struct hlist_head hlist; /* Connected socket stuff: */ struct sock *listener; struct sk_buff_head ctrlreq_queue; #define PNPIPE_CTRLREQ_MAX 10 atomic_t tx_credits; int ifindex; u16 peer_type; /* peer type/subtype */ u8 pipe_handle; u8 rx_credits; u8 rx_fc; /* RX flow control */ u8 tx_fc; /* TX flow control */ u8 init_enable; /* auto-enable at creation */ u8 aligned; }; static inline struct pep_sock *pep_sk(struct sock *sk) { return (struct pep_sock *)sk; } extern const struct proto_ops phonet_stream_ops; /* Pipe protocol definitions */ struct pnpipehdr { u8 utid; /* transaction ID */ u8 message_id; u8 pipe_handle; union { u8 state_after_connect; /* connect request */ u8 state_after_reset; /* reset request */ u8 error_code; /* any response */ u8 pep_type; /* status indication */ u8 data[1]; }; }; #define other_pep_type data[1] static inline struct pnpipehdr *pnp_hdr(struct sk_buff *skb) { return (struct pnpipehdr *)skb_transport_header(skb); } #define MAX_PNPIPE_HEADER (MAX_PHONET_HEADER + 4) enum { PNS_PIPE_DATA = 0x20, PNS_PIPE_ALIGNED_DATA, PNS_PEP_CONNECT_REQ = 0x40, PNS_PEP_CONNECT_RESP, PNS_PEP_DISCONNECT_REQ, PNS_PEP_DISCONNECT_RESP, PNS_PEP_RESET_REQ, PNS_PEP_RESET_RESP, PNS_PEP_ENABLE_REQ, PNS_PEP_ENABLE_RESP, PNS_PEP_CTRL_REQ, PNS_PEP_CTRL_RESP, PNS_PEP_DISABLE_REQ = 0x4C, PNS_PEP_DISABLE_RESP, PNS_PEP_STATUS_IND = 0x60, PNS_PIPE_CREATED_IND, PNS_PIPE_RESET_IND = 0x63, PNS_PIPE_ENABLED_IND, PNS_PIPE_REDIRECTED_IND, PNS_PIPE_DISABLED_IND = 0x66, }; #define PN_PIPE_INVALID_HANDLE 0xff #define PN_PEP_TYPE_COMMON 0x00 /* Phonet pipe status indication */ enum { PN_PEP_IND_FLOW_CONTROL, PN_PEP_IND_ID_MCFC_GRANT_CREDITS, }; /* Phonet pipe error codes */ enum { PN_PIPE_NO_ERROR, PN_PIPE_ERR_INVALID_PARAM, PN_PIPE_ERR_INVALID_HANDLE, PN_PIPE_ERR_INVALID_CTRL_ID, PN_PIPE_ERR_NOT_ALLOWED, PN_PIPE_ERR_PEP_IN_USE, PN_PIPE_ERR_OVERLOAD, PN_PIPE_ERR_DEV_DISCONNECTED, PN_PIPE_ERR_TIMEOUT, PN_PIPE_ERR_ALL_PIPES_IN_USE, PN_PIPE_ERR_GENERAL, PN_PIPE_ERR_NOT_SUPPORTED, }; /* Phonet pipe states */ enum { PN_PIPE_DISABLE, PN_PIPE_ENABLE, }; /* Phonet pipe sub-block types */ enum { PN_PIPE_SB_CREATE_REQ_PEP_SUB_TYPE, PN_PIPE_SB_CONNECT_REQ_PEP_SUB_TYPE, PN_PIPE_SB_REDIRECT_REQ_PEP_SUB_TYPE, PN_PIPE_SB_NEGOTIATED_FC, PN_PIPE_SB_REQUIRED_FC_TX, PN_PIPE_SB_PREFERRED_FC_RX, PN_PIPE_SB_ALIGNED_DATA, }; /* Phonet pipe flow control models */ enum { PN_NO_FLOW_CONTROL, PN_LEGACY_FLOW_CONTROL, PN_ONE_CREDIT_FLOW_CONTROL, PN_MULTI_CREDIT_FLOW_CONTROL, }; #define pn_flow_safe(fc) ((fc) >> 1) /* Phonet pipe flow control states */ enum { PEP_IND_EMPTY, PEP_IND_BUSY, PEP_IND_READY, }; #endif
/* * Copyright (C) 2011 Ericsson AB. All rights reserved. * Copyright (C) 2012 Google Inc. All rights reserved. * * 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. * 3. Neither the name of Ericsson nor the names of its contributors * may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT * OWNER 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. */ #ifndef MediaStreamSourcesQueryClient_h #define MediaStreamSourcesQueryClient_h #if ENABLE(MEDIA_STREAM) #include "MediaStreamSource.h" namespace WebCore { class MediaStreamSourcesQueryClient : public RefCounted<MediaStreamSourcesQueryClient> { public: virtual ~MediaStreamSourcesQueryClient() { } virtual bool audio() const = 0; virtual bool video() const = 0; virtual void didCompleteQuery(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) = 0; }; } // namespace WebCore #endif // ENABLE(MEDIA_STREAM) #endif // MediaStreamSourcesQueryClient_h
#ifndef _LINUX_MIGRATE_H #define _LINUX_MIGRATE_H #include <linux/mm.h> #include <linux/mempolicy.h> #include <linux/migrate_mode.h> typedef struct page *new_page_t(struct page *, unsigned long private, int **); #ifdef CONFIG_MIGRATION extern void putback_lru_pages(struct list_head *l); extern int migrate_page(struct address_space *, struct page *, struct page *, enum migrate_mode); extern int migrate_pages(struct list_head *l, new_page_t x, unsigned long private, bool offlining, enum migrate_mode mode); extern int migrate_huge_page(struct page *, new_page_t x, unsigned long private, bool offlining, enum migrate_mode mode); extern int fail_migrate_page(struct address_space *, struct page *, struct page *); extern int migrate_prep(void); extern int migrate_prep_local(void); extern int migrate_vmas(struct mm_struct *mm, const nodemask_t *from, const nodemask_t *to, unsigned long flags); extern void migrate_page_copy(struct page *newpage, struct page *page); extern int migrate_huge_page_move_mapping(struct address_space *mapping, struct page *newpage, struct page *page); #else static inline void putback_lru_pages(struct list_head *l) {} static inline int migrate_pages(struct list_head *l, new_page_t x, unsigned long private, bool offlining, enum migrate_mode mode) { return -ENOSYS; } static inline int migrate_huge_page(struct page *page, new_page_t x, unsigned long private, bool offlining, enum migrate_mode mode) { return -ENOSYS; } static inline int migrate_prep(void) { return -ENOSYS; } static inline int migrate_prep_local(void) { return -ENOSYS; } static inline int migrate_vmas(struct mm_struct *mm, const nodemask_t *from, const nodemask_t *to, unsigned long flags) { return -ENOSYS; } static inline void migrate_page_copy(struct page *newpage, struct page *page) {} static inline int migrate_huge_page_move_mapping(struct address_space *mapping, struct page *newpage, struct page *page) { return -ENOSYS; } /* Possible settings for the migrate_page() method in address_operations */ #define migrate_page NULL #define fail_migrate_page NULL #endif /* CONFIG_MIGRATION */ #endif /* _LINUX_MIGRATE_H */
/* * Driver for Epson RTC-9701JE * * Copyright (C) 2008 Magnus Damm * * Based on rtc-max6902.c * * Copyright (C) 2006 8D Technologies inc. * Copyright (C) 2004 Compulab Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/platform_device.h> #include <linux/device.h> #include <linux/init.h> #include <linux/rtc.h> #include <linux/spi/spi.h> #include <linux/bcd.h> #include <linux/delay.h> #include <linux/bitops.h> #define RSECCNT 0x00 /* Second Counter */ #define RMINCNT 0x01 /* Minute Counter */ #define RHRCNT 0x02 /* Hour Counter */ #define RWKCNT 0x03 /* Week Counter */ #define RDAYCNT 0x04 /* Day Counter */ #define RMONCNT 0x05 /* Month Counter */ #define RYRCNT 0x06 /* Year Counter */ #define R100CNT 0x07 /* Y100 Counter */ #define RMINAR 0x08 /* Minute Alarm */ #define RHRAR 0x09 /* Hour Alarm */ #define RWKAR 0x0a /* Week/Day Alarm */ #define RTIMCNT 0x0c /* Interval Timer */ #define REXT 0x0d /* Extension Register */ #define RFLAG 0x0e /* RTC Flag Register */ #define RCR 0x0f /* RTC Control Register */ static int write_reg(struct device *dev, int address, unsigned char data) { struct spi_device *spi = to_spi_device(dev); unsigned char buf[2]; buf[0] = address & 0x7f; buf[1] = data; return spi_write(spi, buf, ARRAY_SIZE(buf)); } static int read_regs(struct device *dev, unsigned char *regs, int no_regs) { struct spi_device *spi = to_spi_device(dev); u8 txbuf[1], rxbuf[1]; int k, ret; ret = 0; for (k = 0; ret == 0 && k < no_regs; k++) { txbuf[0] = 0x80 | regs[k]; ret = spi_write_then_read(spi, txbuf, 1, rxbuf, 1); regs[k] = rxbuf[0]; } return ret; } static int r9701_get_datetime(struct device *dev, struct rtc_time *dt) { int ret; unsigned char buf[] = { RSECCNT, RMINCNT, RHRCNT, RDAYCNT, RMONCNT, RYRCNT }; ret = read_regs(dev, buf, ARRAY_SIZE(buf)); if (ret) return ret; memset(dt, 0, sizeof(*dt)); dt->tm_sec = bcd2bin(buf[0]); /* RSECCNT */ dt->tm_min = bcd2bin(buf[1]); /* RMINCNT */ dt->tm_hour = bcd2bin(buf[2]); /* RHRCNT */ dt->tm_mday = bcd2bin(buf[3]); /* RDAYCNT */ dt->tm_mon = bcd2bin(buf[4]) - 1; /* RMONCNT */ dt->tm_year = bcd2bin(buf[5]) + 100; /* RYRCNT */ /* the rtc device may contain illegal values on power up * according to the data sheet. make sure they are valid. */ return rtc_valid_tm(dt); } static int r9701_set_datetime(struct device *dev, struct rtc_time *dt) { int ret, year; year = dt->tm_year + 1900; if (year >= 2100 || year < 2000) return -EINVAL; ret = write_reg(dev, RHRCNT, bin2bcd(dt->tm_hour)); ret = ret ? ret : write_reg(dev, RMINCNT, bin2bcd(dt->tm_min)); ret = ret ? ret : write_reg(dev, RSECCNT, bin2bcd(dt->tm_sec)); ret = ret ? ret : write_reg(dev, RDAYCNT, bin2bcd(dt->tm_mday)); ret = ret ? ret : write_reg(dev, RMONCNT, bin2bcd(dt->tm_mon + 1)); ret = ret ? ret : write_reg(dev, RYRCNT, bin2bcd(dt->tm_year - 100)); ret = ret ? ret : write_reg(dev, RWKCNT, 1 << dt->tm_wday); return ret; } static const struct rtc_class_ops r9701_rtc_ops = { .read_time = r9701_get_datetime, .set_time = r9701_set_datetime, }; static int __devinit r9701_probe(struct spi_device *spi) { struct rtc_device *rtc; struct rtc_time dt; unsigned char tmp; int res; tmp = R100CNT; res = read_regs(&spi->dev, &tmp, 1); if (res || tmp != 0x20) { dev_err(&spi->dev, "cannot read RTC register\n"); return -ENODEV; } /* * The device seems to be present. Now check if the registers * contain invalid values. If so, try to write a default date: * 2000/1/1 00:00:00 */ if (r9701_get_datetime(&spi->dev, &dt)) { dev_info(&spi->dev, "trying to repair invalid date/time\n"); dt.tm_sec = 0; dt.tm_min = 0; dt.tm_hour = 0; dt.tm_mday = 1; dt.tm_mon = 0; dt.tm_year = 100; if (r9701_set_datetime(&spi->dev, &dt) || r9701_get_datetime(&spi->dev, &dt)) { dev_err(&spi->dev, "cannot repair RTC register\n"); return -ENODEV; } } rtc = rtc_device_register("r9701", &spi->dev, &r9701_rtc_ops, THIS_MODULE); if (IS_ERR(rtc)) return PTR_ERR(rtc); dev_set_drvdata(&spi->dev, rtc); return 0; } static int __devexit r9701_remove(struct spi_device *spi) { struct rtc_device *rtc = dev_get_drvdata(&spi->dev); rtc_device_unregister(rtc); return 0; } static struct spi_driver r9701_driver = { .driver = { .name = "rtc-r9701", .owner = THIS_MODULE, }, .probe = r9701_probe, .remove = __devexit_p(r9701_remove), }; module_spi_driver(r9701_driver); MODULE_DESCRIPTION("r9701 spi RTC driver"); MODULE_AUTHOR("Magnus Damm <damm@opensource.se>"); MODULE_LICENSE("GPL"); MODULE_ALIAS("spi:rtc-r9701");
/* NetWinder Floating Point Emulator (c) Rebel.com, 1998-1999 Direct questions, comments to Scott Bambrough <scottb@netwinder.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __FPSR_H__ #define __FPSR_H__ /* The FPSR is a 32 bit register consisting of 4 parts, each exactly one byte. SYSTEM ID EXCEPTION TRAP ENABLE BYTE SYSTEM CONTROL BYTE CUMULATIVE EXCEPTION FLAGS BYTE The FPCR is a 32 bit register consisting of bit flags. */ /* SYSTEM ID ------------ Note: the system id byte is read only */ typedef unsigned int FPSR; /* type for floating point status register */ typedef unsigned int FPCR; /* type for floating point control register */ #define MASK_SYSID 0xff000000 #define BIT_HARDWARE 0x80000000 #define FP_EMULATOR 0x01000000 /* System ID for emulator */ #define FP_ACCELERATOR 0x81000000 /* System ID for FPA11 */ /* EXCEPTION TRAP ENABLE BYTE ----------------------------- */ #define MASK_TRAP_ENABLE 0x00ff0000 #define MASK_TRAP_ENABLE_STRICT 0x001f0000 #define BIT_IXE 0x00100000 /* inexact exception enable */ #define BIT_UFE 0x00080000 /* underflow exception enable */ #define BIT_OFE 0x00040000 /* overflow exception enable */ #define BIT_DZE 0x00020000 /* divide by zero exception enable */ #define BIT_IOE 0x00010000 /* invalid operation exception enable */ /* SYSTEM CONTROL BYTE ---------------------- */ #define MASK_SYSTEM_CONTROL 0x0000ff00 #define MASK_TRAP_STRICT 0x00001f00 #define BIT_AC 0x00001000 /* use alternative C-flag definition for compares */ #define BIT_EP 0x00000800 /* use expanded packed decimal format */ #define BIT_SO 0x00000400 /* select synchronous operation of FPA */ #define BIT_NE 0x00000200 /* NaN exception bit */ #define BIT_ND 0x00000100 /* no denormalized numbers bit */ /* CUMULATIVE EXCEPTION FLAGS BYTE ---------------------------------- */ #define MASK_EXCEPTION_FLAGS 0x000000ff #define MASK_EXCEPTION_FLAGS_STRICT 0x0000001f #define BIT_IXC 0x00000010 /* inexact exception flag */ #define BIT_UFC 0x00000008 /* underflow exception flag */ #define BIT_OFC 0x00000004 /* overfloat exception flag */ #define BIT_DZC 0x00000002 /* divide by zero exception flag */ #define BIT_IOC 0x00000001 /* invalid operation exception flag */ /* Floating Point Control Register ----------------------------------*/ #define BIT_RU 0x80000000 /* rounded up bit */ #define BIT_IE 0x10000000 /* inexact bit */ #define BIT_MO 0x08000000 /* mantissa overflow bit */ #define BIT_EO 0x04000000 /* exponent overflow bit */ #define BIT_SB 0x00000800 /* store bounce */ #define BIT_AB 0x00000400 /* arithmetic bounce */ #define BIT_RE 0x00000200 /* rounding exception */ #define BIT_DA 0x00000100 /* disable FPA */ #define MASK_OP 0x00f08010 /* AU operation code */ #define MASK_PR 0x00080080 /* AU precision */ #define MASK_S1 0x00070000 /* AU source register 1 */ #define MASK_S2 0x00000007 /* AU source register 2 */ #define MASK_DS 0x00007000 /* AU destination register */ #define MASK_RM 0x00000060 /* AU rounding mode */ #define MASK_ALU 0x9cfff2ff /* only ALU can write these bits */ #define MASK_RESET 0x00000d00 /* bits set on reset, all others cleared */ #define MASK_WFC MASK_RESET #define MASK_RFC ~MASK_RESET #endif
/* Test various logical operations. */ TYPE arg1 (TYPE p, TYPE q) { return p & q; } /* AND */ TYPE arg2 (TYPE p, TYPE q) { return p | q; } /* OR */ TYPE arg3 (TYPE p, TYPE q) { return p ^ q; } /* XOR */ TYPE arg4 (TYPE p) { return ~ p; } /* NOR */ TYPE arg5 (TYPE p, TYPE q) { return ~(p & q); } /* NAND */ TYPE arg6 (TYPE p, TYPE q) { return ~(p | q); } /* NOR */ TYPE arg7 (TYPE p, TYPE q) { return ~(p ^ q); } /* EQV */ TYPE arg8 (TYPE p, TYPE q) { return (~p) & q; } /* ANDC */ TYPE arg9 (TYPE p, TYPE q) { return (~p) | q; } /* ORC */ TYPE arg10(TYPE p, TYPE q) { return (~p) ^ q; } /* EQV */ TYPE arg11(TYPE p, TYPE q) { return p & (~q); } /* ANDC */ TYPE arg12(TYPE p, TYPE q) { return p | (~q); } /* ORC */ TYPE arg13(TYPE p, TYPE q) { return p ^ (~q); } /* EQV */ void ptr1 (TYPE *p) { p[0] = p[1] & p[2]; } /* AND */ void ptr2 (TYPE *p) { p[0] = p[1] | p[2]; } /* OR */ void ptr3 (TYPE *p) { p[0] = p[1] ^ p[2]; } /* XOR */ void ptr4 (TYPE *p) { p[0] = ~p[1]; } /* NOR */ void ptr5 (TYPE *p) { p[0] = ~(p[1] & p[2]); } /* NAND */ void ptr6 (TYPE *p) { p[0] = ~(p[1] | p[2]); } /* NOR */ void ptr7 (TYPE *p) { p[0] = ~(p[1] ^ p[2]); } /* EQV */ void ptr8 (TYPE *p) { p[0] = ~(p[1]) & p[2]; } /* ANDC */ void ptr9 (TYPE *p) { p[0] = (~p[1]) | p[2]; } /* ORC */ void ptr10(TYPE *p) { p[0] = (~p[1]) ^ p[2]; } /* EQV */ void ptr11(TYPE *p) { p[0] = p[1] & (~p[2]); } /* ANDC */ void ptr12(TYPE *p) { p[0] = p[1] | (~p[2]); } /* ORC */ void ptr13(TYPE *p) { p[0] = p[1] ^ (~p[2]); } /* EQV */
/* * reset.c -- common ColdFire SoC reset support * * (C) Copyright 2012, Greg Ungerer <gerg@uclinux.org> * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive * for more details. */ #include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> #include <asm/machdep.h> #include <asm/coldfire.h> #include <asm/mcfsim.h> /* * There are 2 common methods amongst the ColdFure parts for reseting * the CPU. But there are couple of exceptions, the 5272 and the 547x * have something completely special to them, and we let their specific * subarch code handle them. */ #ifdef MCFSIM_SYPCR static void mcf_cpu_reset(void) { local_irq_disable(); /* Set watchdog to soft reset, and enabled */ __raw_writeb(0xc0, MCFSIM_SYPCR); for (;;) /* wait for watchdog to timeout */; } #endif #ifdef MCF_RCR static void mcf_cpu_reset(void) { local_irq_disable(); __raw_writeb(MCF_RCR_SWRESET, MCF_RCR); } #endif static int __init mcf_setup_reset(void) { mach_reset = mcf_cpu_reset; return 0; } arch_initcall(mcf_setup_reset);
#include <linux/string.h> #include <linux/kernel.h> #include <linux/sched.h> #include <asm/irq.h> #include <asm/setup.h> #include <asm/bootinfo.h> #include <asm/macintosh.h> /* * Booter vars */ int boothowto; int _boothowto; /* * Called early to parse the environment (passed to us from the booter) * into a bootinfo struct. Will die as soon as we have our own booter */ #define atol(x) simple_strtoul(x,NULL,0) void parse_booter(char *env) { char *name; char *value; #if 0 while(0 && *env) #else while(*env) #endif { name=env; value=name; while(*value!='='&&*value) value++; if(*value=='=') *value++=0; env=value; while(*env) env++; env++; #if 0 if(strcmp(name,"VIDEO_ADDR")==0) mac_mch.videoaddr=atol(value); if(strcmp(name,"ROW_BYTES")==0) mac_mch.videorow=atol(value); if(strcmp(name,"SCREEN_DEPTH")==0) mac_mch.videodepth=atol(value); if(strcmp(name,"DIMENSIONS")==0) mac_mch.dimensions=atol(value); #endif if(strcmp(name,"BOOTTIME")==0) mac_bi_data.boottime=atol(value); if(strcmp(name,"GMTBIAS")==0) mac_bi_data.gmtbias=atol(value); if(strcmp(name,"BOOTERVER")==0) mac_bi_data.bootver=atol(value); if(strcmp(name,"MACOS_VIDEO")==0) mac_bi_data.videological=atol(value); if(strcmp(name,"MACOS_SCC")==0) mac_bi_data.sccbase=atol(value); if(strcmp(name,"MACHINEID")==0) mac_bi_data.id=atol(value); if(strcmp(name,"MEMSIZE")==0) mac_bi_data.memsize=atol(value); if(strcmp(name,"SERIAL_MODEM_FLAGS")==0) mac_bi_data.serialmf=atol(value); if(strcmp(name,"SERIAL_MODEM_HSKICLK")==0) mac_bi_data.serialhsk=atol(value); if(strcmp(name,"SERIAL_MODEM_GPICLK")==0) mac_bi_data.serialgpi=atol(value); if(strcmp(name,"SERIAL_PRINT_FLAGS")==0) mac_bi_data.printmf=atol(value); if(strcmp(name,"SERIAL_PRINT_HSKICLK")==0) mac_bi_data.printhsk=atol(value); if(strcmp(name,"SERIAL_PRINT_GPICLK")==0) mac_bi_data.printgpi=atol(value); if(strcmp(name,"PROCESSOR")==0) mac_bi_data.cpuid=atol(value); if(strcmp(name,"ROMBASE")==0) mac_bi_data.rombase=atol(value); if(strcmp(name,"TIMEDBRA")==0) mac_bi_data.timedbra=atol(value); if(strcmp(name,"ADBDELAY")==0) mac_bi_data.adbdelay=atol(value); } #if 0 /* XXX: TODO with m68k_mach_* */ /* Fill in the base stuff */ boot_info.machtype=MACH_MAC; /* Read this from the macinfo we got ! */ /* boot_info.cputype=CPU_68020|FPUB_68881;*/ /* boot_info.memory[0].addr=0;*/ /* boot_info.memory[0].size=((mac_bi_data.id>>7)&31)<<20;*/ boot_info.num_memory=1; /* On a MacII */ boot_info.ramdisk_size=0; /* For now */ *boot_info.command_line=0; #endif } void print_booter(char *env) { char *name; char *value; while(*env) { name=env; value=name; while(*value!='='&&*value) value++; if(*value=='=') *value++=0; env=value; while(*env) env++; env++; printk("%s=%s\n", name,value); } }
// SPDX-License-Identifier: GPL-2.0-only /* * PCM DRM helpers */ #include <linux/export.h> #include <linux/types.h> #include <sound/asoundef.h> #include <sound/pcm.h> #include <sound/pcm_params.h> #include <sound/pcm_iec958.h> static int create_iec958_consumer(uint rate, uint sample_width, u8 *cs, size_t len) { unsigned int fs, ws; if (len < 4) return -EINVAL; switch (rate) { case 32000: fs = IEC958_AES3_CON_FS_32000; break; case 44100: fs = IEC958_AES3_CON_FS_44100; break; case 48000: fs = IEC958_AES3_CON_FS_48000; break; case 88200: fs = IEC958_AES3_CON_FS_88200; break; case 96000: fs = IEC958_AES3_CON_FS_96000; break; case 176400: fs = IEC958_AES3_CON_FS_176400; break; case 192000: fs = IEC958_AES3_CON_FS_192000; break; default: return -EINVAL; } if (len > 4) { switch (sample_width) { case 16: ws = IEC958_AES4_CON_WORDLEN_20_16; break; case 18: ws = IEC958_AES4_CON_WORDLEN_22_18; break; case 20: ws = IEC958_AES4_CON_WORDLEN_20_16 | IEC958_AES4_CON_MAX_WORDLEN_24; break; case 24: case 32: /* Assume 24-bit width for 32-bit samples. */ ws = IEC958_AES4_CON_WORDLEN_24_20 | IEC958_AES4_CON_MAX_WORDLEN_24; break; default: return -EINVAL; } } memset(cs, 0, len); cs[0] = IEC958_AES0_CON_NOT_COPYRIGHT | IEC958_AES0_CON_EMPHASIS_NONE; cs[1] = IEC958_AES1_CON_GENERAL; cs[2] = IEC958_AES2_CON_SOURCE_UNSPEC | IEC958_AES2_CON_CHANNEL_UNSPEC; cs[3] = IEC958_AES3_CON_CLOCK_1000PPM | fs; if (len > 4) cs[4] = ws; return len; } /** * snd_pcm_create_iec958_consumer - create consumer format IEC958 channel status * @runtime: pcm runtime structure with ->rate filled in * @cs: channel status buffer, at least four bytes * @len: length of channel status buffer * * Create the consumer format channel status data in @cs of maximum size * @len corresponding to the parameters of the PCM runtime @runtime. * * Drivers may wish to tweak the contents of the buffer after creation. * * Returns: length of buffer, or negative error code if something failed. */ int snd_pcm_create_iec958_consumer(struct snd_pcm_runtime *runtime, u8 *cs, size_t len) { return create_iec958_consumer(runtime->rate, snd_pcm_format_width(runtime->format), cs, len); } EXPORT_SYMBOL(snd_pcm_create_iec958_consumer); /** * snd_pcm_create_iec958_consumer_hw_params - create IEC958 channel status * @hw_params: the hw_params instance for extracting rate and sample format * @cs: channel status buffer, at least four bytes * @len: length of channel status buffer * * Create the consumer format channel status data in @cs of maximum size * @len corresponding to the parameters of the PCM runtime @runtime. * * Drivers may wish to tweak the contents of the buffer after creation. * * Returns: length of buffer, or negative error code if something failed. */ int snd_pcm_create_iec958_consumer_hw_params(struct snd_pcm_hw_params *params, u8 *cs, size_t len) { return create_iec958_consumer(params_rate(params), params_width(params), cs, len); } EXPORT_SYMBOL(snd_pcm_create_iec958_consumer_hw_params);
// SPDX-License-Identifier: GPL-2.0 OR MIT /****************************************************************************** * grant_table.c * x86 specific part * * Granting foreign access to our memory reservation. * * Copyright (c) 2005-2006, Christopher Clark * Copyright (c) 2004-2005, K A Fraser * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp> * VA Linux Systems Japan. Split out x86 specific part. */ #include <linux/sched.h> #include <linux/mm.h> #include <linux/slab.h> #include <linux/vmalloc.h> #include <xen/interface/xen.h> #include <xen/page.h> #include <xen/grant_table.h> #include <xen/xen.h> static struct gnttab_vm_area { struct vm_struct *area; pte_t **ptes; int idx; } gnttab_shared_vm_area, gnttab_status_vm_area; int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, unsigned long max_nr_gframes, void **__shared) { void *shared = *__shared; unsigned long addr; unsigned long i; if (shared == NULL) *__shared = shared = gnttab_shared_vm_area.area->addr; addr = (unsigned long)shared; for (i = 0; i < nr_gframes; i++) { set_pte_at(&init_mm, addr, gnttab_shared_vm_area.ptes[i], mfn_pte(frames[i], PAGE_KERNEL)); addr += PAGE_SIZE; } return 0; } int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes, unsigned long max_nr_gframes, grant_status_t **__shared) { grant_status_t *shared = *__shared; unsigned long addr; unsigned long i; if (shared == NULL) *__shared = shared = gnttab_status_vm_area.area->addr; addr = (unsigned long)shared; for (i = 0; i < nr_gframes; i++) { set_pte_at(&init_mm, addr, gnttab_status_vm_area.ptes[i], mfn_pte(frames[i], PAGE_KERNEL)); addr += PAGE_SIZE; } return 0; } void arch_gnttab_unmap(void *shared, unsigned long nr_gframes) { pte_t **ptes; unsigned long addr; unsigned long i; if (shared == gnttab_status_vm_area.area->addr) ptes = gnttab_status_vm_area.ptes; else ptes = gnttab_shared_vm_area.ptes; addr = (unsigned long)shared; for (i = 0; i < nr_gframes; i++) { set_pte_at(&init_mm, addr, ptes[i], __pte(0)); addr += PAGE_SIZE; } } static int gnttab_apply(pte_t *pte, unsigned long addr, void *data) { struct gnttab_vm_area *area = data; area->ptes[area->idx++] = pte; return 0; } static int arch_gnttab_valloc(struct gnttab_vm_area *area, unsigned nr_frames) { area->ptes = kmalloc_array(nr_frames, sizeof(*area->ptes), GFP_KERNEL); if (area->ptes == NULL) return -ENOMEM; area->area = get_vm_area(PAGE_SIZE * nr_frames, VM_IOREMAP); if (!area->area) goto out_free_ptes; if (apply_to_page_range(&init_mm, (unsigned long)area->area->addr, PAGE_SIZE * nr_frames, gnttab_apply, area)) goto out_free_vm_area; return 0; out_free_vm_area: free_vm_area(area->area); out_free_ptes: kfree(area->ptes); return -ENOMEM; } static void arch_gnttab_vfree(struct gnttab_vm_area *area) { free_vm_area(area->area); kfree(area->ptes); } int arch_gnttab_init(unsigned long nr_shared, unsigned long nr_status) { int ret; if (!xen_pv_domain()) return 0; ret = arch_gnttab_valloc(&gnttab_shared_vm_area, nr_shared); if (ret < 0) return ret; /* * Always allocate the space for the status frames in case * we're migrated to a host with V2 support. */ ret = arch_gnttab_valloc(&gnttab_status_vm_area, nr_status); if (ret < 0) goto err; return 0; err: arch_gnttab_vfree(&gnttab_shared_vm_area); return -ENOMEM; } #ifdef CONFIG_XEN_PVH #include <xen/events.h> #include <xen/xen-ops.h> static int __init xen_pvh_gnttab_setup(void) { if (!xen_pvh_domain()) return -ENODEV; xen_auto_xlat_grant_frames.count = gnttab_max_grant_frames(); return xen_xlate_map_ballooned_pages(&xen_auto_xlat_grant_frames.pfn, &xen_auto_xlat_grant_frames.vaddr, xen_auto_xlat_grant_frames.count); } /* Call it _before_ __gnttab_init as we need to initialize the * xen_auto_xlat_grant_frames first. */ core_initcall(xen_pvh_gnttab_setup); #endif
/* * syscore.c - Execution of system core operations. * * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc. * * This file is released under the GPLv2. */ #include <linux/syscore_ops.h> #include <linux/mutex.h> #include <linux/module.h> #include <linux/interrupt.h> #include <trace/events/power.h> static LIST_HEAD(syscore_ops_list); static DEFINE_MUTEX(syscore_ops_lock); /** * register_syscore_ops - Register a set of system core operations. * @ops: System core operations to register. */ void register_syscore_ops(struct syscore_ops *ops) { mutex_lock(&syscore_ops_lock); list_add_tail(&ops->node, &syscore_ops_list); mutex_unlock(&syscore_ops_lock); } EXPORT_SYMBOL_GPL(register_syscore_ops); /** * unregister_syscore_ops - Unregister a set of system core operations. * @ops: System core operations to unregister. */ void unregister_syscore_ops(struct syscore_ops *ops) { mutex_lock(&syscore_ops_lock); list_del(&ops->node); mutex_unlock(&syscore_ops_lock); } EXPORT_SYMBOL_GPL(unregister_syscore_ops); #ifdef CONFIG_PM_SLEEP /** * syscore_suspend - Execute all the registered system core suspend callbacks. * * This function is executed with one CPU on-line and disabled interrupts. */ int syscore_suspend(void) { struct syscore_ops *ops; int ret = 0; trace_suspend_resume(TPS("syscore_suspend"), 0, true); pr_debug("Checking wakeup interrupts\n"); /* Return error code if there are any wakeup interrupts pending. */ ret = check_wakeup_irqs(); if (ret) return ret; WARN_ONCE(!irqs_disabled(), "Interrupts enabled before system core suspend.\n"); list_for_each_entry_reverse(ops, &syscore_ops_list, node) if (ops->suspend) { if (initcall_debug) pr_info("PM: Calling %pF\n", ops->suspend); ret = ops->suspend(); if (ret) goto err_out; WARN_ONCE(!irqs_disabled(), "Interrupts enabled after %pF\n", ops->suspend); } trace_suspend_resume(TPS("syscore_suspend"), 0, false); return 0; err_out: pr_err("PM: System core suspend callback %pF failed.\n", ops->suspend); list_for_each_entry_continue(ops, &syscore_ops_list, node) if (ops->resume) ops->resume(); return ret; } EXPORT_SYMBOL_GPL(syscore_suspend); /** * syscore_resume - Execute all the registered system core resume callbacks. * * This function is executed with one CPU on-line and disabled interrupts. */ void syscore_resume(void) { struct syscore_ops *ops; trace_suspend_resume(TPS("syscore_resume"), 0, true); WARN_ONCE(!irqs_disabled(), "Interrupts enabled before system core resume.\n"); list_for_each_entry(ops, &syscore_ops_list, node) if (ops->resume) { if (initcall_debug) pr_info("PM: Calling %pF\n", ops->resume); ops->resume(); WARN_ONCE(!irqs_disabled(), "Interrupts enabled after %pF\n", ops->resume); } trace_suspend_resume(TPS("syscore_resume"), 0, false); } EXPORT_SYMBOL_GPL(syscore_resume); #endif /* CONFIG_PM_SLEEP */ /** * syscore_shutdown - Execute all the registered system core shutdown callbacks. */ void syscore_shutdown(void) { struct syscore_ops *ops; mutex_lock(&syscore_ops_lock); list_for_each_entry_reverse(ops, &syscore_ops_list, node) if (ops->shutdown) { if (initcall_debug) pr_info("PM: Calling %pF\n", ops->shutdown); ops->shutdown(); } mutex_unlock(&syscore_ops_lock); }
/* * sleep.c - x86-specific ACPI sleep support. * * Copyright (C) 2001-2003 Patrick Mochel * Copyright (C) 2001-2003 Pavel Machek <pavel@ucw.cz> */ #include <linux/acpi.h> #include <linux/bootmem.h> #include <linux/memblock.h> #include <linux/dmi.h> #include <linux/cpumask.h> #include <asm/segment.h> #include <asm/desc.h> #include <asm/pgtable.h> #include <asm/cacheflush.h> #include <asm/realmode.h> #include "../../realmode/rm/wakeup.h" #include "sleep.h" unsigned long acpi_realmode_flags; #if defined(CONFIG_SMP) && defined(CONFIG_64BIT) static char temp_stack[4096]; #endif /** * x86_acpi_enter_sleep_state - enter sleep state * @state: Sleep state to enter. * * Wrapper around acpi_enter_sleep_state() to be called by assmebly. */ acpi_status asmlinkage __visible x86_acpi_enter_sleep_state(u8 state) { return acpi_enter_sleep_state(state); } /** * x86_acpi_suspend_lowlevel - save kernel state * * Create an identity mapped page table and copy the wakeup routine to * low memory. */ int x86_acpi_suspend_lowlevel(void) { struct wakeup_header *header = (struct wakeup_header *) __va(real_mode_header->wakeup_header); if (header->signature != WAKEUP_HEADER_SIGNATURE) { printk(KERN_ERR "wakeup header does not match\n"); return -EINVAL; } header->video_mode = saved_video_mode; header->pmode_behavior = 0; #ifndef CONFIG_64BIT native_store_gdt((struct desc_ptr *)&header->pmode_gdt); /* * We have to check that we can write back the value, and not * just read it. At least on 90 nm Pentium M (Family 6, Model * 13), reading an invalid MSR is not guaranteed to trap, see * Erratum X4 in "Intel Pentium M Processor on 90 nm Process * with 2-MB L2 Cache and Intel® Processor A100 and A110 on 90 * nm process with 512-KB L2 Cache Specification Update". */ if (!rdmsr_safe(MSR_EFER, &header->pmode_efer_low, &header->pmode_efer_high) && !wrmsr_safe(MSR_EFER, header->pmode_efer_low, header->pmode_efer_high)) header->pmode_behavior |= (1 << WAKEUP_BEHAVIOR_RESTORE_EFER); #endif /* !CONFIG_64BIT */ header->pmode_cr0 = read_cr0(); if (__this_cpu_read(cpu_info.cpuid_level) >= 0) { header->pmode_cr4 = read_cr4(); header->pmode_behavior |= (1 << WAKEUP_BEHAVIOR_RESTORE_CR4); } if (!rdmsr_safe(MSR_IA32_MISC_ENABLE, &header->pmode_misc_en_low, &header->pmode_misc_en_high) && !wrmsr_safe(MSR_IA32_MISC_ENABLE, header->pmode_misc_en_low, header->pmode_misc_en_high)) header->pmode_behavior |= (1 << WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE); header->realmode_flags = acpi_realmode_flags; header->real_magic = 0x12345678; #ifndef CONFIG_64BIT header->pmode_entry = (u32)&wakeup_pmode_return; header->pmode_cr3 = (u32)__pa_symbol(initial_page_table); saved_magic = 0x12345678; #else /* CONFIG_64BIT */ #ifdef CONFIG_SMP stack_start = (unsigned long)temp_stack + sizeof(temp_stack); early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(smp_processor_id()); initial_gs = per_cpu_offset(smp_processor_id()); #endif initial_code = (unsigned long)wakeup_long64; saved_magic = 0x123456789abcdef0L; #endif /* CONFIG_64BIT */ do_suspend_lowlevel(); return 0; } static int __init acpi_sleep_setup(char *str) { while ((str != NULL) && (*str != '\0')) { if (strncmp(str, "s3_bios", 7) == 0) acpi_realmode_flags |= 1; if (strncmp(str, "s3_mode", 7) == 0) acpi_realmode_flags |= 2; if (strncmp(str, "s3_beep", 7) == 0) acpi_realmode_flags |= 4; #ifdef CONFIG_HIBERNATION if (strncmp(str, "s4_nohwsig", 10) == 0) acpi_no_s4_hw_signature(); #endif if (strncmp(str, "nonvs", 5) == 0) acpi_nvs_nosave(); if (strncmp(str, "nonvs_s3", 8) == 0) acpi_nvs_nosave_s3(); if (strncmp(str, "old_ordering", 12) == 0) acpi_old_suspend_ordering(); str = strchr(str, ','); if (str != NULL) str += strspn(str, ", \t"); } return 1; } __setup("acpi_sleep=", acpi_sleep_setup);
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_PLATFORM_DEFAULT_FROM_STREAM_EXECUTOR_STATUS_H_ #define TENSORFLOW_PLATFORM_DEFAULT_FROM_STREAM_EXECUTOR_STATUS_H_ // IWYU pragma: private, include "third_party/tensorflow/core/platform/from_stream_executor_status.h" // IWYU pragma: friend third_party/tensorflow/core/platform/from_stream_executor_status.h #include "tensorflow/stream_executor/lib/status.h" namespace tensorflow { namespace gpu = ::perftools::gputools; // On the open-source platform, stream_executor currently uses // tensorflow::Status inline Status FromStreamExecutorStatus( const perftools::gputools::port::Status& s) { return s; } } // namespace tensorflow #endif // TENSORFLOW_PLATFORM_DEFAULT_FROM_STREAM_EXECUTOR_STATUS_H_
// Copyright (c) 2013 Mutual Mobile (http://mutualmobile.com/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #import <UIKit/UIKit.h> /** `MMDrawerBarButtonItem` provides convenience methods to create `UIBarButtonItems` with a default hamburger-menu asset. */ @interface MMDrawerBarButtonItem : UIBarButtonItem ///--------------------------------------- /// @name Initializing a `MMDrawerBarButtonItem` ///--------------------------------------- /** Creates and initializes an `MMDrawerBarButtonItem` without a border. @param target The target to forward the `action` to when the button is pressed. @param action The action to call when the button is pressed. @return The newly-initialized bar button item. */ -(instancetype)initWithTarget:(id)target action:(SEL)action; /** Returns the current color of the menu button for the state requested. This property is deprecated in iOS 7.0. Use `tintColor` instead. @param state The UIControl state that the color is being requested for. @return The menu button color for the requested state. */ -(UIColor *)menuButtonColorForState:(UIControlState)state __attribute__((deprecated("Use tintColor instead"))); /** Sets the color of the menu button for the specified state. For this control, only set colors for `UIControlStateNormal` and `UIControlStateHighlighted`. This property is deprecated in iOS 7.0. Use `tintColor` instead. @param color The color to set. @param state The state to set the color for. */ -(void)setMenuButtonColor:(UIColor *)color forState:(UIControlState)state __attribute__((deprecated("Use tintColor instead"))); /** Returns the current color of the shadow for the state requested. This property is deprecated in iOS 7.0. The menu button no longer supports a shadow. @param state The UIControl state that the color is being requested for. @return The menu button color for the requested state. */ -(UIColor *)shadowColorForState:(UIControlState)state __attribute__((deprecated("Shadow is no longer supported"))); /** Sets the color of the shadow for the specified state. For this control, only set colors for `UIControlStateNormal` and `UIControlStateHighlighted`. This property is deprecated in iOS 7.0. The menu button no longer supports a shadow. @param color The color to set. @param state The state to set the color for. */ -(void)setShadowColor:(UIColor *)color forState:(UIControlState)state __attribute__((deprecated("Shadow is no longer supported"))); @end
/* * Copyright 2015, Sam Bobroff, IBM Corp. * Licensed under GPLv2. * * Test the kernel's system call code to ensure that a system call * made from within an active HTM transaction is aborted with the * correct failure code. * Conversely, ensure that a system call made from within a * suspended transaction can succeed. */ #include <stdio.h> #include <unistd.h> #include <sys/syscall.h> #include <asm/tm.h> #include <asm/cputable.h> #include <linux/auxvec.h> #include <sys/time.h> #include <stdlib.h> #include "utils.h" extern int getppid_tm_active(void); extern int getppid_tm_suspended(void); unsigned retries = 0; #define TEST_DURATION 10 /* seconds */ #define TM_RETRIES 100 long failure_code(void) { return __builtin_get_texasru() >> 24; } bool failure_is_persistent(void) { return (failure_code() & TM_CAUSE_PERSISTENT) == TM_CAUSE_PERSISTENT; } bool failure_is_syscall(void) { return (failure_code() & TM_CAUSE_SYSCALL) == TM_CAUSE_SYSCALL; } pid_t getppid_tm(bool suspend) { int i; pid_t pid; for (i = 0; i < TM_RETRIES; i++) { if (suspend) pid = getppid_tm_suspended(); else pid = getppid_tm_active(); if (pid >= 0) return pid; if (failure_is_persistent()) { if (failure_is_syscall()) return -1; printf("Unexpected persistent transaction failure.\n"); printf("TEXASR 0x%016lx, TFIAR 0x%016lx.\n", __builtin_get_texasr(), __builtin_get_tfiar()); exit(-1); } retries++; } printf("Exceeded limit of %d temporary transaction failures.\n", TM_RETRIES); printf("TEXASR 0x%016lx, TFIAR 0x%016lx.\n", __builtin_get_texasr(), __builtin_get_tfiar()); exit(-1); } static inline bool have_htm_nosc(void) { #ifdef PPC_FEATURE2_HTM_NOSC return ((long)get_auxv_entry(AT_HWCAP2) & PPC_FEATURE2_HTM_NOSC); #else printf("PPC_FEATURE2_HTM_NOSC not defined, can't check AT_HWCAP2\n"); return false; #endif } int tm_syscall(void) { unsigned count = 0; struct timeval end, now; SKIP_IF(!have_htm_nosc()); setbuf(stdout, NULL); printf("Testing transactional syscalls for %d seconds...\n", TEST_DURATION); gettimeofday(&end, NULL); now.tv_sec = TEST_DURATION; now.tv_usec = 0; timeradd(&end, &now, &end); for (count = 0; timercmp(&now, &end, <); count++) { /* * Test a syscall within a suspended transaction and verify * that it succeeds. */ FAIL_IF(getppid_tm(true) == -1); /* Should succeed. */ /* * Test a syscall within an active transaction and verify that * it fails with the correct failure code. */ FAIL_IF(getppid_tm(false) != -1); /* Should fail... */ FAIL_IF(!failure_is_persistent()); /* ...persistently... */ FAIL_IF(!failure_is_syscall()); /* ...with code syscall. */ gettimeofday(&now, 0); } printf("%d active and suspended transactions behaved correctly.\n", count); printf("(There were %d transaction retries.)\n", retries); return 0; } int main(void) { return test_harness(tm_syscall, "tm_syscall"); }
#ifndef _PARISC_CACHEFLUSH_H #define _PARISC_CACHEFLUSH_H #include <linux/mm.h> #include <linux/uaccess.h> /* The usual comment is "Caches aren't brain-dead on the <architecture>". * Unfortunately, that doesn't apply to PA-RISC. */ /* Internal implementation */ void flush_data_cache_local(void *); /* flushes local data-cache only */ void flush_instruction_cache_local(void *); /* flushes local code-cache only */ #ifdef CONFIG_SMP void flush_data_cache(void); /* flushes data-cache only (all processors) */ void flush_instruction_cache(void); /* flushes i-cache only (all processors) */ #else #define flush_data_cache() flush_data_cache_local(NULL) #define flush_instruction_cache() flush_instruction_cache_local(NULL) #endif #define flush_cache_dup_mm(mm) flush_cache_mm(mm) void flush_user_icache_range_asm(unsigned long, unsigned long); void flush_kernel_icache_range_asm(unsigned long, unsigned long); void flush_user_dcache_range_asm(unsigned long, unsigned long); void flush_kernel_dcache_range_asm(unsigned long, unsigned long); void flush_kernel_dcache_page_asm(void *); void flush_kernel_icache_page(void *); void flush_user_dcache_page(unsigned long); void flush_user_icache_page(unsigned long); void flush_user_dcache_range(unsigned long, unsigned long); void flush_user_icache_range(unsigned long, unsigned long); /* Cache flush operations */ void flush_cache_all_local(void); void flush_cache_all(void); void flush_cache_mm(struct mm_struct *mm); #define flush_kernel_dcache_range(start,size) \ flush_kernel_dcache_range_asm((start), (start)+(size)); /* vmap range flushes and invalidates. Architecturally, we don't need * the invalidate, because the CPU should refuse to speculate once an * area has been flushed, so invalidate is left empty */ static inline void flush_kernel_vmap_range(void *vaddr, int size) { unsigned long start = (unsigned long)vaddr; flush_kernel_dcache_range_asm(start, start + size); } static inline void invalidate_kernel_vmap_range(void *vaddr, int size) { } #define flush_cache_vmap(start, end) flush_cache_all() #define flush_cache_vunmap(start, end) flush_cache_all() #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 extern void flush_dcache_page(struct page *page); #define flush_dcache_mmap_lock(mapping) \ spin_lock_irq(&(mapping)->tree_lock) #define flush_dcache_mmap_unlock(mapping) \ spin_unlock_irq(&(mapping)->tree_lock) #define flush_icache_page(vma,page) do { \ flush_kernel_dcache_page(page); \ flush_kernel_icache_page(page_address(page)); \ } while (0) #define flush_icache_range(s,e) do { \ flush_kernel_dcache_range_asm(s,e); \ flush_kernel_icache_range_asm(s,e); \ } while (0) #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ do { \ flush_cache_page(vma, vaddr, page_to_pfn(page)); \ memcpy(dst, src, len); \ flush_kernel_dcache_range_asm((unsigned long)dst, (unsigned long)dst + len); \ } while (0) #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ do { \ flush_cache_page(vma, vaddr, page_to_pfn(page)); \ memcpy(dst, src, len); \ } while (0) void flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long pfn); void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end); #define ARCH_HAS_FLUSH_ANON_PAGE static inline void flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned long vmaddr) { if (PageAnon(page)) flush_user_dcache_page(vmaddr); } #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE void flush_kernel_dcache_page_addr(void *addr); static inline void flush_kernel_dcache_page(struct page *page) { flush_kernel_dcache_page_addr(page_address(page)); } #ifdef CONFIG_DEBUG_RODATA void mark_rodata_ro(void); #endif #ifdef CONFIG_PA8X00 /* Only pa8800, pa8900 needs this */ #include <asm/kmap_types.h> #define ARCH_HAS_KMAP void kunmap_parisc(void *addr); static inline void *kmap(struct page *page) { might_sleep(); return page_address(page); } #define kunmap(page) kunmap_parisc(page_address(page)) static inline void *__kmap_atomic(struct page *page) { pagefault_disable(); return page_address(page); } static inline void __kunmap_atomic(void *addr) { kunmap_parisc(addr); pagefault_enable(); } #define kmap_atomic_prot(page, prot) kmap_atomic(page) #define kmap_atomic_pfn(pfn) kmap_atomic(pfn_to_page(pfn)) #define kmap_atomic_to_page(ptr) virt_to_page(ptr) #endif #endif /* _PARISC_CACHEFLUSH_H */
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- #ifndef __javax_swing_plaf_basic_BasicTreeUI$PropertyChangeHandler__ #define __javax_swing_plaf_basic_BasicTreeUI$PropertyChangeHandler__ #pragma interface #include <java/lang/Object.h> extern "Java" { namespace java { namespace beans { class PropertyChangeEvent; } } namespace javax { namespace swing { namespace plaf { namespace basic { class BasicTreeUI; class BasicTreeUI$PropertyChangeHandler; } } } } } class javax::swing::plaf::basic::BasicTreeUI$PropertyChangeHandler : public ::java::lang::Object { public: BasicTreeUI$PropertyChangeHandler(::javax::swing::plaf::basic::BasicTreeUI *); virtual void propertyChange(::java::beans::PropertyChangeEvent *); public: // actually package-private ::javax::swing::plaf::basic::BasicTreeUI * __attribute__((aligned(__alignof__( ::java::lang::Object)))) this$0; public: static ::java::lang::Class class$; }; #endif // __javax_swing_plaf_basic_BasicTreeUI$PropertyChangeHandler__
/* * Driver for the Conexant CX23885/7/8 PCIe bridge * * Various common ioctl() support functions * * Copyright (c) 2009 Andy Walls <awalls@md.metrocast.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _CX23885_IOCTL_H_ #define _CX23885_IOCTL_H_ int cx23885_g_chip_info(struct file *file, void *fh, struct v4l2_dbg_chip_info *chip); #ifdef CONFIG_VIDEO_ADV_DEBUG int cx23885_g_register(struct file *file, void *fh, struct v4l2_dbg_register *reg); int cx23885_s_register(struct file *file, void *fh, const struct v4l2_dbg_register *reg); #endif #endif
#ifndef __ASMARM_ELF_H #define __ASMARM_ELF_H #include <asm/hwcap.h> /* * ELF register definitions.. */ #include <asm/ptrace.h> #include <asm/user.h> struct task_struct; typedef unsigned long elf_greg_t; typedef unsigned long elf_freg_t[3]; #define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) typedef elf_greg_t elf_gregset_t[ELF_NGREG]; typedef struct user_fp elf_fpregset_t; #define EM_ARM 40 #define EF_ARM_EABI_MASK 0xff000000 #define EF_ARM_EABI_UNKNOWN 0x00000000 #define EF_ARM_EABI_VER1 0x01000000 #define EF_ARM_EABI_VER2 0x02000000 #define EF_ARM_EABI_VER3 0x03000000 #define EF_ARM_EABI_VER4 0x04000000 #define EF_ARM_EABI_VER5 0x05000000 #define EF_ARM_BE8 0x00800000 /* ABI 4,5 */ #define EF_ARM_LE8 0x00400000 /* ABI 4,5 */ #define EF_ARM_MAVERICK_FLOAT 0x00000800 /* ABI 0 */ #define EF_ARM_VFP_FLOAT 0x00000400 /* ABI 0 */ #define EF_ARM_SOFT_FLOAT 0x00000200 /* ABI 0 */ #define EF_ARM_OLD_ABI 0x00000100 /* ABI 0 */ #define EF_ARM_NEW_ABI 0x00000080 /* ABI 0 */ #define EF_ARM_ALIGN8 0x00000040 /* ABI 0 */ #define EF_ARM_PIC 0x00000020 /* ABI 0 */ #define EF_ARM_MAPSYMSFIRST 0x00000010 /* ABI 2 */ #define EF_ARM_APCS_FLOAT 0x00000010 /* ABI 0, floats in fp regs */ #define EF_ARM_DYNSYMSUSESEGIDX 0x00000008 /* ABI 2 */ #define EF_ARM_APCS_26 0x00000008 /* ABI 0 */ #define EF_ARM_SYMSARESORTED 0x00000004 /* ABI 1,2 */ #define EF_ARM_INTERWORK 0x00000004 /* ABI 0 */ #define EF_ARM_HASENTRY 0x00000002 /* All */ #define EF_ARM_RELEXEC 0x00000001 /* All */ #define R_ARM_NONE 0 #define R_ARM_PC24 1 #define R_ARM_ABS32 2 #define R_ARM_CALL 28 #define R_ARM_JUMP24 29 #define R_ARM_V4BX 40 #define R_ARM_PREL31 42 #define R_ARM_MOVW_ABS_NC 43 #define R_ARM_MOVT_ABS 44 #define R_ARM_THM_CALL 10 #define R_ARM_THM_JUMP24 30 #define R_ARM_THM_MOVW_ABS_NC 47 #define R_ARM_THM_MOVT_ABS 48 /* * These are used to set parameters in the core dumps. */ #define ELF_CLASS ELFCLASS32 #ifdef __ARMEB__ #define ELF_DATA ELFDATA2MSB #else #define ELF_DATA ELFDATA2LSB #endif #define ELF_ARCH EM_ARM /* * This yields a string that ld.so will use to load implementation * specific libraries for optimization. This is more specific in * intent than poking at uname or /proc/cpuinfo. * * For now we just provide a fairly general string that describes the * processor family. This could be made more specific later if someone * implemented optimisations that require it. 26-bit CPUs give you * "v1l" for ARM2 (no SWP) and "v2l" for anything else (ARM1 isn't * supported). 32-bit CPUs give you "v3[lb]" for anything based on an * ARM6 or ARM7 core and "armv4[lb]" for anything based on a StrongARM-1 * core. */ #define ELF_PLATFORM_SIZE 8 #define ELF_PLATFORM (elf_platform) extern char elf_platform[]; struct elf32_hdr; /* * This is used to ensure we don't load something for the wrong architecture. */ extern int elf_check_arch(const struct elf32_hdr *); #define elf_check_arch elf_check_arch #define vmcore_elf64_check_arch(x) (0) extern int arm_elf_read_implies_exec(const struct elf32_hdr *, int); #define elf_read_implies_exec(ex,stk) arm_elf_read_implies_exec(&(ex), stk) struct task_struct; int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs); #define ELF_CORE_COPY_TASK_REGS dump_task_regs #define CORE_DUMP_USE_REGSET #define ELF_EXEC_PAGESIZE 4096 /* This is the location that an ET_DYN program is loaded if exec'ed. Typical use of this is to invoke "./ld.so someprog" to test out a new version of the loader. We need to make sure that it is out of the way of the program that it will "exec", and that there is sufficient room for the brk. */ #define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2) /* When the program starts, a1 contains a pointer to a function to be registered with atexit, as per the SVR4 ABI. A value of 0 means we have no such handler. */ #define ELF_PLAT_INIT(_r, load_addr) (_r)->ARM_r0 = 0 extern void elf_set_personality(const struct elf32_hdr *); #define SET_PERSONALITY(ex) elf_set_personality(&(ex)) struct mm_struct; extern unsigned long arch_randomize_brk(struct mm_struct *mm); #define arch_randomize_brk arch_randomize_brk #ifdef CONFIG_MMU #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 struct linux_binprm; int arch_setup_additional_pages(struct linux_binprm *, int); #endif #endif
/* * Copyright (C) ST-Ericsson AB 2010 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com * License terms: GNU General Public License (GPL) version 2 */ #ifndef CFSERL_H_ #define CFSERL_H_ #include <net/caif/caif_layer.h> struct cflayer *cfserl_create(int instance, bool use_stx); #endif
/* * Copyright 2011-2016 by Emese Revfy <re.emese@gmail.com> * Licensed under the GPL v2, or (at your option) v3 * * Homepage: * https://github.com/ephox-gcc-plugins/cyclomatic_complexity * * https://en.wikipedia.org/wiki/Cyclomatic_complexity * The complexity M is then defined as: * M = E - N + 2P * where * * E = the number of edges of the graph * N = the number of nodes of the graph * P = the number of connected components (exit nodes). * * Usage (4.5 - 5): * $ make clean; make run */ #include "gcc-common.h" __visible int plugin_is_GPL_compatible; static struct plugin_info cyc_complexity_plugin_info = { .version = "20160225", .help = "Cyclomatic Complexity\n", }; static unsigned int cyc_complexity_execute(void) { int complexity; expanded_location xloc; /* M = E - N + 2P */ complexity = n_edges_for_fn(cfun) - n_basic_blocks_for_fn(cfun) + 2; xloc = expand_location(DECL_SOURCE_LOCATION(current_function_decl)); fprintf(stderr, "Cyclomatic Complexity %d %s:%s\n", complexity, xloc.file, DECL_NAME_POINTER(current_function_decl)); return 0; } #define PASS_NAME cyc_complexity #define NO_GATE #define TODO_FLAGS_FINISH TODO_dump_func #include "gcc-generate-gimple-pass.h" __visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) { const char * const plugin_name = plugin_info->base_name; PASS_INFO(cyc_complexity, "ssa", 1, PASS_POS_INSERT_AFTER); if (!plugin_default_version_check(version, &gcc_version)) { error(G_("incompatible gcc/plugin versions")); return 1; } register_callback(plugin_name, PLUGIN_INFO, NULL, &cyc_complexity_plugin_info); register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &cyc_complexity_pass_info); return 0; }
/* * arch/arm/include/asm/fncpy.h - helper macros for function body copying * * Copyright (C) 2011 Linaro Limited * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * These macros are intended for use when there is a need to copy a low-level * function body into special memory. * * For example, when reconfiguring the SDRAM controller, the code doing the * reconfiguration may need to run from SRAM. * * NOTE: that the copied function body must be entirely self-contained and * position-independent in order for this to work properly. * * NOTE: in order for embedded literals and data to get referenced correctly, * the alignment of functions must be preserved when copying. To ensure this, * the source and destination addresses for fncpy() must be aligned to a * multiple of 8 bytes: you will be get a BUG() if this condition is not met. * You will typically need a ".align 3" directive in the assembler where the * function to be copied is defined, and ensure that your allocator for the * destination buffer returns 8-byte-aligned pointers. * * Typical usage example: * * extern int f(args); * extern uint32_t size_of_f; * int (*copied_f)(args); * void *sram_buffer; * * copied_f = fncpy(sram_buffer, &f, size_of_f); * * ... later, call the function: ... * * copied_f(args); * * The size of the function to be copied can't be determined from C: * this must be determined by other means, such as adding assmbler directives * in the file where f is defined. */ #ifndef __ASM_FNCPY_H #define __ASM_FNCPY_H #include <linux/types.h> #include <linux/string.h> #include <asm/bug.h> #include <asm/cacheflush.h> /* * Minimum alignment requirement for the source and destination addresses * for function copying. */ #define FNCPY_ALIGN 8 #define fncpy(dest_buf, funcp, size) ({ \ uintptr_t __funcp_address; \ typeof(funcp) __result; \ \ asm("" : "=r" (__funcp_address) : "0" (funcp)); \ \ /* \ * Ensure alignment of source and destination addresses, \ * disregarding the function's Thumb bit: \ */ \ BUG_ON((uintptr_t)(dest_buf) & (FNCPY_ALIGN - 1) || \ (__funcp_address & ~(uintptr_t)1 & (FNCPY_ALIGN - 1))); \ \ memcpy(dest_buf, (void const *)(__funcp_address & ~1), size); \ flush_icache_range((unsigned long)(dest_buf), \ (unsigned long)(dest_buf) + (size)); \ \ asm("" : "=r" (__result) \ : "0" ((uintptr_t)(dest_buf) | (__funcp_address & 1))); \ \ __result; \ }) #endif /* !__ASM_FNCPY_H */
/* Qualifiers lost when taking the address of a const restrict object. PR 44322. */ /* { dg-do compile } */ /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ void * restrict const a[2]; void * restrict const (*p2)[2]; void foo(void) { p2 = &a; } void * restrict volatile b[2]; void * restrict volatile (*q2)[2]; void bar(void) { q2 = &b; }
/* ** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $ ** Auxiliary functions to manipulate prototypes and closures ** See Copyright Notice in lua.h */ #ifndef lfunc_h #define lfunc_h #include "lobject.h" #include "lgc.h" #define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ cast(int, sizeof(TValue)*((n)-1))) #define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ cast(int, sizeof(TValue *)*((n)-1))) #define proto_readonly(p) l_setbit((p)->marked, READONLYBIT) #define proto_is_readonly(p) testbit((p)->marked, READONLYBIT) LUAI_FUNC Proto *luaF_newproto (lua_State *L); LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); LUAI_FUNC UpVal *luaF_newupval (lua_State *L); LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); LUAI_FUNC void luaF_close (lua_State *L, StkId level); LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c); LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv); LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, int pc); #endif
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_PLATFORM_REGEXP_H_ #define TENSORFLOW_PLATFORM_REGEXP_H_ #include "tensorflow/core/platform/platform.h" #include "tensorflow/core/platform/types.h" #if defined(PLATFORM_GOOGLE) || defined(PLATFORM_GOOGLE_ANDROID) || \ defined(GOOGLE_RE2) #include "tensorflow/core/platform/google/build_config/re2.h" namespace tensorflow { typedef ::StringPiece RegexpStringPiece; } // namespace tensorflow #else #include "re2/re2.h" namespace tensorflow { typedef re2::StringPiece RegexpStringPiece; } // namespace tensorflow #endif #endif // TENSORFLOW_PLATFORM_REGEXP_H_
/* * Copyright (C) 2005-2006 by Texas Instruments * * The Inventra Controller Driver for Linux is free software; you * can redistribute it and/or modify it under the terms of the GNU * General Public License version 2 as published by the Free Software * Foundation. */ #ifndef __MUSB_OMAP243X_H__ #define __MUSB_OMAP243X_H__ #include <plat/usb.h> /* * OMAP2430-specific definitions */ #define OTG_REVISION 0x400 #define OTG_SYSCONFIG 0x404 # define MIDLEMODE 12 /* bit position */ # define FORCESTDBY (0 << MIDLEMODE) # define NOSTDBY (1 << MIDLEMODE) # define SMARTSTDBY (2 << MIDLEMODE) # define SIDLEMODE 3 /* bit position */ # define FORCEIDLE (0 << SIDLEMODE) # define NOIDLE (1 << SIDLEMODE) # define SMARTIDLE (2 << SIDLEMODE) # define ENABLEWAKEUP (1 << 2) # define SOFTRST (1 << 1) # define AUTOIDLE (1 << 0) #define OTG_SYSSTATUS 0x408 # define RESETDONE (1 << 0) #define OTG_INTERFSEL 0x40c # define EXTCP (1 << 2) # define PHYSEL 0 /* bit position */ # define UTMI_8BIT (0 << PHYSEL) # define ULPI_12PIN (1 << PHYSEL) # define ULPI_8PIN (2 << PHYSEL) #define OTG_SIMENABLE 0x410 # define TM1 (1 << 0) #define OTG_FORCESTDBY 0x414 # define ENABLEFORCE (1 << 0) #endif /* __MUSB_OMAP243X_H__ */
#ifndef _ASM_SOCKET_H #define _ASM_SOCKET_H #include <asm/sockios.h> /* For setsockopt(2) */ #define SOL_SOCKET 1 #define SO_DEBUG 1 #define SO_REUSEADDR 2 #define SO_TYPE 3 #define SO_ERROR 4 #define SO_DONTROUTE 5 #define SO_BROADCAST 6 #define SO_SNDBUF 7 #define SO_RCVBUF 8 #define SO_SNDBUFFORCE 32 #define SO_RCVBUFFORCE 33 #define SO_KEEPALIVE 9 #define SO_OOBINLINE 10 #define SO_NO_CHECK 11 #define SO_PRIORITY 12 #define SO_LINGER 13 #define SO_BSDCOMPAT 14 /* To add :#define SO_REUSEPORT 15 */ #define SO_PASSCRED 16 #define SO_PEERCRED 17 #define SO_RCVLOWAT 18 #define SO_SNDLOWAT 19 #define SO_RCVTIMEO 20 #define SO_SNDTIMEO 21 /* Security levels - as per NRL IPv6 - don't actually do anything */ #define SO_SECURITY_AUTHENTICATION 22 #define SO_SECURITY_ENCRYPTION_TRANSPORT 23 #define SO_SECURITY_ENCRYPTION_NETWORK 24 #define SO_BINDTODEVICE 25 /* Socket filtering */ #define SO_ATTACH_FILTER 26 #define SO_DETACH_FILTER 27 #define SO_PEERNAME 28 #define SO_TIMESTAMP 29 #define SCM_TIMESTAMP SO_TIMESTAMP #define SO_ACCEPTCONN 30 #define SO_PEERSEC 31 #define SO_PASSSEC 34 #define SO_TIMESTAMPNS 35 #define SCM_TIMESTAMPNS SO_TIMESTAMPNS #define SO_MARK 36 #endif /* _ASM_SOCKET_H */
/* Area: ffi_call, closure_call Purpose: Check structure alignment of long double. Limitations: none. PR: none. Originator: Blake Chaffin 6/18/2007 */ /* { dg-do run { xfail strongarm*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ #include "ffitest.h" typedef struct cls_struct_align { long double a; long double b; long double c; long double d; long double e; double f; long double g; } cls_struct_align; cls_struct_align cls_struct_align_fn( cls_struct_align a1, cls_struct_align a2) { struct cls_struct_align r; r.a = a1.a + a2.a; r.b = a1.b + a2.b; r.c = a1.c + a2.c; r.d = a1.d + a2.d; r.e = a1.e + a2.e; r.f = a1.f + a2.f; r.g = a1.g + a2.g; printf("%Lg %Lg %Lg %Lg %Lg %g %Lg %Lg %Lg %Lg %Lg %Lg %g %Lg: " "%Lg %Lg %Lg %Lg %Lg %g %Lg\n", a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, a2.g, r.a, r.b, r.c, r.d, r.e, r.f, r.g); return r; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[8]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; struct cls_struct_align res_dbl; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_fields[0] = &ffi_type_longdouble; cls_struct_fields[1] = &ffi_type_longdouble; cls_struct_fields[2] = &ffi_type_longdouble; cls_struct_fields[3] = &ffi_type_longdouble; cls_struct_fields[4] = &ffi_type_longdouble; cls_struct_fields[5] = &ffi_type_double; cls_struct_fields[6] = &ffi_type_longdouble; cls_struct_fields[7] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ printf("res: %Lg %Lg %Lg %Lg %Lg %g %Lg\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ printf("res: %Lg %Lg %Lg %Lg %Lg %g %Lg\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ exit(0); }
/* * Copyright (c) 2012 Neratec Solutions AG * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef DFS_PATTERN_DETECTOR_H #define DFS_PATTERN_DETECTOR_H #include <linux/types.h> #include <linux/list.h> #include <linux/nl80211.h> /** * struct pulse_event - describing pulses reported by PHY * @ts: pulse time stamp in us * @freq: channel frequency in MHz * @width: pulse duration in us * @rssi: rssi of radar event */ struct pulse_event { u64 ts; u16 freq; u8 width; u8 rssi; }; /** * struct radar_detector_specs - detector specs for a radar pattern type * @type_id: pattern type, as defined by regulatory * @width_min: minimum radar pulse width in [us] * @width_max: maximum radar pulse width in [us] * @pri_min: minimum pulse repetition interval in [us] (including tolerance) * @pri_max: minimum pri in [us] (including tolerance) * @num_pri: maximum number of different pri for this type * @ppb: pulses per bursts for this type * @ppb_thresh: number of pulses required to trigger detection * @max_pri_tolerance: pulse time stamp tolerance on both sides [us] */ struct radar_detector_specs { u8 type_id; u8 width_min; u8 width_max; u16 pri_min; u16 pri_max; u8 num_pri; u8 ppb; u8 ppb_thresh; u8 max_pri_tolerance; }; /** * struct dfs_pattern_detector - DFS pattern detector * @exit(): destructor * @set_domain(): set DFS domain, resets detector lines upon domain changes * @add_pulse(): add radar pulse to detector, returns true on detection * @region: active DFS region, NL80211_DFS_UNSET until set * @num_radar_types: number of different radar types * @last_pulse_ts: time stamp of last valid pulse in usecs * @radar_detector_specs: array of radar detection specs * @channel_detectors: list connecting channel_detector elements */ struct dfs_pattern_detector { void (*exit)(struct dfs_pattern_detector *dpd); bool (*set_domain)(struct dfs_pattern_detector *dpd, enum nl80211_dfs_regions region); bool (*add_pulse)(struct dfs_pattern_detector *dpd, struct pulse_event *pe); enum nl80211_dfs_regions region; u8 num_radar_types; u64 last_pulse_ts; const struct radar_detector_specs *radar_spec; struct list_head channel_detectors; }; /** * dfs_pattern_detector_init() - constructor for pattern detector class * @param region: DFS domain to be used, can be NL80211_DFS_UNSET at creation * @return instance pointer on success, NULL otherwise */ #if defined(CONFIG_ATH9K_DFS_CERTIFIED) extern struct dfs_pattern_detector * dfs_pattern_detector_init(enum nl80211_dfs_regions region); #else static inline struct dfs_pattern_detector * dfs_pattern_detector_init(enum nl80211_dfs_regions region) { return NULL; } #endif /* CONFIG_ATH9K_DFS_CERTIFIED */ #endif /* DFS_PATTERN_DETECTOR_H */
/* * Copyright (c) 2012 NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ #ifndef __DRIVER_CPUQUIET_H #define __DRIVER_CPUQUIET_H #include <linux/device.h> extern struct mutex cpuquiet_lock; extern struct cpuquiet_governor *cpuquiet_curr_governor; extern struct list_head cpuquiet_governors; int cpuquiet_add_interface(struct device *dev); struct cpuquiet_governor *cpuquiet_find_governor(const char *str); int cpuquiet_switch_governor(struct cpuquiet_governor *gov); struct cpuquiet_governor *cpuquiet_get_first_governor(void); struct cpuquiet_driver *cpuquiet_get_driver(void); void cpuquiet_add_dev(struct device *dev, unsigned int cpu); void cpuquiet_remove_dev(unsigned int cpu); int cpuquiet_cpu_kobject_init(struct kobject *kobj, struct kobj_type *type, char *name, int cpu); #endif
/* Copyright 2013 Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 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. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT * OWNER 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. */ /* minidump_format.h: A cross-platform reimplementation of minidump-related * portions of DbgHelp.h from the Windows Platform SDK. * * (This is C99 source, please don't corrupt it with C++.) * * This file contains the necessary definitions to read minidump files * produced on ARM. These files may be read on any platform provided * that the alignments of these structures on the processing system are * identical to the alignments of these structures on the producing system. * For this reason, precise-sized types are used. The structures defined * by this file have been laid out to minimize alignment problems by * ensuring that all members are aligned on their natural boundaries. * In some cases, tail-padding may be significant when different ABIs specify * different tail-padding behaviors. To avoid problems when reading or * writing affected structures, MD_*_SIZE macros are provided where needed, * containing the useful size of the structures without padding. * * Structures that are defined by Microsoft to contain a zero-length array * are instead defined here to contain an array with one element, as * zero-length arrays are forbidden by standard C and C++. In these cases, * *_minsize constants are provided to be used in place of sizeof. For a * cleaner interface to these sizes when using C++, see minidump_size.h. * * These structures are also sufficient to populate minidump files. * * Because precise data type sizes are crucial for this implementation to * function properly and portably, a set of primitive types with known sizes * are used as the basis of each structure defined by this file. * * Author: Colin Blundell */ /* * ARM64 support */ #ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_ARM64_H__ #define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_ARM64_H__ #define MD_FLOATINGSAVEAREA_ARM64_FPR_COUNT 32 typedef struct { uint32_t fpsr; /* FPU status register */ uint32_t fpcr; /* FPU control register */ /* 32 128-bit floating point registers, d0 .. d31. */ uint128_struct regs[MD_FLOATINGSAVEAREA_ARM64_FPR_COUNT]; } MDFloatingSaveAreaARM64; #define MD_CONTEXT_ARM64_GPR_COUNT 33 /* Use the same 32-bit alignment when accessing this structure from 64-bit code * as is used natively in 32-bit code. */ #pragma pack(push, 4) typedef struct { /* The next field determines the layout of the structure, and which parts * of it are populated */ uint64_t context_flags; /* 33 64-bit integer registers, x0 .. x31 + the PC * Note the following fixed uses: * x29 is the frame pointer * x30 is the link register * x31 is the stack pointer * The PC is effectively x32. */ uint64_t iregs[MD_CONTEXT_ARM64_GPR_COUNT]; /* CPSR (flags, basically): 32 bits: bit 31 - N (negative) bit 30 - Z (zero) bit 29 - C (carry) bit 28 - V (overflow) bit 27 - Q (saturation flag, sticky) All other fields -- ignore */ uint32_t cpsr; /* The next field is included with MD_CONTEXT64_ARM_FLOATING_POINT */ MDFloatingSaveAreaARM64 float_save; } MDRawContextARM64; #pragma pack(pop) /* Indices into iregs for registers with a dedicated or conventional * purpose. */ enum MDARM64RegisterNumbers { MD_CONTEXT_ARM64_REG_FP = 29, MD_CONTEXT_ARM64_REG_LR = 30, MD_CONTEXT_ARM64_REG_SP = 31, MD_CONTEXT_ARM64_REG_PC = 32 }; /* For (MDRawContextARM64).context_flags. These values indicate the type of * context stored in the structure. MD_CONTEXT_ARM64 is Breakpad-defined. * This value was chosen to avoid likely conflicts with MD_CONTEXT_* * for other CPUs. */ #define MD_CONTEXT_ARM64 0x80000000 #define MD_CONTEXT_ARM64_INTEGER (MD_CONTEXT_ARM64 | 0x00000002) #define MD_CONTEXT_ARM64_FLOATING_POINT (MD_CONTEXT_ARM64 | 0x00000004) #define MD_CONTEXT_ARM64_FULL (MD_CONTEXT_ARM64_INTEGER | \ MD_CONTEXT_ARM64_FLOATING_POINT) #define MD_CONTEXT_ARM64_ALL (MD_CONTEXT_ARM64_INTEGER | \ MD_CONTEXT_ARM64_FLOATING_POINT) #endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_ARM64_H__ */
/* The following code used to ICE in fold_convert. */ float ceilf(float); int foo(float x) { return (double)ceilf(x); }
/***************************************************************************** (c) Cambridge Silicon Radio Limited 2010 Confidential information of CSR Refer to LICENSE.txt included with this source for details on the license terms. *****************************************************************************/ #ifndef CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_H__ #define CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_H__ #include "csr_wifi_router_prim.h" typedef void (*CsrWifiRouterStateHandlerType)(void* drvpriv, CsrWifiFsmEvent* msg); extern const CsrWifiRouterStateHandlerType CsrWifiRouterDownstreamStateHandlers[CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT]; extern void CsrWifiRouterMaPacketSubscribeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); extern void CsrWifiRouterMaPacketUnsubscribeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); extern void CsrWifiRouterMaPacketReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); extern void CsrWifiRouterMaPacketResHandler(void* drvpriv, CsrWifiFsmEvent* msg); extern void CsrWifiRouterMaPacketCancelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); #endif /* CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_H__ */
/* * PPC EDAC common defs * * Author: Dave Jiang <djiang@mvista.com> * * 2007 (c) MontaVista Software, Inc. This file is licensed under * the terms of the GNU General Public License version 2. This program * is licensed "as is" without any warranty of any kind, whether express * or implied. */ #ifndef ASM_EDAC_H #define ASM_EDAC_H /* * ECC atomic, DMA, SMP and interrupt safe scrub function. * Implements the per arch atomic_scrub() that EDAC use for software * ECC scrubbing. It reads memory and then writes back the original * value, allowing the hardware to detect and correct memory errors. */ static __inline__ void atomic_scrub(void *va, u32 size) { unsigned int *virt_addr = va; unsigned int temp; unsigned int i; for (i = 0; i < size / sizeof(*virt_addr); i++, virt_addr++) { /* Very carefully read and write to memory atomically * so we are interrupt, DMA and SMP safe. */ __asm__ __volatile__ ("\n\ 1: lwarx %0,0,%1\n\ stwcx. %0,0,%1\n\ bne- 1b\n\ isync" : "=&r"(temp) : "r"(virt_addr) : "cr0", "memory"); } } #endif
/* Copyright (c) 2009, Code Aurora Forum. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 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. * * Neither the name of Code Aurora Forum, Inc. nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. */ #ifndef _INTERNAL_POWER_RAIL_H #define _INTERNAL_POWER_RAIL_H /* Clock power rail IDs */ #define PWR_RAIL_GRP_CLK 8 #define PWR_RAIL_GRP_2D_CLK 58 #define PWR_RAIL_MDP_CLK 14 #define PWR_RAIL_MFC_CLK 68 #define PWR_RAIL_ROTATOR_CLK 90 #define PWR_RAIL_VDC_CLK 39 #define PWR_RAIL_VFE_CLK 41 #define PWR_RAIL_VPE_CLK 76 enum rail_ctl_mode { PWR_RAIL_CTL_AUTO = 0, PWR_RAIL_CTL_MANUAL, }; #ifdef CONFIG_ARCH_MSM8X60 static inline int __maybe_unused internal_pwr_rail_ctl(unsigned rail_id, bool enable) { /* Not yet implemented. */ return 0; } static inline int __maybe_unused internal_pwr_rail_mode(unsigned rail_id, enum rail_ctl_mode mode) { /* Not yet implemented. */ return 0; } #else int internal_pwr_rail_ctl(unsigned rail_id, bool enable); int internal_pwr_rail_mode(unsigned rail_id, enum rail_ctl_mode mode); #endif #endif /* _INTERNAL_POWER_RAIL_H */
// SPDX-License-Identifier: MIT /* * Copyright 2019 Advanced Micro Devices, Inc. */ #include <linux/slab.h> #include <linux/tee_drv.h> #include <linux/psp-sev.h> #include "amdtee_private.h" static int pool_op_alloc(struct tee_shm_pool_mgr *poolm, struct tee_shm *shm, size_t size) { unsigned int order = get_order(size); unsigned long va; int rc; va = __get_free_pages(GFP_KERNEL | __GFP_ZERO, order); if (!va) return -ENOMEM; shm->kaddr = (void *)va; shm->paddr = __psp_pa((void *)va); shm->size = PAGE_SIZE << order; /* Map the allocated memory in to TEE */ rc = amdtee_map_shmem(shm); if (rc) { free_pages(va, order); shm->kaddr = NULL; return rc; } return 0; } static void pool_op_free(struct tee_shm_pool_mgr *poolm, struct tee_shm *shm) { /* Unmap the shared memory from TEE */ amdtee_unmap_shmem(shm); free_pages((unsigned long)shm->kaddr, get_order(shm->size)); shm->kaddr = NULL; } static void pool_op_destroy_poolmgr(struct tee_shm_pool_mgr *poolm) { kfree(poolm); } static const struct tee_shm_pool_mgr_ops pool_ops = { .alloc = pool_op_alloc, .free = pool_op_free, .destroy_poolmgr = pool_op_destroy_poolmgr, }; static struct tee_shm_pool_mgr *pool_mem_mgr_alloc(void) { struct tee_shm_pool_mgr *mgr = kzalloc(sizeof(*mgr), GFP_KERNEL); if (!mgr) return ERR_PTR(-ENOMEM); mgr->ops = &pool_ops; return mgr; } struct tee_shm_pool *amdtee_config_shm(void) { struct tee_shm_pool_mgr *priv_mgr; struct tee_shm_pool_mgr *dmabuf_mgr; void *rc; rc = pool_mem_mgr_alloc(); if (IS_ERR(rc)) return rc; priv_mgr = rc; rc = pool_mem_mgr_alloc(); if (IS_ERR(rc)) { tee_shm_pool_mgr_destroy(priv_mgr); return rc; } dmabuf_mgr = rc; rc = tee_shm_pool_alloc(priv_mgr, dmabuf_mgr); if (IS_ERR(rc)) { tee_shm_pool_mgr_destroy(priv_mgr); tee_shm_pool_mgr_destroy(dmabuf_mgr); } return rc; }
/* * arch/arm/plat-omap/include/mach/board.h * * Information structures for board-specific data * * Copyright (C) 2004 Nokia Corporation * Written by Juha Yrjölä <juha.yrjola@nokia.com> */ #ifndef _OMAP_BOARD_H #define _OMAP_BOARD_H #include <linux/types.h> #include <plat/gpio-switch.h> /* * OMAP35x EVM revision * Run time detection of EVM revision is done by reading Ethernet * PHY ID - * GEN_1 = 0x01150000 * GEN_2 = 0x92200000 */ enum { OMAP3EVM_BOARD_GEN_1 = 0, /* EVM Rev between A - D */ OMAP3EVM_BOARD_GEN_2, /* EVM Rev >= Rev E */ }; /* Different peripheral ids */ #define OMAP_TAG_CLOCK 0x4f01 #define OMAP_TAG_LCD 0x4f05 #define OMAP_TAG_GPIO_SWITCH 0x4f06 #define OMAP_TAG_FBMEM 0x4f08 #define OMAP_TAG_STI_CONSOLE 0x4f09 #define OMAP_TAG_CAMERA_SENSOR 0x4f0a #define OMAP_TAG_BOOT_REASON 0x4f80 #define OMAP_TAG_FLASH_PART 0x4f81 #define OMAP_TAG_VERSION_STR 0x4f82 struct omap_clock_config { /* 0 for 12 MHz, 1 for 13 MHz and 2 for 19.2 MHz */ u8 system_clock_type; }; struct omap_serial_console_config { u8 console_uart; u32 console_speed; }; struct omap_sti_console_config { unsigned enable:1; u8 channel; }; struct omap_camera_sensor_config { u16 reset_gpio; int (*power_on)(void * data); int (*power_off)(void * data); }; struct omap_usb_config { /* Configure drivers according to the connectors on your board: * - "A" connector (rectagular) * ... for host/OHCI use, set "register_host". * - "B" connector (squarish) or "Mini-B" * ... for device/gadget use, set "register_dev". * - "Mini-AB" connector (very similar to Mini-B) * ... for OTG use as device OR host, initialize "otg" */ unsigned register_host:1; unsigned register_dev:1; u8 otg; /* port number, 1-based: usb1 == 2 */ u8 hmc_mode; /* implicitly true if otg: host supports remote wakeup? */ u8 rwc; /* signaling pins used to talk to transceiver on usbN: * 0 == usbN unused * 2 == usb0-only, using internal transceiver * 3 == 3 wire bidirectional * 4 == 4 wire bidirectional * 6 == 6 wire unidirectional (or TLL) */ u8 pins[3]; struct platform_device *udc_device; struct platform_device *ohci_device; struct platform_device *otg_device; u32 (*usb0_init)(unsigned nwires, unsigned is_device); u32 (*usb1_init)(unsigned nwires); u32 (*usb2_init)(unsigned nwires, unsigned alt_pingroup); }; struct omap_lcd_config { char panel_name[16]; char ctrl_name[16]; s16 nreset_gpio; u8 data_lines; }; struct device; struct fb_info; struct omap_backlight_config { int default_intensity; int (*set_power)(struct device *dev, int state); }; struct omap_fbmem_config { u32 start; u32 size; }; struct omap_pwm_led_platform_data { const char *name; int intensity_timer; int blink_timer; void (*set_power)(struct omap_pwm_led_platform_data *self, int on_off); }; struct omap_uart_config { /* Bit field of UARTs present; bit 0 --> UART1 */ unsigned int enabled_uarts; }; struct omap_flash_part_config { char part_table[0]; }; struct omap_boot_reason_config { char reason_str[12]; }; struct omap_version_config { char component[12]; char version[12]; }; struct omap_board_config_entry { u16 tag; u16 len; u8 data[0]; }; struct omap_board_config_kernel { u16 tag; const void *data; }; extern const void *__init __omap_get_config(u16 tag, size_t len, int nr); #define omap_get_config(tag, type) \ ((const type *) __omap_get_config((tag), sizeof(type), 0)) #define omap_get_nr_config(tag, type, nr) \ ((const type *) __omap_get_config((tag), sizeof(type), (nr))) extern const void *__init omap_get_var_config(u16 tag, size_t *len); extern struct omap_board_config_kernel *omap_board_config; extern int omap_board_config_size; /* for TI reference platforms sharing the same debug card */ extern int debug_card_init(u32 addr, unsigned gpio); /* OMAP3EVM revision */ #if defined(CONFIG_MACH_OMAP3EVM) u8 get_omap3_evm_rev(void); #else #define get_omap3_evm_rev() (-EINVAL) #endif #endif
/* * Support for the VMIVME-7805 board access to the Universe II bridge. * * Author: Arthur Benilov <arthur.benilov@iba-group.com> * Copyright 2010 Ion Beam Application, Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ #include <linux/module.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/pci.h> #include <linux/poll.h> #include <linux/io.h> #include "vme_vmivme7805.h" static int __init vmic_init(void); static int vmic_probe(struct pci_dev *, const struct pci_device_id *); static void vmic_remove(struct pci_dev *); static void __exit vmic_exit(void); /** Base address to access FPGA register */ static void *vmic_base; static const char driver_name[] = "vmivme_7805"; static DEFINE_PCI_DEVICE_TABLE(vmic_ids) = { { PCI_DEVICE(PCI_VENDOR_ID_VMIC, PCI_DEVICE_ID_VTIMR) }, { }, }; static struct pci_driver vmic_driver = { .name = driver_name, .id_table = vmic_ids, .probe = vmic_probe, .remove = vmic_remove, }; static int __init vmic_init(void) { return pci_register_driver(&vmic_driver); } static int vmic_probe(struct pci_dev *pdev, const struct pci_device_id *id) { int retval; u32 data; /* Enable the device */ retval = pci_enable_device(pdev); if (retval) { dev_err(&pdev->dev, "Unable to enable device\n"); goto err; } /* Map Registers */ retval = pci_request_regions(pdev, driver_name); if (retval) { dev_err(&pdev->dev, "Unable to reserve resources\n"); goto err_resource; } /* Map registers in BAR 0 */ vmic_base = ioremap_nocache(pci_resource_start(pdev, 0), 16); if (!vmic_base) { dev_err(&pdev->dev, "Unable to remap CRG region\n"); retval = -EIO; goto err_remap; } /* Clear the FPGA VME IF contents */ iowrite32(0, vmic_base + VME_CONTROL); /* Clear any initial BERR */ data = ioread32(vmic_base + VME_CONTROL) & 0x00000FFF; data |= BM_VME_CONTROL_BERRST; iowrite32(data, vmic_base + VME_CONTROL); /* Enable the vme interface and byte swapping */ data = ioread32(vmic_base + VME_CONTROL) & 0x00000FFF; data = data | BM_VME_CONTROL_MASTER_ENDIAN | BM_VME_CONTROL_SLAVE_ENDIAN | BM_VME_CONTROL_ABLE | BM_VME_CONTROL_BERRI | BM_VME_CONTROL_BPENA | BM_VME_CONTROL_VBENA; iowrite32(data, vmic_base + VME_CONTROL); return 0; err_remap: pci_release_regions(pdev); err_resource: pci_disable_device(pdev); err: return retval; } static void vmic_remove(struct pci_dev *pdev) { iounmap(vmic_base); pci_release_regions(pdev); pci_disable_device(pdev); } static void __exit vmic_exit(void) { pci_unregister_driver(&vmic_driver); } MODULE_DESCRIPTION("VMIVME-7805 board support driver"); MODULE_AUTHOR("Arthur Benilov <arthur.benilov@iba-group.com>"); MODULE_LICENSE("GPL"); module_init(vmic_init); module_exit(vmic_exit);
/* * Generated by class-dump 3.1.2. * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2007 by Steve Nygard. */ #import "_ADBannerContentSizeIdentifierLandscape.h" @interface Options : _ADBannerContentSizeIdentifierLandscape { BOOL highlight; BOOL disallowSleep; BOOL displayTimer; BOOL displayIncorrect; BOOL displayConflict; BOOL autoUpdateNotes; } - (void)setAutoUpdateNotes:(BOOL)fp8; - (BOOL)autoUpdateNotes; - (void)setDisplayConflict:(BOOL)fp8; - (BOOL)displayConflict; - (void)setDisplayIncorrect:(BOOL)fp8; - (BOOL)displayIncorrect; - (void)setDisplayTimer:(BOOL)fp8; - (BOOL)displayTimer; - (void)setDisallowSleep:(BOOL)fp8; - (BOOL)disallowSleep; - (void)setHighlight:(BOOL)fp8; - (BOOL)highlight; - (void)saveToUserDefaults; - (void)loadFromUserDefaults; - (BOOL)getBool:(id)fp8 withDefault:(BOOL)fp12; @end
/* * This file is part of OpenGrafik. * * Copyright 2009 Frederic Morcos <fred.morcos@gmail.com> * * OpenGrafik is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * OpenGrafik is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with OpenGrafik. If not, see <http://www.gnu.org/licenses/>. */ #import "Layer.h" @interface Group: Layer @end