answer
stringlengths
15
1.25M
<?php // This file is part of BOINC. // BOINC is free software; you can redistribute it and/or modify it // as published by the Free Software Foundation, // BOINC is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // web interfaces for viewing and controlling batches ini_set('display_errors', 'stdout'); error_reporting(E_ALL); require_once("../inc/util.inc"); require_once("../inc/boinc_db.inc"); require_once("../inc/result.inc"); require_once("../inc/submit_db.inc"); function show_batch($user) { $batch_id = get_int('batch_id'); $batch = BoincBatch::lookup_id($batch_id); if (!$batch || $batch->user_id != $user->id) { error_page("no batch"); } page_head("Batch $batch->id"); $results = BoincResult::enum("batch=$batch->id order by workunitid"); $i = 0; result_table_start(true, true, null); foreach ($results as $result) { show_result_row($result, true, true, true, $i++); } end_table(); page_tail(); } function show_batches($user) { $batches = BoincBatch::enum("user_id=$user->id"); page_head("Batches"); start_table(); table_header("Batch ID", "Submitted", "# jobs"); foreach ($batches as $batch) { echo "<tr> <td><a href=submit_status.php?action=show_batch&batch_id=$batch->id>$batch->id</a></td> <td>".time_str($batch->create_time)."</td> <td>$batch->njobs</td> </tr> "; } end_table(); page_tail(); } $user = get_logged_in_user(); $action = get_str('action', true); switch ($action) { case '': show_batches($user); break; case 'show_batch': show_batch($user); } ?>
# -*- coding: utf-8 -*- # OpenERP, Open Source Management Solution # This program is free software: you can redistribute it and/or modify # published by the Free Software Foundation, either version 3 of the # This program is distributed in the hope that it will be useful, # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the import copy from openerp import models from openerp.addons.account.report.<API key> import\ <API key> class <API key>(<API key>): def __init__(self, cr, uid, name, context=None): super(<API key>, self).__init__( cr, uid, name, context=context) self.localcontext.update({ 'get_left_lines': self.get_left_lines, 'get_right_lines': self.get_right_lines, }) def get_lines(self, data, side=None): data = copy.deepcopy(data) if data['form']['used_context'] is None: data['form']['used_context'] = {} data['form']['used_context'].update( <API key>=side) return super(<API key>, self).get_lines( data) def get_left_lines(self, data): return self.get_lines(data, side='left') def get_right_lines(self, data): return self.get_lines(data, side='right') class ReportFinancial(models.AbstractModel): _inherit = 'report.account.report_financial' <API key> = <API key>
package org.hsqldb_voltpatches.lib; /** * This should be used as the datatype for parameters and instance variables * instead of HsqlArrayList or HsqlLinkedList to allow interchangable use of the * two. * * @author dnordahl@users * @version 1.7.2 * @since 1.7.2 */ public interface HsqlList extends Collection { void add(int index, Object element); boolean add(Object element); Object get(int index); Object remove(int index); Object set(int index, Object element); boolean isEmpty(); int size(); Iterator iterator(); }
#!/usr/bin/env python # This file is subject to the terms and conditions of the GNU Lesser # directory for more details. import os import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner from datetime import datetime class InvalidTimeout(Exception): pass def testfunc(child): exp_diff1 = 1000000 exp_diff5 = 5000000 exp_diff10 = 10000000 child.expect(u"This test will print \"Slept for X sec...\" every 1, 5 and 10 seconds.\r\n") child.expect(u"\r\n") child.expect(u"<======== If using pyterm, this is the time when started.") child.expect(u"\r\n") m = 9 while (m): n = 3 while (n): if n == 3: exp_diff = exp_diff1 if n == 2: exp_diff = exp_diff5 elif n == 1: exp_diff = exp_diff10 start = datetime.now() child.expect(u"Slept for \\d+ sec...", timeout=11) stop = datetime.now() diff = (stop - start) diff = (diff.seconds * 1000000) + diff.microseconds # fail within 5% of expected if diff > (exp_diff + (exp_diff1 * 0.05)) or \ diff < (exp_diff - (exp_diff1 * 0.05)): raise InvalidTimeout("Invalid timeout %d (expected %d)" % (diff, exp_diff)); else: print("Timed out correctly: %d (expected %d)" % (diff, exp_diff)) n = n - 1 m = m -1 child.expect(u"Test end.", timeout=15) if __name__ == "__main__": sys.exit(testrunner.run(testfunc))
// The LLVM Compiler Infrastructure // This file is distributed under the University of Illinois Open Source // This file implements the LiveDebugVariables analysis. // Remove all DBG_VALUE instructions referencing virtual registers and replace // them with a data structure tracking where live user variables are kept - in a // virtual register or in a stack slot. // Allow the data structure to be updated during register allocation when values // are moved between registers and stack slots. Finally emit new DBG_VALUE // instructions after register allocation is complete. #include "LiveDebugVariables.h" #include "llvm/ADT/IntervalMap.h" #include "llvm/ADT/Statistic.h" #include "llvm/CodeGen/LexicalScopes.h" #include "llvm/CodeGen/<API key>.h" #include "llvm/CodeGen/MachineDominators.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/Passes.h" #include "llvm/CodeGen/VirtRegMap.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DebugInfo.h" #include "llvm/IR/Metadata.h" #include "llvm/IR/Value.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetSubtargetInfo.h" #include <memory> #include <utility> using namespace llvm; #define DEBUG_TYPE "livedebug" static cl::opt<bool> EnableLDV("<API key>", cl::init(true), cl::desc("Enable the live debug variables pass"), cl::Hidden); STATISTIC(<API key>, "Number of DBG_VALUEs inserted"); char LiveDebugVariables::ID = 0; <API key>(LiveDebugVariables, "livedebugvars", "Debug Variable Analysis", false, false) <API key>(<API key>) <API key>(LiveIntervals) INITIALIZE_PASS_END(LiveDebugVariables, "livedebugvars", "Debug Variable Analysis", false, false) void LiveDebugVariables::getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<<API key>>(); AU.<API key><LiveIntervals>(); AU.setPreservesAll(); MachineFunctionPass::getAnalysisUsage(AU); } LiveDebugVariables::LiveDebugVariables() : MachineFunctionPass(ID), pImpl(nullptr) { <API key>(*PassRegistry::getPassRegistry()); } LocMap - Map of where a user value is live, and its location. typedef IntervalMap<SlotIndex, unsigned, 4> LocMap; namespace { UserValueScopes - Keeps track of lexical scopes associated with a user value's source location. class UserValueScopes { DebugLoc DL; LexicalScopes &LS; SmallPtrSet<const MachineBasicBlock *, 4> LBlocks; public: UserValueScopes(DebugLoc D, LexicalScopes &L) : DL(std::move(D)), LS(L) {} dominates - Return true if current scope dominates at least one machine instruction in a given machine basic block. bool dominates(MachineBasicBlock *MBB) { if (LBlocks.empty()) LS.<API key>(DL, LBlocks); return LBlocks.count(MBB) != 0 || LS.dominates(DL, MBB); } }; } // end anonymous namespace UserValue - A user value is a part of a debug info user variable. A DBG_VALUE instruction notes that (a sub-register of) a virtual register holds part of a user variable. The part is identified by a byte offset. UserValues are grouped into equivalence classes for easier searching. Two user values are related if they refer to the same variable, or if they are held by the same virtual register. The equivalence class is the transitive closure of that relation. namespace { class LDVImpl; class UserValue { const MDNode *Variable; ///< The debug info variable we are part of. const MDNode *Expression; ///< Any complex address expression. unsigned offset; ///< Byte offset into variable. bool IsIndirect; ///< true if this is a register-indirect+offset value. DebugLoc dl; ///< The debug location for the variable. This is < used by dwarf writer to find lexical scope. UserValue *leader; ///< Equivalence class leader. UserValue *next; ///< Next value in equivalence class, or null. Numbered locations referenced by locmap. SmallVector<MachineOperand, 4> locations; Map of slot indices where this value is live. LocMap locInts; coalesceLocation - After LocNo was changed, check if it has become identical to another location, and coalesce them. This may cause LocNo or a later location to be erased, but no earlier location will be erased. void coalesceLocation(unsigned LocNo); insertDebugValue - Insert a DBG_VALUE into MBB at Idx for LocNo. void insertDebugValue(MachineBasicBlock *MBB, SlotIndex Idx, unsigned LocNo, LiveIntervals &LIS, const TargetInstrInfo &TII); splitLocation - Replace OldLocNo ranges with NewRegs ranges where NewRegs is live. Returns true if any changes were made. bool splitLocation(unsigned OldLocNo, ArrayRef<unsigned> NewRegs, LiveIntervals &LIS); public: UserValue - Create a new UserValue. UserValue(const MDNode *var, const MDNode *expr, unsigned o, bool i, DebugLoc L, LocMap::Allocator &alloc) : Variable(var), Expression(expr), offset(o), IsIndirect(i), dl(std::move(L)), leader(this), next(nullptr), locInts(alloc) {} getLeader - Get the leader of this value's equivalence class. UserValue *getLeader() { UserValue *l = leader; while (l != l->leader) l = l->leader; return leader = l; } getNext - Return the next UserValue in the equivalence class. UserValue *getNext() const { return next; } match - Does this UserValue match the parameters? bool match(const MDNode *Var, const MDNode *Expr, const DILocation *IA, unsigned Offset, bool indirect) const { return Var == Variable && Expr == Expression && dl->getInlinedAt() == IA && Offset == offset && indirect == IsIndirect; } merge - Merge equivalence classes. static UserValue *merge(UserValue *L1, UserValue *L2) { L2 = L2->getLeader(); if (!L1) return L2; L1 = L1->getLeader(); if (L1 == L2) return L1; // Splice L2 before L1's members. UserValue *End = L2; while (End->next) { End->leader = L1; End = End->next; } End->leader = L1; End->next = L1->next; L1->next = L2; return L1; } getLocationNo - Return the location number that matches Loc. unsigned getLocationNo(const MachineOperand &LocMO) { if (LocMO.isReg()) { if (LocMO.getReg() == 0) return ~0u; // For register locations we dont care about use/def and other flags. for (unsigned i = 0, e = locations.size(); i != e; ++i) if (locations[i].isReg() && locations[i].getReg() == LocMO.getReg() && locations[i].getSubReg() == LocMO.getSubReg()) return i; } else for (unsigned i = 0, e = locations.size(); i != e; ++i) if (LocMO.isIdenticalTo(locations[i])) return i; locations.push_back(LocMO); // We are storing a MachineOperand outside a MachineInstr. locations.back().clearParent(); // Don't store def operands. if (locations.back().isReg()) locations.back().setIsUse(); return locations.size() - 1; } mapVirtRegs - Ensure that all virtual register locations are mapped. void mapVirtRegs(LDVImpl *LDV); addDef - Add a definition point to this value. void addDef(SlotIndex Idx, const MachineOperand &LocMO) { // Add a singular (Idx,Idx) -> Loc mapping. LocMap::iterator I = locInts.find(Idx); if (!I.valid() || I.start() != Idx) I.insert(Idx, Idx.getNextSlot(), getLocationNo(LocMO)); else // A later DBG_VALUE at the same SlotIndex overrides the old location. I.setValue(getLocationNo(LocMO)); } extendDef - Extend the current definition as far as possible down the dominator tree. Stop when meeting an existing def or when leaving the live range of VNI. End points where VNI is no longer live are added to Kills. @param Idx Starting point for the definition. @param LocNo Location number to propagate. @param LR Restrict liveness to where LR has the value VNI. May be null. @param VNI When LR is not null, this is the value to restrict to. @param Kills Append end points of VNI's live range to Kills. @param LIS Live intervals analysis. @param MDT Dominator tree. void extendDef(SlotIndex Idx, unsigned LocNo, LiveRange *LR, const VNInfo *VNI, SmallVectorImpl<SlotIndex> *Kills, LiveIntervals &LIS, <API key> &MDT, UserValueScopes &UVS); addDefsFromCopies - The value in LI/LocNo may be copies to other registers. Determine if any of the copies are available at the kill points, and add defs if possible. @param LI Scan for copies of the value in LI->reg. @param LocNo Location number of LI->reg. @param Kills Points where the range of LocNo could be extended. @param NewDefs Append (Idx, LocNo) of inserted defs here. void addDefsFromCopies(LiveInterval *LI, unsigned LocNo, const SmallVectorImpl<SlotIndex> &Kills, SmallVectorImpl<std::pair<SlotIndex, unsigned> > &NewDefs, MachineRegisterInfo &MRI, LiveIntervals &LIS); computeIntervals - Compute the live intervals of all locations after collecting all their def points. void computeIntervals(MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI, LiveIntervals &LIS, <API key> &MDT, UserValueScopes &UVS); splitRegister - Replace OldReg ranges with NewRegs ranges where NewRegs is live. Returns true if any changes were made. bool splitRegister(unsigned OldLocNo, ArrayRef<unsigned> NewRegs, LiveIntervals &LIS); rewriteLocations - Rewrite virtual register locations according to the provided virtual register map. void rewriteLocations(VirtRegMap &VRM, const TargetRegisterInfo &TRI); emitDebugValues - Recreate DBG_VALUE instruction from data structures. void emitDebugValues(VirtRegMap *VRM, LiveIntervals &LIS, const TargetInstrInfo &TRI); getDebugLoc - Return DebugLoc of this UserValue. DebugLoc getDebugLoc() { return dl;} void print(raw_ostream &, const TargetRegisterInfo *); }; } // namespace LDVImpl - Implementation of the LiveDebugVariables pass. namespace { class LDVImpl { LiveDebugVariables &pass; LocMap::Allocator allocator; MachineFunction *MF; LiveIntervals *LIS; LexicalScopes LS; <API key> *MDT; const TargetRegisterInfo *TRI; Whether emitDebugValues is called. bool EmitDone; Whether the machine function is modified during the pass. bool ModifiedMF; userValues - All allocated UserValue instances. SmallVector<std::unique_ptr<UserValue>, 8> userValues; Map virtual register to eq class leader. typedef DenseMap<unsigned, UserValue*> VRMap; VRMap virtRegToEqClass; Map user variable to eq class leader. typedef DenseMap<const MDNode *, UserValue*> UVMap; UVMap userVarMap; getUserValue - Find or create a UserValue. UserValue *getUserValue(const MDNode *Var, const MDNode *Expr, unsigned Offset, bool IsIndirect, const DebugLoc &DL); lookupVirtReg - Find the EC leader for VirtReg or null. UserValue *lookupVirtReg(unsigned VirtReg); handleDebugValue - Add DBG_VALUE instruction to our maps. @param MI DBG_VALUE instruction @param Idx Last valid SLotIndex before instruction. @return True if the DBG_VALUE instruction should be deleted. bool handleDebugValue(MachineInstr &MI, SlotIndex Idx); collectDebugValues - Collect and erase all DBG_VALUE instructions, adding a UserValue def for each instruction. @param mf MachineFunction to be scanned. @return True if any debug values were found. bool collectDebugValues(MachineFunction &mf); computeIntervals - Compute the live intervals of all user values after collecting all their def points. void computeIntervals(); public: LDVImpl(LiveDebugVariables *ps) : pass(*ps), MF(nullptr), EmitDone(false), ModifiedMF(false) {} bool <API key>(MachineFunction &mf); clear - Release all memory. void clear() { MF = nullptr; userValues.clear(); virtRegToEqClass.clear(); userVarMap.clear(); // Make sure we call emitDebugValues if the machine function was modified. assert((!ModifiedMF || EmitDone) && "Dbg values are not emitted in LDV"); EmitDone = false; ModifiedMF = false; LS.reset(); } mapVirtReg - Map virtual register to an equivalence class. void mapVirtReg(unsigned VirtReg, UserValue *EC); splitRegister - Replace all references to OldReg with NewRegs. void splitRegister(unsigned OldReg, ArrayRef<unsigned> NewRegs); emitDebugValues - Recreate DBG_VALUE instruction from data structures. void emitDebugValues(VirtRegMap *VRM); void print(raw_ostream&); }; } // namespace static void printDebugLoc(const DebugLoc &DL, raw_ostream &CommentOS, const LLVMContext &Ctx) { if (!DL) return; auto *Scope = cast<DIScope>(DL.getScope()); // Omit the directory, because it's likely to be long and uninteresting. CommentOS << Scope->getFilename(); CommentOS << ':' << DL.getLine(); if (DL.getCol() != 0) CommentOS << ':' << DL.getCol(); DebugLoc InlinedAtDL = DL.getInlinedAt(); if (!InlinedAtDL) return; CommentOS << " @[ "; printDebugLoc(InlinedAtDL, CommentOS, Ctx); CommentOS << " ]"; } static void printExtendedName(raw_ostream &OS, const DILocalVariable *V, const DILocation *DL) { const LLVMContext &Ctx = V->getContext(); StringRef Res = V->getName(); if (!Res.empty()) OS << Res << "," << V->getLine(); if (auto *InlinedAt = DL->getInlinedAt()) { if (DebugLoc InlinedAtDL = InlinedAt) { OS << " @["; printDebugLoc(InlinedAtDL, OS, Ctx); OS << "]"; } } } void UserValue::print(raw_ostream &OS, const TargetRegisterInfo *TRI) { auto *DV = cast<DILocalVariable>(Variable); OS << "!\""; printExtendedName(OS, DV, dl); OS << "\"\t"; if (offset) OS << '+' << offset; for (LocMap::const_iterator I = locInts.begin(); I.valid(); ++I) { OS << " [" << I.start() << ';' << I.stop() << "):"; if (I.value() == ~0u) OS << "undef"; else OS << I.value(); } for (unsigned i = 0, e = locations.size(); i != e; ++i) { OS << " Loc" << i << '='; locations[i].print(OS, TRI); } OS << '\n'; } void LDVImpl::print(raw_ostream &OS) { OS << "********** DEBUG VARIABLES **********\n"; for (unsigned i = 0, e = userValues.size(); i != e; ++i) userValues[i]->print(OS, TRI); } void UserValue::coalesceLocation(unsigned LocNo) { unsigned KeepLoc = 0; for (unsigned e = locations.size(); KeepLoc != e; ++KeepLoc) { if (KeepLoc == LocNo) continue; if (locations[KeepLoc].isIdenticalTo(locations[LocNo])) break; } // No matches. if (KeepLoc == locations.size()) return; // Keep the smaller location, erase the larger one. unsigned EraseLoc = LocNo; if (KeepLoc > EraseLoc) std::swap(KeepLoc, EraseLoc); locations.erase(locations.begin() + EraseLoc); // Rewrite values. for (LocMap::iterator I = locInts.begin(); I.valid(); ++I) { unsigned v = I.value(); if (v == EraseLoc) I.setValue(KeepLoc); // Coalesce when possible. else if (v > EraseLoc) I.setValueUnchecked(v-1); // Avoid coalescing with untransformed values. } } void UserValue::mapVirtRegs(LDVImpl *LDV) { for (unsigned i = 0, e = locations.size(); i != e; ++i) if (locations[i].isReg() && TargetRegisterInfo::isVirtualRegister(locations[i].getReg())) LDV->mapVirtReg(locations[i].getReg(), this); } UserValue *LDVImpl::getUserValue(const MDNode *Var, const MDNode *Expr, unsigned Offset, bool IsIndirect, const DebugLoc &DL) { UserValue *&Leader = userVarMap[Var]; if (Leader) { UserValue *UV = Leader->getLeader(); Leader = UV; for (; UV; UV = UV->getNext()) if (UV->match(Var, Expr, DL->getInlinedAt(), Offset, IsIndirect)) return UV; } userValues.push_back( make_unique<UserValue>(Var, Expr, Offset, IsIndirect, DL, allocator)); UserValue *UV = userValues.back().get(); Leader = UserValue::merge(Leader, UV); return UV; } void LDVImpl::mapVirtReg(unsigned VirtReg, UserValue *EC) { assert(TargetRegisterInfo::isVirtualRegister(VirtReg) && "Only map VirtRegs"); UserValue *&Leader = virtRegToEqClass[VirtReg]; Leader = UserValue::merge(Leader, EC); } UserValue *LDVImpl::lookupVirtReg(unsigned VirtReg) { if (UserValue *UV = virtRegToEqClass.lookup(VirtReg)) return UV->getLeader(); return nullptr; } bool LDVImpl::handleDebugValue(MachineInstr &MI, SlotIndex Idx) { // DBG_VALUE loc, offset, variable if (MI.getNumOperands() != 4 || !(MI.getOperand(1).isReg() || MI.getOperand(1).isImm()) || !MI.getOperand(2).isMetadata()) { DEBUG(dbgs() << "Can't handle " << MI); return false; } // Get or create the UserValue for (variable,offset). bool IsIndirect = MI.<API key>(); unsigned Offset = IsIndirect ? MI.getOperand(1).getImm() : 0; const MDNode *Var = MI.getDebugVariable(); const MDNode *Expr = MI.getDebugExpression(); //here. UserValue *UV = getUserValue(Var, Expr, Offset, IsIndirect, MI.getDebugLoc()); UV->addDef(Idx, MI.getOperand(0)); return true; } bool LDVImpl::collectDebugValues(MachineFunction &mf) { bool Changed = false; for (MachineFunction::iterator MFI = mf.begin(), MFE = mf.end(); MFI != MFE; ++MFI) { MachineBasicBlock *MBB = &*MFI; for (MachineBasicBlock::iterator MBBI = MBB->begin(), MBBE = MBB->end(); MBBI != MBBE;) { if (!MBBI->isDebugValue()) { ++MBBI; continue; } // DBG_VALUE has no slot index, use the previous instruction instead. SlotIndex Idx = MBBI == MBB->begin() ? LIS->getMBBStartIdx(MBB) : LIS->getInstructionIndex(*std::prev(MBBI)).getRegSlot(); // Handle consecutive DBG_VALUE instructions with the same slot index. do { if (handleDebugValue(*MBBI, Idx)) { MBBI = MBB->erase(MBBI); Changed = true; } else ++MBBI; } while (MBBI != MBBE && MBBI->isDebugValue()); } } return Changed; } We only propagate DBG_VALUES locally here. LiveDebugValues performs a data-flow analysis to propagate them beyond basic block boundaries. void UserValue::extendDef(SlotIndex Idx, unsigned LocNo, LiveRange *LR, const VNInfo *VNI, SmallVectorImpl<SlotIndex> *Kills, LiveIntervals &LIS, <API key> &MDT, UserValueScopes &UVS) { SlotIndex Start = Idx; MachineBasicBlock *MBB = LIS.getMBBFromIndex(Start); SlotIndex Stop = LIS.getMBBEndIdx(MBB); LocMap::iterator I = locInts.find(Start); // Limit to VNI's live range. bool ToEnd = true; if (LR && VNI) { LiveInterval::Segment *Segment = LR-><API key>(Start); if (!Segment || Segment->valno != VNI) { if (Kills) Kills->push_back(Start); return; } if (Segment->end < Stop) { Stop = Segment->end; ToEnd = false; } } // There could already be a short def at Start. if (I.valid() && I.start() <= Start) { // Stop when meeting a different location or an already extended interval. Start = Start.getNextSlot(); if (I.value() != LocNo || I.stop() != Start) return; // This is a one-slot placeholder. Just skip it. ++I; } // Limited by the next def. if (I.valid() && I.start() < Stop) { Stop = I.start(); ToEnd = false; } // Limited by VNI's live range. else if (!ToEnd && Kills) Kills->push_back(Stop); if (Start < Stop) I.insert(Start, Stop, LocNo); } void UserValue::addDefsFromCopies(LiveInterval *LI, unsigned LocNo, const SmallVectorImpl<SlotIndex> &Kills, SmallVectorImpl<std::pair<SlotIndex, unsigned> > &NewDefs, MachineRegisterInfo &MRI, LiveIntervals &LIS) { if (Kills.empty()) return; // Don't track copies from physregs, there are too many uses. if (!TargetRegisterInfo::isVirtualRegister(LI->reg)) return; // Collect all the (vreg, valno) pairs that are copies of LI. SmallVector<std::pair<LiveInterval*, const VNInfo*>, 8> CopyValues; for (MachineOperand &MO : MRI.use_nodbg_operands(LI->reg)) { MachineInstr *MI = MO.getParent(); // Copies of the full value. if (MO.getSubReg() || !MI->isCopy()) continue; unsigned DstReg = MI->getOperand(0).getReg(); // Don't follow copies to physregs. These are usually setting up call // arguments, and the argument registers are always call clobbered. We are // better off in the source register which could be a callee-saved register, // or it could be spilled. if (!TargetRegisterInfo::isVirtualRegister(DstReg)) continue; // Is LocNo extended to reach this copy? If not, another def may be blocking // it, or we are looking at a wrong value of LI. SlotIndex Idx = LIS.getInstructionIndex(*MI); LocMap::iterator I = locInts.find(Idx.getRegSlot(true)); if (!I.valid() || I.value() != LocNo) continue; if (!LIS.hasInterval(DstReg)) continue; LiveInterval *DstLI = &LIS.getInterval(DstReg); const VNInfo *DstVNI = DstLI->getVNInfoAt(Idx.getRegSlot()); assert(DstVNI && DstVNI->def == Idx.getRegSlot() && "Bad copy value"); CopyValues.push_back(std::make_pair(DstLI, DstVNI)); } if (CopyValues.empty()) return; DEBUG(dbgs() << "Got " << CopyValues.size() << " copies of " << *LI << '\n'); // Try to add defs of the copied values for each kill point. for (unsigned i = 0, e = Kills.size(); i != e; ++i) { SlotIndex Idx = Kills[i]; for (unsigned j = 0, e = CopyValues.size(); j != e; ++j) { LiveInterval *DstLI = CopyValues[j].first; const VNInfo *DstVNI = CopyValues[j].second; if (DstLI->getVNInfoAt(Idx) != DstVNI) continue; // Check that there isn't already a def at Idx LocMap::iterator I = locInts.find(Idx); if (I.valid() && I.start() <= Idx) continue; DEBUG(dbgs() << "Kill at " << Idx << " covered by valno << DstVNI->id << " in " << *DstLI << '\n'); MachineInstr *CopyMI = LIS.<API key>(DstVNI->def); assert(CopyMI && CopyMI->isCopy() && "Bad copy value"); unsigned LocNo = getLocationNo(CopyMI->getOperand(0)); I.insert(Idx, Idx.getNextSlot(), LocNo); NewDefs.push_back(std::make_pair(Idx, LocNo)); break; } } } void UserValue::computeIntervals(MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI, LiveIntervals &LIS, <API key> &MDT, UserValueScopes &UVS) { SmallVector<std::pair<SlotIndex, unsigned>, 16> Defs; // Collect all defs to be extended (Skipping undefs). for (LocMap::const_iterator I = locInts.begin(); I.valid(); ++I) if (I.value() != ~0u) Defs.push_back(std::make_pair(I.start(), I.value())); // Extend all defs, and possibly add new ones along the way. for (unsigned i = 0; i != Defs.size(); ++i) { SlotIndex Idx = Defs[i].first; unsigned LocNo = Defs[i].second; const MachineOperand &Loc = locations[LocNo]; if (!Loc.isReg()) { extendDef(Idx, LocNo, nullptr, nullptr, nullptr, LIS, MDT, UVS); continue; } // Register locations are constrained to where the register value is live. if (TargetRegisterInfo::isVirtualRegister(Loc.getReg())) { LiveInterval *LI = nullptr; const VNInfo *VNI = nullptr; if (LIS.hasInterval(Loc.getReg())) { LI = &LIS.getInterval(Loc.getReg()); VNI = LI->getVNInfoAt(Idx); } SmallVector<SlotIndex, 16> Kills; extendDef(Idx, LocNo, LI, VNI, &Kills, LIS, MDT, UVS); if (LI) addDefsFromCopies(LI, LocNo, Kills, Defs, MRI, LIS); continue; } // For physregs, use the live range of the first regunit as a guide. unsigned Unit = *MCRegUnitIterator(Loc.getReg(), &TRI); LiveRange *LR = &LIS.getRegUnit(Unit); const VNInfo *VNI = LR->getVNInfoAt(Idx); // Don't track copies from physregs, it is too expensive. extendDef(Idx, LocNo, LR, VNI, nullptr, LIS, MDT, UVS); } // Finally, erase all the undefs. for (LocMap::iterator I = locInts.begin(); I.valid();) if (I.value() == ~0u) I.erase(); else ++I; } void LDVImpl::computeIntervals() { for (unsigned i = 0, e = userValues.size(); i != e; ++i) { UserValueScopes UVS(userValues[i]->getDebugLoc(), LS); userValues[i]->computeIntervals(MF->getRegInfo(), *TRI, *LIS, *MDT, UVS); userValues[i]->mapVirtRegs(this); } } bool LDVImpl::<API key>(MachineFunction &mf) { clear(); MF = &mf; LIS = &pass.getAnalysis<LiveIntervals>(); MDT = &pass.getAnalysis<<API key>>(); TRI = mf.getSubtarget().getRegisterInfo(); LS.initialize(mf); DEBUG(dbgs() << "********** COMPUTING LIVE DEBUG VARIABLES: " << mf.getName() << " **********\n"); bool Changed = collectDebugValues(mf); computeIntervals(); DEBUG(print(dbgs())); ModifiedMF = Changed; return Changed; } static void removeDebugValues(MachineFunction &mf) { for (MachineBasicBlock &MBB : mf) { for (auto MBBI = MBB.begin(), MBBE = MBB.end(); MBBI != MBBE; ) { if (!MBBI->isDebugValue()) { ++MBBI; continue; } MBBI = MBB.erase(MBBI); } } } bool LiveDebugVariables::<API key>(MachineFunction &mf) { if (!EnableLDV) return false; if (!mf.getFunction()->getSubprogram()) { removeDebugValues(mf); return false; } if (!pImpl) pImpl = new LDVImpl(this); return static_cast<LDVImpl*>(pImpl)-><API key>(mf); } void LiveDebugVariables::releaseMemory() { if (pImpl) static_cast<LDVImpl*>(pImpl)->clear(); } LiveDebugVariables::~LiveDebugVariables() { if (pImpl) delete static_cast<LDVImpl*>(pImpl); } // Live Range Splitting bool UserValue::splitLocation(unsigned OldLocNo, ArrayRef<unsigned> NewRegs, LiveIntervals& LIS) { DEBUG({ dbgs() << "Splitting Loc" << OldLocNo << '\t'; print(dbgs(), nullptr); }); bool DidChange = false; LocMap::iterator LocMapI; LocMapI.setMap(locInts); for (unsigned i = 0; i != NewRegs.size(); ++i) { LiveInterval *LI = &LIS.getInterval(NewRegs[i]); if (LI->empty()) continue; // Don't allocate the new LocNo until it is needed. unsigned NewLocNo = ~0u; // Iterate over the overlaps between locInts and LI. LocMapI.find(LI->beginIndex()); if (!LocMapI.valid()) continue; LiveInterval::iterator LII = LI->advanceTo(LI->begin(), LocMapI.start()); LiveInterval::iterator LIE = LI->end(); while (LocMapI.valid() && LII != LIE) { // At this point, we know that LocMapI.stop() > LII->start. LII = LI->advanceTo(LII, LocMapI.start()); if (LII == LIE) break; // Now LII->end > LocMapI.start(). Do we have an overlap? if (LocMapI.value() == OldLocNo && LII->start < LocMapI.stop()) { // Overlapping correct location. Allocate NewLocNo now. if (NewLocNo == ~0u) { MachineOperand MO = MachineOperand::CreateReg(LI->reg, false); MO.setSubReg(locations[OldLocNo].getSubReg()); NewLocNo = getLocationNo(MO); DidChange = true; } SlotIndex LStart = LocMapI.start(); SlotIndex LStop = LocMapI.stop(); // Trim LocMapI down to the LII overlap. if (LStart < LII->start) LocMapI.setStartUnchecked(LII->start); if (LStop > LII->end) LocMapI.setStopUnchecked(LII->end); // Change the value in the overlap. This may trigger coalescing. LocMapI.setValue(NewLocNo); // Re-insert any removed OldLocNo ranges. if (LStart < LocMapI.start()) { LocMapI.insert(LStart, LocMapI.start(), OldLocNo); ++LocMapI; assert(LocMapI.valid() && "Unexpected coalescing"); } if (LStop > LocMapI.stop()) { ++LocMapI; LocMapI.insert(LII->end, LStop, OldLocNo); --LocMapI; } } // Advance to the next overlap. if (LII->end < LocMapI.stop()) { if (++LII == LIE) break; LocMapI.advanceTo(LII->start); } else { ++LocMapI; if (!LocMapI.valid()) break; LII = LI->advanceTo(LII, LocMapI.start()); } } } // Finally, remove any remaining OldLocNo intervals and OldLocNo itself. locations.erase(locations.begin() + OldLocNo); LocMapI.goToBegin(); while (LocMapI.valid()) { unsigned v = LocMapI.value(); if (v == OldLocNo) { DEBUG(dbgs() << "Erasing [" << LocMapI.start() << ';' << LocMapI.stop() << ")\n"); LocMapI.erase(); } else { if (v > OldLocNo) LocMapI.setValueUnchecked(v-1); ++LocMapI; } } DEBUG({dbgs() << "Split result: \t"; print(dbgs(), nullptr);}); return DidChange; } bool UserValue::splitRegister(unsigned OldReg, ArrayRef<unsigned> NewRegs, LiveIntervals &LIS) { bool DidChange = false; // Split locations referring to OldReg. Iterate backwards so splitLocation can // safely erase unused locations. for (unsigned i = locations.size(); i ; --i) { unsigned LocNo = i-1; const MachineOperand *Loc = &locations[LocNo]; if (!Loc->isReg() || Loc->getReg() != OldReg) continue; DidChange |= splitLocation(LocNo, NewRegs, LIS); } return DidChange; } void LDVImpl::splitRegister(unsigned OldReg, ArrayRef<unsigned> NewRegs) { bool DidChange = false; for (UserValue *UV = lookupVirtReg(OldReg); UV; UV = UV->getNext()) DidChange |= UV->splitRegister(OldReg, NewRegs, *LIS); if (!DidChange) return; // Map all of the new virtual registers. UserValue *UV = lookupVirtReg(OldReg); for (unsigned i = 0; i != NewRegs.size(); ++i) mapVirtReg(NewRegs[i], UV); } void LiveDebugVariables:: splitRegister(unsigned OldReg, ArrayRef<unsigned> NewRegs, LiveIntervals &LIS) { if (pImpl) static_cast<LDVImpl*>(pImpl)->splitRegister(OldReg, NewRegs); } void UserValue::rewriteLocations(VirtRegMap &VRM, const TargetRegisterInfo &TRI) { // Iterate over locations in reverse makes it easier to handle coalescing. for (unsigned i = locations.size(); i ; --i) { unsigned LocNo = i-1; MachineOperand &Loc = locations[LocNo]; // Only virtual registers are rewritten. if (!Loc.isReg() || !Loc.getReg() || !TargetRegisterInfo::isVirtualRegister(Loc.getReg())) continue; unsigned VirtReg = Loc.getReg(); if (VRM.isAssignedReg(VirtReg) && TargetRegisterInfo::isPhysicalRegister(VRM.getPhys(VirtReg))) { // This can create a %noreg operand in rare cases when the sub-register // index is no longer available. That means the user value is in a // non-existent sub-register, and %noreg is exactly what we want. Loc.substPhysReg(VRM.getPhys(VirtReg), TRI); } else if (VRM.getStackSlot(VirtReg) != VirtRegMap::NO_STACK_SLOT) { // FIXME: Translate SubIdx to a stackslot offset. Loc = MachineOperand::CreateFI(VRM.getStackSlot(VirtReg)); } else { Loc.setReg(0); Loc.setSubReg(0); } coalesceLocation(LocNo); } } findInsertLocation - Find an iterator for inserting a DBG_VALUE instruction. static MachineBasicBlock::iterator findInsertLocation(MachineBasicBlock *MBB, SlotIndex Idx, LiveIntervals &LIS) { SlotIndex Start = LIS.getMBBStartIdx(MBB); Idx = Idx.getBaseIndex(); // Try to find an insert location by going backwards from Idx. MachineInstr *MI; while (!(MI = LIS.<API key>(Idx))) { // We've reached the beginning of MBB. if (Idx == Start) { MachineBasicBlock::iterator I = MBB->SkipPHIsAndLabels(MBB->begin()); return I; } Idx = Idx.getPrevIndex(); } // Don't insert anything after the first terminator, though. return MI->isTerminator() ? MBB->getFirstTerminator() : std::next(MachineBasicBlock::iterator(MI)); } void UserValue::insertDebugValue(MachineBasicBlock *MBB, SlotIndex Idx, unsigned LocNo, LiveIntervals &LIS, const TargetInstrInfo &TII) { MachineBasicBlock::iterator I = findInsertLocation(MBB, Idx, LIS); MachineOperand &Loc = locations[LocNo]; ++<API key>; assert(cast<DILocalVariable>(Variable) -><API key>(getDebugLoc()) && "Expected inlined-at fields to agree"); if (Loc.isReg()) BuildMI(*MBB, I, getDebugLoc(), TII.get(TargetOpcode::DBG_VALUE), IsIndirect, Loc.getReg(), offset, Variable, Expression); else BuildMI(*MBB, I, getDebugLoc(), TII.get(TargetOpcode::DBG_VALUE)) .addOperand(Loc) .addImm(offset) .addMetadata(Variable) .addMetadata(Expression); } void UserValue::emitDebugValues(VirtRegMap *VRM, LiveIntervals &LIS, const TargetInstrInfo &TII) { MachineFunction::iterator MFEnd = VRM->getMachineFunction().end(); for (LocMap::const_iterator I = locInts.begin(); I.valid();) { SlotIndex Start = I.start(); SlotIndex Stop = I.stop(); unsigned LocNo = I.value(); DEBUG(dbgs() << "\t[" << Start << ';' << Stop << "):" << LocNo); MachineFunction::iterator MBB = LIS.getMBBFromIndex(Start)->getIterator(); SlotIndex MBBEnd = LIS.getMBBEndIdx(&*MBB); DEBUG(dbgs() << " BB#" << MBB->getNumber() << '-' << MBBEnd); insertDebugValue(&*MBB, Start, LocNo, LIS, TII); // This interval may span multiple basic blocks. // Insert a DBG_VALUE into each one. while(Stop > MBBEnd) { // Move to the next block. Start = MBBEnd; if (++MBB == MFEnd) break; MBBEnd = LIS.getMBBEndIdx(&*MBB); DEBUG(dbgs() << " BB#" << MBB->getNumber() << '-' << MBBEnd); insertDebugValue(&*MBB, Start, LocNo, LIS, TII); } DEBUG(dbgs() << '\n'); if (MBB == MFEnd) break; ++I; } } void LDVImpl::emitDebugValues(VirtRegMap *VRM) { DEBUG(dbgs() << "********** EMITTING LIVE DEBUG VARIABLES **********\n"); if (!MF) return; const TargetInstrInfo *TII = MF->getSubtarget().getInstrInfo(); for (unsigned i = 0, e = userValues.size(); i != e; ++i) { DEBUG(userValues[i]->print(dbgs(), TRI)); userValues[i]->rewriteLocations(*VRM, *TRI); userValues[i]->emitDebugValues(VRM, *LIS, *TII); } EmitDone = true; } void LiveDebugVariables::emitDebugValues(VirtRegMap *VRM) { if (pImpl) static_cast<LDVImpl*>(pImpl)->emitDebugValues(VRM); } bool LiveDebugVariables::doInitialization(Module &M) { return Pass::doInitialization(M); } #ifndef NDEBUG LLVM_DUMP_METHOD void LiveDebugVariables::dump() { if (pImpl) static_cast<LDVImpl*>(pImpl)->print(dbgs()); } #endif
package org.elasticsearch.xpack.core.ml.action; import org.elasticsearch.action.ActionType; import org.elasticsearch.action.support.tasks.BaseTasksResponse; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.<API key>; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.xcontent.XContentBuilder; import org.elasticsearch.xpack.core.ml.job.config.JobUpdate; import org.elasticsearch.xpack.core.ml.job.config.MlFilter; import org.elasticsearch.xpack.core.ml.job.config.ModelPlotConfig; import org.elasticsearch.xpack.core.ml.job.config.<API key>; import java.io.IOException; import java.util.List; import java.util.Objects; public class UpdateProcessAction extends ActionType<UpdateProcessAction.Response> { public static final UpdateProcessAction INSTANCE = new UpdateProcessAction(); public static final String NAME = "cluster:internal/xpack/ml/job/update/process"; private UpdateProcessAction() { super(NAME, UpdateProcessAction.Response::new); } public static class Response extends BaseTasksResponse implements <API key>, Writeable { private final boolean isUpdated; public Response() { super(null, null); this.isUpdated = true; } public Response(StreamInput in) throws IOException { super(in); isUpdated = in.readBoolean(); } @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); out.writeBoolean(isUpdated); } public boolean isUpdated() { return isUpdated; } @Override public RestStatus status() { return RestStatus.ACCEPTED; } @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(); builder.field("updated", isUpdated); builder.endObject(); return builder; } @Override public int hashCode() { return Objects.hashCode(isUpdated); } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Response other = (Response) obj; return this.isUpdated == other.isUpdated; } } public static class Request extends JobTaskRequest<Request> { private ModelPlotConfig modelPlotConfig; private <API key> <API key>; private List<JobUpdate.DetectorUpdate> detectorUpdates; private MlFilter filter; private boolean <API key> = false; public Request(StreamInput in) throws IOException { super(in); modelPlotConfig = in.<API key>(ModelPlotConfig::new); <API key> = in.<API key>(<API key>::new); if (in.readBoolean()) { detectorUpdates = in.readList(JobUpdate.DetectorUpdate::new); } filter = in.<API key>(MlFilter::new); <API key> = in.readBoolean(); } @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); out.<API key>(modelPlotConfig); out.<API key>(<API key>); boolean hasDetectorUpdates = detectorUpdates != null; out.writeBoolean(hasDetectorUpdates); if (hasDetectorUpdates) { out.writeList(detectorUpdates); } out.<API key>(filter); out.writeBoolean(<API key>); } public Request( String jobId, ModelPlotConfig modelPlotConfig, <API key> <API key>, List<JobUpdate.DetectorUpdate> detectorUpdates, MlFilter filter, boolean <API key> ) { super(jobId); this.modelPlotConfig = modelPlotConfig; this.<API key> = <API key>; this.detectorUpdates = detectorUpdates; this.filter = filter; this.<API key> = <API key>; } public ModelPlotConfig getModelPlotConfig() { return modelPlotConfig; } public <API key> <API key>() { return <API key>; } public List<JobUpdate.DetectorUpdate> getDetectorUpdates() { return detectorUpdates; } public MlFilter getFilter() { return filter; } public boolean <API key>() { return <API key>; } @Override public int hashCode() { return Objects.hash( getJobId(), modelPlotConfig, <API key>, detectorUpdates, filter, <API key> ); } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Request other = (Request) obj; return Objects.equals(getJobId(), other.getJobId()) && Objects.equals(modelPlotConfig, other.modelPlotConfig) && Objects.equals(<API key>, other.<API key>) && Objects.equals(detectorUpdates, other.detectorUpdates) && Objects.equals(filter, other.filter) && Objects.equals(<API key>, other.<API key>); } } }
<!DOCTYPE HTML PUBLIC "- <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_11) on Tue Aug 12 11:16:05 PDT 2014 --> <title>com.microsoft.windowsazure.mobileservices.table.serialization</title> <meta name="date" content="2014-08-12"> <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../../script.js"></script> </head> <body> <script type="text/javascript"><! try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="com.microsoft.windowsazure.mobileservices.table.serialization"; } } catch(err) { } </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <div class="topNav"><a name="navbar.top"> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li class="navBarCell1Rev">Package</li> <li>Class</li> <li><a href="package-use.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../index-files/index-1.html">Index</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../../com/microsoft/windowsazure/mobileservices/table/query/package-summary.html">Prev&nbsp;Package</a></li> <li><a href="../../../../../../com/microsoft/windowsazure/mobileservices/table/sync/package-summary.html">Next&nbsp;Package</a></li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?com/microsoft/windowsazure/mobileservices/table/serialization/package-summary.html" target="_top">Frames</a></li> <li><a href="package-summary.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <a name="skip.navbar.top"> </a></div> <div class="header"> <h1 title="Package" class="title">Package&nbsp;com.microsoft.windowsazure.mobileservices.table.serialization</h1> </div> <div class="contentContainer"> <ul class="blockList"> <li class="blockList"> <table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation"> <caption><span>Class Summary</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Class</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="../../../../../../com/microsoft/windowsazure/mobileservices/table/serialization/DateSerializer.html" title="class in com.microsoft.windowsazure.mobileservices.table.serialization">DateSerializer</a></td> <td class="colLast"> <div class="block">Date Serializer/Deserializer to make Mobile Services and Java dates compatible</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="../../../../../../com/microsoft/windowsazure/mobileservices/table/serialization/JsonEntityParser.html" title="class in com.microsoft.windowsazure.mobileservices.table.serialization">JsonEntityParser</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><a href="../../../../../../com/microsoft/windowsazure/mobileservices/table/serialization/LongSerializer.html" title="class in com.microsoft.windowsazure.mobileservices.table.serialization">LongSerializer</a></td> <td class="colLast"> <div class="block">Long Serializer to avoid losing precision when sending data to Mobile Services</div> </td> </tr> </tbody> </table> </li> </ul> </div> <div class="bottomNav"><a name="navbar.bottom"> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li class="navBarCell1Rev">Package</li> <li>Class</li> <li><a href="package-use.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../index-files/index-1.html">Index</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../../com/microsoft/windowsazure/mobileservices/table/query/package-summary.html">Prev&nbsp;Package</a></li> <li><a href="../../../../../../com/microsoft/windowsazure/mobileservices/table/sync/package-summary.html">Next&nbsp;Package</a></li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?com/microsoft/windowsazure/mobileservices/table/serialization/package-summary.html" target="_top">Frames</a></li> <li><a href="package-summary.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <a name="skip.navbar.bottom"> </a></div> </body> </html>
{ "EL": {"custom":["org.nutz.el.issue279.Uuuid"]} }
using System.Collections.Generic; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Formatting.Rules; using Microsoft.CodeAnalysis.Options; namespace Microsoft.CodeAnalysis.CSharp.Formatting { internal class <API key> : BaseFormattingRule { public override <API key> <API key>(SyntaxToken previousToken, SyntaxToken currentToken, OptionSet optionSet, NextOperation<<API key>> nextOperation) { if (optionSet == null) { return nextOperation.Invoke(); } System.Diagnostics.Debug.Assert(previousToken.Parent != null && currentToken.Parent != null); var previousKind = previousToken.Kind(); var currentKind = currentToken.Kind(); var previousParentKind = previousToken.Parent.Kind(); var currentParentKind = currentToken.Parent.Kind(); // For Method Declaration if (currentToken.<API key>() && previousKind == SyntaxKind.IdentifierToken) { return <API key>(optionSet, <API key>.<API key>); } // For Generic Method Declaration if (currentToken.<API key>() && previousKind == SyntaxKind.GreaterThanToken && previousParentKind == SyntaxKind.TypeParameterList) { return <API key>(optionSet, <API key>.<API key>); } // Case: public static implicit operator string(Program p) { return null; } if (previousToken.IsKeyword() && currentToken.<API key>()) { return <API key>(optionSet, <API key>.<API key>); } // Case: public static Program operator !(Program p) { return null; } if (previousToken.Parent.IsKind(SyntaxKind.OperatorDeclaration) && currentToken.<API key>()) { return <API key>(optionSet, <API key>.<API key>); } if (previousToken.<API key>() && currentToken.<API key>()) { return <API key>(optionSet, <API key>.<API key>); } if (previousToken.<API key>()) { return <API key>(optionSet, <API key>.<API key>); } if (currentToken.<API key>()) { return <API key>(optionSet, <API key>.<API key>); } // For Method Call if (currentToken.<API key>()) { return <API key>(optionSet, <API key>.<API key>); } if (previousToken.<API key>() && currentToken.<API key>()) { return <API key>(optionSet, <API key>.<API key>); } if (previousToken.<API key>()) { return <API key>(optionSet, <API key>.<API key>); } if (currentToken.<API key>()) { return <API key>(optionSet, <API key>.<API key>); } // For spacing around: typeof, default, and sizeof; treat like a Method Call if (currentKind == SyntaxKind.OpenParenToken && <API key>(currentParentKind)) { return <API key>(optionSet, <API key>.<API key>); } if (previousKind == SyntaxKind.OpenParenToken && <API key>(previousParentKind)) { return <API key>(optionSet, <API key>.<API key>); } if (currentKind == SyntaxKind.CloseParenToken && <API key>(currentParentKind)) { return <API key>(optionSet, <API key>.<API key>); } // For Spacing b/n control flow keyword and paren. Parent check not needed. if (currentKind == SyntaxKind.OpenParenToken && (previousKind == SyntaxKind.IfKeyword || previousKind == SyntaxKind.WhileKeyword || previousKind == SyntaxKind.SwitchKeyword || previousKind == SyntaxKind.ForKeyword || previousKind == SyntaxKind.ForEachKeyword || previousKind == SyntaxKind.CatchKeyword || previousKind == SyntaxKind.UsingKeyword)) { return <API key>(optionSet, <API key>.<API key>); } // For spacing between parenthesis and expression if ((previousParentKind == SyntaxKind.<API key> && previousKind == SyntaxKind.OpenParenToken) || (currentParentKind == SyntaxKind.<API key> && currentKind == SyntaxKind.CloseParenToken)) { return <API key>(optionSet, <API key>.<API key>); } // For spacing between the parenthesis and the cast expression if ((previousParentKind == SyntaxKind.CastExpression && previousKind == SyntaxKind.OpenParenToken) || (currentParentKind == SyntaxKind.CastExpression && currentKind == SyntaxKind.CloseParenToken)) { return <API key>(optionSet, <API key>.<API key>); } // For spacing between the parenthesis and the expression inside the control flow expression if (previousKind == SyntaxKind.OpenParenToken && <API key>(previousParentKind)) { return <API key>(optionSet, <API key>.<API key>); } // Semicolons in an empty for statement. i.e. for(;;) if (previousKind == SyntaxKind.OpenParenToken || previousKind == SyntaxKind.SemicolonToken) { if (previousToken.Parent.Kind() == SyntaxKind.ForStatement) { var forStatement = (ForStatementSyntax)previousToken.Parent; if (forStatement.Initializers.Count == 0 && forStatement.Declaration == null && forStatement.Condition == null && forStatement.Incrementors.Count == 0) { return <API key>(0, AdjustSpacesOption.ForceSpaces); } } } if (currentKind == SyntaxKind.CloseParenToken && <API key>(currentParentKind)) { return <API key>(optionSet, <API key>.<API key>); } // For spacing after the cast if (previousParentKind == SyntaxKind.CastExpression && previousKind == SyntaxKind.CloseParenToken) { return <API key>(optionSet, <API key>.SpaceAfterCast); } // For spacing Before Square Braces if (currentKind == SyntaxKind.OpenBracketToken && <API key>(currentToken) && !previousToken.<API key>()) { return <API key>(optionSet, <API key>.<API key>); } // For spacing empty square braces if (previousKind == SyntaxKind.OpenBracketToken && (currentKind == SyntaxKind.CloseBracketToken || currentKind == SyntaxKind.<API key>) && <API key>(previousToken)) { return <API key>(optionSet, <API key>.<API key>); } // For spacing square brackets within if (previousKind == SyntaxKind.OpenBracketToken && <API key>(previousToken)) { return <API key>(optionSet, <API key>.<API key>); } else if (currentKind == SyntaxKind.CloseBracketToken && <API key>(currentToken)) { if (currentToken.Parent is <API key>) { var parent = currentToken.Parent as <API key>; if ((parent.Sizes.Any() && parent.Sizes.First().Kind() != SyntaxKind.<API key>) || parent.Sizes.SeparatorCount > 0) { // int []: added spacing operation on open [ // int[1], int[,]: need spacing operation return <API key>(optionSet, <API key>.<API key>); } } else { return <API key>(optionSet, <API key>.<API key>); } } // For spacing delimiters - after colon if (previousToken.<API key>()) { return <API key>(optionSet, <API key>.<API key>); } // For spacing delimiters - before colon if (currentToken.<API key>()) { return <API key>(optionSet, <API key>.<API key>); } // For spacing delimiters - after comma if ((previousToken.<API key>() && currentKind != SyntaxKind.<API key>) || previousToken.<API key>()) { return <API key>(optionSet, <API key>.SpaceAfterComma); } // For spacing delimiters - before comma if ((currentToken.<API key>() && previousKind != SyntaxKind.<API key>) || currentToken.<API key>()) { return <API key>(optionSet, <API key>.SpaceBeforeComma); } // For Spacing delimiters - after Dot if (previousToken.<API key>()) { return <API key>(optionSet, <API key>.SpaceAfterDot); } // For spacing delimiters - before Dot if (currentToken.<API key>()) { return <API key>(optionSet, <API key>.SpaceBeforeDot); } // For spacing delimiters - after semicolon if (previousToken.<API key>() && currentKind != SyntaxKind.CloseParenToken) { return <API key>(optionSet, <API key>.<API key>); } // For spacing delimiters - before semicolon if (currentToken.<API key>()) { return <API key>(optionSet, <API key>.<API key>); } // For spacing around the binary operators if (currentToken.Parent is <API key> || previousToken.Parent is <API key> || currentToken.Parent is <API key> || previousToken.Parent is <API key>) { switch (optionSet.GetOption(<API key>.<API key>)) { case <API key>.Single: return <API key>(1, AdjustSpacesOption.<API key>); case <API key>.Remove: if (currentKind == SyntaxKind.IsKeyword || currentKind == SyntaxKind.AsKeyword || previousKind == SyntaxKind.IsKeyword || previousKind == SyntaxKind.AsKeyword) { // User want spaces removed but at least one is required for the "as" & "is" keyword return <API key>(1, AdjustSpacesOption.<API key>); } else { return <API key>(0, AdjustSpacesOption.<API key>); } case <API key>.Ignore: return <API key>(0, AdjustSpacesOption.PreserveSpaces); default: System.Diagnostics.Debug.Assert(false, "Invalid <API key>"); break; } } // No space after $" and $@" at the start of an interpolated string if (previousKind == SyntaxKind.<API key> || previousKind == SyntaxKind.<API key>) { return <API key>(0, AdjustSpacesOption.ForceSpaces); } // No space before " at the end of an interpolated string if (currentKind == SyntaxKind.<API key>) { return <API key>(0, AdjustSpacesOption.ForceSpaces); } // No space before { or after } in interpolations if ((currentKind == SyntaxKind.OpenBraceToken && currentToken.Parent is InterpolationSyntax) || (previousKind == SyntaxKind.CloseBraceToken && previousToken.Parent is InterpolationSyntax)) { return <API key>(0, AdjustSpacesOption.ForceSpaces); } // Preserve space after { or before } in interpolations (i.e. between the braces and the expression) if ((previousKind == SyntaxKind.OpenBraceToken && previousToken.Parent is InterpolationSyntax) || (currentKind == SyntaxKind.CloseBraceToken && currentToken.Parent is InterpolationSyntax)) { return <API key>(0, AdjustSpacesOption.PreserveSpaces); } // No space before or after , in interpolation alignment clause if ((previousKind == SyntaxKind.CommaToken && previousToken.Parent is <API key>) || (currentKind == SyntaxKind.CommaToken && currentToken.Parent is <API key>)) { return <API key>(0, AdjustSpacesOption.ForceSpaces); } // No space before or after : in interpolation format clause if ((previousKind == SyntaxKind.ColonToken && previousToken.Parent is <API key>) || (currentKind == SyntaxKind.ColonToken && currentToken.Parent is <API key>)) { return <API key>(0, AdjustSpacesOption.ForceSpaces); } return nextOperation.Invoke(); } public override void <API key>(List<SuppressOperation> list, SyntaxNode node, SyntaxToken lastToken, OptionSet optionSet, NextAction<SuppressOperation> nextOperation) { nextOperation.Invoke(list); <API key>(list, node, optionSet); } private void <API key>(List<SuppressOperation> list, SyntaxNode node, OptionSet optionSet) { if (node.IsKind(SyntaxKind.FieldDeclaration) || node.IsKind(SyntaxKind.EventDeclaration) || node.IsKind(SyntaxKind.<API key>) || node.IsKind(SyntaxKind.<API key>)) { if (optionSet.GetOption(<API key>.<API key>)) { var firstToken = node.GetFirstToken(includeZeroWidth: true); var lastToken = node.GetLastToken(includeZeroWidth: true); list.Add(<API key>.<API key>(firstToken, lastToken, SuppressOption.NoSpacing)); } } } private <API key> <API key>(OptionSet optionSet, Option<bool> option, AdjustSpacesOption explicitOption = AdjustSpacesOption.<API key>) { if (optionSet.GetOption(option)) { return <API key>(1, explicitOption); } else { return <API key>(0, explicitOption); } } private bool <API key>(SyntaxToken token) { return token.Parent.IsKind(SyntaxKind.ArrayRankSpecifier, SyntaxKind.<API key>, SyntaxKind.<API key>, SyntaxKind.<API key>); } private bool <API key>(SyntaxKind syntaxKind) { return (syntaxKind == SyntaxKind.TypeOfExpression || syntaxKind == SyntaxKind.DefaultExpression || syntaxKind == SyntaxKind.SizeOfExpression); } private bool <API key>(SyntaxKind syntaxKind) { return (syntaxKind == SyntaxKind.IfStatement || syntaxKind == SyntaxKind.WhileStatement || syntaxKind == SyntaxKind.SwitchStatement || syntaxKind == SyntaxKind.ForStatement || syntaxKind == SyntaxKind.ForEachStatement || syntaxKind == SyntaxKind.DoStatement || syntaxKind == SyntaxKind.CatchDeclaration || syntaxKind == SyntaxKind.UsingStatement || syntaxKind == SyntaxKind.LockStatement || syntaxKind == SyntaxKind.FixedStatement); } } }
#include <lib/lib.h> int main(int argc, char* argv[]) { return MACRO_IN_LIB; }
#![crate_name = "foo"] #![doc(html_playground_url = "")] //! module docs //! println!("Hello, world!"); // @!has foo/index.html '//a[@class="test-arrow"]' "Run"
<!DOCTYPE HTML PUBLIC "- <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.6.0_27) on Thu Dec 26 19:42:35 EST 2013 --> <title>com.jwetherell.augmented_reality.ui.objects</title> <meta name="date" content="2013-12-26"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> </head> <body> <h1 class="bar"><a href="../../../../../com/jwetherell/augmented_reality/ui/objects/package-summary.html" target="classFrame">com.jwetherell.augmented_reality.ui.objects</a></h1> <div class="indexContainer"> <h2 title="Classes">Classes</h2> <ul title="Classes"> <li><a href="PaintableBox.html" title="class in com.jwetherell.augmented_reality.ui.objects" target="classFrame">PaintableBox</a></li> <li><a href="PaintableBoxedText.html" title="class in com.jwetherell.augmented_reality.ui.objects" target="classFrame">PaintableBoxedText</a></li> <li><a href="PaintableCircle.html" title="class in com.jwetherell.augmented_reality.ui.objects" target="classFrame">PaintableCircle</a></li> <li><a href="PaintableGps.html" title="class in com.jwetherell.augmented_reality.ui.objects" target="classFrame">PaintableGps</a></li> <li><a href="PaintableIcon.html" title="class in com.jwetherell.augmented_reality.ui.objects" target="classFrame">PaintableIcon</a></li> <li><a href="PaintableLine.html" title="class in com.jwetherell.augmented_reality.ui.objects" target="classFrame">PaintableLine</a></li> <li><a href="PaintableObject.html" title="class in com.jwetherell.augmented_reality.ui.objects" target="classFrame">PaintableObject</a></li> <li><a href="PaintablePoint.html" title="class in com.jwetherell.augmented_reality.ui.objects" target="classFrame">PaintablePoint</a></li> <li><a href="PaintablePosition.html" title="class in com.jwetherell.augmented_reality.ui.objects" target="classFrame">PaintablePosition</a></li> <li><a href="<API key>.html" title="class in com.jwetherell.augmented_reality.ui.objects" target="classFrame"><API key></a></li> <li><a href="PaintableText.html" title="class in com.jwetherell.augmented_reality.ui.objects" target="classFrame">PaintableText</a></li> </ul> </div> </body> </html>
#include <stdio.h> #include <stdlib.h> #include <gst/gst.h> #include "gst/glib-compat-private.h" #define BUFFER_SIZE (1400) gint main (gint argc, gchar * argv[]) { gint i; GstBuffer *tmp; GstBufferPool *pool; GstClockTime start, end; GstClockTimeDiff dur1, dur2; guint64 nbuffers; GstStructure *conf; gst_init (&argc, &argv); if (argc != 2) { g_print ("usage: %s <nbuffers>\n", argv[0]); exit (-1); } nbuffers = atoi (argv[1]); if (nbuffers <= 0) { g_print ("number of buffers must be greater than 0\n"); exit (-3); } /* Let's just make sure the GstBufferClass is loaded ... */ tmp = gst_buffer_new (); gst_buffer_unref (tmp); pool = gst_buffer_pool_new (); conf = <API key> (pool); <API key> (conf, NULL, BUFFER_SIZE, 0, 0); <API key> (pool, conf); <API key> (pool, TRUE); /* allocate buffers directly */ start = <API key> (); for (i = 0; i < nbuffers; i++) { tmp = <API key> (NULL, BUFFER_SIZE, NULL); gst_buffer_unref (tmp); } end = <API key> (); dur1 = GST_CLOCK_DIFF (start, end); g_print ("*** total %" GST_TIME_FORMAT " - average %" GST_TIME_FORMAT " - Done creating %" G_GUINT64_FORMAT " fresh buffers\n", GST_TIME_ARGS (dur1), GST_TIME_ARGS (dur1 / nbuffers), nbuffers); /* allocate buffers from the pool */ start = <API key> (); for (i = 0; i < nbuffers; i++) { <API key> (pool, &tmp, NULL); gst_buffer_unref (tmp); } end = <API key> (); dur2 = GST_CLOCK_DIFF (start, end); g_print ("*** total %" GST_TIME_FORMAT " - average %" GST_TIME_FORMAT " - Done creating %" G_GUINT64_FORMAT " pooled buffers\n", GST_TIME_ARGS (dur2), GST_TIME_ARGS (dur2 / nbuffers), nbuffers); g_print ("*** speedup %6.4lf\n", ((gdouble) dur1 / (gdouble) dur2)); <API key> (pool, FALSE); gst_object_unref (pool); return 0; }
using Xunit; using System.Linq; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Parsing { [CompilerTrait(CompilerFeature.ReadOnlyReferences)] public class RefStructs : ParsingTests { public RefStructs(ITestOutputHelper output) : base(output) { } protected override SyntaxTree ParseTree(string text, CSharpParseOptions options) { return SyntaxFactory.ParseSyntaxTree(text, options: options); } [Fact] public void RefStructSimple() { var text = @" class Program { ref struct S1{} public ref struct S2{} } "; var comp = <API key>(text, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.Latest), options: TestOptions.DebugDll); comp.VerifyDiagnostics(); } [Fact] public void <API key>() { var text = @" class Program { ref struct S1{} public ref struct S2{} } "; var comp = <API key>(text, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7), options: TestOptions.DebugDll); comp.VerifyDiagnostics( // (4,5): error CS8107: Feature 'ref structs' is not available in C# 7. Please use language version 7.2 or greater. // ref struct S1{} Diagnostic(ErrorCode.<API key>, "ref").WithArguments("ref structs", "7.2").WithLocation(4, 5), // (6,12): error CS8107: Feature 'ref structs' is not available in C# 7. Please use language version 7.2 or greater. // public ref struct S2{} Diagnostic(ErrorCode.<API key>, "ref").WithArguments("ref structs", "7.2").WithLocation(6, 12) ); } [Fact] public void RefStructErr() { var text = @" class Program { ref class S1{} public ref unsafe struct S2{} ref interface I1{}; public ref delegate ref int D1(); } "; var comp = <API key>(text, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.Latest), options: TestOptions.DebugDll); comp.VerifyDiagnostics( // (4,9): error CS1031: Type expected // ref class S1{} Diagnostic(ErrorCode.ERR_TypeExpected, "class"), // (6,16): error CS1031: Type expected // public ref unsafe struct S2{} Diagnostic(ErrorCode.ERR_TypeExpected, "unsafe"), // (8,9): error CS1031: Type expected // ref interface I1{}; Diagnostic(ErrorCode.ERR_TypeExpected, "interface").WithLocation(8, 9), // (10,16): error CS1031: Type expected // public ref delegate ref int D1(); Diagnostic(ErrorCode.ERR_TypeExpected, "delegate").WithLocation(10, 16), // (6,30): error CS0227: Unsafe code may only appear if compiling with /unsafe // public ref unsafe struct S2{} Diagnostic(ErrorCode.ERR_IllegalUnsafe, "S2") ); } [Fact] public void PartialRefStruct() { var text = @" class Program { partial ref struct S {} partial ref struct S {} } "; var comp = CreateCompilation(text); comp.VerifyDiagnostics( // (4,13): error CS1585: Member modifier 'ref' must precede the member type and name // partial ref struct S {} Diagnostic(ErrorCode.<API key>, "ref").WithArguments("ref").WithLocation(4, 13), // (5,13): error CS1585: Member modifier 'ref' must precede the member type and name // partial ref struct S {} Diagnostic(ErrorCode.<API key>, "ref").WithArguments("ref").WithLocation(5, 13), // (5,24): error CS0102: The type 'Program' already contains a definition for 'S' // partial ref struct S {} Diagnostic(ErrorCode.<API key>, "S").WithArguments("Program", "S").WithLocation(5, 24)); } [Fact] public void RefPartialStruct() { var comp = CreateCompilation(@" class C { ref partial struct S {} ref partial struct S {} }"); comp.VerifyDiagnostics(); } [Fact] public void <API key>() { var comp = CreateCompilation(@" class C { ref partial readonly struct S {} ref partial readonly struct S {} }"); comp.VerifyDiagnostics( // (4,17): error CS1585: Member modifier 'readonly' must precede the member type and name // ref partial readonly struct S {} Diagnostic(ErrorCode.<API key>, "readonly").WithArguments("readonly").WithLocation(4, 17), // (5,17): error CS1585: Member modifier 'readonly' must precede the member type and name // ref partial readonly struct S {} Diagnostic(ErrorCode.<API key>, "readonly").WithArguments("readonly").WithLocation(5, 17), // (5,33): error CS0102: The type 'C' already contains a definition for 'S' // ref partial readonly struct S {} Diagnostic(ErrorCode.<API key>, "S").WithArguments("C", "S").WithLocation(5, 33)); } [Fact] public void <API key>() { var comp = CreateCompilation(@" class C { partial ref readonly struct S {} partial ref readonly struct S {} }"); comp.VerifyDiagnostics( // (4,13): error CS1585: Member modifier 'ref' must precede the member type and name // partial ref readonly struct S {} Diagnostic(ErrorCode.<API key>, "ref").WithArguments("ref").WithLocation(4, 13), // (4,26): error CS1031: Type expected // partial ref readonly struct S {} Diagnostic(ErrorCode.ERR_TypeExpected, "struct").WithLocation(4, 26), // (5,13): error CS1585: Member modifier 'ref' must precede the member type and name // partial ref readonly struct S {} Diagnostic(ErrorCode.<API key>, "ref").WithArguments("ref").WithLocation(5, 13), // (5,26): error CS1031: Type expected // partial ref readonly struct S {} Diagnostic(ErrorCode.ERR_TypeExpected, "struct").WithLocation(5, 26), // (5,33): error CS0102: The type 'C' already contains a definition for 'S' // partial ref readonly struct S {} Diagnostic(ErrorCode.<API key>, "S").WithArguments("C", "S").WithLocation(5, 33)); } [Fact] public void <API key>() { var comp = CreateCompilation(@" class C { readonly partial ref struct S {} readonly partial ref struct S {} }"); comp.VerifyDiagnostics( // (4,22): error CS1585: Member modifier 'ref' must precede the member type and name // readonly partial ref struct S {} Diagnostic(ErrorCode.<API key>, "ref").WithArguments("ref").WithLocation(4, 22), // (5,22): error CS1585: Member modifier 'ref' must precede the member type and name // readonly partial ref struct S {} Diagnostic(ErrorCode.<API key>, "ref").WithArguments("ref").WithLocation(5, 22), // (5,33): error CS0102: The type 'C' already contains a definition for 'S' // readonly partial ref struct S {} Diagnostic(ErrorCode.<API key>, "S").WithArguments("C", "S").WithLocation(5, 33)); } [Fact] public void <API key>() { var comp = CreateCompilation(@" class C { readonly ref partial struct S {} readonly ref partial struct S {} }"); comp.VerifyDiagnostics(); } [Fact] public void <API key>() { <API key>(@" using System; class Test { unsafe public void M() { int* a = stackalloc int[10]; var b = stackalloc int[10]; Span<int> c = stackalloc int [10]; } }", TestOptions.UnsafeDebugDll).GetParseDiagnostics().Verify(); } [Fact] public void <API key>() { <API key>(@" using System; class Test { public void M() { unsafe void local() { int* x = stackalloc int[10]; } } }").GetParseDiagnostics().Verify(); } [Fact] public void <API key>() { <API key>(@" using System; class Test { public void M() { Visit(stackalloc int [10]); } public void Visit(Span<int> s) { } }").GetParseDiagnostics().Verify(); } [Fact] public void <API key>() { <API key>(@" using System; class Test { public void M() { Console.WriteLine((stackalloc int [10]).Length); } }").GetParseDiagnostics().Verify(); } [Fact] public void <API key>() { <API key>(@" using System; class Test { public void M() { void* x = (void*)(stackalloc int[10]); } }").GetParseDiagnostics().Verify(); } } }
package org.elasticsearch.threadpool; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.xcontent.ToXContent; import org.elasticsearch.xcontent.ToXContentFragment; import org.elasticsearch.xcontent.XContentBuilder; import java.io.IOException; import java.util.Collections; import java.util.Iterator; import java.util.List; public class ThreadPoolStats implements Writeable, ToXContentFragment, Iterable<ThreadPoolStats.Stats> { public static class Stats implements Writeable, ToXContentFragment, Comparable<Stats> { private final String name; private final int threads; private final int queue; private final int active; private final long rejected; private final int largest; private final long completed; public Stats(String name, int threads, int queue, int active, long rejected, int largest, long completed) { this.name = name; this.threads = threads; this.queue = queue; this.active = active; this.rejected = rejected; this.largest = largest; this.completed = completed; } public Stats(StreamInput in) throws IOException { name = in.readString(); threads = in.readInt(); queue = in.readInt(); active = in.readInt(); rejected = in.readLong(); largest = in.readInt(); completed = in.readLong(); } @Override public void writeTo(StreamOutput out) throws IOException { out.writeString(name); out.writeInt(threads); out.writeInt(queue); out.writeInt(active); out.writeLong(rejected); out.writeInt(largest); out.writeLong(completed); } public String getName() { return this.name; } public int getThreads() { return this.threads; } public int getQueue() { return this.queue; } public int getActive() { return this.active; } public long getRejected() { return rejected; } public int getLargest() { return largest; } public long getCompleted() { return this.completed; } @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(name); if (threads != -1) { builder.field(Fields.THREADS, threads); } if (queue != -1) { builder.field(Fields.QUEUE, queue); } if (active != -1) { builder.field(Fields.ACTIVE, active); } if (rejected != -1) { builder.field(Fields.REJECTED, rejected); } if (largest != -1) { builder.field(Fields.LARGEST, largest); } if (completed != -1) { builder.field(Fields.COMPLETED, completed); } builder.endObject(); return builder; } @Override public int compareTo(Stats other) { if ((getName() == null) && (other.getName() == null)) { return 0; } else if ((getName() != null) && (other.getName() == null)) { return 1; } else if (getName() == null) { return -1; } else { int compare = getName().compareTo(other.getName()); if (compare == 0) { compare = Integer.compare(getThreads(), other.getThreads()); } return compare; } } } private List<Stats> stats; public ThreadPoolStats(List<Stats> stats) { Collections.sort(stats); this.stats = stats; } public ThreadPoolStats(StreamInput in) throws IOException { stats = in.readList(Stats::new); } @Override public void writeTo(StreamOutput out) throws IOException { out.writeList(stats); } @Override public Iterator<Stats> iterator() { return stats.iterator(); } static final class Fields { static final String THREAD_POOL = "thread_pool"; static final String THREADS = "threads"; static final String QUEUE = "queue"; static final String ACTIVE = "active"; static final String REJECTED = "rejected"; static final String LARGEST = "largest"; static final String COMPLETED = "completed"; } @Override public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException { builder.startObject(Fields.THREAD_POOL); for (Stats stat : stats) { stat.toXContent(builder, params); } builder.endObject(); return builder; } }
<!DOCTYPE HTML PUBLIC "- <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.6.0_27) on Thu Dec 26 19:42:35 EST 2013 --> <title>Overview List</title> <meta name="date" content="2013-12-26"> <link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style"> </head> <body> <div class="indexHeader"><a href="allclasses-frame.html" target="packageFrame">All Classes</a></div> <div class="indexContainer"> <h2 title="Packages">Packages</h2> <ul title="Packages"> <li><a href="com/jwetherell/augmented_reality/package-frame.html" target="packageFrame">com.jwetherell.augmented_reality</a></li> <li><a href="com/jwetherell/augmented_reality/activity/package-frame.html" target="packageFrame">com.jwetherell.augmented_reality.activity</a></li> <li><a href="com/jwetherell/augmented_reality/camera/package-frame.html" target="packageFrame">com.jwetherell.augmented_reality.camera</a></li> <li><a href="com/jwetherell/augmented_reality/common/package-frame.html" target="packageFrame">com.jwetherell.augmented_reality.common</a></li> <li><a href="com/jwetherell/augmented_reality/data/package-frame.html" target="packageFrame">com.jwetherell.augmented_reality.data</a></li> <li><a href="com/jwetherell/augmented_reality/ui/package-frame.html" target="packageFrame">com.jwetherell.augmented_reality.ui</a></li> <li><a href="com/jwetherell/augmented_reality/ui/objects/package-frame.html" target="packageFrame">com.jwetherell.augmented_reality.ui.objects</a></li> <li><a href="com/jwetherell/augmented_reality/widget/package-frame.html" target="packageFrame">com.jwetherell.augmented_reality.widget</a></li> </ul> </div> <p>&nbsp;</p> </body> </html>
import unittest import pysal from pysal.core.IOHandlers.arcgis_swm import ArcGISSwmIO import tempfile import os class test_ArcGISSwmIO(unittest.TestCase): def setUp(self): self.test_file = test_file = pysal.examples.get_path('ohio.swm') self.obj = ArcGISSwmIO(test_file, 'r') def test_close(self): f = self.obj f.close() self.failUnlessRaises(ValueError, f.read) def test_read(self): w = self.obj.read() self.assertEqual(88, w.n) self.assertEqual(5.25, w.mean_neighbors) self.assertEqual([1.0, 1.0, 1.0, 1.0], w[1].values()) def test_seek(self): self.test_read() self.failUnlessRaises(StopIteration, self.obj.read) self.obj.seek(0) self.test_read() def test_write(self): w = self.obj.read() f = tempfile.NamedTemporaryFile( suffix='.swm', dir=pysal.examples.get_path('')) fname = f.name f.close() o = pysal.open(fname, 'w') o.write(w) o.close() wnew = pysal.open(fname, 'r').read() self.assertEqual(wnew.pct_nonzero, w.pct_nonzero) os.remove(fname) if __name__ == '__main__': unittest.main()
// The LLVM Compiler Infrastructure // This file is distributed under the University of Illinois Open Source // This file declares the NVPTX specific subclass of TargetMachine. #ifndef <API key> #define <API key> #include "ManagedStringPool.h" #include "NVPTXFrameLowering.h" #include "NVPTXISelLowering.h" #include "NVPTXInstrInfo.h" #include "NVPTXRegisterInfo.h" #include "NVPTXSubtarget.h" #include "llvm/IR/DataLayout.h" #include "llvm/Target/TargetFrameLowering.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/<API key>.h" namespace llvm { NVPTXTargetMachine class NVPTXTargetMachine : public LLVMTargetMachine { NVPTXSubtarget Subtarget; const DataLayout DL; // Calculates type size & alignment NVPTXInstrInfo InstrInfo; NVPTXTargetLowering TLInfo; <API key> TSInfo; // NVPTX does not have any call stack frame, but need a NVPTX specific // FrameLowering class because TargetFrameLowering is abstract. NVPTXFrameLowering FrameLowering; // Hold Strings that can be free'd all together with NVPTXTargetMachine ManagedStringPool ManagedStrPool; //bool <API key>(PassManagerBase &, CodeGenOpt::Level, // bool DisableVerify, MCContext *&OutCtx); public: NVPTXTargetMachine(const Target &T, StringRef TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OP, bool is64bit); virtual const TargetFrameLowering *getFrameLowering() const { return &FrameLowering; } virtual const NVPTXInstrInfo *getInstrInfo() const { return &InstrInfo; } virtual const DataLayout *getDataLayout() const { return &DL; } virtual const NVPTXSubtarget *getSubtargetImpl() const { return &Subtarget; } virtual const NVPTXRegisterInfo *getRegisterInfo() const { return &(InstrInfo.getRegisterInfo()); } virtual NVPTXTargetLowering *getTargetLowering() const { return const_cast<NVPTXTargetLowering *>(&TLInfo); } virtual const <API key> *getSelectionDAGInfo() const { return &TSInfo; } //virtual bool addInstSelector(PassManagerBase &PM, // CodeGenOpt::Level OptLevel); //virtual bool addPreRegAlloc(PassManagerBase &, CodeGenOpt::Level); ManagedStringPool *getManagedStrPool() const { return const_cast<ManagedStringPool *>(&ManagedStrPool); } virtual TargetPassConfig *createPassConfig(PassManagerBase &PM); // Emission of machine code through JITCodeEmitter is not supported. virtual bool <API key>(PassManagerBase &, JITCodeEmitter &, bool = true) { return true; } // Emission of machine code through MCJIT is not supported. virtual bool addPassesToEmitMC(PassManagerBase &, MCContext *&, raw_ostream &, bool = true) { return true; } }; // NVPTXTargetMachine. class <API key> : public NVPTXTargetMachine { virtual void anchor(); public: <API key>(const Target &T, StringRef TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL); }; class <API key> : public NVPTXTargetMachine { virtual void anchor(); public: <API key>(const Target &T, StringRef TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL); }; } // end namespace llvm #endif
<!doctype html> <title>line-height has no effect on placeholder</title> <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1714631"> <link rel="match" href="<API key>.html"> <style> input::placeholder { line-height: 0; } </style> <input placeholder=Foo>
// Inferno utils/5c/sgen.c // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // all copies or substantial portions of the Software. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // 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. #include "gc.h" Prog* gtext(Sym *s, int32 stkoff) { int32 a; a = 0; if(!(textflag & NOSPLIT)) a = argsize(); else if(stkoff >= 128) yyerror("stack frame too large for NOSPLIT function"); gpseudo(ATEXT, s, nodconst(stkoff)); p->to.type = D_CONST2; p->to.offset2 = a; return p; } void noretval(int n) { if(n & 1) { gins(ANOP, Z, Z); p->to.type = D_REG; p->to.reg = REGRET; } if(n & 2) { gins(ANOP, Z, Z); p->to.type = D_FREG; p->to.reg = FREGRET; } } /* * calculate addressability as follows * CONST ==> 20 $value * NAME ==> 10 name * REGISTER ==> 11 register * INDREG ==> 12 *[(reg)+offset] * &10 ==> 2 $name * ADD(2, 20) ==> 2 $name+offset * ADD(3, 20) ==> 3 $(reg)+offset * &12 ==> 3 $(reg)+offset * *11 ==> 11 ?? * *2 ==> 10 name * *3 ==> 12 *(reg)+offset * calculate complexity (number of registers) */ void xcom(Node *n) { Node *l, *r; int t; if(n == Z) return; l = n->left; r = n->right; n->addable = 0; n->complex = 0; switch(n->op) { case OCONST: n->addable = 20; return; case OREGISTER: n->addable = 11; return; case OINDREG: n->addable = 12; return; case ONAME: n->addable = 10; return; case OADDR: xcom(l); if(l->addable == 10) n->addable = 2; if(l->addable == 12) n->addable = 3; break; case OIND: xcom(l); if(l->addable == 11) n->addable = 12; if(l->addable == 3) n->addable = 12; if(l->addable == 2) n->addable = 10; break; case OADD: xcom(l); xcom(r); if(l->addable == 20) { if(r->addable == 2) n->addable = 2; if(r->addable == 3) n->addable = 3; } if(r->addable == 20) { if(l->addable == 2) n->addable = 2; if(l->addable == 3) n->addable = 3; } break; case OASLMUL: case OASMUL: xcom(l); xcom(r); t = vlog(r); if(t >= 0) { n->op = OASASHL; r->vconst = t; r->type = types[TINT]; } break; case OMUL: case OLMUL: xcom(l); xcom(r); t = vlog(r); if(t >= 0) { n->op = OASHL; r->vconst = t; r->type = types[TINT]; } t = vlog(l); if(t >= 0) { n->op = OASHL; n->left = r; n->right = l; r = l; l = n->left; r->vconst = t; r->type = types[TINT]; } break; case OASLDIV: xcom(l); xcom(r); t = vlog(r); if(t >= 0) { n->op = OASLSHR; r->vconst = t; r->type = types[TINT]; } break; case OLDIV: xcom(l); xcom(r); t = vlog(r); if(t >= 0) { n->op = OLSHR; r->vconst = t; r->type = types[TINT]; } break; case OASLMOD: xcom(l); xcom(r); t = vlog(r); if(t >= 0) { n->op = OASAND; r->vconst } break; case OLMOD: xcom(l); xcom(r); t = vlog(r); if(t >= 0) { n->op = OAND; r->vconst } break; default: if(l != Z) xcom(l); if(r != Z) xcom(r); break; } if(n->addable >= 10) return; if(l != Z) n->complex = l->complex; if(r != Z) { if(r->complex == n->complex) n->complex = r->complex+1; else if(r->complex > n->complex) n->complex = r->complex; } if(n->complex == 0) n->complex++; if(com64(n)) return; switch(n->op) { case OFUNC: n->complex = FNX; break; case OADD: case OXOR: case OAND: case OOR: case OEQ: case ONE: /* * immediate operators, make const on right */ if(l->op == OCONST) { n->left = r; n->right = l; } break; } }
Timepicker for Twitter Bootstrap 3 fork of https://github.com/jdewit/<API key> ==================
RSpec::Matchers.define :have_rule do |rule| match do |subject| if subject.class.name == 'Serverspec::Type::Iptables' subject.has_rule?(rule, @table, @chain) else subject.has_rule?(rule) end end chain :with_table do |table| @table = table end chain :with_chain do |chain| @chain = chain end end
'use strict'; angular.module('showcase', [ 'showcase.angularWay', 'showcase.angularWay.withOptions', 'showcase.withAjax', 'showcase.withOptions', 'showcase.withPromise', 'showcase.angularWay.dataChange', 'showcase.<API key>', 'showcase.changeOptions', 'showcase.dataReload.withAjax', 'showcase.dataReload.withPromise', 'showcase.disableDeepWatchers', 'showcase.<API key>', 'showcase.<API key>', 'showcase.rerender', 'showcase.rowClickEvent', 'showcase.rowSelect', 'showcase.<API key>', 'showcase.<API key>', 'showcase.<API key>', 'showcase.<API key>', 'showcase.withColReorder', 'showcase.withColumnFilter', 'showcase.<API key>', 'showcase.withColVis', 'showcase.withResponsive', 'showcase.withScroller', 'showcase.withTableTools', 'showcase.withFixedColumns', 'showcase.withFixedHeader', 'showcase.withButtons', 'showcase.withSelect', 'showcase.dtInstances', 'showcase.usages', 'ui.bootstrap', 'ui.router', 'hljs' ]) .config(sampleConfig) .config(routerConfig) .config(translateConfig) .config(debugDisabled) .run(initDT); backToTop.init({ theme: 'classic', // Available themes: 'classic', 'sky', 'slate' animation: 'fade' // Available animations: 'fade', 'slide' }); function debugDisabled($compileProvider)  { $compileProvider.debugInfoEnabled(false); } function sampleConfig(hljsServiceProvider) { hljsServiceProvider.setOptions({ // replace tab with 4 spaces tabReplace: ' ' }); } function routerConfig($stateProvider, $urlRouterProvider, USAGES) { $urlRouterProvider.otherwise('/welcome'); $stateProvider .state('welcome', { url: '/welcome', templateUrl: 'demo/partials/welcome.html', controller: function($rootScope) { $rootScope.$broadcast('event:changeView', 'welcome'); } }) .state('gettingStarted', { url: '/gettingStarted', templateUrl: 'demo/partials/gettingStarted.html', controller: function($rootScope) { $rootScope.$broadcast('event:changeView', 'gettingStarted'); } }) .state('api', { url: '/api', templateUrl: 'demo/api/api.html', controller: function($rootScope) { $rootScope.$broadcast('event:changeView', 'api'); } }); angular.forEach(USAGES, function(usages, key) { angular.forEach(usages, function(usage) { $stateProvider.state(usage.name, { url: '/' + usage.name, templateUrl: 'demo/' + key + '/' + usage.name + '.html', controller: function($rootScope) { $rootScope.$broadcast('event:changeView', usage.name); }, onExit: usage.onExit }); }); }); } function translateConfig($translateProvider) { $translateProvider.translations('en', { id: 'ID with angular-translate', firstName: 'First name with angular-translate', lastName: 'Last name with angular-translate' }); $translateProvider.translations('fr', { id: 'ID avec angular-translate', firstName: 'Prénom avec angular-translate', lastName: 'Nom avec angular-translate' }); $translateProvider.preferredLanguage('en'); } function initDT(DTDefaultOptions) { DTDefaultOptions.setLoadingTemplate('<img src="/angular-datatables/images/loading.gif" />'); }
#ifndef <API key> #define <API key> namespace sandbox { // Operation result codes returned by the sandbox API. enum ResultCode { SBOX_ALL_OK = 0, // Error is originating on the win32 layer. Call GetlastError() for more // information. SBOX_ERROR_GENERIC = 1, // An invalid combination of parameters was given to the API. <API key> = 2, // The desired operation is not supported at this time. <API key> = 3, // The request requires more memory that allocated or available. SBOX_ERROR_NO_SPACE = 4, // The ipc service requested does not exist. <API key> = 5, // The ipc service did not complete. <API key> = 6, // The requested handle was not found. <API key> = 7, // This function was not expected to be called at this time. <API key> = 8, // WaitForAllTargets is already called. <API key> = 9, // A channel error prevented DoCall from executing. <API key> = 10, // Failed to create the alternate desktop. <API key> = 11, // Failed to create the alternate window station. <API key> = 12, // Failed to switch back to the interactive window station. <API key> = 13, // The supplied AppContainer is not valid. <API key> = 14, // The supplied capability is not valid. <API key> = 15, // There is a failure initializing the AppContainer. <API key> = 16, // Initializing or updating <API key> failed. <API key> = 17, // Error in creating process. <API key> = 18, // Placeholder for last item of the enum. SBOX_ERROR_LAST }; // If the sandbox cannot create a secure environment for the target, the // target will be forcibly terminated. These are the process exit codes. enum TerminationCodes { <API key> = 7006, // Could not set the integrity level. <API key> = 7007, // Could not lower the token. <API key> = 7008, // Failed to flush registry handles. <API key> = 7009, // Failed to forbid HCKU caching. <API key> = 7010, // Failed to close pending handles. <API key> = 7011, // Could not set the mitigation policy. <API key> = 7012, // Exceeded the job memory limit. SBOX_FATAL_LAST }; class BrokerServices; class TargetServices; // Contains the pointer to a target or broker service. struct <API key> { BrokerServices* broker_services; TargetServices* target_services; }; #if SANDBOX_EXPORTS #define SANDBOX_INTERCEPT extern "C" __declspec(dllexport) #else #define SANDBOX_INTERCEPT extern "C" #endif enum InterceptionType { <API key> = 0, <API key>, // Trampoline of an NT native call INTERCEPTION_EAT, <API key>, // Preamble patch <API key>, // Preamble patch but bypass internal calls <API key>, // Unload the module (don't patch) INTERCEPTION_LAST // Placeholder for last item in the enumeration }; } // namespace sandbox #endif // <API key>
#ifndef _CRYPT_BLOWFISH_H #define _CRYPT_BLOWFISH_H #if 0 extern int _crypt_output_magic(const char *setting, char *output, int size); #endif extern char *<API key>(const char *key, const char *setting, char *output, int size); #if 0 extern char *<API key>(const char *prefix, unsigned long count, const char *input, int size, char *output, int output_size); #endif #endif
// <API key>: GPL-2.0 #include <linux/memcontrol.h> #include <linux/mm_inline.h> #include <linux/writeback.h> #include <linux/shmem_fs.h> #include <linux/pagemap.h> #include <linux/atomic.h> #include <linux/module.h> #include <linux/swap.h> #include <linux/dax.h> #include <linux/fs.h> #include <linux/mm.h> #define EVICTION_SHIFT ((BITS_PER_LONG - BITS_PER_XA_VALUE) + \ 1 + NODES_SHIFT + MEM_CGROUP_ID_SHIFT) #define EVICTION_MASK (~0UL >> EVICTION_SHIFT) /* * Eviction timestamps need to be able to cover the full range of * actionable refaults. However, bits are tight in the xarray * entry, and after storing the identifier for the lruvec there might * not be enough left to represent every single actionable refault. In * that case, we have to sacrifice granularity for distance, and group * evictions into coarser buckets by shaving off lower timestamp bits. */ static unsigned int bucket_order __read_mostly; static void *pack_shadow(int memcgid, pg_data_t *pgdat, unsigned long eviction, bool workingset) { eviction >>= bucket_order; eviction &= EVICTION_MASK; eviction = (eviction << MEM_CGROUP_ID_SHIFT) | memcgid; eviction = (eviction << NODES_SHIFT) | pgdat->node_id; eviction = (eviction << 1) | workingset; return xa_mk_value(eviction); } static void unpack_shadow(void *shadow, int *memcgidp, pg_data_t **pgdat, unsigned long *evictionp, bool *workingsetp) { unsigned long entry = xa_to_value(shadow); int memcgid, nid; bool workingset; workingset = entry & 1; entry >>= 1; nid = entry & ((1UL << NODES_SHIFT) - 1); entry >>= NODES_SHIFT; memcgid = entry & ((1UL << MEM_CGROUP_ID_SHIFT) - 1); entry >>= MEM_CGROUP_ID_SHIFT; *memcgidp = memcgid; *pgdat = NODE_DATA(nid); *evictionp = entry << bucket_order; *workingsetp = workingset; } /** * <API key> - age non-resident entries as LRU ages * @lruvec: the lruvec that was aged * @nr_pages: the number of pages to count * * As in-memory pages are aged, non-resident pages need to be aged as * well, in order for the refault distances later on to be comparable * to the in-memory dimensions. This function allows reclaim and LRU * operations to drive the non-resident aging along in parallel. */ void <API key>(struct lruvec *lruvec, unsigned long nr_pages) { /* * Reclaiming a cgroup means reclaiming all its children in a * round-robin fashion. That means that each cgroup has an LRU * order that is composed of the LRU orders of its child * cgroups; and every page has an LRU position not just in the * cgroup that owns it, but in all of that group's ancestors. * * So when the physical inactive list of a leaf cgroup ages, * the virtual inactive lists of all its parents, including * the root cgroup's, age as well. */ do { atomic_long_add(nr_pages, &lruvec->nonresident_age); } while ((lruvec = parent_lruvec(lruvec))); } /** * workingset_eviction - note the eviction of a page from memory * @target_memcg: the cgroup that is causing the reclaim * @page: the page being evicted * * Returns a shadow entry to be stored in @page->mapping->i_pages in place * of the evicted @page so that a later refault can be detected. */ void *workingset_eviction(struct page *page, struct mem_cgroup *target_memcg) { struct pglist_data *pgdat = page_pgdat(page); unsigned long eviction; struct lruvec *lruvec; int memcgid; /* Page is fully exclusive and pins page's memory cgroup pointer */ VM_BUG_ON_PAGE(PageLRU(page), page); VM_BUG_ON_PAGE(page_count(page), page); VM_BUG_ON_PAGE(!PageLocked(page), page); lruvec = mem_cgroup_lruvec(target_memcg, pgdat); /* XXX: target_memcg can be NULL, go through lruvec */ memcgid = mem_cgroup_id(lruvec_memcg(lruvec)); eviction = atomic_long_read(&lruvec->nonresident_age); <API key>(lruvec, thp_nr_pages(page)); return pack_shadow(memcgid, pgdat, eviction, PageWorkingset(page)); } /** * workingset_refault - evaluate the refault of a previously evicted page * @page: the freshly allocated replacement page * @shadow: shadow entry of the evicted page * * Calculates and evaluates the refault distance of the previously * evicted page in the context of the node and the memcg whose memory * pressure caused the eviction. */ void workingset_refault(struct page *page, void *shadow) { bool file = page_is_file_lru(page); struct mem_cgroup *eviction_memcg; struct lruvec *eviction_lruvec; unsigned long refault_distance; unsigned long workingset_size; struct pglist_data *pgdat; struct mem_cgroup *memcg; unsigned long eviction; struct lruvec *lruvec; unsigned long refault; bool workingset; int memcgid; unpack_shadow(shadow, &memcgid, &pgdat, &eviction, &workingset); rcu_read_lock(); /* * Look up the memcg associated with the stored ID. It might * have been deleted since the page's eviction. * * Note that in rare events the ID could have been recycled * for a new cgroup that refaults a shared page. This is * impossible to tell from the available data. However, this * should be a rare and limited disturbance, and activations * are always speculative anyway. Ultimately, it's the aging * algorithm's job to shake out the minimum access frequency * for the active cache. * * XXX: On !CONFIG_MEMCG, this will always return NULL; it * would be better if the root_mem_cgroup existed in all * configurations instead. */ eviction_memcg = mem_cgroup_from_id(memcgid); if (!mem_cgroup_disabled() && !eviction_memcg) goto out; eviction_lruvec = mem_cgroup_lruvec(eviction_memcg, pgdat); refault = atomic_long_read(&eviction_lruvec->nonresident_age); /* * Calculate the refault distance * * The unsigned subtraction here gives an accurate distance * across nonresident_age overflows in most cases. There is a * special case: usually, shadow entries have a short lifetime * and are either refaulted or reclaimed along with the inode * before they get too old. But it is not impossible for the * nonresident_age to lap a shadow entry in the field, which * can then result in a false small refault distance, leading * to a false activation should this old entry actually * refault again. However, earlier kernels used to deactivate * unconditionally with *every* reclaim invocation for the * longest time, so the occasional inappropriate activation * leading to pressure on the active list is not a problem. */ refault_distance = (refault - eviction) & EVICTION_MASK; /* * The activation decision for this page is made at the level * where the eviction occurred, as that is where the LRU order * during page reclaim is being determined. * * However, the cgroup that will own the page is the one that * is actually experiencing the refault event. */ memcg = page_memcg(page); lruvec = mem_cgroup_lruvec(memcg, pgdat); inc_lruvec_state(lruvec, <API key> + file); /* * Compare the distance to the existing workingset size. We * don't activate pages that couldn't stay resident even if * all the memory was available to the workingset. Whether * workingset competition needs to consider anon or not depends * on having swap. */ workingset_size = lruvec_page_state(eviction_lruvec, NR_ACTIVE_FILE); if (!file) { workingset_size += lruvec_page_state(eviction_lruvec, NR_INACTIVE_FILE); } if (<API key>(memcg) > 0) { workingset_size += lruvec_page_state(eviction_lruvec, NR_ACTIVE_ANON); if (file) { workingset_size += lruvec_page_state(eviction_lruvec, NR_INACTIVE_ANON); } } if (refault_distance > workingset_size) goto out; SetPageActive(page); <API key>(lruvec, thp_nr_pages(page)); inc_lruvec_state(lruvec, <API key> + file); /* Page was active prior to eviction */ if (workingset) { SetPageWorkingset(page); /* XXX: Move to lru_cache_add() when it supports new vs putback */ lru_note_cost_page(page); inc_lruvec_state(lruvec, <API key> + file); } out: rcu_read_unlock(); } /** * <API key> - note a page activation * @page: page that is being activated */ void <API key>(struct page *page) { struct mem_cgroup *memcg; struct lruvec *lruvec; rcu_read_lock(); /* * Filter non-memcg pages here, e.g. unmap can call * mark_page_accessed() on VDSO pages. * * XXX: See workingset_refault() - this should return * root_mem_cgroup even for !CONFIG_MEMCG. */ memcg = page_memcg_rcu(page); if (!mem_cgroup_disabled() && !memcg) goto out; lruvec = <API key>(page, page_pgdat(page)); <API key>(lruvec, thp_nr_pages(page)); out: rcu_read_unlock(); } /* * Shadow entries reflect the share of the working set that does not * fit into memory, so their number depends on the access pattern of * the workload. In most cases, they will refault or get reclaimed * along with the inode, but a (malicious) workload that streams * through files with a total size several times that of available * memory, while preventing the inodes from being reclaimed, can * create excessive amounts of shadow nodes. To keep a lid on this, * track shadow nodes and reclaim them when they grow way past the * point where they would still be useful. */ static struct list_lru shadow_nodes; void <API key>(struct xa_node *node) { /* * Track non-empty nodes that contain only shadow entries; * unlink those that contain pages or are being freed. * * Avoid acquiring the list_lru lock when the nodes are * already where they should be. The list_empty() test is safe * as node->private_list is protected by the i_pages lock. */ VM_WARN_ON_ONCE(!irqs_disabled()); /* For <API key> */ if (node->count && node->count == node->nr_values) { if (list_empty(&node->private_list)) { list_lru_add(&shadow_nodes, &node->private_list); <API key>(node, WORKINGSET_NODES); } } else { if (!list_empty(&node->private_list)) { list_lru_del(&shadow_nodes, &node->private_list); <API key>(node, WORKINGSET_NODES); } } } static unsigned long count_shadow_nodes(struct shrinker *shrinker, struct shrink_control *sc) { unsigned long max_nodes; unsigned long nodes; unsigned long pages; nodes = <API key>(&shadow_nodes, sc); if (!nodes) return SHRINK_EMPTY; /* * Approximate a reasonable limit for the nodes * containing shadow entries. We don't need to keep more * shadow entries than possible pages on the active list, * since refault distances bigger than that are dismissed. * * The size of the active list converges toward 100% of * overall page cache as memory grows, with only a tiny * inactive list. Assume the total cache size for that. * * Nodes might be sparsely populated, with only one shadow * entry in the extreme case. Obviously, we cannot keep one * node for every eligible shadow entry, so compromise on a * worst-case density of 1/8th. Below that, not all eligible * refaults can be detected anymore. * * On 64-bit with 7 xa_nodes per page and 64 slots * each, this will reclaim shadow entries when they consume * ~1.8% of available memory: * * PAGE_SIZE / xa_nodes / node_entries * 8 / PAGE_SIZE */ #ifdef CONFIG_MEMCG if (sc->memcg) { struct lruvec *lruvec; int i; lruvec = mem_cgroup_lruvec(sc->memcg, NODE_DATA(sc->nid)); for (pages = 0, i = 0; i < NR_LRU_LISTS; i++) pages += <API key>(lruvec, NR_LRU_BASE + i); pages += <API key>( lruvec, <API key>) >> PAGE_SHIFT; pages += <API key>( lruvec, <API key>) >> PAGE_SHIFT; } else #endif pages = node_present_pages(sc->nid); max_nodes = pages >> (XA_CHUNK_SHIFT - 3); if (nodes <= max_nodes) return 0; return nodes - max_nodes; } static enum lru_status shadow_lru_isolate(struct list_head *item, struct list_lru_one *lru, spinlock_t *lru_lock, void *arg) __must_hold(lru_lock) { struct xa_node *node = container_of(item, struct xa_node, private_list); struct address_space *mapping; int ret; /* * Page cache insertions and deletions synchronously maintain * the shadow node LRU under the i_pages lock and the * lru_lock. Because the page cache tree is emptied before * the inode can be destroyed, holding the lru_lock pins any * address_space that has nodes on the LRU. * * We can then safely transition to the i_pages lock to * pin only the address_space of the particular node we want * to reclaim, take the node off-LRU, and drop the lru_lock. */ mapping = container_of(node->array, struct address_space, i_pages); /* Coming from the list, invert the lock order */ if (!xa_trylock(&mapping->i_pages)) { spin_unlock_irq(lru_lock); ret = LRU_RETRY; goto out; } list_lru_isolate(lru, item); <API key>(node, WORKINGSET_NODES); spin_unlock(lru_lock); /* * The nodes should only contain one or more shadow entries, * no pages, so we expect to be able to remove them all and * delete and free the empty node afterwards. */ if (WARN_ON_ONCE(!node->nr_values)) goto out_invalid; if (WARN_ON_ONCE(node->count != node->nr_values)) goto out_invalid; mapping->nrexceptional -= node->nr_values; xa_delete_node(node, <API key>); <API key>(node, <API key>); out_invalid: xa_unlock_irq(&mapping->i_pages); ret = LRU_REMOVED_RETRY; out: cond_resched(); spin_lock_irq(lru_lock); return ret; } static unsigned long scan_shadow_nodes(struct shrinker *shrinker, struct shrink_control *sc) { /* list_lru lock nests inside the IRQ-safe i_pages lock */ return <API key>(&shadow_nodes, sc, shadow_lru_isolate, NULL); } static struct shrinker <API key> = { .count_objects = count_shadow_nodes, .scan_objects = scan_shadow_nodes, .seeks = 0, /* ->count reports only fully expendable nodes */ .flags = SHRINKER_NUMA_AWARE | <API key>, }; /* * Our list_lru->lock is IRQ-safe as it nests inside the IRQ-safe * i_pages lock. */ static struct lock_class_key shadow_nodes_key; static int __init workingset_init(void) { unsigned int timestamp_bits; unsigned int max_order; int ret; BUILD_BUG_ON(BITS_PER_LONG < EVICTION_SHIFT); /* * Calculate the eviction bucket size to cover the longest * actionable refault distance, which is currently half of * memory (totalram_pages/2). However, memory hotplug may add * some more pages at runtime, so keep working with up to * double the initial memory by using totalram_pages as-is. */ timestamp_bits = BITS_PER_LONG - EVICTION_SHIFT; max_order = fls_long(totalram_pages() - 1); if (max_order > timestamp_bits) bucket_order = max_order - timestamp_bits; pr_info("workingset: timestamp_bits=%d max_order=%d bucket_order=%u\n", timestamp_bits, max_order, bucket_order); ret = prealloc_shrinker(&<API key>); if (ret) goto err; ret = __list_lru_init(&shadow_nodes, true, &shadow_nodes_key, &<API key>); if (ret) goto err_list_lru; <API key>(&<API key>); return 0; err_list_lru: <API key>(&<API key>); err: return ret; } module_init(workingset_init);
SET(CMAKE_CXX_COMPILER "/usr/bin/c++") SET(<API key> "") SET(<API key> "GNU") SET(<API key> "4.7.2") SET(<API key> "Linux") SET(CMAKE_AR "/usr/bin/ar") SET(CMAKE_RANLIB "/usr/bin/ranlib") SET(CMAKE_LINKER "/usr/bin/ld") SET(<API key> 1) SET(<API key> 1) SET(<API key> ) SET(<API key> ) IF(<API key>) SET(CYGWIN 1) SET(UNIX 1) ENDIF(<API key>) SET(<API key> "CXX") IF(<API key>) SET(MINGW 1) ENDIF(<API key>) SET(<API key> 1) SET(<API key> inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) SET(<API key> C;M;c++;cc;cpp;cxx;m;mm;CPP) SET(<API key> 30) SET(<API key> 1) # Save compiler ABI information. SET(<API key> "8") SET(<API key> "ELF") SET(<API key> "x86_64-linux-gnu") IF(<API key>) SET(CMAKE_SIZEOF_VOID_P "${<API key>}") ENDIF(<API key>) IF(<API key>) SET(<API key> "${<API key>}") ENDIF(<API key>) IF(<API key>) SET(<API key> "x86_64-linux-gnu") ENDIF() SET(<API key> "") SET(<API key> "stdc++;m;c") SET(<API key> "/usr/lib/gcc/x86_64-linux-gnu/4.7;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib")
<?php /** * @file * Initiates a browser-based installation of Drupal. */ // Change the directory to the Drupal root. chdir('..'); /** * Global flag to indicate the site is in installation mode. * * The constant is defined using define() instead of const so that PHP * versions prior to 5.3 can display proper PHP requirements instead of causing * a fatal error. */ define('MAINTENANCE_MODE', 'install'); // Exit early if running an incompatible PHP version to avoid fatal errors. // The minimum version is specified explicitly, as DRUPAL_MINIMUM_PHP is not // yet available. It is defined in bootstrap.inc, but it is not possible to // load that file yet as it would cause a fatal error on older versions of PHP. if (version_compare(PHP_VERSION, '5.4.2') < 0) { print 'Your PHP installation is too old. Drupal requires at least PHP 5.4.2. See the <a href="http://drupal.org/requirements">system requirements</a> page for more information.'; exit; } // Start the installer. require_once __DIR__ . '/vendor/autoload.php'; require_once __DIR__ . '/includes/install.core.inc'; install_drupal();
#ifndef <API key> #define <API key> /* this struct defines a stack used during syscall handling */ typedef struct target_sigaltstack { abi_ulong ss_sp; abi_long ss_flags; abi_ulong ss_size; } target_stack_t; /* * sigaltstack controls */ #define TARGET_SS_ONSTACK 1 #define TARGET_SS_DISABLE 2 #define TARGET_MINSIGSTKSZ 2048 #define TARGET_SIGSTKSZ 8192 #include "../generic/signal.h" #endif /* <API key> */
// <API key>: GPL-2.0 #include <linux/device.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/msi.h> #include <linux/pci.h> #include <linux/srcu.h> #include <linux/rculist.h> #include <linux/rcupdate.h> #include <asm/irqdomain.h> #include <asm/device.h> #include <asm/msi.h> #include <asm/msidef.h> #define VMD_CFGBAR 0 #define VMD_MEMBAR1 2 #define VMD_MEMBAR2 4 #define PCI_REG_VMCAP 0x40 #define BUS_RESTRICT_CAP(vmcap) (vmcap & 0x1) #define PCI_REG_VMCONFIG 0x44 #define BUS_RESTRICT_CFG(vmcfg) ((vmcfg >> 8) & 0x3) #define PCI_REG_VMLOCK 0x70 #define MB2_SHADOW_EN(vmlock) (vmlock & 0x2) #define MB2_SHADOW_OFFSET 0x2000 #define MB2_SHADOW_SIZE 16 enum vmd_features { /* * Device may contain registers which hint the physical location of the * membars, in order to allow proper address translation during * resource assignment to enable guest virtualization */ <API key> = (1 << 0), /* * Device may provide root port configuration information which limits * bus numbering */ <API key> = (1 << 1), }; /* * Lock for manipulating VMD IRQ lists. */ static DEFINE_RAW_SPINLOCK(list_lock); /** * struct vmd_irq - private data to map driver IRQ to the VMD shared vector * @node: list item for parent traversal. * @irq: back pointer to parent. * @enabled: true if driver enabled IRQ * @virq: the virtual IRQ value provided to the requesting driver. * * Every MSI/MSI-X IRQ requested for a device in a VMD domain will be mapped to * a VMD IRQ using this structure. */ struct vmd_irq { struct list_head node; struct vmd_irq_list *irq; bool enabled; unsigned int virq; }; /** * struct vmd_irq_list - list of driver requested IRQs mapping to a VMD vector * @irq_list: the list of irq's the VMD one demuxes to. * @srcu: SRCU struct for local synchronization. * @count: number of child IRQs assigned to this vector; used to track * sharing. */ struct vmd_irq_list { struct list_head irq_list; struct srcu_struct srcu; unsigned int count; }; struct vmd_dev { struct pci_dev *dev; spinlock_t cfg_lock; char __iomem *cfgbar; int msix_count; struct vmd_irq_list *irqs; struct pci_sysdata sysdata; struct resource resources[3]; struct irq_domain *irq_domain; struct pci_bus *bus; u8 busn_start; struct dma_map_ops dma_ops; struct dma_domain dma_domain; }; static inline struct vmd_dev *vmd_from_bus(struct pci_bus *bus) { return container_of(bus->sysdata, struct vmd_dev, sysdata); } static inline unsigned int index_from_irqs(struct vmd_dev *vmd, struct vmd_irq_list *irqs) { return irqs - vmd->irqs; } /* * Drivers managing a device in a VMD domain allocate their own IRQs as before, * but the MSI entry for the hardware it's driving will be programmed with a * destination ID for the VMD MSI-X table. The VMD muxes interrupts in its * domain into one of its own, and the VMD driver de-muxes these for the * handlers sharing that VMD IRQ. The vmd irq_domain provides the operations * and irq_chip to set this up. */ static void vmd_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) { struct vmd_irq *vmdirq = data->chip_data; struct vmd_irq_list *irq = vmdirq->irq; struct vmd_dev *vmd = <API key>(data); msg->address_hi = MSI_ADDR_BASE_HI; msg->address_lo = MSI_ADDR_BASE_LO | MSI_ADDR_DEST_ID(index_from_irqs(vmd, irq)); msg->data = 0; } /* * We rely on <API key> to set the IRQ mask/unmask ops. */ static void vmd_irq_enable(struct irq_data *data) { struct vmd_irq *vmdirq = data->chip_data; unsigned long flags; <API key>(&list_lock, flags); WARN_ON(vmdirq->enabled); list_add_tail_rcu(&vmdirq->node, &vmdirq->irq->irq_list); vmdirq->enabled = true; <API key>(&list_lock, flags); data->chip->irq_unmask(data); } static void vmd_irq_disable(struct irq_data *data) { struct vmd_irq *vmdirq = data->chip_data; unsigned long flags; data->chip->irq_mask(data); <API key>(&list_lock, flags); if (vmdirq->enabled) { list_del_rcu(&vmdirq->node); vmdirq->enabled = false; } <API key>(&list_lock, flags); } /* * XXX: Stubbed until we develop acceptable way to not create conflicts with * other devices sharing the same vector. */ static int <API key>(struct irq_data *data, const struct cpumask *dest, bool force) { return -EINVAL; } static struct irq_chip vmd_msi_controller = { .name = "VMD-MSI", .irq_enable = vmd_irq_enable, .irq_disable = vmd_irq_disable, .irq_compose_msi_msg = vmd_compose_msi_msg, .irq_set_affinity = <API key>, }; static irq_hw_number_t vmd_get_hwirq(struct msi_domain_info *info, msi_alloc_info_t *arg) { return 0; } /* * XXX: We can be even smarter selecting the best IRQ once we solve the * affinity problem. */ static struct vmd_irq_list *vmd_next_irq(struct vmd_dev *vmd, struct msi_desc *desc) { int i, best = 1; unsigned long flags; if (vmd->msix_count == 1) return &vmd->irqs[0]; /* * White list for fast-interrupt handlers. All others will share the * "slow" interrupt vector. */ switch (msi_desc_to_pci_dev(desc)->class) { case <API key>: break; default: return &vmd->irqs[0]; } <API key>(&list_lock, flags); for (i = 1; i < vmd->msix_count; i++) if (vmd->irqs[i].count < vmd->irqs[best].count) best = i; vmd->irqs[best].count++; <API key>(&list_lock, flags); return &vmd->irqs[best]; } static int vmd_msi_init(struct irq_domain *domain, struct msi_domain_info *info, unsigned int virq, irq_hw_number_t hwirq, msi_alloc_info_t *arg) { struct msi_desc *desc = arg->desc; struct vmd_dev *vmd = vmd_from_bus(msi_desc_to_pci_dev(desc)->bus); struct vmd_irq *vmdirq = kzalloc(sizeof(*vmdirq), GFP_KERNEL); unsigned int index, vector; if (!vmdirq) return -ENOMEM; INIT_LIST_HEAD(&vmdirq->node); vmdirq->irq = vmd_next_irq(vmd, desc); vmdirq->virq = virq; index = index_from_irqs(vmd, vmdirq->irq); vector = pci_irq_vector(vmd->dev, index); irq_domain_set_info(domain, virq, vector, info->chip, vmdirq, <API key>, vmd, NULL); return 0; } static void vmd_msi_free(struct irq_domain *domain, struct msi_domain_info *info, unsigned int virq) { struct vmd_irq *vmdirq = irq_get_chip_data(virq); unsigned long flags; synchronize_srcu(&vmdirq->irq->srcu); /* XXX: Potential optimization to rebalance */ <API key>(&list_lock, flags); vmdirq->irq->count <API key>(&list_lock, flags); kfree(vmdirq); } static int vmd_msi_prepare(struct irq_domain *domain, struct device *dev, int nvec, msi_alloc_info_t *arg) { struct pci_dev *pdev = to_pci_dev(dev); struct vmd_dev *vmd = vmd_from_bus(pdev->bus); if (nvec > vmd->msix_count) return vmd->msix_count; memset(arg, 0, sizeof(*arg)); return 0; } static void vmd_set_desc(msi_alloc_info_t *arg, struct msi_desc *desc) { arg->desc = desc; } static struct msi_domain_ops vmd_msi_domain_ops = { .get_hwirq = vmd_get_hwirq, .msi_init = vmd_msi_init, .msi_free = vmd_msi_free, .msi_prepare = vmd_msi_prepare, .set_desc = vmd_set_desc, }; static struct msi_domain_info vmd_msi_domain_info = { .flags = <API key> | <API key> | MSI_FLAG_PCI_MSIX, .ops = &vmd_msi_domain_ops, .chip = &vmd_msi_controller, }; /* * VMD replaces the requester ID with its own. DMA mappings for devices in a * VMD domain need to be mapped for the VMD, not the device requiring * the mapping. */ static struct device *to_vmd_dev(struct device *dev) { struct pci_dev *pdev = to_pci_dev(dev); struct vmd_dev *vmd = vmd_from_bus(pdev->bus); return &vmd->dev->dev; } static void *vmd_alloc(struct device *dev, size_t size, dma_addr_t *addr, gfp_t flag, unsigned long attrs) { return dma_alloc_attrs(to_vmd_dev(dev), size, addr, flag, attrs); } static void vmd_free(struct device *dev, size_t size, void *vaddr, dma_addr_t addr, unsigned long attrs) { return dma_free_attrs(to_vmd_dev(dev), size, vaddr, addr, attrs); } static int vmd_mmap(struct device *dev, struct vm_area_struct *vma, void *cpu_addr, dma_addr_t addr, size_t size, unsigned long attrs) { return dma_mmap_attrs(to_vmd_dev(dev), vma, cpu_addr, addr, size, attrs); } static int vmd_get_sgtable(struct device *dev, struct sg_table *sgt, void *cpu_addr, dma_addr_t addr, size_t size, unsigned long attrs) { return <API key>(to_vmd_dev(dev), sgt, cpu_addr, addr, size, attrs); } static dma_addr_t vmd_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction dir, unsigned long attrs) { return dma_map_page_attrs(to_vmd_dev(dev), page, offset, size, dir, attrs); } static void vmd_unmap_page(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir, unsigned long attrs) { <API key>(to_vmd_dev(dev), addr, size, dir, attrs); } static int vmd_map_sg(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction dir, unsigned long attrs) { return dma_map_sg_attrs(to_vmd_dev(dev), sg, nents, dir, attrs); } static void vmd_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction dir, unsigned long attrs) { dma_unmap_sg_attrs(to_vmd_dev(dev), sg, nents, dir, attrs); } static void <API key>(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir) { <API key>(to_vmd_dev(dev), addr, size, dir); } static void <API key>(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir) { <API key>(to_vmd_dev(dev), addr, size, dir); } static void vmd_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction dir) { dma_sync_sg_for_cpu(to_vmd_dev(dev), sg, nents, dir); } static void <API key>(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction dir) { <API key>(to_vmd_dev(dev), sg, nents, dir); } static int vmd_dma_supported(struct device *dev, u64 mask) { return dma_supported(to_vmd_dev(dev), mask); } static u64 <API key>(struct device *dev) { return <API key>(to_vmd_dev(dev)); } static void <API key>(struct vmd_dev *vmd) { struct dma_domain *domain = &vmd->dma_domain; if (get_dma_ops(&vmd->dev->dev)) del_dma_domain(domain); } #define ASSIGN_VMD_DMA_OPS(source, dest, fn) \ do { \ if (source->fn) \ dest->fn = vmd_ } while (0) static void vmd_setup_dma_ops(struct vmd_dev *vmd) { const struct dma_map_ops *source = get_dma_ops(&vmd->dev->dev); struct dma_map_ops *dest = &vmd->dma_ops; struct dma_domain *domain = &vmd->dma_domain; domain->domain_nr = vmd->sysdata.domain; domain->dma_ops = dest; if (!source) return; ASSIGN_VMD_DMA_OPS(source, dest, alloc); ASSIGN_VMD_DMA_OPS(source, dest, free); ASSIGN_VMD_DMA_OPS(source, dest, mmap); ASSIGN_VMD_DMA_OPS(source, dest, get_sgtable); ASSIGN_VMD_DMA_OPS(source, dest, map_page); ASSIGN_VMD_DMA_OPS(source, dest, unmap_page); ASSIGN_VMD_DMA_OPS(source, dest, map_sg); ASSIGN_VMD_DMA_OPS(source, dest, unmap_sg); ASSIGN_VMD_DMA_OPS(source, dest, sync_single_for_cpu); ASSIGN_VMD_DMA_OPS(source, dest, <API key>); ASSIGN_VMD_DMA_OPS(source, dest, sync_sg_for_cpu); ASSIGN_VMD_DMA_OPS(source, dest, sync_sg_for_device); ASSIGN_VMD_DMA_OPS(source, dest, dma_supported); ASSIGN_VMD_DMA_OPS(source, dest, get_required_mask); add_dma_domain(domain); } #undef ASSIGN_VMD_DMA_OPS static char __iomem *vmd_cfg_addr(struct vmd_dev *vmd, struct pci_bus *bus, unsigned int devfn, int reg, int len) { char __iomem *addr = vmd->cfgbar + ((bus->number - vmd->busn_start) << 20) + (devfn << 12) + reg; if ((addr - vmd->cfgbar) + len >= resource_size(&vmd->dev->resource[VMD_CFGBAR])) return NULL; return addr; } /* * CPU may deadlock if config space is not serialized on some versions of this * hardware, so all config space access is done under a spinlock. */ static int vmd_pci_read(struct pci_bus *bus, unsigned int devfn, int reg, int len, u32 *value) { struct vmd_dev *vmd = vmd_from_bus(bus); char __iomem *addr = vmd_cfg_addr(vmd, bus, devfn, reg, len); unsigned long flags; int ret = 0; if (!addr) return -EFAULT; spin_lock_irqsave(&vmd->cfg_lock, flags); switch (len) { case 1: *value = readb(addr); break; case 2: *value = readw(addr); break; case 4: *value = readl(addr); break; default: ret = -EINVAL; break; } <API key>(&vmd->cfg_lock, flags); return ret; } /* * VMD h/w converts non-posted config writes to posted memory writes. The * read-back in this function forces the completion so it returns only after * the config space was written, as expected. */ static int vmd_pci_write(struct pci_bus *bus, unsigned int devfn, int reg, int len, u32 value) { struct vmd_dev *vmd = vmd_from_bus(bus); char __iomem *addr = vmd_cfg_addr(vmd, bus, devfn, reg, len); unsigned long flags; int ret = 0; if (!addr) return -EFAULT; spin_lock_irqsave(&vmd->cfg_lock, flags); switch (len) { case 1: writeb(value, addr); readb(addr); break; case 2: writew(value, addr); readw(addr); break; case 4: writel(value, addr); readl(addr); break; default: ret = -EINVAL; break; } <API key>(&vmd->cfg_lock, flags); return ret; } static struct pci_ops vmd_ops = { .read = vmd_pci_read, .write = vmd_pci_write, }; static void <API key>(struct vmd_dev *vmd) { vmd->dev->resource[VMD_MEMBAR1].child = &vmd->resources[1]; vmd->dev->resource[VMD_MEMBAR2].child = &vmd->resources[2]; } static void <API key>(struct vmd_dev *vmd) { vmd->dev->resource[VMD_MEMBAR1].child = NULL; vmd->dev->resource[VMD_MEMBAR2].child = NULL; } /* * VMD domains start at 0x10000 to not clash with ACPI _SEG domains. * Per ACPI r6.0, sec 6.5.6, _SEG returns an integer, of which the lower * 16 bits are the PCI Segment Group (domain) number. Other bits are * currently reserved. */ static int <API key>(void) { int domain = 0xffff; struct pci_bus *bus = NULL; while ((bus = pci_find_next_bus(bus)) != NULL) domain = max_t(int, domain, pci_domain_nr(bus)); return domain + 1; } static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) { struct pci_sysdata *sd = &vmd->sysdata; struct fwnode_handle *fn; struct resource *res; u32 upper_bits; unsigned long flags; LIST_HEAD(resources); resource_size_t offset[2] = {0}; resource_size_t membar2_offset = 0x2000; struct pci_bus *child; /* * Shadow registers may exist in certain VMD device ids which allow * guests to correctly assign host physical addresses to the root ports * and child devices. These registers will either return the host value * or 0, depending on an enable bit in the VMD device. */ if (features & <API key>) { u32 vmlock; int ret; membar2_offset = MB2_SHADOW_OFFSET + MB2_SHADOW_SIZE; ret = <API key>(vmd->dev, PCI_REG_VMLOCK, &vmlock); if (ret || vmlock == ~0) return -ENODEV; if (MB2_SHADOW_EN(vmlock)) { void __iomem *membar2; membar2 = pci_iomap(vmd->dev, VMD_MEMBAR2, 0); if (!membar2) return -ENOMEM; offset[0] = vmd->dev->resource[VMD_MEMBAR1].start - readq(membar2 + MB2_SHADOW_OFFSET); offset[1] = vmd->dev->resource[VMD_MEMBAR2].start - readq(membar2 + MB2_SHADOW_OFFSET + 8); pci_iounmap(vmd->dev, membar2); } } /* * Certain VMD devices may have a root port configuration option which * limits the bus range to between 0-127 or 128-255 */ if (features & <API key>) { u32 vmcap, vmconfig; <API key>(vmd->dev, PCI_REG_VMCAP, &vmcap); <API key>(vmd->dev, PCI_REG_VMCONFIG, &vmconfig); if (BUS_RESTRICT_CAP(vmcap) && (BUS_RESTRICT_CFG(vmconfig) == 0x1)) vmd->busn_start = 128; } res = &vmd->dev->resource[VMD_CFGBAR]; vmd->resources[0] = (struct resource) { .name = "VMD CFGBAR", .start = vmd->busn_start, .end = vmd->busn_start + (resource_size(res) >> 20) - 1, .flags = IORESOURCE_BUS | <API key>, }; /* * If the window is below 4GB, clear IORESOURCE_MEM_64 so we can * put 32-bit resources in the window. * * There's no hardware reason why a 64-bit window *couldn't* * contain a 32-bit resource, but pbus_size_mem() computes the * bridge window size assuming a 64-bit window will contain no * 32-bit resources. <API key>() enforces that * artificial restriction to make sure everything will fit. * * The only way we could use a 64-bit non-prefetchable MEMBAR is * if its address is <4GB so that we can convert it to a 32-bit * resource. To be visible to the host OS, all VMD endpoints must * be initially configured by platform BIOS, which includes setting * up these resources. We can assume the device is configured * according to the platform needs. */ res = &vmd->dev->resource[VMD_MEMBAR1]; upper_bits = upper_32_bits(res->end); flags = res->flags & ~<API key>; if (!upper_bits) flags &= ~IORESOURCE_MEM_64; vmd->resources[1] = (struct resource) { .name = "VMD MEMBAR1", .start = res->start, .end = res->end, .flags = flags, .parent = res, }; res = &vmd->dev->resource[VMD_MEMBAR2]; upper_bits = upper_32_bits(res->end); flags = res->flags & ~<API key>; if (!upper_bits) flags &= ~IORESOURCE_MEM_64; vmd->resources[2] = (struct resource) { .name = "VMD MEMBAR2", .start = res->start + membar2_offset, .end = res->end, .flags = flags, .parent = res, }; sd->vmd_domain = true; sd->domain = <API key>(); if (sd->domain < 0) return sd->domain; sd->node = pcibus_to_node(vmd->dev->bus); fn = <API key>("VMD-MSI", vmd->sysdata.domain); if (!fn) return -ENODEV; vmd->irq_domain = <API key>(fn, &vmd_msi_domain_info, x86_vector_domain); <API key>(fn); if (!vmd->irq_domain) return -ENODEV; pci_add_resource(&resources, &vmd->resources[0]); <API key>(&resources, &vmd->resources[1], offset[0]); <API key>(&resources, &vmd->resources[2], offset[1]); vmd->bus = pci_create_root_bus(&vmd->dev->dev, vmd->busn_start, &vmd_ops, sd, &resources); if (!vmd->bus) { <API key>(&resources); irq_domain_remove(vmd->irq_domain); return -ENODEV; } <API key>(vmd); vmd_setup_dma_ops(vmd); dev_set_msi_domain(&vmd->bus->dev, vmd->irq_domain); pci_scan_child_bus(vmd->bus); <API key>(vmd->bus); /* * VMD root buses are virtual and don't return true on pci_is_pcie() * and will fail <API key>() early. It can instead be * run on each of the real root ports. */ list_for_each_entry(child, &vmd->bus->children, node) <API key>(child); pci_bus_add_devices(vmd->bus); WARN(sysfs_create_link(&vmd->dev->dev.kobj, &vmd->bus->dev.kobj, "domain"), "Can't create symlink to domain\n"); return 0; } static irqreturn_t vmd_irq(int irq, void *data) { struct vmd_irq_list *irqs = data; struct vmd_irq *vmdirq; int idx; idx = srcu_read_lock(&irqs->srcu); <API key>(vmdirq, &irqs->irq_list, node) generic_handle_irq(vmdirq->virq); srcu_read_unlock(&irqs->srcu, idx); return IRQ_HANDLED; } static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id) { struct vmd_dev *vmd; int i, err; if (resource_size(&dev->resource[VMD_CFGBAR]) < (1 << 20)) return -ENOMEM; vmd = devm_kzalloc(&dev->dev, sizeof(*vmd), GFP_KERNEL); if (!vmd) return -ENOMEM; vmd->dev = dev; err = pcim_enable_device(dev); if (err < 0) return err; vmd->cfgbar = pcim_iomap(dev, VMD_CFGBAR, 0); if (!vmd->cfgbar) return -ENOMEM; pci_set_master(dev); if (<API key>(&dev->dev, DMA_BIT_MASK(64)) && <API key>(&dev->dev, DMA_BIT_MASK(32))) return -ENODEV; vmd->msix_count = pci_msix_vec_count(dev); if (vmd->msix_count < 0) return -ENODEV; vmd->msix_count = <API key>(dev, 1, vmd->msix_count, PCI_IRQ_MSIX); if (vmd->msix_count < 0) return vmd->msix_count; vmd->irqs = devm_kcalloc(&dev->dev, vmd->msix_count, sizeof(*vmd->irqs), GFP_KERNEL); if (!vmd->irqs) return -ENOMEM; for (i = 0; i < vmd->msix_count; i++) { err = init_srcu_struct(&vmd->irqs[i].srcu); if (err) return err; INIT_LIST_HEAD(&vmd->irqs[i].irq_list); err = devm_request_irq(&dev->dev, pci_irq_vector(dev, i), vmd_irq, IRQF_NO_THREAD, "vmd", &vmd->irqs[i]); if (err) return err; } spin_lock_init(&vmd->cfg_lock); pci_set_drvdata(dev, vmd); err = vmd_enable_domain(vmd, (unsigned long) id->driver_data); if (err) return err; dev_info(&vmd->dev->dev, "Bound to PCI domain %04x\n", vmd->sysdata.domain); return 0; } static void vmd_cleanup_srcu(struct vmd_dev *vmd) { int i; for (i = 0; i < vmd->msix_count; i++) cleanup_srcu_struct(&vmd->irqs[i].srcu); } static void vmd_remove(struct pci_dev *dev) { struct vmd_dev *vmd = pci_get_drvdata(dev); sysfs_remove_link(&vmd->dev->dev.kobj, "domain"); pci_stop_root_bus(vmd->bus); pci_remove_root_bus(vmd->bus); vmd_cleanup_srcu(vmd); <API key>(vmd); <API key>(vmd); irq_domain_remove(vmd->irq_domain); } #ifdef CONFIG_PM_SLEEP static int vmd_suspend(struct device *dev) { struct pci_dev *pdev = to_pci_dev(dev); struct vmd_dev *vmd = pci_get_drvdata(pdev); int i; for (i = 0; i < vmd->msix_count; i++) devm_free_irq(dev, pci_irq_vector(pdev, i), &vmd->irqs[i]); pci_save_state(pdev); return 0; } static int vmd_resume(struct device *dev) { struct pci_dev *pdev = to_pci_dev(dev); struct vmd_dev *vmd = pci_get_drvdata(pdev); int err, i; for (i = 0; i < vmd->msix_count; i++) { err = devm_request_irq(dev, pci_irq_vector(pdev, i), vmd_irq, IRQF_NO_THREAD, "vmd", &vmd->irqs[i]); if (err) return err; } pci_restore_state(pdev); return 0; } #endif static SIMPLE_DEV_PM_OPS(vmd_dev_pm_ops, vmd_suspend, vmd_resume); static const struct pci_device_id vmd_ids[] = { {PCI_DEVICE(PCI_VENDOR_ID_INTEL, <API key>),}, {PCI_DEVICE(PCI_VENDOR_ID_INTEL, <API key>), .driver_data = <API key> | <API key>,}, {0,} }; MODULE_DEVICE_TABLE(pci, vmd_ids); static struct pci_driver vmd_drv = { .name = "vmd", .id_table = vmd_ids, .probe = vmd_probe, .remove = vmd_remove, .driver = { .pm = &vmd_dev_pm_ops, }, }; module_pci_driver(vmd_drv); MODULE_AUTHOR("Intel Corporation"); MODULE_LICENSE("GPL v2"); MODULE_VERSION("0.6");
import os, sys; sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..")) import codecs from pattern.vector import Document, PORTER, LEMMA # A Document is a "bag-of-words" that splits a string into words and counts them. # A list of words or dictionary of (word, count)-items can also be given. # Words (or more generally "features") and their word count ("feature weights") # can be used to compare documents. The word count in a document is normalized # between 0.0-1.0 so that shorted documents can be compared to longer documents. # Words can be stemmed or lemmatized before counting them. # The purpose of stemming is to bring variant forms a word together. # For example, "conspiracy" and "conspired" are both stemmed to "conspir". # Nowadays, lemmatization is usually preferred over stemming, # e.g., "conspiracies" => "conspiracy", "conspired" => "conspire". s = """ The shuttle Discovery, already delayed three times by technical problems and bad weather, was grounded again Friday, this time by a potentially dangerous gaseous hydrogen leak in a vent line attached to the ship's external tank. The Discovery was initially scheduled to make its 39th and final flight last Monday, bearing fresh supplies and an intelligent robot for the International Space Station. But complications delayed the flight from Monday to Friday, when the hydrogen leak led NASA to conclude that the shuttle would not be ready to launch before its flight window closed this Monday. """ # With threshold=1, only words that occur more than once are counted. # With stopwords=False, words like "the", "and", "I", "is" are ignored. document = Document(s, threshold=1, stopwords=False) print document.words print # The /corpus folder contains texts mined from Wikipedia. # Below is the mining script (we already executed it for you): #import os, codecs #from pattern.web import Wikipedia #w = Wikipedia() #for q in ( # "badger", "bear", "dog", "dolphin", "lion", "parakeet", # "rabbit", "shark", "sparrow", "tiger", "wolf"): # s = w.search(q, cached=True) # s = s.plaintext() # print os.path.join("corpus2", q+".txt") # f = codecs.open(os.path.join("corpus2", q+".txt"), "w", encoding="utf-8") # f.write(s) # f.close() # Loading a document from a text file: f = os.path.join(os.path.dirname(__file__), "corpus", "wolf.txt") s = codecs.open(f, encoding="utf-8").read() document = Document(s, name="wolf", stemmer=PORTER) print document print document.keywords(top=10) # (weight, feature)-items. print # Same document, using lemmatization instead of stemming (slower): document = Document(s, name="wolf", stemmer=LEMMA) print document print document.keywords(top=10) print # In summary, a document is a bag-of-words representation of a text. # Bag-of-words means that the word order is discarded. # The dictionary of words (features) and their normalized word count (weights) # is also called the document vector: document = Document("a black cat and a white cat", stopwords=True) print document.words print document.vector.features for feature, weight in document.vector.items(): print feature, weight # Document vectors can be bundled into a Model (next example).
#include "sam_header.h" #include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> #include <stdarg.h> #include "htslib/khash.h" KHASH_MAP_INIT_STR(str, const char *) struct _HeaderList { struct _HeaderList *last; // Hack: Used and maintained only by list_append_to_end. Maintained in the root node only. struct _HeaderList *next; void *data; }; typedef struct _HeaderList list_t; typedef list_t HeaderDict; typedef struct { char key[2]; char *value; } HeaderTag; typedef struct { char type[2]; list_t *tags; } HeaderLine; const char *o_hd_tags[] = {"SO","GO",NULL}; const char *r_hd_tags[] = {"VN",NULL}; const char *o_sq_tags[] = {"AS","M5","UR","SP",NULL}; const char *r_sq_tags[] = {"SN","LN",NULL}; const char *u_sq_tags[] = {"SN",NULL}; const char *o_rg_tags[] = {"CN","DS","DT","FO","KS","LB","PG","PI","PL","PU","SM",NULL}; const char *r_rg_tags[] = {"ID",NULL}; const char *u_rg_tags[] = {"ID",NULL}; const char *o_pg_tags[] = {"VN","CL",NULL}; const char *r_pg_tags[] = {"ID",NULL}; const char *types[] = {"HD","SQ","RG","PG","CO",NULL}; const char **optional_tags[] = {o_hd_tags,o_sq_tags,o_rg_tags,o_pg_tags,NULL,NULL}; const char **required_tags[] = {r_hd_tags,r_sq_tags,r_rg_tags,r_pg_tags,NULL,NULL}; const char **unique_tags[] = {NULL, u_sq_tags,u_rg_tags,NULL,NULL,NULL}; static void debug(const char *format, ...) { va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); } #if 0 // Replaced by list_append_to_end static list_t *list_prepend(list_t *root, void *data) { list_t *l = malloc(sizeof(list_t)); l->next = root; l->data = data; return l; } #endif // Relies on the root->last being correct. Do not use with the other list_* // routines unless they are fixed to modify root->last as well. static list_t *list_append_to_end(list_t *root, void *data) { list_t *l = malloc(sizeof(list_t)); l->last = l; l->next = NULL; l->data = data; if ( !root ) return l; root->last->next = l; root->last = l; return root; } static list_t *list_append(list_t *root, void *data) { list_t *l = root; while (l && l->next) l = l->next; if ( l ) { l->next = malloc(sizeof(list_t)); l = l->next; } else { l = malloc(sizeof(list_t)); root = l; } l->data = data; l->next = NULL; return root; } static void list_free(list_t *root) { list_t *l = root; while (root) { l = root; root = root->next; free(l); } } // Look for a tag "XY" in a predefined const char *[] array. static int tag_exists(const char *tag, const char **tags) { int itag=0; if ( !tags ) return -1; while ( tags[itag] ) { if ( tags[itag][0]==tag[0] && tags[itag][1]==tag[1] ) return itag; itag++; } return -1; } // Mimics the behaviour of getline, except it returns pointer to the next chunk of the text // or NULL if everything has been read. The lineptr should be freed by the caller. The // newline character is stripped. static const char *nextline(char **lineptr, size_t *n, const char *text) { int len; const char *to = text; if ( !*to ) return NULL; while ( *to && *to!='\n' && *to!='\r' ) to++; len = to - text + 1; if ( *to ) { // Advance the pointer for the next call if ( *to=='\n' ) to++; else if ( *to=='\r' && *(to+1)=='\n' ) to+=2; } if ( !len ) return to; if ( !*lineptr ) { *lineptr = malloc(len); *n = len; } else if ( *n<len ) { *lineptr = realloc(*lineptr, len); *n = len; } if ( !*lineptr ) { debug("[nextline] Insufficient memory!\n"); return 0; } memcpy(*lineptr,text,len); (*lineptr)[len-1] = 0; return to; } // name points to "XY", value_from points to the first character of the value string and // value_to points to the last character of the value string. static HeaderTag *new_tag(const char *name, const char *value_from, const char *value_to) { HeaderTag *tag = malloc(sizeof(HeaderTag)); int len = value_to-value_from+1; tag->key[0] = name[0]; tag->key[1] = name[1]; tag->value = malloc(len+1); memcpy(tag->value,value_from,len+1); tag->value[len] = 0; return tag; } static HeaderTag *header_line_has_tag(HeaderLine *hline, const char *key) { list_t *tags = hline->tags; while (tags) { HeaderTag *tag = tags->data; if ( tag->key[0]==key[0] && tag->key[1]==key[1] ) return tag; tags = tags->next; } return NULL; } // Return codes: // 0 .. different types or unique tags differ or conflicting tags, cannot be merged // 1 .. all tags identical -> no need to merge, drop one // 2 .. the unique tags match and there are some conflicting tags (same tag, different value) -> error, cannot be merged nor duplicated // 3 .. there are some missing complementary tags and no unique conflict -> can be merged into a single line static int <API key>(HeaderLine *hline1, HeaderLine *hline2) { HeaderTag *t1, *t2; if ( hline1->type[0]!=hline2->type[0] || hline1->type[1]!=hline2->type[1] ) return 0; int itype = tag_exists(hline1->type,types); if ( itype==-1 ) { debug("[<API key>] Unknown type [%c%c]\n", hline1->type[0],hline1->type[1]); return -1; // FIXME (lh3): error; I do not know how this will be handled in Petr's code } if ( unique_tags[itype] ) { t1 = header_line_has_tag(hline1,unique_tags[itype][0]); t2 = header_line_has_tag(hline2,unique_tags[itype][0]); if ( !t1 || !t2 ) // this should never happen, the unique tags are required return 2; if ( strcmp(t1->value,t2->value) ) return 0; // the unique tags differ, cannot be merged } if ( !required_tags[itype] && !optional_tags[itype] ) { t1 = hline1->tags->data; t2 = hline2->tags->data; if ( !strcmp(t1->value,t2->value) ) return 1; // identical comments return 0; } int missing=0, itag=0; while ( required_tags[itype] && required_tags[itype][itag] ) { t1 = header_line_has_tag(hline1,required_tags[itype][itag]); t2 = header_line_has_tag(hline2,required_tags[itype][itag]); if ( !t1 && !t2 ) return 2; // this should never happen else if ( !t1 || !t2 ) missing = 1; // there is some tag missing in one of the hlines else if ( strcmp(t1->value,t2->value) ) { if ( unique_tags[itype] ) return 2; // the lines have a matching unique tag but have a conflicting tag return 0; // the lines contain conflicting tags, cannot be merged } itag++; } itag = 0; while ( optional_tags[itype] && optional_tags[itype][itag] ) { t1 = header_line_has_tag(hline1,optional_tags[itype][itag]); t2 = header_line_has_tag(hline2,optional_tags[itype][itag]); if ( !t1 && !t2 ) { itag++; continue; } if ( !t1 || !t2 ) missing = 1; // there is some tag missing in one of the hlines else if ( strcmp(t1->value,t2->value) ) { if ( unique_tags[itype] ) return 2; // the lines have a matching unique tag but have a conflicting tag return 0; // the lines contain conflicting tags, cannot be merged } itag++; } if ( missing ) return 3; // there are some missing complementary tags with no conflicts, can be merged return 1; } static HeaderLine *<API key>(const HeaderLine *hline) { list_t *tags; HeaderLine *out = malloc(sizeof(HeaderLine)); out->type[0] = hline->type[0]; out->type[1] = hline->type[1]; out->tags = NULL; tags = hline->tags; while (tags) { HeaderTag *old = tags->data; HeaderTag *new = malloc(sizeof(HeaderTag)); new->key[0] = old->key[0]; new->key[1] = old->key[1]; new->value = strdup(old->value); out->tags = list_append(out->tags, new); tags = tags->next; } return out; } static int <API key>(HeaderLine *out_hline, const HeaderLine *tmpl_hline) { list_t *tmpl_tags; if ( out_hline->type[0]!=tmpl_hline->type[0] || out_hline->type[1]!=tmpl_hline->type[1] ) return 0; tmpl_tags = tmpl_hline->tags; while (tmpl_tags) { HeaderTag *tmpl_tag = tmpl_tags->data; HeaderTag *out_tag = header_line_has_tag(out_hline, tmpl_tag->key); if ( !out_tag ) { HeaderTag *tag = malloc(sizeof(HeaderTag)); tag->key[0] = tmpl_tag->key[0]; tag->key[1] = tmpl_tag->key[1]; tag->value = strdup(tmpl_tag->value); out_hline->tags = list_append(out_hline->tags,tag); } tmpl_tags = tmpl_tags->next; } return 1; } static HeaderLine *<API key>(const char *headerLine) { HeaderLine *hline; HeaderTag *tag; const char *from, *to; from = headerLine; if ( *from != '@' ) { debug("[<API key>] expected '@', got [%s]\n", headerLine); return 0; } to = ++from; while (*to && *to!='\t') to++; if ( to-from != 2 ) { debug("[<API key>] expected '@XY', got [%s]\nHint: The header tags must be tab-separated.\n", headerLine); return 0; } hline = malloc(sizeof(HeaderLine)); hline->type[0] = from[0]; hline->type[1] = from[1]; hline->tags = NULL; int itype = tag_exists(hline->type, types); from = to; while (*to && *to=='\t') to++; if ( to-from != 1 ) { debug("[<API key>] multiple tabs on line [%s] (%d)\n", headerLine,(int)(to-from)); free(hline); return 0; } from = to; while (*from) { while (*to && *to!='\t') to++; if ( !required_tags[itype] && !optional_tags[itype] ) { // CO is a special case, it can contain anything, including tabs if ( *to ) { to++; continue; } tag = new_tag(" ",from,to-1); } else tag = new_tag(from,from+3,to-1); if ( header_line_has_tag(hline,tag->key) ) debug("The tag '%c%c' present (at least) twice on line [%s]\n", tag->key[0],tag->key[1], headerLine); hline->tags = list_append(hline->tags, tag); from = to; while (*to && *to=='\t') to++; if ( *to && to-from != 1 ) { debug("[<API key>] multiple tabs on line [%s] (%d)\n", headerLine,(int)(to-from)); return 0; } from = to; } return hline; } // Must be of an existing type, all tags must be recognised and all required tags must be present static int <API key>(HeaderLine *hline) { list_t *tags; HeaderTag *tag; int itype, itag; // Is the type correct? itype = tag_exists(hline->type, types); if ( itype==-1 ) { debug("The type [%c%c] not recognised.\n", hline->type[0],hline->type[1]); return 0; } // Has all required tags? itag = 0; while ( required_tags[itype] && required_tags[itype][itag] ) { if ( !header_line_has_tag(hline,required_tags[itype][itag]) ) { debug("The tag [%c%c] required for [%c%c] not present.\n", required_tags[itype][itag][0],required_tags[itype][itag][1], hline->type[0],hline->type[1]); return 0; } itag++; } // Are all tags recognised? tags = hline->tags; while ( tags ) { tag = tags->data; if ( !tag_exists(tag->key,required_tags[itype]) && !tag_exists(tag->key,optional_tags[itype]) ) { // Lower case tags are user-defined values. if( !(islower(tag->key[0]) || islower(tag->key[1])) ) { // Neither is lower case, but tag was not recognized. debug("Unknown tag [%c%c] for [%c%c].\n", tag->key[0],tag->key[1], hline->type[0],hline->type[1]); // return 0; // Even unknown tags are allowed - for forward compatibility with new attributes } // else - allow user defined tag } tags = tags->next; } return 1; } static void print_header_line(FILE *fp, HeaderLine *hline) { list_t *tags = hline->tags; HeaderTag *tag; fprintf(fp, "@%c%c", hline->type[0],hline->type[1]); while (tags) { tag = tags->data; fprintf(fp, "\t"); if ( tag->key[0]!=' ' || tag->key[1]!=' ' ) fprintf(fp, "%c%c:", tag->key[0],tag->key[1]); fprintf(fp, "%s", tag->value); tags = tags->next; } fprintf(fp,"\n"); } static void <API key>(HeaderLine *hline) { list_t *tags = hline->tags; while (tags) { HeaderTag *tag = tags->data; free(tag->value); free(tag); tags = tags->next; } list_free(hline->tags); free(hline); } void sam_header_free(void *_header) { HeaderDict *header = (HeaderDict*)_header; list_t *hlines = header; while (hlines) { <API key>(hlines->data); hlines = hlines->next; } list_free(header); } HeaderDict *sam_header_clone(const HeaderDict *dict) { HeaderDict *out = NULL; while (dict) { HeaderLine *hline = dict->data; out = list_append(out, <API key>(hline)); dict = dict->next; } return out; } // Returns a newly allocated string char *sam_header_write(const void *_header) { const HeaderDict *header = (const HeaderDict*)_header; char *out = NULL; int len=0, nout=0; const list_t *hlines; // Calculate the length of the string to allocate hlines = header; while (hlines) { len += 4; // @XY and \n HeaderLine *hline = hlines->data; list_t *tags = hline->tags; while (tags) { HeaderTag *tag = tags->data; len += strlen(tag->value) + 1; if ( tag->key[0]!=' ' || tag->key[1]!=' ' ) len += strlen(tag->value) + 3; tags = tags->next; } hlines = hlines->next; } nout = 0; out = malloc(len+1); hlines = header; while (hlines) { HeaderLine *hline = hlines->data; nout += sprintf(out+nout,"@%c%c",hline->type[0],hline->type[1]); list_t *tags = hline->tags; while (tags) { HeaderTag *tag = tags->data; nout += sprintf(out+nout,"\t"); if ( tag->key[0]!=' ' || tag->key[1]!=' ' ) nout += sprintf(out+nout,"%c%c:", tag->key[0],tag->key[1]); nout += sprintf(out+nout,"%s", tag->value); tags = tags->next; } hlines = hlines->next; nout += sprintf(out+nout,"\n"); } out[len] = 0; return out; } void *sam_header_parse2(const char *headerText) { list_t *hlines = NULL; HeaderLine *hline; const char *text; char *buf=NULL; size_t nbuf = 0; int tovalidate = 0; if ( !headerText ) return 0; text = headerText; while ( (text=nextline(&buf, &nbuf, text)) ) { hline = <API key>(buf); if ( hline && (!tovalidate || <API key>(hline)) ) // With too many (~250,000) reference sequences the header parsing was too slow with list_append. hlines = list_append_to_end(hlines, hline); else { if (hline) <API key>(hline); sam_header_free(hlines); if ( buf ) free(buf); return NULL; } } if ( buf ) free(buf); return hlines; } void *sam_header2tbl(const void *_dict, char type[2], char key_tag[2], char value_tag[2]) { const HeaderDict *dict = (const HeaderDict*)_dict; const list_t *l = dict; khash_t(str) *tbl = kh_init(str); khiter_t k; int ret; if (_dict == 0) return tbl; // return an empty (not null) hash table while (l) { HeaderLine *hline = l->data; if ( hline->type[0]!=type[0] || hline->type[1]!=type[1] ) { l = l->next; continue; } HeaderTag *key, *value; key = header_line_has_tag(hline,key_tag); value = header_line_has_tag(hline,value_tag); if ( !key || !value ) { l = l->next; continue; } k = kh_get(str, tbl, key->value); if ( k != kh_end(tbl) ) debug("[<API key>] They key %s not unique.\n", key->value); k = kh_put(str, tbl, key->value, &ret); kh_value(tbl, k) = value->value; l = l->next; } return tbl; } char **sam_header2list(const void *_dict, char type[2], char key_tag[2], int *_n) { const HeaderDict *dict = (const HeaderDict*)_dict; const list_t *l = dict; int max, n; char **ret; ret = 0; *_n = max = n = 0; while (l) { HeaderLine *hline = l->data; if ( hline->type[0]!=type[0] || hline->type[1]!=type[1] ) { l = l->next; continue; } HeaderTag *key; key = header_line_has_tag(hline,key_tag); if ( !key ) { l = l->next; continue; } if (n == max) { max = max? max<<1 : 4; ret = realloc(ret, max * sizeof(char*)); } ret[n++] = key->value; l = l->next; } *_n = n; return ret; } void *sam_header2key_val(void *iter, const char type[2], const char key_tag[2], const char value_tag[2], const char **_key, const char **_value) { list_t *l = iter; if ( !l ) return NULL; while (l) { HeaderLine *hline = l->data; if ( hline->type[0]!=type[0] || hline->type[1]!=type[1] ) { l = l->next; continue; } HeaderTag *key, *value; key = header_line_has_tag(hline,key_tag); value = header_line_has_tag(hline,value_tag); if ( !key && !value ) { l = l->next; continue; } *_key = key->value; *_value = value->value; return l->next; } return l; } const char *sam_tbl_get(void *h, const char *key) { khash_t(str) *tbl = (khash_t(str)*)h; khint_t k; k = kh_get(str, tbl, key); return k == kh_end(tbl)? 0 : kh_val(tbl, k); } int sam_tbl_size(void *h) { khash_t(str) *tbl = (khash_t(str)*)h; return h? kh_size(tbl) : 0; } void sam_tbl_destroy(void *h) { khash_t(str) *tbl = (khash_t(str)*)h; kh_destroy(str, tbl); } void *sam_header_merge(int n, const void **_dicts) { const HeaderDict **dicts = (const HeaderDict**)_dicts; HeaderDict *out_dict; int idict, status; if ( n<2 ) return NULL; out_dict = sam_header_clone(dicts[0]); for (idict=1; idict<n; idict++) { const list_t *tmpl_hlines = dicts[idict]; while ( tmpl_hlines ) { list_t *out_hlines = out_dict; int inserted = 0; while ( out_hlines ) { status = <API key>(tmpl_hlines->data, out_hlines->data); if ( status==0 ) { out_hlines = out_hlines->next; continue; } if ( status==2 ) { print_header_line(stderr,tmpl_hlines->data); print_header_line(stderr,out_hlines->data); debug("Conflicting lines, cannot merge the headers.\n"); return 0; } if ( status==3 ) <API key>(out_hlines->data, tmpl_hlines->data); inserted = 1; break; } if ( !inserted ) out_dict = list_append(out_dict, <API key>(tmpl_hlines->data)); tmpl_hlines = tmpl_hlines->next; } } return out_dict; } char **sam_header2tbl_n(const void *dict, const char type[2], const char *tags[], int *n) { int nout = 0; char **out = NULL; *n = 0; list_t *l = (list_t *)dict; if ( !l ) return NULL; int i, ntags = 0; while ( tags[ntags] ) ntags++; while (l) { HeaderLine *hline = l->data; if ( hline->type[0]!=type[0] || hline->type[1]!=type[1] ) { l = l->next; continue; } out = (char**) realloc(out, sizeof(char*)*(nout+1)*ntags); for (i=0; i<ntags; i++) { HeaderTag *key = header_line_has_tag(hline, tags[i]); if ( !key ) { out[nout*ntags+i] = NULL; continue; } out[nout*ntags+i] = key->value; } nout++; l = l->next; } *n = nout; return out; }
var mv_dynamic_to_top;(function($,mv_dynamic_to_top){jQuery.fn.DynamicToTop=function(options){var defaults={text:mv_dynamic_to_top.text,min:parseInt(mv_dynamic_to_top.min,10),fade_in:600,fade_out:400,speed:parseInt(mv_dynamic_to_top.speed,10),easing:mv_dynamic_to_top.easing,version:mv_dynamic_to_top.version,id:'dynamic-to-top'},settings=$.extend(defaults,options);if(settings.version===""||settings.version==='0'){settings.text='<span>&nbsp;</span>';} if(!$.isFunction(settings.easing)){settings.easing='linear';} var $toTop=$('<a href=\" if(sd>settings.min){$toTop.fadeIn(settings.fade_in);}else{$toTop.fadeOut(settings.fade_out);}});};$('body').DynamicToTop();})(jQuery,mv_dynamic_to_top);
#include "config.h" #include <epan/packet.h> #include <epan/asn1.h> #include "packet-ber.h" #include "packet-smrse.h" #define PNAME "Short Message Relaying Service" #define PSNAME "SMRSE" #define PFNAME "smrse" #define TCP_PORT_SMRSE 4321 void <API key>(void); void <API key>(void); /* Initialize the protocol and registered fields */ static int proto_smrse = -1; static int hf_smrse_reserved = -1; static int hf_smrse_tag = -1; static int hf_smrse_length = -1; static int <API key> = -1; #include "packet-smrse-hf.c" /* Initialize the subtree pointers */ static gint ett_smrse = -1; #include "packet-smrse-ett.c" #include "packet-smrse-fn.c" static const value_string tag_vals[] = { { 1, "AliveTest" }, { 2, "AliveTestRsp" }, { 3, "Bind" }, { 4, "BindRsp" }, { 5, "BindFail" }, { 6, "Unbind" }, { 7, "MT" }, { 8, "MO" }, { 9, "Ack" }, { 10, "Error" }, { 11, "Alert" }, { 0, NULL } }; static int dissect_smrse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data _U_) { proto_item *item = NULL; proto_tree *tree = NULL; guint8 reserved, tag; int offset=0; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); reserved=tvb_get_guint8(tvb, 0); tag=tvb_get_guint8(tvb, 3); if( reserved!= 126 ) return 0; if( (tag<1)||(tag>11) ) return 0; if(parent_tree){ item = proto_tree_add_item(parent_tree, proto_smrse, tvb, 0, -1, ENC_NA); tree = <API key>(item, ett_smrse); } col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMRSE"); col_add_str(pinfo->cinfo, COL_INFO, val_to_str(tag, tag_vals,"Unknown Tag:0x%02x")); proto_tree_add_item(tree, hf_smrse_reserved, tvb, 0, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_smrse_length, tvb, 1, 2, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_smrse_tag, tvb, 3, 1, ENC_BIG_ENDIAN); switch(tag){ case 1: case 2: offset=4; break; case 3: offset=<API key>(FALSE, tvb, 4, &asn1_ctx, tree, -1); break; case 4: offset=<API key>(FALSE, tvb, 4, &asn1_ctx, tree, -1); break; case 5: offset=<API key>(FALSE, tvb, 4, &asn1_ctx, tree, -1); break; case 6: offset=<API key>(FALSE, tvb, 4, &asn1_ctx, tree, -1); break; case 7: offset=<API key>(FALSE, tvb, 4, &asn1_ctx, tree, -1); break; case 8: offset=<API key>(FALSE, tvb, 4, &asn1_ctx, tree, -1); break; case 9: offset=dissect_smrse_RPAck(FALSE, tvb, 4, &asn1_ctx, tree, -1); break; case 10: offset=<API key>(FALSE, tvb, 4, &asn1_ctx, tree, -1); break; case 11: offset=<API key>(FALSE, tvb, 4, &asn1_ctx, tree, -1); break; } return offset; } void <API key>(void) { /* List of fields */ static hf_register_info hf[] = { { &hf_smrse_reserved, { "Reserved", "smrse.reserved", FT_UINT8, BASE_DEC, NULL, 0, "Reserved byte, must be 126", HFILL }}, { &hf_smrse_tag, { "Tag", "smrse.tag", FT_UINT8, BASE_DEC, VALS(tag_vals), 0, NULL, HFILL }}, { &hf_smrse_length, { "Length", "smrse.length", FT_UINT16, BASE_DEC, NULL, 0, "Length of SMRSE PDU", HFILL }}, { &<API key>, { "octet-Format", "smrse.octet_Format", FT_STRING, BASE_NONE, NULL, 0, "SMS-Address/address-value/octet-format", HFILL }}, #include "packet-smrse-hfarr.c" }; /* List of subtrees */ static gint *ett[] = { &ett_smrse, #include "packet-smrse-ettarr.c" }; /* Register protocol */ proto_smrse = <API key>(PNAME, PSNAME, PFNAME); /* Register fields and subtrees */ <API key>(proto_smrse, hf, array_length(hf)); <API key>(ett, array_length(ett)); } void <API key>(void) { dissector_handle_t smrse_handle; smrse_handle = <API key>(dissect_smrse, proto_smrse); dissector_add_uint("tcp.port",TCP_PORT_SMRSE, smrse_handle); }
// Use of this source code is governed by a BSD-style // +build irix package syscall //sysnb raw_ptrace(request int, pid int, addr *byte, data *byte) (err Errno) //ptrace(request _C_int, pid Pid_t, addr *byte, data *byte) _C_long
#if !defined(_FXFT_VERSION_) || _FXFT_VERSION_ == 2501 /* truetype.c */ /* FreeType TrueType driver component (body only). */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* understand and accept it fully. */ #define <API key> #define FT2_BUILD_LIBRARY #include "../../include/ft2build.h" #include "ttpic.c" #include "ttdriver.c" /* driver interface */ #include "ttpload.c" /* tables loader */ #include "ttgload.c" /* glyph loader */ #include "ttobjs.c" /* object manager */ #ifdef <API key> #include "ttinterp.c" #include "ttsubpix.c" #endif #ifdef <API key> #include "ttgxvar.c" /* gx distortable font */ #endif /* END */ #endif
html, body { margin:0; padding: 0; font-family: "helvetica neue"; font-size: 14px; color: #666666; } #ubwidget { position: absolute; top: 0; bottom: 0; left: 0; right: 0; background: url("images/bg.png"); } .theme-pad #ubwidget { border-radius: 40px; border-width: 52px; -webkit-border-image: url("images/pad-bd.png") 52 repeat; -moz-border-image: url("images/pad-bd.png") 52 repeat; border-image: url("images/pad-bd.png") 52 repeat; } .theme-slate #ubwidget { border-radius: 44px; border-width: 52px; -webkit-border-image: url("images/slate-bd.png") 52 repeat; -moz-border-image: url("images/slate-bd.png") 52 repeat; border-image: url("images/slate-bd.png") 52 repeat; } #ubwidget > .wrapper { position: absolute; top: 0px; bottom: 0px; left: 0px; right: 0px; overflow: hidden; } .theme-slate #ubwidget > .wrapper, .theme-pad #ubwidget > .wrapper { position: absolute; top: -49px; bottom: -5px; left: -5px; right: -5px; overflow: hidden; } #toolbar { display: table; width: 100%; height: 44px; font-size: 24px; color: #FFCC99; padding:0 10px; } .theme-pad #toolbar, .theme-slate #toolbar { height: 38px; padding: 6px 0 0; } .theme-slate #toolbar { color: #7F613F; text-shadow: #FFDCA9 0 1px 0; } #toolbar > * { display: table-cell; height: 100%; vertical-align: middle; } #toolbar .actions { text-align: right; } #toolbar button, h1 { font-weight: normal; font-size: 24px; color: #FFCC99; margin: 0; } .theme-slate #toolbar button, .theme-slate h1 { color: #7F613F; text-shadow: #FFDCA9 0 1px 0; } #toolbar button { border: none; padding: none; outline: none; background: none; cursor: pointer; padding-left: 34px; margin-left: 10px; height: 32px; } #toolbar button span { display: block; line-height: 32px; } #toolbar button[role='edit'] { background: url("images/toolbar-edit.png") left top no-repeat; } #toolbar button[role='view'] { display: none; color: #FFF; background: url("images/toolbar-edit.png") left -32px no-repeat; } #toolbar button[role='reload'] { background: url("images/toolbar-reload.png") left top no-repeat; } #toolbar button[role='help'] { background: url("images/toolbar-help.png") left top no-repeat; display: none; } .hasHelp #toolbar button[role='help'] { display: inline-block; } .showHelp #toolbar button[role='help'] { color: #FFF; background-position: left -32px; } .theme-slate #toolbar button[role='edit'] { background-image: url("images/slate-toolbar-edit.png"); } .theme-slate #toolbar button[role='view'] { text-shadow: #7F613F 0 -1px 0; background: url("images/slate-toolbar-edit.png") left -32px no-repeat; } .theme-slate #toolbar button[role='reload'] { background-image: url("images/<API key>.png"); } .theme-slate #toolbar button[role='help'] { background-image: url("images/slate-toolbar-help.png"); } .showHelp.theme-slate #toolbar button[role='help'] { text-shadow: #7F613F 0 -1px 0; } .onEdit #toolbar button[role='view'] { display: inline-block; } .onEdit #toolbar button[role='edit'] { display: none; } #help { width: 300px; height: 400px; position: absolute; margin-top: 10px; right: 10px; z-index: 10000; display: none; } .showHelp #help { display: block; } #content { position: absolute; top: 44px; bottom: 0; overflow: auto; left: 0; right: 0; background-image: -moz-radial-gradient(center center, ellipse closest-side, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 100%); background-image: -<API key>(center center, ellipse closest-side, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 100%); background-image: -o-radial-gradient(center center, ellipse closest-side, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 100%); background-image: -ms-radial-gradient(center center, ellipse closest-side, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 100%); background-image: radial-gradient(center center, ellipse closest-side, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 100%); } #parameters { display:none; padding: 10px 20px; background: url("images/parameters-bg.png"); -<API key>: 4px 4px 0 0; -moz-border-radius: 4px 4px 0 0; -mz-border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0; } #parameters label { font-style: italic; } #parameters label > select, #parameters label > input{ margin-left: 10px; width: 80px; } #parameters > div.inline { display: inline-block; } #parameters > div.inline+div.inline { margin-left: 20px; } #parameters input[type=text], #parameters input[type=number] { height: 26px; border: 1px solid #BBB; background-color: #FFF; padding: 0 4px; -<API key>: 4px; -moz-border-radius: 4px; -ms-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: 0 1px 0 #FFF; -moz-box-shadow: 0 1px 0 #FFF; -ms-box-shadow: 0 1px 0 #FFF; box-shadow: 0 1px 0 #FFF; } #parameters input.tiny { width: 40px; } #parameters input.small { width: 80px; } #parameters input.medium { width: 120px; } #parameters input.long { width: 160px; } #scene { padding: 20px; } #scene > * { margin: 0 auto; } .onEdit #scene { } .onEdit #parameters { display: block; } /* .card-container { -webkit-perspective: 600px; width:100%; height: 100%; } .card { position: relative; width:100%; height: 100%; } .card > div { position: absolute; width:100%; height: 100%; -<API key>: preserve-3d; -webkit-transition: all .5s ease-in-out; -<API key>: hidden; } .card > div:first-child { -webkit-transform: rotateY( 0deg ); } .card > div:last-child { -webkit-transform: rotateY( -180deg ); } .card.flip > div:first-child { -webkit-transform: rotateY( 180deg ); } .card.flip > div:last-child { -webkit-transform: rotateY( 0deg ); } */
#nullable disable using System; using Microsoft.CodeAnalysis.ErrorReporting; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests { public class <API key> : TestBase { <summary> Test that throwing <API key> does NOT trigger FailFast </summary> [Fact] public void <API key>() { var finallyExecuted = false; void a() { try { throw new <API key>(); } finally { finallyExecuted = true; } } try { try { a(); } catch (Exception e) when (FatalError.<API key>(e)) { throw ExceptionUtilities.Unreachable; } Assert.True(false, "Should not get here because an exception should be thrown before this point."); } catch (<API key>) { Assert.True(finallyExecuted); return; } Assert.True(false, "Should have returned in the catch block before this point."); } } }
package create import ( "fmt" "io" "github.com/spf13/cobra" kapi "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/meta" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/runtime" "github.com/openshift/origin/pkg/client" "github.com/openshift/origin/pkg/cmd/util/clientcmd" deployapi "github.com/openshift/origin/pkg/deploy/api" ) const ( <API key> = "deploymentconfig" <API key> = ` Create a deployment config that uses a given image. Deployment configs define the template for a pod and manages deploying new images or configuration changes.` <API key> = ` # Create an nginx deployment config named my-nginx %[1]s my-nginx --image=nginx` ) type <API key> struct { DC *deployapi.DeploymentConfig Client client.<API key> Mapper meta.RESTMapper OutputFormat string Out io.Writer Printer ObjectPrinter } // <API key> is a macro command to create a new service account func <API key>(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { o := &<API key>{Out: out} cmd := &cobra.Command{ Use: name + " NAME --image=IMAGE -- [COMMAND] [args...]", Short: "Create deployment config with default options that uses a given image.", Long: <API key>, Example: fmt.Sprintf(<API key>, fullName), Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(o.Complete(cmd, f, args)) cmdutil.CheckErr(o.Validate()) cmdutil.CheckErr(o.Run()) }, Aliases: []string{"dc"}, } cmd.Flags().String("image", "", "The image for the container to run.") cmd.MarkFlagRequired("image") cmdutil.<API key>(cmd) return cmd } func (o *<API key>) Complete(cmd *cobra.Command, f *clientcmd.Factory, args []string) error { argsLenAtDash := cmd.ArgsLenAtDash() switch { case (argsLenAtDash == -1 && len(args) != 1), (argsLenAtDash == 0), (argsLenAtDash > 1): return fmt.Errorf("NAME is required: %v", args) } labels := map[string]string{"deployment-config.name": args[0]} o.DC = &deployapi.DeploymentConfig{ ObjectMeta: kapi.ObjectMeta{Name: args[0]}, Spec: deployapi.<API key>{ Selector: labels, Replicas: 1, Template: &kapi.PodTemplateSpec{ ObjectMeta: kapi.ObjectMeta{Labels: labels}, Spec: kapi.PodSpec{ Containers: []kapi.Container{ { Name: "default-container", Image: cmdutil.GetFlagString(cmd, "image"), Args: args[1:], }, }, }, }, }, } var err error o.DC.Namespace, _, err = f.DefaultNamespace() if err != nil { return err } o.Client, _, err = f.Clients() if err != nil { return err } o.Mapper, _ = f.Object(false) o.OutputFormat = cmdutil.GetFlagString(cmd, "output") o.Printer = func(obj runtime.Object, out io.Writer) error { return f.PrintObject(cmd, o.Mapper, obj, out) } return nil } func (o *<API key>) Validate() error { if o.DC == nil { return fmt.Errorf("DC is required") } if o.Client == nil { return fmt.Errorf("Client is required") } if o.Mapper == nil { return fmt.Errorf("Mapper is required") } if o.Out == nil { return fmt.Errorf("Out is required") } if o.Printer == nil { return fmt.Errorf("Printer is required") } return nil } func (o *<API key>) Run() error { actualObj, err := o.Client.DeploymentConfigs(o.DC.Namespace).Create(o.DC) if err != nil { return err } if useShortOutput := o.OutputFormat == "name"; useShortOutput || len(o.OutputFormat) == 0 { cmdutil.PrintSuccess(o.Mapper, useShortOutput, o.Out, "deploymentconfig", actualObj.Name, "created") return nil } return o.Printer(actualObj, o.Out) }
<?php /** * Class to invalidate the HTML cache of all the pages linking to a given title. * * @ingroup Cache */ class HTMLCacheUpdate implements DeferrableUpdate { /** * @var Title */ public $mTitle; public $mTable; /** * @param $titleTo * @param $table * @param $start bool * @param $end bool */ function __construct( Title $titleTo, $table ) { $this->mTitle = $titleTo; $this->mTable = $table; } public function doUpdate() { wfProfileIn( __METHOD__ ); $job = new HTMLCacheUpdateJob( $this->mTitle, array( 'table' => $this->mTable, ) + Job::newRootJobParams( // "overall" refresh links job info "htmlCacheUpdate:{$this->mTable}:{$this->mTitle->getPrefixedText()}" ) ); $count = $this->mTitle->getBacklinkCache()->getNumLinks( $this->mTable, 200 ); if ( $count >= 200 ) { // many backlinks JobQueueGroup::singleton()->push( $job ); JobQueueGroup::singleton()->deduplicateRootJob( $job ); } else { // few backlinks ($count might be off even if 0) $dbw = wfGetDB( DB_MASTER ); $dbw->onTransactionIdle( function() use ( $job ) { $job->run(); // just do the purge query now } ); } wfProfileOut( __METHOD__ ); } }
cask :v1 => 'witgui' do version '2.1.2' sha256 '<SHA256-like>' url "http://desairem.altervista.org/witgui/download.php?version=#{version}" name 'Witgui' appcast 'http://desairem.altervista.org/witgui/appcast.xml', :sha256 => '<SHA256-like>' homepage 'http://desairem.altervista.org/witgui/wordpress/' license :unknown app 'Witgui.app' end
#ifndef <API key> #define <API key> #include <string> #include "base/files/file_path.h" #include "base/memory/weak_ptr.h" #include "base/<API key>.h" #include "extensions/browser/sandboxed_unpacker.h" namespace extensions { class Extension; } namespace chromeos { // Delegate class for <API key>, derived class must support // WeakPtr. class <API key> { public: virtual void <API key>( const std::string& app_id, const std::string& version, const std::string& min_browser_version, const base::FilePath& temp_dir) = 0; virtual void <API key>(const std::string& app_id) = 0; protected: virtual ~<API key>() {} }; // Unpacks the crx file of the kiosk app and validates its signature. class <API key> : public extensions::<API key> { public: <API key>( const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner, const extensions::CRXFileInfo& file, const base::FilePath& crx_unpack_dir, const base::WeakPtr<<API key>>& delegate); // Starts validating the external crx file. void Start(); private: ~<API key>() override; // <API key> overrides. void OnUnpackFailure(const extensions::CrxInstallError& error) override; void OnUnpackSuccess(const base::FilePath& temp_dir, const base::FilePath& extension_dir, const base::DictionaryValue* original_manifest, const extensions::Extension* extension, const SkBitmap& install_icon) override; // Task runner for executing file I/O tasks. const scoped_refptr<base::SequencedTaskRunner> <API key>; // Information about the external crx file. extensions::CRXFileInfo crx_file_; // The temporary directory used by SandBoxedUnpacker for unpacking extensions. const base::FilePath crx_unpack_dir_; base::WeakPtr<<API key>> delegate_; <API key>(<API key>); }; } // namespace chromeos #endif // <API key>
import { MacOption24 } from "../../"; export = MacOption24;
export default (...modifiers): Array<string> => {};
<?php namespace Concrete\Core\Search; use Concrete\Core\Application\EditResponse; use Concrete\Core\Entity\Search\Query; use Concrete\Core\Search\Result\Result as SearchResult; interface <API key> { function <API key>(Query $query); function <API key>(); function <API key>(); function getSessionNamespace(); }
#ifndef NV_CORE_H #error "Do not include this file directly." #endif //#include <cstddef> // size_t, NULL // Function linkage #define DLL_IMPORT __declspec(dllimport) #define DLL_EXPORT __declspec(dllexport) #define DLL_EXPORT_CLASS DLL_EXPORT // Function calling modes #if NV_CPU_X86 # define NV_CDECL __attribute__((cdecl)) # define NV_STDCALL __attribute__((stdcall)) #else # define NV_CDECL # define NV_STDCALL #endif #define NV_FASTCALL __attribute__((fastcall)) #define NV_FORCEINLINE __attribute__((always_inline)) #define NV_DEPRECATED __attribute__((deprecated)) #if __GNUC__ > 2 #define NV_PURE __attribute__((pure)) #define NV_CONST __attribute__((const)) #else #define NV_PURE #define NV_CONST #endif #define NV_NOINLINE __attribute__((noinline)) // Define __FUNC__ properly. #if __STDC_VERSION__ < 199901L # if __GNUC__ >= 2 # define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__ # else # define __FUNC__ "<unknown>" # endif #else # define __FUNC__ __PRETTY_FUNCTION__ #endif #define restrict __restrict__ /* // Type definitions typedef unsigned char uint8; typedef signed char int8; typedef unsigned short uint16; typedef signed short int16; typedef unsigned int uint32; typedef signed int int32; typedef unsigned long long uint64; typedef signed long long int64; // Aliases typedef uint32 uint; */
import { LogoTumblr16 } from "../../"; export = LogoTumblr16;
// Karma configuration // Generated on Sun Apr 14 2013 18:31:17 GMT+0200 (CEST) // base path, that will be used to resolve files and exclude basePath = ''; // list of files / patterns to load in the browser files = [ JASMINE, JASMINE_ADAPTER, 'http://code.angularjs.org/1.1.4/angular.js', 'http://code.angularjs.org/1.1.4/angular-resource.js', 'http://code.angularjs.org/1.1.4/angular-mocks.js', 'http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js', 'src/restangular.js',
#include "pppm_omp.h" #include "atom.h" #include "comm.h" #include "domain.h" #include "error.h" #include "fix_omp.h" #include "force.h" #include "memory.h" #include "math_const.h" #include "math_special.h" #include <string.h> #include <math.h> #include "suffix.h" using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; #ifdef FFT_SINGLE #define ZEROF 0.0f #else #define ZEROF 0.0 #endif #define EPS_HOC 1.0e-7 PPPMOMP::PPPMOMP(LAMMPS *lmp, int narg, char **arg) : PPPM(lmp, narg, arg), ThrOMP(lmp, THR_KSPACE) { triclinic_support = 0; suffix_flag |= Suffix::OMP; } void PPPMOMP::allocate() { PPPM::allocate(); #if defined(_OPENMP) #pragma omp parallel default(none) #endif { #if defined(_OPENMP) const int tid = omp_get_thread_num(); #else const int tid = 0; #endif ThrData *thr = fix->get_thr(tid); thr->init_pppm(order,memory); } } void PPPMOMP::deallocate() { PPPM::deallocate(); #if defined(_OPENMP) #pragma omp parallel default(none) #endif { #if defined(_OPENMP) const int tid = omp_get_thread_num(); #else const int tid = 0; #endif ThrData *thr = fix->get_thr(tid); thr->init_pppm(-order,memory); } } void PPPMOMP::compute_gf_ik() { const double * const prd = (triclinic==0) ? domain->prd : domain->prd_lamda; const double xprd = prd[0]; const double yprd = prd[1]; const double zprd = prd[2]; const double zprd_slab = zprd*slab_volfactor; const double unitkx = (MY_2PI/xprd); const double unitky = (MY_2PI/yprd); const double unitkz = (MY_2PI/zprd_slab); const int nbx = static_cast<int> ((g_ewald*xprd/(MY_PI*nx_pppm)) * pow(-log(EPS_HOC),0.25)); const int nby = static_cast<int> ((g_ewald*yprd/(MY_PI*ny_pppm)) * pow(-log(EPS_HOC),0.25)); const int nbz = static_cast<int> ((g_ewald*zprd_slab/(MY_PI*nz_pppm)) * pow(-log(EPS_HOC),0.25)); const int numk = nxhi_fft - nxlo_fft + 1; const int numl = nyhi_fft - nylo_fft + 1; const int twoorder = 2*order; #if defined(_OPENMP) #pragma omp parallel default(none) #endif { double snx,sny,snz; double argx,argy,argz,wx,wy,wz,sx,sy,sz,qx,qy,qz; double sum1,dot1,dot2; double numerator,denominator; double sqk; int k,l,m,nx,ny,nz,kper,lper,mper,n,nfrom,nto,tid; loop_setup_thr(nfrom, nto, tid, nfft, comm->nthreads); for (n = nfrom; n < nto; ++n) { m = n / (numl*numk); l = (n - m*numl*numk) / numk; k = n - m*numl*numk - l*numk; m += nzlo_fft; l += nylo_fft; k += nxlo_fft; mper = m - nz_pppm*(2*m/nz_pppm); snz = square(sin(0.5*unitkz*mper*zprd_slab/nz_pppm)); lper = l - ny_pppm*(2*l/ny_pppm); sny = square(sin(0.5*unitky*lper*yprd/ny_pppm)); kper = k - nx_pppm*(2*k/nx_pppm); snx = square(sin(0.5*unitkx*kper*xprd/nx_pppm)); sqk = square(unitkx*kper) + square(unitky*lper) + square(unitkz*mper); if (sqk != 0.0) { numerator = 12.5663706/sqk; denominator = gf_denom(snx,sny,snz); sum1 = 0.0; for (nx = -nbx; nx <= nbx; nx++) { qx = unitkx*(kper+nx_pppm*nx); sx = exp(-0.25*square(qx/g_ewald)); argx = 0.5*qx*xprd/nx_pppm; wx = powsinxx(argx,twoorder); for (ny = -nby; ny <= nby; ny++) { qy = unitky*(lper+ny_pppm*ny); sy = exp(-0.25*square(qy/g_ewald)); argy = 0.5*qy*yprd/ny_pppm; wy = powsinxx(argy,twoorder); for (nz = -nbz; nz <= nbz; nz++) { qz = unitkz*(mper+nz_pppm*nz); sz = exp(-0.25*square(qz/g_ewald)); argz = 0.5*qz*zprd_slab/nz_pppm; wz = powsinxx(argz,twoorder); dot1 = unitkx*kper*qx + unitky*lper*qy + unitkz*mper*qz; dot2 = qx*qx+qy*qy+qz*qz; sum1 += (dot1/dot2) * sx*sy*sz * wx*wy*wz; } } } greensfn[n] = numerator*sum1/denominator; } else greensfn[n] = 0.0; } } // end of parallel region } void PPPMOMP::compute_gf_ad() { const double * const prd = (triclinic==0) ? domain->prd : domain->prd_lamda; const double xprd = prd[0]; const double yprd = prd[1]; const double zprd = prd[2]; const double zprd_slab = zprd*slab_volfactor; const double unitkx = (MY_2PI/xprd); const double unitky = (MY_2PI/yprd); const double unitkz = (MY_2PI/zprd_slab); const int numk = nxhi_fft - nxlo_fft + 1; const int numl = nyhi_fft - nylo_fft + 1; const int twoorder = 2*order; double sf0=0.0,sf1=0.0,sf2=0.0,sf3=0.0,sf4=0.0,sf5=0.0; #if defined(_OPENMP) #pragma omp parallel default(none) reduction(+:sf0,sf1,sf2,sf3,sf4,sf5) #endif { double snx,sny,snz,sqk; double argx,argy,argz,wx,wy,wz,sx,sy,sz,qx,qy,qz; double numerator,denominator; int k,l,m,kper,lper,mper,n,nfrom,nto,tid; loop_setup_thr(nfrom, nto, tid, nfft, comm->nthreads); for (n = nfrom; n < nto; ++n) { m = n / (numl*numk); l = (n - m*numl*numk) / numk; k = n - m*numl*numk - l*numk; m += nzlo_fft; l += nylo_fft; k += nxlo_fft; mper = m - nz_pppm*(2*m/nz_pppm); qz = unitkz*mper; snz = square(sin(0.5*qz*zprd_slab/nz_pppm)); sz = exp(-0.25*square(qz/g_ewald)); argz = 0.5*qz*zprd_slab/nz_pppm; wz = powsinxx(argz,twoorder); lper = l - ny_pppm*(2*l/ny_pppm); qy = unitky*lper; sny = square(sin(0.5*qy*yprd/ny_pppm)); sy = exp(-0.25*square(qy/g_ewald)); argy = 0.5*qy*yprd/ny_pppm; wy = powsinxx(argy,twoorder); kper = k - nx_pppm*(2*k/nx_pppm); qx = unitkx*kper; snx = square(sin(0.5*qx*xprd/nx_pppm)); sx = exp(-0.25*square(qx/g_ewald)); argx = 0.5*qx*xprd/nx_pppm; wx = powsinxx(argx,twoorder); sqk = qx*qx + qy*qy + qz*qz; if (sqk != 0.0) { numerator = MY_4PI/sqk; denominator = gf_denom(snx,sny,snz); greensfn[n] = numerator*sx*sy*sz*wx*wy*wz/denominator; sf0 += sf_precoeff1[n]*greensfn[n]; sf1 += sf_precoeff2[n]*greensfn[n]; sf2 += sf_precoeff3[n]*greensfn[n]; sf3 += sf_precoeff4[n]*greensfn[n]; sf4 += sf_precoeff5[n]*greensfn[n]; sf5 += sf_precoeff6[n]*greensfn[n]; } else { greensfn[n] = 0.0; sf0 += sf_precoeff1[n]*greensfn[n]; sf1 += sf_precoeff2[n]*greensfn[n]; sf2 += sf_precoeff3[n]*greensfn[n]; sf3 += sf_precoeff4[n]*greensfn[n]; sf4 += sf_precoeff5[n]*greensfn[n]; sf5 += sf_precoeff6[n]*greensfn[n]; } } } // end of paralle region // compute the coefficients for the self-force correction double prex, prey, prez, tmp[6]; prex = prey = prez = MY_PI/volume; prex *= nx_pppm/xprd; prey *= ny_pppm/yprd; prez *= nz_pppm/zprd_slab; tmp[0] = sf0 * prex; tmp[1] = sf1 * prex*2; tmp[2] = sf2 * prey; tmp[3] = sf3 * prey*2; tmp[4] = sf4 * prez; tmp[5] = sf5 * prez*2; // communicate values with other procs MPI_Allreduce(tmp,sf_coeff,6,MPI_DOUBLE,MPI_SUM,world); } void PPPMOMP::compute(int eflag, int vflag) { PPPM::compute(eflag,vflag); #if defined(_OPENMP) #pragma omp parallel default(none) shared(eflag,vflag) #endif { #if defined(_OPENMP) const int tid = omp_get_thread_num(); #else const int tid = 0; #endif ThrData *thr = fix->get_thr(tid); reduce_thr(this, eflag, vflag, thr); } // end of omp parallel region } void PPPMOMP::make_rho() { // clear 3d density array FFT_SCALAR * _noalias const d = &(density_brick[nzlo_out][nylo_out][nxlo_out]); memset(d,0,ngrid*sizeof(FFT_SCALAR)); // no local atoms => nothing else to do const int nlocal = atom->nlocal; if (nlocal == 0) return; const int ix = nxhi_out - nxlo_out + 1; const int iy = nyhi_out - nylo_out + 1; #if defined(_OPENMP) #pragma omp parallel default(none) #endif { const double * _noalias const q = atom->q; const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; const double boxloz = boxlo[2]; // determine range of grid points handled by this thread int i,jfrom,jto,tid; loop_setup_thr(jfrom,jto,tid,ngrid,comm->nthreads); // get per thread data ThrData *thr = fix->get_thr(tid); FFT_SCALAR * const * const r1d = static_cast<FFT_SCALAR **>(thr->get_rho1d()); // loop over my charges, add their contribution to nearby grid points // (nx,ny,nz) = global coords of grid pt to "lower left" of charge // (dx,dy,dz) = distance to "lower left" grid pt // loop over all local atoms for all threads for (i = 0; i < nlocal; i++) { const int nx = p2g[i].a; const int ny = p2g[i].b; const int nz = p2g[i].t; // pre-screen whether this atom will ever come within // reach of the data segement this thread is updating. if ( ((nz+nlower-nzlo_out)*ix*iy >= jto) || ((nz+nupper-nzlo_out+1)*ix*iy < jfrom) ) continue; const FFT_SCALAR dx = nx+shiftone - (x[i].x-boxlox)*delxinv; const FFT_SCALAR dy = ny+shiftone - (x[i].y-boxloy)*delyinv; const FFT_SCALAR dz = nz+shiftone - (x[i].z-boxloz)*delzinv; compute_rho1d_thr(r1d,dx,dy,dz); const FFT_SCALAR z0 = delvolinv * q[i]; for (int n = nlower; n <= nupper; ++n) { const int jn = (nz+n-nzlo_out)*ix*iy; const FFT_SCALAR y0 = z0*r1d[2][n]; for (int m = nlower; m <= nupper; ++m) { const int jm = jn+(ny+m-nylo_out)*ix; const FFT_SCALAR x0 = y0*r1d[1][m]; for (int l = nlower; l <= nupper; ++l) { const int jl = jm+nx+l-nxlo_out; // make sure each thread only updates // "his" elements of the density grid if (jl >= jto) break; if (jl < jfrom) continue; d[jl] += x0*r1d[0][l]; } } } } } } void PPPMOMP::fieldforce_ik() { // loop over my charges, interpolate electric field from nearby grid points // (nx,ny,nz) = global coords of grid pt to "lower left" of charge // (dx,dy,dz) = distance to "lower left" grid pt // (mx,my,mz) = global coords of moving stencil pt // ek = 3 components of E-field on particle const int nthreads = comm->nthreads; const int nlocal = atom->nlocal; // no local atoms => nothing to do if (nlocal == 0) return; const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; const double qqrd2e = force->qqrd2e; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; const double boxloz = boxlo[2]; #if defined(_OPENMP) #pragma omp parallel default(none) #endif { FFT_SCALAR x0,y0,z0,ekx,eky,ekz; int i,ifrom,ito,tid,l,m,n,mx,my,mz; loop_setup_thr(ifrom,ito,tid,nlocal,nthreads); // get per thread data ThrData *thr = fix->get_thr(tid); dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; FFT_SCALAR * const * const r1d = static_cast<FFT_SCALAR **>(thr->get_rho1d()); for (i = ifrom; i < ito; ++i) { const int nx = p2g[i].a; const int ny = p2g[i].b; const int nz = p2g[i].t; const FFT_SCALAR dx = nx+shiftone - (x[i].x-boxlox)*delxinv; const FFT_SCALAR dy = ny+shiftone - (x[i].y-boxloy)*delyinv; const FFT_SCALAR dz = nz+shiftone - (x[i].z-boxloz)*delzinv; compute_rho1d_thr(r1d,dx,dy,dz); ekx = eky = ekz = ZEROF; for (n = nlower; n <= nupper; n++) { mz = n+nz; z0 = r1d[2][n]; for (m = nlower; m <= nupper; m++) { my = m+ny; y0 = z0*r1d[1][m]; for (l = nlower; l <= nupper; l++) { mx = l+nx; x0 = y0*r1d[0][l]; ekx -= x0*vdx_brick[mz][my][mx]; eky -= x0*vdy_brick[mz][my][mx]; ekz -= x0*vdz_brick[mz][my][mx]; } } } // convert E-field to force const double qfactor = qqrd2e * scale * q[i]; f[i].x += qfactor*ekx; f[i].y += qfactor*eky; if (slabflag != 2) f[i].z += qfactor*ekz; } } // end of parallel region } void PPPMOMP::fieldforce_ad() { const int nthreads = comm->nthreads; const int nlocal = atom->nlocal; // no local atoms => nothing to do if (nlocal == 0) return; const double *prd = (triclinic == 0) ? domain->prd : domain->prd_lamda; const double hx_inv = nx_pppm/prd[0]; const double hy_inv = ny_pppm/prd[1]; const double hz_inv = nz_pppm/prd[2]; // loop over my charges, interpolate electric field from nearby grid points // (nx,ny,nz) = global coords of grid pt to "lower left" of charge // (dx,dy,dz) = distance to "lower left" grid pt // (mx,my,mz) = global coords of moving stencil pt // ek = 3 components of E-field on particle const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; const double qqrd2e = force->qqrd2e; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; const double boxloz = boxlo[2]; #if defined(_OPENMP) #pragma omp parallel default(none) #endif { double s1,s2,s3,sf; FFT_SCALAR ekx,eky,ekz; int i,ifrom,ito,tid,l,m,n,mx,my,mz; loop_setup_thr(ifrom,ito,tid,nlocal,nthreads); // get per thread data ThrData *thr = fix->get_thr(tid); dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; FFT_SCALAR * const * const r1d = static_cast<FFT_SCALAR **>(thr->get_rho1d()); FFT_SCALAR * const * const d1d = static_cast<FFT_SCALAR **>(thr->get_drho1d()); for (i = ifrom; i < ito; ++i) { const int nx = p2g[i].a; const int ny = p2g[i].b; const int nz = p2g[i].t; const FFT_SCALAR dx = nx+shiftone - (x[i].x-boxlox)*delxinv; const FFT_SCALAR dy = ny+shiftone - (x[i].y-boxloy)*delyinv; const FFT_SCALAR dz = nz+shiftone - (x[i].z-boxloz)*delzinv; compute_rho1d_thr(r1d,dx,dy,dz); compute_drho1d_thr(d1d,dx,dy,dz); ekx = eky = ekz = ZEROF; for (n = nlower; n <= nupper; n++) { mz = n+nz; for (m = nlower; m <= nupper; m++) { my = m+ny; for (l = nlower; l <= nupper; l++) { mx = l+nx; ekx += d1d[0][l]*r1d[1][m]*r1d[2][n]*u_brick[mz][my][mx]; eky += r1d[0][l]*d1d[1][m]*r1d[2][n]*u_brick[mz][my][mx]; ekz += r1d[0][l]*r1d[1][m]*d1d[2][n]*u_brick[mz][my][mx]; } } } ekx *= hx_inv; eky *= hy_inv; ekz *= hz_inv; // convert E-field to force and substract self forces const double qi = q[i]; const double qfactor = qqrd2e * scale * qi; s1 = x[i].x*hx_inv; sf = sf_coeff[0]*sin(MY_2PI*s1); sf += sf_coeff[1]*sin(MY_4PI*s1); sf *= 2.0*qi; f[i].x += qfactor*(ekx - sf); s2 = x[i].y*hy_inv; sf = sf_coeff[2]*sin(MY_2PI*s2); sf += sf_coeff[3]*sin(MY_4PI*s2); sf *= 2.0*qi; f[i].y += qfactor*(eky - sf); s3 = x[i].z*hz_inv; sf = sf_coeff[4]*sin(MY_2PI*s3); sf += sf_coeff[5]*sin(MY_4PI*s3); sf *= 2.0*qi; if (slabflag != 2) f[i].z += qfactor*(ekz - sf); } } // end of parallel region } void PPPMOMP::fieldforce_peratom() { const int nthreads = comm->nthreads; const int nlocal = atom->nlocal; // no local atoms => nothing to do if (nlocal == 0) return; // loop over my charges, interpolate from nearby grid points // (nx,ny,nz) = global coords of grid pt to "lower left" of charge // (dx,dy,dz) = distance to "lower left" grid pt // (mx,my,mz) = global coords of moving stencil pt const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; #if defined(_OPENMP) #pragma omp parallel default(none) #endif { FFT_SCALAR dx,dy,dz,x0,y0,z0; FFT_SCALAR u,v0,v1,v2,v3,v4,v5; int i,ifrom,ito,tid,l,m,n,nx,ny,nz,mx,my,mz; loop_setup_thr(ifrom,ito,tid,nlocal,nthreads); // get per thread data ThrData *thr = fix->get_thr(tid); FFT_SCALAR * const * const r1d = static_cast<FFT_SCALAR **>(thr->get_rho1d()); for (i = ifrom; i < ito; ++i) { nx = part2grid[i][0]; ny = part2grid[i][1]; nz = part2grid[i][2]; dx = nx+shiftone - (x[i].x-boxlo[0])*delxinv; dy = ny+shiftone - (x[i].y-boxlo[1])*delyinv; dz = nz+shiftone - (x[i].z-boxlo[2])*delzinv; compute_rho1d_thr(r1d,dx,dy,dz); u = v0 = v1 = v2 = v3 = v4 = v5 = ZEROF; for (n = nlower; n <= nupper; n++) { mz = n+nz; z0 = r1d[2][n]; for (m = nlower; m <= nupper; m++) { my = m+ny; y0 = z0*r1d[1][m]; for (l = nlower; l <= nupper; l++) { mx = l+nx; x0 = y0*r1d[0][l]; if (eflag_atom) u += x0*u_brick[mz][my][mx]; if (vflag_atom) { v0 += x0*v0_brick[mz][my][mx]; v1 += x0*v1_brick[mz][my][mx]; v2 += x0*v2_brick[mz][my][mx]; v3 += x0*v3_brick[mz][my][mx]; v4 += x0*v4_brick[mz][my][mx]; v5 += x0*v5_brick[mz][my][mx]; } } } } const double qi = q[i]; if (eflag_atom) eatom[i] += qi*u; if (vflag_atom) { vatom[i][0] += qi*v0; vatom[i][1] += qi*v1; vatom[i][2] += qi*v2; vatom[i][3] += qi*v3; vatom[i][4] += qi*v4; vatom[i][5] += qi*v5; } } } // end of parallel region } void PPPMOMP::compute_rho1d_thr(FFT_SCALAR * const * const r1d, const FFT_SCALAR &dx, const FFT_SCALAR &dy, const FFT_SCALAR &dz) { int k,l; FFT_SCALAR r1,r2,r3; for (k = (1-order)/2; k <= order/2; k++) { r1 = r2 = r3 = ZEROF; for (l = order-1; l >= 0; l r1 = rho_coeff[l][k] + r1*dx; r2 = rho_coeff[l][k] + r2*dy; r3 = rho_coeff[l][k] + r3*dz; } r1d[0][k] = r1; r1d[1][k] = r2; r1d[2][k] = r3; } } void PPPMOMP::compute_drho1d_thr(FFT_SCALAR * const * const d1d, const FFT_SCALAR &dx, const FFT_SCALAR &dy, const FFT_SCALAR &dz) { int k,l; FFT_SCALAR r1,r2,r3; for (k = (1-order)/2; k <= order/2; k++) { r1 = r2 = r3 = ZEROF; for (l = order-2; l >= 0; l r1 = drho_coeff[l][k] + r1*dx; r2 = drho_coeff[l][k] + r2*dy; r3 = drho_coeff[l][k] + r3*dz; } d1d[0][k] = r1; d1d[1][k] = r2; d1d[2][k] = r3; } }
/* * board/config.h - configuration options, board specific */ #ifndef __CONFIG_H #define __CONFIG_H #define <API key> /* * High Level Configuration Options * (easy to change) */ #define CONFIG_X86 1 /* This is a X86 CPU */ #define CONFIG_SYS_SC520 1 /* Include support for AMD SC520 */ #define <API key> 6 #define <API key> 78 /* 7.8uS (choices are 7.8, 15.6, 31.2 or 62.5uS) */ #define <API key> 3 /* define at most one of these */ #undef <API key> #define <API key> #define <API key> 0 /* 100 or 133MHz */ #undef <API key> /* use SC520 MMCR's to reset cpu */ #undef <API key> /* use SC520 swtimers */ #define <API key> 1 /* use the i8254 PIT timers */ #undef <API key> /* use the Pentium TSC timers */ #define <API key> #define CONFIG_SYS_NUM_IRQS 16 #define <API key> 0x8000 /* Size of bootloader stack */ #define <API key> 1 #define <API key> 1 /* * Size of malloc() pool */ #define CONFIG_MALLOC_SIZE (CONFIG_ENV_SIZE + 128*1024) #define CONFIG_BAUDRATE 9600 /* * BOOTP options */ #define <API key> #define <API key> #define <API key> #define <API key> /* * Command line configuration. */ #include <config_cmd_default.h> #define CONFIG_CMD_PCI #define CONFIG_CMD_JFFS2 #define CONFIG_CMD_IDE #define CONFIG_CMD_NET #define CONFIG_CMD_PCMCIA #define CONFIG_CMD_EEPROM #define CONFIG_BOOTDELAY 15 #define CONFIG_BOOTARGS "root=/dev/mtdblock1 console=ttyS0,9600 " \ "mtdparts=phys:7936k(root),256k(uboot) " #define CONFIG_BOOTCOMMAND "setenv bootargs root=/dev/nfs ip=autoconf " \ "console=ttyS0,9600 " \ "mtdparts=phys:7808k(root),128k(env),256k(uboot);" \ "bootp;bootm" #if defined(CONFIG_CMD_KGDB) #define <API key> 115200 /* speed to run kgdb serial port */ #define <API key> 2 /* which serial port to use */ #endif /* * Miscellaneous configurable options */ #define CONFIG_SYS_LONGHELP /* undef to save memory */ #define CONFIG_SYS_PROMPT "boot > " /* Monitor Command Prompt */ #define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) /* Print Buffer Size */ #define CONFIG_SYS_MAXARGS 16 /* max number of command args */ #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */ #define <API key> 0x00100000 /* memtest works on */ #define <API key> 0x01000000 /* 1 ... 16 MB in DRAM */ #define <API key> 0x100000 /* default load address */ #define CONFIG_SYS_HZ 1024 /* incrementer freq: 1kHz */ /* valid baudrates */ #define <API key> { 9600, 19200, 38400, 57600, 115200 } #define <API key> 4 /* we have 4 banks of DRAM */ #define <API key> 1 /* max number of memory banks */ #define <API key> 512 /* max number of sectors on one chip */ /* timeout values are in ticks */ #define <API key> (2*CONFIG_SYS_HZ) /* Timeout for Flash Erase */ #define <API key> (2*CONFIG_SYS_HZ) /* Timeout for Flash Write */ #define CONFIG_SPI_EEPROM /* SPI EEPROMs such as AT25010 or AT25640 */ #define CONFIG_MW_EEPROM /* MicroWire EEPROMS such as AT93LC46 */ #define CONFIG_DTT_DS1722 /* Dallas DS1722 SPI Temperature probe */ /* allow to overwrite serial and ethaddr */ #define <API key> #if 0 /* Environment in flash */ #define <API key> 1 # define CONFIG_ENV_ADDR (0x387a0000) /* Addr of Environment Sector */ # define CONFIG_ENV_SIZE 0x20000 /* Total Size of Environment Sector (or 0x10000) */ # define CONFIG_ENV_OFFSET 0 #else /* Environment in EEPROM */ # define <API key> 1 # define CONFIG_SPI # define CONFIG_SPI_X 1 # define CONFIG_ENV_SIZE 0x2000 /* Total Size of Environment EEPROM */ # define CONFIG_ENV_OFFSET 0x1c00 #endif /* * JFFS2 partitions * */ /* No command line, one static partition, whole device */ #undef CONFIG_CMD_MTDPARTS #define CONFIG_JFFS2_DEV "nor0" #define <API key> 0xFFFFFFFF #define <API key> 0x00000000 /* mtdparts command line support */ /* Note: fake mtd_id used, no linux mtd map file */ /* #define CONFIG_CMD_MTDPARTS #define MTDIDS_DEFAULT "nor0=sc520_spunk-0" #define MTDPARTS_DEFAULT "mtdparts=sc520_spunk-0:-(jffs2)" */ #define CONFIG_NET_MULTI /* Multi ethernet cards support */ #define CONFIG_EEPRO100 #define <API key> 8 /* use 8 rx buffer on eepro100 */ #define <API key> 2 /* max. 2 IDE busses */ #define <API key> (<API key>*2) /* max. 2 drives per IDE bus */ #define <API key> 0 #define <API key> 0x01f0 /* ide0 offset */ #define <API key> 0xe000 /* ide1 offset */ #define <API key> 0 /* data reg offset */ #define <API key> 0 /* reg offset */ #define <API key> 0x200 /* alternate register offset */ #define <API key> 1 #undef CONFIG_IDE_LED /* no led for ide supported */ #undef CONFIG_IDE_RESET /* reset for ide unsupported... */ #undef <API key> /* no special reset function */ #define <API key> #define <API key> 0x27f00000 #define <API key> 0x00100000 #define <API key> 0xe000 #define <API key> 16 #define <API key> #define <API key> #define <API key> /* Experimental */ #define CONFIG_RTC_MC146818 #undef CONFIG_WATCHDOG /* watchdog disabled */ /* * PCI stuff */ #define CONFIG_PCI /* include pci support */ #define CONFIG_PCI_PNP /* pci plug-and-play */ #define <API key> #define <API key> 9 #define <API key> 10 #define <API key> 11 #define <API key> 12 #endif /* __CONFIG_H */
/* eepro.c: Intel EtherExpress Pro/10 device driver for Linux. */ static const char version[] = "eepro.c: v0.13b 09/13/2004 aris@cathedrallabs.org\n"; #include <linux/module.h> /* Sources: This driver wouldn't have been written without the availability of the Crynwr's Lan595 driver source code. It helps me to familiarize with the 82595 chipset while waiting for the Intel documentation. I also learned how to detect the 82595 using the packet driver's technique. This driver is written by cutting and pasting the skeleton.c driver provided by Donald Becker. I also borrowed the EEPROM routine from Donald Becker's 82586 driver. Datasheet for the Intel 82595 (including the TX and FX version). It provides just enough info that the casual reader might think that it documents the i82595. The User Manual for the 82595. It provides a lot of the missing information. */ #include <linux/kernel.h> #include <linux/types.h> #include <linux/fcntl.h> #include <linux/interrupt.h> #include <linux/ioport.h> #include <linux/in.h> #include <linux/slab.h> #include <linux/string.h> #include <linux/errno.h> #include <linux/netdevice.h> #include <linux/etherdevice.h> #include <linux/skbuff.h> #include <linux/spinlock.h> #include <linux/init.h> #include <linux/delay.h> #include <linux/bitops.h> #include <linux/ethtool.h> #include <asm/system.h> #include <asm/io.h> #include <asm/dma.h> #define DRV_NAME "eepro" #define DRV_VERSION "0.13c" #define <API key>( skb, mode ) dev_kfree_skb( (skb) ) /* I had reports of looong delays with SLOW_DOWN defined as udelay(2) */ #define SLOW_DOWN inb(0x80) /* udelay(2) */ #define compat_init_data __initdata enum iftype { AUI=0, BNC=1, TPE=2 }; /* First, a few definitions that the brave might change. */ /* A zero-terminated list of I/O addresses to be probed. */ static unsigned int eepro_portlist[] compat_init_data = { 0x300, 0x210, 0x240, 0x280, 0x2C0, 0x200, 0x320, 0x340, 0x360, 0}; /* note: 0x300 is default, the 595FX supports ALL IO Ports from 0x000 to 0x3F0, some of which are reserved in PCs */ /* To try the (not-really PnP Wakeup: */ /* #define PnPWakeup */ /* use 0 for production, 1 for verification, >2 for debug */ #ifndef NET_DEBUG #define NET_DEBUG 0 #endif static unsigned int net_debug = NET_DEBUG; /* The number of low I/O ports used by the ethercard. */ #define EEPRO_IO_EXTENT 16 /* Different 82595 chips */ #define LAN595 0 #define LAN595TX 1 #define LAN595FX 2 #define LAN595FX_10ISA 3 /* Information that need to be kept for each board. */ struct eepro_local { unsigned rx_start; unsigned tx_start; /* start of the transmit chain */ int tx_last; /* pointer to last packet in the transmit chain */ unsigned tx_end; /* end of the transmit chain (plus 1) */ int eepro; /* 1 for the EtherExpress Pro/10, 2 for the EtherExpress Pro/10+, 3 for the EtherExpress 10 (blue cards), 0 for other 82595-based lan cards. */ int version; /* a flag to indicate if this is a TX or FX version of the 82595 chip. */ int stepping; spinlock_t lock; /* Serializing lock */ unsigned rcv_ram; /* pre-calculated space for rx */ unsigned xmt_ram; /* pre-calculated space for tx */ unsigned char xmt_bar; unsigned char xmt_lower_limit_reg; unsigned char xmt_upper_limit_reg; short xmt_lower_limit; short xmt_upper_limit; short rcv_lower_limit; short rcv_upper_limit; unsigned char eeprom_reg; unsigned short word[8]; }; /* The station (ethernet) address prefix, used for IDing the board. */ #define SA_ADDR0 0x00 /* Etherexpress Pro/10 */ #define SA_ADDR1 0xaa #define SA_ADDR2 0x00 #define GetBit(x,y) ((x & (1<<y))>>y) /* EEPROM Word 0: */ #define ee_PnP 0 /* Plug 'n Play enable bit */ #define ee_Word1 1 /* Word 1? */ #define ee_BusWidth 2 /* 8/16 bit */ #define ee_FlashAddr 3 /* Flash Address */ #define ee_FlashMask 0x7 /* Mask */ #define ee_AutoIO 6 #define ee_reserved0 7 #define ee_Flash 8 /* Flash there? */ #define ee_AutoNeg 9 /* Auto Negotiation enabled? */ #define ee_IO0 10 /* IO Address LSB */ #define ee_IO0Mask 0x #define ee_IO1 15 /* IO MSB */ /* EEPROM Word 1: */ #define ee_IntSel 0 /* Interrupt */ #define ee_IntMask 0x7 #define ee_LI 3 /* Link Integrity 0= enabled */ #define ee_PC 4 /* Polarity Correction 0= enabled */ #define ee_TPE_AUI 5 /* PortSelection 1=TPE */ #define ee_Jabber 6 /* Jabber prevention 0= enabled */ #define ee_AutoPort 7 /* Auto Port Selection 1= Disabled */ #define ee_SMOUT 8 /* SMout Pin Control 0= Input */ #define ee_PROM 9 /* Flash EPROM / PROM 0=Flash */ #define ee_reserved1 10 /* .. 12 =0! */ #define ee_AltReady 13 /* Alternate Ready, 0=normal */ #define ee_reserved2 14 #define ee_Duplex 15 /* Word2,3,4: */ #define ee_IA5 0 /*bit start for individual Addr Byte 5 */ #define ee_IA4 8 /*bit start for individual Addr Byte 5 */ #define ee_IA3 0 /*bit start for individual Addr Byte 5 */ #define ee_IA2 8 /*bit start for individual Addr Byte 5 */ #define ee_IA1 0 /*bit start for individual Addr Byte 5 */ #define ee_IA0 8 /*bit start for individual Addr Byte 5 */ /* Word 5: */ #define ee_BNC_TPE 0 /* 0=TPE */ #define ee_BootType 1 /* 00=None, 01=IPX, 10=ODI, 11=NDIS */ #define ee_BootTypeMask 0x3 #define ee_NumConn 3 /* Number of Connections 0= One or Two */ #define ee_FlashSock 4 /* Presence of Flash Socket 0= Present */ #define ee_PortTPE 5 #define ee_PortBNC 6 #define ee_PortAUI 7 #define ee_PowerMgt 10 /* 0= disabled */ #define ee_CP 13 /* Concurrent Processing */ #define ee_CPMask 0x7 /* Word 6: */ #define ee_Stepping 0 /* Stepping info */ #define ee_StepMask 0x0F #define ee_BoardID 4 /* Manucaturer Board ID, reserved */ #define ee_BoardMask 0x0FFF /* Word 7: */ #define ee_INT_TO_IRQ 0 /* int to IRQ Mapping = 0x1EB8 for Pro/10+ */ #define ee_FX_INT2IRQ 0x1EB8 /* the _only_ mapping allowed for FX chips */ #define ee_SIZE 0x40 /* total EEprom Size */ #define ee_Checksum 0xBABA /* initial and final value for adding checksum */ /* Card identification via EEprom: */ #define ee_addr_vendor 0x10 /* Word offset for EISA Vendor ID */ #define ee_addr_id 0x11 /* Word offset for Card ID */ #define ee_addr_SN 0x12 /* Serial Number */ #define ee_addr_CRC_8 0x14 /* CRC over last thee Bytes */ #define ee_vendor_intel0 0x25 /* Vendor ID Intel */ #define ee_vendor_intel1 0xD4 #define ee_id_eepro10p0 0x10 /* ID for eepro/10+ */ #define ee_id_eepro10p1 0x31 #define TX_TIMEOUT 40 /* Index to functions, as function prototypes. */ static int eepro_probe1(struct net_device *dev, int autoprobe); static int eepro_open(struct net_device *dev); static int eepro_send_packet(struct sk_buff *skb, struct net_device *dev); static irqreturn_t eepro_interrupt(int irq, void *dev_id); static void eepro_rx(struct net_device *dev); static void <API key>(struct net_device *dev); static int eepro_close(struct net_device *dev); static void set_multicast_list(struct net_device *dev); static void eepro_tx_timeout (struct net_device *dev); static int read_eeprom(int ioaddr, int location, struct net_device *dev); static int <API key>(struct net_device *dev, void *buf, short length); static int eepro_grab_irq(struct net_device *dev); /* Details of the i82595. You will need either the datasheet or the user manual to understand what is going on here. The 82595 is very different from the 82586, 82593. The receive algorithm in eepro_rx() is just an implementation of the RCV ring structure that the Intel 82595 imposes at the hardware level. The receive buffer is set at 24K, and the transmit buffer is 8K. I am assuming that the total buffer memory is 32K, which is true for the Intel EtherExpress Pro/10. If it is less than that on a generic card, the driver will be broken. The transmit algorithm in the <API key>() is similar to the one in the eepro_rx(). The transmit buffer is a ring linked list. I just queue the next available packet to the end of the list. In my system, the 82595 is so fast that the list seems to always contain a single packet. In other systems with faster computers and more congested network traffics, the ring linked list should improve performance by allowing up to 8K worth of packets to be queued. The sizes of the receive and transmit buffers can now be changed via lilo or insmod. Lilo uses the appended line "ether=io,irq,debug,rx-buffer,eth0" where rx-buffer is in KB unit. Modules uses the parameter mem which is also in KB unit, for example "insmod io=io-address irq=0 mem=rx-buffer." The receive buffer has to be more than 3K or less than 29K. Otherwise, it is reset to the default of 24K, and, hence, 8K for the trasnmit buffer (transmit-buffer = 32K - receive-buffer). */ #define RAM_SIZE 0x8000 #define RCV_HEADER 8 #define RCV_DEFAULT_RAM 0x6000 #define XMT_HEADER 8 #define XMT_DEFAULT_RAM (RAM_SIZE - RCV_DEFAULT_RAM) #define XMT_START_PRO RCV_DEFAULT_RAM #define XMT_START_10 0x0000 #define RCV_START_PRO 0x0000 #define RCV_START_10 XMT_DEFAULT_RAM #define RCV_DONE 0x0008 #define RX_OK 0x2000 #define RX_ERROR 0x0d81 #define TX_DONE_BIT 0x0080 #define TX_OK 0x2000 #define CHAIN_BIT 0x8000 #define XMT_STATUS 0x02 #define XMT_CHAIN 0x04 #define XMT_COUNT 0x06 #define BANK0_SELECT 0x00 #define BANK1_SELECT 0x40 #define BANK2_SELECT 0x80 /* Bank 0 registers */ #define COMMAND_REG 0x00 /* Register 0 */ #define MC_SETUP 0x03 #define XMT_CMD 0x04 #define DIAGNOSE_CMD 0x07 #define RCV_ENABLE_CMD 0x08 #define RCV_DISABLE_CMD 0x0a #define STOP_RCV_CMD 0x0b #define RESET_CMD 0x0e #define POWER_DOWN_CMD 0x18 #define RESUME_XMT_CMD 0x1c #define SEL_RESET_CMD 0x1e #define STATUS_REG 0x01 /* Register 1 */ #define RX_INT 0x02 #define TX_INT 0x04 #define EXEC_STATUS 0x30 #define ID_REG 0x02 /* Register 2 */ #define R_ROBIN_BITS 0xc0 /* round robin counter */ #define ID_REG_MASK 0x2c #define ID_REG_SIG 0x24 #define AUTO_ENABLE 0x10 #define INT_MASK_REG 0x03 /* Register 3 */ #define RX_STOP_MASK 0x01 #define RX_MASK 0x02 #define TX_MASK 0x04 #define EXEC_MASK 0x08 #define ALL_MASK 0x0f #define IO_32_BIT 0x10 #define RCV_BAR 0x04 /* The following are word (16-bit) registers */ #define RCV_STOP 0x06 #define XMT_BAR_PRO 0x0a #define XMT_BAR_10 0x0b #define HOST_ADDRESS_REG 0x0c #define IO_PORT 0x0e #define IO_PORT_32_BIT 0x0c /* Bank 1 registers */ #define REG1 0x01 #define WORD_WIDTH 0x02 #define INT_ENABLE 0x80 #define INT_NO_REG 0x02 #define RCV_LOWER_LIMIT_REG 0x08 #define RCV_UPPER_LIMIT_REG 0x09 #define <API key> 0x0a #define <API key> 0x0b #define <API key> 0x0b #define <API key> 0x0a /* Bank 2 registers */ #define XMT_Chain_Int 0x20 /* Interrupt at the end of the transmit chain */ #define XMT_Chain_ErrStop 0x40 /* Interrupt at the end of the chain even if there are errors */ #define <API key> 0x80 /* Throw bad frames away, and continue to receive others */ #define REG2 0x02 #define PRMSC_Mode 0x01 #define Multi_IA 0x20 #define REG3 0x03 #define TPE_BIT 0x04 #define BNC_BIT 0x20 #define REG13 0x0d #define FDX 0x00 #define A_N_ENABLE 0x02 #define I_ADD_REG0 0x04 #define I_ADD_REG1 0x05 #define I_ADD_REG2 0x06 #define I_ADD_REG3 0x07 #define I_ADD_REG4 0x08 #define I_ADD_REG5 0x09 #define EEPROM_REG_PRO 0x0a #define EEPROM_REG_10 0x0b #define EESK 0x01 #define EECS 0x02 #define EEDI 0x04 #define EEDO 0x08 /* do a full reset */ #define eepro_reset(ioaddr) outb(RESET_CMD, ioaddr) /* do a nice reset */ #define eepro_sel_reset(ioaddr) { \ outb(SEL_RESET_CMD, ioaddr); \ SLOW_DOWN; \ SLOW_DOWN; \ } /* disable all interrupts */ #define eepro_dis_int(ioaddr) outb(ALL_MASK, ioaddr + INT_MASK_REG) /* clear all interrupts */ #define eepro_clear_int(ioaddr) outb(ALL_MASK, ioaddr + STATUS_REG) /* enable tx/rx */ #define eepro_en_int(ioaddr) outb(ALL_MASK & ~(RX_MASK | TX_MASK), \ ioaddr + INT_MASK_REG) /* enable exec event interrupt */ #define eepro_en_intexec(ioaddr) outb(ALL_MASK & ~(EXEC_MASK), ioaddr + INT_MASK_REG) /* enable rx */ #define eepro_en_rx(ioaddr) outb(RCV_ENABLE_CMD, ioaddr) /* disable rx */ #define eepro_dis_rx(ioaddr) outb(RCV_DISABLE_CMD, ioaddr) /* switch bank */ #define eepro_sw2bank0(ioaddr) outb(BANK0_SELECT, ioaddr) #define eepro_sw2bank1(ioaddr) outb(BANK1_SELECT, ioaddr) #define eepro_sw2bank2(ioaddr) outb(BANK2_SELECT, ioaddr) /* enable interrupt line */ #define eepro_en_intline(ioaddr) outb(inb(ioaddr + REG1) | INT_ENABLE,\ ioaddr + REG1) /* disable interrupt line */ #define eepro_dis_intline(ioaddr) outb(inb(ioaddr + REG1) & 0x7f, \ ioaddr + REG1); /* set diagnose flag */ #define eepro_diag(ioaddr) outb(DIAGNOSE_CMD, ioaddr) /* ack for rx int */ #define eepro_ack_rx(ioaddr) outb (RX_INT, ioaddr + STATUS_REG) /* ack for tx int */ #define eepro_ack_tx(ioaddr) outb (TX_INT, ioaddr + STATUS_REG) /* a complete sel reset */ #define <API key>(ioaddr) { \ dev->stats.tx_errors++;\ eepro_sel_reset(ioaddr);\ lp->tx_end = \ lp->xmt_lower_limit;\ lp->tx_start = lp->tx_end;\ lp->tx_last = 0;\ dev->trans_start = jiffies;\ netif_wake_queue(dev);\ eepro_en_rx(ioaddr);\ } /* Check for a network adaptor of this type, and return '0' if one exists. If dev->base_addr == 0, probe all likely locations. If dev->base_addr == 1, always return failure. If dev->base_addr == 2, allocate space for the device and return success (detachable devices only). */ static int __init do_eepro_probe(struct net_device *dev) { int i; int base_addr = dev->base_addr; int irq = dev->irq; #ifdef PnPWakeup /* XXXX for multiple cards should this only be run once? */ /* Wakeup: */ #define WakeupPort 0x279 #define WakeupSeq {0x6A, 0xB5, 0xDA, 0xED, 0xF6, 0xFB, 0x7D, 0xBE,\ 0xDF, 0x6F, 0x37, 0x1B, 0x0D, 0x86, 0xC3, 0x61,\ 0xB0, 0x58, 0x2C, 0x16, 0x8B, 0x45, 0xA2, 0xD1,\ 0xE8, 0x74, 0x3A, 0x9D, 0xCE, 0xE7, 0x73, 0x43} { unsigned short int WS[32]=WakeupSeq; if (request_region(WakeupPort, 2, "eepro wakeup")) { if (net_debug>5) printk(KERN_DEBUG "Waking UP\n"); outb_p(0,WakeupPort); outb_p(0,WakeupPort); for (i=0; i<32; i++) { outb_p(WS[i],WakeupPort); if (net_debug>5) printk(KERN_DEBUG ": %#x ",WS[i]); } release_region(WakeupPort, 2); } else printk(KERN_WARNING "PnP wakeup region busy!\n"); } #endif if (base_addr > 0x1ff) /* Check a single specified location. */ return eepro_probe1(dev, 0); else if (base_addr != 0) /* Don't probe at all. */ return -ENXIO; for (i = 0; eepro_portlist[i]; i++) { dev->base_addr = eepro_portlist[i]; dev->irq = irq; if (eepro_probe1(dev, 1) == 0) return 0; } return -ENODEV; } #ifndef MODULE struct net_device * __init eepro_probe(int unit) { struct net_device *dev = alloc_etherdev(sizeof(struct eepro_local)); int err; if (!dev) return ERR_PTR(-ENODEV); sprintf(dev->name, "eth%d", unit); <API key>(dev); err = do_eepro_probe(dev); if (err) goto out; return dev; out: free_netdev(dev); return ERR_PTR(err); } #endif static void __init printEEPROMInfo(struct net_device *dev) { struct eepro_local *lp = netdev_priv(dev); int ioaddr = dev->base_addr; unsigned short Word; int i,j; j = ee_Checksum; for (i = 0; i < 8; i++) j += lp->word[i]; for ( ; i < ee_SIZE; i++) j += read_eeprom(ioaddr, i, dev); printk(KERN_DEBUG "Checksum: %#x\n",j&0xffff); Word = lp->word[0]; printk(KERN_DEBUG "Word0:\n"); printk(KERN_DEBUG " Plug 'n Pray: %d\n",GetBit(Word,ee_PnP)); printk(KERN_DEBUG " Buswidth: %d\n",(GetBit(Word,ee_BusWidth)+1)*8 ); printk(KERN_DEBUG " AutoNegotiation: %d\n",GetBit(Word,ee_AutoNeg)); printk(KERN_DEBUG " IO Address: %#x\n", (Word>>ee_IO0)<<4); if (net_debug>4) { Word = lp->word[1]; printk(KERN_DEBUG "Word1:\n"); printk(KERN_DEBUG " INT: %d\n", Word & ee_IntMask); printk(KERN_DEBUG " LI: %d\n", GetBit(Word,ee_LI)); printk(KERN_DEBUG " PC: %d\n", GetBit(Word,ee_PC)); printk(KERN_DEBUG " TPE/AUI: %d\n", GetBit(Word,ee_TPE_AUI)); printk(KERN_DEBUG " Jabber: %d\n", GetBit(Word,ee_Jabber)); printk(KERN_DEBUG " AutoPort: %d\n", !GetBit(Word,ee_AutoPort)); printk(KERN_DEBUG " Duplex: %d\n", GetBit(Word,ee_Duplex)); } Word = lp->word[5]; printk(KERN_DEBUG "Word5:\n"); printk(KERN_DEBUG " BNC: %d\n",GetBit(Word,ee_BNC_TPE)); printk(KERN_DEBUG " NumConnectors: %d\n",GetBit(Word,ee_NumConn)); printk(KERN_DEBUG " Has "); if (GetBit(Word,ee_PortTPE)) printk(KERN_DEBUG "TPE "); if (GetBit(Word,ee_PortBNC)) printk(KERN_DEBUG "BNC "); if (GetBit(Word,ee_PortAUI)) printk(KERN_DEBUG "AUI "); printk(KERN_DEBUG "port(s) \n"); Word = lp->word[6]; printk(KERN_DEBUG "Word6:\n"); printk(KERN_DEBUG " Stepping: %d\n",Word & ee_StepMask); printk(KERN_DEBUG " BoardID: %d\n",Word>>ee_BoardID); Word = lp->word[7]; printk(KERN_DEBUG "Word7:\n"); printk(KERN_DEBUG " INT to IRQ:\n"); for (i=0, j=0; i<15; i++) if (GetBit(Word,i)) printk(KERN_DEBUG " INT%d -> IRQ %d;",j++,i); printk(KERN_DEBUG "\n"); } /* function to recalculate the limits of buffer based on rcv_ram */ static void eepro_recalc (struct net_device *dev) { struct eepro_local * lp; lp = netdev_priv(dev); lp->xmt_ram = RAM_SIZE - lp->rcv_ram; if (lp->eepro == LAN595FX_10ISA) { lp->xmt_lower_limit = XMT_START_10; lp->xmt_upper_limit = (lp->xmt_ram - 2); lp->rcv_lower_limit = lp->xmt_ram; lp->rcv_upper_limit = (RAM_SIZE - 2); } else { lp->rcv_lower_limit = RCV_START_PRO; lp->rcv_upper_limit = (lp->rcv_ram - 2); lp->xmt_lower_limit = lp->rcv_ram; lp->xmt_upper_limit = (RAM_SIZE - 2); } } /* prints boot-time info */ static void __init eepro_print_info (struct net_device *dev) { struct eepro_local * lp = netdev_priv(dev); int i; const char * ifmap[] = {"AUI", "10Base2", "10BaseT"}; i = inb(dev->base_addr + ID_REG); printk(KERN_DEBUG " id: %#x ",i); printk(" io: %#x ", (unsigned)dev->base_addr); switch (lp->eepro) { case LAN595FX_10ISA: printk("%s: Intel EtherExpress 10 ISA\n at % dev->name, (unsigned)dev->base_addr); break; case LAN595FX: printk("%s: Intel EtherExpress Pro/10+ ISA\n at % dev->name, (unsigned)dev->base_addr); break; case LAN595TX: printk("%s: Intel EtherExpress Pro/10 ISA at % dev->name, (unsigned)dev->base_addr); break; case LAN595: printk("%s: Intel 82595-based lan card at % dev->name, (unsigned)dev->base_addr); break; } printk(" %pM", dev->dev_addr); if (net_debug > 3) printk(KERN_DEBUG ", %dK RCV buffer", (int)(lp->rcv_ram)/1024); if (dev->irq > 2) printk(", IRQ %d, %s.\n", dev->irq, ifmap[dev->if_port]); else printk(", %s.\n", ifmap[dev->if_port]); if (net_debug > 3) { i = lp->word[5]; if (i & 0x2000) /* bit 13 of EEPROM word 5 */ printk(KERN_DEBUG "%s: Concurrent Processing is " "enabled but not used!\n", dev->name); } /* Check the station address for the manufacturer's code */ if (net_debug>3) printEEPROMInfo(dev); } static const struct ethtool_ops eepro_ethtool_ops; static const struct net_device_ops eepro_netdev_ops = { .ndo_open = eepro_open, .ndo_stop = eepro_close, .ndo_start_xmit = eepro_send_packet, .<API key> = set_multicast_list, .ndo_tx_timeout = eepro_tx_timeout, .ndo_change_mtu = eth_change_mtu, .ndo_set_mac_address = eth_mac_addr, .ndo_validate_addr = eth_validate_addr, }; /* This is the real probe routine. Linux has a history of friendly device probes on the ISA bus. A good device probe avoids doing writes, and verifies that the correct device exists and functions. */ static int __init eepro_probe1(struct net_device *dev, int autoprobe) { unsigned short station_addr[3], id, counter; int i; struct eepro_local *lp; int ioaddr = dev->base_addr; int err; /* Grab the region so we can find another board if autoIRQ fails. */ if (!request_region(ioaddr, EEPRO_IO_EXTENT, DRV_NAME)) { if (!autoprobe) printk(KERN_WARNING "EEPRO: io-port 0x%04x in use \n", ioaddr); return -EBUSY; } /* Now, we are going to check for the signature of the ID_REG (register 2 of bank 0) */ id = inb(ioaddr + ID_REG); if ((id & ID_REG_MASK) != ID_REG_SIG) goto exit; /* We seem to have the 82595 signature, let's play with its counter (last 2 bits of register 2 of bank 0) to be sure. */ counter = id & R_ROBIN_BITS; if ((inb(ioaddr + ID_REG) & R_ROBIN_BITS) != (counter + 0x40)) goto exit; lp = netdev_priv(dev); memset(lp, 0, sizeof(struct eepro_local)); lp->xmt_bar = XMT_BAR_PRO; lp->xmt_lower_limit_reg = <API key>; lp->xmt_upper_limit_reg = <API key>; lp->eeprom_reg = EEPROM_REG_PRO; spin_lock_init(&lp->lock); /* Now, get the ethernet hardware address from the EEPROM */ station_addr[0] = read_eeprom(ioaddr, 2, dev); /* FIXME - find another way to know that we've found * an Etherexpress 10 */ if (station_addr[0] == 0x0000 || station_addr[0] == 0xffff) { lp->eepro = LAN595FX_10ISA; lp->eeprom_reg = EEPROM_REG_10; lp->xmt_lower_limit_reg = <API key>; lp->xmt_upper_limit_reg = <API key>; lp->xmt_bar = XMT_BAR_10; station_addr[0] = read_eeprom(ioaddr, 2, dev); } /* get all words at once. will be used here and for ethtool */ for (i = 0; i < 8; i++) { lp->word[i] = read_eeprom(ioaddr, i, dev); } station_addr[1] = lp->word[3]; station_addr[2] = lp->word[4]; if (!lp->eepro) { if (lp->word[7] == ee_FX_INT2IRQ) lp->eepro = 2; else if (station_addr[2] == SA_ADDR1) lp->eepro = 1; } /* Fill in the 'dev' fields. */ for (i=0; i < 6; i++) dev->dev_addr[i] = ((unsigned char *) station_addr)[5-i]; /* RX buffer must be more than 3K and less than 29K */ if (dev->mem_end < 3072 || dev->mem_end > 29696) lp->rcv_ram = RCV_DEFAULT_RAM; /* calculate {xmt,rcv}_{lower,upper}_limit */ eepro_recalc(dev); if (GetBit(lp->word[5], ee_BNC_TPE)) dev->if_port = BNC; else dev->if_port = TPE; if (dev->irq < 2 && lp->eepro != 0) { /* Mask off INT number */ int count = lp->word[1] & 7; unsigned irqMask = lp->word[7]; while (count irqMask &= irqMask - 1; count = ffs(irqMask); if (count) dev->irq = count - 1; if (dev->irq < 2) { printk(KERN_ERR " Duh! illegal interrupt vector stored in EEPROM.\n"); goto exit; } else if (dev->irq == 2) { dev->irq = 9; } } dev->netdev_ops = &eepro_netdev_ops; dev->watchdog_timeo = TX_TIMEOUT; dev->ethtool_ops = &eepro_ethtool_ops; /* print boot time info */ eepro_print_info(dev); /* reset 82595 */ eepro_reset(ioaddr); err = register_netdev(dev); if (err) goto err; return 0; exit: err = -ENODEV; err: release_region(dev->base_addr, EEPRO_IO_EXTENT); return err; } /* Open/initialize the board. This is called (in the current kernel) sometime after booting when the 'ifconfig' program is run. This routine should set everything up anew at each open, even registers that "should" only need to be set once at boot, so that there is non-reboot way to recover if something goes wrong. */ static char irqrmap[] = {-1,-1,0,1,-1,2,-1,-1,-1,0,3,4,-1,-1,-1,-1}; static char irqrmap2[] = {-1,-1,4,0,1,2,-1,3,-1,4,5,6,7,-1,-1,-1}; static int eepro_grab_irq(struct net_device *dev) { int irqlist[] = { 3, 4, 5, 7, 9, 10, 11, 12, 0 }; int *irqp = irqlist, temp_reg, ioaddr = dev->base_addr; eepro_sw2bank1(ioaddr); /* be CAREFUL, BANK 1 now */ /* Enable the interrupt line. */ eepro_en_intline(ioaddr); /* be CAREFUL, BANK 0 now */ eepro_sw2bank0(ioaddr); /* clear all interrupts */ eepro_clear_int(ioaddr); /* Let EXEC event to interrupt */ eepro_en_intexec(ioaddr); do { eepro_sw2bank1(ioaddr); /* be CAREFUL, BANK 1 now */ temp_reg = inb(ioaddr + INT_NO_REG); outb((temp_reg & 0xf8) | irqrmap[*irqp], ioaddr + INT_NO_REG); eepro_sw2bank0(ioaddr); /* Switch back to Bank 0 */ if (request_irq (*irqp, NULL, IRQF_SHARED, "bogus", dev) != EBUSY) { unsigned long irq_mask; /* Twinkle the interrupt, and check if it's seen */ irq_mask = probe_irq_on(); eepro_diag(ioaddr); /* RESET the 82595 */ mdelay(20); if (*irqp == probe_irq_off(irq_mask)) /* It's a good IRQ line */ break; /* clear all interrupts */ eepro_clear_int(ioaddr); } } while (*++irqp); eepro_sw2bank1(ioaddr); /* Switch back to Bank 1 */ /* Disable the physical interrupt line. */ eepro_dis_intline(ioaddr); eepro_sw2bank0(ioaddr); /* Switch back to Bank 0 */ /* Mask all the interrupts. */ eepro_dis_int(ioaddr); /* clear all interrupts */ eepro_clear_int(ioaddr); return dev->irq; } static int eepro_open(struct net_device *dev) { unsigned short temp_reg, old8, old9; int irqMask; int i, ioaddr = dev->base_addr; struct eepro_local *lp = netdev_priv(dev); if (net_debug > 3) printk(KERN_DEBUG "%s: entering eepro_open routine.\n", dev->name); irqMask = lp->word[7]; if (lp->eepro == LAN595FX_10ISA) { if (net_debug > 3) printk(KERN_DEBUG "p->eepro = 3;\n"); } else if (irqMask == ee_FX_INT2IRQ) /* INT to IRQ Mask */ { lp->eepro = 2; /* Yes, an Intel EtherExpress Pro/10+ */ if (net_debug > 3) printk(KERN_DEBUG "p->eepro = 2;\n"); } else if ((dev->dev_addr[0] == SA_ADDR0 && dev->dev_addr[1] == SA_ADDR1 && dev->dev_addr[2] == SA_ADDR2)) { lp->eepro = 1; if (net_debug > 3) printk(KERN_DEBUG "p->eepro = 1;\n"); } /* Yes, an Intel EtherExpress Pro/10 */ else lp->eepro = 0; /* No, it is a generic 82585 lan card */ /* Get the interrupt vector for the 82595 */ if (dev->irq < 2 && eepro_grab_irq(dev) == 0) { printk(KERN_ERR "%s: unable to get IRQ %d.\n", dev->name, dev->irq); return -EAGAIN; } if (request_irq(dev->irq , &eepro_interrupt, 0, dev->name, dev)) { printk(KERN_ERR "%s: unable to get IRQ %d.\n", dev->name, dev->irq); return -EAGAIN; } /* Initialize the 82595. */ eepro_sw2bank2(ioaddr); /* be CAREFUL, BANK 2 now */ temp_reg = inb(ioaddr + lp->eeprom_reg); lp->stepping = temp_reg >> 5; /* Get the stepping number of the 595 */ if (net_debug > 3) printk(KERN_DEBUG "The stepping of the 82595 is %d\n", lp->stepping); if (temp_reg & 0x10) /* Check the TurnOff Enable bit */ outb(temp_reg & 0xef, ioaddr + lp->eeprom_reg); for (i=0; i < 6; i++) outb(dev->dev_addr[i] , ioaddr + I_ADD_REG0 + i); temp_reg = inb(ioaddr + REG1); /* Setup Transmit Chaining */ outb(temp_reg | XMT_Chain_Int | XMT_Chain_ErrStop /* and discard bad RCV frames */ | <API key>, ioaddr + REG1); temp_reg = inb(ioaddr + REG2); /* Match broadcast */ outb(temp_reg | 0x14, ioaddr + REG2); temp_reg = inb(ioaddr + REG3); outb(temp_reg & 0x3f, ioaddr + REG3); /* clear test mode */ /* Set the receiving mode */ eepro_sw2bank1(ioaddr); /* be CAREFUL, BANK 1 now */ /* Set the interrupt vector */ temp_reg = inb(ioaddr + INT_NO_REG); if (lp->eepro == LAN595FX || lp->eepro == LAN595FX_10ISA) outb((temp_reg & 0xf8) | irqrmap2[dev->irq], ioaddr + INT_NO_REG); else outb((temp_reg & 0xf8) | irqrmap[dev->irq], ioaddr + INT_NO_REG); temp_reg = inb(ioaddr + INT_NO_REG); if (lp->eepro == LAN595FX || lp->eepro == LAN595FX_10ISA) outb((temp_reg & 0xf0) | irqrmap2[dev->irq] | 0x08,ioaddr+INT_NO_REG); else outb((temp_reg & 0xf8) | irqrmap[dev->irq], ioaddr + INT_NO_REG); if (net_debug > 3) printk(KERN_DEBUG "eepro_open: content of INT Reg is %x\n", temp_reg); /* Initialize the RCV and XMT upper and lower limits */ outb(lp->rcv_lower_limit >> 8, ioaddr + RCV_LOWER_LIMIT_REG); outb(lp->rcv_upper_limit >> 8, ioaddr + RCV_UPPER_LIMIT_REG); outb(lp->xmt_lower_limit >> 8, ioaddr + lp->xmt_lower_limit_reg); outb(lp->xmt_upper_limit >> 8, ioaddr + lp->xmt_upper_limit_reg); /* Enable the interrupt line. */ eepro_en_intline(ioaddr); /* Switch back to Bank 0 */ eepro_sw2bank0(ioaddr); /* Let RX and TX events to interrupt */ eepro_en_int(ioaddr); /* clear all interrupts */ eepro_clear_int(ioaddr); /* Initialize RCV */ outw(lp->rcv_lower_limit, ioaddr + RCV_BAR); lp->rx_start = lp->rcv_lower_limit; outw(lp->rcv_upper_limit | 0xfe, ioaddr + RCV_STOP); /* Initialize XMT */ outw(lp->xmt_lower_limit, ioaddr + lp->xmt_bar); lp->tx_start = lp->tx_end = lp->xmt_lower_limit; lp->tx_last = 0; /* Check for the i82595TX and i82595FX */ old8 = inb(ioaddr + 8); outb(~old8, ioaddr + 8); if ((temp_reg = inb(ioaddr + 8)) == old8) { if (net_debug > 3) printk(KERN_DEBUG "i82595 detected!\n"); lp->version = LAN595; } else { lp->version = LAN595TX; outb(old8, ioaddr + 8); old9 = inb(ioaddr + 9); if (irqMask==ee_FX_INT2IRQ) { if (net_debug > 3) { printk(KERN_DEBUG "IrqMask: %#x\n",irqMask); printk(KERN_DEBUG "i82595FX detected!\n"); } lp->version = LAN595FX; outb(old9, ioaddr + 9); if (dev->if_port != TPE) { /* Hopefully, this will fix the problem of using Pentiums and pro/10 w/ BNC. */ eepro_sw2bank2(ioaddr); /* be CAREFUL, BANK 2 now */ temp_reg = inb(ioaddr + REG13); /* disable the full duplex mode since it is not applicable with the 10Base2 cable. */ outb(temp_reg & ~(FDX | A_N_ENABLE), REG13); eepro_sw2bank0(ioaddr); /* be CAREFUL, BANK 0 now */ } } else if (net_debug > 3) { printk(KERN_DEBUG "temp_reg: %#x ~old9: %#x\n",temp_reg,((~old9)&0xff)); printk(KERN_DEBUG "i82595TX detected!\n"); } } eepro_sel_reset(ioaddr); netif_start_queue(dev); if (net_debug > 3) printk(KERN_DEBUG "%s: exiting eepro_open routine.\n", dev->name); /* enabling rx */ eepro_en_rx(ioaddr); return 0; } static void eepro_tx_timeout (struct net_device *dev) { struct eepro_local *lp = netdev_priv(dev); int ioaddr = dev->base_addr; /* if (net_debug > 1) */ printk (KERN_ERR "%s: transmit timed out, %s?\n", dev->name, "network cable problem"); /* This is not a duplicate. One message for the console, one for the log file */ printk (KERN_DEBUG "%s: transmit timed out, %s?\n", dev->name, "network cable problem"); <API key>(ioaddr); } static int eepro_send_packet(struct sk_buff *skb, struct net_device *dev) { struct eepro_local *lp = netdev_priv(dev); unsigned long flags; int ioaddr = dev->base_addr; short length = skb->len; if (net_debug > 5) printk(KERN_DEBUG "%s: entering eepro_send_packet routine.\n", dev->name); if (length < ETH_ZLEN) { if (skb_padto(skb, ETH_ZLEN)) return 0; length = ETH_ZLEN; } netif_stop_queue (dev); eepro_dis_int(ioaddr); spin_lock_irqsave(&lp->lock, flags); { unsigned char *buf = skb->data; if (<API key>(dev, buf, length)) /* we won't wake queue here because we're out of space */ dev->stats.tx_dropped++; else { dev->stats.tx_bytes+=skb->len; dev->trans_start = jiffies; netif_wake_queue(dev); } } dev_kfree_skb (skb); /* You might need to clean up and record Tx statistics here. */ /* dev->stats.tx_aborted_errors++; */ if (net_debug > 5) printk(KERN_DEBUG "%s: exiting eepro_send_packet routine.\n", dev->name); eepro_en_int(ioaddr); <API key>(&lp->lock, flags); return 0; } /* The typical workload of the driver: Handle the network interface interrupts. */ static irqreturn_t eepro_interrupt(int irq, void *dev_id) { struct net_device *dev = dev_id; struct eepro_local *lp; int ioaddr, status, boguscount = 20; int handled = 0; lp = netdev_priv(dev); spin_lock(&lp->lock); if (net_debug > 5) printk(KERN_DEBUG "%s: entering eepro_interrupt routine.\n", dev->name); ioaddr = dev->base_addr; while (((status = inb(ioaddr + STATUS_REG)) & (RX_INT|TX_INT)) && (boguscount { handled = 1; if (status & RX_INT) { if (net_debug > 4) printk(KERN_DEBUG "%s: packet received interrupt.\n", dev->name); eepro_dis_int(ioaddr); /* Get the received packets */ eepro_ack_rx(ioaddr); eepro_rx(dev); eepro_en_int(ioaddr); } if (status & TX_INT) { if (net_debug > 4) printk(KERN_DEBUG "%s: packet transmit interrupt.\n", dev->name); eepro_dis_int(ioaddr); /* Process the status of transmitted packets */ eepro_ack_tx(ioaddr); <API key>(dev); eepro_en_int(ioaddr); } } if (net_debug > 5) printk(KERN_DEBUG "%s: exiting eepro_interrupt routine.\n", dev->name); spin_unlock(&lp->lock); return IRQ_RETVAL(handled); } static int eepro_close(struct net_device *dev) { struct eepro_local *lp = netdev_priv(dev); int ioaddr = dev->base_addr; short temp_reg; netif_stop_queue(dev); eepro_sw2bank1(ioaddr); /* Switch back to Bank 1 */ /* Disable the physical interrupt line. */ temp_reg = inb(ioaddr + REG1); outb(temp_reg & 0x7f, ioaddr + REG1); eepro_sw2bank0(ioaddr); /* Switch back to Bank 0 */ /* Flush the Tx and disable Rx. */ outb(STOP_RCV_CMD, ioaddr); lp->tx_start = lp->tx_end = lp->xmt_lower_limit; lp->tx_last = 0; /* Mask all the interrupts. */ eepro_dis_int(ioaddr); /* clear all interrupts */ eepro_clear_int(ioaddr); /* Reset the 82595 */ eepro_reset(ioaddr); /* release the interrupt */ free_irq(dev->irq, dev); /* Update the statistics here. What statistics? */ return 0; } /* Set or clear the multicast filter for this adaptor. */ static void set_multicast_list(struct net_device *dev) { struct eepro_local *lp = netdev_priv(dev); short ioaddr = dev->base_addr; unsigned short mode; struct dev_mc_list *dmi=dev->mc_list; if (dev->flags&(IFF_ALLMULTI|IFF_PROMISC) || dev->mc_count > 63) { eepro_sw2bank2(ioaddr); /* be CAREFUL, BANK 2 now */ mode = inb(ioaddr + REG2); outb(mode | PRMSC_Mode, ioaddr + REG2); mode = inb(ioaddr + REG3); outb(mode, ioaddr + REG3); /* writing reg. 3 to complete the update */ eepro_sw2bank0(ioaddr); /* Return to BANK 0 now */ } else if (dev->mc_count==0 ) { eepro_sw2bank2(ioaddr); /* be CAREFUL, BANK 2 now */ mode = inb(ioaddr + REG2); outb(mode & 0xd6, ioaddr + REG2); /* Turn off Multi-IA and PRMSC_Mode bits */ mode = inb(ioaddr + REG3); outb(mode, ioaddr + REG3); /* writing reg. 3 to complete the update */ eepro_sw2bank0(ioaddr); /* Return to BANK 0 now */ } else { unsigned short status, *eaddrs; int i, boguscount = 0; /* Disable RX and TX interrupts. Necessary to avoid corruption of the HOST_ADDRESS_REG by interrupt service routines. */ eepro_dis_int(ioaddr); eepro_sw2bank2(ioaddr); /* be CAREFUL, BANK 2 now */ mode = inb(ioaddr + REG2); outb(mode | Multi_IA, ioaddr + REG2); mode = inb(ioaddr + REG3); outb(mode, ioaddr + REG3); /* writing reg. 3 to complete the update */ eepro_sw2bank0(ioaddr); /* Return to BANK 0 now */ outw(lp->tx_end, ioaddr + HOST_ADDRESS_REG); outw(MC_SETUP, ioaddr + IO_PORT); outw(0, ioaddr + IO_PORT); outw(0, ioaddr + IO_PORT); outw(6*(dev->mc_count + 1), ioaddr + IO_PORT); for (i = 0; i < dev->mc_count; i++) { eaddrs=(unsigned short *)dmi->dmi_addr; dmi=dmi->next; outw(*eaddrs++, ioaddr + IO_PORT); outw(*eaddrs++, ioaddr + IO_PORT); outw(*eaddrs++, ioaddr + IO_PORT); } eaddrs = (unsigned short *) dev->dev_addr; outw(eaddrs[0], ioaddr + IO_PORT); outw(eaddrs[1], ioaddr + IO_PORT); outw(eaddrs[2], ioaddr + IO_PORT); outw(lp->tx_end, ioaddr + lp->xmt_bar); outb(MC_SETUP, ioaddr); /* Update the transmit queue */ i = lp->tx_end + XMT_HEADER + 6*(dev->mc_count + 1); if (lp->tx_start != lp->tx_end) { /* update the next address and the chain bit in the last packet */ outw(lp->tx_last + XMT_CHAIN, ioaddr + HOST_ADDRESS_REG); outw(i, ioaddr + IO_PORT); outw(lp->tx_last + XMT_COUNT, ioaddr + HOST_ADDRESS_REG); status = inw(ioaddr + IO_PORT); outw(status | CHAIN_BIT, ioaddr + IO_PORT); lp->tx_end = i ; } else { lp->tx_start = lp->tx_end = i ; } /* Acknowledge that the MC setup is done */ do { /* We should be doing this in the eepro_interrupt()! */ SLOW_DOWN; SLOW_DOWN; if (inb(ioaddr + STATUS_REG) & 0x08) { i = inb(ioaddr); outb(0x08, ioaddr + STATUS_REG); if (i & 0x20) { /* command ABORTed */ printk(KERN_NOTICE "%s: multicast setup failed.\n", dev->name); break; } else if ((i & 0x0f) == 0x03) { /* MC-Done */ printk(KERN_DEBUG "%s: set Rx mode to %d address%s.\n", dev->name, dev->mc_count, dev->mc_count > 1 ? "es":""); break; } } } while (++boguscount < 100); /* Re-enable RX and TX interrupts */ eepro_en_int(ioaddr); } if (lp->eepro == LAN595FX_10ISA) { <API key>(ioaddr); } else eepro_en_rx(ioaddr); } /* The horrible routine to read a word from the serial EEPROM. */ /* IMPORTANT - the 82595 will be set to Bank 0 after the eeprom is read */ /* The delay between EEPROM clock transitions. */ #define eeprom_delay() { udelay(40); } #define EE_READ_CMD (6 << 6) static int read_eeprom(int ioaddr, int location, struct net_device *dev) { int i; unsigned short retval = 0; struct eepro_local *lp = netdev_priv(dev); short ee_addr = ioaddr + lp->eeprom_reg; int read_cmd = location | EE_READ_CMD; short ctrl_val = EECS ; /* XXXX - black magic */ eepro_sw2bank1(ioaddr); outb(0x00, ioaddr + STATUS_REG); /* XXXX - black magic */ eepro_sw2bank2(ioaddr); outb(ctrl_val, ee_addr); /* Shift the read command bits out. */ for (i = 8; i >= 0; i short outval = (read_cmd & (1 << i)) ? ctrl_val | EEDI : ctrl_val; outb(outval, ee_addr); outb(outval | EESK, ee_addr); /* EEPROM clock tick. */ eeprom_delay(); outb(outval, ee_addr); /* Finish EEPROM a clock tick. */ eeprom_delay(); } outb(ctrl_val, ee_addr); for (i = 16; i > 0; i outb(ctrl_val | EESK, ee_addr); eeprom_delay(); retval = (retval << 1) | ((inb(ee_addr) & EEDO) ? 1 : 0); outb(ctrl_val, ee_addr); eeprom_delay(); } /* Terminate the EEPROM access. */ ctrl_val &= ~EECS; outb(ctrl_val | EESK, ee_addr); eeprom_delay(); outb(ctrl_val, ee_addr); eeprom_delay(); eepro_sw2bank0(ioaddr); return retval; } static int <API key>(struct net_device *dev, void *buf, short length) { struct eepro_local *lp = netdev_priv(dev); short ioaddr = dev->base_addr; unsigned status, tx_available, last, end; if (net_debug > 5) printk(KERN_DEBUG "%s: entering <API key> routine.\n", dev->name); /* determine how much of the transmit buffer space is available */ if (lp->tx_end > lp->tx_start) tx_available = lp->xmt_ram - (lp->tx_end - lp->tx_start); else if (lp->tx_end < lp->tx_start) tx_available = lp->tx_start - lp->tx_end; else tx_available = lp->xmt_ram; if (((((length + 3) >> 1) << 1) + 2*XMT_HEADER) >= tx_available) { /* No space available ??? */ return 1; } last = lp->tx_end; end = last + (((length + 3) >> 1) << 1) + XMT_HEADER; if (end >= lp->xmt_upper_limit + 2) { /* the transmit buffer is wrapped around */ if ((lp->xmt_upper_limit + 2 - last) <= XMT_HEADER) { /* Arrrr!!!, must keep the xmt header together, several days were lost to chase this one down. */ last = lp->xmt_lower_limit; end = last + (((length + 3) >> 1) << 1) + XMT_HEADER; } else end = lp->xmt_lower_limit + (end - lp->xmt_upper_limit + 2); } outw(last, ioaddr + HOST_ADDRESS_REG); outw(XMT_CMD, ioaddr + IO_PORT); outw(0, ioaddr + IO_PORT); outw(end, ioaddr + IO_PORT); outw(length, ioaddr + IO_PORT); if (lp->version == LAN595) outsw(ioaddr + IO_PORT, buf, (length + 3) >> 1); else { /* LAN595TX or LAN595FX, capable of 32-bit I/O processing */ unsigned short temp = inb(ioaddr + INT_MASK_REG); outb(temp | IO_32_BIT, ioaddr + INT_MASK_REG); outsl(ioaddr + IO_PORT_32_BIT, buf, (length + 3) >> 2); outb(temp & ~(IO_32_BIT), ioaddr + INT_MASK_REG); } /* A dummy read to flush the DRAM write pipeline */ status = inw(ioaddr + IO_PORT); if (lp->tx_start == lp->tx_end) { outw(last, ioaddr + lp->xmt_bar); outb(XMT_CMD, ioaddr); lp->tx_start = last; /* I don't like to change tx_start here */ } else { /* update the next address and the chain bit in the last packet */ if (lp->tx_end != last) { outw(lp->tx_last + XMT_CHAIN, ioaddr + HOST_ADDRESS_REG); outw(last, ioaddr + IO_PORT); } outw(lp->tx_last + XMT_COUNT, ioaddr + HOST_ADDRESS_REG); status = inw(ioaddr + IO_PORT); outw(status | CHAIN_BIT, ioaddr + IO_PORT); /* Continue the transmit command */ outb(RESUME_XMT_CMD, ioaddr); } lp->tx_last = last; lp->tx_end = end; if (net_debug > 5) printk(KERN_DEBUG "%s: exiting <API key> routine.\n", dev->name); return 0; } static void eepro_rx(struct net_device *dev) { struct eepro_local *lp = netdev_priv(dev); short ioaddr = dev->base_addr; short boguscount = 20; short rcv_car = lp->rx_start; unsigned rcv_event, rcv_status, rcv_next_frame, rcv_size; if (net_debug > 5) printk(KERN_DEBUG "%s: entering eepro_rx routine.\n", dev->name); /* Set the read pointer to the start of the RCV */ outw(rcv_car, ioaddr + HOST_ADDRESS_REG); rcv_event = inw(ioaddr + IO_PORT); while (rcv_event == RCV_DONE) { rcv_status = inw(ioaddr + IO_PORT); rcv_next_frame = inw(ioaddr + IO_PORT); rcv_size = inw(ioaddr + IO_PORT); if ((rcv_status & (RX_OK | RX_ERROR)) == RX_OK) { /* Malloc up new buffer. */ struct sk_buff *skb; dev->stats.rx_bytes+=rcv_size; rcv_size &= 0x3fff; skb = dev_alloc_skb(rcv_size+5); if (skb == NULL) { printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name); dev->stats.rx_dropped++; rcv_car = lp->rx_start + RCV_HEADER + rcv_size; lp->rx_start = rcv_next_frame; outw(rcv_next_frame, ioaddr + HOST_ADDRESS_REG); break; } skb_reserve(skb,2); if (lp->version == LAN595) insw(ioaddr+IO_PORT, skb_put(skb,rcv_size), (rcv_size + 3) >> 1); else { /* LAN595TX or LAN595FX, capable of 32-bit I/O processing */ unsigned short temp = inb(ioaddr + INT_MASK_REG); outb(temp | IO_32_BIT, ioaddr + INT_MASK_REG); insl(ioaddr+IO_PORT_32_BIT, skb_put(skb,rcv_size), (rcv_size + 3) >> 2); outb(temp & ~(IO_32_BIT), ioaddr + INT_MASK_REG); } skb->protocol = eth_type_trans(skb,dev); netif_rx(skb); dev->stats.rx_packets++; } else { /* Not sure will ever reach here, I set the 595 to discard bad received frames */ dev->stats.rx_errors++; if (rcv_status & 0x0100) dev->stats.rx_over_errors++; else if (rcv_status & 0x0400) dev->stats.rx_frame_errors++; else if (rcv_status & 0x0800) dev->stats.rx_crc_errors++; printk(KERN_DEBUG "%s: event = %#x, status = %#x, next = %#x, size = %#x\n", dev->name, rcv_event, rcv_status, rcv_next_frame, rcv_size); } if (rcv_status & 0x1000) dev->stats.rx_length_errors++; rcv_car = lp->rx_start + RCV_HEADER + rcv_size; lp->rx_start = rcv_next_frame; if (--boguscount == 0) break; outw(rcv_next_frame, ioaddr + HOST_ADDRESS_REG); rcv_event = inw(ioaddr + IO_PORT); } if (rcv_car == 0) rcv_car = lp->rcv_upper_limit | 0xff; outw(rcv_car - 1, ioaddr + RCV_STOP); if (net_debug > 5) printk(KERN_DEBUG "%s: exiting eepro_rx routine.\n", dev->name); } static void <API key>(struct net_device *dev) { struct eepro_local *lp = netdev_priv(dev); short ioaddr = dev->base_addr; short boguscount = 25; short xmt_status; while ((lp->tx_start != lp->tx_end) && boguscount outw(lp->tx_start, ioaddr + HOST_ADDRESS_REG); xmt_status = inw(ioaddr+IO_PORT); if (!(xmt_status & TX_DONE_BIT)) break; xmt_status = inw(ioaddr+IO_PORT); lp->tx_start = inw(ioaddr+IO_PORT); netif_wake_queue (dev); if (xmt_status & TX_OK) dev->stats.tx_packets++; else { dev->stats.tx_errors++; if (xmt_status & 0x0400) { dev->stats.tx_carrier_errors++; printk(KERN_DEBUG "%s: carrier error\n", dev->name); printk(KERN_DEBUG "%s: XMT status = % dev->name, xmt_status); } else { printk(KERN_DEBUG "%s: XMT status = % dev->name, xmt_status); printk(KERN_DEBUG "%s: XMT status = % dev->name, xmt_status); } } if (xmt_status & 0x000f) { dev->stats.collisions += (xmt_status & 0x000f); } if ((xmt_status & 0x0040) == 0x0) { dev->stats.tx_heartbeat_errors++; } } } static int <API key>(struct net_device *dev, struct ethtool_cmd *cmd) { struct eepro_local *lp = netdev_priv(dev); cmd->supported = <API key> | <API key> | SUPPORTED_Autoneg; cmd->advertising = <API key> | <API key> | ADVERTISED_Autoneg; if (GetBit(lp->word[5], ee_PortTPE)) { cmd->supported |= SUPPORTED_TP; cmd->advertising |= ADVERTISED_TP; } if (GetBit(lp->word[5], ee_PortBNC)) { cmd->supported |= SUPPORTED_BNC; cmd->advertising |= ADVERTISED_BNC; } if (GetBit(lp->word[5], ee_PortAUI)) { cmd->supported |= SUPPORTED_AUI; cmd->advertising |= ADVERTISED_AUI; } cmd->speed = SPEED_10; if (dev->if_port == TPE && lp->word[1] & ee_Duplex) { cmd->duplex = DUPLEX_FULL; } else { cmd->duplex = DUPLEX_HALF; } cmd->port = dev->if_port; cmd->phy_address = dev->base_addr; cmd->transceiver = XCVR_INTERNAL; if (lp->word[0] & ee_AutoNeg) { cmd->autoneg = 1; } return 0; } static void <API key>(struct net_device *dev, struct ethtool_drvinfo *drvinfo) { strcpy(drvinfo->driver, DRV_NAME); strcpy(drvinfo->version, DRV_VERSION); sprintf(drvinfo->bus_info, "ISA 0x%lx", dev->base_addr); } static const struct ethtool_ops eepro_ethtool_ops = { .get_settings = <API key>, .get_drvinfo = <API key>, }; #ifdef MODULE #define MAX_EEPRO 8 static struct net_device *dev_eepro[MAX_EEPRO]; static int io[MAX_EEPRO] = { [0 ... MAX_EEPRO-1] = -1 }; static int irq[MAX_EEPRO]; static int mem[MAX_EEPRO] = { /* Size of the rx buffer in KB */ [0 ... MAX_EEPRO-1] = RCV_DEFAULT_RAM/1024 }; static int autodetect; static int n_eepro; /* For linux 2.1.xx */ MODULE_AUTHOR("Pascal Dupuis and others"); MODULE_DESCRIPTION("Intel i82595 ISA EtherExpressPro10/10+ driver"); MODULE_LICENSE("GPL"); module_param_array(io, int, NULL, 0); module_param_array(irq, int, NULL, 0); module_param_array(mem, int, NULL, 0); module_param(autodetect, int, 0); MODULE_PARM_DESC(io, "EtherExpress Pro/10 I/O base addres(es)"); MODULE_PARM_DESC(irq, "EtherExpress Pro/10 IRQ number(s)"); MODULE_PARM_DESC(mem, "EtherExpress Pro/10 Rx buffer size(es) in kB (3-29)"); MODULE_PARM_DESC(autodetect, "EtherExpress Pro/10 force board(s) detection (0-1)"); int __init init_module(void) { struct net_device *dev; int i; if (io[0] == -1 && autodetect == 0) { printk(KERN_WARNING "eepro_init_module: Probe is very dangerous in ISA boards!\n"); printk(KERN_WARNING "eepro_init_module: Please add \"autodetect=1\" to force probe\n"); return -ENODEV; } else if (autodetect) { /* if autodetect is set then we must force detection */ for (i = 0; i < MAX_EEPRO; i++) { io[i] = 0; } printk(KERN_INFO "eepro_init_module: Auto-detecting boards (May God protect us...)\n"); } for (i = 0; i < MAX_EEPRO && io[i] != -1; i++) { dev = alloc_etherdev(sizeof(struct eepro_local)); if (!dev) break; dev->mem_end = mem[i]; dev->base_addr = io[i]; dev->irq = irq[i]; if (do_eepro_probe(dev) == 0) { dev_eepro[n_eepro++] = dev; continue; } free_netdev(dev); break; } if (n_eepro) printk(KERN_INFO "%s", version); return n_eepro ? 0 : -ENODEV; } void __exit cleanup_module(void) { int i; for (i=0; i<n_eepro; i++) { struct net_device *dev = dev_eepro[i]; unregister_netdev(dev); release_region(dev->base_addr, EEPRO_IO_EXTENT); free_netdev(dev); } } #endif /* MODULE */
#!/bin/bash export "DEBIAN_FRONTEND=noninteractive" VAGRANT_CORE_FOLDER=$(cat "/.puphpet-stuff/vagrant-core-folder.txt") OS=$(/bin/bash "${VAGRANT_CORE_FOLDER}/shell/os-detect.sh" ID) RELEASE=$(/bin/bash "${VAGRANT_CORE_FOLDER}/shell/os-detect.sh" RELEASE) CODENAME=$(/bin/bash "${VAGRANT_CORE_FOLDER}/shell/os-detect.sh" CODENAME) if [[ ! -f /.puphpet-stuff/update-puppet ]]; then if [ "${OS}" == 'debian' ] || [ "${OS}" == 'ubuntu' ]; then echo "Downloading http://apt.puppetlabs.com/puppetlabs-release-${CODENAME}.deb" wget --quiet --tries=5 --connect-timeout=10 -O "/.puphpet-stuff/puppetlabs-release-${CODENAME}.deb" "http://apt.puppetlabs.com/puppetlabs-release-${CODENAME}.deb" echo "Finished downloading http://apt.puppetlabs.com/puppetlabs-release-${CODENAME}.deb" dpkg -i "/.puphpet-stuff/puppetlabs-release-${CODENAME}.deb" >/dev/null echo "Running update-puppet apt-get update" apt-get update >/dev/null echo "Finished running update-puppet apt-get update" echo "Updating Puppet to version 3.4.x" apt-get install -y puppet=3.4.3-1puppetlabs1 puppet-common=3.4.3-1puppetlabs1 >/dev/null PUPPET_VERSION=$(puppet help | grep 'Puppet v') echo "Finished updating puppet to latest version: ${PUPPET_VERSION}" touch /.puphpet-stuff/update-puppet echo "Created empty file /.puphpet-stuff/update-puppet" elif [ "${OS}" == 'centos' ]; then echo "Downloading http://yum.puppetlabs.com/el/${RELEASE}/products/x86_64/puppet-3.4.3-1.el6.noarch.rpm" yum -y --nogpgcheck install "http://yum.puppetlabs.com/el/${RELEASE}/products/x86_64/puppet-3.4.3-1.el6.noarch.rpm" >/dev/null echo "Finished downloading http://yum.puppetlabs.com/el/${RELEASE}/products/x86_64/puppet-3.4.3-1.el6.noarch.rpm" echo "Installing/Updating Puppet to version 3.4.x" yum -y install puppet >/dev/null PUPPET_VERSION=$(puppet help | grep 'Puppet v') echo "Finished installing/updating puppet to version: ${PUPPET_VERSION}" touch /.puphpet-stuff/update-puppet echo "Created empty file /.puphpet-stuff/update-puppet" fi fi
(function (_, $, Backbone, Drupal, drupalSettings) { "use strict"; /** * State of an in-place editable entity in the DOM. */ Drupal.edit.EntityModel = Drupal.edit.BaseModel.extend({ defaults: { // The DOM element that represents this entity. It may seem bizarre to // have a DOM element in a Backbone Model, but we need to be able to map // entities in the DOM to EntityModels in memory. el: null, // An entity ID, of the form "<entity type>/<entity ID>", e.g. "node/1". entityID: null, // An entity instance ID. The first intance of a specific entity (i.e. with // a given entity ID) is assigned 0, the second 1, and so on. entityInstanceID: null, // The unique ID of this entity instance on the page, of the form "<entity // type>/<entity ID>[entity instance ID]", e.g. "node/1[0]". id: null, // The label of the entity. label: null, // A Drupal.edit.FieldCollection for all fields of this entity. fields: null, // The attributes below are stateful. The ones above will never change // during the life of a EntityModel instance. // Indicates whether this instance of this entity is currently being // edited in-place. isActive: false, // Whether one or more fields have already been stored in TempStore. inTempStore: false, // Whether one or more fields have already been stored in TempStore *or* // the field that's currently being edited is in the 'changed' or a later // state. In other words, this boolean indicates whether a "Save" button is // necessary or not. isDirty: false, // Whether the request to the server has been made to commit this entity. // Used to prevent multiple such requests. isCommitting: false, // The current processing state of an entity. state: 'closed', // The IDs of the fields whose new values have been stored in TempStore. We // must store this on the EntityModel as well (even though it already is on // the FieldModel) because when a field is rerendered, its FieldModel is // destroyed and this allows us to transition it back to the proper state. fieldsInTempStore: [], // A flag the tells the application that this EntityModel must be reloaded // in order to restore the original values to its fields in the client. reload: false }, /** * @inheritdoc */ initialize: function () { this.set('fields', new Drupal.edit.FieldCollection()); // Respond to entity state changes. this.listenTo(this, 'change:state', this.stateChange); // The state of the entity is largely dependent on the state of its // fields. this.listenTo(this.get('fields'), 'change:state', this.fieldStateChange); // Call Drupal.edit.BaseModel's initialize() method. Drupal.edit.BaseModel.prototype.initialize.call(this); }, /** * Updates FieldModels' states when an EntityModel change occurs. * * @param Drupal.edit.EntityModel entityModel * @param String state * The state of the associated entity. One of Drupal.edit.EntityModel.states. * @param Object options */ stateChange: function (entityModel, state, options) { var to = state; switch (to) { case 'closed': this.set({ 'isActive': false, 'inTempStore': false, 'isDirty': false }); break; case 'launching': break; case 'opening': // Set the fields to candidate state. entityModel.get('fields').each(function (fieldModel) { fieldModel.set('state', 'candidate', options); }); break; case 'opened': // The entity is now ready for editing! this.set('isActive', true); break; case 'committing': // The user indicated they want to save the entity. var fields = this.get('fields'); // For fields that are in an active state, transition them to candidate. fields.chain() .filter(function (fieldModel) { return _.intersection([fieldModel.get('state')], ['active']).length; }) .each(function (fieldModel) { fieldModel.set('state', 'candidate'); }); // For fields that are in a changed state, field values must first be // stored in TempStore. fields.chain() .filter(function (fieldModel) { return _.intersection([fieldModel.get('state')], Drupal.edit.app.changedFieldStates).length; }) .each(function (fieldModel) { fieldModel.set('state', 'saving'); }); break; case 'deactivating': var changedFields = this.get('fields') .filter(function (fieldModel) { return _.intersection([fieldModel.get('state')], ['changed', 'invalid']).length; }); // If the entity contains unconfirmed or unsaved changes, return the // entity to an opened state and ask the user if they would like to save // the changes or discard the changes. // 1. One of the fields is in a changed state. The changed field might // just be a change in the client or it might have been saved to // tempstore. // 2. The saved flag is empty and the confirmed flag is empty. If the // entity has been saved to the server, the fields changed in the // client are irrelevant. If the changes are confirmed, then proceed // to set the fields to candidate state. if ((changedFields.length || this.get('fieldsInTempStore').length) && (!options.saved && !options.confirmed)) { // Cancel deactivation until the user confirms save or discard. this.set('state', 'opened', {confirming: true}); // An action in reaction to state change must be deferred. _.defer(function () { Drupal.edit.app.<API key>(entityModel); }); } else { var invalidFields = this.get('fields') .filter(function (fieldModel) { return _.intersection([fieldModel.get('state')], ['invalid']).length; }); // Indicate if this EntityModel needs to be reloaded in order to // restore the original values of its fields. entityModel.set('reload', (this.get('fieldsInTempStore').length || invalidFields.length)); // Set all fields to the 'candidate' state. A changed field may have to // go through confirmation first. entityModel.get('fields').each(function (fieldModel) { // If the field is already in the candidate state, trigger a change // event so that the entityModel can move to the next state in // deactivation. if (_.intersection([fieldModel.get('state')], ['candidate', 'highlighted']).length) { fieldModel.trigger('change:state', fieldModel, fieldModel.get('state'), options); } else { fieldModel.set('state', 'candidate', options); } }); } break; case 'closing': // Set all fields to the 'inactive' state. options.reason = 'stop'; this.get('fields').each(function (fieldModel) { fieldModel.set({ 'inTempStore': false, 'state': 'inactive' }, options); }); break; } }, /** * Updates a Field and Entity model's "inTempStore" when appropriate. * * Helper function. * * @param Drupal.edit.EntityModel entityModel * The model of the entity for which a field's state attribute has changed. * @param Drupal.edit.FieldModel fieldModel * The model of the field whose state attribute has changed. * * @see fieldStateChange() */ <API key>: function (entityModel, fieldModel) { var current = fieldModel.get('state'); var previous = fieldModel.previous('state'); var fieldsInTempStore = entityModel.get('fieldsInTempStore'); // If the fieldModel changed to the 'saved' state: remember that this // field was saved to TempStore. if (current === 'saved') { // Mark the entity as saved in TempStore, so that we can pass the // proper "reset TempStore" boolean value when communicating with the // server. entityModel.set('inTempStore', true); // Mark the field as saved in TempStore, so that visual indicators // signifying just that may be rendered. fieldModel.set('inTempStore', true); // Remember that this field is in TempStore, restore when rerendered. fieldsInTempStore.push(fieldModel.get('fieldID')); fieldsInTempStore = _.uniq(fieldsInTempStore); entityModel.set('fieldsInTempStore', fieldsInTempStore); } // If the fieldModel changed to the 'candidate' state from the // 'inactive' state, then this is a field for this entity that got // rerendered. Restore its previous 'inTempStore' attribute value. else if (current === 'candidate' && previous === 'inactive') { fieldModel.set('inTempStore', _.intersection([fieldModel.get('fieldID')], fieldsInTempStore).length > 0); } }, /** * Reacts to state changes in this entity's fields. * * @param Drupal.edit.FieldModel fieldModel * The model of the field whose state attribute changed. * @param String state * The state of the associated field. One of Drupal.edit.FieldModel.states. */ fieldStateChange: function (fieldModel, state) { var entityModel = this; var fieldState = state; // Switch on the entityModel state. // The EntityModel responds to FieldModel state changes as a function of its // state. For example, a field switching back to 'candidate' state when its // entity is in the 'opened' state has no effect on the entity. But that // same switch back to 'candidate' state of a field when the entity is in // the 'committing' state might allow the entity to proceed with the commit // flow. switch (this.get('state')) { case 'closed': case 'launching': // It should be impossible to reach these: fields can't change state // while the entity is closed or still launching. break; case 'opening': // We must change the entity to the 'opened' state, but it must first be // confirmed that all of its fieldModels have transitioned to the // 'candidate' state. // We do this here, because this is called every time a fieldModel // changes state, hence each time this is called, we get closer to the // goal of having all fieldModels in the 'candidate' state. // A state change in reaction to another state change must be deferred. _.defer(function () { entityModel.set('state', 'opened', { 'accept-field-states': Drupal.edit.app.readyFieldStates }); }); break; case 'opened': // Set the isDirty attribute when appropriate so that it is known when // to display the "Save" button in the entity toolbar. // Note that once a field has been changed, there's no way to discard // that change, hence it will have to be saved into TempStore, or the // in-place editing of this field will have to be stopped completely. // In other words: once any field enters the 'changed' field, then for // the remainder of the in-place editing session, the entity is by // definition dirty. if (fieldState === 'changed') { entityModel.set('isDirty', true); } else { this.<API key>(entityModel, fieldModel); } break; case 'committing': // If the field save returned a validation error, set the state of the // entity back to 'opened'. if (fieldState === 'invalid') { // A state change in reaction to another state change must be deferred. _.defer(function() { entityModel.set('state', 'opened', { reason: 'invalid' }); }); } else { this.<API key>(entityModel, fieldModel); } // Attempt to save the entity. If the entity's fields are not yet all in // a ready state, the save will not be processed. var options = { 'accept-field-states': Drupal.edit.app.readyFieldStates }; if (entityModel.set('isCommitting', true, options)) { entityModel.save({ success: function () { entityModel.set({ 'state': 'deactivating', 'isCommitting' : false }, {'saved': true}); }, error: function () { // Reset the "isCommitting" mutex. entityModel.set('isCommitting', false); // Change the state back to "opened", to allow the user to hit the // "Save" button again. entityModel.set('state', 'opened', { reason: 'networkerror' }); // Show a modal to inform the user of the network error. var message = Drupal.t('Your changes to <q>@entity-title</q> could not be saved, either due to a website problem or a network connection problem.<br>Please try again.', { '@entity-title' : entityModel.get('label') }); Drupal.edit.util.networkErrorModal(Drupal.t('Sorry!'), message); } }); } break; case 'deactivating': // When setting the entity to 'closing', require that all fieldModels // are in either the 'candidate' or 'highlighted' state. // A state change in reaction to another state change must be deferred. _.defer(function() { entityModel.set('state', 'closing', { 'accept-field-states': Drupal.edit.app.readyFieldStates }); }); break; case 'closing': // When setting the entity to 'closed', require that all fieldModels are // in the 'inactive' state. // A state change in reaction to another state change must be deferred. _.defer(function() { entityModel.set('state', 'closed', { 'accept-field-states': ['inactive'] }); }); break; } }, /** * Fires an AJAX request to the REST save URL for an entity. * * @param options * An object of options that contains: * - success: (optional) A function to invoke if the entity is success- * fully saved. */ save: function (options) { var entityModel = this; var id = 'edit-save-entity'; // Create a temporary element to be able to use Drupal.ajax. var $el = $('#edit-entity-toolbar').find('.action-save'); // This is the span element inside the button. // Create a Drupal.ajax instance to save the entity. var entitySaverAjax = new Drupal.ajax(id, $el, { url: Drupal.edit.util.buildUrl(entityModel.get('entityID'), drupalSettings.edit.entitySaveURL), event: 'edit-save.edit', progress: { type: 'none' }, error: function () { $el.off('edit-save.edit'); // Let the Drupal.edit.EntityModel Backbone model's error() method // handle errors. options.error.call(entityModel); } }); entitySaverAjax.commands = {}; // Entity saved successfully. entitySaverAjax.commands.editEntitySaved = function(ajax, response, status) { // Clean up. $(ajax.element).off('edit-save.edit'); // All fields have been moved from TempStore to permanent storage, update // the "inTempStore" attribute on FieldModels, on the EntityModel and // clear EntityModel's "fieldInTempStore" attribute. entityModel.get('fields').each(function (fieldModel) { fieldModel.set('inTempStore', false); }); entityModel.set('inTempStore', false); entityModel.set('fieldsInTempStore', []); // Invoke the optional success callback. if (options.success) { options.success.call(entityModel); } }; // Trigger the AJAX request, which will will return the editEntitySaved AJAX // command to which we then react. $el.trigger('edit-save.edit'); }, /** * {@inheritdoc} * * @param Object attrs * The attributes changes in the save or set call. * @param Object options * An object with the following option: * - String reason (optional): a string that conveys a particular reason * to allow for an exceptional state change. * - Array accept-field-states (optional) An array of strings that * represent field states that the entities must be in to validate. For * example, if accept-field-states is ['candidate', 'highlighted'], then * all the fields of the entity must be in either of these two states * for the save or set call to validate and proceed. */ validate: function (attrs, options) { var acceptedFieldStates = options['accept-field-states'] || []; // Validate state change. var currentState = this.get('state'); var nextState = attrs.state; if (currentState !== nextState) { // Ensure it's a valid state. if (_.indexOf(this.constructor.states, nextState) === -1) { return '"' + nextState + '" is an invalid state'; } // Ensure it's a state change that is allowed. // Check if the acceptStateChange function accepts it. if (!this._acceptStateChange(currentState, nextState, options)) { return 'state change not accepted'; } // If that function accepts it, then ensure all fields are also in an // acceptable state. else if (!this.<API key>(acceptedFieldStates)) { return 'state change not accepted because fields are not in acceptable state'; } } // Validate setting isCommitting = true. var currentIsCommitting = this.get('isCommitting'); var nextIsCommitting = attrs.isCommitting; if (currentIsCommitting === false && nextIsCommitting === true) { if (!this.<API key>(acceptedFieldStates)) { return 'isCommitting change not accepted because fields are not in acceptable state'; } } else if (currentIsCommitting === true && nextIsCommitting === true) { return "isCommiting is a mutex, hence only changes are allowed"; } }, // Like @see AppView.<API key>() _acceptStateChange: function (from, to, context) { var accept = true; // In general, enforce the states sequence. Disallow going back from a // "later" state to an "earlier" state, except in explicitly allowed // cases. if (!this.constructor.<API key>(from, to)) { accept = false; // Allow: closing -> closed. // Necessary to stop editing an entity. if (from === 'closing' && to === 'closed') { accept = true; } // Allow: committing -> opened. // Necessary to be able to correct an invalid field, or to hit the "Save" // button again after a server/network error. else if (from === 'committing' && to === 'opened' && context.reason && (context.reason === 'invalid' || context.reason === 'networkerror')) { accept = true; } // Allow: deactivating -> opened. // Necessary to be able to confirm changes with the user. else if (from === 'deactivating' && to === 'opened' && context.confirming) { accept = true; } // Allow: opened -> deactivating. // Necessary to be able to stop editing. else if (from === 'opened' && to === 'deactivating' && context.confirmed) { accept = true; } } return accept; }, /** * @param Array acceptedFieldStates * @see validate() * @return Boolean */ <API key>: function (acceptedFieldStates) { var accept = true; // If no acceptable field states are provided, assume all field states are // acceptable. We want to let validation pass as a default and only // check validity on calls to set that explicitly request it. if (acceptedFieldStates.length > 0) { var fieldStates = this.get('fields').pluck('state') || []; // If not all fields are in one of the accepted field states, then we // still can't allow this state change. if (_.difference(fieldStates, acceptedFieldStates).length) { accept = false; } } return accept; }, /** * @inheritdoc */ destroy: function (options) { Drupal.edit.BaseModel.prototype.destroy.call(this, options); this.stopListening(); // Destroy all fields of this entity. this.get('fields').each(function (fieldModel) { fieldModel.destroy(); }); }, /** * {@inheritdoc} */ sync: function () { // We don't use REST updates to sync. return; } }, { /** * A list (sequence) of all possible states an entity can be in during * in-place editing. */ states: [ // Initial state, like field's 'inactive' OR the user has just finished // in-place editing this entity. // - Trigger: none (initial) or EntityModel (finished). // - Expected behavior: (when not initial state): tear down // EntityToolbarView, in-place editors and related views. 'closed', // User has activated in-place editing of this entity. // - Trigger: user. // - Expected behavior: the EntityToolbarView is gets set up, in-place // editors (EditorViews) and related views for this entity's fields are // set up. Upon completion of those, the state is changed to 'opening'. 'launching', // Launching has finished. // - Trigger: application. // - Guarantees: in-place editors ready for use, all entity and field views // have been set up, all fields are in the 'inactive' state. // - Expected behavior: all fields are changed to the 'candidate' state and // once this is completed, the entity state will be changed to 'opened'. 'opening', // Opening has finished. // - Trigger: EntityModel. // - Guarantees: see 'opening', all fields are in the 'candidate' state. // - Expected behavior: the user is able to actually use in-place editing. 'opened', // User has clicked the 'Save' button (and has thus changed at least one // field). // - Trigger: user. // - Guarantees: see 'opened', plus: either a changed field is in TempStore, // or the user has just modified a field without activating (switching to) // another field. // - Expected behavior: 1) if any of the fields are not yet in TempStore, // save them to TempStore, 2) if then any of the fields has the 'invalid' // state, then change the entity state back to 'opened', otherwise: save // the entity by committing it from TempStore into permanent storage. 'committing', // User has clicked the 'Close' button, or has clicked the 'Save' button and // that was successfully completed. // - Trigger: user or EntityModel. // - Guarantees: when having clicked 'Close' hardly any: fields may be in a // variety of states; when having clicked 'Save': all fields are in the // 'candidate' state. // - Expected behavior: transition all fields to the 'candidate' state, // possibly requiring confirmation in the case of having clicked 'Close'. 'deactivating', // Deactivation has been completed. // - Trigger: EntityModel. // - Guarantees: all fields are in the 'candidate' state. // - Expected behavior: change all fields to the 'inactive' state. 'closing' ], /** * Indicates whether the 'from' state comes before the 'to' state. * * @param String from * One of Drupal.edit.EntityModel.states. * @param String to * One of Drupal.edit.EntityModel.states. * @return Boolean */ <API key>: function (from, to) { return _.indexOf(this.states, from) < _.indexOf(this.states, to); } }); Drupal.edit.EntityCollection = Backbone.Collection.extend({ model: Drupal.edit.EntityModel }); }(_, jQuery, Backbone, Drupal, Drupal.settings));
.wp-block-file{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;margin-bottom:0}.wp-block[data-align=left]>.wp-block-file,.wp-block[data-align=right]>.wp-block-file{height:auto}.wp-block-file .<API key>{margin-bottom:1em}.wp-block-file .<API key>{margin-bottom:1em;width:100%;height:100%}.wp-block-file .<API key>{position:absolute;top:0;left:0;bottom:0;right:0}.wp-block-file .<API key>{flex-grow:1}.wp-block-file a{min-width:1em}.wp-block-file .<API key>{display:inline-block;margin-right:.75em}
// <API key>: GPL-2.0-only #include "qla_def.h" #include "qla_gbl.h" #include <linux/delay.h> #include <linux/slab.h> #include <linux/vmalloc.h> #include "qla_devtbl.h" #ifdef CONFIG_SPARC #include <asm/prom.h> #endif #include "qla_target.h" /* * QLogic ISP2x00 Hardware Support Function Prototypes. */ static int <API key>(scsi_qla_host_t *); static int qla2x00_setup_chip(scsi_qla_host_t *); static int qla2x00_fw_ready(scsi_qla_host_t *); static int <API key>(scsi_qla_host_t *); static int <API key>(scsi_qla_host_t *); static int <API key>(scsi_qla_host_t *); static int <API key>(scsi_qla_host_t *); static int <API key>(scsi_qla_host_t *); static int qla2x00_restart_isp(scsi_qla_host_t *); static struct qla_chip_state_84xx *qla84xx_get_chip(struct scsi_qla_host *); static int qla84xx_init_chip(scsi_qla_host_t *); static int qla25xx_init_queues(struct qla_hw_data *); static int <API key>(struct scsi_qla_host*, fc_port_t *); static void <API key>(scsi_qla_host_t *vha, struct event_arg *ea); static void <API key>(struct scsi_qla_host *, struct event_arg *); static void <API key>(scsi_qla_host_t *, struct event_arg *); void qla2x00_sp_timeout(struct timer_list *t) { srb_t *sp = from_timer(sp, t, u.iocb_cmd.timer); struct srb_iocb *iocb; WARN_ON(irqs_disabled()); iocb = &sp->u.iocb_cmd; iocb->timeout(sp); } void qla2x00_sp_free(srb_t *sp) { struct srb_iocb *iocb = &sp->u.iocb_cmd; del_timer(&iocb->timer); qla2x00_rel_sp(sp); } void <API key>(srb_t *sp, int res) { WARN_ONCE(1, "Calling done() of an already freed srb %p object\n", sp); } void <API key>(srb_t *sp) { WARN_ONCE(1, "Calling free() of an already freed srb %p object\n", sp); } unsigned long <API key>(struct scsi_qla_host *vha) { unsigned long tmo; struct qla_hw_data *ha = vha->hw; /* Firmware should use switch negotiated r_a_tov for timeout. */ tmo = ha->r_a_tov / 10 * 2; if (IS_QLAFX00(ha)) { tmo = FX00_DEF_RATOV * 2; } else if (!IS_FWI2_CAPABLE(ha)) { /* * Except for earlier ISPs where the timeout is seeded from the * initialization control block. */ tmo = ha->login_timeout; } return tmo; } static void <API key>(void *data) { srb_t *sp = data; struct srb_iocb *abt = &sp->u.iocb_cmd; struct qla_qpair *qpair = sp->qpair; u32 handle; unsigned long flags; if (sp->cmd_sp) ql_dbg(ql_dbg_async, sp->vha, 0x507c, "Abort timeout - cmd hdl=%x, cmd type=%x hdl=%x, type=%x\n", sp->cmd_sp->handle, sp->cmd_sp->type, sp->handle, sp->type); else ql_dbg(ql_dbg_async, sp->vha, 0x507c, "Abort timeout 2 - hdl=%x, type=%x\n", sp->handle, sp->type); spin_lock_irqsave(qpair->qp_lock_ptr, flags); for (handle = 1; handle < qpair->req-><API key>; handle++) { if (sp->cmd_sp && (qpair->req->outstanding_cmds[handle] == sp->cmd_sp)) qpair->req->outstanding_cmds[handle] = NULL; /* removing the abort */ if (qpair->req->outstanding_cmds[handle] == sp) { qpair->req->outstanding_cmds[handle] = NULL; break; } } <API key>(qpair->qp_lock_ptr, flags); if (sp->cmd_sp) sp->cmd_sp->done(sp->cmd_sp, <API key>); abt->u.abt.comp_status = cpu_to_le16(CS_TIMEOUT); sp->done(sp, <API key>); } static void <API key>(srb_t *sp, int res) { struct srb_iocb *abt = &sp->u.iocb_cmd; srb_t *orig_sp = sp->cmd_sp; if (orig_sp) <API key>(orig_sp); del_timer(&sp->u.iocb_cmd.timer); if (sp->flags & SRB_WAKEUP_ON_COMP) complete(&abt->u.abt.comp); else sp->free(sp); } int <API key>(srb_t *cmd_sp, bool wait) { scsi_qla_host_t *vha = cmd_sp->vha; struct srb_iocb *abt_iocb; srb_t *sp; int rval = QLA_FUNCTION_FAILED; sp = <API key>(cmd_sp->vha, cmd_sp->qpair, cmd_sp->fcport, GFP_ATOMIC); if (!sp) return rval; abt_iocb = &sp->u.iocb_cmd; sp->type = SRB_ABT_CMD; sp->name = "abort"; sp->qpair = cmd_sp->qpair; sp->cmd_sp = cmd_sp; if (wait) sp->flags = SRB_WAKEUP_ON_COMP; abt_iocb->timeout = <API key>; init_completion(&abt_iocb->u.abt.comp); /* FW can send 2 x ABTS's timeout/20s */ qla2x00_init_timer(sp, 42); abt_iocb->u.abt.cmd_hndl = cmd_sp->handle; abt_iocb->u.abt.req_que_no = cpu_to_le16(cmd_sp->qpair->req->id); sp->done = <API key>; ql_dbg(ql_dbg_async, vha, 0x507c, "Abort command issued - hdl=%x, type=%x\n", cmd_sp->handle, cmd_sp->type); rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { sp->free(sp); return rval; } if (wait) { wait_for_completion(&abt_iocb->u.abt.comp); rval = abt_iocb->u.abt.comp_status == CS_COMPLETE ? QLA_SUCCESS : QLA_FUNCTION_FAILED; sp->free(sp); } return rval; } void <API key>(void *data) { srb_t *sp = data; fc_port_t *fcport = sp->fcport; struct srb_iocb *lio = &sp->u.iocb_cmd; int rc, h; unsigned long flags; if (fcport) { ql_dbg(ql_dbg_disc, fcport->vha, 0x2071, "Async-%s timeout - hdl=%x portid=%06x %8phC.\n", sp->name, sp->handle, fcport->d_id.b24, fcport->port_name); fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); } else { pr_info("Async-%s timeout - hdl=%x.\n", sp->name, sp->handle); } switch (sp->type) { case SRB_LOGIN_CMD: rc = <API key>(sp, false); if (rc) { /* Retry as needed. */ lio->u.logio.data[0] = MBS_COMMAND_ERROR; lio->u.logio.data[1] = lio->u.logio.flags & SRB_LOGIN_RETRIED ? <API key> : 0; spin_lock_irqsave(sp->qpair->qp_lock_ptr, flags); for (h = 1; h < sp->qpair->req-><API key>; h++) { if (sp->qpair->req->outstanding_cmds[h] == sp) { sp->qpair->req->outstanding_cmds[h] = NULL; break; } } <API key>(sp->qpair->qp_lock_ptr, flags); sp->done(sp, <API key>); } break; case SRB_LOGOUT_CMD: case SRB_CT_PTHRU_CMD: case SRB_MB_IOCB: case SRB_NACK_PLOGI: case SRB_NACK_PRLI: case SRB_NACK_LOGO: case SRB_CTRL_VP: default: rc = <API key>(sp, false); if (rc) { spin_lock_irqsave(sp->qpair->qp_lock_ptr, flags); for (h = 1; h < sp->qpair->req-><API key>; h++) { if (sp->qpair->req->outstanding_cmds[h] == sp) { sp->qpair->req->outstanding_cmds[h] = NULL; break; } } <API key>(sp->qpair->qp_lock_ptr, flags); sp->done(sp, <API key>); } break; } } static void <API key>(srb_t *sp, int res) { struct scsi_qla_host *vha = sp->vha; struct srb_iocb *lio = &sp->u.iocb_cmd; struct event_arg ea; ql_dbg(ql_dbg_disc, vha, 0x20dd, "%s %8phC res %d \n", __func__, sp->fcport->port_name, res); sp->fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); if (!test_bit(UNLOADING, &vha->dpc_flags)) { memset(&ea, 0, sizeof(ea)); ea.fcport = sp->fcport; ea.data[0] = lio->u.logio.data[0]; ea.data[1] = lio->u.logio.data[1]; ea.iop[0] = lio->u.logio.iop[0]; ea.iop[1] = lio->u.logio.iop[1]; ea.sp = sp; <API key>(vha, &ea); } sp->free(sp); } static inline bool fcport_is_smaller(fc_port_t *fcport) { if (wwn_to_u64(fcport->port_name) < wwn_to_u64(fcport->vha->port_name)) return true; else return false; } static inline bool fcport_is_bigger(fc_port_t *fcport) { return !fcport_is_smaller(fcport); } int qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport, uint16_t *data) { srb_t *sp; struct srb_iocb *lio; int rval = QLA_FUNCTION_FAILED; if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT) || fcport->loop_id == FC_NO_LOOP_ID) { ql_log(ql_log_warn, vha, 0xffff, "%s: %8phC - not sending command.\n", __func__, fcport->port_name); return rval; } sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); if (!sp) goto done; <API key>(fcport, DSC_LOGIN_PEND); fcport->flags |= FCF_ASYNC_SENT; fcport->logout_completed = 0; sp->type = SRB_LOGIN_CMD; sp->name = "login"; sp->gen1 = fcport->rscn_gen; sp->gen2 = fcport->login_gen; lio = &sp->u.iocb_cmd; lio->timeout = <API key>; qla2x00_init_timer(sp, <API key>(vha) + 2); sp->done = <API key>; if (N2N_TOPO(fcport->vha->hw) && fcport_is_bigger(fcport)) lio->u.logio.flags |= SRB_LOGIN_PRLI_ONLY; else lio->u.logio.flags |= <API key>; if (NVME_TARGET(vha->hw, fcport)) lio->u.logio.flags |= SRB_LOGIN_SKIP_PRLI; ql_log(ql_log_warn, vha, 0x2072, "Async-login - %8phC hdl=%x, loopid=%x portid=%02x%02x%02x retries=%d.\n", fcport->port_name, sp->handle, fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa, fcport->login_retry); rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { fcport->flags |= FCF_LOGIN_NEEDED; set_bit(RELOGIN_NEEDED, &vha->dpc_flags); goto done_free_sp; } return rval; done_free_sp: sp->free(sp); fcport->flags &= ~FCF_ASYNC_SENT; done: fcport->flags &= ~FCF_ASYNC_ACTIVE; return rval; } static void <API key>(srb_t *sp, int res) { sp->fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); sp->fcport->login_gen++; <API key>(sp->fcport, res); sp->free(sp); } int <API key>(struct scsi_qla_host *vha, fc_port_t *fcport) { srb_t *sp; struct srb_iocb *lio; int rval = QLA_FUNCTION_FAILED; fcport->flags |= FCF_ASYNC_SENT; sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); if (!sp) goto done; sp->type = SRB_LOGOUT_CMD; sp->name = "logout"; lio = &sp->u.iocb_cmd; lio->timeout = <API key>; qla2x00_init_timer(sp, <API key>(vha) + 2); sp->done = <API key>; ql_dbg(ql_dbg_disc, vha, 0x2070, "Async-logout - hdl=%x loop-id=%x portid=%02x%02x%02x %8phC.\n", sp->handle, fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa, fcport->port_name); rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) goto done_free_sp; return rval; done_free_sp: sp->free(sp); done: fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); return rval; } void <API key>(struct scsi_qla_host *vha, fc_port_t *fcport, uint16_t *data) { fcport->flags &= ~FCF_ASYNC_ACTIVE; /* Don't re-login in target mode */ if (!fcport->tgt_session) <API key>(vha, fcport, 1); <API key>(fcport, data[0]); } static void <API key>(srb_t *sp, int res) { struct srb_iocb *lio = &sp->u.iocb_cmd; struct scsi_qla_host *vha = sp->vha; sp->fcport->flags &= ~FCF_ASYNC_ACTIVE; if (!test_bit(UNLOADING, &vha->dpc_flags)) <API key>(sp->fcport->vha, sp->fcport, lio->u.logio.data); sp->free(sp); } int qla2x00_async_prlo(struct scsi_qla_host *vha, fc_port_t *fcport) { srb_t *sp; struct srb_iocb *lio; int rval; rval = QLA_FUNCTION_FAILED; sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); if (!sp) goto done; sp->type = SRB_PRLO_CMD; sp->name = "prlo"; lio = &sp->u.iocb_cmd; lio->timeout = <API key>; qla2x00_init_timer(sp, <API key>(vha) + 2); sp->done = <API key>; ql_dbg(ql_dbg_disc, vha, 0x2070, "Async-prlo - hdl=%x loop-id=%x portid=%02x%02x%02x.\n", sp->handle, fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa); rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) goto done_free_sp; return rval; done_free_sp: sp->free(sp); done: fcport->flags &= ~FCF_ASYNC_ACTIVE; return rval; } static void <API key>(scsi_qla_host_t *vha, struct event_arg *ea) { struct fc_port *fcport = ea->fcport; ql_dbg(ql_dbg_disc, vha, 0x20d2, "%s %8phC DS %d LS %d rc %d login %d|%d rscn %d|%d lid %d\n", __func__, fcport->port_name, fcport->disc_state, fcport->fw_login_state, ea->rc, fcport->login_gen, ea->sp->gen2, fcport->rscn_gen, ea->sp->gen1, fcport->loop_id); WARN_ONCE(!<API key>(ea->data[0]), "mbs: % ea->data[0]); if (ea->data[0] != <API key>) { ql_dbg(ql_dbg_disc, vha, 0x2066, "%s %8phC: adisc fail: post delete\n", __func__, ea->fcport->port_name); /* deleted = 0 & logout_on_delete = force fw cleanup */ fcport->deleted = 0; fcport->logout_on_delete = 1; <API key>(ea->fcport); return; } if (ea->fcport->disc_state == DSC_DELETE_PEND) return; if (ea->sp->gen2 != ea->fcport->login_gen) { /* target side must have changed it. */ ql_dbg(ql_dbg_disc, vha, 0x20d3, "%s %8phC generation changed\n", __func__, ea->fcport->port_name); return; } else if (ea->sp->gen1 != ea->fcport->rscn_gen) { qla_rscn_replay(fcport); <API key>(fcport); return; } <API key>(vha, ea); } static int <API key>(struct scsi_qla_host *vha, fc_port_t *fcport) { struct qla_work_evt *e; e = qla2x00_alloc_work(vha, QLA_EVT_ELS_PLOGI); if (!e) return QLA_FUNCTION_FAILED; e->u.fcport.fcport = fcport; fcport->flags |= FCF_ASYNC_ACTIVE; <API key>(fcport, DSC_LOGIN_PEND); return qla2x00_post_work(vha, e); } static void <API key>(srb_t *sp, int res) { struct scsi_qla_host *vha = sp->vha; struct event_arg ea; struct srb_iocb *lio = &sp->u.iocb_cmd; ql_dbg(ql_dbg_disc, vha, 0x2066, "Async done-%s res %x %8phC\n", sp->name, res, sp->fcport->port_name); sp->fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); memset(&ea, 0, sizeof(ea)); ea.rc = res; ea.data[0] = lio->u.logio.data[0]; ea.data[1] = lio->u.logio.data[1]; ea.iop[0] = lio->u.logio.iop[0]; ea.iop[1] = lio->u.logio.iop[1]; ea.fcport = sp->fcport; ea.sp = sp; <API key>(vha, &ea); sp->free(sp); } int qla2x00_async_adisc(struct scsi_qla_host *vha, fc_port_t *fcport, uint16_t *data) { srb_t *sp; struct srb_iocb *lio; int rval = QLA_FUNCTION_FAILED; if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT)) return rval; fcport->flags |= FCF_ASYNC_SENT; sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); if (!sp) goto done; sp->type = SRB_ADISC_CMD; sp->name = "adisc"; lio = &sp->u.iocb_cmd; lio->timeout = <API key>; sp->gen1 = fcport->rscn_gen; sp->gen2 = fcport->login_gen; qla2x00_init_timer(sp, <API key>(vha) + 2); sp->done = <API key>; if (data[1] & <API key>) lio->u.logio.flags |= SRB_LOGIN_RETRIED; ql_dbg(ql_dbg_disc, vha, 0x206f, "Async-adisc - hdl=%x loopid=%x portid=%06x %8phC.\n", sp->handle, fcport->loop_id, fcport->d_id.b24, fcport->port_name); rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) goto done_free_sp; return rval; done_free_sp: sp->free(sp); done: fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); <API key>(vha, fcport, data); return rval; } static bool <API key>(scsi_qla_host_t *vha, uint16_t loop_id) { struct qla_hw_data *ha = vha->hw; if (IS_FWI2_CAPABLE(ha)) return loop_id > NPH_LAST_HANDLE; return (loop_id > ha->max_loop_id && loop_id < SNS_FIRST_LOOP_ID) || loop_id == MANAGEMENT_SERVER || loop_id == BROADCAST; } /** * <API key> - scan through our port list and find a new usable loop ID * @vha: adapter state pointer. * @dev: port structure pointer. * * Returns: * qla2x00 local function return status code. * * Context: * Kernel context. */ static int <API key>(scsi_qla_host_t *vha, fc_port_t *dev) { int rval; struct qla_hw_data *ha = vha->hw; unsigned long flags = 0; rval = QLA_SUCCESS; spin_lock_irqsave(&ha->vport_slock, flags); dev->loop_id = find_first_zero_bit(ha->loop_id_map, LOOPID_MAP_SIZE); if (dev->loop_id >= LOOPID_MAP_SIZE || <API key>(vha, dev->loop_id)) { dev->loop_id = FC_NO_LOOP_ID; rval = QLA_FUNCTION_FAILED; } else { set_bit(dev->loop_id, ha->loop_id_map); } <API key>(&ha->vport_slock, flags); if (rval == QLA_SUCCESS) ql_dbg(ql_dbg_disc, dev->vha, 0x2086, "Assigning new loopid=%x, portid=%x.\n", dev->loop_id, dev->d_id.b24); else ql_log(ql_log_warn, dev->vha, 0x2087, "No loop_id's available, portid=%x.\n", dev->d_id.b24); return rval; } void <API key>(fc_port_t *fcport) { struct qla_hw_data *ha = fcport->vha->hw; if (fcport->loop_id == FC_NO_LOOP_ID || <API key>(fcport->vha, fcport->loop_id)) return; clear_bit(fcport->loop_id, ha->loop_id_map); fcport->loop_id = FC_NO_LOOP_ID; } static void <API key>(scsi_qla_host_t *vha, struct event_arg *ea) { fc_port_t *fcport, *conflict_fcport; struct <API key> *e; u16 i, n, found = 0, loop_id; port_id_t id; u64 wwn; u16 data[2]; u8 current_login_state, nvme_cls; fcport = ea->fcport; ql_dbg(ql_dbg_disc, vha, 0xffff, "%s %8phC DS %d LS rc %d %d login %d|%d rscn %d|%d lid %d\n", __func__, fcport->port_name, fcport->disc_state, fcport->fw_login_state, ea->rc, fcport->login_gen, fcport->last_login_gen, fcport->rscn_gen, fcport->last_rscn_gen, vha->loop_id); if (fcport->disc_state == DSC_DELETE_PEND) return; if (ea->rc) { /* rval */ if (fcport->login_retry == 0) { ql_dbg(ql_dbg_disc, vha, 0x20de, "GNL failed Port login retry %8phN, retry cnt=%d.\n", fcport->port_name, fcport->login_retry); } return; } if (fcport->last_rscn_gen != fcport->rscn_gen) { qla_rscn_replay(fcport); <API key>(fcport); return; } else if (fcport->last_login_gen != fcport->login_gen) { ql_dbg(ql_dbg_disc, vha, 0x20e0, "%s %8phC login gen changed\n", __func__, fcport->port_name); return; } n = ea->data[0] / sizeof(struct <API key>); ql_dbg(ql_dbg_disc, vha, 0x20e1, "%s %d %8phC n %d %02x%02x%02x lid %d \n", __func__, __LINE__, fcport->port_name, n, fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa, fcport->loop_id); for (i = 0; i < n; i++) { e = &vha->gnl.l[i]; wwn = wwn_to_u64(e->port_name); id.b.domain = e->port_id[2]; id.b.area = e->port_id[1]; id.b.al_pa = e->port_id[0]; id.b.rsvd_1 = 0; if (memcmp((u8 *)&wwn, fcport->port_name, WWN_SIZE)) continue; if (IS_SW_RESV_ADDR(id)) continue; found = 1; loop_id = le16_to_cpu(e->nport_handle); loop_id = (loop_id & 0x7fff); nvme_cls = e->current_login_state >> 4; current_login_state = e->current_login_state & 0xf; if (PRLI_PHASE(nvme_cls)) { current_login_state = nvme_cls; fcport->fc4_type &= ~FS_FC4TYPE_FCP; fcport->fc4_type |= FS_FC4TYPE_NVME; } else if (PRLI_PHASE(current_login_state)) { fcport->fc4_type |= FS_FC4TYPE_FCP; fcport->fc4_type &= ~FS_FC4TYPE_NVME; } ql_dbg(ql_dbg_disc, vha, 0x20e2, "%s found %8phC CLS [%x|%x] fc4_type %d ID[%06x|%06x] lid[%d|%d]\n", __func__, fcport->port_name, e->current_login_state, fcport->fw_login_state, fcport->fc4_type, id.b24, fcport->d_id.b24, loop_id, fcport->loop_id); switch (fcport->disc_state) { case DSC_DELETE_PEND: case DSC_DELETED: break; default: if ((id.b24 != fcport->d_id.b24 && fcport->d_id.b24 && fcport->loop_id != FC_NO_LOOP_ID) || (fcport->loop_id != FC_NO_LOOP_ID && fcport->loop_id != loop_id)) { ql_dbg(ql_dbg_disc, vha, 0x20e3, "%s %d %8phC post del sess\n", __func__, __LINE__, fcport->port_name); if (fcport->n2n_flag) fcport->d_id.b24 = 0; <API key>(fcport); return; } break; } fcport->loop_id = loop_id; if (fcport->n2n_flag) fcport->d_id.b24 = id.b24; wwn = wwn_to_u64(fcport->port_name); <API key>(vha, wwn, id, loop_id, &conflict_fcport); if (conflict_fcport) { /* * Another share fcport share the same loop_id & * nport id. Conflict fcport needs to finish * cleanup before this fcport can proceed to login. */ conflict_fcport->conflict = fcport; fcport->login_pause = 1; } switch (vha->hw->current_topology) { default: switch (current_login_state) { case DSC_LS_PRLI_COMP: ql_dbg(ql_dbg_disc + ql_dbg_verbose, vha, 0x20e4, "%s %d %8phC post gpdb\n", __func__, __LINE__, fcport->port_name); if ((e-><API key>[0] & BIT_4) == 0) fcport->port_type = FCT_INITIATOR; else fcport->port_type = FCT_TARGET; data[0] = data[1] = 0; <API key>(vha, fcport, data); break; case DSC_LS_PORT_UNAVAIL: default: if (fcport->loop_id == FC_NO_LOOP_ID) { <API key>(vha, fcport); fcport->fw_login_state = DSC_LS_PORT_UNAVAIL; } ql_dbg(ql_dbg_disc, vha, 0x20e5, "%s %d %8phC\n", __func__, __LINE__, fcport->port_name); <API key>(vha, fcport); break; } break; case ISP_CFG_N: fcport->fw_login_state = current_login_state; fcport->d_id = id; switch (current_login_state) { case DSC_LS_PRLI_PEND: /* * In the middle of PRLI. Let it finish. * Allow relogin code to recheck state again * with GNL. Push disc_state back to DELETED * so GNL can go out again */ <API key>(fcport, DSC_DELETED); break; case DSC_LS_PRLI_COMP: if ((e-><API key>[0] & BIT_4) == 0) fcport->port_type = FCT_INITIATOR; else fcport->port_type = FCT_TARGET; data[0] = data[1] = 0; <API key>(vha, fcport, data); break; case DSC_LS_PLOGI_COMP: if (fcport_is_bigger(fcport)) { /* local adapter is smaller */ if (fcport->loop_id != FC_NO_LOOP_ID) <API key>(fcport); fcport->loop_id = loop_id; <API key>(vha, fcport); break; } fallthrough; default: if (fcport_is_smaller(fcport)) { /* local adapter is bigger */ if (fcport->loop_id != FC_NO_LOOP_ID) <API key>(fcport); fcport->loop_id = loop_id; <API key>(vha, fcport); } break; } break; } /* switch (ha->current_topology) */ } if (!found) { switch (vha->hw->current_topology) { case ISP_CFG_F: case ISP_CFG_FL: for (i = 0; i < n; i++) { e = &vha->gnl.l[i]; id.b.domain = e->port_id[0]; id.b.area = e->port_id[1]; id.b.al_pa = e->port_id[2]; id.b.rsvd_1 = 0; loop_id = le16_to_cpu(e->nport_handle); if (fcport->d_id.b24 == id.b24) { conflict_fcport = <API key>(vha, e->port_name, 0); if (conflict_fcport) { ql_dbg(ql_dbg_disc + ql_dbg_verbose, vha, 0x20e5, "%s %d %8phC post del sess\n", __func__, __LINE__, conflict_fcport->port_name); <API key> (conflict_fcport); } } /* * FW already picked this loop id for * another fcport */ if (fcport->loop_id == loop_id) fcport->loop_id = FC_NO_LOOP_ID; } <API key>(vha, fcport); break; case ISP_CFG_N: <API key>(fcport, DSC_DELETED); if (time_after_eq(jiffies, fcport->dm_login_expire)) { if (fcport->n2n_link_reset_cnt < 2) { fcport->n2n_link_reset_cnt++; /* * remote port is not sending PLOGI. * Reset link to kick start his state * machine */ set_bit(N2N_LINK_RESET, &vha->dpc_flags); } else { if (fcport->n2n_chip_reset < 1) { ql_log(ql_log_info, vha, 0x705d, "Chip reset to bring laser down"); set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); fcport->n2n_chip_reset++; } else { ql_log(ql_log_info, vha, 0x705d, "Remote port %8ph is not coming back\n", fcport->port_name); fcport->scan_state = 0; } } qla2xxx_wake_dpc(vha); } else { /* * report port suppose to do PLOGI. Give him * more time. FW will catch it. */ set_bit(RELOGIN_NEEDED, &vha->dpc_flags); } break; default: break; } } } /* gnl_event */ static void <API key>(srb_t *sp, int res) { struct scsi_qla_host *vha = sp->vha; unsigned long flags; struct fc_port *fcport = NULL, *tf; u16 i, n = 0, loop_id; struct event_arg ea; struct <API key> *e; u64 wwn; struct list_head h; bool found = false; ql_dbg(ql_dbg_disc, vha, 0x20e7, "Async done-%s res %x mb[1]=%x mb[2]=%x \n", sp->name, res, sp->u.iocb_cmd.u.mbx.in_mb[1], sp->u.iocb_cmd.u.mbx.in_mb[2]); if (res == <API key>) return; sp->fcport->flags &= ~(FCF_ASYNC_SENT|FCF_ASYNC_ACTIVE); memset(&ea, 0, sizeof(ea)); ea.sp = sp; ea.rc = res; if (sp->u.iocb_cmd.u.mbx.in_mb[1] >= sizeof(struct <API key>)) { n = sp->u.iocb_cmd.u.mbx.in_mb[1] / sizeof(struct <API key>); ea.data[0] = sp->u.iocb_cmd.u.mbx.in_mb[1]; /* amnt xfered */ } for (i = 0; i < n; i++) { e = &vha->gnl.l[i]; loop_id = le16_to_cpu(e->nport_handle); /* mask out reserve bit */ loop_id = (loop_id & 0x7fff); set_bit(loop_id, vha->hw->loop_id_map); wwn = wwn_to_u64(e->port_name); ql_dbg(ql_dbg_disc, vha, 0x20e8, "%s %8phC %02x:%02x:%02x CLS %x/%x lid %x \n", __func__, &wwn, e->port_id[2], e->port_id[1], e->port_id[0], e->current_login_state, e->last_login_state, (loop_id & 0x7fff)); } spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); INIT_LIST_HEAD(&h); fcport = tf = NULL; if (!list_empty(&vha->gnl.fcports)) list_splice_init(&vha->gnl.fcports, &h); <API key>(&vha->hw->tgt.sess_lock, flags); <API key>(fcport, tf, &h, gnl_entry) { list_del_init(&fcport->gnl_entry); spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); <API key>(&vha->hw->tgt.sess_lock, flags); ea.fcport = fcport; <API key>(vha, &ea); } /* create new fcport if fw has knowledge of new sessions */ for (i = 0; i < n; i++) { port_id_t id; u64 wwnn; e = &vha->gnl.l[i]; wwn = wwn_to_u64(e->port_name); found = false; <API key>(fcport, tf, &vha->vp_fcports, list) { if (!memcmp((u8 *)&wwn, fcport->port_name, WWN_SIZE)) { found = true; break; } } id.b.domain = e->port_id[2]; id.b.area = e->port_id[1]; id.b.al_pa = e->port_id[0]; id.b.rsvd_1 = 0; if (!found && wwn && !IS_SW_RESV_ADDR(id)) { ql_dbg(ql_dbg_disc, vha, 0x2065, "%s %d %8phC %06x post new sess\n", __func__, __LINE__, (u8 *)&wwn, id.b24); wwnn = wwn_to_u64(e->node_name); <API key>(vha, &id, (u8 *)&wwn, (u8 *)&wwnn, NULL, 0); } } spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); vha->gnl.sent = 0; if (!list_empty(&vha->gnl.fcports)) { /* retrigger gnl */ <API key>(fcport, tf, &vha->gnl.fcports, gnl_entry) { list_del_init(&fcport->gnl_entry); fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); if (<API key>(vha, fcport) == QLA_SUCCESS) break; } } <API key>(&vha->hw->tgt.sess_lock, flags); sp->free(sp); } int qla24xx_async_gnl(struct scsi_qla_host *vha, fc_port_t *fcport) { srb_t *sp; struct srb_iocb *mbx; int rval = QLA_FUNCTION_FAILED; unsigned long flags; u16 *mb; if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT)) return rval; ql_dbg(ql_dbg_disc, vha, 0x20d9, "Async-gnlist WWPN %8phC \n", fcport->port_name); spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); fcport->flags |= FCF_ASYNC_SENT; <API key>(fcport, DSC_GNL); fcport->last_rscn_gen = fcport->rscn_gen; fcport->last_login_gen = fcport->login_gen; list_add_tail(&fcport->gnl_entry, &vha->gnl.fcports); if (vha->gnl.sent) { <API key>(&vha->hw->tgt.sess_lock, flags); return QLA_SUCCESS; } vha->gnl.sent = 1; <API key>(&vha->hw->tgt.sess_lock, flags); sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); if (!sp) goto done; sp->type = SRB_MB_IOCB; sp->name = "gnlist"; sp->gen1 = fcport->rscn_gen; sp->gen2 = fcport->login_gen; mbx = &sp->u.iocb_cmd; mbx->timeout = <API key>; qla2x00_init_timer(sp, <API key>(vha)+2); mb = sp->u.iocb_cmd.u.mbx.out_mb; mb[0] = <API key>; mb[1] = BIT_2 | BIT_3; mb[2] = MSW(vha->gnl.ldma); mb[3] = LSW(vha->gnl.ldma); mb[6] = MSW(MSD(vha->gnl.ldma)); mb[7] = LSW(MSD(vha->gnl.ldma)); mb[8] = vha->gnl.size; mb[9] = vha->vp_idx; sp->done = <API key>; ql_dbg(ql_dbg_disc, vha, 0x20da, "Async-%s - OUT WWPN %8phC hndl %x\n", sp->name, fcport->port_name, sp->handle); rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) goto done_free_sp; return rval; done_free_sp: sp->free(sp); done: fcport->flags &= ~(FCF_ASYNC_ACTIVE | FCF_ASYNC_SENT); return rval; } int <API key>(struct scsi_qla_host *vha, fc_port_t *fcport) { struct qla_work_evt *e; e = qla2x00_alloc_work(vha, QLA_EVT_GNL); if (!e) return QLA_FUNCTION_FAILED; e->u.fcport.fcport = fcport; fcport->flags |= FCF_ASYNC_ACTIVE; return qla2x00_post_work(vha, e); } static void <API key>(srb_t *sp, int res) { struct scsi_qla_host *vha = sp->vha; struct qla_hw_data *ha = vha->hw; fc_port_t *fcport = sp->fcport; u16 *mb = sp->u.iocb_cmd.u.mbx.in_mb; struct event_arg ea; ql_dbg(ql_dbg_disc, vha, 0x20db, "Async done-%s res %x, WWPN %8phC mb[1]=%x mb[2]=%x \n", sp->name, res, fcport->port_name, mb[1], mb[2]); fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); if (res == <API key>) goto done; memset(&ea, 0, sizeof(ea)); ea.fcport = fcport; ea.sp = sp; <API key>(vha, &ea); done: dma_pool_free(ha->s_dma_pool, sp->u.iocb_cmd.u.mbx.in, sp->u.iocb_cmd.u.mbx.in_dma); sp->free(sp); } static int <API key>(struct scsi_qla_host *vha, fc_port_t *fcport) { struct qla_work_evt *e; e = qla2x00_alloc_work(vha, QLA_EVT_PRLI); if (!e) return QLA_FUNCTION_FAILED; e->u.fcport.fcport = fcport; return qla2x00_post_work(vha, e); } static void <API key>(srb_t *sp, int res) { struct scsi_qla_host *vha = sp->vha; struct srb_iocb *lio = &sp->u.iocb_cmd; struct event_arg ea; ql_dbg(ql_dbg_disc, vha, 0x2129, "%s %8phC res %d \n", __func__, sp->fcport->port_name, res); sp->fcport->flags &= ~FCF_ASYNC_SENT; if (!test_bit(UNLOADING, &vha->dpc_flags)) { memset(&ea, 0, sizeof(ea)); ea.fcport = sp->fcport; ea.data[0] = lio->u.logio.data[0]; ea.data[1] = lio->u.logio.data[1]; ea.iop[0] = lio->u.logio.iop[0]; ea.iop[1] = lio->u.logio.iop[1]; ea.sp = sp; <API key>(vha, &ea); } sp->free(sp); } int qla24xx_async_prli(struct scsi_qla_host *vha, fc_port_t *fcport) { srb_t *sp; struct srb_iocb *lio; int rval = QLA_FUNCTION_FAILED; if (!vha->flags.online) { ql_dbg(ql_dbg_disc, vha, 0xffff, "%s %d %8phC exit\n", __func__, __LINE__, fcport->port_name); return rval; } if ((fcport->fw_login_state == DSC_LS_PLOGI_PEND || fcport->fw_login_state == DSC_LS_PRLI_PEND) && <API key>(vha)) { ql_dbg(ql_dbg_disc, vha, 0xffff, "%s %d %8phC exit\n", __func__, __LINE__, fcport->port_name); return rval; } sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); if (!sp) return rval; fcport->flags |= FCF_ASYNC_SENT; fcport->logout_completed = 0; sp->type = SRB_PRLI_CMD; sp->name = "prli"; lio = &sp->u.iocb_cmd; lio->timeout = <API key>; qla2x00_init_timer(sp, <API key>(vha) + 2); sp->done = <API key>; lio->u.logio.flags = 0; if (NVME_TARGET(vha->hw, fcport)) lio->u.logio.flags |= SRB_LOGIN_NVME_PRLI; ql_dbg(ql_dbg_disc, vha, 0x211b, "Async-prli - %8phC hdl=%x, loopid=%x portid=%06x retries=%d fc4type %x priority %x %s.\n", fcport->port_name, sp->handle, fcport->loop_id, fcport->d_id.b24, fcport->login_retry, fcport->fc4_type, vha->hw->fc4_type_priority, NVME_TARGET(vha->hw, fcport) ? "nvme" : "fcp"); rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { fcport->flags |= FCF_LOGIN_NEEDED; set_bit(RELOGIN_NEEDED, &vha->dpc_flags); goto done_free_sp; } return rval; done_free_sp: sp->free(sp); fcport->flags &= ~FCF_ASYNC_SENT; return rval; } int <API key>(struct scsi_qla_host *vha, fc_port_t *fcport, u8 opt) { struct qla_work_evt *e; e = qla2x00_alloc_work(vha, QLA_EVT_GPDB); if (!e) return QLA_FUNCTION_FAILED; e->u.fcport.fcport = fcport; e->u.fcport.opt = opt; fcport->flags |= FCF_ASYNC_ACTIVE; return qla2x00_post_work(vha, e); } int qla24xx_async_gpdb(struct scsi_qla_host *vha, fc_port_t *fcport, u8 opt) { srb_t *sp; struct srb_iocb *mbx; int rval = QLA_FUNCTION_FAILED; u16 *mb; dma_addr_t pd_dma; struct port_database_24xx *pd; struct qla_hw_data *ha = vha->hw; if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT) || fcport->loop_id == FC_NO_LOOP_ID) { ql_log(ql_log_warn, vha, 0xffff, "%s: %8phC - not sending command.\n", __func__, fcport->port_name); return rval; } sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); if (!sp) goto done; <API key>(fcport, DSC_GPDB); fcport->flags |= FCF_ASYNC_SENT; sp->type = SRB_MB_IOCB; sp->name = "gpdb"; sp->gen1 = fcport->rscn_gen; sp->gen2 = fcport->login_gen; mbx = &sp->u.iocb_cmd; mbx->timeout = <API key>; qla2x00_init_timer(sp, <API key>(vha) + 2); pd = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &pd_dma); if (pd == NULL) { ql_log(ql_log_warn, vha, 0xd043, "Failed to allocate port database structure.\n"); goto done_free_sp; } mb = sp->u.iocb_cmd.u.mbx.out_mb; mb[0] = <API key>; mb[1] = fcport->loop_id; mb[2] = MSW(pd_dma); mb[3] = LSW(pd_dma); mb[6] = MSW(MSD(pd_dma)); mb[7] = LSW(MSD(pd_dma)); mb[9] = vha->vp_idx; mb[10] = opt; mbx->u.mbx.in = pd; mbx->u.mbx.in_dma = pd_dma; sp->done = <API key>; ql_dbg(ql_dbg_disc, vha, 0x20dc, "Async-%s %8phC hndl %x opt %x\n", sp->name, fcport->port_name, sp->handle, opt); rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) goto done_free_sp; return rval; done_free_sp: if (pd) dma_pool_free(ha->s_dma_pool, pd, pd_dma); sp->free(sp); fcport->flags &= ~FCF_ASYNC_SENT; done: fcport->flags &= ~FCF_ASYNC_ACTIVE; <API key>(vha, fcport, opt); return rval; } static void <API key>(scsi_qla_host_t *vha, struct event_arg *ea) { unsigned long flags; spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); ea->fcport->login_gen++; ea->fcport->deleted = 0; ea->fcport->logout_on_delete = 1; if (!ea->fcport->login_succ && !IS_SW_RESV_ADDR(ea->fcport->d_id)) { vha->fcport_count++; ea->fcport->login_succ = 1; <API key>(&vha->hw->tgt.sess_lock, flags); <API key>(ea->fcport); spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); } else if (ea->fcport->login_succ) { /* * We have an existing session. A late RSCN delivery * must have triggered the session to be re-validate. * Session is still valid. */ ql_dbg(ql_dbg_disc, vha, 0x20d6, "%s %d %8phC session revalidate success\n", __func__, __LINE__, ea->fcport->port_name); <API key>(ea->fcport, DSC_LOGIN_COMPLETE); } <API key>(&vha->hw->tgt.sess_lock, flags); } static void <API key>(scsi_qla_host_t *vha, struct event_arg *ea) { fc_port_t *fcport = ea->fcport; struct port_database_24xx *pd; struct srb *sp = ea->sp; uint8_t ls; pd = (struct port_database_24xx *)sp->u.iocb_cmd.u.mbx.in; fcport->flags &= ~FCF_ASYNC_SENT; ql_dbg(ql_dbg_disc, vha, 0x20d2, "%s %8phC DS %d LS %d fc4_type %x rc %d\n", __func__, fcport->port_name, fcport->disc_state, pd->current_login_state, fcport->fc4_type, ea->rc); if (fcport->disc_state == DSC_DELETE_PEND) return; if (NVME_TARGET(vha->hw, fcport)) ls = pd->current_login_state >> 4; else ls = pd->current_login_state & 0xf; if (ea->sp->gen2 != fcport->login_gen) { /* target side must have changed it. */ ql_dbg(ql_dbg_disc, vha, 0x20d3, "%s %8phC generation changed\n", __func__, fcport->port_name); return; } else if (ea->sp->gen1 != fcport->rscn_gen) { qla_rscn_replay(fcport); <API key>(fcport); return; } switch (ls) { case PDS_PRLI_COMPLETE: <API key>(vha, fcport, pd); break; case PDS_PLOGI_PENDING: case PDS_PLOGI_COMPLETE: case PDS_PRLI_PENDING: case PDS_PRLI2_PENDING: /* Set discovery state back to GNL to Relogin attempt */ if (<API key>(vha) || <API key>(vha)) { <API key>(fcport, DSC_GNL); set_bit(RELOGIN_NEEDED, &vha->dpc_flags); } return; case PDS_LOGO_PENDING: case <API key>: default: ql_dbg(ql_dbg_disc, vha, 0x20d5, "%s %d %8phC post del sess\n", __func__, __LINE__, fcport->port_name); <API key>(fcport); return; } <API key>(vha, ea); } /* gpdb event */ static void <API key>(struct scsi_qla_host *vha, fc_port_t *fcport) { u8 login = 0; int rc; if (<API key>(vha)) return; if (<API key>(vha)) { if (N2N_TOPO(vha->hw)) { u64 mywwn, wwn; mywwn = wwn_to_u64(vha->port_name); wwn = wwn_to_u64(fcport->port_name); if (mywwn > wwn) login = 1; else if ((fcport->fw_login_state == DSC_LS_PLOGI_COMP) && time_after_eq(jiffies, fcport-><API key>)) login = 1; } else { login = 1; } } else { /* initiator mode */ login = 1; } if (login && fcport->login_retry) { fcport->login_retry if (fcport->loop_id == FC_NO_LOOP_ID) { fcport->fw_login_state = DSC_LS_PORT_UNAVAIL; rc = <API key>(vha, fcport); if (rc) { ql_dbg(ql_dbg_disc, vha, 0x20e6, "%s %d %8phC post del sess - out of loopid\n", __func__, __LINE__, fcport->port_name); fcport->scan_state = 0; <API key>(fcport); return; } } ql_dbg(ql_dbg_disc, vha, 0x20bf, "%s %d %8phC post login\n", __func__, __LINE__, fcport->port_name); <API key>(vha, fcport, NULL); } } int <API key>(struct scsi_qla_host *vha, fc_port_t *fcport) { u16 data[2]; u64 wwn; u16 sec; ql_dbg(ql_dbg_disc, vha, 0x20d8, "%s %8phC DS %d LS %d P %d fl %x confl %p rscn %d|%d login %d lid %d scan %d\n", __func__, fcport->port_name, fcport->disc_state, fcport->fw_login_state, fcport->login_pause, fcport->flags, fcport->conflict, fcport->last_rscn_gen, fcport->rscn_gen, fcport->login_gen, fcport->loop_id, fcport->scan_state); if (fcport->scan_state != QLA_FCPORT_FOUND) return 0; if ((fcport->loop_id != FC_NO_LOOP_ID) && <API key>(vha) && ((fcport->fw_login_state == DSC_LS_PLOGI_PEND) || (fcport->fw_login_state == DSC_LS_PRLI_PEND))) return 0; if (fcport->fw_login_state == DSC_LS_PLOGI_COMP && !N2N_TOPO(vha->hw)) { if (time_before_eq(jiffies, fcport-><API key>)) { set_bit(RELOGIN_NEEDED, &vha->dpc_flags); return 0; } } /* Target won't initiate port login if fabric is present */ if (vha->host->active_mode == MODE_TARGET && !N2N_TOPO(vha->hw)) return 0; if (fcport->flags & FCF_ASYNC_SENT) { set_bit(RELOGIN_NEEDED, &vha->dpc_flags); return 0; } switch (fcport->disc_state) { case DSC_DELETED: wwn = wwn_to_u64(fcport->node_name); switch (vha->hw->current_topology) { case ISP_CFG_N: if (fcport_is_smaller(fcport)) { /* this adapter is bigger */ if (fcport->login_retry) { if (fcport->loop_id == FC_NO_LOOP_ID) { <API key>(vha, fcport); fcport->fw_login_state = DSC_LS_PORT_UNAVAIL; } fcport->login_retry <API key>(vha, fcport); } else { ql_log(ql_log_info, vha, 0x705d, "Unable to reach remote port %8phC", fcport->port_name); } } else { <API key>(vha, fcport); } break; default: if (wwn == 0) { ql_dbg(ql_dbg_disc, vha, 0xffff, "%s %d %8phC post GNNID\n", __func__, __LINE__, fcport->port_name); <API key>(vha, fcport); } else if (fcport->loop_id == FC_NO_LOOP_ID) { ql_dbg(ql_dbg_disc, vha, 0x20bd, "%s %d %8phC post gnl\n", __func__, __LINE__, fcport->port_name); <API key>(vha, fcport); } else { <API key>(vha, fcport); } break; } break; case DSC_GNL: switch (vha->hw->current_topology) { case ISP_CFG_N: if ((fcport->current_login_state & 0xf) == 0x6) { ql_dbg(ql_dbg_disc, vha, 0x2118, "%s %d %8phC post GPDB work\n", __func__, __LINE__, fcport->port_name); fcport->chip_reset = vha->hw->base_qpair->chip_reset; <API key>(vha, fcport, 0); } else { ql_dbg(ql_dbg_disc, vha, 0x2118, "%s %d %8phC post %s PRLI\n", __func__, __LINE__, fcport->port_name, NVME_TARGET(vha->hw, fcport) ? "NVME" : "FC"); <API key>(vha, fcport); } break; default: if (fcport->login_pause) { ql_dbg(ql_dbg_disc, vha, 0x20d8, "%s %d %8phC exit\n", __func__, __LINE__, fcport->port_name); fcport->last_rscn_gen = fcport->rscn_gen; fcport->last_login_gen = fcport->login_gen; set_bit(RELOGIN_NEEDED, &vha->dpc_flags); break; } <API key>(vha, fcport); break; } break; case DSC_LOGIN_FAILED: if (N2N_TOPO(vha->hw)) <API key>(vha, fcport); else <API key>(fcport); break; case DSC_LOGIN_COMPLETE: /* recheck login state */ data[0] = data[1] = 0; <API key>(vha, fcport, data); break; case DSC_LOGIN_PEND: if (fcport->fw_login_state == DSC_LS_PLOGI_COMP) <API key>(vha, fcport); break; case DSC_UPD_FCPORT: sec = jiffies_to_msecs(jiffies - fcport-><API key>)/1000; if (fcport-><API key> < sec && sec && !(sec % 60)) { fcport-><API key> = sec; ql_dbg(ql_dbg_disc, fcport->vha, 0xffff, "%s %8phC - Slow Rport registration(%d Sec)\n", __func__, fcport->port_name, sec); } if (fcport->next_disc_state != DSC_DELETE_PEND) fcport->next_disc_state = DSC_ADISC; set_bit(RELOGIN_NEEDED, &vha->dpc_flags); break; default: break; } return 0; } int <API key>(struct scsi_qla_host *vha, port_id_t *id, u8 *port_name, u8 *node_name, void *pla, u8 fc4_type) { struct qla_work_evt *e; e = qla2x00_alloc_work(vha, QLA_EVT_NEW_SESS); if (!e) return QLA_FUNCTION_FAILED; e->u.new_sess.id = *id; e->u.new_sess.pla = pla; e->u.new_sess.fc4_type = fc4_type; memcpy(e->u.new_sess.port_name, port_name, WWN_SIZE); if (node_name) memcpy(e->u.new_sess.node_name, node_name, WWN_SIZE); return qla2x00_post_work(vha, e); } void qla2x00_handle_rscn(scsi_qla_host_t *vha, struct event_arg *ea) { fc_port_t *fcport; unsigned long flags; fcport = <API key>(vha, &ea->id, 1); if (fcport) { fcport->scan_needed = 1; fcport->rscn_gen++; } spin_lock_irqsave(&vha->work_lock, flags); if (vha->scan.scan_flags == 0) { ql_dbg(ql_dbg_disc, vha, 0xffff, "%s: schedule\n", __func__); vha->scan.scan_flags |= SF_QUEUED; <API key>(&vha->scan.scan_work, 5); } <API key>(&vha->work_lock, flags); } void <API key>(scsi_qla_host_t *vha, struct event_arg *ea) { fc_port_t *fcport = ea->fcport; if (test_bit(UNLOADING, &vha->dpc_flags)) return; ql_dbg(ql_dbg_disc, vha, 0x2102, "%s %8phC DS %d LS %d P %d del %d cnfl %p rscn %d|%d login %d|%d fl %x\n", __func__, fcport->port_name, fcport->disc_state, fcport->fw_login_state, fcport->login_pause, fcport->deleted, fcport->conflict, fcport->last_rscn_gen, fcport->rscn_gen, fcport->last_login_gen, fcport->login_gen, fcport->flags); if (fcport->last_rscn_gen != fcport->rscn_gen) { ql_dbg(ql_dbg_disc, vha, 0x20e9, "%s %d %8phC post gnl\n", __func__, __LINE__, fcport->port_name); <API key>(vha, fcport); return; } <API key>(vha, fcport); } void <API key>(scsi_qla_host_t *vha, struct event_arg *ea) { /* for pure Target Mode, PRLI will not be initiated */ if (vha->host->active_mode == MODE_TARGET) return; ql_dbg(ql_dbg_disc, vha, 0x2118, "%s %d %8phC post PRLI\n", __func__, __LINE__, ea->fcport->port_name); <API key>(vha, ea->fcport); } /* * RSCN(s) came in for this fcport, but the RSCN(s) was not able * to be consumed by the fcport */ void qla_rscn_replay(fc_port_t *fcport) { struct event_arg ea; switch (fcport->disc_state) { case DSC_DELETE_PEND: return; default: break; } if (fcport->scan_needed) { memset(&ea, 0, sizeof(ea)); ea.id = fcport->d_id; ea.id.b.rsvd_1 = RSCN_PORT_ADDR; qla2x00_handle_rscn(fcport->vha, &ea); } } static void <API key>(void *data) { srb_t *sp = data; struct srb_iocb *tmf = &sp->u.iocb_cmd; int rc, h; unsigned long flags; rc = <API key>(sp, false); if (rc) { spin_lock_irqsave(sp->qpair->qp_lock_ptr, flags); for (h = 1; h < sp->qpair->req-><API key>; h++) { if (sp->qpair->req->outstanding_cmds[h] == sp) { sp->qpair->req->outstanding_cmds[h] = NULL; break; } } <API key>(sp->qpair->qp_lock_ptr, flags); tmf->u.tmf.comp_status = cpu_to_le16(CS_TIMEOUT); tmf->u.tmf.data = QLA_FUNCTION_FAILED; complete(&tmf->u.tmf.comp); } } static void qla2x00_tmf_sp_done(srb_t *sp, int res) { struct srb_iocb *tmf = &sp->u.iocb_cmd; complete(&tmf->u.tmf.comp); } int <API key>(fc_port_t *fcport, uint32_t flags, uint32_t lun, uint32_t tag) { struct scsi_qla_host *vha = fcport->vha; struct srb_iocb *tm_iocb; srb_t *sp; int rval = QLA_FUNCTION_FAILED; sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); if (!sp) goto done; tm_iocb = &sp->u.iocb_cmd; sp->type = SRB_TM_CMD; sp->name = "tmf"; tm_iocb->timeout = <API key>; init_completion(&tm_iocb->u.tmf.comp); qla2x00_init_timer(sp, <API key>(vha)); tm_iocb->u.tmf.flags = flags; tm_iocb->u.tmf.lun = lun; tm_iocb->u.tmf.data = tag; sp->done = qla2x00_tmf_sp_done; ql_dbg(ql_dbg_taskm, vha, 0x802f, "Async-tmf hdl=%x loop-id=%x portid=%02x%02x%02x.\n", sp->handle, fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa); rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) goto done_free_sp; wait_for_completion(&tm_iocb->u.tmf.comp); rval = tm_iocb->u.tmf.data; if (rval != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x8030, "TM IOCB failed (%x).\n", rval); } if (!test_bit(UNLOADING, &vha->dpc_flags) && !IS_QLAFX00(vha->hw)) { flags = tm_iocb->u.tmf.flags; lun = (uint16_t)tm_iocb->u.tmf.lun; /* Issue Marker IOCB */ qla2x00_marker(vha, vha->hw->base_qpair, fcport->loop_id, lun, flags == TCF_LUN_RESET ? MK_SYNC_ID_LUN : MK_SYNC_ID); } done_free_sp: sp->free(sp); fcport->flags &= ~FCF_ASYNC_SENT; done: return rval; } int <API key>(srb_t *sp) { unsigned long flags = 0; uint32_t handle; fc_port_t *fcport = sp->fcport; struct qla_qpair *qpair = sp->qpair; struct scsi_qla_host *vha = fcport->vha; struct req_que *req = qpair->req; spin_lock_irqsave(qpair->qp_lock_ptr, flags); for (handle = 1; handle < req-><API key>; handle++) { if (req->outstanding_cmds[handle] == sp) break; } <API key>(qpair->qp_lock_ptr, flags); if (handle == req-><API key>) { /* Command not found. */ return QLA_FUNCTION_FAILED; } if (sp->type == SRB_FXIOCB_DCMD) return qlafx00_fx_disc(vha, &vha->hw->mr.fcport, FXDISC_ABORT_IOCTL); return <API key>(sp, true); } static void <API key>(struct scsi_qla_host *vha, struct event_arg *ea) { WARN_ONCE(!<API key>(ea->data[0]), "mbs: % ea->data[0]); switch (ea->data[0]) { case <API key>: ql_dbg(ql_dbg_disc, vha, 0x2118, "%s %d %8phC post gpdb\n", __func__, __LINE__, ea->fcport->port_name); ea->fcport->chip_reset = vha->hw->base_qpair->chip_reset; ea->fcport->logout_on_delete = 1; ea->fcport-><API key> = ea->iop[0]; if (ea->iop[0] & <API key>) ea->fcport-><API key> = (ea->iop[1] & 0xffff) * 512; else ea->fcport-><API key> = 0; <API key>(vha, ea->fcport, 0); break; default: if ((ea->iop[0] == <API key>) && (ea->iop[1] == 0x50000)) { /* reson 5=busy expl:0x0 */ set_bit(RELOGIN_NEEDED, &vha->dpc_flags); ea->fcport->fw_login_state = DSC_LS_PLOGI_COMP; break; } ql_dbg(ql_dbg_disc, vha, 0x2118, "%s %d %8phC priority %s, fc4type %x\n", __func__, __LINE__, ea->fcport->port_name, vha->hw->fc4_type_priority == FC4_PRIORITY_FCP ? "FCP" : "NVMe", ea->fcport->fc4_type); if (N2N_TOPO(vha->hw)) { if (vha->hw->fc4_type_priority == FC4_PRIORITY_NVME) { ea->fcport->fc4_type &= ~FS_FC4TYPE_NVME; ea->fcport->fc4_type |= FS_FC4TYPE_FCP; } else { ea->fcport->fc4_type &= ~FS_FC4TYPE_FCP; ea->fcport->fc4_type |= FS_FC4TYPE_NVME; } if (ea->fcport->n2n_link_reset_cnt < 3) { ea->fcport->n2n_link_reset_cnt++; vha->relogin_jif = jiffies + 2 * HZ; /* * PRLI failed. Reset link to kick start * state machine */ set_bit(N2N_LINK_RESET, &vha->dpc_flags); } else { ql_log(ql_log_warn, vha, 0x2119, "%s %d %8phC Unable to reconnect\n", __func__, __LINE__, ea->fcport->port_name); } } else { /* * switch connect. login failed. Take connection down * and allow relogin to retrigger */ if (NVME_FCP_TARGET(ea->fcport)) { ql_dbg(ql_dbg_disc, vha, 0x2118, "%s %d %8phC post %s prli\n", __func__, __LINE__, ea->fcport->port_name, (ea->fcport->fc4_type & FS_FC4TYPE_NVME) ? "NVMe" : "FCP"); if (vha->hw->fc4_type_priority == FC4_PRIORITY_NVME) ea->fcport->fc4_type &= ~FS_FC4TYPE_NVME; else ea->fcport->fc4_type &= ~FS_FC4TYPE_FCP; } ea->fcport->flags &= ~FCF_ASYNC_SENT; ea->fcport->keep_nport_handle = 0; ea->fcport->logout_on_delete = 1; <API key>(ea->fcport); } break; } } void <API key>(struct scsi_qla_host *vha, struct event_arg *ea) { port_id_t cid; /* conflict Nport id */ u16 lid; struct fc_port *conflict_fcport; unsigned long flags; struct fc_port *fcport = ea->fcport; ql_dbg(ql_dbg_disc, vha, 0xffff, "%s %8phC DS %d LS %d rc %d login %d|%d rscn %d|%d data %x|%x iop %x|%x\n", __func__, fcport->port_name, fcport->disc_state, fcport->fw_login_state, ea->rc, ea->sp->gen2, fcport->login_gen, ea->sp->gen1, fcport->rscn_gen, ea->data[0], ea->data[1], ea->iop[0], ea->iop[1]); if ((fcport->fw_login_state == DSC_LS_PLOGI_PEND) || (fcport->fw_login_state == DSC_LS_PRLI_PEND)) { ql_dbg(ql_dbg_disc, vha, 0x20ea, "%s %d %8phC Remote is trying to login\n", __func__, __LINE__, fcport->port_name); return; } if ((fcport->disc_state == DSC_DELETE_PEND) || (fcport->disc_state == DSC_DELETED)) { set_bit(RELOGIN_NEEDED, &vha->dpc_flags); return; } if (ea->sp->gen2 != fcport->login_gen) { /* target side must have changed it. */ ql_dbg(ql_dbg_disc, vha, 0x20d3, "%s %8phC generation changed\n", __func__, fcport->port_name); set_bit(RELOGIN_NEEDED, &vha->dpc_flags); return; } else if (ea->sp->gen1 != fcport->rscn_gen) { ql_dbg(ql_dbg_disc, vha, 0x20d3, "%s %8phC RSCN generation changed\n", __func__, fcport->port_name); qla_rscn_replay(fcport); <API key>(fcport); return; } WARN_ONCE(!<API key>(ea->data[0]), "mbs: % ea->data[0]); switch (ea->data[0]) { case <API key>: /* * Driver must validate login state - If PRLI not complete, * force a relogin attempt via implicit LOGO, PLOGI, and PRLI * requests. */ if (NVME_TARGET(vha->hw, ea->fcport)) { ql_dbg(ql_dbg_disc, vha, 0x2117, "%s %d %8phC post prli\n", __func__, __LINE__, ea->fcport->port_name); <API key>(vha, ea->fcport); } else { ql_dbg(ql_dbg_disc, vha, 0x20ea, "%s %d %8phC LoopID 0x%x in use with %06x. post gpdb\n", __func__, __LINE__, ea->fcport->port_name, ea->fcport->loop_id, ea->fcport->d_id.b24); set_bit(ea->fcport->loop_id, vha->hw->loop_id_map); spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); ea->fcport->chip_reset = vha->hw->base_qpair->chip_reset; ea->fcport->logout_on_delete = 1; ea->fcport->send_els_logo = 0; ea->fcport->fw_login_state = DSC_LS_PRLI_COMP; <API key>(&vha->hw->tgt.sess_lock, flags); <API key>(vha, ea->fcport, 0); } break; case MBS_COMMAND_ERROR: ql_dbg(ql_dbg_disc, vha, 0x20eb, "%s %d %8phC cmd error %x\n", __func__, __LINE__, ea->fcport->port_name, ea->data[1]); ea->fcport->flags &= ~FCF_ASYNC_SENT; <API key>(ea->fcport, DSC_LOGIN_FAILED); if (ea->data[1] & <API key>) set_bit(RELOGIN_NEEDED, &vha->dpc_flags); else <API key>(vha, ea->fcport, 1); break; case MBS_LOOP_ID_USED: /* data[1] = IO PARAM 1 = nport ID */ cid.b.domain = (ea->iop[1] >> 16) & 0xff; cid.b.area = (ea->iop[1] >> 8) & 0xff; cid.b.al_pa = ea->iop[1] & 0xff; cid.b.rsvd_1 = 0; ql_dbg(ql_dbg_disc, vha, 0x20ec, "%s %d %8phC lid %#x in use with pid %06x post gnl\n", __func__, __LINE__, ea->fcport->port_name, ea->fcport->loop_id, cid.b24); set_bit(ea->fcport->loop_id, vha->hw->loop_id_map); ea->fcport->loop_id = FC_NO_LOOP_ID; <API key>(vha, ea->fcport); break; case MBS_PORT_ID_USED: lid = ea->iop[1] & 0xffff; <API key>(vha, wwn_to_u64(ea->fcport->port_name), ea->fcport->d_id, lid, &conflict_fcport); if (conflict_fcport) { /* * Another fcport share the same loop_id/nport id. * Conflict fcport needs to finish cleanup before this * fcport can proceed to login. */ conflict_fcport->conflict = ea->fcport; ea->fcport->login_pause = 1; ql_dbg(ql_dbg_disc, vha, 0x20ed, "%s %d %8phC NPortId %06x inuse with loopid 0x%x. post gidpn\n", __func__, __LINE__, ea->fcport->port_name, ea->fcport->d_id.b24, lid); } else { ql_dbg(ql_dbg_disc, vha, 0x20ed, "%s %d %8phC NPortId %06x inuse with loopid 0x%x. sched delete\n", __func__, __LINE__, ea->fcport->port_name, ea->fcport->d_id.b24, lid); <API key>(ea->fcport); set_bit(lid, vha->hw->loop_id_map); ea->fcport->loop_id = lid; ea->fcport->keep_nport_handle = 0; ea->fcport->logout_on_delete = 1; <API key>(ea->fcport); } break; } return; } /* QLogic ISP2x00 Hardware Support Functions. */ static int <API key>(scsi_qla_host_t *vha) { int rval = QLA_SUCCESS; struct qla_hw_data *ha = vha->hw; uint32_t idc_major_ver, idc_minor_ver; uint16_t config[4]; qla83xx_idc_lock(vha, 0); /* SV: TODO: Assign initialization timeout from * flash-info / other param */ ha-><API key> = <API key>; ha->fcoe_reset_timeout = <API key>; /* Set our fcoe function presence */ if (<API key>(vha) != QLA_SUCCESS) { ql_dbg(ql_dbg_p3p, vha, 0xb077, "Error while setting DRV-Presence.\n"); rval = QLA_FUNCTION_FAILED; goto exit; } /* Decide the reset ownership */ <API key>(vha); /* * On first protocol driver load: * Init-Owner: Set IDC-Major-Version and Clear IDC-Lock-Recovery * register. * Others: Check compatibility with current IDC Major version. */ qla83xx_rd_reg(vha, <API key>, &idc_major_ver); if (ha->flags.<API key>) { /* Set IDC Major version */ idc_major_ver = <API key>; qla83xx_wr_reg(vha, <API key>, idc_major_ver); /* Clearing IDC-Lock-Recovery register */ qla83xx_wr_reg(vha, <API key>, 0); } else if (idc_major_ver != <API key>) { /* * Clear further IDC participation if we are not compatible with * the current IDC Major Version. */ ql_log(ql_log_warn, vha, 0xb07d, "Failing load, idc_major_ver=%d, expected_major_ver=%d.\n", idc_major_ver, <API key>); <API key>(vha); rval = QLA_FUNCTION_FAILED; goto exit; } /* Each function sets its supported Minor version. */ qla83xx_rd_reg(vha, <API key>, &idc_minor_ver); idc_minor_ver |= (<API key> << (ha->portnum * 2)); qla83xx_wr_reg(vha, <API key>, idc_minor_ver); if (ha->flags.<API key>) { memset(config, 0, sizeof(config)); if (!<API key>(vha, config)) qla83xx_wr_reg(vha, <API key>, QLA8XXX_DEV_READY); } rval = <API key>(vha); exit: qla83xx_idc_unlock(vha, 0); return rval; } /* * <API key> * Initialize board. * * Input: * ha = adapter block pointer. * * Returns: * 0 = success */ int <API key>(scsi_qla_host_t *vha) { int rval; struct qla_hw_data *ha = vha->hw; struct req_que *req = ha->req_q_map[0]; struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; memset(&vha->qla_stats, 0, sizeof(vha->qla_stats)); memset(&vha->fc_host_stat, 0, sizeof(vha->fc_host_stat)); /* Clear adapter flags. */ vha->flags.online = 0; ha->flags.chip_reset_done = 0; vha->flags.reset_active = 0; ha->flags.<API key> = 0; ha->flags.eeh_busy = 0; vha->qla_stats.<API key> = get_jiffies_64(); atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); atomic_set(&vha->loop_state, LOOP_DOWN); vha->device_flags = DFLG_NO_CABLE; vha->dpc_flags = 0; vha->flags.<API key> = 0; vha->marker_needed = 0; ha->isp_abort_cnt = 0; ha->beacon_blink_led = 0; set_bit(0, ha->req_qid_map); set_bit(0, ha->rsp_qid_map); ql_dbg(ql_dbg_init, vha, 0x0040, "Configuring PCI space...\n"); rval = ha->isp_ops->pci_config(vha); if (rval) { ql_log(ql_log_warn, vha, 0x0044, "Unable to configure PCI space.\n"); return (rval); } ha->isp_ops->reset_chip(vha); /* Check for secure flash support */ if (IS_QLA28XX(ha)) { if (rd_reg_word(&reg->mailbox12) & BIT_0) ha->flags.secure_adapter = 1; ql_log(ql_log_info, vha, 0xffff, "Secure Adapter: %s\n", (ha->flags.secure_adapter) ? "Yes" : "No"); } rval = <API key>(vha); if (rval) { ql_log(ql_log_fatal, vha, 0x004f, "Unable to validate FLASH data.\n"); return rval; } if (IS_QLA8044(ha)) { <API key>(vha); /* NOTE: If ql2xdontresethba==1, set IDC_CTRL DONTRESET_BIT0. * If DONRESET_BIT0 is set, drivers should not set dev_state * to NEED_RESET. But if NEED_RESET is set, drivers should * should honor the reset. */ if (ql2xdontresethba == 1) <API key>(vha); } ha->isp_ops->get_flash_version(vha, req->ring); ql_dbg(ql_dbg_init, vha, 0x0061, "Configure NVRAM parameters...\n"); /* Let priority default to FCP, can be overridden by nvram_config */ ha->fc4_type_priority = FC4_PRIORITY_FCP; ha->isp_ops->nvram_config(vha); if (ha->fc4_type_priority != FC4_PRIORITY_FCP && ha->fc4_type_priority != FC4_PRIORITY_NVME) ha->fc4_type_priority = FC4_PRIORITY_FCP; ql_log(ql_log_info, vha, 0xffff, "FC4 priority set to %s\n", ha->fc4_type_priority == FC4_PRIORITY_FCP ? "FCP" : "NVMe"); if (ha->flags.disable_serdes) { /* Mask HBA via NVRAM settings? */ ql_log(ql_log_info, vha, 0x0077, "Masking HBA WWPN %8phN (via NVRAM).\n", vha->port_name); return QLA_FUNCTION_FAILED; } ql_dbg(ql_dbg_init, vha, 0x0078, "Verifying loaded RISC code...\n"); /* If smartsan enabled then require fdmi and rdp enabled */ if (ql2xsmartsan) { ql2xfdmienable = 1; ql2xrdpenable = 1; } if (<API key>(vha) != QLA_SUCCESS) { rval = ha->isp_ops->chip_diag(vha); if (rval) return (rval); rval = qla2x00_setup_chip(vha); if (rval) return (rval); } if (IS_QLA84XX(ha)) { ha->cs84xx = qla84xx_get_chip(vha); if (!ha->cs84xx) { ql_log(ql_log_warn, vha, 0x00d0, "Unable to configure ISP84XX.\n"); return QLA_FUNCTION_FAILED; } } if (<API key>(vha) || <API key>(vha)) rval = qla2x00_init_rings(vha); /* No point in continuing if firmware initialization failed. */ if (rval != QLA_SUCCESS) return rval; ha->flags.chip_reset_done = 1; if (rval == QLA_SUCCESS && IS_QLA84XX(ha)) { /* Issue verify 84xx FW IOCB to complete 84xx initialization */ rval = qla84xx_init_chip(vha); if (rval != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x00d4, "Unable to initialize ISP84XX.\n"); qla84xx_put_chip(vha); } } /* Load the NIC Core f/w if we are the first protocol driver. */ if (IS_QLA8031(ha)) { rval = <API key>(vha); if (rval) ql_log(ql_log_warn, vha, 0x0124, "Error in initializing NIC Core f/w.\n"); } if (IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha)) <API key>(vha); if (IS_P3P_TYPE(ha)) <API key>(vha, QLA2XXX_VERSION); else <API key>(vha, QLA2XXX_VERSION); return (rval); } /** * qla2100_pci_config() - Setup ISP21xx PCI configuration registers. * @vha: HA context * * Returns 0 on success. */ int qla2100_pci_config(scsi_qla_host_t *vha) { uint16_t w; unsigned long flags; struct qla_hw_data *ha = vha->hw; struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; pci_set_master(ha->pdev); pci_try_set_mwi(ha->pdev); <API key>(ha->pdev, PCI_COMMAND, &w); w |= (PCI_COMMAND_PARITY | PCI_COMMAND_SERR); <API key>(ha->pdev, PCI_COMMAND, w); pci_disable_rom(ha->pdev); /* Get PCI bus information. */ spin_lock_irqsave(&ha->hardware_lock, flags); ha->pci_attr = rd_reg_word(&reg->ctrl_status); <API key>(&ha->hardware_lock, flags); return QLA_SUCCESS; } /** * qla2300_pci_config() - Setup ISP23xx PCI configuration registers. * @vha: HA context * * Returns 0 on success. */ int qla2300_pci_config(scsi_qla_host_t *vha) { uint16_t w; unsigned long flags = 0; uint32_t cnt; struct qla_hw_data *ha = vha->hw; struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; pci_set_master(ha->pdev); pci_try_set_mwi(ha->pdev); <API key>(ha->pdev, PCI_COMMAND, &w); w |= (PCI_COMMAND_PARITY | PCI_COMMAND_SERR); if (IS_QLA2322(ha) || IS_QLA6322(ha)) w &= ~<API key>; <API key>(ha->pdev, PCI_COMMAND, w); /* * If this is a 2300 card and not 2312, reset the * COMMAND_INVALIDATE due to a bug in the 2300. Unfortunately, * the 2310 also reports itself as a 2300 so we need to get the * fb revision level -- a 6 indicates it really is a 2300 and * not a 2310. */ if (IS_QLA2300(ha)) { spin_lock_irqsave(&ha->hardware_lock, flags); /* Pause RISC. */ wrt_reg_word(&reg->hccr, HCCR_PAUSE_RISC); for (cnt = 0; cnt < 30000; cnt++) { if ((rd_reg_word(&reg->hccr) & HCCR_RISC_PAUSE) != 0) break; udelay(10); } /* Select FPM registers. */ wrt_reg_word(&reg->ctrl_status, 0x20); rd_reg_word(&reg->ctrl_status); /* Get the fb rev level */ ha->fb_rev = RD_FB_CMD_REG(ha, reg); if (ha->fb_rev == FPM_2300) pci_clear_mwi(ha->pdev); /* Deselect FPM registers. */ wrt_reg_word(&reg->ctrl_status, 0x0); rd_reg_word(&reg->ctrl_status); /* Release RISC module. */ wrt_reg_word(&reg->hccr, HCCR_RELEASE_RISC); for (cnt = 0; cnt < 30000; cnt++) { if ((rd_reg_word(&reg->hccr) & HCCR_RISC_PAUSE) == 0) break; udelay(10); } <API key>(&ha->hardware_lock, flags); } <API key>(ha->pdev, PCI_LATENCY_TIMER, 0x80); pci_disable_rom(ha->pdev); /* Get PCI bus information. */ spin_lock_irqsave(&ha->hardware_lock, flags); ha->pci_attr = rd_reg_word(&reg->ctrl_status); <API key>(&ha->hardware_lock, flags); return QLA_SUCCESS; } /** * qla24xx_pci_config() - Setup ISP24xx PCI configuration registers. * @vha: HA context * * Returns 0 on success. */ int qla24xx_pci_config(scsi_qla_host_t *vha) { uint16_t w; unsigned long flags = 0; struct qla_hw_data *ha = vha->hw; struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; pci_set_master(ha->pdev); pci_try_set_mwi(ha->pdev); <API key>(ha->pdev, PCI_COMMAND, &w); w |= (PCI_COMMAND_PARITY | PCI_COMMAND_SERR); w &= ~<API key>; <API key>(ha->pdev, PCI_COMMAND, w); <API key>(ha->pdev, PCI_LATENCY_TIMER, 0x80); /* PCI-X -- adjust Maximum Memory Read Byte Count (2048). */ if (pci_find_capability(ha->pdev, PCI_CAP_ID_PCIX)) pcix_set_mmrbc(ha->pdev, 2048); /* PCIe -- adjust Maximum Read Request Size (2048). */ if (pci_is_pcie(ha->pdev)) pcie_set_readrq(ha->pdev, 4096); pci_disable_rom(ha->pdev); ha->chip_revision = ha->pdev->revision; /* Get PCI bus information. */ spin_lock_irqsave(&ha->hardware_lock, flags); ha->pci_attr = rd_reg_dword(&reg->ctrl_status); <API key>(&ha->hardware_lock, flags); return QLA_SUCCESS; } /** * qla25xx_pci_config() - Setup ISP25xx PCI configuration registers. * @vha: HA context * * Returns 0 on success. */ int qla25xx_pci_config(scsi_qla_host_t *vha) { uint16_t w; struct qla_hw_data *ha = vha->hw; pci_set_master(ha->pdev); pci_try_set_mwi(ha->pdev); <API key>(ha->pdev, PCI_COMMAND, &w); w |= (PCI_COMMAND_PARITY | PCI_COMMAND_SERR); w &= ~<API key>; <API key>(ha->pdev, PCI_COMMAND, w); /* PCIe -- adjust Maximum Read Request Size (2048). */ if (pci_is_pcie(ha->pdev)) pcie_set_readrq(ha->pdev, 4096); pci_disable_rom(ha->pdev); ha->chip_revision = ha->pdev->revision; return QLA_SUCCESS; } /** * <API key>() - Choose firmware image. * @vha: HA context * * Returns 0 on success. */ static int <API key>(scsi_qla_host_t *vha) { int rval; uint16_t loop_id, topo, sw_cap; uint8_t domain, area, al_pa; struct qla_hw_data *ha = vha->hw; /* Assume loading risc code */ rval = QLA_FUNCTION_FAILED; if (ha->flags.<API key>) { ql_log(ql_log_info, vha, 0x0079, "RISC CODE NOT loaded.\n"); /* Verify checksum of loaded RISC code. */ rval = <API key>(vha, ha->fw_srisc_address); if (rval == QLA_SUCCESS) { /* And, verify we are not in ROM code. */ rval = <API key>(vha, &loop_id, &al_pa, &area, &domain, &topo, &sw_cap); } } if (rval) ql_dbg(ql_dbg_init, vha, 0x007a, "**** Load RISC code ****.\n"); return (rval); } /** * qla2x00_reset_chip() - Reset ISP chip. * @vha: HA context * * Returns 0 on success. */ int qla2x00_reset_chip(scsi_qla_host_t *vha) { unsigned long flags = 0; struct qla_hw_data *ha = vha->hw; struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; uint32_t cnt; uint16_t cmd; int rval = QLA_FUNCTION_FAILED; if (unlikely(pci_channel_offline(ha->pdev))) return rval; ha->isp_ops->disable_intrs(ha); spin_lock_irqsave(&ha->hardware_lock, flags); /* Turn off master enable */ cmd = 0; <API key>(ha->pdev, PCI_COMMAND, &cmd); cmd &= ~PCI_COMMAND_MASTER; <API key>(ha->pdev, PCI_COMMAND, cmd); if (!IS_QLA2100(ha)) { /* Pause RISC. */ wrt_reg_word(&reg->hccr, HCCR_PAUSE_RISC); if (IS_QLA2200(ha) || IS_QLA2300(ha)) { for (cnt = 0; cnt < 30000; cnt++) { if ((rd_reg_word(&reg->hccr) & HCCR_RISC_PAUSE) != 0) break; udelay(100); } } else { rd_reg_word(&reg->hccr); /* PCI Posting. */ udelay(10); } /* Select FPM registers. */ wrt_reg_word(&reg->ctrl_status, 0x20); rd_reg_word(&reg->ctrl_status); /* PCI Posting. */ /* FPM Soft Reset. */ wrt_reg_word(&reg->fpm_diag_config, 0x100); rd_reg_word(&reg->fpm_diag_config); /* PCI Posting. */ /* Toggle Fpm Reset. */ if (!IS_QLA2200(ha)) { wrt_reg_word(&reg->fpm_diag_config, 0x0); rd_reg_word(&reg->fpm_diag_config); /* PCI Posting. */ } /* Select frame buffer registers. */ wrt_reg_word(&reg->ctrl_status, 0x10); rd_reg_word(&reg->ctrl_status); /* PCI Posting. */ /* Reset frame buffer FIFOs. */ if (IS_QLA2200(ha)) { WRT_FB_CMD_REG(ha, reg, 0xa000); RD_FB_CMD_REG(ha, reg); /* PCI Posting. */ } else { WRT_FB_CMD_REG(ha, reg, 0x00fc); /* Read back fb_cmd until zero or 3 seconds max */ for (cnt = 0; cnt < 3000; cnt++) { if ((RD_FB_CMD_REG(ha, reg) & 0xff) == 0) break; udelay(100); } } /* Select RISC module registers. */ wrt_reg_word(&reg->ctrl_status, 0); rd_reg_word(&reg->ctrl_status); /* PCI Posting. */ /* Reset RISC processor. */ wrt_reg_word(&reg->hccr, HCCR_RESET_RISC); rd_reg_word(&reg->hccr); /* PCI Posting. */ /* Release RISC processor. */ wrt_reg_word(&reg->hccr, HCCR_RELEASE_RISC); rd_reg_word(&reg->hccr); /* PCI Posting. */ } wrt_reg_word(&reg->hccr, HCCR_CLR_RISC_INT); wrt_reg_word(&reg->hccr, HCCR_CLR_HOST_INT); /* Reset ISP chip. */ wrt_reg_word(&reg->ctrl_status, CSR_ISP_SOFT_RESET); /* Wait for RISC to recover from reset. */ if (IS_QLA2100(ha) || IS_QLA2200(ha) || IS_QLA2300(ha)) { /* * It is necessary to for a delay here since the card doesn't * respond to PCI reads during a reset. On some architectures * this will result in an MCA. */ udelay(20); for (cnt = 30000; cnt; cnt if ((rd_reg_word(&reg->ctrl_status) & CSR_ISP_SOFT_RESET) == 0) break; udelay(100); } } else udelay(10); /* Reset RISC processor. */ wrt_reg_word(&reg->hccr, HCCR_RESET_RISC); wrt_reg_word(&reg->semaphore, 0); /* Release RISC processor. */ wrt_reg_word(&reg->hccr, HCCR_RELEASE_RISC); rd_reg_word(&reg->hccr); /* PCI Posting. */ if (IS_QLA2100(ha) || IS_QLA2200(ha) || IS_QLA2300(ha)) { for (cnt = 0; cnt < 30000; cnt++) { if (RD_MAILBOX_REG(ha, reg, 0) != MBS_BUSY) break; udelay(100); } } else udelay(100); /* Turn on master enable */ cmd |= PCI_COMMAND_MASTER; <API key>(ha->pdev, PCI_COMMAND, cmd); /* Disable RISC pause on FPM parity error. */ if (!IS_QLA2100(ha)) { wrt_reg_word(&reg->hccr, <API key>); rd_reg_word(&reg->hccr); /* PCI Posting. */ } <API key>(&ha->hardware_lock, flags); return QLA_SUCCESS; } /** * qla81xx_reset_mpi() - Reset's MPI FW via Write MPI Register MBC. * @vha: HA context * * Returns 0 on success. */ static int qla81xx_reset_mpi(scsi_qla_host_t *vha) { uint16_t mb[4] = {0x1010, 0, 1, 0}; if (!IS_QLA81XX(vha->hw)) return QLA_SUCCESS; return <API key>(vha, mb); } /** * qla24xx_reset_risc() - Perform full reset of ISP24xx RISC. * @vha: HA context * * Returns 0 on success. */ static inline int qla24xx_reset_risc(scsi_qla_host_t *vha) { unsigned long flags = 0; struct qla_hw_data *ha = vha->hw; struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; uint32_t cnt; uint16_t wd; static int abts_cnt; /* ISP abort retry counts */ int rval = QLA_SUCCESS; spin_lock_irqsave(&ha->hardware_lock, flags); /* Reset RISC. */ wrt_reg_dword(&reg->ctrl_status, CSRX_DMA_SHUTDOWN|MWB_4096_BYTES); for (cnt = 0; cnt < 30000; cnt++) { if ((rd_reg_dword(&reg->ctrl_status) & CSRX_DMA_ACTIVE) == 0) break; udelay(10); } if (!(rd_reg_dword(&reg->ctrl_status) & CSRX_DMA_ACTIVE)) set_bit(DMA_SHUTDOWN_CMPL, &ha->fw_dump_cap_flags); ql_dbg(ql_dbg_init + ql_dbg_verbose, vha, 0x017e, "HCCR: 0x%x, Control Status %x, DMA active status:0x%x\n", rd_reg_dword(&reg->hccr), rd_reg_dword(&reg->ctrl_status), (rd_reg_dword(&reg->ctrl_status) & CSRX_DMA_ACTIVE)); wrt_reg_dword(&reg->ctrl_status, CSRX_ISP_SOFT_RESET|CSRX_DMA_SHUTDOWN|MWB_4096_BYTES); <API key>(ha->pdev, PCI_COMMAND, &wd); udelay(100); /* Wait for firmware to complete NVRAM accesses. */ rd_reg_word(&reg->mailbox0); for (cnt = 10000; rd_reg_word(&reg->mailbox0) != 0 && rval == QLA_SUCCESS; cnt barrier(); if (cnt) udelay(5); else rval = <API key>; } if (rval == QLA_SUCCESS) set_bit(ISP_MBX_RDY, &ha->fw_dump_cap_flags); ql_dbg(ql_dbg_init + ql_dbg_verbose, vha, 0x017f, "HCCR: 0x%x, MailBox0 Status 0x%x\n", rd_reg_dword(&reg->hccr), rd_reg_word(&reg->mailbox0)); /* Wait for soft-reset to complete. */ rd_reg_dword(&reg->ctrl_status); for (cnt = 0; cnt < 60; cnt++) { barrier(); if ((rd_reg_dword(&reg->ctrl_status) & CSRX_ISP_SOFT_RESET) == 0) break; udelay(5); } if (!(rd_reg_dword(&reg->ctrl_status) & CSRX_ISP_SOFT_RESET)) set_bit(ISP_SOFT_RESET_CMPL, &ha->fw_dump_cap_flags); ql_dbg(ql_dbg_init + ql_dbg_verbose, vha, 0x015d, "HCCR: 0x%x, Soft Reset status: 0x%x\n", rd_reg_dword(&reg->hccr), rd_reg_dword(&reg->ctrl_status)); /* If required, do an MPI FW reset now */ if (test_and_clear_bit(MPI_RESET_NEEDED, &vha->dpc_flags)) { if (qla81xx_reset_mpi(vha) != QLA_SUCCESS) { if (++abts_cnt < 5) { set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); set_bit(MPI_RESET_NEEDED, &vha->dpc_flags); } else { /* * We exhausted the ISP abort retries. We have to * set the board offline. */ abts_cnt = 0; vha->flags.online = 0; } } } wrt_reg_dword(&reg->hccr, <API key>); rd_reg_dword(&reg->hccr); wrt_reg_dword(&reg->hccr, <API key>); rd_reg_dword(&reg->hccr); wrt_reg_dword(&reg->hccr, <API key>); rd_reg_dword(&reg->hccr); rd_reg_word(&reg->mailbox0); for (cnt = 60; rd_reg_word(&reg->mailbox0) != 0 && rval == QLA_SUCCESS; cnt barrier(); if (cnt) udelay(5); else rval = <API key>; } if (rval == QLA_SUCCESS) set_bit(RISC_RDY_AFT_RESET, &ha->fw_dump_cap_flags); ql_dbg(ql_dbg_init + ql_dbg_verbose, vha, 0x015e, "Host Risc 0x%x, mailbox0 0x%x\n", rd_reg_dword(&reg->hccr), rd_reg_word(&reg->mailbox0)); <API key>(&ha->hardware_lock, flags); ql_dbg(ql_dbg_init + ql_dbg_verbose, vha, 0x015f, "Driver in %s mode\n", IS_NOPOLLING_TYPE(ha) ? "Interrupt" : "Polling"); if (IS_NOPOLLING_TYPE(ha)) ha->isp_ops->enable_intrs(ha); return rval; } static void <API key>(scsi_qla_host_t *vha, uint32_t *data) { struct device_reg_24xx __iomem *reg = &vha->hw->iobase->isp24; wrt_reg_dword(&reg->iobase_addr, <API key>); *data = rd_reg_dword(&reg->iobase_window + <API key>); } static void <API key>(scsi_qla_host_t *vha, uint32_t data) { struct device_reg_24xx __iomem *reg = &vha->hw->iobase->isp24; wrt_reg_dword(&reg->iobase_addr, <API key>); wrt_reg_dword(&reg->iobase_window + <API key>, data); } static void <API key>(scsi_qla_host_t *vha) { uint32_t wd32 = 0; uint delta_msec = 100; uint elapsed_msec = 0; uint timeout_msec; ulong n; if (vha->hw->pdev->subsystem_device != 0x0175 && vha->hw->pdev->subsystem_device != 0x0240) return; wrt_reg_dword(&vha->hw->iobase->isp24.hccr, <API key>); udelay(100); attempt: timeout_msec = TIMEOUT_SEMAPHORE; n = timeout_msec / delta_msec; while (n <API key>(vha, RISC_SEMAPHORE_SET); <API key>(vha, &wd32); if (wd32 & RISC_SEMAPHORE) break; msleep(delta_msec); elapsed_msec += delta_msec; if (elapsed_msec > <API key>) goto force; } if (!(wd32 & RISC_SEMAPHORE)) goto force; if (!(wd32 & <API key>)) goto acquired; <API key>(vha, RISC_SEMAPHORE_CLR); timeout_msec = <API key>; n = timeout_msec / delta_msec; while (n <API key>(vha, &wd32); if (!(wd32 & <API key>)) break; msleep(delta_msec); elapsed_msec += delta_msec; if (elapsed_msec > <API key>) goto force; } if (wd32 & <API key>) <API key>(vha, <API key>); goto attempt; force: <API key>(vha, <API key>); acquired: return; } /** * qla24xx_reset_chip() - Reset ISP24xx chip. * @vha: HA context * * Returns 0 on success. */ int qla24xx_reset_chip(scsi_qla_host_t *vha) { struct qla_hw_data *ha = vha->hw; int rval = QLA_FUNCTION_FAILED; if (pci_channel_offline(ha->pdev) && ha->flags.<API key>) { return rval; } ha->isp_ops->disable_intrs(ha); <API key>(vha); /* Perform RISC reset. */ rval = qla24xx_reset_risc(vha); return rval; } /** * qla2x00_chip_diag() - Test chip for proper operation. * @vha: HA context * * Returns 0 on success. */ int qla2x00_chip_diag(scsi_qla_host_t *vha) { int rval; struct qla_hw_data *ha = vha->hw; struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; unsigned long flags = 0; uint16_t data; uint32_t cnt; uint16_t mb[5]; struct req_que *req = ha->req_q_map[0]; /* Assume a failed state */ rval = QLA_FUNCTION_FAILED; ql_dbg(ql_dbg_init, vha, 0x007b, "Testing device at %p.\n", &reg->flash_address); spin_lock_irqsave(&ha->hardware_lock, flags); /* Reset ISP chip. */ wrt_reg_word(&reg->ctrl_status, CSR_ISP_SOFT_RESET); /* * We need to have a delay here since the card will not respond while * in reset causing an MCA on some architectures. */ udelay(20); data = <API key>(&reg->ctrl_status); for (cnt = 6000000 ; cnt && (data & CSR_ISP_SOFT_RESET); cnt udelay(5); data = rd_reg_word(&reg->ctrl_status); barrier(); } if (!cnt) goto chip_diag_failed; ql_dbg(ql_dbg_init, vha, 0x007c, "Reset register cleared by chip reset.\n"); /* Reset RISC processor. */ wrt_reg_word(&reg->hccr, HCCR_RESET_RISC); wrt_reg_word(&reg->hccr, HCCR_RELEASE_RISC); /* Workaround for QLA2312 PCI parity error */ if (IS_QLA2100(ha) || IS_QLA2200(ha) || IS_QLA2300(ha)) { data = <API key>(MAILBOX_REG(ha, reg, 0)); for (cnt = 6000000; cnt && (data == MBS_BUSY); cnt udelay(5); data = RD_MAILBOX_REG(ha, reg, 0); barrier(); } } else udelay(10); if (!cnt) goto chip_diag_failed; /* Check product ID of chip */ ql_dbg(ql_dbg_init, vha, 0x007d, "Checking product ID of chip.\n"); mb[1] = RD_MAILBOX_REG(ha, reg, 1); mb[2] = RD_MAILBOX_REG(ha, reg, 2); mb[3] = RD_MAILBOX_REG(ha, reg, 3); mb[4] = <API key>(MAILBOX_REG(ha, reg, 4)); if (mb[1] != PROD_ID_1 || (mb[2] != PROD_ID_2 && mb[2] != PROD_ID_2a) || mb[3] != PROD_ID_3) { ql_log(ql_log_warn, vha, 0x0062, "Wrong product ID = 0x%x,0x%x,0x%x.\n", mb[1], mb[2], mb[3]); goto chip_diag_failed; } ha->product_id[0] = mb[1]; ha->product_id[1] = mb[2]; ha->product_id[2] = mb[3]; ha->product_id[3] = mb[4]; /* Adjust fw RISC transfer size */ if (req->length > 1024) ha->fw_transfer_size = REQUEST_ENTRY_SIZE * 1024; else ha->fw_transfer_size = REQUEST_ENTRY_SIZE * req->length; if (IS_QLA2200(ha) && RD_MAILBOX_REG(ha, reg, 7) == <API key>) { /* Limit firmware transfer size with a 2200A */ ql_dbg(ql_dbg_init, vha, 0x007e, "Found QLA2200A Chip.\n"); ha->device_type |= DT_ISP2200A; ha->fw_transfer_size = 128; } /* Wrap Incoming Mailboxes Test. */ <API key>(&ha->hardware_lock, flags); ql_dbg(ql_dbg_init, vha, 0x007f, "Checking mailboxes.\n"); rval = <API key>(vha); if (rval) ql_log(ql_log_warn, vha, 0x0080, "Failed mailbox send register test.\n"); else /* Flag a successful rval */ rval = QLA_SUCCESS; spin_lock_irqsave(&ha->hardware_lock, flags); chip_diag_failed: if (rval) ql_log(ql_log_info, vha, 0x0081, "Chip diagnostics **** FAILED ****.\n"); <API key>(&ha->hardware_lock, flags); return (rval); } /** * qla24xx_chip_diag() - Test ISP24xx for proper operation. * @vha: HA context * * Returns 0 on success. */ int qla24xx_chip_diag(scsi_qla_host_t *vha) { int rval; struct qla_hw_data *ha = vha->hw; struct req_que *req = ha->req_q_map[0]; if (IS_P3P_TYPE(ha)) return QLA_SUCCESS; ha->fw_transfer_size = REQUEST_ENTRY_SIZE * req->length; rval = <API key>(vha); if (rval) { ql_log(ql_log_warn, vha, 0x0082, "Failed mailbox send register test.\n"); } else { /* Flag a successful rval */ rval = QLA_SUCCESS; } return rval; } static void <API key>(scsi_qla_host_t *vha) { int rval; dma_addr_t tc_dma; void *tc; struct qla_hw_data *ha = vha->hw; if (!IS_FWI2_CAPABLE(ha)) return; if (!IS_QLA25XX(ha) && !IS_QLA81XX(ha) && !IS_QLA83XX(ha) && !IS_QLA27XX(ha) && !IS_QLA28XX(ha)) return; if (ha->fce) { ql_dbg(ql_dbg_init, vha, 0x00bd, "%s: FCE Mem is already allocated.\n", __func__); return; } /* Allocate memory for Fibre Channel Event Buffer. */ tc = dma_alloc_coherent(&ha->pdev->dev, FCE_SIZE, &tc_dma, GFP_KERNEL); if (!tc) { ql_log(ql_log_warn, vha, 0x00be, "Unable to allocate (%d KB) for FCE.\n", FCE_SIZE / 1024); return; } rval = <API key>(vha, tc_dma, FCE_NUM_BUFFERS, ha->fce_mb, &ha->fce_bufs); if (rval) { ql_log(ql_log_warn, vha, 0x00bf, "Unable to initialize FCE (%d).\n", rval); dma_free_coherent(&ha->pdev->dev, FCE_SIZE, tc, tc_dma); return; } ql_dbg(ql_dbg_init, vha, 0x00c0, "Allocated (%d KB) for FCE...\n", FCE_SIZE / 1024); ha->flags.fce_enabled = 1; ha->fce_dma = tc_dma; ha->fce = tc; } static void <API key>(scsi_qla_host_t *vha) { int rval; dma_addr_t tc_dma; void *tc; struct qla_hw_data *ha = vha->hw; if (!IS_FWI2_CAPABLE(ha)) return; if (ha->eft) { ql_dbg(ql_dbg_init, vha, 0x00bd, "%s: EFT Mem is already allocated.\n", __func__); return; } /* Allocate memory for Extended Trace Buffer. */ tc = dma_alloc_coherent(&ha->pdev->dev, EFT_SIZE, &tc_dma, GFP_KERNEL); if (!tc) { ql_log(ql_log_warn, vha, 0x00c1, "Unable to allocate (%d KB) for EFT.\n", EFT_SIZE / 1024); return; } rval = <API key>(vha, tc_dma, EFT_NUM_BUFFERS); if (rval) { ql_log(ql_log_warn, vha, 0x00c2, "Unable to initialize EFT (%d).\n", rval); dma_free_coherent(&ha->pdev->dev, EFT_SIZE, tc, tc_dma); return; } ql_dbg(ql_dbg_init, vha, 0x00c3, "Allocated (%d KB) EFT ...\n", EFT_SIZE / 1024); ha->eft_dma = tc_dma; ha->eft = tc; } static void <API key>(scsi_qla_host_t *vha) { <API key>(vha); <API key>(vha); } void <API key>(scsi_qla_host_t *vha) { uint32_t dump_size, fixed_size, mem_size, req_q_size, rsp_q_size, eft_size, fce_size, mq_size; struct qla_hw_data *ha = vha->hw; struct req_que *req = ha->req_q_map[0]; struct rsp_que *rsp = ha->rsp_q_map[0]; struct qla2xxx_fw_dump *fw_dump; dump_size = fixed_size = mem_size = eft_size = fce_size = mq_size = 0; req_q_size = rsp_q_size = 0; if (IS_QLA2100(ha) || IS_QLA2200(ha)) { fixed_size = sizeof(struct qla2100_fw_dump); } else if (IS_QLA23XX(ha)) { fixed_size = offsetof(struct qla2300_fw_dump, data_ram); mem_size = (ha->fw_memory_size - 0x11000 + 1) * sizeof(uint16_t); } else if (IS_FWI2_CAPABLE(ha)) { if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) fixed_size = offsetof(struct qla83xx_fw_dump, ext_mem); else if (IS_QLA81XX(ha)) fixed_size = offsetof(struct qla81xx_fw_dump, ext_mem); else if (IS_QLA25XX(ha)) fixed_size = offsetof(struct qla25xx_fw_dump, ext_mem); else fixed_size = offsetof(struct qla24xx_fw_dump, ext_mem); mem_size = (ha->fw_memory_size - 0x100000 + 1) * sizeof(uint32_t); if (ha->mqenable) { if (!IS_QLA83XX(ha) && !IS_QLA27XX(ha) && !IS_QLA28XX(ha)) mq_size = sizeof(struct qla2xxx_mq_chain); /* * Allocate maximum buffer size for all queues - Q0. * Resizing must be done at end-of-dump processing. */ mq_size += (ha->max_req_queues - 1) * (req->length * sizeof(request_t)); mq_size += (ha->max_rsp_queues - 1) * (rsp->length * sizeof(response_t)); } if (ha->tgt.atio_ring) mq_size += ha->tgt.atio_q_length * sizeof(request_t); <API key>(vha); if (ha->fce) fce_size = sizeof(struct qla2xxx_fce_chain) + FCE_SIZE; <API key>(vha); if (ha->eft) eft_size = EFT_SIZE; } if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) { struct fwdt *fwdt = ha->fwdt; uint j; for (j = 0; j < 2; j++, fwdt++) { if (!fwdt->template) { ql_dbg(ql_dbg_init, vha, 0x00ba, "-> fwdt%u no template\n", j); continue; } ql_dbg(ql_dbg_init, vha, 0x00fa, "-> fwdt%u calculating fwdump size...\n", j); fwdt->dump_size = <API key>( vha, fwdt->template); ql_dbg(ql_dbg_init, vha, 0x00fa, "-> fwdt%u calculated fwdump size = %#lx bytes\n", j, fwdt->dump_size); dump_size += fwdt->dump_size; } /* Add space for spare MPI fw dump. */ dump_size += ha->fwdt[1].dump_size; } else { req_q_size = req->length * sizeof(request_t); rsp_q_size = rsp->length * sizeof(response_t); dump_size = offsetof(struct qla2xxx_fw_dump, isp); dump_size += fixed_size + mem_size + req_q_size + rsp_q_size + eft_size; ha->chain_offset = dump_size; dump_size += mq_size + fce_size; if (ha->exchoffld_buf) dump_size += sizeof(struct qla2xxx_offld_chain) + ha->exchoffld_size; if (ha->exlogin_buf) dump_size += sizeof(struct qla2xxx_offld_chain) + ha->exlogin_size; } if (!ha->fw_dump_len || dump_size > ha->fw_dump_alloc_len) { ql_dbg(ql_dbg_init, vha, 0x00c5, "%s dump_size %d fw_dump_len %d fw_dump_alloc_len %d\n", __func__, dump_size, ha->fw_dump_len, ha->fw_dump_alloc_len); fw_dump = vmalloc(dump_size); if (!fw_dump) { ql_log(ql_log_warn, vha, 0x00c4, "Unable to allocate (%d KB) for firmware dump.\n", dump_size / 1024); } else { mutex_lock(&ha->optrom_mutex); if (ha->fw_dumped) { memcpy(fw_dump, ha->fw_dump, ha->fw_dump_len); vfree(ha->fw_dump); ha->fw_dump = fw_dump; ha->fw_dump_alloc_len = dump_size; ql_dbg(ql_dbg_init, vha, 0x00c5, "Re-Allocated (%d KB) and save firmware dump.\n", dump_size / 1024); } else { vfree(ha->fw_dump); ha->fw_dump = fw_dump; ha->fw_dump_len = ha->fw_dump_alloc_len = dump_size; ql_dbg(ql_dbg_init, vha, 0x00c5, "Allocated (%d KB) for firmware dump.\n", dump_size / 1024); if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) { ha->mpi_fw_dump = (char *)fw_dump + ha->fwdt[1].dump_size; mutex_unlock(&ha->optrom_mutex); return; } ha->fw_dump->signature[0] = 'Q'; ha->fw_dump->signature[1] = 'L'; ha->fw_dump->signature[2] = 'G'; ha->fw_dump->signature[3] = 'C'; ha->fw_dump->version = htonl(1); ha->fw_dump->fixed_size = htonl(fixed_size); ha->fw_dump->mem_size = htonl(mem_size); ha->fw_dump->req_q_size = htonl(req_q_size); ha->fw_dump->rsp_q_size = htonl(rsp_q_size); ha->fw_dump->eft_size = htonl(eft_size); ha->fw_dump->eft_addr_l = htonl(LSD(ha->eft_dma)); ha->fw_dump->eft_addr_h = htonl(MSD(ha->eft_dma)); ha->fw_dump->header_size = htonl(offsetof (struct qla2xxx_fw_dump, isp)); } mutex_unlock(&ha->optrom_mutex); } } } static int qla81xx_mpi_sync(scsi_qla_host_t *vha) { #define MPS_MASK 0xe0 int rval; uint16_t dc; uint32_t dw; if (!IS_QLA81XX(vha->hw)) return QLA_SUCCESS; rval = <API key>(vha, 0x7c00, 1); if (rval != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x0105, "Unable to acquire semaphore.\n"); goto done; } <API key>(vha->hw->pdev, 0x54, &dc); rval = <API key>(vha, 0x7a15, &dw); if (rval != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x0067, "Unable to read sync.\n"); goto done_release; } dc &= MPS_MASK; if (dc == (dw & MPS_MASK)) goto done_release; dw &= ~MPS_MASK; dw |= dc; rval = <API key>(vha, 0x7a15, dw); if (rval != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x0114, "Unable to gain sync.\n"); } done_release: rval = <API key>(vha, 0x7c00, 0); if (rval != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x006d, "Unable to release semaphore.\n"); } done: return rval; } int <API key>(struct qla_hw_data *ha, struct req_que *req) { /* Don't try to reallocate the array */ if (req->outstanding_cmds) return QLA_SUCCESS; if (!IS_FWI2_CAPABLE(ha)) req-><API key> = <API key>; else { if (ha->cur_fw_xcb_count <= ha->cur_fw_iocb_count) req-><API key> = ha->cur_fw_xcb_count; else req-><API key> = ha->cur_fw_iocb_count; } req->outstanding_cmds = kcalloc(req-><API key>, sizeof(srb_t *), GFP_KERNEL); if (!req->outstanding_cmds) { /* * Try to allocate a minimal size just so we can get through * initialization. */ req-><API key> = <API key>; req->outstanding_cmds = kcalloc(req-><API key>, sizeof(srb_t *), GFP_KERNEL); if (!req->outstanding_cmds) { ql_log(ql_log_fatal, NULL, 0x0126, "Failed to allocate memory for " "outstanding_cmds for req_que %p.\n", req); req-><API key> = 0; return QLA_FUNCTION_FAILED; } } return QLA_SUCCESS; } #define PRINT_FIELD(_field, _flag, _str) { \ if (a0->_field & _flag) {\ if (p) {\ strcat(ptr, "|");\ ptr++;\ leftover } \ len = snprintf(ptr, leftover, "%s", _str); \ p = 1;\ leftover -= len;\ ptr += len; \ } \ } static void <API key>(struct scsi_qla_host *vha) { #define STR_LEN 64 struct sff_8247_a0 *a0 = (struct sff_8247_a0 *)vha->hw->sfp_data; u8 str[STR_LEN], *ptr, p; int leftover, len; memset(str, 0, STR_LEN); snprintf(str, SFF_VEN_NAME_LEN+1, a0->vendor_name); ql_dbg(ql_dbg_init, vha, 0x015a, "SFP MFG Name: %s\n", str); memset(str, 0, STR_LEN); snprintf(str, SFF_PART_NAME_LEN+1, a0->vendor_pn); ql_dbg(ql_dbg_init, vha, 0x015c, "SFP Part Name: %s\n", str); /* media */ memset(str, 0, STR_LEN); ptr = str; leftover = STR_LEN; p = len = 0; PRINT_FIELD(fc_med_cc9, FC_MED_TW, "Twin AX"); PRINT_FIELD(fc_med_cc9, FC_MED_TP, "Twisted Pair"); PRINT_FIELD(fc_med_cc9, FC_MED_MI, "Min Coax"); PRINT_FIELD(fc_med_cc9, FC_MED_TV, "Video Coax"); PRINT_FIELD(fc_med_cc9, FC_MED_M6, "MultiMode 62.5um"); PRINT_FIELD(fc_med_cc9, FC_MED_M5, "MultiMode 50um"); PRINT_FIELD(fc_med_cc9, FC_MED_SM, "SingleMode"); ql_dbg(ql_dbg_init, vha, 0x0160, "SFP Media: %s\n", str); /* link length */ memset(str, 0, STR_LEN); ptr = str; leftover = STR_LEN; p = len = 0; PRINT_FIELD(fc_ll_cc7, FC_LL_VL, "Very Long"); PRINT_FIELD(fc_ll_cc7, FC_LL_S, "Short"); PRINT_FIELD(fc_ll_cc7, FC_LL_I, "Intermediate"); PRINT_FIELD(fc_ll_cc7, FC_LL_L, "Long"); PRINT_FIELD(fc_ll_cc7, FC_LL_M, "Medium"); ql_dbg(ql_dbg_init, vha, 0x0196, "SFP Link Length: %s\n", str); memset(str, 0, STR_LEN); ptr = str; leftover = STR_LEN; p = len = 0; PRINT_FIELD(fc_ll_cc7, FC_LL_SA, "Short Wave (SA)"); PRINT_FIELD(fc_ll_cc7, FC_LL_LC, "Long Wave(LC)"); PRINT_FIELD(fc_tec_cc8, FC_TEC_SN, "Short Wave (SN)"); PRINT_FIELD(fc_tec_cc8, FC_TEC_SL, "Short Wave (SL)"); PRINT_FIELD(fc_tec_cc8, FC_TEC_LL, "Long Wave (LL)"); ql_dbg(ql_dbg_init, vha, 0x016e, "SFP FC Link Tech: %s\n", str); if (a0->length_km) ql_dbg(ql_dbg_init, vha, 0x016f, "SFP Distant: %d km\n", a0->length_km); if (a0->length_100m) ql_dbg(ql_dbg_init, vha, 0x0170, "SFP Distant: %d m\n", a0->length_100m*100); if (a0->length_50um_10m) ql_dbg(ql_dbg_init, vha, 0x0189, "SFP Distant (WL=50um): %d m\n", a0->length_50um_10m * 10); if (a0->length_62um_10m) ql_dbg(ql_dbg_init, vha, 0x018a, "SFP Distant (WL=62.5um): %d m\n", a0->length_62um_10m * 10); if (a0->length_om4_10m) ql_dbg(ql_dbg_init, vha, 0x0194, "SFP Distant (OM4): %d m\n", a0->length_om4_10m * 10); if (a0->length_om3_10m) ql_dbg(ql_dbg_init, vha, 0x0195, "SFP Distant (OM3): %d m\n", a0->length_om3_10m * 10); } /** * qla24xx_detect_sfp() * * @vha: adapter state pointer. * * @return * 0 -- Configure firmware to use short-range settings -- normal * buffer-to-buffer credits. * * 1 -- Configure firmware to use long-range settings -- extra * buffer-to-buffer credits should be allocated with * ha->lr_distance containing distance settings from NVRAM or SFP * (if supported). */ int qla24xx_detect_sfp(scsi_qla_host_t *vha) { int rc, used_nvram; struct sff_8247_a0 *a; struct qla_hw_data *ha = vha->hw; struct nvram_81xx *nv = ha->nvram; #define LR_DISTANCE_UNKNOWN 2 static const char * const types[] = { "Short", "Long" }; static const char * const lengths[] = { "(10km)", "(5km)", "" }; u8 ll = 0; /* Seed with NVRAM settings. */ used_nvram = 0; ha->flags.lr_detected = 0; if (<API key>(ha) && (nv->enhanced_features & NEF_LR_DIST_ENABLE)) { used_nvram = 1; ha->flags.lr_detected = 1; ha->lr_distance = (nv->enhanced_features >> LR_DIST_NV_POS) & LR_DIST_NV_MASK; } if (!IS_BPM_ENABLED(vha)) goto out; /* Determine SR/LR capabilities of SFP/Transceiver. */ rc = <API key>(vha, NULL, 0); if (rc) goto out; used_nvram = 0; a = (struct sff_8247_a0 *)vha->hw->sfp_data; <API key>(vha); ha->flags.lr_detected = 0; ll = a->fc_ll_cc7; if (ll & FC_LL_VL || ll & FC_LL_L) { /* Long range, track length. */ ha->flags.lr_detected = 1; if (a->length_km > 5 || a->length_100m > 50) ha->lr_distance = LR_DISTANCE_10K; else ha->lr_distance = LR_DISTANCE_5K; } out: ql_dbg(ql_dbg_async, vha, 0x507b, "SFP detect: %s-Range SFP %s (nvr=%x ll=%x lr=%x lrd=%x).\n", types[ha->flags.lr_detected], ha->flags.lr_detected ? lengths[ha->lr_distance] : lengths[LR_DISTANCE_UNKNOWN], used_nvram, ll, ha->flags.lr_detected, ha->lr_distance); return ha->flags.lr_detected; } void qla_init_iocb_limit(scsi_qla_host_t *vha) { u16 i, num_qps; u32 limit; struct qla_hw_data *ha = vha->hw; num_qps = ha->num_qpairs + 1; limit = (ha->orig_fw_iocb_count * QLA_IOCB_PCT_LIMIT) / 100; ha->base_qpair->fwres.iocbs_total = ha->orig_fw_iocb_count; ha->base_qpair->fwres.iocbs_limit = limit; ha->base_qpair->fwres.iocbs_qp_limit = limit / num_qps; ha->base_qpair->fwres.iocbs_used = 0; for (i = 0; i < ha->max_qpairs; i++) { if (ha->queue_pair_map[i]) { ha->queue_pair_map[i]->fwres.iocbs_total = ha->orig_fw_iocb_count; ha->queue_pair_map[i]->fwres.iocbs_limit = limit; ha->queue_pair_map[i]->fwres.iocbs_qp_limit = limit / num_qps; ha->queue_pair_map[i]->fwres.iocbs_used = 0; } } } /** * qla2x00_setup_chip() - Load and start RISC firmware. * @vha: HA context * * Returns 0 on success. */ static int qla2x00_setup_chip(scsi_qla_host_t *vha) { int rval; uint32_t srisc_address = 0; struct qla_hw_data *ha = vha->hw; struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; unsigned long flags; uint16_t fw_major_version; int done_once = 0; if (IS_P3P_TYPE(ha)) { rval = ha->isp_ops->load_risc(vha, &srisc_address); if (rval == QLA_SUCCESS) { <API key>(vha); goto enable_82xx_npiv; } else goto failed; } if (!IS_FWI2_CAPABLE(ha) && !IS_QLA2100(ha) && !IS_QLA2200(ha)) { /* Disable SRAM, Instruction RAM and GP RAM parity. */ spin_lock_irqsave(&ha->hardware_lock, flags); wrt_reg_word(&reg->hccr, (HCCR_ENABLE_PARITY + 0x0)); rd_reg_word(&reg->hccr); <API key>(&ha->hardware_lock, flags); } qla81xx_mpi_sync(vha); execute_fw_with_lr: /* Load firmware sequences */ rval = ha->isp_ops->load_risc(vha, &srisc_address); if (rval == QLA_SUCCESS) { ql_dbg(ql_dbg_init, vha, 0x00c9, "Verifying Checksum of loaded RISC code.\n"); rval = <API key>(vha, srisc_address); if (rval == QLA_SUCCESS) { /* Start firmware execution. */ ql_dbg(ql_dbg_init, vha, 0x00ca, "Starting firmware.\n"); if (ql2xexlogins) ha->flags.exlogins_enabled = 1; if (<API key>(vha)) ha->flags.exchoffld_enabled = 1; rval = qla2x00_execute_fw(vha, srisc_address); /* Retrieve firmware information. */ if (rval == QLA_SUCCESS) { /* Enable BPM support? */ if (!done_once++ && qla24xx_detect_sfp(vha)) { ql_dbg(ql_dbg_init, vha, 0x00ca, "Re-starting firmware -- BPM.\n"); /* Best-effort - re-init. */ ha->isp_ops->reset_chip(vha); ha->isp_ops->chip_diag(vha); goto execute_fw_with_lr; } if (<API key>(ha)) <API key>(vha, ha->last_zio_threshold); rval = <API key>(vha); if (rval != QLA_SUCCESS) goto failed; rval = <API key>(vha); if (rval != QLA_SUCCESS) goto failed; enable_82xx_npiv: fw_major_version = ha->fw_major_version; if (IS_P3P_TYPE(ha)) <API key>(vha); else rval = <API key>(vha); if (rval != QLA_SUCCESS) goto failed; ha->flags.npiv_supported = 0; if (IS_QLA2XXX_MIDTYPE(ha) && (ha->fw_attributes & BIT_2)) { ha->flags.npiv_supported = 1; if ((!ha->max_npiv_vports) || ((ha->max_npiv_vports + 1) % MIN_MULTI_ID_FABRIC)) ha->max_npiv_vports = MIN_MULTI_ID_FABRIC - 1; } <API key>(vha); qla_init_iocb_limit(vha); /* * Allocate the array of outstanding commands * now that we know the firmware resources. */ rval = <API key>(ha, vha->req); if (rval != QLA_SUCCESS) goto failed; if (!fw_major_version && !(IS_P3P_TYPE(ha))) <API key>(vha); if (ql2xallocfwdump && !(IS_P3P_TYPE(ha))) <API key>(vha); } else { goto failed; } } else { ql_log(ql_log_fatal, vha, 0x00cd, "ISP Firmware failed checksum.\n"); goto failed; } /* Enable PUREX PASSTHRU */ if (ql2xrdpenable || ha->flags.scm_supported_f) <API key>(vha); } else goto failed; if (!IS_FWI2_CAPABLE(ha) && !IS_QLA2100(ha) && !IS_QLA2200(ha)) { /* Enable proper parity. */ spin_lock_irqsave(&ha->hardware_lock, flags); if (IS_QLA2300(ha)) /* SRAM parity */ wrt_reg_word(&reg->hccr, HCCR_ENABLE_PARITY + 0x1); else /* SRAM, Instruction RAM and GP RAM parity */ wrt_reg_word(&reg->hccr, HCCR_ENABLE_PARITY + 0x7); rd_reg_word(&reg->hccr); <API key>(&ha->hardware_lock, flags); } if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) ha->flags.fac_supported = 1; else if (rval == QLA_SUCCESS && IS_FAC_REQUIRED(ha)) { uint32_t size; rval = <API key>(vha, &size); if (rval == QLA_SUCCESS) { ha->flags.fac_supported = 1; ha->fdt_block_size = size << 2; } else { ql_log(ql_log_warn, vha, 0x00ce, "Unsupported FAC firmware (%d.%02d.%02d).\n", ha->fw_major_version, ha->fw_minor_version, ha->fw_subminor_version); if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) { ha->flags.fac_supported = 0; rval = QLA_SUCCESS; } } } failed: if (rval) { ql_log(ql_log_fatal, vha, 0x00cf, "Setup chip ****FAILED****.\n"); } return (rval); } /** * <API key>() - Initializes response queue entries. * @rsp: response queue * * Beginning of request ring has initialization control block already built * by nvram config routine. * * Returns 0 on success. */ void <API key>(struct rsp_que *rsp) { uint16_t cnt; response_t *pkt; rsp->ring_ptr = rsp->ring; rsp->ring_index = 0; rsp->status_srb = NULL; pkt = rsp->ring_ptr; for (cnt = 0; cnt < rsp->length; cnt++) { pkt->signature = RESPONSE_PROCESSED; pkt++; } } /** * <API key>() - Read and process firmware options. * @vha: HA context * * Returns 0 on success. */ void <API key>(scsi_qla_host_t *vha) { uint16_t swing, emphasis, tx_sens, rx_sens; struct qla_hw_data *ha = vha->hw; memset(ha->fw_options, 0, sizeof(ha->fw_options)); <API key>(vha, ha->fw_options); if (IS_QLA2100(ha) || IS_QLA2200(ha)) return; /* Serial Link options. */ ql_dbg(ql_dbg_init + ql_dbg_buffer, vha, 0x0115, "Serial link options.\n"); ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x0109, ha-><API key>, sizeof(ha-><API key>)); ha->fw_options[1] &= ~<API key>; if (ha-><API key>[3] & BIT_2) { ha->fw_options[1] |= <API key>; /* 1G settings */ swing = ha-><API key>[2] & (BIT_2 | BIT_1 | BIT_0); emphasis = (ha-><API key>[2] & (BIT_4 | BIT_3)) >> 3; tx_sens = ha-><API key>[0] & (BIT_3 | BIT_2 | BIT_1 | BIT_0); rx_sens = (ha-><API key>[0] & (BIT_7 | BIT_6 | BIT_5 | BIT_4)) >> 4; ha->fw_options[10] = (emphasis << 14) | (swing << 8); if (IS_QLA2300(ha) || IS_QLA2312(ha) || IS_QLA6312(ha)) { if (rx_sens == 0x0) rx_sens = 0x3; ha->fw_options[10] |= (tx_sens << 4) | rx_sens; } else if (IS_QLA2322(ha) || IS_QLA6322(ha)) ha->fw_options[10] |= BIT_5 | ((rx_sens & (BIT_1 | BIT_0)) << 2) | (tx_sens & (BIT_1 | BIT_0)); /* 2G settings */ swing = (ha-><API key>[2] & (BIT_7 | BIT_6 | BIT_5)) >> 5; emphasis = ha-><API key>[3] & (BIT_1 | BIT_0); tx_sens = ha-><API key>[1] & (BIT_3 | BIT_2 | BIT_1 | BIT_0); rx_sens = (ha-><API key>[1] & (BIT_7 | BIT_6 | BIT_5 | BIT_4)) >> 4; ha->fw_options[11] = (emphasis << 14) | (swing << 8); if (IS_QLA2300(ha) || IS_QLA2312(ha) || IS_QLA6312(ha)) { if (rx_sens == 0x0) rx_sens = 0x3; ha->fw_options[11] |= (tx_sens << 4) | rx_sens; } else if (IS_QLA2322(ha) || IS_QLA6322(ha)) ha->fw_options[11] |= BIT_5 | ((rx_sens & (BIT_1 | BIT_0)) << 2) | (tx_sens & (BIT_1 | BIT_0)); } /* FCP2 options. */ /* Return command IOCBs without waiting for an ABTS to complete. */ ha->fw_options[3] |= BIT_13; /* LED scheme. */ if (ha->flags.enable_led_scheme) ha->fw_options[2] |= BIT_12; /* Detect ISP6312. */ if (IS_QLA6312(ha)) ha->fw_options[2] |= BIT_13; /* Set Retry FLOGI in case of P2P connection */ if (ha->operating_mode == P2P) { ha->fw_options[2] |= BIT_3; ql_dbg(ql_dbg_disc, vha, 0x2100, "(%s): Setting FLOGI retry BIT in fw_options[2]: 0x%x\n", __func__, ha->fw_options[2]); } /* Update firmware options. */ <API key>(vha, ha->fw_options); } void <API key>(scsi_qla_host_t *vha) { int rval; struct qla_hw_data *ha = vha->hw; if (IS_P3P_TYPE(ha)) return; /* Hold status IOCBs until ABTS response received. */ if (ql2xfwholdabts) ha->fw_options[3] |= BIT_12; /* Set Retry FLOGI in case of P2P connection */ if (ha->operating_mode == P2P) { ha->fw_options[2] |= BIT_3; ql_dbg(ql_dbg_disc, vha, 0x2101, "(%s): Setting FLOGI retry BIT in fw_options[2]: 0x%x\n", __func__, ha->fw_options[2]); } /* Move PUREX, ABTS RX & RIDA to ATIOQ */ if (ql2xmvasynctoatio && (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha))) { if (<API key>(vha) || <API key>(vha)) ha->fw_options[2] |= BIT_11; else ha->fw_options[2] &= ~BIT_11; } if (IS_QLA25XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) { /* * Tell FW to track each exchange to prevent * driver from using stale exchange. */ if (<API key>(vha) || <API key>(vha)) ha->fw_options[2] |= BIT_4; else ha->fw_options[2] &= ~BIT_4; /* Reserve 1/2 of emergency exchanges for ELS.*/ if (<API key>) ha->fw_options[2] |= BIT_8; else ha->fw_options[2] &= ~BIT_8; } if (ql2xrdpenable || ha->flags.scm_supported_f) ha->fw_options[1] |= <API key>; /* Enable Async 8130/8131 events -- transceiver insertion/removal */ if (<API key>(ha)) ha->fw_options[3] |= BIT_10; ql_dbg(ql_dbg_init, vha, 0x00e8, "%s, add FW options 1-3 = 0x%04x 0x%04x 0x%04x mode %x\n", __func__, ha->fw_options[1], ha->fw_options[2], ha->fw_options[3], vha->host->active_mode); if (ha->fw_options[1] || ha->fw_options[2] || ha->fw_options[3]) <API key>(vha, ha->fw_options); /* Update Serial Link options. */ if ((le16_to_cpu(ha-><API key>[0]) & BIT_0) == 0) return; rval = <API key>(vha, le16_to_cpu(ha-><API key>[1]), le16_to_cpu(ha-><API key>[2]), le16_to_cpu(ha-><API key>[3])); if (rval != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x0104, "Unable to update Serial Link options (%x).\n", rval); } } void <API key>(struct scsi_qla_host *vha) { struct qla_hw_data *ha = vha->hw; struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; struct req_que *req = ha->req_q_map[0]; struct rsp_que *rsp = ha->rsp_q_map[0]; /* Setup ring parameters in initialization control block. */ ha->init_cb-><API key> = cpu_to_le16(0); ha->init_cb-><API key> = cpu_to_le16(0); ha->init_cb->request_q_length = cpu_to_le16(req->length); ha->init_cb->response_q_length = cpu_to_le16(rsp->length); put_unaligned_le64(req->dma, &ha->init_cb->request_q_address); put_unaligned_le64(rsp->dma, &ha->init_cb->response_q_address); wrt_reg_word(ISP_REQ_Q_IN(ha, reg), 0); wrt_reg_word(ISP_REQ_Q_OUT(ha, reg), 0); wrt_reg_word(ISP_RSP_Q_IN(ha, reg), 0); wrt_reg_word(ISP_RSP_Q_OUT(ha, reg), 0); rd_reg_word(ISP_RSP_Q_OUT(ha, reg)); /* PCI Posting. */ } void <API key>(struct scsi_qla_host *vha) { struct qla_hw_data *ha = vha->hw; device_reg_t *reg = ISP_QUE_REG(ha, 0); struct device_reg_2xxx __iomem *ioreg = &ha->iobase->isp; struct qla_msix_entry *msix; struct init_cb_24xx *icb; uint16_t rid = 0; struct req_que *req = ha->req_q_map[0]; struct rsp_que *rsp = ha->rsp_q_map[0]; /* Setup ring parameters in initialization control block. */ icb = (struct init_cb_24xx *)ha->init_cb; icb-><API key> = cpu_to_le16(0); icb-><API key> = cpu_to_le16(0); icb->request_q_length = cpu_to_le16(req->length); icb->response_q_length = cpu_to_le16(rsp->length); put_unaligned_le64(req->dma, &icb->request_q_address); put_unaligned_le64(rsp->dma, &icb->response_q_address); /* Setup ATIO queue dma pointers for target mode */ icb->atio_q_inpointer = cpu_to_le16(0); icb->atio_q_length = cpu_to_le16(ha->tgt.atio_q_length); put_unaligned_le64(ha->tgt.atio_dma, &icb->atio_q_address); if (<API key>(ha)) icb->firmware_options_2 |= cpu_to_le32(BIT_30|BIT_29); if (ha->mqenable || IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) { icb->qos = cpu_to_le16(QLA_DEFAULT_QUE_QOS); icb->rid = cpu_to_le16(rid); if (ha->flags.msix_enabled) { msix = &ha->msix_entries[1]; ql_dbg(ql_dbg_init, vha, 0x0019, "Registering vector 0x%x for base que.\n", msix->entry); icb->msix = cpu_to_le16(msix->entry); } /* Use alternate PCI bus number */ if (MSB(rid)) icb->firmware_options_2 |= cpu_to_le32(BIT_19); /* Use alternate PCI devfn */ if (LSB(rid)) icb->firmware_options_2 |= cpu_to_le32(BIT_18); /* Use Disable MSIX Handshake mode for capable adapters */ if ((ha->fw_attributes & BIT_6) && (<API key>(ha)) && (ha->flags.msix_enabled)) { icb->firmware_options_2 &= cpu_to_le32(~BIT_22); ha->flags.<API key> = 1; ql_dbg(ql_dbg_init, vha, 0x00fe, "MSIX Handshake Disable Mode turned on.\n"); } else { icb->firmware_options_2 |= cpu_to_le32(BIT_22); } icb->firmware_options_2 |= cpu_to_le32(BIT_23); wrt_reg_dword(&reg->isp25mq.req_q_in, 0); wrt_reg_dword(&reg->isp25mq.req_q_out, 0); wrt_reg_dword(&reg->isp25mq.rsp_q_in, 0); wrt_reg_dword(&reg->isp25mq.rsp_q_out, 0); } else { wrt_reg_dword(&reg->isp24.req_q_in, 0); wrt_reg_dword(&reg->isp24.req_q_out, 0); wrt_reg_dword(&reg->isp24.rsp_q_in, 0); wrt_reg_dword(&reg->isp24.rsp_q_out, 0); } <API key>(vha); /* If the user has configured the speed, set it here */ if (ha->set_data_rate) { ql_dbg(ql_dbg_init, vha, 0x00fd, "Speed set by user : %s Gbps \n", <API key>(ha, ha->set_data_rate)); icb->firmware_options_3 = cpu_to_le32(ha->set_data_rate << 13); } /* PCI posting */ rd_reg_word(&ioreg->hccr); } /** * qla2x00_init_rings() - Initializes firmware. * @vha: HA context * * Beginning of request ring has initialization control block already built * by nvram config routine. * * Returns 0 on success. */ int qla2x00_init_rings(scsi_qla_host_t *vha) { int rval; unsigned long flags = 0; int cnt, que; struct qla_hw_data *ha = vha->hw; struct req_que *req; struct rsp_que *rsp; struct mid_init_cb_24xx *mid_init_cb = (struct mid_init_cb_24xx *) ha->init_cb; spin_lock_irqsave(&ha->hardware_lock, flags); /* Clear outstanding commands array. */ for (que = 0; que < ha->max_req_queues; que++) { req = ha->req_q_map[que]; if (!req || !test_bit(que, ha->req_qid_map)) continue; req->out_ptr = (uint16_t *)(req->ring + req->length); *req->out_ptr = 0; for (cnt = 1; cnt < req-><API key>; cnt++) req->outstanding_cmds[cnt] = NULL; req-><API key> = 1; /* Initialize firmware. */ req->ring_ptr = req->ring; req->ring_index = 0; req->cnt = req->length; } for (que = 0; que < ha->max_rsp_queues; que++) { rsp = ha->rsp_q_map[que]; if (!rsp || !test_bit(que, ha->rsp_qid_map)) continue; rsp->in_ptr = (uint16_t *)(rsp->ring + rsp->length); *rsp->in_ptr = 0; /* Initialize response queue entries */ if (IS_QLAFX00(ha)) <API key>(rsp); else <API key>(rsp); } ha->tgt.atio_ring_ptr = ha->tgt.atio_ring; ha->tgt.atio_ring_index = 0; /* Initialize ATIO queue entries */ <API key>(vha); ha->isp_ops->config_rings(vha); <API key>(&ha->hardware_lock, flags); ql_dbg(ql_dbg_init, vha, 0x00d1, "Issue init firmware.\n"); if (IS_QLAFX00(ha)) { rval = <API key>(vha, ha->init_cb_size); goto next_check; } /* Update any ISP specific firmware options before initialization. */ ha->isp_ops->update_fw_options(vha); if (ha->flags.npiv_supported) { if (ha->operating_mode == LOOP && !IS_CNA_CAPABLE(ha)) ha->max_npiv_vports = MIN_MULTI_ID_FABRIC - 1; mid_init_cb->count = cpu_to_le16(ha->max_npiv_vports); } if (IS_FWI2_CAPABLE(ha)) { mid_init_cb->options = cpu_to_le16(BIT_1); mid_init_cb->init_cb.execution_throttle = cpu_to_le16(ha->cur_fw_xcb_count); ha->flags.dport_enabled = (le32_to_cpu(mid_init_cb->init_cb.firmware_options_1) & BIT_7) != 0; ql_dbg(ql_dbg_init, vha, 0x0191, "DPORT Support: %s.\n", (ha->flags.dport_enabled) ? "enabled" : "disabled"); /* FA-WWPN Status */ ha->flags.fawwpn_enabled = (le32_to_cpu(mid_init_cb->init_cb.firmware_options_1) & BIT_6) != 0; ql_dbg(ql_dbg_init, vha, 0x00bc, "FA-WWPN Support: %s.\n", (ha->flags.fawwpn_enabled) ? "enabled" : "disabled"); } rval = <API key>(vha, ha->init_cb_size); next_check: if (rval) { ql_log(ql_log_fatal, vha, 0x00d2, "Init Firmware **** FAILED ****.\n"); } else { ql_dbg(ql_dbg_init, vha, 0x00d3, "Init Firmware -- success.\n"); QLA_FW_STARTED(ha); vha->u_ql2xexchoffld = vha->u_ql2xiniexchg = 0; } return (rval); } /** * qla2x00_fw_ready() - Waits for firmware ready. * @vha: HA context * * Returns 0 on success. */ static int qla2x00_fw_ready(scsi_qla_host_t *vha) { int rval; unsigned long wtime, mtime, cs84xx_time; uint16_t min_wait; /* Minimum wait time if loop is down */ uint16_t wait_time; /* Wait time if loop is coming ready */ uint16_t state[6]; struct qla_hw_data *ha = vha->hw; if (IS_QLAFX00(vha->hw)) return qlafx00_fw_ready(vha); rval = QLA_SUCCESS; /* Time to wait for loop down */ if (IS_P3P_TYPE(ha)) min_wait = 30; else min_wait = 20; /* * Firmware should take at most one RATOV to login, plus 5 seconds for * our own processing. */ if ((wait_time = (ha->retry_count*ha->login_timeout) + 5) < min_wait) { wait_time = min_wait; } /* Min wait time if loop down */ mtime = jiffies + (min_wait * HZ); /* wait time before firmware ready */ wtime = jiffies + (wait_time * HZ); /* Wait for ISP to finish LIP */ if (!vha->flags.init_done) ql_log(ql_log_info, vha, 0x801e, "Waiting for LIP to complete.\n"); do { memset(state, -1, sizeof(state)); rval = <API key>(vha, state); if (rval == QLA_SUCCESS) { if (state[0] < FSTATE_LOSS_OF_SYNC) { vha->device_flags &= ~DFLG_NO_CABLE; } if (IS_QLA84XX(ha) && state[0] != FSTATE_READY) { ql_dbg(ql_dbg_taskm, vha, 0x801f, "fw_state=%x 84xx=%x.\n", state[0], state[2]); if ((state[2] & FSTATE_LOGGED_IN) && (state[2] & <API key>)) { ql_dbg(ql_dbg_taskm, vha, 0x8028, "Sending verify iocb.\n"); cs84xx_time = jiffies; rval = qla84xx_init_chip(vha); if (rval != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x8007, "Init chip failed.\n"); break; } /* Add time taken to initialize. */ cs84xx_time = jiffies - cs84xx_time; wtime += cs84xx_time; mtime += cs84xx_time; ql_dbg(ql_dbg_taskm, vha, 0x8008, "Increasing wait time by %ld. " "New time %ld.\n", cs84xx_time, wtime); } } else if (state[0] == FSTATE_READY) { ql_dbg(ql_dbg_taskm, vha, 0x8037, "F/W Ready - OK.\n"); <API key>(vha, &ha->retry_count, &ha->login_timeout, &ha->r_a_tov); rval = QLA_SUCCESS; break; } rval = QLA_FUNCTION_FAILED; if (atomic_read(&vha->loop_down_timer) && state[0] != FSTATE_READY) { /* Loop down. Timeout on min_wait for states * other than Wait for Login. */ if (time_after_eq(jiffies, mtime)) { ql_log(ql_log_info, vha, 0x8038, "Cable is unplugged...\n"); vha->device_flags |= DFLG_NO_CABLE; break; } } } else { /* Mailbox cmd failed. Timeout on min_wait. */ if (time_after_eq(jiffies, mtime) || ha->flags.isp82xx_fw_hung) break; } if (time_after_eq(jiffies, wtime)) break; /* Delay for a while */ msleep(500); } while (1); ql_dbg(ql_dbg_taskm, vha, 0x803a, "fw_state=%x (%x, %x, %x, %x %x) curr time=%lx.\n", state[0], state[1], state[2], state[3], state[4], state[5], jiffies); if (rval && !(vha->device_flags & DFLG_NO_CABLE)) { ql_log(ql_log_warn, vha, 0x803b, "Firmware ready **** FAILED ****.\n"); } return (rval); } /* * <API key> * Setup adapter context. * * Input: * ha = adapter state pointer. * * Returns: * 0 = success * * Context: * Kernel context. */ static int <API key>(scsi_qla_host_t *vha) { int rval; uint16_t loop_id; uint16_t topo; uint16_t sw_cap; uint8_t al_pa; uint8_t area; uint8_t domain; char connect_type[22]; struct qla_hw_data *ha = vha->hw; scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); port_id_t id; unsigned long flags; /* Get host addresses. */ rval = <API key>(vha, &loop_id, &al_pa, &area, &domain, &topo, &sw_cap); if (rval != QLA_SUCCESS) { if (LOOP_TRANSITION(vha) || atomic_read(&ha->loop_down_timer) || IS_CNA_CAPABLE(ha) || (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) { ql_dbg(ql_dbg_disc, vha, 0x2008, "Loop is in a transition state.\n"); } else { ql_log(ql_log_warn, vha, 0x2009, "Unable to get host loop ID.\n"); if (IS_FWI2_CAPABLE(ha) && (vha == base_vha) && (rval == QLA_COMMAND_ERROR && loop_id == 0x1b)) { ql_log(ql_log_warn, vha, 0x1151, "Doing link init.\n"); if (<API key>(vha) == QLA_SUCCESS) return rval; } set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); } return (rval); } if (topo == 4) { ql_log(ql_log_info, vha, 0x200a, "Cannot get topology - retrying.\n"); return (QLA_FUNCTION_FAILED); } vha->loop_id = loop_id; /* initialize */ ha->min_external_loopid = SNS_FIRST_LOOP_ID; ha->operating_mode = LOOP; ha->switch_cap = 0; switch (topo) { case 0: ql_dbg(ql_dbg_disc, vha, 0x200b, "HBA in NL topology.\n"); ha->current_topology = ISP_CFG_NL; strcpy(connect_type, "(Loop)"); break; case 1: ql_dbg(ql_dbg_disc, vha, 0x200c, "HBA in FL topology.\n"); ha->switch_cap = sw_cap; ha->current_topology = ISP_CFG_FL; strcpy(connect_type, "(FL_Port)"); break; case 2: ql_dbg(ql_dbg_disc, vha, 0x200d, "HBA in N P2P topology.\n"); ha->operating_mode = P2P; ha->current_topology = ISP_CFG_N; strcpy(connect_type, "(N_Port-to-N_Port)"); break; case 3: ql_dbg(ql_dbg_disc, vha, 0x200e, "HBA in F P2P topology.\n"); ha->switch_cap = sw_cap; ha->operating_mode = P2P; ha->current_topology = ISP_CFG_F; strcpy(connect_type, "(F_Port)"); break; default: ql_dbg(ql_dbg_disc, vha, 0x200f, "HBA in unknown topology %x, using NL.\n", topo); ha->current_topology = ISP_CFG_NL; strcpy(connect_type, "(Loop)"); break; } /* Save Host port and loop ID. */ /* byte order - Big Endian */ id.b.domain = domain; id.b.area = area; id.b.al_pa = al_pa; id.b.rsvd_1 = 0; spin_lock_irqsave(&ha->hardware_lock, flags); if (!(topo == 2 && ha->flags.n2n_bigger)) qlt_update_host_map(vha, id); <API key>(&ha->hardware_lock, flags); if (!vha->flags.init_done) ql_log(ql_log_info, vha, 0x2010, "Topology - %s, Host Loop address 0x%x.\n", connect_type, vha->loop_id); return(rval); } inline void <API key>(scsi_qla_host_t *vha, uint8_t *model, size_t len, const char *def) { char *st, *en; uint16_t index; uint64_t zero[2] = { 0 }; struct qla_hw_data *ha = vha->hw; int use_tbl = !IS_QLA24XX_TYPE(ha) && !IS_QLA25XX(ha) && !IS_CNA_CAPABLE(ha) && !IS_QLA2031(ha); if (len > sizeof(zero)) len = sizeof(zero); if (memcmp(model, &zero, len) != 0) { memcpy(ha->model_number, model, len); st = en = ha->model_number; en += len - 1; while (en > st) { if (*en != 0x20 && *en != 0x00) break; *en } index = (ha->pdev->subsystem_device & 0xff); if (use_tbl && ha->pdev->subsystem_vendor == <API key> && index < QLA_MODEL_NAMES) strlcpy(ha->model_desc, qla2x00_model_name[index * 2 + 1], sizeof(ha->model_desc)); } else { index = (ha->pdev->subsystem_device & 0xff); if (use_tbl && ha->pdev->subsystem_vendor == <API key> && index < QLA_MODEL_NAMES) { strlcpy(ha->model_number, qla2x00_model_name[index * 2], sizeof(ha->model_number)); strlcpy(ha->model_desc, qla2x00_model_name[index * 2 + 1], sizeof(ha->model_desc)); } else { strlcpy(ha->model_number, def, sizeof(ha->model_number)); } } if (IS_FWI2_CAPABLE(ha)) <API key>(vha, "\x82", ha->model_desc, sizeof(ha->model_desc)); } /* On sparc systems, obtain port and node WWN from firmware * properties. */ static void <API key>(scsi_qla_host_t *vha, nvram_t *nv) { #ifdef CONFIG_SPARC struct qla_hw_data *ha = vha->hw; struct pci_dev *pdev = ha->pdev; struct device_node *dp = <API key>(pdev); const u8 *val; int len; val = of_get_property(dp, "port-wwn", &len); if (val && len >= WWN_SIZE) memcpy(nv->port_name, val, WWN_SIZE); val = of_get_property(dp, "node-wwn", &len); if (val && len >= WWN_SIZE) memcpy(nv->node_name, val, WWN_SIZE); #endif } /* * NVRAM configuration for ISP 2xxx * * Input: * ha = adapter block pointer. * * Output: * initialization control block in response_ring * host adapters parameters in host adapter block * * Returns: * 0 = success. */ int <API key>(scsi_qla_host_t *vha) { int rval; uint8_t chksum = 0; uint16_t cnt; uint8_t *dptr1, *dptr2; struct qla_hw_data *ha = vha->hw; init_cb_t *icb = ha->init_cb; nvram_t *nv = ha->nvram; uint8_t *ptr = ha->nvram; struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; rval = QLA_SUCCESS; /* Determine NVRAM starting address. */ ha->nvram_size = sizeof(*nv); ha->nvram_base = 0; if (!IS_QLA2100(ha) && !IS_QLA2200(ha) && !IS_QLA2300(ha)) if ((rd_reg_word(&reg->ctrl_status) >> 14) == 1) ha->nvram_base = 0x80; /* Get NVRAM data and calculate checksum. */ ha->isp_ops->read_nvram(vha, ptr, ha->nvram_base, ha->nvram_size); for (cnt = 0, chksum = 0; cnt < ha->nvram_size; cnt++) chksum += *ptr++; ql_dbg(ql_dbg_init + ql_dbg_buffer, vha, 0x010f, "Contents of NVRAM.\n"); ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x0110, nv, ha->nvram_size); /* Bad NVRAM data, set defaults parameters. */ if (chksum || memcmp("ISP ", nv->id, sizeof(nv->id)) || nv->nvram_version < 1) { /* Reset NVRAM data. */ ql_log(ql_log_warn, vha, 0x0064, "Inconsistent NVRAM detected: checksum=%#x id=%.4s version=%#x.\n", chksum, nv->id, nv->nvram_version); ql_log(ql_log_warn, vha, 0x0065, "Falling back to " "functioning (yet invalid -- WWPN) defaults.\n"); /* * Set default initialization control block. */ memset(nv, 0, ha->nvram_size); nv-><API key> = ICB_VERSION; if (IS_QLA23XX(ha)) { nv->firmware_options[0] = BIT_2 | BIT_1; nv->firmware_options[1] = BIT_7 | BIT_5; nv-><API key>[0] = BIT_5; nv-><API key>[1] = BIT_5 | BIT_4; nv->frame_payload_size = cpu_to_le16(2048); nv->special_options[1] = BIT_7; } else if (IS_QLA2200(ha)) { nv->firmware_options[0] = BIT_2 | BIT_1; nv->firmware_options[1] = BIT_7 | BIT_5; nv-><API key>[0] = BIT_5; nv-><API key>[1] = BIT_5 | BIT_4; nv->frame_payload_size = cpu_to_le16(1024); } else if (IS_QLA2100(ha)) { nv->firmware_options[0] = BIT_3 | BIT_1; nv->firmware_options[1] = BIT_5; nv->frame_payload_size = cpu_to_le16(1024); } nv->max_iocb_allocation = cpu_to_le16(256); nv->execution_throttle = cpu_to_le16(16); nv->retry_count = 8; nv->retry_delay = 1; nv->port_name[0] = 33; nv->port_name[3] = 224; nv->port_name[4] = 139; <API key>(vha, nv); nv->login_timeout = 4; /* * Set default host adapter parameters */ nv->host_p[1] = BIT_2; nv->reset_delay = 5; nv-><API key> = 8; nv->max_luns_per_target = cpu_to_le16(8); nv->link_down_timeout = 60; rval = 1; } /* Reset Initialization control block */ memset(icb, 0, ha->init_cb_size); /* * Setup driver NVRAM options. */ nv->firmware_options[0] |= (BIT_6 | BIT_1); nv->firmware_options[0] &= ~(BIT_5 | BIT_4); nv->firmware_options[1] |= (BIT_5 | BIT_0); nv->firmware_options[1] &= ~BIT_4; if (IS_QLA23XX(ha)) { nv->firmware_options[0] |= BIT_2; nv->firmware_options[0] &= ~BIT_3; nv->special_options[0] &= ~BIT_6; nv-><API key>[1] |= BIT_5 | BIT_4; if (IS_QLA2300(ha)) { if (ha->fb_rev == FPM_2310) { strcpy(ha->model_number, "QLA2310"); } else { strcpy(ha->model_number, "QLA2300"); } } else { <API key>(vha, nv->model_number, sizeof(nv->model_number), "QLA23xx"); } } else if (IS_QLA2200(ha)) { nv->firmware_options[0] |= BIT_2; /* * 'Point-to-point preferred, else loop' is not a safe * connection mode setting. */ if ((nv-><API key>[0] & (BIT_6 | BIT_5 | BIT_4)) == (BIT_5 | BIT_4)) { /* Force 'loop preferred, else point-to-point'. */ nv-><API key>[0] &= ~(BIT_6 | BIT_5 | BIT_4); nv-><API key>[0] |= BIT_5; } strcpy(ha->model_number, "QLA22xx"); } else /*if (IS_QLA2100(ha))*/ { strcpy(ha->model_number, "QLA2100"); } /* * Copy over NVRAM RISC parameter block to initialization control block. */ dptr1 = (uint8_t *)icb; dptr2 = (uint8_t *)&nv-><API key>; cnt = (uint8_t *)&icb-><API key> - (uint8_t *)&icb->version; while (cnt *dptr1++ = *dptr2++; /* Copy 2nd half. */ dptr1 = (uint8_t *)icb-><API key>; cnt = (uint8_t *)icb->reserved_3 - (uint8_t *)icb-><API key>; while (cnt *dptr1++ = *dptr2++; ha->frame_payload_size = le16_to_cpu(icb->frame_payload_size); /* Use alternate WWN? */ if (nv->host_p[1] & BIT_7) { memcpy(icb->node_name, nv->alternate_node_name, WWN_SIZE); memcpy(icb->port_name, nv->alternate_port_name, WWN_SIZE); } /* Prepare nodename */ if ((icb->firmware_options[1] & BIT_6) == 0) { /* * Firmware will apply the following mask if the nodename was * not provided. */ memcpy(icb->node_name, icb->port_name, WWN_SIZE); icb->node_name[0] &= 0xF0; } /* * Set host adapter parameters. */ /* * BIT_7 in the host-parameters section allows for modification to * internal driver logging. */ if (nv->host_p[0] & BIT_7) <API key> = <API key>; ha->flags.<API key> = ((nv->host_p[0] & BIT_4) ? 1 : 0); /* Always load RISC code on non ISP2[12]00 chips. */ if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) ha->flags.<API key> = 0; ha->flags.enable_lip_reset = ((nv->host_p[1] & BIT_1) ? 1 : 0); ha->flags.<API key> = ((nv->host_p[1] & BIT_2) ? 1 : 0); ha->flags.enable_target_reset = ((nv->host_p[1] & BIT_3) ? 1 : 0); ha->flags.enable_led_scheme = (nv->special_options[1] & BIT_4) ? 1 : 0; ha->flags.disable_serdes = 0; ha->operating_mode = (icb-><API key>[0] & (BIT_6 | BIT_5 | BIT_4)) >> 4; memcpy(ha-><API key>, nv->seriallink_options, sizeof(ha-><API key>)); /* save HBA serial number */ ha->serial0 = icb->port_name[5]; ha->serial1 = icb->port_name[6]; ha->serial2 = icb->port_name[7]; memcpy(vha->node_name, icb->node_name, WWN_SIZE); memcpy(vha->port_name, icb->port_name, WWN_SIZE); icb->execution_throttle = cpu_to_le16(0xFFFF); ha->retry_count = nv->retry_count; /* Set minimum login_timeout to 4 seconds. */ if (nv->login_timeout != ql2xlogintimeout) nv->login_timeout = ql2xlogintimeout; if (nv->login_timeout < 4) nv->login_timeout = 4; ha->login_timeout = nv->login_timeout; /* Set minimum RATOV to 100 tenths of a second. */ ha->r_a_tov = 100; ha->loop_reset_delay = nv->reset_delay; /* Link Down Timeout = 0: * * When Port Down timer expires we will start returning * I/O's to OS with "DID_NO_CONNECT". * * Link Down Timeout != 0: * * The driver waits for the link to come up after link down * before returning I/Os to OS with "DID_NO_CONNECT". */ if (nv->link_down_timeout == 0) { ha-><API key> = (LOOP_DOWN_TIME - LOOP_DOWN_TIMEOUT); } else { ha->link_down_timeout = nv->link_down_timeout; ha-><API key> = (LOOP_DOWN_TIME - ha->link_down_timeout); } /* * Need enough time to try and get the port back. */ ha-><API key> = nv-><API key>; if (qlport_down_retry) ha-><API key> = qlport_down_retry; /* Set login_retry_count */ ha->login_retry_count = nv->retry_count; if (ha-><API key> == nv-><API key> && ha-><API key> > 3) ha->login_retry_count = ha-><API key>; else if (ha-><API key> > (int)ha->login_retry_count) ha->login_retry_count = ha-><API key>; if (ql2xloginretrycount) ha->login_retry_count = ql2xloginretrycount; icb->lun_enables = cpu_to_le16(0); icb-><API key> = 0; icb-><API key> = 0; icb->timeout = cpu_to_le16(0); if (IS_QLA2100(ha) || IS_QLA2200(ha)) { /* Enable RIO */ icb->firmware_options[0] &= ~BIT_3; icb-><API key>[0] &= ~(BIT_3 | BIT_2 | BIT_1 | BIT_0); icb-><API key>[0] |= BIT_2; icb-><API key> = 3; icb-><API key> = 5; vha->flags.<API key> = 1; } else { /* Enable ZIO. */ if (!vha->flags.init_done) { ha->zio_mode = icb-><API key>[0] & (BIT_3 | BIT_2 | BIT_1 | BIT_0); ha->zio_timer = icb-><API key> ? icb-><API key> : 2; } icb-><API key>[0] &= ~(BIT_3 | BIT_2 | BIT_1 | BIT_0); vha->flags.<API key> = 0; if (ha->zio_mode != QLA_ZIO_DISABLED) { ha->zio_mode = QLA_ZIO_MODE_6; ql_log(ql_log_info, vha, 0x0068, "ZIO mode %d enabled; timer delay (%d us).\n", ha->zio_mode, ha->zio_timer * 100); icb-><API key>[0] |= (uint8_t)ha->zio_mode; icb-><API key> = (uint8_t)ha->zio_timer; vha->flags.<API key> = 1; } } if (rval) { ql_log(ql_log_warn, vha, 0x0069, "NVRAM configuration failed.\n"); } return (rval); } static void qla2x00_rport_del(void *data) { fc_port_t *fcport = data; struct fc_rport *rport; unsigned long flags; spin_lock_irqsave(fcport->vha->host->host_lock, flags); rport = fcport->drport ? fcport->drport : fcport->rport; fcport->drport = NULL; <API key>(fcport->vha->host->host_lock, flags); if (rport) { ql_dbg(ql_dbg_disc, fcport->vha, 0x210b, "%s %8phN. rport %p roles %x\n", __func__, fcport->port_name, rport, rport->roles); <API key>(rport); } } void <API key>(fc_port_t *fcport, int state) { int old_state; old_state = atomic_read(&fcport->state); atomic_set(&fcport->state, state); /* Don't print state transitions during initial allocation of fcport */ if (old_state && old_state != state) { ql_dbg(ql_dbg_disc, fcport->vha, 0x207d, "FCPort %8phC state transitioned from %s to %s - portid=%02x%02x%02x.\n", fcport->port_name, port_state_str[old_state], port_state_str[state], fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa); } } /** * <API key>() - Allocate a generic fcport. * @vha: HA context * @flags: allocation flags * * Returns a pointer to the allocated fcport, or NULL, if none available. */ fc_port_t * <API key>(scsi_qla_host_t *vha, gfp_t flags) { fc_port_t *fcport; fcport = kzalloc(sizeof(fc_port_t), flags); if (!fcport) return NULL; fcport->ct_desc.ct_sns = dma_alloc_coherent(&vha->hw->pdev->dev, sizeof(struct ct_sns_pkt), &fcport->ct_desc.ct_sns_dma, flags); if (!fcport->ct_desc.ct_sns) { ql_log(ql_log_warn, vha, 0xd049, "Failed to allocate ct_sns request.\n"); kfree(fcport); return NULL; } /* Setup fcport template structure. */ fcport->vha = vha; fcport->port_type = FCT_UNKNOWN; fcport->loop_id = FC_NO_LOOP_ID; <API key>(fcport, FCS_UNCONFIGURED); fcport->supported_classes = FC_COS_UNSPECIFIED; fcport->fp_speed = PORT_SPEED_UNKNOWN; fcport->disc_state = DSC_DELETED; fcport->fw_login_state = DSC_LS_PORT_UNAVAIL; fcport->deleted = QLA_SESS_DELETED; fcport->login_retry = vha->hw->login_retry_count; fcport->chip_reset = vha->hw->base_qpair->chip_reset; fcport->logout_on_delete = 1; fcport->tgt_link_down_time = <API key>; fcport-><API key> = 0; fcport->dev_loss_tmo = 0; if (!fcport->ct_desc.ct_sns) { ql_log(ql_log_warn, vha, 0xd049, "Failed to allocate ct_sns request.\n"); kfree(fcport); return NULL; } INIT_WORK(&fcport->del_work, <API key>); INIT_WORK(&fcport->free_work, <API key>); INIT_WORK(&fcport->reg_work, <API key>); INIT_LIST_HEAD(&fcport->gnl_entry); INIT_LIST_HEAD(&fcport->list); INIT_LIST_HEAD(&fcport->sess_cmd_list); spin_lock_init(&fcport->sess_cmd_lock); return fcport; } void qla2x00_free_fcport(fc_port_t *fcport) { if (fcport->ct_desc.ct_sns) { dma_free_coherent(&fcport->vha->hw->pdev->dev, sizeof(struct ct_sns_pkt), fcport->ct_desc.ct_sns, fcport->ct_desc.ct_sns_dma); fcport->ct_desc.ct_sns = NULL; } list_del(&fcport->list); <API key>(fcport); kfree(fcport); } static void <API key>(scsi_qla_host_t *vha) { struct qla_hw_data *ha = vha->hw; int rval; u32 *bp, sz; __be32 *q; memset(ha->init_cb, 0, ha->init_cb_size); sz = min_t(int, sizeof(struct fc_els_flogi), ha->init_cb_size); rval = <API key>(vha, ha->init_cb_dma, ha->init_cb, sz); if (rval != QLA_SUCCESS) { ql_dbg(ql_dbg_init, vha, 0x00d1, "PLOGI ELS param read fail.\n"); return; } q = (__be32 *)&ha->plogi_els_payld.fl_csp; bp = (uint32_t *)ha->init_cb; cpu_to_be32_array(q, bp, sz / 4); ha->flags.<API key> = 1; } /* * <API key> * Updates Fibre Channel Device Database with what is actually on loop. * * Input: * ha = adapter block pointer. * * Returns: * 0 = success. * 1 = error. * 2 = database was full and device was not configured. */ static int <API key>(scsi_qla_host_t *vha) { int rval; unsigned long flags, save_flags; struct qla_hw_data *ha = vha->hw; rval = QLA_SUCCESS; /* Get Initiator ID */ if (test_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags)) { rval = <API key>(vha); if (rval != QLA_SUCCESS) { ql_dbg(ql_dbg_disc, vha, 0x2013, "Unable to configure HBA.\n"); return (rval); } } save_flags = flags = vha->dpc_flags; ql_dbg(ql_dbg_disc, vha, 0x2014, "Configure loop -- dpc flags = 0x%lx.\n", flags); /* * If we have both an RSCN and PORT UPDATE pending then handle them * both at the same time. */ clear_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); clear_bit(RSCN_UPDATE, &vha->dpc_flags); <API key>(vha); <API key>(vha); /* Determine what we need to do */ if ((ha->current_topology == ISP_CFG_FL || ha->current_topology == ISP_CFG_F) && (test_bit(LOCAL_LOOP_UPDATE, &flags))) { set_bit(RSCN_UPDATE, &flags); clear_bit(LOCAL_LOOP_UPDATE, &flags); } else if (ha->current_topology == ISP_CFG_NL || ha->current_topology == ISP_CFG_N) { clear_bit(RSCN_UPDATE, &flags); set_bit(LOCAL_LOOP_UPDATE, &flags); } else if (!vha->flags.online || (test_bit(ABORT_ISP_ACTIVE, &flags))) { set_bit(RSCN_UPDATE, &flags); set_bit(LOCAL_LOOP_UPDATE, &flags); } if (test_bit(LOCAL_LOOP_UPDATE, &flags)) { if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) { ql_dbg(ql_dbg_disc, vha, 0x2015, "Loop resync needed, failing.\n"); rval = QLA_FUNCTION_FAILED; } else rval = <API key>(vha); } if (rval == QLA_SUCCESS && test_bit(RSCN_UPDATE, &flags)) { if (LOOP_TRANSITION(vha)) { ql_dbg(ql_dbg_disc, vha, 0x2099, "Needs RSCN update and loop transition.\n"); rval = QLA_FUNCTION_FAILED; } else rval = <API key>(vha); } if (rval == QLA_SUCCESS) { if (atomic_read(&vha->loop_down_timer) || test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) { rval = QLA_FUNCTION_FAILED; } else { atomic_set(&vha->loop_state, LOOP_READY); ql_dbg(ql_dbg_disc, vha, 0x2069, "LOOP READY.\n"); ha->flags.fw_init_done = 1; /* * Process any ATIO queue entries that came in * while we weren't online. */ if (<API key>(vha) || <API key>(vha)) { spin_lock_irqsave(&ha->tgt.atio_lock, flags); <API key>(vha, 0); <API key>(&ha->tgt.atio_lock, flags); } } } if (rval) { ql_dbg(ql_dbg_disc, vha, 0x206a, "%s *** FAILED ***.\n", __func__); } else { ql_dbg(ql_dbg_disc, vha, 0x206b, "%s: exiting normally.\n", __func__); } /* Restore state if a resync event occurred during processing */ if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) { if (test_bit(LOCAL_LOOP_UPDATE, &save_flags)) set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); if (test_bit(RSCN_UPDATE, &save_flags)) { set_bit(RSCN_UPDATE, &vha->dpc_flags); } } return (rval); } static int <API key>(scsi_qla_host_t *vha) { unsigned long flags; fc_port_t *fcport; if (test_and_clear_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags)) set_bit(RELOGIN_NEEDED, &vha->dpc_flags); list_for_each_entry(fcport, &vha->vp_fcports, list) { if (fcport->n2n_flag) { <API key>(vha, fcport); return QLA_SUCCESS; } } spin_lock_irqsave(&vha->work_lock, flags); vha->scan.scan_retry++; <API key>(&vha->work_lock, flags); if (vha->scan.scan_retry < MAX_SCAN_RETRIES) { set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); } return QLA_FUNCTION_FAILED; } /* * <API key> * Updates Fibre Channel Device Database with local loop devices. * * Input: * ha = adapter block pointer. * * Returns: * 0 = success. */ static int <API key>(scsi_qla_host_t *vha) { int rval, rval2; int found_devs; int found; fc_port_t *fcport, *new_fcport; uint16_t index; uint16_t entries; struct gid_list_info *gid; uint16_t loop_id; uint8_t domain, area, al_pa; struct qla_hw_data *ha = vha->hw; unsigned long flags; /* Inititae N2N login. */ if (N2N_TOPO(ha)) return <API key>(vha); found_devs = 0; new_fcport = NULL; entries = <API key>; /* Get list of logged in devices. */ memset(ha->gid_list, 0, <API key>(ha)); rval = qla2x00_get_id_list(vha, ha->gid_list, ha->gid_list_dma, &entries); if (rval != QLA_SUCCESS) goto err; ql_dbg(ql_dbg_disc, vha, 0x2011, "Entries in ID list (%d).\n", entries); ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x2075, ha->gid_list, entries * sizeof(*ha->gid_list)); if (entries == 0) { spin_lock_irqsave(&vha->work_lock, flags); vha->scan.scan_retry++; <API key>(&vha->work_lock, flags); if (vha->scan.scan_retry < MAX_SCAN_RETRIES) { set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); } } else { vha->scan.scan_retry = 0; } list_for_each_entry(fcport, &vha->vp_fcports, list) { fcport->scan_state = QLA_FCPORT_SCAN; } /* Allocate temporary fcport for any new fcports discovered. */ new_fcport = <API key>(vha, GFP_KERNEL); if (new_fcport == NULL) { ql_log(ql_log_warn, vha, 0x2012, "Memory allocation failed for fcport.\n"); rval = <API key>; goto err; } new_fcport->flags &= ~FCF_FABRIC_DEVICE; /* Add devices to port list. */ gid = ha->gid_list; for (index = 0; index < entries; index++) { domain = gid->domain; area = gid->area; al_pa = gid->al_pa; if (IS_QLA2100(ha) || IS_QLA2200(ha)) loop_id = gid->loop_id_2100; else loop_id = le16_to_cpu(gid->loop_id); gid = (void *)gid + ha->gid_list_info_size; /* Bypass reserved domain fields. */ if ((domain & 0xf0) == 0xf0) continue; /* Bypass if not same domain and area of adapter. */ if (area && domain && ((area != vha->d_id.b.area) || (domain != vha->d_id.b.domain)) && (ha->current_topology == ISP_CFG_NL)) continue; /* Bypass invalid local loop ID. */ if (loop_id > LAST_LOCAL_LOOP_ID) continue; memset(new_fcport->port_name, 0, WWN_SIZE); /* Fill in member data. */ new_fcport->d_id.b.domain = domain; new_fcport->d_id.b.area = area; new_fcport->d_id.b.al_pa = al_pa; new_fcport->loop_id = loop_id; new_fcport->scan_state = QLA_FCPORT_FOUND; rval2 = <API key>(vha, new_fcport, 0); if (rval2 != QLA_SUCCESS) { ql_dbg(ql_dbg_disc, vha, 0x2097, "Failed to retrieve fcport information " "-- get_port_database=%x, loop_id=0x%04x.\n", rval2, new_fcport->loop_id); /* Skip retry if N2N */ if (ha->current_topology != ISP_CFG_N) { ql_dbg(ql_dbg_disc, vha, 0x2105, "Scheduling resync.\n"); set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); continue; } } spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); /* Check for matching device in port list. */ found = 0; fcport = NULL; list_for_each_entry(fcport, &vha->vp_fcports, list) { if (memcmp(new_fcport->port_name, fcport->port_name, WWN_SIZE)) continue; fcport->flags &= ~FCF_FABRIC_DEVICE; fcport->loop_id = new_fcport->loop_id; fcport->port_type = new_fcport->port_type; fcport->d_id.b24 = new_fcport->d_id.b24; memcpy(fcport->node_name, new_fcport->node_name, WWN_SIZE); fcport->scan_state = QLA_FCPORT_FOUND; found++; break; } if (!found) { /* New device, add to fcports list. */ list_add_tail(&new_fcport->list, &vha->vp_fcports); /* Allocate a new replacement fcport. */ fcport = new_fcport; <API key>(&vha->hw->tgt.sess_lock, flags); new_fcport = <API key>(vha, GFP_KERNEL); if (new_fcport == NULL) { ql_log(ql_log_warn, vha, 0xd031, "Failed to allocate memory for fcport.\n"); rval = <API key>; goto err; } spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); new_fcport->flags &= ~FCF_FABRIC_DEVICE; } <API key>(&vha->hw->tgt.sess_lock, flags); /* Base iIDMA settings on HBA port speed. */ fcport->fp_speed = ha->link_data_rate; found_devs++; } list_for_each_entry(fcport, &vha->vp_fcports, list) { if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) break; if (fcport->scan_state == QLA_FCPORT_SCAN) { if ((<API key>(vha) || <API key>(vha)) && atomic_read(&fcport->state) == FCS_ONLINE) { <API key>(vha, fcport, <API key>); if (fcport->loop_id != FC_NO_LOOP_ID && (fcport->flags & FCF_FCP2_DEVICE) == 0 && fcport->port_type != FCT_INITIATOR && fcport->port_type != FCT_BROADCAST) { ql_dbg(ql_dbg_disc, vha, 0x20f0, "%s %d %8phC post del sess\n", __func__, __LINE__, fcport->port_name); <API key>(fcport); continue; } } } if (fcport->scan_state == QLA_FCPORT_FOUND) <API key>(vha, fcport); } qla2x00_free_fcport(new_fcport); return rval; err: ql_dbg(ql_dbg_disc, vha, 0x2098, "Configure local loop error exit: rval=%x.\n", rval); return rval; } static void <API key>(scsi_qla_host_t *vha, fc_port_t *fcport) { int rval; uint16_t mb[<API key>]; struct qla_hw_data *ha = vha->hw; if (!IS_IIDMA_CAPABLE(ha)) return; if (atomic_read(&fcport->state) != FCS_ONLINE) return; if (fcport->fp_speed == PORT_SPEED_UNKNOWN || fcport->fp_speed > ha->link_data_rate || !ha->flags.gpsc_supported) return; rval = <API key>(vha, fcport->loop_id, fcport->fp_speed, mb); if (rval != QLA_SUCCESS) { ql_dbg(ql_dbg_disc, vha, 0x2004, "Unable to adjust iIDMA %8phN -- %04x %x %04x %04x.\n", fcport->port_name, rval, fcport->fp_speed, mb[0], mb[1]); } else { ql_dbg(ql_dbg_disc, vha, 0x2005, "iIDMA adjusted to %s GB/s (%X) on %8phN.\n", <API key>(ha, fcport->fp_speed), fcport->fp_speed, fcport->port_name); } } void qla_do_iidma_work(struct scsi_qla_host *vha, fc_port_t *fcport) { <API key>(vha, fcport); <API key>(vha, fcport); } int qla_post_iidma_work(struct scsi_qla_host *vha, fc_port_t *fcport) { struct qla_work_evt *e; e = qla2x00_alloc_work(vha, QLA_EVT_IIDMA); if (!e) return QLA_FUNCTION_FAILED; e->u.fcport.fcport = fcport; return qla2x00_post_work(vha, e); } /* <API key> is reserved for Initiator Mode only.*/ static void <API key>(scsi_qla_host_t *vha, fc_port_t *fcport) { struct <API key> rport_ids; struct fc_rport *rport; unsigned long flags; if (atomic_read(&fcport->state) == FCS_ONLINE) return; rport_ids.node_name = wwn_to_u64(fcport->node_name); rport_ids.port_name = wwn_to_u64(fcport->port_name); rport_ids.port_id = fcport->d_id.b.domain << 16 | fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa; rport_ids.roles = <API key>; fcport->rport = rport = fc_remote_port_add(vha->host, 0, &rport_ids); if (!rport) { ql_log(ql_log_warn, vha, 0x2006, "Unable to allocate fc remote port.\n"); return; } spin_lock_irqsave(fcport->vha->host->host_lock, flags); *((fc_port_t **)rport->dd_data) = fcport; <API key>(fcport->vha->host->host_lock, flags); fcport->dev_loss_tmo = rport->dev_loss_tmo; rport->supported_classes = fcport->supported_classes; rport_ids.roles = <API key>; if (fcport->port_type == FCT_INITIATOR) rport_ids.roles |= <API key>; if (fcport->port_type == FCT_TARGET) rport_ids.roles |= <API key>; if (fcport->port_type & FCT_NVME_INITIATOR) rport_ids.roles |= <API key>; if (fcport->port_type & FCT_NVME_TARGET) rport_ids.roles |= <API key>; if (fcport->port_type & FCT_NVME_DISCOVERY) rport_ids.roles |= <API key>; ql_dbg(ql_dbg_disc, vha, 0x20ee, "%s %8phN. rport %p is %s mode\n", __func__, fcport->port_name, rport, (fcport->port_type == FCT_TARGET) ? "tgt" : ((fcport->port_type & FCT_NVME) ? "nvme" : "ini")); <API key>(rport, rport_ids.roles); } /* * <API key> * Updates device on list. * * Input: * ha = adapter block pointer. * fcport = port structure pointer. * * Return: * 0 - Success * BIT_0 - error * * Context: * Kernel context. */ void <API key>(scsi_qla_host_t *vha, fc_port_t *fcport) { if (IS_SW_RESV_ADDR(fcport->d_id)) return; ql_dbg(ql_dbg_disc, vha, 0x20ef, "%s %8phC\n", __func__, fcport->port_name); <API key>(fcport, DSC_UPD_FCPORT); fcport->login_retry = vha->hw->login_retry_count; fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); fcport->deleted = 0; if (vha->hw->current_topology == ISP_CFG_NL) fcport->logout_on_delete = 0; else fcport->logout_on_delete = 1; fcport->n2n_chip_reset = fcport->n2n_link_reset_cnt = 0; if (fcport->tgt_link_down_time < fcport->dev_loss_tmo) { fcport-><API key>++; fcport->tgt_link_down_time = <API key>; } switch (vha->hw->current_topology) { case ISP_CFG_N: case ISP_CFG_NL: fcport->keep_nport_handle = 1; break; default: break; } <API key>(vha, fcport); <API key>(vha, fcport); if (NVME_TARGET(vha->hw, fcport)) { <API key>(vha, fcport); <API key>(fcport, DSC_LOGIN_COMPLETE); <API key>(fcport, FCS_ONLINE); return; } <API key>(vha, fcport); switch (vha->host->active_mode) { case MODE_INITIATOR: <API key>(vha, fcport); break; case MODE_TARGET: if (!vha->vha_tgt.qla_tgt->tgt_stop && !vha->vha_tgt.qla_tgt->tgt_stopped) qlt_fc_port_added(vha, fcport); break; case MODE_DUAL: <API key>(vha, fcport); if (!vha->vha_tgt.qla_tgt->tgt_stop && !vha->vha_tgt.qla_tgt->tgt_stopped) qlt_fc_port_added(vha, fcport); break; default: break; } <API key>(fcport, FCS_ONLINE); if (IS_IIDMA_CAPABLE(vha->hw) && vha->hw->flags.gpsc_supported) { if (fcport->id_changed) { fcport->id_changed = 0; ql_dbg(ql_dbg_disc, vha, 0x20d7, "%s %d %8phC post gfpnid fcp_cnt %d\n", __func__, __LINE__, fcport->port_name, vha->fcport_count); <API key>(vha, fcport); } else { ql_dbg(ql_dbg_disc, vha, 0x20d7, "%s %d %8phC post gpsc fcp_cnt %d\n", __func__, __LINE__, fcport->port_name, vha->fcport_count); <API key>(vha, fcport); } } <API key>(fcport, DSC_LOGIN_COMPLETE); } void <API key>(struct work_struct *work) { fc_port_t *fcport = container_of(work, struct fc_port, reg_work); u32 rscn_gen = fcport->rscn_gen; u16 data[2]; if (IS_SW_RESV_ADDR(fcport->d_id)) return; <API key>(fcport->vha, fcport); if (rscn_gen != fcport->rscn_gen) { /* RSCN(s) came in while registration */ switch (fcport->next_disc_state) { case DSC_DELETE_PEND: <API key>(fcport); break; case DSC_ADISC: data[0] = data[1] = 0; <API key>(fcport->vha, fcport, data); break; default: break; } } } /* * <API key> * Setup SNS devices with loop ID's. * * Input: * ha = adapter block pointer. * * Returns: * 0 = success. * BIT_0 = error */ static int <API key>(scsi_qla_host_t *vha) { int rval; fc_port_t *fcport; uint16_t mb[<API key>]; uint16_t loop_id; LIST_HEAD(new_fcports); struct qla_hw_data *ha = vha->hw; int discovery_gen; /* If FL port exists, then SNS is present */ if (IS_FWI2_CAPABLE(ha)) loop_id = NPH_F_PORT; else loop_id = SNS_FL_PORT; rval = <API key>(vha, loop_id, vha->fabric_node_name, 1); if (rval != QLA_SUCCESS) { ql_dbg(ql_dbg_disc, vha, 0x20a0, "MBX_GET_PORT_NAME failed, No FL Port.\n"); vha->device_flags &= ~SWITCH_FOUND; return (QLA_SUCCESS); } vha->device_flags |= SWITCH_FOUND; rval = <API key>(vha, loop_id, vha->fabric_port_name, 0); if (rval != QLA_SUCCESS) ql_dbg(ql_dbg_disc, vha, 0x20ff, "Failed to get Fabric Port Name\n"); if (<API key>(vha) || <API key>(vha)) { rval = <API key>(vha, 0x3, 0); if (rval != QLA_SUCCESS) ql_log(ql_log_warn, vha, 0x121, "Failed to enable receiving of RSCN requests: 0x%x.\n", rval); } do { <API key>(vha); /* Ensure we are logged into the SNS. */ loop_id = NPH_SNS_LID(ha); rval = ha->isp_ops->fabric_login(vha, loop_id, 0xff, 0xff, 0xfc, mb, BIT_1|BIT_0); if (rval != QLA_SUCCESS || mb[0] != <API key>) { ql_dbg(ql_dbg_disc, vha, 0x20a1, "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x mb[2]=%x mb[6]=%x mb[7]=%x (%x).\n", loop_id, mb[0], mb[1], mb[2], mb[6], mb[7], rval); set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); return rval; } /* FDMI support. */ if (ql2xfdmienable && test_and_clear_bit(<API key>, &vha->dpc_flags)) <API key>(vha); if (test_and_clear_bit(REGISTER_FC4_NEEDED, &vha->dpc_flags)) { if (qla2x00_rft_id(vha)) { /* EMPTY */ ql_dbg(ql_dbg_disc, vha, 0x20a2, "Register FC-4 TYPE failed.\n"); if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) break; } if (qla2x00_rff_id(vha, FC4_TYPE_FCP_SCSI)) { /* EMPTY */ ql_dbg(ql_dbg_disc, vha, 0x209a, "Register FC-4 Features failed.\n"); if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) break; } if (vha->flags.nvme_enabled) { if (qla2x00_rff_id(vha, FC_TYPE_NVME)) { ql_dbg(ql_dbg_disc, vha, 0x2049, "Register NVME FC Type Features failed.\n"); } } if (qla2x00_rnn_id(vha)) { /* EMPTY */ ql_dbg(ql_dbg_disc, vha, 0x2104, "Register Node Name failed.\n"); if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) break; } else if (qla2x00_rsnn_nn(vha)) { /* EMPTY */ ql_dbg(ql_dbg_disc, vha, 0x209b, "Register Symbolic Node Name failed.\n"); if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) break; } } /* Mark the time right before querying FW for connected ports. * This process is long, asynchronous and by the time it's done, * collected information might not be accurate anymore. E.g. * disconnected port might have re-connected and a brand new * session has been created. In this case session's generation * will be newer than discovery_gen. */ <API key>(vha, &discovery_gen); if (USE_ASYNC_SCAN(ha)) { rval = qla24xx_async_gpnft(vha, FC4_TYPE_FCP_SCSI, NULL); if (rval) set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); } else { list_for_each_entry(fcport, &vha->vp_fcports, list) fcport->scan_state = QLA_FCPORT_SCAN; rval = <API key>(vha); } if (rval != QLA_SUCCESS) break; } while (0); if (!vha->nvme_local_port && vha->flags.nvme_enabled) <API key>(vha); if (rval) ql_dbg(ql_dbg_disc, vha, 0x2068, "Configure fabric error exit rval=%d.\n", rval); return (rval); } /* * <API key> * * Input: * ha = adapter block pointer. * dev = database device entry pointer. * * Returns: * 0 = success. * * Context: * Kernel context. */ static int <API key>(scsi_qla_host_t *vha) { int rval; uint16_t loop_id; fc_port_t *fcport, *new_fcport; int found; sw_info_t *swl; int swl_idx; int first_dev, last_dev; port_id_t wrap = {}, nxt_d_id; struct qla_hw_data *ha = vha->hw; struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); unsigned long flags; rval = QLA_SUCCESS; /* Try GID_PT to get device list, else GAN. */ if (!ha->swl) ha->swl = kcalloc(ha->max_fibre_devices, sizeof(sw_info_t), GFP_KERNEL); swl = ha->swl; if (!swl) { /*EMPTY*/ ql_dbg(ql_dbg_disc, vha, 0x209c, "GID_PT allocations failed, fallback on GA_NXT.\n"); } else { memset(swl, 0, ha->max_fibre_devices * sizeof(sw_info_t)); if (qla2x00_gid_pt(vha, swl) != QLA_SUCCESS) { swl = NULL; if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) return rval; } else if (qla2x00_gpn_id(vha, swl) != QLA_SUCCESS) { swl = NULL; if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) return rval; } else if (qla2x00_gnn_id(vha, swl) != QLA_SUCCESS) { swl = NULL; if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) return rval; } else if (qla2x00_gfpn_id(vha, swl) != QLA_SUCCESS) { swl = NULL; if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) return rval; } /* If other queries succeeded probe for FC-4 type */ if (swl) { qla2x00_gff_id(vha, swl); if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) return rval; } } swl_idx = 0; /* Allocate temporary fcport for any new fcports discovered. */ new_fcport = <API key>(vha, GFP_KERNEL); if (new_fcport == NULL) { ql_log(ql_log_warn, vha, 0x209d, "Failed to allocate memory for fcport.\n"); return (<API key>); } new_fcport->flags |= (FCF_FABRIC_DEVICE | FCF_LOGIN_NEEDED); /* Set start port ID scan at adapter ID. */ first_dev = 1; last_dev = 0; /* Starting free loop ID. */ loop_id = ha->min_external_loopid; for (; loop_id <= ha->max_loop_id; loop_id++) { if (<API key>(vha, loop_id)) continue; if (ha->current_topology == ISP_CFG_FL && (atomic_read(&vha->loop_down_timer) || LOOP_TRANSITION(vha))) { atomic_set(&vha->loop_down_timer, 0); set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); break; } if (swl != NULL) { if (last_dev) { wrap.b24 = new_fcport->d_id.b24; } else { new_fcport->d_id.b24 = swl[swl_idx].d_id.b24; memcpy(new_fcport->node_name, swl[swl_idx].node_name, WWN_SIZE); memcpy(new_fcport->port_name, swl[swl_idx].port_name, WWN_SIZE); memcpy(new_fcport->fabric_port_name, swl[swl_idx].fabric_port_name, WWN_SIZE); new_fcport->fp_speed = swl[swl_idx].fp_speed; new_fcport->fc4_type = swl[swl_idx].fc4_type; new_fcport->nvme_flag = 0; if (vha->flags.nvme_enabled && swl[swl_idx].fc4_type & FS_FC4TYPE_NVME) { ql_log(ql_log_info, vha, 0x2131, "FOUND: NVME port %8phC as FC Type 28h\n", new_fcport->port_name); } if (swl[swl_idx].d_id.b.rsvd_1 != 0) { last_dev = 1; } swl_idx++; } } else { /* Send GA_NXT to the switch */ rval = qla2x00_ga_nxt(vha, new_fcport); if (rval != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x209e, "SNS scan failed -- assuming " "zero-entry result.\n"); rval = QLA_SUCCESS; break; } } /* If wrap on switch device list, exit. */ if (first_dev) { wrap.b24 = new_fcport->d_id.b24; first_dev = 0; } else if (new_fcport->d_id.b24 == wrap.b24) { ql_dbg(ql_dbg_disc, vha, 0x209f, "Device wrap (%02x%02x%02x).\n", new_fcport->d_id.b.domain, new_fcport->d_id.b.area, new_fcport->d_id.b.al_pa); break; } /* Bypass if same physical adapter. */ if (new_fcport->d_id.b24 == base_vha->d_id.b24) continue; /* Bypass virtual ports of the same host. */ if (qla2x00_is_a_vp_did(vha, new_fcport->d_id.b24)) continue; /* Bypass if same domain and area of adapter. */ if (((new_fcport->d_id.b24 & 0xffff00) == (vha->d_id.b24 & 0xffff00)) && ha->current_topology == ISP_CFG_FL) continue; /* Bypass reserved domain fields. */ if ((new_fcport->d_id.b.domain & 0xf0) == 0xf0) continue; /* Bypass ports whose FCP-4 type is not FCP_SCSI */ if (ql2xgffidenable && (!(new_fcport->fc4_type & FS_FC4TYPE_FCP) && new_fcport->fc4_type != 0)) continue; spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); /* Locate matching device in database. */ found = 0; list_for_each_entry(fcport, &vha->vp_fcports, list) { if (memcmp(new_fcport->port_name, fcport->port_name, WWN_SIZE)) continue; fcport->scan_state = QLA_FCPORT_FOUND; found++; /* Update port state. */ memcpy(fcport->fabric_port_name, new_fcport->fabric_port_name, WWN_SIZE); fcport->fp_speed = new_fcport->fp_speed; /* * If address the same and state FCS_ONLINE * (or in target mode), nothing changed. */ if (fcport->d_id.b24 == new_fcport->d_id.b24 && (atomic_read(&fcport->state) == FCS_ONLINE || (vha->host->active_mode == MODE_TARGET))) { break; } if (fcport->login_retry == 0) fcport->login_retry = vha->hw->login_retry_count; /* * If device was not a fabric device before. */ if ((fcport->flags & FCF_FABRIC_DEVICE) == 0) { fcport->d_id.b24 = new_fcport->d_id.b24; <API key>(fcport); fcport->flags |= (FCF_FABRIC_DEVICE | FCF_LOGIN_NEEDED); break; } /* * Port ID changed or device was marked to be updated; * Log it out if still logged in and mark it for * relogin later. */ if (<API key>(base_vha)) { ql_dbg(ql_dbg_tgt_mgt, vha, 0xf080, "port changed FC ID, %8phC" " old %x:%x:%x (loop_id 0x%04x)-> new %x:%x:%x\n", fcport->port_name, fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa, fcport->loop_id, new_fcport->d_id.b.domain, new_fcport->d_id.b.area, new_fcport->d_id.b.al_pa); fcport->d_id.b24 = new_fcport->d_id.b24; break; } fcport->d_id.b24 = new_fcport->d_id.b24; fcport->flags |= FCF_LOGIN_NEEDED; break; } if (found && NVME_TARGET(vha->hw, fcport)) { if (fcport->disc_state == DSC_DELETE_PEND) { <API key>(fcport, DSC_GNL); vha->fcport_count fcport->login_succ = 0; } } if (found) { <API key>(&vha->hw->tgt.sess_lock, flags); continue; } /* If device was not in our fcports list, then add it. */ new_fcport->scan_state = QLA_FCPORT_FOUND; list_add_tail(&new_fcport->list, &vha->vp_fcports); <API key>(&vha->hw->tgt.sess_lock, flags); /* Allocate a new replacement fcport. */ nxt_d_id.b24 = new_fcport->d_id.b24; new_fcport = <API key>(vha, GFP_KERNEL); if (new_fcport == NULL) { ql_log(ql_log_warn, vha, 0xd032, "Memory allocation failed for fcport.\n"); return (<API key>); } new_fcport->flags |= (FCF_FABRIC_DEVICE | FCF_LOGIN_NEEDED); new_fcport->d_id.b24 = nxt_d_id.b24; } qla2x00_free_fcport(new_fcport); /* * Logout all previous fabric dev marked lost, except FCP2 devices. */ list_for_each_entry(fcport, &vha->vp_fcports, list) { if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) break; if ((fcport->flags & FCF_FABRIC_DEVICE) == 0) continue; if (fcport->scan_state == QLA_FCPORT_SCAN) { if ((<API key>(vha) || <API key>(vha)) && atomic_read(&fcport->state) == FCS_ONLINE) { <API key>(vha, fcport, <API key>); if (fcport->loop_id != FC_NO_LOOP_ID && (fcport->flags & FCF_FCP2_DEVICE) == 0 && fcport->port_type != FCT_INITIATOR && fcport->port_type != FCT_BROADCAST) { ql_dbg(ql_dbg_disc, vha, 0x20f0, "%s %d %8phC post del sess\n", __func__, __LINE__, fcport->port_name); <API key>(fcport); continue; } } } if (fcport->scan_state == QLA_FCPORT_FOUND && (fcport->flags & FCF_LOGIN_NEEDED) != 0) <API key>(vha, fcport); } return (rval); } /* FW does not set aside Loop id for MGMT Server/FFFFFAh */ int <API key>(scsi_qla_host_t *vha) { int loop_id = FC_NO_LOOP_ID; int lid = NPH_MGMT_SERVER - vha->vp_idx; unsigned long flags; struct qla_hw_data *ha = vha->hw; if (vha->vp_idx == 0) { set_bit(NPH_MGMT_SERVER, ha->loop_id_map); return NPH_MGMT_SERVER; } /* pick id from high and work down to low */ spin_lock_irqsave(&ha->vport_slock, flags); for (; lid > 0; lid if (!test_bit(lid, vha->hw->loop_id_map)) { set_bit(lid, vha->hw->loop_id_map); loop_id = lid; break; } } <API key>(&ha->vport_slock, flags); return loop_id; } /* * <API key> * Issue fabric login command. * * Input: * ha = adapter block pointer. * device = pointer to FC device type structure. * * Returns: * 0 - Login successfully * 1 - Login failed * 2 - Initiator device * 3 - Fatal error */ int <API key>(scsi_qla_host_t *vha, fc_port_t *fcport, uint16_t *next_loopid) { int rval; int retry; uint16_t tmp_loopid; uint16_t mb[<API key>]; struct qla_hw_data *ha = vha->hw; retry = 0; tmp_loopid = 0; for (;;) { ql_dbg(ql_dbg_disc, vha, 0x2000, "Trying Fabric Login w/loop id 0x%04x for port " "%02x%02x%02x.\n", fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa); /* Login fcport on switch. */ rval = ha->isp_ops->fabric_login(vha, fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa, mb, BIT_0); if (rval != QLA_SUCCESS) { return rval; } if (mb[0] == MBS_PORT_ID_USED) { /* * Device has another loop ID. The firmware team * recommends the driver perform an implicit login with * the specified ID again. The ID we just used is save * here so we return with an ID that can be tried by * the next login. */ retry++; tmp_loopid = fcport->loop_id; fcport->loop_id = mb[1]; ql_dbg(ql_dbg_disc, vha, 0x2001, "Fabric Login: port in use - next loop " "id=0x%04x, port id= %02x%02x%02x.\n", fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa); } else if (mb[0] == <API key>) { /* * Login succeeded. */ if (retry) { /* A retry occurred before. */ *next_loopid = tmp_loopid; } else { /* * No retry occurred before. Just increment the * ID value for next login. */ *next_loopid = (fcport->loop_id + 1); } if (mb[1] & BIT_0) { fcport->port_type = FCT_INITIATOR; } else { fcport->port_type = FCT_TARGET; if (mb[1] & BIT_1) { fcport->flags |= FCF_FCP2_DEVICE; } } if (mb[10] & BIT_0) fcport->supported_classes |= FC_COS_CLASS2; if (mb[10] & BIT_1) fcport->supported_classes |= FC_COS_CLASS3; if (IS_FWI2_CAPABLE(ha)) { if (mb[10] & BIT_7) fcport->flags |= <API key>; } rval = QLA_SUCCESS; break; } else if (mb[0] == MBS_LOOP_ID_USED) { /* * Loop ID already used, try next loop ID. */ fcport->loop_id++; rval = <API key>(vha, fcport); if (rval != QLA_SUCCESS) { /* Ran out of loop IDs to use */ break; } } else if (mb[0] == MBS_COMMAND_ERROR) { /* * Firmware possibly timed out during login. If NO * retries are left to do then the device is declared * dead. */ *next_loopid = fcport->loop_id; ha->isp_ops->fabric_logout(vha, fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa); <API key>(vha, fcport, 1); rval = 1; break; } else { /* * unrecoverable / not handled error */ ql_dbg(ql_dbg_disc, vha, 0x2002, "Failed=%x port_id=%02x%02x%02x loop_id=%x " "jiffies=%lx.\n", mb[0], fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa, fcport->loop_id, jiffies); *next_loopid = fcport->loop_id; ha->isp_ops->fabric_logout(vha, fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa); <API key>(fcport); fcport->login_retry = 0; rval = 3; break; } } return (rval); } /* * <API key> * Issue local device login command. * * Input: * ha = adapter block pointer. * loop_id = loop id of device to login to. * * Returns (Where's the #define!!!!): * 0 - Login successfully * 1 - Login failed * 3 - Fatal error */ int <API key>(scsi_qla_host_t *vha, fc_port_t *fcport) { int rval; uint16_t mb[<API key>]; memset(mb, 0, sizeof(mb)); rval = <API key>(vha, fcport, mb, BIT_0); if (rval == QLA_SUCCESS) { /* Interrogate mailbox registers for any errors */ if (mb[0] == MBS_COMMAND_ERROR) rval = 1; else if (mb[0] == <API key>) /* device not in PCB table */ rval = 3; } return (rval); } /* * qla2x00_loop_resync * Resync with fibre channel devices. * * Input: * ha = adapter block pointer. * * Returns: * 0 = success */ int qla2x00_loop_resync(scsi_qla_host_t *vha) { int rval = QLA_SUCCESS; uint32_t wait_time; clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); if (vha->flags.online) { if (!(rval = qla2x00_fw_ready(vha))) { /* Wait at most MAX_TARGET RSCNs for a stable link. */ wait_time = 256; do { if (!IS_QLAFX00(vha->hw)) { /* * Issue a marker after FW becomes * ready. */ qla2x00_marker(vha, vha->hw->base_qpair, 0, 0, MK_SYNC_ALL); vha->marker_needed = 0; } /* Remap devices on Loop. */ clear_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); if (IS_QLAFX00(vha->hw)) <API key>(vha); else <API key>(vha); wait_time } while (!atomic_read(&vha->loop_down_timer) && !(test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags)) && wait_time && (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))); } } if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags)) return (QLA_FUNCTION_FAILED); if (rval) ql_dbg(ql_dbg_disc, vha, 0x206c, "%s *** FAILED ***.\n", __func__); return (rval); } /* * <API key> * Description: This function will set the appropriate flags and call * qla2x00_loop_resync. If successful loop will be resynced * Arguments : scsi_qla_host_t pointer * returm : Success or Failure */ int <API key>(scsi_qla_host_t *ha) { int32_t rval = 0; if (!test_and_set_bit(LOOP_RESYNC_ACTIVE, &ha->dpc_flags)) { /*Configure the flags so that resync happens properly*/ atomic_set(&ha->loop_down_timer, 0); if (!(ha->device_flags & DFLG_NO_CABLE)) { atomic_set(&ha->loop_state, LOOP_UP); set_bit(LOCAL_LOOP_UPDATE, &ha->dpc_flags); set_bit(REGISTER_FC4_NEEDED, &ha->dpc_flags); set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags); rval = qla2x00_loop_resync(ha); } else atomic_set(&ha->loop_state, LOOP_DEAD); clear_bit(LOOP_RESYNC_ACTIVE, &ha->dpc_flags); } return rval; } void <API key>(scsi_qla_host_t *base_vha) { fc_port_t *fcport; struct scsi_qla_host *vha; struct qla_hw_data *ha = base_vha->hw; unsigned long flags; spin_lock_irqsave(&ha->vport_slock, flags); /* Go with deferred removal of rport references. */ list_for_each_entry(vha, &base_vha->hw->vp_list, list) { atomic_inc(&vha->vref_count); list_for_each_entry(fcport, &vha->vp_fcports, list) { if (fcport->drport && atomic_read(&fcport->state) != FCS_UNCONFIGURED) { <API key>(&ha->vport_slock, flags); qla2x00_rport_del(fcport); spin_lock_irqsave(&ha->vport_slock, flags); } } atomic_dec(&vha->vref_count); wake_up(&vha->vref_waitq); } <API key>(&ha->vport_slock, flags); } /* Assumes idc_lock always held on entry */ void <API key>(scsi_qla_host_t *vha) { struct qla_hw_data *ha = vha->hw; uint32_t drv_presence, drv_presence_mask; uint32_t dev_part_info1, dev_part_info2, class_type; uint32_t class_type_mask = 0x3; uint16_t fcoe_other_function = 0xffff, i; if (IS_QLA8044(ha)) { drv_presence = qla8044_rd_direct(vha, <API key>); dev_part_info1 = qla8044_rd_direct(vha, <API key>); dev_part_info2 = qla8044_rd_direct(vha, <API key>); } else { qla83xx_rd_reg(vha, <API key>, &drv_presence); qla83xx_rd_reg(vha, <API key>, &dev_part_info1); qla83xx_rd_reg(vha, <API key>, &dev_part_info2); } for (i = 0; i < 8; i++) { class_type = ((dev_part_info1 >> (i * 4)) & class_type_mask); if ((class_type == <API key>) && (i != ha->portnum)) { fcoe_other_function = i; break; } } if (fcoe_other_function == 0xffff) { for (i = 0; i < 8; i++) { class_type = ((dev_part_info2 >> (i * 4)) & class_type_mask); if ((class_type == <API key>) && ((i + 8) != ha->portnum)) { fcoe_other_function = i + 8; break; } } } /* * Prepare drv-presence mask based on fcoe functions present. * However consider only valid physical fcoe function numbers (0-15). */ drv_presence_mask = ~((1 << (ha->portnum)) | ((fcoe_other_function == 0xffff) ? 0 : (1 << (fcoe_other_function)))); /* We are the reset owner iff: * - No other protocol drivers present. * - This is the lowest among fcoe functions. */ if (!(drv_presence & drv_presence_mask) && (ha->portnum < fcoe_other_function)) { ql_dbg(ql_dbg_p3p, vha, 0xb07f, "This host is Reset owner.\n"); ha->flags.<API key> = 1; } } static int <API key>(scsi_qla_host_t *vha) { int rval = QLA_SUCCESS; struct qla_hw_data *ha = vha->hw; uint32_t drv_ack; rval = qla83xx_rd_reg(vha, <API key>, &drv_ack); if (rval == QLA_SUCCESS) { drv_ack |= (1 << ha->portnum); rval = qla83xx_wr_reg(vha, <API key>, drv_ack); } return rval; } static int <API key>(scsi_qla_host_t *vha) { int rval = QLA_SUCCESS; struct qla_hw_data *ha = vha->hw; uint32_t drv_ack; rval = qla83xx_rd_reg(vha, <API key>, &drv_ack); if (rval == QLA_SUCCESS) { drv_ack &= ~(1 << ha->portnum); rval = qla83xx_wr_reg(vha, <API key>, drv_ack); } return rval; } static const char * <API key>(uint32_t dev_state) { switch (dev_state) { case QLA8XXX_DEV_COLD: return "COLD/RE-INIT"; case <API key>: return "INITIALIZING"; case QLA8XXX_DEV_READY: return "READY"; case <API key>: return "NEED RESET"; case <API key>: return "NEED QUIESCENT"; case QLA8XXX_DEV_FAILED: return "FAILED"; case <API key>: return "QUIESCENT"; default: return "Unknown"; } } /* Assumes idc-lock always held on entry */ void qla83xx_idc_audit(scsi_qla_host_t *vha, int audit_type) { struct qla_hw_data *ha = vha->hw; uint32_t idc_audit_reg = 0, duration_secs = 0; switch (audit_type) { case IDC_AUDIT_TIMESTAMP: ha->idc_audit_ts = (jiffies_to_msecs(jiffies) / 1000); idc_audit_reg = (ha->portnum) | (IDC_AUDIT_TIMESTAMP << 7) | (ha->idc_audit_ts << 8); qla83xx_wr_reg(vha, QLA83XX_IDC_AUDIT, idc_audit_reg); break; case <API key>: duration_secs = ((jiffies_to_msecs(jiffies) - jiffies_to_msecs(ha->idc_audit_ts)) / 1000); idc_audit_reg = (ha->portnum) | (<API key> << 7) | (duration_secs << 8); qla83xx_wr_reg(vha, QLA83XX_IDC_AUDIT, idc_audit_reg); break; default: ql_log(ql_log_warn, vha, 0xb078, "Invalid audit type specified.\n"); break; } } /* Assumes idc_lock always held on entry */ static int <API key>(scsi_qla_host_t *vha) { struct qla_hw_data *ha = vha->hw; uint32_t idc_control, dev_state; <API key>(vha, &idc_control); if ((idc_control & <API key>)) { ql_log(ql_log_info, vha, 0xb080, "NIC Core reset has been disabled. idc-control=0x%x\n", idc_control); return QLA_FUNCTION_FAILED; } /* Set NEED-RESET iff in READY state and we are the reset-owner */ qla83xx_rd_reg(vha, <API key>, &dev_state); if (ha->flags.<API key> && dev_state == QLA8XXX_DEV_READY) { qla83xx_wr_reg(vha, <API key>, <API key>); ql_log(ql_log_info, vha, 0xb056, "HW State: NEED RESET.\n"); qla83xx_idc_audit(vha, IDC_AUDIT_TIMESTAMP); } else { const char *state = <API key>(dev_state); ql_log(ql_log_info, vha, 0xb057, "HW State: %s.\n", state); /* SV: XXX: Is timeout required here? */ /* Wait for IDC state change READY -> NEED_RESET */ while (dev_state == QLA8XXX_DEV_READY) { qla83xx_idc_unlock(vha, 0); msleep(200); qla83xx_idc_lock(vha, 0); qla83xx_rd_reg(vha, <API key>, &dev_state); } } /* Send IDC ack by writing to drv-ack register */ <API key>(vha); return QLA_SUCCESS; } int <API key>(scsi_qla_host_t *vha, uint32_t idc_control) { return qla83xx_wr_reg(vha, QLA83XX_IDC_CONTROL, idc_control); } int <API key>(scsi_qla_host_t *vha, uint32_t *idc_control) { return qla83xx_rd_reg(vha, QLA83XX_IDC_CONTROL, idc_control); } static int <API key>(scsi_qla_host_t *vha) { uint32_t drv_presence = 0; struct qla_hw_data *ha = vha->hw; qla83xx_rd_reg(vha, <API key>, &drv_presence); if (drv_presence & (1 << ha->portnum)) return QLA_SUCCESS; else return QLA_TEST_FAILED; } int <API key>(scsi_qla_host_t *vha) { int rval = QLA_SUCCESS; struct qla_hw_data *ha = vha->hw; ql_dbg(ql_dbg_p3p, vha, 0xb058, "Entered %s().\n", __func__); if (vha->device_flags & DFLG_DEV_FAILED) { ql_log(ql_log_warn, vha, 0xb059, "Device in unrecoverable FAILED state.\n"); return QLA_FUNCTION_FAILED; } qla83xx_idc_lock(vha, 0); if (<API key>(vha) != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0xb05a, "Function=0x%x has been removed from IDC participation.\n", ha->portnum); rval = QLA_FUNCTION_FAILED; goto exit; } <API key>(vha); rval = <API key>(vha); /* * Perform reset if we are the reset-owner, * else wait till IDC state changes to READY/FAILED. */ if (rval == QLA_SUCCESS) { rval = <API key>(vha); if (rval == QLA_SUCCESS) ha->flags.nic_core_hung = 0; <API key>(vha); } exit: qla83xx_idc_unlock(vha, 0); ql_dbg(ql_dbg_p3p, vha, 0xb05b, "Exiting %s.\n", __func__); return rval; } int qla2xxx_mctp_dump(scsi_qla_host_t *vha) { struct qla_hw_data *ha = vha->hw; int rval = QLA_FUNCTION_FAILED; if (!IS_MCTP_CAPABLE(ha)) { /* This message can be removed from the final version */ ql_log(ql_log_info, vha, 0x506d, "This board is not MCTP capable\n"); return rval; } if (!ha->mctp_dump) { ha->mctp_dump = dma_alloc_coherent(&ha->pdev->dev, MCTP_DUMP_SIZE, &ha->mctp_dump_dma, GFP_KERNEL); if (!ha->mctp_dump) { ql_log(ql_log_warn, vha, 0x506e, "Failed to allocate memory for mctp dump\n"); return rval; } } #define MCTP_DUMP_STR_ADDR 0x00000000 rval = <API key>(vha, ha->mctp_dump_dma, MCTP_DUMP_STR_ADDR, MCTP_DUMP_SIZE/4); if (rval != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x506f, "Failed to capture mctp dump\n"); } else { ql_log(ql_log_info, vha, 0x5070, "Mctp dump capture for host (%ld/%p).\n", vha->host_no, ha->mctp_dump); ha->mctp_dumped = 1; } if (!ha->flags.<API key> && !ha->portnum) { ha->flags.<API key> = 1; rval = <API key>(vha); if (rval) /* NIC Core reset failed. */ ql_log(ql_log_warn, vha, 0x5071, "Failed to restart nic firmware\n"); else ql_dbg(ql_dbg_p3p, vha, 0xb084, "Restarted NIC firmware successfully.\n"); ha->flags.<API key> = 0; } return rval; } /* * qla2x00_quiesce_io * Description: This function will block the new I/Os * Its not aborting any I/Os as context * is not destroyed during quiescence * Arguments: scsi_qla_host_t * return : void */ void qla2x00_quiesce_io(scsi_qla_host_t *vha) { struct qla_hw_data *ha = vha->hw; struct scsi_qla_host *vp; ql_dbg(ql_dbg_dpc, vha, 0x401d, "Quiescing I/O - ha=%p.\n", ha); atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME); if (atomic_read(&vha->loop_state) != LOOP_DOWN) { atomic_set(&vha->loop_state, LOOP_DOWN); <API key>(vha); list_for_each_entry(vp, &ha->vp_list, list) <API key>(vp); } else { if (!atomic_read(&vha->loop_down_timer)) atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); } /* Wait for pending cmds to complete */ WARN_ON_ONCE(<API key>(vha, 0, 0, WAIT_HOST) != QLA_SUCCESS); } void <API key>(scsi_qla_host_t *vha) { struct qla_hw_data *ha = vha->hw; struct scsi_qla_host *vp; unsigned long flags; fc_port_t *fcport; u16 i; /* For ISP82XX, driver waits for completion of the commands. * online flag should be set. */ if (!(IS_P3P_TYPE(ha))) vha->flags.online = 0; ha->flags.chip_reset_done = 0; clear_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); vha->qla_stats.total_isp_aborts++; ql_log(ql_log_info, vha, 0x00af, "Performing ISP error recovery - ha=%p.\n", ha); ha->flags.purge_mbox = 1; /* For ISP82XX, reset_chip is just disabling interrupts. * Driver waits for the completion of the commands. * the interrupts need to be enabled. */ if (!(IS_P3P_TYPE(ha))) ha->isp_ops->reset_chip(vha); ha->link_data_rate = PORT_SPEED_UNKNOWN; SAVE_TOPO(ha); ha->flags.rida_fmt2 = 0; ha->flags.n2n_ae = 0; ha->flags.lip_ae = 0; ha->current_topology = 0; QLA_FW_STOPPED(ha); ha->flags.fw_init_done = 0; ha->chip_reset++; ha->base_qpair->chip_reset = ha->chip_reset; for (i = 0; i < ha->max_qpairs; i++) { if (ha->queue_pair_map[i]) ha->queue_pair_map[i]->chip_reset = ha->base_qpair->chip_reset; } /* purge MBox commands */ if (atomic_read(&ha->num_pend_mbx_stage3)) { clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); complete(&ha->mbx_intr_comp); } i = 0; while (atomic_read(&ha->num_pend_mbx_stage3) || atomic_read(&ha->num_pend_mbx_stage2) || atomic_read(&ha->num_pend_mbx_stage1)) { msleep(20); i++; if (i > 50) break; } ha->flags.purge_mbox = 0; atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); if (atomic_read(&vha->loop_state) != LOOP_DOWN) { atomic_set(&vha->loop_state, LOOP_DOWN); <API key>(vha); spin_lock_irqsave(&ha->vport_slock, flags); list_for_each_entry(vp, &ha->vp_list, list) { atomic_inc(&vp->vref_count); <API key>(&ha->vport_slock, flags); <API key>(vp); spin_lock_irqsave(&ha->vport_slock, flags); atomic_dec(&vp->vref_count); } <API key>(&ha->vport_slock, flags); } else { if (!atomic_read(&vha->loop_down_timer)) atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); } /* Clear all async request states across all VPs. */ list_for_each_entry(fcport, &vha->vp_fcports, list) { fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); fcport->scan_state = 0; } spin_lock_irqsave(&ha->vport_slock, flags); list_for_each_entry(vp, &ha->vp_list, list) { atomic_inc(&vp->vref_count); <API key>(&ha->vport_slock, flags); list_for_each_entry(fcport, &vp->vp_fcports, list) fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); spin_lock_irqsave(&ha->vport_slock, flags); atomic_dec(&vp->vref_count); } <API key>(&ha->vport_slock, flags); if (!ha->flags.eeh_busy) { /* Make sure for ISP 82XX IO DMA is complete */ if (IS_P3P_TYPE(ha)) { <API key>(vha); ql_log(ql_log_info, vha, 0x00b4, "Done chip reset cleanup.\n"); /* Done waiting for pending commands. * Reset the online flag. */ vha->flags.online = 0; } /* Requeue all commands in outstanding command list. */ <API key>(vha, DID_RESET << 16); } /* memory barrier */ wmb(); } /* * qla2x00_abort_isp * Resets ISP and aborts all outstanding commands. * * Input: * ha = adapter block pointer. * * Returns: * 0 = success */ int qla2x00_abort_isp(scsi_qla_host_t *vha) { int rval; uint8_t status = 0; struct qla_hw_data *ha = vha->hw; struct scsi_qla_host *vp; struct req_que *req = ha->req_q_map[0]; unsigned long flags; if (vha->flags.online) { <API key>(vha); if (vha->hw->flags.port_isolated) return status; if (test_and_clear_bit(ISP_ABORT_TO_ROM, &vha->dpc_flags)) { ha->flags.chip_reset_done = 1; vha->flags.online = 1; status = 0; clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); return status; } if (IS_QLA8031(ha)) { ql_dbg(ql_dbg_p3p, vha, 0xb05c, "Clearing fcoe driver presence.\n"); if (<API key>(vha) != QLA_SUCCESS) ql_dbg(ql_dbg_p3p, vha, 0xb073, "Error while clearing DRV-Presence.\n"); } if (unlikely(pci_channel_offline(ha->pdev) && ha->flags.<API key>)) { clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); status = 0; return status; } switch (vha->qlini_mode) { case <API key>: if (!<API key>(vha)) return 0; break; case <API key>: if (!<API key>(vha)) return 0; break; case <API key>: default: break; } ha->isp_ops->get_flash_version(vha, req->ring); ha->isp_ops->nvram_config(vha); if (!qla2x00_restart_isp(vha)) { clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); if (!atomic_read(&vha->loop_down_timer)) { /* * Issue marker command only when we are going * to start the I/O . */ vha->marker_needed = 1; } vha->flags.online = 1; ha->isp_ops->enable_intrs(ha); ha->isp_abort_cnt = 0; clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); if (IS_QLA81XX(ha) || IS_QLA8031(ha)) <API key>(vha); if (ha->fce) { ha->flags.fce_enabled = 1; memset(ha->fce, 0, fce_calc_size(ha->fce_bufs)); rval = <API key>(vha, ha->fce_dma, ha->fce_bufs, ha->fce_mb, &ha->fce_bufs); if (rval) { ql_log(ql_log_warn, vha, 0x8033, "Unable to reinitialize FCE " "(%d).\n", rval); ha->flags.fce_enabled = 0; } } if (ha->eft) { memset(ha->eft, 0, EFT_SIZE); rval = <API key>(vha, ha->eft_dma, EFT_NUM_BUFFERS); if (rval) { ql_log(ql_log_warn, vha, 0x8034, "Unable to reinitialize EFT " "(%d).\n", rval); } } } else { /* failed the ISP abort */ vha->flags.online = 1; if (test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { if (ha->isp_abort_cnt == 0) { ql_log(ql_log_fatal, vha, 0x8035, "ISP error recover failed - " "board disabled.\n"); /* * The next call disables the board * completely. */ <API key>(vha); vha->flags.online = 0; clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); status = 0; } else { /* schedule another ISP abort */ ha->isp_abort_cnt ql_dbg(ql_dbg_taskm, vha, 0x8020, "ISP abort - retry remaining %d.\n", ha->isp_abort_cnt); status = 1; } } else { ha->isp_abort_cnt = <API key>; ql_dbg(ql_dbg_taskm, vha, 0x8021, "ISP error recovery - retrying (%d) " "more times.\n", ha->isp_abort_cnt); set_bit(ISP_ABORT_RETRY, &vha->dpc_flags); status = 1; } } } if (vha->hw->flags.port_isolated) { <API key>(vha); return status; } if (!status) { ql_dbg(ql_dbg_taskm, vha, 0x8022, "%s succeeded.\n", __func__); <API key>(vha); spin_lock_irqsave(&ha->vport_slock, flags); list_for_each_entry(vp, &ha->vp_list, list) { if (vp->vp_idx) { atomic_inc(&vp->vref_count); <API key>(&ha->vport_slock, flags); <API key>(vp); spin_lock_irqsave(&ha->vport_slock, flags); atomic_dec(&vp->vref_count); } } <API key>(&ha->vport_slock, flags); if (IS_QLA8031(ha)) { ql_dbg(ql_dbg_p3p, vha, 0xb05d, "Setting back fcoe driver presence.\n"); if (<API key>(vha) != QLA_SUCCESS) ql_dbg(ql_dbg_p3p, vha, 0xb074, "Error while setting DRV-Presence.\n"); } } else { ql_log(ql_log_warn, vha, 0x8023, "%s **** FAILED ****.\n", __func__); } return(status); } /* * qla2x00_restart_isp * restarts the ISP after a reset * * Input: * ha = adapter block pointer. * * Returns: * 0 = success */ static int qla2x00_restart_isp(scsi_qla_host_t *vha) { int status; struct qla_hw_data *ha = vha->hw; /* If firmware needs to be loaded */ if (<API key>(vha)) { vha->flags.online = 0; status = ha->isp_ops->chip_diag(vha); if (status) return status; status = qla2x00_setup_chip(vha); if (status) return status; } status = qla2x00_init_rings(vha); if (status) return status; clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); ha->flags.chip_reset_done = 1; /* Initialize the queues in use */ qla25xx_init_queues(ha); status = qla2x00_fw_ready(vha); if (status) { /* if no cable then assume it's good */ return vha->device_flags & DFLG_NO_CABLE ? 0 : status; } /* Issue a marker after FW becomes ready. */ qla2x00_marker(vha, ha->base_qpair, 0, 0, MK_SYNC_ALL); set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); return 0; } static int qla25xx_init_queues(struct qla_hw_data *ha) { struct rsp_que *rsp = NULL; struct req_que *req = NULL; struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); int ret = -1; int i; for (i = 1; i < ha->max_rsp_queues; i++) { rsp = ha->rsp_q_map[i]; if (rsp && test_bit(i, ha->rsp_qid_map)) { rsp->options &= ~BIT_0; ret = <API key>(base_vha, rsp); if (ret != QLA_SUCCESS) ql_dbg(ql_dbg_init, base_vha, 0x00ff, "%s Rsp que: %d init failed.\n", __func__, rsp->id); else ql_dbg(ql_dbg_init, base_vha, 0x0100, "%s Rsp que: %d inited.\n", __func__, rsp->id); } } for (i = 1; i < ha->max_req_queues; i++) { req = ha->req_q_map[i]; if (req && test_bit(i, ha->req_qid_map)) { /* Clear outstanding commands array. */ req->options &= ~BIT_0; ret = <API key>(base_vha, req); if (ret != QLA_SUCCESS) ql_dbg(ql_dbg_init, base_vha, 0x0101, "%s Req que: %d init failed.\n", __func__, req->id); else ql_dbg(ql_dbg_init, base_vha, 0x0102, "%s Req que: %d inited.\n", __func__, req->id); } } return ret; } /* * <API key> * Reset adapter. * * Input: * ha = adapter block pointer. */ int <API key>(scsi_qla_host_t *vha) { unsigned long flags = 0; struct qla_hw_data *ha = vha->hw; struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; vha->flags.online = 0; ha->isp_ops->disable_intrs(ha); spin_lock_irqsave(&ha->hardware_lock, flags); wrt_reg_word(&reg->hccr, HCCR_RESET_RISC); rd_reg_word(&reg->hccr); /* PCI Posting. */ wrt_reg_word(&reg->hccr, HCCR_RELEASE_RISC); rd_reg_word(&reg->hccr); /* PCI Posting. */ <API key>(&ha->hardware_lock, flags); return QLA_SUCCESS; } int <API key>(scsi_qla_host_t *vha) { unsigned long flags = 0; struct qla_hw_data *ha = vha->hw; struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; if (IS_P3P_TYPE(ha)) return QLA_SUCCESS; vha->flags.online = 0; ha->isp_ops->disable_intrs(ha); spin_lock_irqsave(&ha->hardware_lock, flags); wrt_reg_dword(&reg->hccr, <API key>); rd_reg_dword(&reg->hccr); wrt_reg_dword(&reg->hccr, <API key>); rd_reg_dword(&reg->hccr); <API key>(&ha->hardware_lock, flags); if (IS_NOPOLLING_TYPE(ha)) ha->isp_ops->enable_intrs(ha); return QLA_SUCCESS; } /* On sparc systems, obtain port and node WWN from firmware * properties. */ static void <API key>(scsi_qla_host_t *vha, struct nvram_24xx *nv) { #ifdef CONFIG_SPARC struct qla_hw_data *ha = vha->hw; struct pci_dev *pdev = ha->pdev; struct device_node *dp = <API key>(pdev); const u8 *val; int len; val = of_get_property(dp, "port-wwn", &len); if (val && len >= WWN_SIZE) memcpy(nv->port_name, val, WWN_SIZE); val = of_get_property(dp, "node-wwn", &len); if (val && len >= WWN_SIZE) memcpy(nv->node_name, val, WWN_SIZE); #endif } int <API key>(scsi_qla_host_t *vha) { int rval; struct init_cb_24xx *icb; struct nvram_24xx *nv; __le32 *dptr; uint8_t *dptr1, *dptr2; uint32_t chksum; uint16_t cnt; struct qla_hw_data *ha = vha->hw; rval = QLA_SUCCESS; icb = (struct init_cb_24xx *)ha->init_cb; nv = ha->nvram; /* Determine NVRAM starting address. */ if (ha->port_no == 0) { ha->nvram_base = FA_NVRAM_FUNC0_ADDR; ha->vpd_base = FA_NVRAM_VPD0_ADDR; } else { ha->nvram_base = FA_NVRAM_FUNC1_ADDR; ha->vpd_base = FA_NVRAM_VPD1_ADDR; } ha->nvram_size = sizeof(*nv); ha->vpd_size = FA_NVRAM_VPD_SIZE; /* Get VPD data into cache */ ha->vpd = ha->nvram + VPD_OFFSET; ha->isp_ops->read_nvram(vha, ha->vpd, ha->nvram_base - FA_NVRAM_FUNC0_ADDR, FA_NVRAM_VPD_SIZE * 4); /* Get NVRAM data into cache and calculate checksum. */ dptr = (__force __le32 *)nv; ha->isp_ops->read_nvram(vha, dptr, ha->nvram_base, ha->nvram_size); for (cnt = 0, chksum = 0; cnt < ha->nvram_size >> 2; cnt++, dptr++) chksum += le32_to_cpu(*dptr); ql_dbg(ql_dbg_init + ql_dbg_buffer, vha, 0x006a, "Contents of NVRAM\n"); ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x010d, nv, ha->nvram_size); /* Bad NVRAM data, set defaults parameters. */ if (chksum || memcmp("ISP ", nv->id, sizeof(nv->id)) || le16_to_cpu(nv->nvram_version) < ICB_VERSION) { /* Reset NVRAM data. */ ql_log(ql_log_warn, vha, 0x006b, "Inconsistent NVRAM checksum=%#x id=%.4s version=%#x.\n", chksum, nv->id, nv->nvram_version); ql_dump_buffer(ql_dbg_init, vha, 0x006b, nv, sizeof(*nv)); ql_log(ql_log_warn, vha, 0x006c, "Falling back to functioning (yet invalid -- WWPN) " "defaults.\n"); /* * Set default initialization control block. */ memset(nv, 0, ha->nvram_size); nv->nvram_version = cpu_to_le16(ICB_VERSION); nv->version = cpu_to_le16(ICB_VERSION); nv->frame_payload_size = cpu_to_le16(2048); nv->execution_throttle = cpu_to_le16(0xFFFF); nv->exchange_count = cpu_to_le16(0); nv->hard_address = cpu_to_le16(124); nv->port_name[0] = 0x21; nv->port_name[1] = 0x00 + ha->port_no + 1; nv->port_name[2] = 0x00; nv->port_name[3] = 0xe0; nv->port_name[4] = 0x8b; nv->port_name[5] = 0x1c; nv->port_name[6] = 0x55; nv->port_name[7] = 0x86; nv->node_name[0] = 0x20; nv->node_name[1] = 0x00; nv->node_name[2] = 0x00; nv->node_name[3] = 0xe0; nv->node_name[4] = 0x8b; nv->node_name[5] = 0x1c; nv->node_name[6] = 0x55; nv->node_name[7] = 0x86; <API key>(vha, nv); nv->login_retry_count = cpu_to_le16(8); nv-><API key> = cpu_to_le16(0); nv->login_timeout = cpu_to_le16(0); nv->firmware_options_1 = cpu_to_le32(BIT_14|BIT_13|BIT_2|BIT_1); nv->firmware_options_2 = cpu_to_le32(2 << 4); nv->firmware_options_2 |= cpu_to_le32(BIT_12); nv->firmware_options_3 = cpu_to_le32(2 << 13); nv->host_p = cpu_to_le32(BIT_11|BIT_10); nv->efi_parameters = cpu_to_le32(0); nv->reset_delay = 5; nv->max_luns_per_target = cpu_to_le16(128); nv-><API key> = cpu_to_le16(30); nv->link_down_timeout = cpu_to_le16(30); rval = 1; } if (<API key>(vha)) { /* Don't enable full login after initial LIP */ nv->firmware_options_1 &= cpu_to_le32(~BIT_13); /* Don't enable LIP full login for initiator */ nv->host_p &= cpu_to_le32(~BIT_10); } <API key>(vha, nv); /* Reset Initialization control block */ memset(icb, 0, ha->init_cb_size); /* Copy 1st segment. */ dptr1 = (uint8_t *)icb; dptr2 = (uint8_t *)&nv->version; cnt = (uint8_t *)&icb-><API key> - (uint8_t *)&icb->version; while (cnt *dptr1++ = *dptr2++; icb->login_retry_count = nv->login_retry_count; icb->link_down_on_nos = nv->link_down_on_nos; /* Copy 2nd segment. */ dptr1 = (uint8_t *)&icb-><API key>; dptr2 = (uint8_t *)&nv-><API key>; cnt = (uint8_t *)&icb->reserved_3 - (uint8_t *)&icb-><API key>; while (cnt *dptr1++ = *dptr2++; ha->frame_payload_size = le16_to_cpu(icb->frame_payload_size); /* * Setup driver NVRAM options. */ <API key>(vha, nv->model_name, sizeof(nv->model_name), "QLA2462"); <API key>(vha, icb); if (nv->host_p & cpu_to_le32(BIT_15)) { /* Use alternate WWN? */ memcpy(icb->node_name, nv->alternate_node_name, WWN_SIZE); memcpy(icb->port_name, nv->alternate_port_name, WWN_SIZE); } /* Prepare nodename */ if ((icb->firmware_options_1 & cpu_to_le32(BIT_14)) == 0) { /* * Firmware will apply the following mask if the nodename was * not provided. */ memcpy(icb->node_name, icb->port_name, WWN_SIZE); icb->node_name[0] &= 0xF0; } /* Set host adapter parameters. */ ha->flags.<API key> = 0; ha->flags.enable_lip_reset = 0; ha->flags.<API key> = le32_to_cpu(nv->host_p) & BIT_10 ? 1 : 0; ha->flags.enable_target_reset = le32_to_cpu(nv->host_p) & BIT_11 ? 1 : 0; ha->flags.enable_led_scheme = 0; ha->flags.disable_serdes = le32_to_cpu(nv->host_p) & BIT_5 ? 1 : 0; ha->operating_mode = (le32_to_cpu(icb->firmware_options_2) & (BIT_6 | BIT_5 | BIT_4)) >> 4; memcpy(ha-><API key>, nv->seriallink_options, sizeof(ha-><API key>)); /* save HBA serial number */ ha->serial0 = icb->port_name[5]; ha->serial1 = icb->port_name[6]; ha->serial2 = icb->port_name[7]; memcpy(vha->node_name, icb->node_name, WWN_SIZE); memcpy(vha->port_name, icb->port_name, WWN_SIZE); icb->execution_throttle = cpu_to_le16(0xFFFF); ha->retry_count = le16_to_cpu(nv->login_retry_count); /* Set minimum login_timeout to 4 seconds. */ if (le16_to_cpu(nv->login_timeout) < ql2xlogintimeout) nv->login_timeout = cpu_to_le16(ql2xlogintimeout); if (le16_to_cpu(nv->login_timeout) < 4) nv->login_timeout = cpu_to_le16(4); ha->login_timeout = le16_to_cpu(nv->login_timeout); /* Set minimum RATOV to 100 tenths of a second. */ ha->r_a_tov = 100; ha->loop_reset_delay = nv->reset_delay; /* Link Down Timeout = 0: * * When Port Down timer expires we will start returning * I/O's to OS with "DID_NO_CONNECT". * * Link Down Timeout != 0: * * The driver waits for the link to come up after link down * before returning I/Os to OS with "DID_NO_CONNECT". */ if (le16_to_cpu(nv->link_down_timeout) == 0) { ha-><API key> = (LOOP_DOWN_TIME - LOOP_DOWN_TIMEOUT); } else { ha->link_down_timeout = le16_to_cpu(nv->link_down_timeout); ha-><API key> = (LOOP_DOWN_TIME - ha->link_down_timeout); } /* Need enough time to try and get the port back. */ ha-><API key> = le16_to_cpu(nv-><API key>); if (qlport_down_retry) ha-><API key> = qlport_down_retry; /* Set login_retry_count */ ha->login_retry_count = le16_to_cpu(nv->login_retry_count); if (ha-><API key> == le16_to_cpu(nv-><API key>) && ha-><API key> > 3) ha->login_retry_count = ha-><API key>; else if (ha-><API key> > (int)ha->login_retry_count) ha->login_retry_count = ha-><API key>; if (ql2xloginretrycount) ha->login_retry_count = ql2xloginretrycount; /* N2N: driver will initiate Login instead of FW */ icb->firmware_options_3 |= cpu_to_le32(BIT_8); /* Enable ZIO. */ if (!vha->flags.init_done) { ha->zio_mode = le32_to_cpu(icb->firmware_options_2) & (BIT_3 | BIT_2 | BIT_1 | BIT_0); ha->zio_timer = le16_to_cpu(icb-><API key>) ? le16_to_cpu(icb-><API key>) : 2; } icb->firmware_options_2 &= cpu_to_le32( ~(BIT_3 | BIT_2 | BIT_1 | BIT_0)); if (ha->zio_mode != QLA_ZIO_DISABLED) { ha->zio_mode = QLA_ZIO_MODE_6; ql_log(ql_log_info, vha, 0x006f, "ZIO mode %d enabled; timer delay (%d us).\n", ha->zio_mode, ha->zio_timer * 100); icb->firmware_options_2 |= cpu_to_le32( (uint32_t)ha->zio_mode); icb-><API key> = cpu_to_le16(ha->zio_timer); } if (rval) { ql_log(ql_log_warn, vha, 0x0070, "NVRAM configuration failed.\n"); } return (rval); } static void qla27xx_print_image(struct scsi_qla_host *vha, char *name, struct <API key> *image_status) { ql_dbg(ql_dbg_init, vha, 0x018b, "%s %s: mask=%#02x gen=%#04x ver=%u.%u map=%#01x sum=%#08x sig=%#08x\n", name, "status", image_status->image_status_mask, le16_to_cpu(image_status->generation), image_status->ver_major, image_status->ver_minor, image_status->bitmap, le32_to_cpu(image_status->checksum), le32_to_cpu(image_status->signature)); } static bool <API key>( struct <API key> *image_status) { ulong signature = le32_to_cpu(image_status->signature); return signature != <API key>; } static bool <API key>(struct <API key> *image_status) { ulong signature = le32_to_cpu(image_status->signature); return signature != <API key> && signature != <API key>; } static ulong <API key>(struct <API key> *image_status) { __le32 *p = (__force __le32 *)image_status; uint n = sizeof(*image_status) / sizeof(*p); uint32_t sum = 0; for ( ; n sum += le32_to_cpup(p); return sum; } static inline uint <API key>(struct <API key> *aux, uint bitmask) { return aux->bitmap & bitmask ? <API key> : <API key>; } static void <API key>( struct active_regions *active_regions, struct <API key> *aux) { active_regions->aux.board_config = <API key>(aux, <API key>); active_regions->aux.vpd_nvram = <API key>(aux, <API key>); active_regions->aux.npiv_config_0_1 = <API key>(aux, <API key>); active_regions->aux.npiv_config_2_3 = <API key>(aux, <API key>); } static int <API key>( struct <API key> *pri_image_status, struct <API key> *sec_image_status) { /* calculate generation delta as uint16 (this accounts for wrap) */ int16_t delta = le16_to_cpu(pri_image_status->generation) - le16_to_cpu(sec_image_status->generation); ql_dbg(ql_dbg_init, NULL, 0x0180, "generation delta = %d\n", delta); return delta; } void <API key>( struct scsi_qla_host *vha, struct active_regions *active_regions) { struct qla_hw_data *ha = vha->hw; struct <API key> <API key>, <API key>; bool valid_pri_image = false, valid_sec_image = false; bool active_pri_image = false, active_sec_image = false; if (!ha-><API key>) { ql_dbg(ql_dbg_init, vha, 0x018a, "Primary aux image not addressed\n"); goto check_sec_image; } <API key>(vha, (uint32_t *)&<API key>, ha-><API key>, sizeof(<API key>) >> 2); qla27xx_print_image(vha, "Primary aux image", &<API key>); if (<API key>(&<API key>)) { ql_dbg(ql_dbg_init, vha, 0x018b, "Primary aux image signature (%#x) not valid\n", le32_to_cpu(<API key>.signature)); goto check_sec_image; } if (<API key>(&<API key>)) { ql_dbg(ql_dbg_init, vha, 0x018c, "Primary aux image checksum failed\n"); goto check_sec_image; } valid_pri_image = true; if (<API key>.image_status_mask & 1) { ql_dbg(ql_dbg_init, vha, 0x018d, "Primary aux image is active\n"); active_pri_image = true; } check_sec_image: if (!ha-><API key>) { ql_dbg(ql_dbg_init, vha, 0x018a, "Secondary aux image not addressed\n"); goto check_valid_image; } <API key>(vha, (uint32_t *)&<API key>, ha-><API key>, sizeof(<API key>) >> 2); qla27xx_print_image(vha, "Secondary aux image", &<API key>); if (<API key>(&<API key>)) { ql_dbg(ql_dbg_init, vha, 0x018b, "Secondary aux image signature (%#x) not valid\n", le32_to_cpu(<API key>.signature)); goto check_valid_image; } if (<API key>(&<API key>)) { ql_dbg(ql_dbg_init, vha, 0x018c, "Secondary aux image checksum failed\n"); goto check_valid_image; } valid_sec_image = true; if (<API key>.image_status_mask & 1) { ql_dbg(ql_dbg_init, vha, 0x018d, "Secondary aux image is active\n"); active_sec_image = true; } check_valid_image: if (valid_pri_image && active_pri_image && valid_sec_image && active_sec_image) { if (<API key>(&<API key>, &<API key>) >= 0) { <API key>(active_regions, &<API key>); } else { <API key>(active_regions, &<API key>); } } else if (valid_pri_image && active_pri_image) { <API key>(active_regions, &<API key>); } else if (valid_sec_image && active_sec_image) { <API key>(active_regions, &<API key>); } ql_dbg(ql_dbg_init, vha, 0x018f, "aux images active: BCFG=%u VPD/NVR=%u NPIV0/1=%u NPIV2/3=%u\n", active_regions->aux.board_config, active_regions->aux.vpd_nvram, active_regions->aux.npiv_config_0_1, active_regions->aux.npiv_config_2_3); } void <API key>(struct scsi_qla_host *vha, struct active_regions *active_regions) { struct qla_hw_data *ha = vha->hw; struct <API key> pri_image_status, sec_image_status; bool valid_pri_image = false, valid_sec_image = false; bool active_pri_image = false, active_sec_image = false; if (!ha-><API key>) { ql_dbg(ql_dbg_init, vha, 0x018a, "Primary image not addressed\n"); goto check_sec_image; } if (<API key>(vha, (uint32_t *)&pri_image_status, ha-><API key>, sizeof(pri_image_status) >> 2) != QLA_SUCCESS) { WARN_ON_ONCE(true); goto check_sec_image; } qla27xx_print_image(vha, "Primary image", &pri_image_status); if (<API key>(&pri_image_status)) { ql_dbg(ql_dbg_init, vha, 0x018b, "Primary image signature (%#x) not valid\n", le32_to_cpu(pri_image_status.signature)); goto check_sec_image; } if (<API key>(&pri_image_status)) { ql_dbg(ql_dbg_init, vha, 0x018c, "Primary image checksum failed\n"); goto check_sec_image; } valid_pri_image = true; if (pri_image_status.image_status_mask & 1) { ql_dbg(ql_dbg_init, vha, 0x018d, "Primary image is active\n"); active_pri_image = true; } check_sec_image: if (!ha-><API key>) { ql_dbg(ql_dbg_init, vha, 0x018a, "Secondary image not addressed\n"); goto check_valid_image; } <API key>(vha, (uint32_t *)(&sec_image_status), ha-><API key>, sizeof(sec_image_status) >> 2); qla27xx_print_image(vha, "Secondary image", &sec_image_status); if (<API key>(&sec_image_status)) { ql_dbg(ql_dbg_init, vha, 0x018b, "Secondary image signature (%#x) not valid\n", le32_to_cpu(sec_image_status.signature)); goto check_valid_image; } if (<API key>(&sec_image_status)) { ql_dbg(ql_dbg_init, vha, 0x018c, "Secondary image checksum failed\n"); goto check_valid_image; } valid_sec_image = true; if (sec_image_status.image_status_mask & 1) { ql_dbg(ql_dbg_init, vha, 0x018d, "Secondary image is active\n"); active_sec_image = true; } check_valid_image: if (valid_pri_image && active_pri_image) active_regions->global = <API key>; if (valid_sec_image && active_sec_image) { if (!active_regions->global || <API key>( &pri_image_status, &sec_image_status) < 0) { active_regions->global = <API key>; } } ql_dbg(ql_dbg_init, vha, 0x018f, "active image %s (%u)\n", active_regions->global == <API key> ? "default (boot/fw)" : active_regions->global == <API key> ? "primary" : active_regions->global == <API key> ? "secondary" : "invalid", active_regions->global); } bool <API key>(uint32_t *dword) { return !(dword[4] | dword[5] | dword[6] | dword[7]) || !(~dword[4] | ~dword[5] | ~dword[6] | ~dword[7]); } static int <API key>(scsi_qla_host_t *vha, uint32_t *srisc_addr, uint32_t faddr) { int rval; uint templates, segments, fragment; ulong i; uint j; ulong dlen; uint32_t *dcode; uint32_t risc_addr, risc_size, risc_attr = 0; struct qla_hw_data *ha = vha->hw; struct req_que *req = ha->req_q_map[0]; struct fwdt *fwdt = ha->fwdt; ql_dbg(ql_dbg_init, vha, 0x008b, "FW: Loading firmware from flash (%x).\n", faddr); dcode = (uint32_t *)req->ring; <API key>(vha, dcode, faddr, 8); if (<API key>(dcode)) { ql_log(ql_log_fatal, vha, 0x008c, "Unable to verify the integrity of flash firmware " "image.\n"); ql_log(ql_log_fatal, vha, 0x008d, "Firmware data: %08x %08x %08x %08x.\n", dcode[0], dcode[1], dcode[2], dcode[3]); return QLA_FUNCTION_FAILED; } dcode = (uint32_t *)req->ring; *srisc_addr = 0; segments = <API key>; for (j = 0; j < segments; j++) { ql_dbg(ql_dbg_init, vha, 0x008d, "-> Loading segment %u...\n", j); <API key>(vha, dcode, faddr, 10); risc_addr = be32_to_cpu((__force __be32)dcode[2]); risc_size = be32_to_cpu((__force __be32)dcode[3]); if (!*srisc_addr) { *srisc_addr = risc_addr; risc_attr = be32_to_cpu((__force __be32)dcode[9]); } dlen = ha->fw_transfer_size >> 2; for (fragment = 0; risc_size; fragment++) { if (dlen > risc_size) dlen = risc_size; ql_dbg(ql_dbg_init, vha, 0x008e, "-> Loading fragment %u: %#x <- %#x (%#lx dwords)...\n", fragment, risc_addr, faddr, dlen); <API key>(vha, dcode, faddr, dlen); for (i = 0; i < dlen; i++) dcode[i] = swab32(dcode[i]); rval = qla2x00_load_ram(vha, req->dma, risc_addr, dlen); if (rval) { ql_log(ql_log_fatal, vha, 0x008f, "-> Failed load firmware fragment %u.\n", fragment); return QLA_FUNCTION_FAILED; } faddr += dlen; risc_addr += dlen; risc_size -= dlen; } } if (!IS_QLA27XX(ha) && !IS_QLA28XX(ha)) return QLA_SUCCESS; templates = (risc_attr & BIT_9) ? 2 : 1; ql_dbg(ql_dbg_init, vha, 0x0160, "-> templates = %u\n", templates); for (j = 0; j < templates; j++, fwdt++) { vfree(fwdt->template); fwdt->template = NULL; fwdt->length = 0; dcode = (uint32_t *)req->ring; <API key>(vha, dcode, faddr, 7); risc_size = be32_to_cpu((__force __be32)dcode[2]); ql_dbg(ql_dbg_init, vha, 0x0161, "-> fwdt%u template array at %#x (%#x dwords)\n", j, faddr, risc_size); if (!risc_size || !~risc_size) { ql_dbg(ql_dbg_init, vha, 0x0162, "-> fwdt%u failed to read array\n", j); goto failed; } /* skip header and ignore checksum */ faddr += 7; risc_size -= 8; ql_dbg(ql_dbg_init, vha, 0x0163, "-> fwdt%u template allocate template %#x words...\n", j, risc_size); fwdt->template = vmalloc(risc_size * sizeof(*dcode)); if (!fwdt->template) { ql_log(ql_log_warn, vha, 0x0164, "-> fwdt%u failed allocate template.\n", j); goto failed; } dcode = fwdt->template; <API key>(vha, dcode, faddr, risc_size); if (!<API key>(dcode)) { ql_log(ql_log_warn, vha, 0x0165, "-> fwdt%u failed template validate\n", j); goto failed; } dlen = <API key>(dcode); ql_dbg(ql_dbg_init, vha, 0x0166, "-> fwdt%u template size %#lx bytes (%#lx words)\n", j, dlen, dlen / sizeof(*dcode)); if (dlen > risc_size * sizeof(*dcode)) { ql_log(ql_log_warn, vha, 0x0167, "-> fwdt%u template exceeds array (%-lu bytes)\n", j, dlen - risc_size * sizeof(*dcode)); goto failed; } fwdt->length = dlen; ql_dbg(ql_dbg_init, vha, 0x0168, "-> fwdt%u loaded template ok\n", j); faddr += risc_size + 1; } return QLA_SUCCESS; failed: vfree(fwdt->template); fwdt->template = NULL; fwdt->length = 0; return QLA_SUCCESS; } #define QLA_FW_URL "http://ldriver.qlogic.com/firmware/" int qla2x00_load_risc(scsi_qla_host_t *vha, uint32_t *srisc_addr) { int rval; int i, fragment; uint16_t *wcode; __be16 *fwcode; uint32_t risc_addr, risc_size, fwclen, wlen, *seg; struct fw_blob *blob; struct qla_hw_data *ha = vha->hw; struct req_que *req = ha->req_q_map[0]; /* Load firmware blob. */ blob = <API key>(vha); if (!blob) { ql_log(ql_log_info, vha, 0x0083, "Firmware image unavailable.\n"); ql_log(ql_log_info, vha, 0x0084, "Firmware images can be retrieved from: "QLA_FW_URL ".\n"); return QLA_FUNCTION_FAILED; } rval = QLA_SUCCESS; wcode = (uint16_t *)req->ring; *srisc_addr = 0; fwcode = (__force __be16 *)blob->fw->data; fwclen = 0; /* Validate firmware image by checking version. */ if (blob->fw->size < 8 * sizeof(uint16_t)) { ql_log(ql_log_fatal, vha, 0x0085, "Unable to verify integrity of firmware image (%zd).\n", blob->fw->size); goto fail_fw_integrity; } for (i = 0; i < 4; i++) wcode[i] = be16_to_cpu(fwcode[i + 4]); if ((wcode[0] == 0xffff && wcode[1] == 0xffff && wcode[2] == 0xffff && wcode[3] == 0xffff) || (wcode[0] == 0 && wcode[1] == 0 && wcode[2] == 0 && wcode[3] == 0)) { ql_log(ql_log_fatal, vha, 0x0086, "Unable to verify integrity of firmware image.\n"); ql_log(ql_log_fatal, vha, 0x0087, "Firmware data: %04x %04x %04x %04x.\n", wcode[0], wcode[1], wcode[2], wcode[3]); goto fail_fw_integrity; } seg = blob->segs; while (*seg && rval == QLA_SUCCESS) { risc_addr = *seg; *srisc_addr = *srisc_addr == 0 ? *seg : *srisc_addr; risc_size = be16_to_cpu(fwcode[3]); /* Validate firmware image size. */ fwclen += risc_size * sizeof(uint16_t); if (blob->fw->size < fwclen) { ql_log(ql_log_fatal, vha, 0x0088, "Unable to verify integrity of firmware image " "(%zd).\n", blob->fw->size); goto fail_fw_integrity; } fragment = 0; while (risc_size > 0 && rval == QLA_SUCCESS) { wlen = (uint16_t)(ha->fw_transfer_size >> 1); if (wlen > risc_size) wlen = risc_size; ql_dbg(ql_dbg_init, vha, 0x0089, "Loading risc segment@ risc addr %x number of " "words 0x%x.\n", risc_addr, wlen); for (i = 0; i < wlen; i++) wcode[i] = swab16((__force u32)fwcode[i]); rval = qla2x00_load_ram(vha, req->dma, risc_addr, wlen); if (rval) { ql_log(ql_log_fatal, vha, 0x008a, "Failed to load segment %d of firmware.\n", fragment); break; } fwcode += wlen; risc_addr += wlen; risc_size -= wlen; fragment++; } /* Next segment. */ seg++; } return rval; fail_fw_integrity: return QLA_FUNCTION_FAILED; } static int <API key>(scsi_qla_host_t *vha, uint32_t *srisc_addr) { int rval; uint templates, segments, fragment; uint32_t *dcode; ulong dlen; uint32_t risc_addr, risc_size, risc_attr = 0; ulong i; uint j; struct fw_blob *blob; __be32 *fwcode; struct qla_hw_data *ha = vha->hw; struct req_que *req = ha->req_q_map[0]; struct fwdt *fwdt = ha->fwdt; ql_dbg(ql_dbg_init, vha, 0x0090, "-> FW: Loading via request-firmware.\n"); blob = <API key>(vha); if (!blob) { ql_log(ql_log_warn, vha, 0x0092, "-> Firmware file not found.\n"); return QLA_FUNCTION_FAILED; } fwcode = (__force __be32 *)blob->fw->data; dcode = (__force uint32_t *)fwcode; if (<API key>(dcode)) { ql_log(ql_log_fatal, vha, 0x0093, "Unable to verify integrity of firmware image (%zd).\n", blob->fw->size); ql_log(ql_log_fatal, vha, 0x0095, "Firmware data: %08x %08x %08x %08x.\n", dcode[0], dcode[1], dcode[2], dcode[3]); return QLA_FUNCTION_FAILED; } dcode = (uint32_t *)req->ring; *srisc_addr = 0; segments = <API key>; for (j = 0; j < segments; j++) { ql_dbg(ql_dbg_init, vha, 0x0096, "-> Loading segment %u...\n", j); risc_addr = be32_to_cpu(fwcode[2]); risc_size = be32_to_cpu(fwcode[3]); if (!*srisc_addr) { *srisc_addr = risc_addr; risc_attr = be32_to_cpu(fwcode[9]); } dlen = ha->fw_transfer_size >> 2; for (fragment = 0; risc_size; fragment++) { if (dlen > risc_size) dlen = risc_size; ql_dbg(ql_dbg_init, vha, 0x0097, "-> Loading fragment %u: %#x <- %#x (%#lx words)...\n", fragment, risc_addr, (uint32_t)(fwcode - (typeof(fwcode))blob->fw->data), dlen); for (i = 0; i < dlen; i++) dcode[i] = swab32((__force u32)fwcode[i]); rval = qla2x00_load_ram(vha, req->dma, risc_addr, dlen); if (rval) { ql_log(ql_log_fatal, vha, 0x0098, "-> Failed load firmware fragment %u.\n", fragment); return QLA_FUNCTION_FAILED; } fwcode += dlen; risc_addr += dlen; risc_size -= dlen; } } if (!IS_QLA27XX(ha) && !IS_QLA28XX(ha)) return QLA_SUCCESS; templates = (risc_attr & BIT_9) ? 2 : 1; ql_dbg(ql_dbg_init, vha, 0x0170, "-> templates = %u\n", templates); for (j = 0; j < templates; j++, fwdt++) { vfree(fwdt->template); fwdt->template = NULL; fwdt->length = 0; risc_size = be32_to_cpu(fwcode[2]); ql_dbg(ql_dbg_init, vha, 0x0171, "-> fwdt%u template array at %#x (%#x dwords)\n", j, (uint32_t)((void *)fwcode - (void *)blob->fw->data), risc_size); if (!risc_size || !~risc_size) { ql_dbg(ql_dbg_init, vha, 0x0172, "-> fwdt%u failed to read array\n", j); goto failed; } /* skip header and ignore checksum */ fwcode += 7; risc_size -= 8; ql_dbg(ql_dbg_init, vha, 0x0173, "-> fwdt%u template allocate template %#x words...\n", j, risc_size); fwdt->template = vmalloc(risc_size * sizeof(*dcode)); if (!fwdt->template) { ql_log(ql_log_warn, vha, 0x0174, "-> fwdt%u failed allocate template.\n", j); goto failed; } dcode = fwdt->template; for (i = 0; i < risc_size; i++) dcode[i] = (__force u32)fwcode[i]; if (!<API key>(dcode)) { ql_log(ql_log_warn, vha, 0x0175, "-> fwdt%u failed template validate\n", j); goto failed; } dlen = <API key>(dcode); ql_dbg(ql_dbg_init, vha, 0x0176, "-> fwdt%u template size %#lx bytes (%#lx words)\n", j, dlen, dlen / sizeof(*dcode)); if (dlen > risc_size * sizeof(*dcode)) { ql_log(ql_log_warn, vha, 0x0177, "-> fwdt%u template exceeds array (%-lu bytes)\n", j, dlen - risc_size * sizeof(*dcode)); goto failed; } fwdt->length = dlen; ql_dbg(ql_dbg_init, vha, 0x0178, "-> fwdt%u loaded template ok\n", j); fwcode += risc_size + 1; } return QLA_SUCCESS; failed: vfree(fwdt->template); fwdt->template = NULL; fwdt->length = 0; return QLA_SUCCESS; } int qla24xx_load_risc(scsi_qla_host_t *vha, uint32_t *srisc_addr) { int rval; if (ql2xfwloadbin == 1) return qla81xx_load_risc(vha, srisc_addr); /* * FW Load priority: * 1) Firmware via request-firmware interface (.bin file). * 2) Firmware residing in flash. */ rval = <API key>(vha, srisc_addr); if (rval == QLA_SUCCESS) return rval; return <API key>(vha, srisc_addr, vha->hw->flt_region_fw); } int qla81xx_load_risc(scsi_qla_host_t *vha, uint32_t *srisc_addr) { int rval; struct qla_hw_data *ha = vha->hw; struct active_regions active_regions = { }; if (ql2xfwloadbin == 2) goto try_blob_fw; /* FW Load priority: * 1) Firmware residing in flash. * 2) Firmware via request-firmware interface (.bin file). * 3) Golden-Firmware residing in flash -- (limited operation). */ if (!IS_QLA27XX(ha) && !IS_QLA28XX(ha)) goto try_primary_fw; <API key>(vha, &active_regions); if (active_regions.global != <API key>) goto try_primary_fw; ql_dbg(ql_dbg_init, vha, 0x008b, "Loading secondary firmware image.\n"); rval = <API key>(vha, srisc_addr, ha->flt_region_fw_sec); if (!rval) return rval; try_primary_fw: ql_dbg(ql_dbg_init, vha, 0x008b, "Loading primary firmware image.\n"); rval = <API key>(vha, srisc_addr, ha->flt_region_fw); if (!rval) return rval; try_blob_fw: rval = <API key>(vha, srisc_addr); if (!rval || !ha->flt_region_gold_fw) return rval; ql_log(ql_log_info, vha, 0x0099, "Attempting to fallback to golden firmware.\n"); rval = <API key>(vha, srisc_addr, ha->flt_region_gold_fw); if (rval) return rval; ql_log(ql_log_info, vha, 0x009a, "Need firmware flash update.\n"); ha->flags.running_gold_fw = 1; return rval; } void <API key>(scsi_qla_host_t *vha) { int ret, retries; struct qla_hw_data *ha = vha->hw; if (ha->flags.<API key>) return; if (!IS_FWI2_CAPABLE(ha)) return; if (!ha->fw_major_version) return; if (!ha->flags.fw_started) return; ret = <API key>(vha); for (retries = 5; ret != QLA_SUCCESS && ret != <API key> && ret != QLA_INVALID_COMMAND && retries ; retries ha->isp_ops->reset_chip(vha); if (ha->isp_ops->chip_diag(vha) != QLA_SUCCESS) continue; if (qla2x00_setup_chip(vha) != QLA_SUCCESS) continue; ql_log(ql_log_info, vha, 0x8015, "Attempting retry of stop-firmware command.\n"); ret = <API key>(vha); } QLA_FW_STOPPED(ha); ha->flags.fw_init_done = 0; } int <API key>(scsi_qla_host_t *vha) { int rval = QLA_SUCCESS; int rval2; uint16_t mb[<API key>]; struct qla_hw_data *ha = vha->hw; struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); if (!vha->vp_idx) return -EINVAL; rval = qla2x00_fw_ready(base_vha); if (rval == QLA_SUCCESS) { clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); qla2x00_marker(vha, ha->base_qpair, 0, 0, MK_SYNC_ALL); } vha->flags.<API key> = 0; /* Login to SNS first */ rval2 = ha->isp_ops->fabric_login(vha, NPH_SNS, 0xff, 0xff, 0xfc, mb, BIT_1); if (rval2 != QLA_SUCCESS || mb[0] != <API key>) { if (rval2 == <API key>) ql_dbg(ql_dbg_init, vha, 0x0120, "Failed SNS login: loop_id=%x, rval2=%d\n", NPH_SNS, rval2); else ql_dbg(ql_dbg_init, vha, 0x0103, "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x " "mb[2]=%x mb[6]=%x mb[7]=%x.\n", NPH_SNS, mb[0], mb[1], mb[2], mb[6], mb[7]); return (QLA_FUNCTION_FAILED); } atomic_set(&vha->loop_down_timer, 0); atomic_set(&vha->loop_state, LOOP_UP); set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); rval = qla2x00_loop_resync(base_vha); return rval; } static LIST_HEAD(qla_cs84xx_list); static DEFINE_MUTEX(qla_cs84xx_mutex); static struct qla_chip_state_84xx * qla84xx_get_chip(struct scsi_qla_host *vha) { struct qla_chip_state_84xx *cs84xx; struct qla_hw_data *ha = vha->hw; mutex_lock(&qla_cs84xx_mutex); /* Find any shared 84xx chip. */ list_for_each_entry(cs84xx, &qla_cs84xx_list, list) { if (cs84xx->bus == ha->pdev->bus) { kref_get(&cs84xx->kref); goto done; } } cs84xx = kzalloc(sizeof(*cs84xx), GFP_KERNEL); if (!cs84xx) goto done; kref_init(&cs84xx->kref); spin_lock_init(&cs84xx->access_lock); mutex_init(&cs84xx->fw_update_mutex); cs84xx->bus = ha->pdev->bus; list_add_tail(&cs84xx->list, &qla_cs84xx_list); done: mutex_unlock(&qla_cs84xx_mutex); return cs84xx; } static void <API key>(struct kref *kref) { struct qla_chip_state_84xx *cs84xx = container_of(kref, struct qla_chip_state_84xx, kref); mutex_lock(&qla_cs84xx_mutex); list_del(&cs84xx->list); mutex_unlock(&qla_cs84xx_mutex); kfree(cs84xx); } void qla84xx_put_chip(struct scsi_qla_host *vha) { struct qla_hw_data *ha = vha->hw; if (ha->cs84xx) kref_put(&ha->cs84xx->kref, <API key>); } static int qla84xx_init_chip(scsi_qla_host_t *vha) { int rval; uint16_t status[2]; struct qla_hw_data *ha = vha->hw; mutex_lock(&ha->cs84xx->fw_update_mutex); rval = qla84xx_verify_chip(vha, status); mutex_unlock(&ha->cs84xx->fw_update_mutex); return rval != QLA_SUCCESS || status[0] ? QLA_FUNCTION_FAILED : QLA_SUCCESS; } int <API key>(scsi_qla_host_t *vha) { int rval; struct init_cb_81xx *icb; struct nvram_81xx *nv; __le32 *dptr; uint8_t *dptr1, *dptr2; uint32_t chksum; uint16_t cnt; struct qla_hw_data *ha = vha->hw; uint32_t faddr; struct active_regions active_regions = { }; rval = QLA_SUCCESS; icb = (struct init_cb_81xx *)ha->init_cb; nv = ha->nvram; /* Determine NVRAM starting address. */ ha->nvram_size = sizeof(*nv); ha->vpd_size = FA_NVRAM_VPD_SIZE; if (IS_P3P_TYPE(ha) || IS_QLA8031(ha)) ha->vpd_size = FA_VPD_SIZE_82XX; if (IS_QLA28XX(ha) || IS_QLA27XX(ha)) <API key>(vha, &active_regions); /* Get VPD data into cache */ ha->vpd = ha->nvram + VPD_OFFSET; faddr = ha->flt_region_vpd; if (IS_QLA28XX(ha)) { if (active_regions.aux.vpd_nvram == <API key>) faddr = ha->flt_region_vpd_sec; ql_dbg(ql_dbg_init, vha, 0x0110, "Loading %s nvram image.\n", active_regions.aux.vpd_nvram == <API key> ? "primary" : "secondary"); } ha->isp_ops->read_optrom(vha, ha->vpd, faddr << 2, ha->vpd_size); /* Get NVRAM data into cache and calculate checksum. */ faddr = ha->flt_region_nvram; if (IS_QLA28XX(ha)) { if (active_regions.aux.vpd_nvram == <API key>) faddr = ha-><API key>; } ql_dbg(ql_dbg_init, vha, 0x0110, "Loading %s nvram image.\n", active_regions.aux.vpd_nvram == <API key> ? "primary" : "secondary"); ha->isp_ops->read_optrom(vha, ha->nvram, faddr << 2, ha->nvram_size); dptr = (__force __le32 *)nv; for (cnt = 0, chksum = 0; cnt < ha->nvram_size >> 2; cnt++, dptr++) chksum += le32_to_cpu(*dptr); ql_dbg(ql_dbg_init + ql_dbg_buffer, vha, 0x0111, "Contents of NVRAM:\n"); ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x0112, nv, ha->nvram_size); /* Bad NVRAM data, set defaults parameters. */ if (chksum || memcmp("ISP ", nv->id, sizeof(nv->id)) || le16_to_cpu(nv->nvram_version) < ICB_VERSION) { /* Reset NVRAM data. */ ql_log(ql_log_info, vha, 0x0073, "Inconsistent NVRAM checksum=%#x id=%.4s version=%#x.\n", chksum, nv->id, le16_to_cpu(nv->nvram_version)); ql_dump_buffer(ql_dbg_init, vha, 0x0073, nv, sizeof(*nv)); ql_log(ql_log_info, vha, 0x0074, "Falling back to functioning (yet invalid -- WWPN) " "defaults.\n"); /* * Set default initialization control block. */ memset(nv, 0, ha->nvram_size); nv->nvram_version = cpu_to_le16(ICB_VERSION); nv->version = cpu_to_le16(ICB_VERSION); nv->frame_payload_size = cpu_to_le16(2048); nv->execution_throttle = cpu_to_le16(0xFFFF); nv->exchange_count = cpu_to_le16(0); nv->port_name[0] = 0x21; nv->port_name[1] = 0x00 + ha->port_no + 1; nv->port_name[2] = 0x00; nv->port_name[3] = 0xe0; nv->port_name[4] = 0x8b; nv->port_name[5] = 0x1c; nv->port_name[6] = 0x55; nv->port_name[7] = 0x86; nv->node_name[0] = 0x20; nv->node_name[1] = 0x00; nv->node_name[2] = 0x00; nv->node_name[3] = 0xe0; nv->node_name[4] = 0x8b; nv->node_name[5] = 0x1c; nv->node_name[6] = 0x55; nv->node_name[7] = 0x86; nv->login_retry_count = cpu_to_le16(8); nv-><API key> = cpu_to_le16(0); nv->login_timeout = cpu_to_le16(0); nv->firmware_options_1 = cpu_to_le32(BIT_14|BIT_13|BIT_2|BIT_1); nv->firmware_options_2 = cpu_to_le32(2 << 4); nv->firmware_options_2 |= cpu_to_le32(BIT_12); nv->firmware_options_3 = cpu_to_le32(2 << 13); nv->host_p = cpu_to_le32(BIT_11|BIT_10); nv->efi_parameters = cpu_to_le32(0); nv->reset_delay = 5; nv->max_luns_per_target = cpu_to_le16(128); nv-><API key> = cpu_to_le16(30); nv->link_down_timeout = cpu_to_le16(180); nv->enode_mac[0] = 0x00; nv->enode_mac[1] = 0xC0; nv->enode_mac[2] = 0xDD; nv->enode_mac[3] = 0x04; nv->enode_mac[4] = 0x05; nv->enode_mac[5] = 0x06 + ha->port_no + 1; rval = 1; } if (IS_T10_PI_CAPABLE(ha)) nv->frame_payload_size &= cpu_to_le16(~7); <API key>(vha, nv); /* Reset Initialization control block */ memset(icb, 0, ha->init_cb_size); /* Copy 1st segment. */ dptr1 = (uint8_t *)icb; dptr2 = (uint8_t *)&nv->version; cnt = (uint8_t *)&icb-><API key> - (uint8_t *)&icb->version; while (cnt *dptr1++ = *dptr2++; icb->login_retry_count = nv->login_retry_count; /* Copy 2nd segment. */ dptr1 = (uint8_t *)&icb-><API key>; dptr2 = (uint8_t *)&nv-><API key>; cnt = (uint8_t *)&icb->reserved_5 - (uint8_t *)&icb-><API key>; while (cnt *dptr1++ = *dptr2++; memcpy(icb->enode_mac, nv->enode_mac, sizeof(icb->enode_mac)); /* Some boards (with valid NVRAMs) still have NULL enode_mac!! */ if (!memcmp(icb->enode_mac, "\0\0\0\0\0\0", sizeof(icb->enode_mac))) { icb->enode_mac[0] = 0x00; icb->enode_mac[1] = 0xC0; icb->enode_mac[2] = 0xDD; icb->enode_mac[3] = 0x04; icb->enode_mac[4] = 0x05; icb->enode_mac[5] = 0x06 + ha->port_no + 1; } /* Use <API key> control block. */ memcpy(ha->ex_init_cb, &nv->ex_version, sizeof(*ha->ex_init_cb)); ha->frame_payload_size = le16_to_cpu(icb->frame_payload_size); /* * Setup driver NVRAM options. */ <API key>(vha, nv->model_name, sizeof(nv->model_name), "QLE8XXX"); <API key>(vha, icb); /* Use alternate WWN? */ if (nv->host_p & cpu_to_le32(BIT_15)) { memcpy(icb->node_name, nv->alternate_node_name, WWN_SIZE); memcpy(icb->port_name, nv->alternate_port_name, WWN_SIZE); } /* Prepare nodename */ if ((icb->firmware_options_1 & cpu_to_le32(BIT_14)) == 0) { /* * Firmware will apply the following mask if the nodename was * not provided. */ memcpy(icb->node_name, icb->port_name, WWN_SIZE); icb->node_name[0] &= 0xF0; } if (IS_QLA28XX(ha) || IS_QLA27XX(ha)) { if ((nv->enhanced_features & BIT_7) == 0) ha->flags.scm_supported_a = 1; } /* Set host adapter parameters. */ ha->flags.<API key> = 0; ha->flags.enable_lip_reset = 0; ha->flags.<API key> = le32_to_cpu(nv->host_p) & BIT_10 ? 1 : 0; ha->flags.enable_target_reset = le32_to_cpu(nv->host_p) & BIT_11 ? 1 : 0; ha->flags.enable_led_scheme = 0; ha->flags.disable_serdes = le32_to_cpu(nv->host_p) & BIT_5 ? 1 : 0; ha->operating_mode = (le32_to_cpu(icb->firmware_options_2) & (BIT_6 | BIT_5 | BIT_4)) >> 4; /* save HBA serial number */ ha->serial0 = icb->port_name[5]; ha->serial1 = icb->port_name[6]; ha->serial2 = icb->port_name[7]; memcpy(vha->node_name, icb->node_name, WWN_SIZE); memcpy(vha->port_name, icb->port_name, WWN_SIZE); icb->execution_throttle = cpu_to_le16(0xFFFF); ha->retry_count = le16_to_cpu(nv->login_retry_count); /* Set minimum login_timeout to 4 seconds. */ if (le16_to_cpu(nv->login_timeout) < ql2xlogintimeout) nv->login_timeout = cpu_to_le16(ql2xlogintimeout); if (le16_to_cpu(nv->login_timeout) < 4) nv->login_timeout = cpu_to_le16(4); ha->login_timeout = le16_to_cpu(nv->login_timeout); /* Set minimum RATOV to 100 tenths of a second. */ ha->r_a_tov = 100; ha->loop_reset_delay = nv->reset_delay; /* Link Down Timeout = 0: * * When Port Down timer expires we will start returning * I/O's to OS with "DID_NO_CONNECT". * * Link Down Timeout != 0: * * The driver waits for the link to come up after link down * before returning I/Os to OS with "DID_NO_CONNECT". */ if (le16_to_cpu(nv->link_down_timeout) == 0) { ha-><API key> = (LOOP_DOWN_TIME - LOOP_DOWN_TIMEOUT); } else { ha->link_down_timeout = le16_to_cpu(nv->link_down_timeout); ha-><API key> = (LOOP_DOWN_TIME - ha->link_down_timeout); } /* Need enough time to try and get the port back. */ ha-><API key> = le16_to_cpu(nv-><API key>); if (qlport_down_retry) ha-><API key> = qlport_down_retry; /* Set login_retry_count */ ha->login_retry_count = le16_to_cpu(nv->login_retry_count); if (ha-><API key> == le16_to_cpu(nv-><API key>) && ha-><API key> > 3) ha->login_retry_count = ha-><API key>; else if (ha-><API key> > (int)ha->login_retry_count) ha->login_retry_count = ha-><API key>; if (ql2xloginretrycount) ha->login_retry_count = ql2xloginretrycount; /* if not running MSI-X we need handshaking on interrupts */ if (!vha->hw->flags.msix_enabled && (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha))) icb->firmware_options_2 |= cpu_to_le32(BIT_22); /* Enable ZIO. */ if (!vha->flags.init_done) { ha->zio_mode = le32_to_cpu(icb->firmware_options_2) & (BIT_3 | BIT_2 | BIT_1 | BIT_0); ha->zio_timer = le16_to_cpu(icb-><API key>) ? le16_to_cpu(icb-><API key>) : 2; } icb->firmware_options_2 &= cpu_to_le32( ~(BIT_3 | BIT_2 | BIT_1 | BIT_0)); vha->flags.<API key> = 0; if (ha->zio_mode != QLA_ZIO_DISABLED) { ha->zio_mode = QLA_ZIO_MODE_6; ql_log(ql_log_info, vha, 0x0075, "ZIO mode %d enabled; timer delay (%d us).\n", ha->zio_mode, ha->zio_timer * 100); icb->firmware_options_2 |= cpu_to_le32( (uint32_t)ha->zio_mode); icb-><API key> = cpu_to_le16(ha->zio_timer); vha->flags.<API key> = 1; } /* enable RIDA Format2 */ icb->firmware_options_3 |= cpu_to_le32(BIT_0); /* N2N: driver will initiate Login instead of FW */ icb->firmware_options_3 |= cpu_to_le32(BIT_8); /* Determine NVMe/FCP priority for target ports */ ha->fc4_type_priority = <API key>(vha); if (rval) { ql_log(ql_log_warn, vha, 0x0076, "NVRAM configuration failed.\n"); } return (rval); } int qla82xx_restart_isp(scsi_qla_host_t *vha) { int status, rval; struct qla_hw_data *ha = vha->hw; struct scsi_qla_host *vp; unsigned long flags; status = qla2x00_init_rings(vha); if (!status) { clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); ha->flags.chip_reset_done = 1; status = qla2x00_fw_ready(vha); if (!status) { /* Issue a marker after FW becomes ready. */ qla2x00_marker(vha, ha->base_qpair, 0, 0, MK_SYNC_ALL); vha->flags.online = 1; set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); } /* if no cable then assume it's good */ if ((vha->device_flags & DFLG_NO_CABLE)) status = 0; } if (!status) { clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); if (!atomic_read(&vha->loop_down_timer)) { /* * Issue marker command only when we are going * to start the I/O . */ vha->marker_needed = 1; } ha->isp_ops->enable_intrs(ha); ha->isp_abort_cnt = 0; clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); /* Update the firmware version */ status = <API key>(vha); if (ha->fce) { ha->flags.fce_enabled = 1; memset(ha->fce, 0, fce_calc_size(ha->fce_bufs)); rval = <API key>(vha, ha->fce_dma, ha->fce_bufs, ha->fce_mb, &ha->fce_bufs); if (rval) { ql_log(ql_log_warn, vha, 0x8001, "Unable to reinitialize FCE (%d).\n", rval); ha->flags.fce_enabled = 0; } } if (ha->eft) { memset(ha->eft, 0, EFT_SIZE); rval = <API key>(vha, ha->eft_dma, EFT_NUM_BUFFERS); if (rval) { ql_log(ql_log_warn, vha, 0x8010, "Unable to reinitialize EFT (%d).\n", rval); } } } if (!status) { ql_dbg(ql_dbg_taskm, vha, 0x8011, "qla82xx_restart_isp succeeded.\n"); spin_lock_irqsave(&ha->vport_slock, flags); list_for_each_entry(vp, &ha->vp_list, list) { if (vp->vp_idx) { atomic_inc(&vp->vref_count); <API key>(&ha->vport_slock, flags); <API key>(vp); spin_lock_irqsave(&ha->vport_slock, flags); atomic_dec(&vp->vref_count); } } <API key>(&ha->vport_slock, flags); } else { ql_log(ql_log_warn, vha, 0x8016, "qla82xx_restart_isp **** FAILED ****.\n"); } return status; } /* * <API key> * Gets the fcp cmd priority value for the logged in port. * Looks for a match of the port descriptors within * each of the fcp prio config entries. If a match is found, * the tag (priority) value is returned. * * Input: * vha = scsi host structure pointer. * fcport = port structure pointer. * * Return: * non-zero (if found) * -1 (if not found) * * Context: * Kernel context */ static int <API key>(scsi_qla_host_t *vha, fc_port_t *fcport) { int i, entries; uint8_t pid_match, wwn_match; int priority; uint32_t pid1, pid2; uint64_t wwn1, wwn2; struct qla_fcp_prio_entry *pri_entry; struct qla_hw_data *ha = vha->hw; if (!ha->fcp_prio_cfg || !ha->flags.fcp_prio_enabled) return -1; priority = -1; entries = ha->fcp_prio_cfg->num_entries; pri_entry = &ha->fcp_prio_cfg->entry[0]; for (i = 0; i < entries; i++) { pid_match = wwn_match = 0; if (!(pri_entry->flags & <API key>)) { pri_entry++; continue; } /* check source pid for a match */ if (pri_entry->flags & <API key>) { pid1 = pri_entry->src_pid & INVALID_PORT_ID; pid2 = vha->d_id.b24 & INVALID_PORT_ID; if (pid1 == INVALID_PORT_ID) pid_match++; else if (pid1 == pid2) pid_match++; } /* check destination pid for a match */ if (pri_entry->flags & <API key>) { pid1 = pri_entry->dst_pid & INVALID_PORT_ID; pid2 = fcport->d_id.b24 & INVALID_PORT_ID; if (pid1 == INVALID_PORT_ID) pid_match++; else if (pid1 == pid2) pid_match++; } /* check source WWN for a match */ if (pri_entry->flags & <API key>) { wwn1 = wwn_to_u64(vha->port_name); wwn2 = wwn_to_u64(pri_entry->src_wwpn); if (wwn2 == (uint64_t)-1) wwn_match++; else if (wwn1 == wwn2) wwn_match++; } /* check destination WWN for a match */ if (pri_entry->flags & <API key>) { wwn1 = wwn_to_u64(fcport->port_name); wwn2 = wwn_to_u64(pri_entry->dst_wwpn); if (wwn2 == (uint64_t)-1) wwn_match++; else if (wwn1 == wwn2) wwn_match++; } if (pid_match == 2 || wwn_match == 2) { /* Found a matching entry */ if (pri_entry->flags & <API key>) priority = pri_entry->tag; break; } pri_entry++; } return priority; } /* * <API key> * Activates fcp priority for the logged in fc port * * Input: * vha = scsi host structure pointer. * fcp = port structure pointer. * * Return: * QLA_SUCCESS or QLA_FUNCTION_FAILED * * Context: * Kernel context. */ int <API key>(scsi_qla_host_t *vha, fc_port_t *fcport) { int ret; int priority; uint16_t mb[5]; if (fcport->port_type != FCT_TARGET || fcport->loop_id == FC_NO_LOOP_ID) return QLA_FUNCTION_FAILED; priority = <API key>(vha, fcport); if (priority < 0) return QLA_FUNCTION_FAILED; if (IS_P3P_TYPE(vha->hw)) { fcport->fcp_prio = priority & 0xf; return QLA_SUCCESS; } ret = <API key>(vha, fcport->loop_id, priority, mb); if (ret == QLA_SUCCESS) { if (fcport->fcp_prio != priority) ql_dbg(ql_dbg_user, vha, 0x709e, "Updated FCP_CMND priority - value=%d loop_id=%d " "port_id=%02x%02x%02x.\n", priority, fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa); fcport->fcp_prio = priority & 0xf; } else ql_dbg(ql_dbg_user, vha, 0x704f, "Unable to update FCP_CMND priority - ret=0x%x for " "loop_id=%d port_id=%02x%02x%02x.\n", ret, fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa); return ret; } /* * <API key> * Activates fcp priority for all the logged in ports * * Input: * ha = adapter block pointer. * * Return: * QLA_SUCCESS or QLA_FUNCTION_FAILED * * Context: * Kernel context. */ int <API key>(scsi_qla_host_t *vha) { int ret; fc_port_t *fcport; ret = QLA_FUNCTION_FAILED; /* We need to set priority for all logged in ports */ list_for_each_entry(fcport, &vha->vp_fcports, list) ret = <API key>(vha, fcport); return ret; } struct qla_qpair *<API key>(struct scsi_qla_host *vha, int qos, int vp_idx, bool startqp) { int rsp_id = 0; int req_id = 0; int i; struct qla_hw_data *ha = vha->hw; uint16_t qpair_id = 0; struct qla_qpair *qpair = NULL; struct qla_msix_entry *msix; if (!(ha->fw_attributes & BIT_6) || !ha->flags.msix_enabled) { ql_log(ql_log_warn, vha, 0x00181, "FW/Driver is not multi-queue capable.\n"); return NULL; } if (ql2xmqsupport || ql2xnvmeenable) { qpair = kzalloc(sizeof(struct qla_qpair), GFP_KERNEL); if (qpair == NULL) { ql_log(ql_log_warn, vha, 0x0182, "Failed to allocate memory for queue pair.\n"); return NULL; } qpair->hw = vha->hw; qpair->vha = vha; qpair->qp_lock_ptr = &qpair->qp_lock; spin_lock_init(&qpair->qp_lock); qpair->use_shadow_reg = <API key>(ha) ? 1 : 0; /* Assign available que pair id */ mutex_lock(&ha->mq_lock); qpair_id = find_first_zero_bit(ha->qpair_qid_map, ha->max_qpairs); if (ha->num_qpairs >= ha->max_qpairs) { mutex_unlock(&ha->mq_lock); ql_log(ql_log_warn, vha, 0x0183, "No resources to create additional q pair.\n"); goto fail_qid_map; } ha->num_qpairs++; set_bit(qpair_id, ha->qpair_qid_map); ha->queue_pair_map[qpair_id] = qpair; qpair->id = qpair_id; qpair->vp_idx = vp_idx; qpair->fw_started = ha->flags.fw_started; INIT_LIST_HEAD(&qpair->hints_list); qpair->chip_reset = ha->base_qpair->chip_reset; qpair->enable_class_2 = ha->base_qpair->enable_class_2; qpair-><API key> = ha->base_qpair-><API key>; for (i = 0; i < ha->msix_count; i++) { msix = &ha->msix_entries[i]; if (msix->in_use) continue; qpair->msix = msix; ql_dbg(ql_dbg_multiq, vha, 0xc00f, "Vector %x selected for qpair\n", msix->vector); break; } if (!qpair->msix) { ql_log(ql_log_warn, vha, 0x0184, "Out of MSI-X vectors!.\n"); goto fail_msix; } qpair->msix->in_use = 1; list_add_tail(&qpair->qp_list_elem, &vha->qp_list); qpair->pdev = ha->pdev; if (IS_QLA27XX(ha) || IS_QLA83XX(ha) || IS_QLA28XX(ha)) qpair->reqq_start_iocbs = <API key>; mutex_unlock(&ha->mq_lock); /* Create response queue first */ rsp_id = <API key>(ha, 0, 0, 0, qpair, startqp); if (!rsp_id) { ql_log(ql_log_warn, vha, 0x0185, "Failed to create response queue.\n"); goto fail_rsp; } qpair->rsp = ha->rsp_q_map[rsp_id]; /* Create request queue */ req_id = <API key>(ha, 0, vp_idx, 0, rsp_id, qos, startqp); if (!req_id) { ql_log(ql_log_warn, vha, 0x0186, "Failed to create request queue.\n"); goto fail_req; } qpair->req = ha->req_q_map[req_id]; qpair->rsp->req = qpair->req; qpair->rsp->qpair = qpair; /* init qpair to this cpu. Will adjust at run time. */ qla_cpu_update(qpair, smp_processor_id()); if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) { if (ha->fw_attributes & BIT_4) qpair->difdix_supported = 1; } qpair->srb_mempool = <API key>(SRB_MIN_REQ, srb_cachep); if (!qpair->srb_mempool) { ql_log(ql_log_warn, vha, 0xd036, "Failed to create srb mempool for qpair %d\n", qpair->id); goto fail_mempool; } /* Mark as online */ qpair->online = 1; if (!vha->flags.qpairs_available) vha->flags.qpairs_available = 1; ql_dbg(ql_dbg_multiq, vha, 0xc00d, "Request/Response queue pair created, id %d\n", qpair->id); ql_dbg(ql_dbg_init, vha, 0x0187, "Request/Response queue pair created, id %d\n", qpair->id); } return qpair; fail_mempool: fail_req: <API key>(vha, qpair->rsp); fail_rsp: mutex_lock(&ha->mq_lock); qpair->msix->in_use = 0; list_del(&qpair->qp_list_elem); if (list_empty(&vha->qp_list)) vha->flags.qpairs_available = 0; fail_msix: ha->queue_pair_map[qpair_id] = NULL; clear_bit(qpair_id, ha->qpair_qid_map); ha->num_qpairs mutex_unlock(&ha->mq_lock); fail_qid_map: kfree(qpair); return NULL; } int <API key>(struct scsi_qla_host *vha, struct qla_qpair *qpair) { int ret = QLA_FUNCTION_FAILED; struct qla_hw_data *ha = qpair->hw; qpair->delete_in_progress = 1; ret = <API key>(vha, qpair->req); if (ret != QLA_SUCCESS) goto fail; ret = <API key>(vha, qpair->rsp); if (ret != QLA_SUCCESS) goto fail; mutex_lock(&ha->mq_lock); ha->queue_pair_map[qpair->id] = NULL; clear_bit(qpair->id, ha->qpair_qid_map); ha->num_qpairs list_del(&qpair->qp_list_elem); if (list_empty(&vha->qp_list)) { vha->flags.qpairs_available = 0; vha->flags.qpairs_req_created = 0; vha->flags.qpairs_rsp_created = 0; } mempool_destroy(qpair->srb_mempool); kfree(qpair); mutex_unlock(&ha->mq_lock); return QLA_SUCCESS; fail: return ret; } uint64_t <API key>(uint32_t num) { /* Brian Kernighan's Algorithm */ u64 count = 0; while (num) { num &= (num - 1); count++; } return count; } uint64_t <API key>(scsi_qla_host_t *vha) { fc_port_t *f, *tf; u64 count = 0; f = NULL; tf = NULL; <API key>(f, tf, &vha->vp_fcports, list) { if (f->port_type != FCT_TARGET) continue; count++; } return count; } int qla2xxx_reset_stats(struct Scsi_Host *host, u32 flags) { scsi_qla_host_t *vha = shost_priv(host); fc_port_t *fcport = NULL; unsigned long int_flags; if (flags & QLA2XX_HW_ERROR) vha->hw_err_cnt = 0; if (flags & QLA2XX_SHT_LNK_DWN) vha->short_link_down_cnt = 0; if (flags & QLA2XX_INT_ERR) vha->interface_err_cnt = 0; if (flags & QLA2XX_CMD_TIMEOUT) vha->cmd_timeout_cnt = 0; if (flags & <API key>) vha->reset_cmd_err_cnt = 0; if (flags & <API key>) { spin_lock_irqsave(&vha->hw->tgt.sess_lock, int_flags); list_for_each_entry(fcport, &vha->vp_fcports, list) { fcport-><API key> = 0; fcport->tgt_link_down_time = <API key>; } <API key>(&vha->hw->tgt.sess_lock, int_flags); } vha->link_down_time = <API key>; return 0; } int qla2xxx_start_stats(struct Scsi_Host *host, u32 flags) { return qla2xxx_reset_stats(host, flags); } int qla2xxx_stop_stats(struct Scsi_Host *host, u32 flags) { return qla2xxx_reset_stats(host, flags); } int <API key>(struct Scsi_Host *host, u32 flags, void *data, u64 size) { scsi_qla_host_t *vha = shost_priv(host); struct <API key> *resp = (struct <API key> *)data; struct ql_vnd_stats *rsp_data = &resp->stats; u64 ini_entry_count = 0; u64 i = 0; u64 entry_count = 0; u64 num_tgt = 0; u32 tmp_stat_type = 0; fc_port_t *fcport = NULL; unsigned long int_flags; /* Copy stat type to work on it */ tmp_stat_type = flags; if (tmp_stat_type & BIT_17) { num_tgt = <API key>(vha); /* unset BIT_17 */ tmp_stat_type &= ~(1 << 17); } ini_entry_count = <API key>(tmp_stat_type); entry_count = ini_entry_count + num_tgt; rsp_data->entry_count = entry_count; i = 0; if (flags & QLA2XX_HW_ERROR) { rsp_data->entry[i].stat_type = QLA2XX_HW_ERROR; rsp_data->entry[i].tgt_num = 0x0; rsp_data->entry[i].cnt = vha->hw_err_cnt; i++; } if (flags & QLA2XX_SHT_LNK_DWN) { rsp_data->entry[i].stat_type = QLA2XX_SHT_LNK_DWN; rsp_data->entry[i].tgt_num = 0x0; rsp_data->entry[i].cnt = vha->short_link_down_cnt; i++; } if (flags & QLA2XX_INT_ERR) { rsp_data->entry[i].stat_type = QLA2XX_INT_ERR; rsp_data->entry[i].tgt_num = 0x0; rsp_data->entry[i].cnt = vha->interface_err_cnt; i++; } if (flags & QLA2XX_CMD_TIMEOUT) { rsp_data->entry[i].stat_type = QLA2XX_CMD_TIMEOUT; rsp_data->entry[i].tgt_num = 0x0; rsp_data->entry[i].cnt = vha->cmd_timeout_cnt; i++; } if (flags & <API key>) { rsp_data->entry[i].stat_type = <API key>; rsp_data->entry[i].tgt_num = 0x0; rsp_data->entry[i].cnt = vha->reset_cmd_err_cnt; i++; } /* i will continue from previous loop, as target * entries are after initiator */ if (flags & <API key>) { spin_lock_irqsave(&vha->hw->tgt.sess_lock, int_flags); list_for_each_entry(fcport, &vha->vp_fcports, list) { if (fcport->port_type != FCT_TARGET) continue; if (!fcport->rport) continue; rsp_data->entry[i].stat_type = <API key>; rsp_data->entry[i].tgt_num = fcport->rport->number; rsp_data->entry[i].cnt = fcport-><API key>; i++; } <API key>(&vha->hw->tgt.sess_lock, int_flags); } resp->status = EXT_STATUS_OK; return 0; } int <API key>(struct Scsi_Host *host, u32 flags, struct fc_rport *rport, void *data, u64 size) { struct <API key> *tgt_data = data; fc_port_t *fcport = *(fc_port_t **)rport->dd_data; tgt_data->status = 0; tgt_data->stats.entry_count = 1; tgt_data->stats.entry[0].stat_type = flags; tgt_data->stats.entry[0].tgt_num = rport->number; tgt_data->stats.entry[0].cnt = fcport-><API key>; return 0; } int <API key>(struct Scsi_Host *host) { scsi_qla_host_t *vha = shost_priv(host); vha->hw->flags.port_isolated = 1; if (<API key>(vha)) return 0; if (vha->flags.online) { <API key>(vha); <API key>(vha); } return 0; } int qla2xxx_enable_port(struct Scsi_Host *host) { scsi_qla_host_t *vha = shost_priv(host); vha->hw->flags.port_isolated = 0; /* Set the flag to 1, so that isp_abort can proceed */ vha->flags.online = 1; set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); qla2xxx_wake_dpc(vha); return 0; }
<?php if (!defined('W3TC')) die(); ?> <?php $this->checkbox('minify.html.strip.crlf', false, 'html_') ?> Line break removal</label><br />
package com.sun.media.sound; /** * This class is used to identify destinations in connection blocks, * see <API key>. * * @author Karl Helgason */ public final class ModelDestination { public static final ModelIdentifier DESTINATION_NONE = null; public static final ModelIdentifier <API key> = new ModelIdentifier("noteon", "keynumber"); public static final ModelIdentifier <API key> = new ModelIdentifier("noteon", "velocity"); public static final ModelIdentifier DESTINATION_PITCH = new ModelIdentifier("osc", "pitch"); // cent public static final ModelIdentifier DESTINATION_GAIN = new ModelIdentifier("mixer", "gain"); public static final ModelIdentifier DESTINATION_PAN = new ModelIdentifier("mixer", "pan"); public static final ModelIdentifier DESTINATION_REVERB = new ModelIdentifier("mixer", "reverb"); public static final ModelIdentifier DESTINATION_CHORUS = new ModelIdentifier("mixer", "chorus"); public static final ModelIdentifier <API key> = new ModelIdentifier("lfo", "delay", 0); // timecent public static final ModelIdentifier <API key> = new ModelIdentifier("lfo", "freq", 0); // cent public static final ModelIdentifier <API key> = new ModelIdentifier("lfo", "delay", 1); // timecent public static final ModelIdentifier <API key> = new ModelIdentifier("lfo", "freq", 1); // cent public static final ModelIdentifier <API key> = new ModelIdentifier("eg", "delay", 0); // timecent public static final ModelIdentifier <API key> = new ModelIdentifier("eg", "attack", 0); // timecent public static final ModelIdentifier <API key> = new ModelIdentifier("eg", "hold", 0); // timecent public static final ModelIdentifier <API key> = new ModelIdentifier("eg", "decay", 0); // timecent public static final ModelIdentifier <API key> = new ModelIdentifier("eg", "sustain", 0); // 0.1 % (I want this to be value not %) public static final ModelIdentifier <API key> = new ModelIdentifier("eg", "release", 0); // timecent public static final ModelIdentifier <API key> = new ModelIdentifier("eg", "shutdown", 0); // timecent public static final ModelIdentifier <API key> = new ModelIdentifier("eg", "delay", 1); // timecent public static final ModelIdentifier <API key> = new ModelIdentifier("eg", "attack", 1); // timecent public static final ModelIdentifier <API key> = new ModelIdentifier("eg", "hold", 1); public static final ModelIdentifier <API key> = new ModelIdentifier("eg", "decay", 1); // timecent public static final ModelIdentifier <API key> = new ModelIdentifier("eg", "sustain", 1); // 0.1 % ( I want this to be value not %) public static final ModelIdentifier <API key> = new ModelIdentifier("eg", "release", 1); // timecent public static final ModelIdentifier <API key> = new ModelIdentifier("eg", "shutdown", 1); // timecent public static final ModelIdentifier <API key> = new ModelIdentifier("filter", "freq", 0); // cent public static final ModelIdentifier <API key> = new ModelIdentifier("filter", "q", 0); private ModelIdentifier destination = DESTINATION_NONE; private ModelTransform transform = new <API key>(); public ModelDestination() { } public ModelDestination(ModelIdentifier id) { destination = id; } public ModelIdentifier getIdentifier() { return destination; } public void setIdentifier(ModelIdentifier destination) { this.destination = destination; } public ModelTransform getTransform() { return transform; } public void setTransform(ModelTransform transform) { this.transform = transform; } }
#ifndef linearDirection_H #define linearDirection_H #include "point.H" #include "extrudeModel.H" namespace Foam { namespace extrudeModels { class linearDirection : public extrudeModel { // Private data //- Extrude direction vector direction_; //- Layer thickness scalar thickness_; public: //- Runtime type information TypeName("linearDirection"); // Constructors //- Construct from dictionary linearDirection(const dictionary& dict); //- Destructor virtual ~linearDirection(); // Member Operators point operator() ( const point& surfacePoint, const vector& surfaceNormal, const label layer ) const; }; } // End namespace extrudeModels } // End namespace Foam #endif
YUI.add('event-valuechange', function(Y) { /** Adds a synthetic `valueChange` event that fires when the `value` property of an `<input>` or `<textarea>` node changes as a result of a keystroke, mouse operation, or input method editor (IME) input event. Usage: YUI().use('event-valuechange', function (Y) { Y.one('#my-input').on('valueChange', function (e) { }); }); @module event-valuechange **/ /** Provides the implementation for the synthetic `valueChange` event. This class isn't meant to be used directly, but is public to make monkeypatching possible. Usage: YUI().use('event-valuechange', function (Y) { Y.one('#my-input').on('valueChange', function (e) { }); }); @class ValueChange @static */ var DATA_KEY = '_valuechange', VALUE = 'value', config, // defined at the end of this file // Just a simple namespace to make methods overridable. VC = { /** Interval (in milliseconds) at which to poll for changes to the value of an element with one or more `valueChange` subscribers when the user is likely to be interacting with it. @property POLL_INTERVAL @type Number @default 50 @static **/ POLL_INTERVAL: 50, /** Timeout (in milliseconds) after which to stop polling when there hasn't been any new activity (keypresses, mouse clicks, etc.) on an element. @property TIMEOUT @type Number @default 10000 @static **/ TIMEOUT: 10000, /** Called at an interval to poll for changes to the value of the specified node. @method _poll @param {Node} node Node to poll. @param {Object} options Options object. @param {EventFacade} [options.e] Event facade of the event that initiated the polling. @protected @static **/ _poll: function (node, options) { var domNode = node._node, // performance cheat; getValue() is a big hit when polling event = options.e, newVal = domNode && domNode.value, vcData = node._data && node._data[DATA_KEY], // another perf cheat facade, prevVal; if (!domNode || !vcData) { VC._stopPolling(node); return; } prevVal = vcData.prevVal; if (newVal !== prevVal) { vcData.prevVal = newVal; facade = { _event : event, currentTarget: (event && event.currentTarget) || node, newVal : newVal, prevVal : prevVal, target : (event && event.target) || node }; Y.Object.each(vcData.notifiers, function (notifier) { notifier.fire(facade); }); VC._refreshTimeout(node); } }, /** Restarts the inactivity timeout for the specified node. @method _refreshTimeout @param {Node} node Node to refresh. @param {SyntheticEvent.Notifier} notifier @protected @static **/ _refreshTimeout: function (node, notifier) { // The node may have been destroyed, so check that it still exists // before trying to get its data. Otherwise an error will occur. if (!node._node) { return; } var vcData = node.getData(DATA_KEY); VC._stopTimeout(node); // avoid dupes // If we don't see any changes within the timeout period (10 seconds by // default), stop polling. vcData.timeout = setTimeout(function () { VC._stopPolling(node, notifier); }, VC.TIMEOUT); }, /** Begins polling for changes to the `value` property of the specified node. If polling is already underway for the specified node, it will not be restarted unless the `force` option is `true` @method _startPolling @param {Node} node Node to watch. @param {SyntheticEvent.Notifier} notifier @param {Object} options Options object. @param {EventFacade} [options.e] Event facade of the event that initiated the polling. @param {Boolean} [options.force=false] If `true`, polling will be restarted even if we're already polling this node. @protected @static **/ _startPolling: function (node, notifier, options) { if (!node.test('input,textarea')) { return; } var vcData = node.getData(DATA_KEY); if (!vcData) { vcData = {prevVal: node.get(VALUE)}; node.setData(DATA_KEY, vcData); } vcData.notifiers || (vcData.notifiers = {}); // Don't bother continuing if we're already polling this node, unless // `options.force` is true. if (vcData.interval) { if (options.force) { VC._stopPolling(node, notifier); // restart polling, but avoid dupe polls } else { vcData.notifiers[Y.stamp(notifier)] = notifier; return; } } // Poll for changes to the node's value. We can't rely on keyboard // events for this, since the value may change due to a mouse-initiated // paste event, an IME input event, or for some other reason that // doesn't trigger a key event. vcData.notifiers[Y.stamp(notifier)] = notifier; vcData.interval = setInterval(function () { VC._poll(node, vcData, options); }, VC.POLL_INTERVAL); VC._refreshTimeout(node, notifier); }, /** Stops polling for changes to the specified node's `value` attribute. @method _stopPolling @param {Node} node Node to stop polling on. @param {SyntheticEvent.Notifier} [notifier] Notifier to remove from the node. If not specified, all notifiers will be removed. @protected @static **/ _stopPolling: function (node, notifier) { // The node may have been destroyed, so check that it still exists // before trying to get its data. Otherwise an error will occur. if (!node._node) { return; } var vcData = node.getData(DATA_KEY) || {}; clearInterval(vcData.interval); delete vcData.interval; VC._stopTimeout(node); if (notifier) { vcData.notifiers && delete vcData.notifiers[Y.stamp(notifier)]; } else { vcData.notifiers = {}; } }, /** Clears the inactivity timeout for the specified node, if any. @method _stopTimeout @param {Node} node @protected @static **/ _stopTimeout: function (node) { var vcData = node.getData(DATA_KEY) || {}; clearTimeout(vcData.timeout); delete vcData.timeout; }, /** Stops polling when a node's blur event fires. @method _onBlur @param {EventFacade} e @param {SyntheticEvent.Notifier} notifier @protected @static **/ _onBlur: function (e, notifier) { VC._stopPolling(e.currentTarget, notifier); }, /** Resets a node's history and starts polling when a focus event occurs. @method _onFocus @param {EventFacade} e @param {SyntheticEvent.Notifier} notifier @protected @static **/ _onFocus: function (e, notifier) { var node = e.currentTarget, vcData = node.getData(DATA_KEY); if (!vcData) { vcData = {}; node.setData(DATA_KEY, vcData); } vcData.prevVal = node.get(VALUE); VC._startPolling(node, notifier, {e: e}); }, /** Starts polling when a node receives a keyDown event. @method _onKeyDown @param {EventFacade} e @param {SyntheticEvent.Notifier} notifier @protected @static **/ _onKeyDown: function (e, notifier) { VC._startPolling(e.currentTarget, notifier, {e: e}); }, /** Starts polling when an IME-related keyUp event occurs on a node. @method _onKeyUp @param {EventFacade} e @param {SyntheticEvent.Notifier} notifier @protected @static **/ _onKeyUp: function (e, notifier) { // These charCodes indicate that an IME has started. We'll restart // polling and give the IME up to 10 seconds (by default) to finish. if (e.charCode === 229 || e.charCode === 197) { VC._startPolling(e.currentTarget, notifier, { e : e, force: true }); } }, /** Starts polling when a node receives a mouseDown event. @method _onMouseDown @param {EventFacade} e @param {SyntheticEvent.Notifier} notifier @protected @static **/ _onMouseDown: function (e, notifier) { VC._startPolling(e.currentTarget, notifier, {e: e}); }, /** Called when the `valuechange` event receives a new subscriber. @method _onSubscribe @param {Node} node @param {Subscription} sub @param {SyntheticEvent.Notifier} notifier @param {Function|String} [filter] Filter function or selector string. Only provided for delegate subscriptions. @protected @static **/ _onSubscribe: function (node, sub, notifier, filter) { var _valuechange, callbacks, nodes; callbacks = { blur : VC._onBlur, focus : VC._onFocus, keydown : VC._onKeyDown, keyup : VC._onKeyUp, mousedown: VC._onMouseDown }; // Store a utility object on the notifier to hold stuff that needs to be // passed around to trigger event handlers, polling handlers, etc. _valuechange = notifier._valuechange = {}; if (filter) { // If a filter is provided, then this is a delegated subscription. _valuechange.delegated = true; // Add a function to the notifier that we can use to find all // nodes that pass the delegate filter. _valuechange.getNodes = function () { return node.all('input,textarea').filter(filter); }; // Store the initial values for each descendant of the container // node that passes the delegate filter. _valuechange.getNodes().each(function (child) { if (!child.getData(DATA_KEY)) { child.setData(DATA_KEY, {prevVal: child.get(VALUE)}); } }); notifier._handles = Y.delegate(callbacks, node, filter, null, notifier); } else { // This is a normal (non-delegated) event subscription. if (!node.test('input,textarea')) { return; } if (!node.getData(DATA_KEY)) { node.setData(DATA_KEY, {prevVal: node.get(VALUE)}); } notifier._handles = node.on(callbacks, null, null, notifier); } }, /** Called when the `valuechange` event loses a subscriber. @method _onUnsubscribe @param {Node} node @param {Subscription} subscription @param {SyntheticEvent.Notifier} notifier @protected @static **/ _onUnsubscribe: function (node, subscription, notifier) { var _valuechange = notifier._valuechange; notifier._handles && notifier._handles.detach(); if (_valuechange.delegated) { _valuechange.getNodes().each(function (child) { VC._stopPolling(child, notifier); }); } else { VC._stopPolling(node, notifier); } } }; /** Synthetic event that fires when the `value` property of an `<input>` or `<textarea>` node changes as a result of a user-initiated keystroke, mouse operation, or input method editor (IME) input event. Unlike the `onchange` event, this event fires when the value actually changes and not when the element loses focus. This event also reports IME and multi-stroke input more reliably than `oninput` or the various key events across browsers. For performance reasons, only focused nodes are monitored for changes, so programmatic value changes on nodes that don't have focus won't be detected. @example YUI().use('event-valuechange', function (Y) { Y.one('#my-input').on('valueChange', function (e) { }); }); @event valuechange @param {String} prevVal Previous value prior to the latest change. @param {String} newVal New value after the latest change. @for YUI **/ config = { detach: VC._onUnsubscribe, on : VC._onSubscribe, delegate : VC._onSubscribe, detachDelegate: VC._onUnsubscribe, publishConfig: { emitFacade: true } }; Y.Event.define('valuechange', config); Y.Event.define('valueChange', config); // deprecated, but supported for backcompat Y.ValueChange = VC; }, '3.5.1' ,{requires:['event-focus', 'event-synthetic']});
""" Read/Write AMQP frames over network transports. 2009-01-14 Barry Pederson <bp@barryp.org> """ # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # This library is distributed in the hope that it will be useful, # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # You should have received a copy of the GNU Lesser General Public # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 import re import socket # See if Python 2.6+ SSL support is available try: import ssl HAVE_PY26_SSL = True except: HAVE_PY26_SSL = False try: bytes except: # Python 2.5 and lower bytes = str from struct import pack, unpack AMQP_PORT = 5672 # Yes, Advanced Message Queuing Protocol Protocol is redundant <API key> = 'AMQP\x01\x01\x09\x01'.encode('latin_1') # Match things like: [fe80::1]:5432, from RFC 2732 IPV6_LITERAL = re.compile(r'\[([\.0-9a-f:]+)\](?::(\d+))?') class _AbstractTransport(object): """ Common superclass for TCP and SSL transports """ def __init__(self, host, connect_timeout): msg = 'socket.getaddrinfo() for %s returned an empty list' % host port = AMQP_PORT m = IPV6_LITERAL.match(host) if m: host = m.group(1) if m.group(2): port = int(m.group(2)) else: if ':' in host: host, port = host.rsplit(':', 1) port = int(port) self.sock = None for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM, socket.SOL_TCP): af, socktype, proto, canonname, sa = res try: self.sock = socket.socket(af, socktype, proto) self.sock.settimeout(connect_timeout) self.sock.connect(sa) except socket.error, msg: self.sock.close() self.sock = None continue break if not self.sock: # Didn't connect, return the most recent error message raise socket.error, msg self.sock.settimeout(None) self.sock.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1) self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) self._setup_transport() self._write(<API key>) def __del__(self): self.close() def _read(self, n): """ Read exactly n bytes from the peer """ raise NotImplementedError('Must be overriden in subclass') def _setup_transport(self): """ Do any additional initialization of the class (used by the subclasses). """ pass def _shutdown_transport(self): """ Do any preliminary work in shutting down the connection. """ pass def _write(self, s): """ Completely write a string to the peer. """ raise NotImplementedError('Must be overriden in subclass') def close(self): if self.sock is not None: self._shutdown_transport() # Call shutdown first to make sure that pending messages # reach the AMQP broker if the program exits after # calling this method. self.sock.shutdown(socket.SHUT_RDWR) self.sock.close() self.sock = None def read_frame(self): """ Read an AMQP frame. """ frame_type, channel, size = unpack('>BHI', self._read(7)) payload = self._read(size) ch = ord(self._read(1)) if ch == 206: # '\xce' return frame_type, channel, payload else: raise Exception('Framing Error, received 0x%02x while expecting 0xce' % ch) def write_frame(self, frame_type, channel, payload): """ Write out an AMQP frame. """ size = len(payload) self._write(pack('>BHI%dsB' % size, frame_type, channel, size, payload, 0xce)) class SSLTransport(_AbstractTransport): """ Transport that works over SSL """ def __init__(self, host, connect_timeout, ssl): if isinstance(ssl, dict): self.sslopts = ssl self.sslobj = None super(SSLTransport, self).__init__(host, connect_timeout) def _setup_transport(self): """ Wrap the socket in an SSL object, either the new Python 2.6 version, or the older Python 2.5 and lower version. """ if HAVE_PY26_SSL: if hasattr(self, 'sslopts'): self.sslobj = ssl.wrap_socket(self.sock, **self.sslopts) else: self.sslobj = ssl.wrap_socket(self.sock) self.sslobj.do_handshake() else: self.sslobj = socket.ssl(self.sock) def _shutdown_transport(self): """ Unwrap a Python 2.6 SSL socket, so we can call shutdown() """ if HAVE_PY26_SSL and (self.sslobj is not None): self.sock = self.sslobj.unwrap() self.sslobj = None def _read(self, n): """ It seems that SSL Objects read() method may not supply as much as you're asking for, at least with extremely large messages. somewhere > 16K - found this in the test_channel.py test_large unittest. """ result = self.sslobj.read(n) while len(result) < n: s = self.sslobj.read(n - len(result)) if not s: raise IOError('Socket closed') result += s return result def _write(self, s): """ Write a string out to the SSL socket fully. """ while s: n = self.sslobj.write(s) if not n: raise IOError('Socket closed') s = s[n:] class TCPTransport(_AbstractTransport): """ Transport that deals directly with TCP socket. """ def _setup_transport(self): """ Setup to _write() directly to the socket, and do our own buffered reads. """ self._write = self.sock.sendall self._read_buffer = bytes() def _read(self, n): """ Read exactly n bytes from the socket """ while len(self._read_buffer) < n: s = self.sock.recv(65536) if not s: raise IOError('Socket closed') self._read_buffer += s result = self._read_buffer[:n] self._read_buffer = self._read_buffer[n:] return result def create_transport(host, connect_timeout, ssl=False): """ Given a few parameters from the Connection constructor, select and create a subclass of _AbstractTransport. """ if ssl: return SSLTransport(host, connect_timeout, ssl) else: return TCPTransport(host, connect_timeout)
$(document).delegate('.storage_graph_link', 'click', function(e){ var anchor = this, el = $(anchor), id = el.attr('data-status'); if(e.ctrlKey || e.metaKey){ return true; }else{ e.preventDefault(); } var cell = document.getElementById(id); var text = el.html(); if (text == '[:: show ::]') { anchor.innerHTML = '[:: hide ::]'; if (cell.nodeName == 'IMG') { // <img src='...'/> cell.src=anchor.href; } else { $.ajax({ type: "get", url: anchor.href, success : function(response, textStatus) { cell.style.display = 'block'; cell.parentNode.style.display = 'block'; cell.innerHTML = response; var data = $('#countTrendMeta',cell).text(); graphLineChart($('#countTrend',cell)[0],eval('('+data+')')); data = $('#longTrendMeta',cell).text(); graphLineChart($('#longTrend',cell)[0],eval('('+data+')')); data = $('#avgTrendMeta',cell).text(); graphLineChart($('#avgTrend',cell)[0],eval('('+data+')')); data = $('#errorTrendMeta',cell).text(); graphLineChart($('#errorTrend',cell)[0],eval('('+data+')')); data = $('#piechartMeta',cell).text(); graphPieChart($('#piechart',cell)[0],eval('('+data+')')); } }); } } else { anchor.innerHTML = '[:: show ::]'; cell.style.display = 'none'; cell.parentNode.style.display = 'none'; } })
#nullable disable using System; using System.Diagnostics; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.CSharp.Simplification { internal partial class <API key> : <API key> { private static readonly ObjectPool<IReductionRewriter> s_pool = new( () => new Rewriter(s_pool)); public <API key>() : base(s_pool) { } private static readonly Func<<API key>, SemanticModel, OptionSet, CancellationToken, SyntaxNode> <API key> = <API key>; private static SyntaxNode <API key>( <API key> node, SemanticModel semanticModel, OptionSet optionSet, Cancellation<API key>) { var rewrittenNode = node; if (node.Expression.Kind() == SyntaxKind.<API key>) { var memberAccessName = (<API key>)node.Expression; rewrittenNode = <API key>(node, semanticModel, rewrittenNode, memberAccessName.Name); } else if (node.Expression is SimpleNameSyntax) { rewrittenNode = <API key>(node, semanticModel, rewrittenNode, (SimpleNameSyntax)node.Expression); } return rewrittenNode; } private static <API key> <API key>(<API key> node, SemanticModel semanticModel, <API key> rewrittenNode, SimpleNameSyntax expressionName) { var targetSymbol = semanticModel.GetSymbolInfo(expressionName); if (targetSymbol.Symbol != null && targetSymbol.Symbol.Kind == SymbolKind.Method) { var targetMethodSymbol = (IMethodSymbol)targetSymbol.Symbol; if (!targetMethodSymbol.IsReducedExtension()) { var argumentList = node.ArgumentList; var noOfArguments = argumentList.Arguments.Count; if (noOfArguments > 0) { <API key> newMemberAccess = null; var <API key> = node.Expression; // Ensure the first expression is parenthesized so that we don't cause any // precedence issues when we take the extension method and tack it on the // end of it. var expression = argumentList.Arguments[0].Expression.Parenthesize(); if (node.Expression.Kind() == SyntaxKind.<API key>) { newMemberAccess = SyntaxFactory.<API key>( SyntaxKind.<API key>, expression, ((<API key>)<API key>).OperatorToken, ((<API key>)<API key>).Name); } else if (node.Expression.Kind() == SyntaxKind.IdentifierName) { newMemberAccess = SyntaxFactory.<API key>( SyntaxKind.<API key>, expression, (<API key>)<API key>.<API key>()); } else if (node.Expression.Kind() == SyntaxKind.GenericName) { newMemberAccess = SyntaxFactory.<API key>( SyntaxKind.<API key>, expression, (GenericNameSyntax)<API key>.<API key>()); } else { Debug.Assert(false, "The expression kind is not <API key> or IdentifierName or GenericName to be converted to Member Access Expression for Ext Method Reduction"); } if (newMemberAccess == null) { return node; } // Preserve Trivia newMemberAccess = newMemberAccess.WithLeadingTrivia(node.GetLeadingTrivia()); // Below removes the first argument // we need to reuse the separators to maintain existing formatting & comments in the arguments itself var newArguments = SyntaxFactory.SeparatedList<ArgumentSyntax>(argumentList.Arguments.GetWithSeparators().AsEnumerable().Skip(2)); var <API key> = argumentList.WithArguments(newArguments); var <API key> = SyntaxFactory.<API key>(newMemberAccess, <API key>); var oldSymbol = semanticModel.GetSymbolInfo(node).Symbol; var newSymbol = semanticModel.<API key>( node.SpanStart, <API key>, <API key>.BindAsExpression).Symbol; if (oldSymbol != null && newSymbol != null) { if (newSymbol.Kind == SymbolKind.Method && oldSymbol.Equals(((IMethodSymbol)newSymbol).<API key>())) { rewrittenNode = <API key>; } } } } } return rewrittenNode; } } }
#nullable disable #if NETCOREAPP using System; using System.IO; using System.Text; using System.Threading; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; namespace Roslyn.Test.Utilities.CoreClr { internal static class SharedConsole { private static TextWriter s_savedConsoleOut; private static TextWriter s_savedConsoleError; private static AsyncLocal<StringWriter> s_currentOut; private static AsyncLocal<StringWriter> s_currentError; internal static void OverrideConsole() { s_savedConsoleOut = Console.Out; s_savedConsoleError = Console.Error; s_currentOut = new AsyncLocal<StringWriter>(); s_currentError = new AsyncLocal<StringWriter>(); Console.SetOut(new <API key>()); Console.SetError(new <API key>()); } public static void CaptureOutput(Action action, int expectedLength, out string output, out string errorOutput) { var outputWriter = new CappedStringWriter(expectedLength); var errorOutputWriter = new CappedStringWriter(expectedLength); var savedOutput = s_currentOut.Value; var savedError = s_currentError.Value; try { s_currentOut.Value = outputWriter; s_currentError.Value = errorOutputWriter; action(); } finally { s_currentOut.Value = savedOutput; s_currentError.Value = savedError; } output = outputWriter.ToString(); errorOutput = errorOutputWriter.ToString(); } private sealed class <API key> : SharedConsoleWriter { public override TextWriter Underlying => s_currentOut.Value ?? s_savedConsoleOut; } private sealed class <API key> : SharedConsoleWriter { public override TextWriter Underlying => s_currentError.Value ?? s_savedConsoleError; } private abstract class SharedConsoleWriter : TextWriter { public override Encoding Encoding => Underlying.Encoding; public abstract TextWriter Underlying { get; } public override void Write(char value) => Underlying.Write(value); } } } #endif
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Linq; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; using Microsoft.WebMatrix.Extensibility; using NuGet; using NuGet.WebMatrix.Data; namespace NuGet.WebMatrix { internal class FilterManager { private ListViewFilter _installedFilter; private ListViewFilter _updatesFilter; private ListViewFilter _disabledFilter; private <API key> _allFilter; // Task scheduler for executing tasks on the primary thread private TaskScheduler _scheduler; <summary> Initializes a new instance of the <see cref="T:FilterManager"/> class. </summary> internal FilterManager(NuGetModel model, TaskScheduler scheduler, <API key> descriptor) { Debug.Assert(model != null, "Model must not be null"); Debug.Assert(scheduler != null, "TaskScheduler must not be null"); this.Model = model; Filters = new <API key><IListViewFilter>(); _installedFilter = new ListViewFilter(Resources.Filter_Installed, string.Format(Resources.<API key>, descriptor.PackageKind), supportsPrerelease: false); _installedFilter.FilteredItems.SortDescriptions.Clear(); _updatesFilter = new ListViewFilter(Resources.Filter_Updated, string.Format(Resources.<API key>, descriptor.PackageKind), supportsPrerelease: true); _updatesFilter.FilteredItems.SortDescriptions.Clear(); _disabledFilter = new ListViewFilter(Resources.Filter_Disabled, string.Format(Resources.<API key>, descriptor.PackageKind), supportsPrerelease: false); _disabledFilter.FilteredItems.SortDescriptions.Clear(); _scheduler = scheduler; } internal <API key><IListViewFilter> Filters { get; private set; } public NuGetModel Model { get; private set; } internal ListViewFilter InstalledFilter { get { return _installedFilter; } } private <API key> AllFilter { get { return _allFilter; } } private ListViewFilter DisabledFilter { get { return _disabledFilter; } } public void UpdateFilters() { // populate the installed packages first, followed by disabled filter (other categories depend on this information) var <API key> = <API key>(); <API key>.Wait(); // Start populating the filters var populateFiltersTask = <API key>(); populateFiltersTask.Wait(); } private Task <API key>() { return Task.Factory.StartNew(() => { // after we get the installed packages, use them to populate the 'installed' and 'disabled' filters var installedTask = Task.Factory .StartNew<IEnumerable<PackageViewModel>>(<API key>, TaskCreationOptions.AttachedToParent); installedTask.ContinueWith( <API key>, CancellationToken.None, <API key>.AttachedToParent | <API key>.<API key>, this._scheduler); installedTask.ContinueWith( <API key>, CancellationToken.None, <API key>.AttachedToParent | <API key>.<API key>, this._scheduler); }); } private Task <API key>() { // the child tasks here are created with AttachedToParent, the outer task will not // complete until all children have. return Task.Factory.StartNew(() => { // each of these operations is a two-step process // 1. Get the packages // 2. Create view models and add to filters Task.Factory .StartNew(UpdateTheAllFilter, TaskCreationOptions.AttachedToParent); Task.Factory .StartNew<IEnumerable<IPackage>>(GetUpdatePackages, TaskCreationOptions.AttachedToParent) .ContinueWith( UpdateUpdatesFilter(), CancellationToken.None, <API key>.AttachedToParent | <API key>.<API key>, this._scheduler); }) .ContinueWith(AddFilters, this._scheduler); } private void AddFilters(Task task) { Filters.Clear(); // always show the 'all' filter Filters.Add(_allFilter); if (_updatesFilter.Count > 0) { Filters.Add(_updatesFilter); } // always show the installed filter Filters.Add(_installedFilter); if (_disabledFilter.Count > 0) { Filters.Add(_disabledFilter); } if (task.IsFaulted) { throw task.Exception; } } private void UpdateTheAllFilter() { // updating the 'all' filter can take a matter of seconds -- so only update when it's timed out if (this._allFilter == null) { this._allFilter = new <API key>( Resources.Filter_All, Resources.<API key>, (p) => new PackageViewModel(this.Model, p as IPackage, <API key>.InstallOrUninstall)); this.AllFilter.Sort = (p) => p.DownloadCount; if (!String.IsNullOrWhiteSpace(this.Model.FeedSource.FilterTag)) { this.AllFilter.Filter = FilterManager.<API key>(this.Model.FeedSource.FilterTag); } this.AllFilter.PackageManager = this.Model.PackageManager; } } private void <API key>(Task<IEnumerable<PackageViewModel>> task) { var installed = task.Result; _installedFilter.Items.Clear(); foreach (var viewModel in installed) { _installedFilter.Items.Add(new ListViewItemWrapper() { Item = viewModel, SearchText = viewModel.SearchText, Name = viewModel.Name, }); } } private void <API key>(Task<IEnumerable<PackageViewModel>> task) { var installed = task.Result; _disabledFilter.Items.Clear(); foreach (var viewModel in installed) { if (!viewModel.IsEnabled) { _disabledFilter.Items.Add(new ListViewItemWrapper() { Item = viewModel, SearchText = viewModel.SearchText, Name = viewModel.Name, }); } } } private Action<Task<IEnumerable<IPackage>>> UpdateUpdatesFilter() { return (task) => { if (task.Result == null) { return; } _updatesFilter.Items.Clear(); var packages = task.Result; foreach (var package in packages) { var packageViewModel = new PackageViewModel(this.Model, package, <API key>.Update); _updatesFilter.Items.Add(new ListViewItemWrapper() { Item = packageViewModel, SearchText = packageViewModel.SearchText, Name = packageViewModel.Name, }); } }; } <summary> Filters the given set of packages on the given tag. If the filter tag is null or whitespace, all packages are returned. (Case-Insensitive) </summary> <param name="packages">Input packages</param> <param name="filterTag">The tag to filter</param> <returns>The set of packages containing the given tag tag</returns> <remarks> This implementation (IQueryable) is based on the nature of the NuGet remote package service. The filter clause applied here is pushed up to the server, which will dramatically increase the performance. If you tweak the body of this function, expect to find things that work locally, and fail when hitting the server-side. </remarks> public static IQueryable<IPackage> FilterOnTag(IQueryable<IPackage> packages, string filterTag) { Debug.Assert(packages != null, "Packages cannot be null"); if (string.IsNullOrWhiteSpace(filterTag)) { return packages; } // we're doing this padding because we don't get to call string.split // when this is running on a remote package list (inside the lambda) // the tag value on the package is considered untrusted input, so we make sure // it has a leading and trailing space, as does the search text. // it's also possible that package.Tags might be delimited by spaces and commas // like: ' foo, bar ' string loweredFilterTag = filterTag.ToLowerInvariant().Trim(); string <API key> = " " + loweredFilterTag + " "; string <API key> = " " + loweredFilterTag + ", "; return packages .Where(package => package.Tags != null) .Where(package => (" " + package.Tags.ToLower().Trim() + " ").Contains(<API key>) || (" " + package.Tags.ToLower().Trim() + " ").Contains(<API key>)); } public static Expression<Func<IPackage, bool>> <API key>(string filterTag) { // we're doing this padding because we don't get to call string.split // when this is running on a remote package list (inside the lambda) // the tag value on the package is considered untrusted input, so we make sure // it has a leading and trailing space, as does the search text. // it's also possible that package.Tags might be delimited by spaces and commas // like: ' foo, bar ' string loweredFilterTag = filterTag.ToLowerInvariant().Trim(); string <API key> = " " + loweredFilterTag + " "; string <API key> = " " + loweredFilterTag + ", "; return (package) => package.Tags != null && ((" " + package.Tags.ToLower().Trim() + " ").Contains(<API key>) || (" " + package.Tags.ToLower().Trim() + " ").Contains(<API key>)); } private IEnumerable<PackageViewModel> <API key>() { var installed = FilterOnTag(this.Model.<API key>().AsQueryable(), this.Model.FeedSource.FilterTag); / From the installed tab, the only possible operation is uninstall and update is NOT supported / For this reason, retrieving the remote package is not worthwhile / Plus, Downloads count will not be shown in installed tab, which is fine / Note that 'ALL' tab continues to support all applicable operations on a selected package including 'Update' IEnumerable<PackageViewModel> viewModels; viewModels = installed.Select((local) => new PackageViewModel( this.Model, local, true, <API key>.InstallOrUninstall)); return viewModels; } private IEnumerable<IPackage> GetUpdatePackages() { IEnumerable<IPackage> allPackages = this.Model.<API key>(); return FilterOnTag(allPackages.AsQueryable(), this.Model.FeedSource.FilterTag); } } }
<!DOCTYPE html> <title>SVG*List immutability</title> <script src=../../resources/testharness.js></script> <script src=../../resources/testharnessreport.js></script> <script> var root = document.createElementNS('http: [ { element: 'polygon', attr: 'points', value: '0,0 10,10', listName: 'SVGPointList', accessor: function(elm) { return elm.animatedPoints; }, constructItem: function(elm) { return root.createSVGPoint(); } }, { element: 'text', attr: 'x', value: '0 10', listName: 'SVGLengthList', accessor: function(elm) { return elm.x.animVal; }, constructItem: function(elm) { return root.createSVGLength(); } }, { element: 'rect', attr: 'transform', value: 'rotate(0) scale(1)', listName: 'SVGTransformList', accessor: function(elm) { return elm.transform.animVal; }, constructItem: function(elm) { return root.createSVGTransform(); } } ].forEach(function(testItem) { var element = document.createElementNS('http: element.setAttribute(testItem.attr, testItem.value); var list = testItem.accessor(element); var item = testItem.constructItem(element); test(function() { assert_equals(list.length, 2); assert_throws('<API key>', function() { list.clear(); }); assert_throws('<API key>', function() { list.initialize(item); }); assert_throws('<API key>', function() { list[0] = item; }); assert_throws('<API key>', function() { list.insertItemBefore(item, 0); }); assert_throws('<API key>', function() { list.replaceItem(item, 0); }); assert_throws('<API key>', function() { list.removeItem(0); }); assert_throws('<API key>', function() { list.appendItem(item); }); }, document.title + ', ' + testItem.listName); }); </script>
description("Test path animation where coordinate modes of start and end differ. You should see PASS messages"); createSVGTestCase(); // Setup test document var path = createSVGElement("path"); path.setAttribute("id", "path"); path.setAttribute("d", "M -30 -30 q 30 0 30 30 t -30 30 Z"); path.setAttribute("fill", "green"); path.setAttribute("onclick", "executeTest()"); path.setAttribute("transform", "translate(50, 50)"); var animate = createSVGElement("animate"); animate.setAttribute("id", "animation"); animate.setAttribute("attributeName", "d"); animate.setAttribute("from", "M -30 -30 q 30 0 30 30 t -30 30 Z"); animate.setAttribute("to", "M -30 -30 Q 30 -30 30 0 T -30 30 Z"); animate.setAttribute("begin", "click"); animate.setAttribute("dur", "4s"); path.appendChild(animate); rootSVGElement.appendChild(path); // Setup animation test function sample1() { // Check initial/end conditions <API key>("path.getAttribute('d')", "M -30 -30 q 30 0 30 30 t -30 30 Z"); } function sample2() { <API key>("path.getAttribute('d')", "M -30 -30 q 37.5 0 37.5 30 t -37.5 30 Z"); } function sample3() { <API key>("path.getAttribute('d')", "M -30 -30 Q 22.5 -30 22.5 0 T -30 30 Z"); } function sample4() { <API key>("path.getAttribute('d')", "M -30 -30 Q 29.9925 -30 29.9925 0 T -30 30 Z"); } function executeTest() { const expectedValues = [ // [animationId, time, sampleCallback] ["animation", 0.0, sample1], ["animation", 1.0, sample2], ["animation", 3.0, sample3], ["animation", 3.999, sample4], ["animation", 4.001, sample1] ]; runAnimationTest(expectedValues); } window.clickX = 40; window.clickY = 70; var successfullyParsed = true;
<html> <body> <script type="text/javascript" charset="utf-8"> window.open('http://host', 'host', '<API key>'); </script> </body> </html>
<?php namespace Symfony\Component\DependencyInjection\Tests\Dumper; use DummyProxyDumper; use PHPUnit\Framework\TestCase; use Psr\Container\ContainerInterface; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\<API key>; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface as <API key>; use Symfony\Component\DependencyInjection\Dumper\PhpDumper; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator; use Symfony\Component\DependencyInjection\TypedReference; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\ServiceLocator; use Symfony\Component\DependencyInjection\Tests\Fixtures\<API key>; use Symfony\Component\DependencyInjection\Variable; use Symfony\Component\ExpressionLanguage\Expression; require_once __DIR__.'/../Fixtures/includes/classes.php'; class PhpDumperTest extends TestCase { protected static $fixturesPath; public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); } public function testDump() { $container = new ContainerBuilder(); $container->compile(); $dumper = new PhpDumper($container); $this-><API key>(self::$fixturesPath.'/php/services1.php', $dumper->dump(), '->dump() dumps an empty container as an empty PHP class'); $this-><API key>(self::$fixturesPath.'/php/services1-1.php', $dumper->dump(array('class' => 'Container', 'base_class' => 'AbstractContainer', 'namespace' => 'Symfony\Component\DependencyInjection\Dump')), '->dump() takes a class and a base_class options'); } public function <API key>() { $definition = new Definition(); $definition->setClass('stdClass'); $definition->addArgument(array( 'only dot' => '.', 'concatenation as value' => '.\'\'.', 'concatenation from the start value' => '\'\'.', '.' => 'dot as a key', '.\'\'.' => 'concatenation as a key', '\'\'.' => 'concatenation from the start key', 'optimize concatenation' => 'string1%some_string%string2', 'optimize concatenation with empty string' => 'string1%empty_value%string2', 'optimize concatenation from the start' => '%empty_value%start', 'optimize concatenation at the end' => 'end%empty_value%', )); $container = new ContainerBuilder(); $container->setResourceTracking(false); $container->setDefinition('test', $definition); $container->setParameter('empty_value', ''); $container->setParameter('some_string', '-'); $container->compile(); $dumper = new PhpDumper($container); $this-><API key>(self::$fixturesPath.'/php/services10.php', $dumper->dump(), '->dump() dumps an empty container as an empty PHP class'); } public function testDumpRelativeDir() { $definition = new Definition(); $definition->setClass('stdClass'); $definition->addArgument('%foo%'); $definition->addArgument(array('%foo%' => '%buz%/')); $container = new ContainerBuilder(); $container->setDefinition('test', $definition); $container->setParameter('foo', 'wiz'.dirname(__DIR__)); $container->setParameter('bar', __DIR__); $container->setParameter('baz', '%bar%/PhpDumperTest.php'); $container->setParameter('buz', dirname(dirname(__DIR__))); $container->compile(); $dumper = new PhpDumper($container); $this-><API key>(self::$fixturesPath.'/php/services12.php', $dumper->dump(array('file' => __FILE__)), '->dump() dumps __DIR__ relative strings'); } /** * @dataProvider <API key> * @expectedException \<API key> */ public function <API key>($parameters) { $container = new ContainerBuilder(new ParameterBag($parameters)); $container->compile(); $dumper = new PhpDumper($container); $dumper->dump(); } public function <API key>() { return array( array(array('foo' => new Definition('stdClass'))), array(array('foo' => new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")'))), array(array('foo' => new Reference('foo'))), array(array('foo' => new Variable('foo'))), ); } public function testAddParameters() { $container = include self::$fixturesPath.'/containers/container8.php'; $container->compile(); $dumper = new PhpDumper($container); $this-><API key>(self::$fixturesPath.'/php/services8.php', $dumper->dump(), '->dump() dumps parameters'); } /** * @group legacy * @expectedDeprecation Dumping an uncompiled ContainerBuilder is deprecated since version 3.3 and will not be supported anymore in 4.0. Compile the container beforehand. */ public function <API key>() { $container = include self::$fixturesPath.'/containers/container9.php'; $dumper = new PhpDumper($container); $this-><API key>(self::$fixturesPath.'/php/services9.php', str_replace(str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), '%path%', $dumper->dump()), '->dump() dumps services'); } public function testAddService() { $container = include self::$fixturesPath.'/containers/container9.php'; $container->compile(); $dumper = new PhpDumper($container); $this-><API key>(self::$fixturesPath.'/php/services9_compiled.php', str_replace(str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), '%path%', $dumper->dump()), '->dump() dumps services'); $container = new ContainerBuilder(); $container->register('foo', 'FooClass')->addArgument(new \stdClass()); $container->compile(); $dumper = new PhpDumper($container); try { $dumper->dump(); $this->fail('->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); } catch (\Exception $e) { $this->assertInstanceOf('\Symfony\Component\DependencyInjection\Exception\RuntimeException', $e, '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); $this->assertEquals('Unable to dump a service container if a parameter is an object or a resource.', $e->getMessage(), '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); } } public function <API key>() { $container = include self::$fixturesPath.'/containers/container19.php'; $container->compile(); $dumper = new PhpDumper($container); $this-><API key>(self::$fixturesPath.'/php/services19.php', $dumper->dump(), '->dump() dumps services with anonymous factories'); } public function <API key>() { $class = '<API key>'; $container = new ContainerBuilder(); $container->register('bar$', 'FooClass'); $container->register('bar$!', 'FooClass'); $container->compile(); $dumper = new PhpDumper($container); eval('?>'.$dumper->dump(array('class' => $class))); $this->assertTrue(method_exists($class, 'getBarService')); $this->assertTrue(method_exists($class, 'getBar2Service')); } public function <API key>() { $class = '<API key>'; $container = new ContainerBuilder(); $container->register('foo_bar', 'FooClass'); $container->register('foobar', 'FooClass'); $container->compile(); $dumper = new PhpDumper($container); eval('?>'.$dumper->dump(array('class' => $class))); $this->assertTrue(method_exists($class, 'getFooBarService')); $this->assertTrue(method_exists($class, 'getFoobar2Service')); } public function <API key>() { $class = '<API key>'; $container = new ContainerBuilder(); $container->register('bar', 'FooClass'); $container->register('foo_bar', 'FooClass'); $container->compile(); $dumper = new PhpDumper($container); eval('?>'.$dumper->dump(array( 'class' => $class, 'base_class' => 'Symfony\Component\DependencyInjection\Tests\Fixtures\containers\CustomContainer', ))); $this->assertTrue(method_exists($class, 'getBar2Service')); $this->assertTrue(method_exists($class, 'getFoobar2Service')); } /** * @dataProvider <API key> * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException * @<API key> Cannot dump definition */ public function <API key>($factory) { $container = new ContainerBuilder(); $def = new Definition('stdClass'); $def->setFactory($factory); $container->setDefinition('bar', $def); $container->compile(); $dumper = new PhpDumper($container); $dumper->dump(); } public function <API key>() { return array( array(array('', 'method')), array(array('class', '')), array(array('...', 'method')), array(array('class', '...')), ); } public function testAliases() { $container = include self::$fixturesPath.'/containers/container9.php'; $container->setParameter('foo_bar', 'foo_bar'); $container->compile(); $dumper = new PhpDumper($container); eval('?>'.$dumper->dump(array('class' => '<API key>'))); $container = new \<API key>(); $foo = $container->get('foo'); $this->assertSame($foo, $container->get('alias_for_foo')); $this->assertSame($foo, $container->get('alias_for_alias')); } public function <API key>() { $container = new ContainerBuilder(); $container->compile(); $dumper = new PhpDumper($container); eval('?>'.$dumper->dump(array('class' => '<API key>'))); $container = new \<API key>(); $this->assertFalse($container->has('foo')); } /** * @group legacy * @expectedDeprecation Setting the "bar" pre-defined service is deprecated since Symfony 3.3 and won't be supported anymore in Symfony 4.0. */ public function <API key>() { require_once self::$fixturesPath.'/php/services9.php'; require_once self::$fixturesPath.'/includes/foo.php'; $container = new \<API key>(); $container->set('bar', $bar = new \stdClass()); $container->setParameter('foo_bar', 'foo_bar'); $this->assertSame($bar, $container->get('bar'), '->set() overrides an already defined service'); } /** * @group legacy * @expectedDeprecation Setting the "bar" pre-defined service is deprecated since Symfony 3.3 and won't be supported anymore in Symfony 4.0. */ public function <API key>() { require_once self::$fixturesPath.'/php/services9.php'; require_once self::$fixturesPath.'/includes/foo.php'; require_once self::$fixturesPath.'/includes/classes.php'; $container = new \<API key>(); $container->set('bar', $bar = new \stdClass()); $this->assertSame($bar, $container->get('foo')->bar, '->set() overrides an already defined service'); } /** * @expectedException \Symfony\Component\DependencyInjection\Exception\<API key> */ public function <API key>() { $container = new ContainerBuilder(); $container->register('foo', 'stdClass')->addArgument(new Reference('bar')); $container->register('bar', 'stdClass')->setPublic(false)->addMethodCall('setA', array(new Reference('baz'))); $container->register('baz', 'stdClass')->addMethodCall('setA', array(new Reference('foo'))); $container->compile(); $dumper = new PhpDumper($container); $dumper->dump(); } public function <API key>() { $container = include self::$fixturesPath.'/containers/container24.php'; $container->compile(); $dumper = new PhpDumper($container); $this-><API key>(self::$fixturesPath.'/php/services24.php', $dumper->dump()); } public function testEnvParameter() { $container = new ContainerBuilder(); $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')); $loader->load('services26.yml'); $container->compile(); $dumper = new PhpDumper($container); $this-><API key>(self::$fixturesPath.'/php/services26.php', $dumper->dump(), '->dump() dumps inline definitions which reference service_container'); } /** * @expectedException \Symfony\Component\DependencyInjection\Exception\<API key> * @<API key> Environment variables "FOO" are never used. Please, check your container's configuration. */ public function <API key>() { $container = new ContainerBuilder(); $container->getParameter('env(FOO)'); $container->compile(); $dumper = new PhpDumper($container); $dumper->dump(); } public function <API key>() { $container = new ContainerBuilder(); $container->register('foo', 'stdClass')->addMethodCall('add', array(new Reference('service_container')))->setPublic(false); $container->register('bar', 'stdClass')->addArgument(new Reference('foo')); $container->compile(); $dumper = new PhpDumper($container); $this-><API key>(self::$fixturesPath.'/php/services13.php', $dumper->dump(), '->dump() dumps inline definitions which reference service_container'); } public function <API key>() { require_once self::$fixturesPath.'/includes/classes.php'; $container = new ContainerBuilder(); $container->register('foo', 'stdClass'); $container->register('bar', 'MethodCallClass') ->setProperty('simple', 'bar') ->setProperty('complex', new Reference('foo')) ->addMethodCall('callMe'); $container->compile(); $dumper = new PhpDumper($container); eval('?>'.$dumper->dump(array('class' => '<API key>'))); $container = new \<API key>(); $this->assertTrue($container->get('bar')->callPassed(), '->dump() initializes properties before method calls'); } public function <API key>() { $container = new ContainerBuilder(); $container->register('foo', 'stdClass')->addArgument(new Reference('bar')); $container->register('bar', 'stdClass')->setLazy(true)->addArgument(new Reference('foo')); $container->compile(); $dumper = new PhpDumper($container); $dumper->dump(); $this->addToAssertionCount(1); } public function <API key>() { /* * test graph: * [connection] -> [event_manager] --> [entity_manager](lazy) * | * --(call)- addEventListener ("@lazy_service") * * [lazy_service](lazy) -> [entity_manager](lazy) * */ $container = new ContainerBuilder(); $<API key> = new Definition('stdClass'); $<API key> = $container->register('connection', 'stdClass'); $<API key>->addArgument($<API key>); $container->register('entity_manager', 'stdClass') ->setLazy(true) ->addArgument(new Reference('connection')); $<API key> = $container->register('lazy_service', 'stdClass'); $<API key>->setLazy(true); $<API key>->addArgument(new Reference('entity_manager')); $<API key>->addMethodCall('addEventListener', array(new Reference('lazy_service'))); $container->compile(); $dumper = new PhpDumper($container); $dumper->setProxyDumper(new DummyProxyDumper()); $dumper->dump(); $this->addToAssertionCount(1); } public function <API key>() { require_once self::$fixturesPath.'/includes/classes.php'; $container = new ContainerBuilder(); $container->register('lazy_referenced', 'stdClass'); $container ->register('lazy_context', 'LazyContext') ->setArguments(array( new IteratorArgument(array('k1' => new Reference('lazy_referenced'), 'k2' => new Reference('service_container'))), new IteratorArgument(array()), )) ; $container->compile(); $dumper = new PhpDumper($container); eval('?>'.$dumper->dump(array('class' => '<API key>'))); $container = new \<API key>(); $lazyContext = $container->get('lazy_context'); $this->assertInstanceOf(RewindableGenerator::class, $lazyContext->lazyValues); $this->assertInstanceOf(RewindableGenerator::class, $lazyContext->lazyEmptyValues); $this->assertCount(2, $lazyContext->lazyValues); $this->assertCount(0, $lazyContext->lazyEmptyValues); $i = -1; foreach ($lazyContext->lazyValues as $k => $v) { switch (++$i) { case 0: $this->assertEquals('k1', $k); $this->assertInstanceOf('stdCLass', $v); break; case 1: $this->assertEquals('k2', $k); $this->assertInstanceOf('<API key>', $v); break; } } $this->assertEmpty(iterator_to_array($lazyContext->lazyEmptyValues)); } public function testNormalizedId() { $container = include self::$fixturesPath.'/containers/container33.php'; $container->compile(); $dumper = new PhpDumper($container); $this-><API key>(self::$fixturesPath.'/php/services33.php', $dumper->dump()); } public function <API key>() { $container = new ContainerBuilder(); $container->register('foo_service', 'stdClass')->setArguments(array(new Reference('baz_service'))); $container->register('bar_service', 'stdClass')->setArguments(array(new Reference('baz_service'))); $container->register('baz_service', 'stdClass')->setPublic(false); $container->compile(); $dumper = new PhpDumper($container); $this-><API key>(self::$fixturesPath.'/php/<API key>.php', $dumper->dump()); } public function testServiceLocator() { $container = new ContainerBuilder(); $container->register('foo_service', ServiceLocator::class) ->addArgument(array( 'bar' => new <API key>(new Reference('bar_service')), 'baz' => new <API key>(new TypedReference('baz_service', 'stdClass')), 'nil' => $nil = new <API key>(new Reference('nil')), )) ; // no method calls $container->register('translator.loader_1', 'stdClass'); $container->register('translator.loader_1_locator', ServiceLocator::class) ->setPublic(false) ->addArgument(array( 'translator.loader_1' => new <API key>(new Reference('translator.loader_1')), )); $container->register('translator_1', StubbedTranslator::class) ->addArgument(new Reference('translator.loader_1_locator')); // one method calls $container->register('translator.loader_2', 'stdClass'); $container->register('translator.loader_2_locator', ServiceLocator::class) ->setPublic(false) ->addArgument(array( 'translator.loader_2' => new <API key>(new Reference('translator.loader_2')), )); $container->register('translator_2', StubbedTranslator::class) ->addArgument(new Reference('translator.loader_2_locator')) ->addMethodCall('addResource', array('db', new Reference('translator.loader_2'), 'nl')); // two method calls $container->register('translator.loader_3', 'stdClass'); $container->register('translator.loader_3_locator', ServiceLocator::class) ->setPublic(false) ->addArgument(array( 'translator.loader_3' => new <API key>(new Reference('translator.loader_3')), )); $container->register('translator_3', StubbedTranslator::class) ->addArgument(new Reference('translator.loader_3_locator')) ->addMethodCall('addResource', array('db', new Reference('translator.loader_3'), 'nl')) ->addMethodCall('addResource', array('db', new Reference('translator.loader_3'), 'en')); $nil->setValues(array(null)); $container->register('bar_service', 'stdClass')->setArguments(array(new Reference('baz_service'))); $container->register('baz_service', 'stdClass')->setPublic(false); $container->compile(); $dumper = new PhpDumper($container); $this-><API key>(self::$fixturesPath.'/php/services_locator.php', $dumper->dump()); } public function <API key>() { $container = new ContainerBuilder(); $container->register('foo_service', <API key>::class) ->setAutowired(true) ->addArgument(new Reference(ContainerInterface::class)) ->addTag('container.service_subscriber', array( 'key' => 'bar', 'id' => <API key>::class, )) ; $container->register(<API key>::class, <API key>::class); $container->compile(); $dumper = new PhpDumper($container); $this-><API key>(self::$fixturesPath.'/php/services_subscriber.php', $dumper->dump()); } public function <API key>() { require_once self::$fixturesPath.'/includes/classes.php'; $container = new ContainerBuilder(); $container->register('not_invalid', 'BazClass') ->setPublic(false); $container->register('bar', 'BarClass') ->addMethodCall('setBaz', array(new Reference('not_invalid', <API key>::<API key>))); $container->compile(); $dumper = new PhpDumper($container); eval('?>'.$dumper->dump(array('class' => '<API key>'))); $container = new \<API key>(); $this->assertInstanceOf('BazClass', $container->get('bar')->getBaz()); } public function <API key>() { $container = new ContainerBuilder(); $container->register('private_bar', 'stdClass') ->setPublic(false); $container->register('private_foo', 'stdClass') ->setPublic(false); $container->register('public_foo', 'stdClass') ->addArgument(new Expression('service("private_foo")')); $container->compile(); $dumper = new PhpDumper($container); $this-><API key>(self::$fixturesPath.'/php/<API key>.php', $dumper->dump()); } public function <API key>() { $container = new ContainerBuilder(); $container->register('foo', '\\stdClass'); $container->compile(); $dumper = new PhpDumper($container); eval('?>'.$dumper->dump(array('class' => '<API key>'))); $container = new \<API key>(); $this->assertInstanceOf('stdClass', $container->get('foo')); } /** * This test checks the trigger of a deprecation note and should not be removed in major releases. * * @group legacy * @expectedDeprecation The "foo" service is deprecated. You should stop using it, as it will soon be removed. */ public function <API key>() { $container = new ContainerBuilder(); $container->register('foo', 'stdClass') ->setPublic(false) ->setDeprecated(true); $container->register('bar', 'stdClass') ->setPublic(true) ->setProperty('foo', new Reference('foo')); $container->compile(); $dumper = new PhpDumper($container); eval('?>'.$dumper->dump(array('class' => '<API key>'))); $container = new \<API key>(); $container->get('bar'); } }
-- This program is free software; you can redistribute it and/or modify -- (at your option) any later version. -- This program is distributed in the hope that it will be useful, -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import Distribution.Simple import Distribution.Simple.PreProcess import Distribution.Simple.PreProcess.Unlit (unlit) import Distribution.Package ( Package(..), PackageName(..) ) import Distribution.ModuleName (ModuleName) import qualified Distribution.ModuleName as ModuleName import Distribution.PackageDescription as PD ( PackageDescription(..), BuildInfo(..), Executable(..), withExe , Library(..), withLib, libModules ) import qualified Distribution.<API key> as Installed ( <API key>(..) ) import qualified Distribution.Simple.PackageIndex as PackageIndex import Distribution.Simple.Compiler ( CompilerFlavor(..), Compiler(..), compilerFlavor, compilerVersion ) import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..)) import Distribution.Simple.BuildPaths (autogenModulesDir,cppHeaderName) import Distribution.Simple.Utils ( <API key>, <API key>, writeUTF8File , die, setupMessage, intercalate, copyFileVerbose , <API key>, <API key>' ) import Distribution.Simple.Program ( Program(..), ConfiguredProgram(..), lookupProgram, programPath , <API key>, rawSystemProgram , greencardProgram, cpphsProgram, hsc2hsProgram, c2hsProgram , happyProgram, alexProgram, haddockProgram, ghcProgram, gccProgram, ldProgram ) import Distribution.System ( OS(OSX, Windows), buildOS ) import Distribution.Version (Version(..)) import Distribution.Verbosity import Distribution.Text ( display ) import Control.Monad (when, unless) import Data.Maybe (fromMaybe) import Data.List (nub) import System.Directory (getModificationTime, doesFileExist) import System.Info (os, arch) import System.FilePath (splitExtension, dropExtensions, (</>), (<.>), takeDirectory, normalise, replaceExtension) import Distribution.Simple.Program (simpleProgram) hsc2hsLdProgram = simpleProgram "hsc2hs-ld" my_ppHsc2hs :: BuildInfo -> LocalBuildInfo -> PreProcessor my_ppHsc2hs bi lbi = standardPP lbi hsc2hsProgram $ [ "--cc=" ++ programPath gccProg , "--ld=" ++ programPath ldProg ] -- [ "--cc=" ++ cc -- , "--ld=" ++ ld ] -- Additional gcc options ++ [ "--cflag=" ++ opt | opt <- programArgs gccProg ] ++ [ "--lflag=" ++ opt | opt <- programArgs gccProg ] -- OSX frameworks: ++ [ what ++ "=-F" ++ opt | isOSX , opt <- nub (concatMap Installed.frameworkDirs pkgs) , what <- ["--cflag", "--lflag"] ] ++ [ "--lflag=" ++ arg | isOSX , opt <- PD.frameworks bi ++ concatMap Installed.frameworks pkgs , arg <- ["-framework", opt] ] -- Note that on ELF systems, wherever we use -L, we must also use -R -- because presumably that -L dir is not on the normal path for the -- system's dynamic linker. This is needed because hsc2hs works by -- compiling a C program and then running it. -- Options from the current package: ++ [ "--cflag=" ++ opt | opt <- hcDefines (compiler lbi) ] ++ [ "--cflag=-I" ++ dir | dir <- PD.includeDirs bi ] ++ [ "--cflag=" ++ opt | opt <- PD.ccOptions bi ++ PD.cppOptions bi ] ++ [ "--lflag=-L" ++ opt | opt <- PD.extraLibDirs bi ] ++ [ "--lflag=-Wl,-R," ++ opt | isELF , opt <- PD.extraLibDirs bi ] ++ [ "--lflag=-l" ++ opt | opt <- PD.extraLibs bi ] ++ [ "--lflag=" ++ opt | opt <- PD.ldOptions bi ] -- Options from dependent packages ++ [ "--cflag=" ++ opt | pkg <- pkgs , opt <- [ "-I" ++ opt | opt <- Installed.includeDirs pkg ] ++ [ opt | opt <- Installed.ccOptions pkg ] ] ++ [ "--lflag=" ++ opt | pkg <- pkgs , opt <- [ "-L" ++ opt | opt <- Installed.libraryDirs pkg ] ++ [ "-Wl,-R," ++ opt | isELF , opt <- Installed.libraryDirs pkg ] ++ [ "-l" ++ opt | opt <- Installed.extraLibraries pkg ] ++ [ opt | opt <- Installed.ldOptions pkg ] ] where pkgs = PackageIndex.topologicalOrder (packageHacks (installedPkgs lbi)) Just gccProg = lookupProgram gccProgram (withPrograms lbi) Just ldProg = lookupProgram hsc2hsLdProgram (withPrograms lbi) isOSX = case buildOS of OSX -> True; _ -> False isELF = case buildOS of OSX -> False; Windows -> False; _ -> True; packageHacks = case compilerFlavor (compiler lbi) of GHC -> hackRtsPackage _ -> id -- We don't link in the actual Haskell libraries of our dependencies, so -- the -u flags in the ldOptions of the rts package mean linking fails on -- OS X (it's ld is a tad stricter than gnu ld). Thus we remove the -- ldOptions for GHC's rts package: hackRtsPackage index = case PackageIndex.lookupPackageName index (PackageName "rts") of [(_, [rts])] -> PackageIndex.insert rts { Installed.ldOptions = [] } index _ -> error "No (or multiple) ghc rts package is registered!!" -- TODO: move this into the compiler abstraction -- FIXME: this forces GHC's crazy 4.8.2 -> 408 convention on all the other -- compilers. Check if that's really what they want. versionInt :: Version -> String versionInt (Version { versionBranch = [] }) = "1" versionInt (Version { versionBranch = [n] }) = show n versionInt (Version { versionBranch = n1:n2:_ }) = -- 6.8.x -> 608 -- 6.10.x -> 610 let s1 = show n1 s2 = show n2 middle = case s2 of _ : _ : _ -> "" _ -> "0" in s1 ++ middle ++ s2 standardPP :: LocalBuildInfo -> Program -> [String] -> PreProcessor standardPP lbi prog args = PreProcessor { platformIndependent = False, runPreProcessor = <API key> $ \inFile outFile verbosity -> do <API key> verbosity prog (withPrograms lbi) (args ++ ["-o", outFile, inFile]) -- XXX This is a nasty hack. GHC requires that hs-boot files -- be in the same place as the hs files, so if we put the hs -- file in dist/... then we need to copy the hs-boot file -- there too. This should probably be done another way, e.g. -- by preprocessing all files, with and "id" preprocessor if -- nothing else, so the hs-boot files automatically get copied -- into the right place. -- Possibly we should also be looking for .lhs-boot files, but -- I think that preprocessors only produce .hs files. let inBoot = replaceExtension inFile "hs-boot" outBoot = replaceExtension outFile "hs-boot" exists <- doesFileExist inBoot when exists $ copyFileVerbose verbosity inBoot outBoot } hcDefines :: Compiler -> [String] hcDefines comp = case compilerFlavor comp of GHC -> ["-<API key>=" ++ versionInt version] JHC -> ["-D__JHC__=" ++ versionInt version] NHC -> ["-D__NHC__=" ++ versionInt version] Hugs -> ["-D__HUGS__"] _ -> [] where version = compilerVersion comp main = <API key> $ simpleUserHooks { hookedPreProcessors = [ ("hsc", my_ppHsc2hs) ] , hookedPrograms = hsc2hsLdProgram : hookedPrograms simpleUserHooks }
#define RCSID "$Id$" /* * TODO: */ #include <stdio.h> #include <string.h> #include <stdlib.h> /* drand48, srand48 */ #include <sys/types.h> #include <sys/time.h> #include "pppd.h" #include "chap.h" #include "md5.h" #ifdef CHAPMS #include "chap_ms.h" #endif static const char rcsid[] = RCSID; /* * Command-line options. */ static option_t chap_option_list[] = { { "chap-restart", o_int, &chap[0].timeouttime, "Set timeout for CHAP", 0, NULL, 0, 0 }, { "chap-max-challenge", o_int, &chap[0].max_transmits, "Set max #xmits for challenge", 0, NULL, 0, 0 }, { "chap-interval", o_int, &chap[0].chal_interval, "Set interval for rechallenge", 0, NULL, 0, 0 }, #ifdef MSLANMAN { "ms-lanman", o_bool, &ms_lanman, "Use LanMan passwd when using MS-CHAP", 1, NULL, 0, 0 }, #endif { NULL, 0, NULL, NULL, 0, NULL, 0, 0 } }; /* * Protocol entry points. */ static void ChapInit(int); static void ChapLowerUp(int); static void ChapLowerDown(int); static void ChapInput(int, u_char *, int); static void ChapProtocolReject(int); static int ChapPrintPkt(u_char *, int, void (*)(void *, char *, ...), void *); struct protent chap_protent = { PPP_CHAP, ChapInit, ChapInput, ChapProtocolReject, ChapLowerUp, ChapLowerDown, NULL, NULL, ChapPrintPkt, NULL, 1, "CHAP", NULL, chap_option_list, NULL, NULL, NULL }; chap_state chap[NUM_PPP]; /* CHAP state; one for each unit */ static void <API key>(void *); static void ChapResponseTimeout(void *); static void <API key>(chap_state *, u_char *, int, int); static void ChapRechallenge(void *); static void ChapReceiveResponse(chap_state *, u_char *, int, int); static void ChapReceiveSuccess(chap_state *, u_char *, u_char, int); static void ChapReceiveFailure(chap_state *, u_char *, u_char, int); static void ChapSendStatus(chap_state *, int); static void ChapSendChallenge(chap_state *); static void ChapSendResponse(chap_state *); static void ChapGenChallenge(chap_state *); /* * ChapInit - Initialize a CHAP unit. */ static void ChapInit( int unit) { chap_state *cstate = &chap[unit]; BZERO(cstate, sizeof(*cstate)); cstate->unit = unit; cstate->clientstate = CHAPCS_INITIAL; cstate->serverstate = CHAPSS_INITIAL; cstate->timeouttime = CHAP_DEFTIMEOUT; cstate->max_transmits = CHAP_DEFTRANSMITS; /* random number generator is initialized in magic_init */ } /* * ChapAuthWithPeer - Authenticate us with our peer (start client). * */ void ChapAuthWithPeer( int unit, char *our_name, int digest) { chap_state *cstate = &chap[unit]; cstate->resp_name = our_name; cstate->resp_type = digest; if (cstate->clientstate == CHAPCS_INITIAL || cstate->clientstate == CHAPCS_PENDING) { /* lower layer isn't up - wait until later */ cstate->clientstate = CHAPCS_PENDING; return; } /* * We get here as a result of LCP coming up. * So even if CHAP was open before, we will * have to re-authenticate ourselves. */ cstate->clientstate = CHAPCS_LISTEN; } /* * ChapAuthPeer - Authenticate our peer (start server). */ void ChapAuthPeer( int unit, char *our_name, int digest) { chap_state *cstate = &chap[unit]; cstate->chal_name = our_name; cstate->chal_type = digest; if (cstate->serverstate == CHAPSS_INITIAL || cstate->serverstate == CHAPSS_PENDING) { /* lower layer isn't up - wait until later */ cstate->serverstate = CHAPSS_PENDING; return; } ChapGenChallenge(cstate); ChapSendChallenge(cstate); /* crank it up dude! */ cstate->serverstate = CHAPSS_INITIAL_CHAL; } /* * <API key> - Timeout expired on sending challenge. */ static void <API key>( void *arg) { chap_state *cstate = (chap_state *) arg; /* if we aren't sending challenges, don't worry. then again we */ /* probably shouldn't be here either */ if (cstate->serverstate != CHAPSS_INITIAL_CHAL && cstate->serverstate != CHAPSS_RECHALLENGE) return; if (cstate->chal_transmits >= cstate->max_transmits) { /* give up on peer */ error("Peer failed to respond to CHAP challenge"); cstate->serverstate = CHAPSS_BADAUTH; auth_peer_fail(cstate->unit, PPP_CHAP); return; } ChapSendChallenge(cstate); /* Re-send challenge */ } /* * ChapResponseTimeout - Timeout expired on sending response. */ static void ChapResponseTimeout( void *arg) { chap_state *cstate = (chap_state *) arg; /* if we aren't sending a response, don't worry. */ if (cstate->clientstate != CHAPCS_RESPONSE) return; ChapSendResponse(cstate); /* re-send response */ } /* * ChapRechallenge - Time to challenge the peer again. */ static void ChapRechallenge( void *arg) { chap_state *cstate = (chap_state *) arg; /* if we aren't sending a response, don't worry. */ if (cstate->serverstate != CHAPSS_OPEN) return; ChapGenChallenge(cstate); ChapSendChallenge(cstate); cstate->serverstate = CHAPSS_RECHALLENGE; } /* * ChapLowerUp - The lower layer is up. * * Start up if we have pending requests. */ static void ChapLowerUp( int unit) { chap_state *cstate = &chap[unit]; if (cstate->clientstate == CHAPCS_INITIAL) cstate->clientstate = CHAPCS_CLOSED; else if (cstate->clientstate == CHAPCS_PENDING) cstate->clientstate = CHAPCS_LISTEN; if (cstate->serverstate == CHAPSS_INITIAL) cstate->serverstate = CHAPSS_CLOSED; else if (cstate->serverstate == CHAPSS_PENDING) { ChapGenChallenge(cstate); ChapSendChallenge(cstate); cstate->serverstate = CHAPSS_INITIAL_CHAL; } } /* * ChapLowerDown - The lower layer is down. * * Cancel all timeouts. */ static void ChapLowerDown( int unit) { chap_state *cstate = &chap[unit]; /* Timeout(s) pending? Cancel if so. */ if (cstate->serverstate == CHAPSS_INITIAL_CHAL || cstate->serverstate == CHAPSS_RECHALLENGE) UNTIMEOUT(<API key>, cstate); else if (cstate->serverstate == CHAPSS_OPEN && cstate->chal_interval != 0) UNTIMEOUT(ChapRechallenge, cstate); if (cstate->clientstate == CHAPCS_RESPONSE) UNTIMEOUT(ChapResponseTimeout, cstate); cstate->clientstate = CHAPCS_INITIAL; cstate->serverstate = CHAPSS_INITIAL; } /* * ChapProtocolReject - Peer doesn't grok CHAP. */ static void ChapProtocolReject( int unit) { chap_state *cstate = &chap[unit]; if (cstate->serverstate != CHAPSS_INITIAL && cstate->serverstate != CHAPSS_CLOSED) auth_peer_fail(unit, PPP_CHAP); if (cstate->clientstate != CHAPCS_INITIAL && cstate->clientstate != CHAPCS_CLOSED) auth_withpeer_fail(unit, PPP_CHAP); ChapLowerDown(unit); /* shutdown chap */ } /* * ChapInput - Input CHAP packet. */ static void ChapInput( int unit, u_char *inpacket, int packet_len) { chap_state *cstate = &chap[unit]; u_char *inp; u_char code, id; int len; /* * Parse header (code, id and length). * If packet too short, drop it. */ inp = inpacket; if (packet_len < CHAP_HEADERLEN) { CHAPDEBUG(("ChapInput: rcvd short header.")); return; } GETCHAR(code, inp); GETCHAR(id, inp); GETSHORT(len, inp); if (len < CHAP_HEADERLEN) { CHAPDEBUG(("ChapInput: rcvd illegal length.")); return; } if (len > packet_len) { CHAPDEBUG(("ChapInput: rcvd short packet.")); return; } len -= CHAP_HEADERLEN; /* * Action depends on code (as in fact it usually does :-). */ switch (code) { case CHAP_CHALLENGE: <API key>(cstate, inp, id, len); break; case CHAP_RESPONSE: ChapReceiveResponse(cstate, inp, id, len); break; case CHAP_FAILURE: ChapReceiveFailure(cstate, inp, id, len); break; case CHAP_SUCCESS: ChapReceiveSuccess(cstate, inp, id, len); break; default: /* Need code reject? */ warn("Unknown CHAP code (%d) received.", code); break; } } /* * <API key> - Receive Challenge and send Response. */ static void <API key>( chap_state *cstate, u_char *inp, int id, int len) { int rchallenge_len; u_char *rchallenge; int secret_len; unsigned char secret[MAXSECRETLEN]; char rhostname[256]; MD5_CTX mdContext; u_char hash[MD5_SIGNATURE_SIZE]; if (cstate->clientstate == CHAPCS_CLOSED || cstate->clientstate == CHAPCS_PENDING) { CHAPDEBUG(("<API key>: in state %d", cstate->clientstate)); return; } if (len < 2) { CHAPDEBUG(("<API key>: rcvd short packet.")); return; } GETCHAR(rchallenge_len, inp); len -= sizeof (u_char) + rchallenge_len; /* now name field length */ if (len < 0) { CHAPDEBUG(("<API key>: rcvd short packet.")); return; } rchallenge = inp; INCPTR(rchallenge_len, inp); if (len >= sizeof(rhostname)) len = sizeof(rhostname) - 1; BCOPY(inp, rhostname, len); rhostname[len] = '\000'; /* Microsoft doesn't send their name back in the PPP packet */ if (explicit_remote || (remote_name[0] != 0 && rhostname[0] == 0)) { strlcpy(rhostname, remote_name, sizeof(rhostname)); CHAPDEBUG(("<API key>: using '%q' as remote name", rhostname)); } /* get secret for authenticating ourselves with the specified host */ if (!get_secret(cstate->unit, cstate->resp_name, rhostname, secret, &secret_len, 0)) { secret_len = 0; /* assume null secret if can't find one */ warn("No CHAP secret found for authenticating us to %q", rhostname); } /* cancel response send timeout if necessary */ if (cstate->clientstate == CHAPCS_RESPONSE) UNTIMEOUT(ChapResponseTimeout, cstate); cstate->resp_id = id; cstate->resp_transmits = 0; /* generate MD based on negotiated type */ switch (cstate->resp_type) { case CHAP_DIGEST_MD5: MD5Init(&mdContext); MD5Update(&mdContext, &cstate->resp_id, 1); MD5Update(&mdContext, secret, secret_len); MD5Update(&mdContext, rchallenge, rchallenge_len); MD5Final(hash, &mdContext); BCOPY(hash, cstate->response, MD5_SIGNATURE_SIZE); cstate->resp_length = MD5_SIGNATURE_SIZE; break; #ifdef CHAPMS case CHAP_MICROSOFT: ChapMS(cstate, rchallenge, rchallenge_len, secret, secret_len); break; #endif default: CHAPDEBUG(("unknown digest type %d", cstate->resp_type)); return; } BZERO(secret, sizeof(secret)); ChapSendResponse(cstate); } /* * ChapReceiveResponse - Receive and process response. */ static void ChapReceiveResponse( chap_state *cstate, u_char *inp, int id, int len) { u_char *remmd, remmd_len; int secret_len, old_state; int code; char rhostname[256]; MD5_CTX mdContext; unsigned char secret[MAXSECRETLEN]; u_char hash[MD5_SIGNATURE_SIZE]; if (cstate->serverstate == CHAPSS_CLOSED || cstate->serverstate == CHAPSS_PENDING) { CHAPDEBUG(("ChapReceiveResponse: in state %d", cstate->serverstate)); return; } if (id != cstate->chal_id) return; /* doesn't match ID of last challenge */ /* * If we have received a duplicate or bogus Response, * we have to send the same answer (Success/Failure) * as we did for the first Response we saw. */ if (cstate->serverstate == CHAPSS_OPEN) { ChapSendStatus(cstate, CHAP_SUCCESS); return; } if (cstate->serverstate == CHAPSS_BADAUTH) { ChapSendStatus(cstate, CHAP_FAILURE); return; } if (len < 2) { CHAPDEBUG(("ChapReceiveResponse: rcvd short packet.")); return; } GETCHAR(remmd_len, inp); /* get length of MD */ remmd = inp; /* get pointer to MD */ INCPTR(remmd_len, inp); len -= sizeof (u_char) + remmd_len; if (len < 0) { CHAPDEBUG(("ChapReceiveResponse: rcvd short packet.")); return; } UNTIMEOUT(<API key>, cstate); if (len >= sizeof(rhostname)) len = sizeof(rhostname) - 1; BCOPY(inp, rhostname, len); rhostname[len] = '\000'; /* * Get secret for authenticating them with us, * do the hash ourselves, and compare the result. */ code = CHAP_FAILURE; if (!get_secret(cstate->unit, (explicit_remote? remote_name: rhostname), cstate->chal_name, secret, &secret_len, 1)) { warn("No CHAP secret found for authenticating %q", rhostname); } else { /* generate MD based on negotiated type */ switch (cstate->chal_type) { case CHAP_DIGEST_MD5: /* only MD5 is defined for now */ if (remmd_len != MD5_SIGNATURE_SIZE) break; /* it's not even the right length */ MD5Init(&mdContext); MD5Update(&mdContext, &cstate->chal_id, 1); MD5Update(&mdContext, secret, secret_len); MD5Update(&mdContext, cstate->challenge, cstate->chal_len); MD5Final(hash, &mdContext); /* compare local and remote MDs and send the appropriate status */ if (memcmp (hash, remmd, MD5_SIGNATURE_SIZE) == 0) code = CHAP_SUCCESS; /* they are the same! */ break; default: CHAPDEBUG(("unknown digest type %d", cstate->chal_type)); } } BZERO(secret, sizeof(secret)); ChapSendStatus(cstate, code); if (code == CHAP_SUCCESS) { old_state = cstate->serverstate; cstate->serverstate = CHAPSS_OPEN; if (old_state == CHAPSS_INITIAL_CHAL) { auth_peer_success(cstate->unit, PPP_CHAP, rhostname, len); } if (cstate->chal_interval != 0) TIMEOUT(ChapRechallenge, cstate, cstate->chal_interval); notice("CHAP peer authentication succeeded for %q", rhostname); } else { error("CHAP peer authentication failed for remote host %q", rhostname); cstate->serverstate = CHAPSS_BADAUTH; auth_peer_fail(cstate->unit, PPP_CHAP); } } /* * ChapReceiveSuccess - Receive Success */ static void ChapReceiveSuccess( chap_state *cstate, u_char *inp, u_char id, int len) { if (cstate->clientstate == CHAPCS_OPEN) /* presumably an answer to a duplicate response */ return; if (cstate->clientstate != CHAPCS_RESPONSE) { /* don't know what this is */ CHAPDEBUG(("ChapReceiveSuccess: in state %d\n", cstate->clientstate)); return; } UNTIMEOUT(ChapResponseTimeout, cstate); /* * Print message. */ if (len > 0) PRINTMSG(inp, len); cstate->clientstate = CHAPCS_OPEN; <API key>(cstate->unit, PPP_CHAP); } /* * ChapReceiveFailure - Receive failure. */ static void ChapReceiveFailure( chap_state *cstate, u_char *inp, u_char id, int len) { if (cstate->clientstate != CHAPCS_RESPONSE) { /* don't know what this is */ CHAPDEBUG(("ChapReceiveFailure: in state %d\n", cstate->clientstate)); return; } UNTIMEOUT(ChapResponseTimeout, cstate); /* * Print message. */ if (len > 0) PRINTMSG(inp, len); error("CHAP authentication failed"); auth_withpeer_fail(cstate->unit, PPP_CHAP); } /* * ChapSendChallenge - Send an Authenticate challenge. */ static void ChapSendChallenge( chap_state *cstate) { u_char *outp; int chal_len, name_len; int outlen; chal_len = cstate->chal_len; name_len = strlen(cstate->chal_name); outlen = CHAP_HEADERLEN + sizeof (u_char) + chal_len + name_len; outp = outpacket_buf; MAKEHEADER(outp, PPP_CHAP); /* paste in a CHAP header */ PUTCHAR(CHAP_CHALLENGE, outp); PUTCHAR(cstate->chal_id, outp); PUTSHORT(outlen, outp); PUTCHAR(chal_len, outp); /* put length of challenge */ BCOPY(cstate->challenge, outp, chal_len); INCPTR(chal_len, outp); BCOPY(cstate->chal_name, outp, name_len); /* append hostname */ output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN); TIMEOUT(<API key>, cstate, cstate->timeouttime); ++cstate->chal_transmits; } /* * ChapSendStatus - Send a status response (ack or nak). */ static void ChapSendStatus( chap_state *cstate, int code) { u_char *outp; int outlen, msglen; char msg[256]; if (code == CHAP_SUCCESS) slprintf(msg, sizeof(msg), "Welcome to %s.", hostname); else slprintf(msg, sizeof(msg), "I don't like you. Go 'way."); msglen = strlen(msg); outlen = CHAP_HEADERLEN + msglen; outp = outpacket_buf; MAKEHEADER(outp, PPP_CHAP); /* paste in a header */ PUTCHAR(code, outp); PUTCHAR(cstate->chal_id, outp); PUTSHORT(outlen, outp); BCOPY(msg, outp, msglen); output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN); } /* * ChapGenChallenge is used to generate a pseudo-random challenge string of * a pseudo-random length between min_len and max_len. The challenge * string and its length are stored in *cstate, and various other fields of * *cstate are initialized. */ static void ChapGenChallenge( chap_state *cstate) { int chal_len; u_char *ptr = cstate->challenge; int i; /* pick a random challenge length between <API key> and <API key> */ chal_len = (unsigned) ((drand48() * (<API key> - <API key>)) + <API key>); cstate->chal_len = chal_len; cstate->chal_id = ++cstate->id; cstate->chal_transmits = 0; /* generate a random string */ for (i = 0; i < chal_len; i++) *ptr++ = (char) (drand48() * 0xff); } /* * ChapSendResponse - send a response packet with values as specified * in *cstate. */ /* ARGSUSED */ static void ChapSendResponse( chap_state *cstate) { u_char *outp; int outlen, md_len, name_len; md_len = cstate->resp_length; name_len = strlen(cstate->resp_name); outlen = CHAP_HEADERLEN + sizeof (u_char) + md_len + name_len; outp = outpacket_buf; MAKEHEADER(outp, PPP_CHAP); PUTCHAR(CHAP_RESPONSE, outp); /* we are a response */ PUTCHAR(cstate->resp_id, outp); /* copy id from challenge packet */ PUTSHORT(outlen, outp); /* packet length */ PUTCHAR(md_len, outp); /* length of MD */ BCOPY(cstate->response, outp, md_len); /* copy MD to buffer */ INCPTR(md_len, outp); BCOPY(cstate->resp_name, outp, name_len); /* append our name */ /* send the packet */ output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN); cstate->clientstate = CHAPCS_RESPONSE; TIMEOUT(ChapResponseTimeout, cstate, cstate->timeouttime); ++cstate->resp_transmits; } /* * ChapPrintPkt - print the contents of a CHAP packet. */ static char *ChapCodenames[] = { "Challenge", "Response", "Success", "Failure" }; static int ChapPrintPkt( u_char *p, int plen, void (*printer)(void *, char *, ...), void *arg) { int code, id, len; int clen, nlen; u_char x; if (plen < CHAP_HEADERLEN) return 0; GETCHAR(code, p); GETCHAR(id, p); GETSHORT(len, p); if (len < CHAP_HEADERLEN || len > plen) return 0; if (code >= 1 && code <= sizeof(ChapCodenames) / sizeof(char *)) printer(arg, " %s", ChapCodenames[code-1]); else printer(arg, " code=0x%x", code); printer(arg, " id=0x%x", id); len -= CHAP_HEADERLEN; switch (code) { case CHAP_CHALLENGE: case CHAP_RESPONSE: if (len < 1) break; clen = p[0]; if (len < clen + 1) break; ++p; nlen = len - clen - 1; printer(arg, " <"); for (; clen > 0; --clen) { GETCHAR(x, p); printer(arg, "%.2x", x); } printer(arg, ">, name = "); print_string((char *)p, nlen, printer, arg); break; case CHAP_FAILURE: case CHAP_SUCCESS: printer(arg, " "); print_string((char *)p, len, printer, arg); break; default: for (clen = len; clen > 0; --clen) { GETCHAR(x, p); printer(arg, " %.2x", x); } } return len + CHAP_HEADERLEN; }
/* Area: ffi_closure, unwind info Purpose: Check if the unwind information is passed correctly. Limitations: none. PR: none. Originator: Jeff Sturm <jsturm@one-point.com> */ /* { dg-do run } */ #include "ffitestcxx.h" #if defined HAVE_STDINT_H #include <stdint.h> #endif #if defined HAVE_INTTYPES_H #include <inttypes.h> #endif void closure_test_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, void** args __UNUSED__, void* userdata __UNUSED__) { throw 9; } typedef void (*closure_test_type)(); void closure_test_fn1(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(ffi_arg*)resp = (int)*(float *)args[0] +(int)(*(float *)args[1]) + (int)(*(float *)args[2]) + (int)*(float *)args[3] + (int)(*(signed short *)args[4]) + (int)(*(float *)args[5]) + (int)*(float *)args[6] + (int)(*(int *)args[7]) + (int)(*(double*)args[8]) + (int)*(int *)args[9] + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(int *)args[13]) + (int)(*(int *)args[14]) + *(int *)args[15] + (int)(intptr_t)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(float *)args[0], (int)(*(float *)args[1]), (int)(*(float *)args[2]), (int)*(float *)args[3], (int)(*(signed short *)args[4]), (int)(*(float *)args[5]), (int)*(float *)args[6], (int)(*(int *)args[7]), (int)(*(double *)args[8]), (int)*(int *)args[9], (int)(*(int *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(int *)args[13]), (int)(*(int *)args[14]), *(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg*)resp); throw (int)*(ffi_arg*)resp; } typedef int (*closure_test_type1)(float, float, float, float, signed short, float, float, int, double, int, int, float, int, int, int, int); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = (ffi_closure *)ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; { cl_arg_types[1] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &ffi_type_void, cl_arg_types) == FFI_OK); CHECK(<API key>(pcl, &cif, closure_test_fn, NULL, code) == FFI_OK); try { (*((closure_test_type)(code)))(); } catch (int exception_code) { CHECK(exception_code == 9); } printf("part one OK\n"); /* { dg-output "part one OK" } */ } { cl_arg_types[0] = &ffi_type_float; cl_arg_types[1] = &ffi_type_float; cl_arg_types[2] = &ffi_type_float; cl_arg_types[3] = &ffi_type_float; cl_arg_types[4] = &ffi_type_sshort; cl_arg_types[5] = &ffi_type_float; cl_arg_types[6] = &ffi_type_float; cl_arg_types[7] = &ffi_type_uint; cl_arg_types[8] = &ffi_type_double; cl_arg_types[9] = &ffi_type_uint; cl_arg_types[10] = &ffi_type_uint; cl_arg_types[11] = &ffi_type_float; cl_arg_types[12] = &ffi_type_uint; cl_arg_types[13] = &ffi_type_uint; cl_arg_types[14] = &ffi_type_uint; cl_arg_types[15] = &ffi_type_uint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(<API key>(pcl, &cif, closure_test_fn1, (void *) 3 /* userdata */, code) == FFI_OK); try { (*((closure_test_type1)code)) (1.1, 2.2, 3.3, 4.4, 127, 5.5, 6.6, 8, 9, 10, 11, 12.0, 13, 19, 21, 1); /* { dg-output "\n1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */ } catch (int exception_code) { CHECK(exception_code == 255); } printf("part two OK\n"); /* { dg-output "\npart two OK" } */ } exit(0); }
#define pr_fmt(fmt) "IPv4: " fmt #include <linux/module.h> #include <asm/uaccess.h> #include <linux/bitops.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/string.h> #include <linux/socket.h> #include <linux/sockios.h> #include <linux/errno.h> #include <linux/in.h> #include <linux/inet.h> #include <linux/netdevice.h> #include <linux/proc_fs.h> #include <linux/init.h> #include <linux/skbuff.h> #include <linux/inetdevice.h> #include <linux/igmp.h> #include <linux/pkt_sched.h> #include <linux/mroute.h> #include <linux/netfilter_ipv4.h> #include <linux/random.h> #include <linux/rcupdate.h> #include <linux/times.h> #include <linux/slab.h> #include <linux/jhash.h> #include <net/dst.h> #include <net/net_namespace.h> #include <net/protocol.h> #include <net/ip.h> #include <net/route.h> #include <net/inetpeer.h> #include <net/sock.h> #include <net/ip_fib.h> #include <net/arp.h> #include <net/tcp.h> #include <net/icmp.h> #include <net/xfrm.h> #include <net/netevent.h> #include <net/rtnetlink.h> #ifdef CONFIG_SYSCTL #include <linux/sysctl.h> #include <linux/kmemleak.h> #endif #include <net/secure_seq.h> #define RT_FL_TOS(oldflp4) \ ((oldflp4)->flowi4_tos & (IPTOS_RT_MASK | RTO_ONLINK)) #define RT_GC_TIMEOUT (300*HZ) static int ip_rt_max_size; static int <API key> __read_mostly = 9; static int ip_rt_redirect_load __read_mostly = HZ / 50; static int <API key> __read_mostly = ((HZ / 50) << (9 + 1)); static int ip_rt_error_cost __read_mostly = HZ; static int ip_rt_error_burst __read_mostly = 5 * HZ; static int ip_rt_mtu_expires __read_mostly = 10 * 60 * HZ; static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20; static int ip_rt_min_advmss __read_mostly = 256; /* * Interface to generic destination cache. */ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie); static unsigned int ipv4_default_advmss(const struct dst_entry *dst); static unsigned int ipv4_mtu(const struct dst_entry *dst); static struct dst_entry *<API key>(struct dst_entry *dst); static void ipv4_link_failure(struct sk_buff *skb); static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb, u32 mtu); static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb); static void ipv4_dst_destroy(struct dst_entry *dst); static u32 *ipv4_cow_metrics(struct dst_entry *dst, unsigned long old) { WARN_ON(1); return NULL; } static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, struct sk_buff *skb, const void *daddr); static struct dst_ops ipv4_dst_ops = { .family = AF_INET, .protocol = cpu_to_be16(ETH_P_IP), .check = ipv4_dst_check, .default_advmss = ipv4_default_advmss, .mtu = ipv4_mtu, .cow_metrics = ipv4_cow_metrics, .destroy = ipv4_dst_destroy, .negative_advice = <API key>, .link_failure = ipv4_link_failure, .update_pmtu = ip_rt_update_pmtu, .redirect = ip_do_redirect, .local_out = __ip_local_out, .neigh_lookup = ipv4_neigh_lookup, }; #define ECN_OR_COST(class) TC_PRIO_##class const __u8 ip_tos2prio[16] = { TC_PRIO_BESTEFFORT, ECN_OR_COST(BESTEFFORT), TC_PRIO_BESTEFFORT, ECN_OR_COST(BESTEFFORT), TC_PRIO_BULK, ECN_OR_COST(BULK), TC_PRIO_BULK, ECN_OR_COST(BULK), TC_PRIO_INTERACTIVE, ECN_OR_COST(INTERACTIVE), TC_PRIO_INTERACTIVE, ECN_OR_COST(INTERACTIVE), <API key>, ECN_OR_COST(INTERACTIVE_BULK), <API key>, ECN_OR_COST(INTERACTIVE_BULK) }; EXPORT_SYMBOL(ip_tos2prio); static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat); #define RT_CACHE_STAT_INC(field) raw_cpu_inc(rt_cache_stat.field) #ifdef CONFIG_PROC_FS static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos) { if (*pos) return NULL; return SEQ_START_TOKEN; } static void *rt_cache_seq_next(struct seq_file *seq, void *v, loff_t *pos) { ++*pos; return NULL; } static void rt_cache_seq_stop(struct seq_file *seq, void *v) { } static int rt_cache_seq_show(struct seq_file *seq, void *v) { if (v == SEQ_START_TOKEN) seq_printf(seq, "%-127s\n", "Iface\tDestination\tGateway \tFlags\t\tRefCnt\tUse\t" "Metric\tSource\t\tMTU\tWindow\tIRTT\tTOS\tHHRef\t" "HHUptod\tSpecDst"); return 0; } static const struct seq_operations rt_cache_seq_ops = { .start = rt_cache_seq_start, .next = rt_cache_seq_next, .stop = rt_cache_seq_stop, .show = rt_cache_seq_show, }; static int rt_cache_seq_open(struct inode *inode, struct file *file) { return seq_open(file, &rt_cache_seq_ops); } static const struct file_operations rt_cache_seq_fops = { .owner = THIS_MODULE, .open = rt_cache_seq_open, .read = seq_read, .llseek = seq_lseek, .release = seq_release, }; static void *rt_cpu_seq_start(struct seq_file *seq, loff_t *pos) { int cpu; if (*pos == 0) return SEQ_START_TOKEN; for (cpu = *pos-1; cpu < nr_cpu_ids; ++cpu) { if (!cpu_possible(cpu)) continue; *pos = cpu+1; return &per_cpu(rt_cache_stat, cpu); } return NULL; } static void *rt_cpu_seq_next(struct seq_file *seq, void *v, loff_t *pos) { int cpu; for (cpu = *pos; cpu < nr_cpu_ids; ++cpu) { if (!cpu_possible(cpu)) continue; *pos = cpu+1; return &per_cpu(rt_cache_stat, cpu); } return NULL; } static void rt_cpu_seq_stop(struct seq_file *seq, void *v) { } static int rt_cpu_seq_show(struct seq_file *seq, void *v) { struct rt_cache_stat *st = v; if (v == SEQ_START_TOKEN) { seq_printf(seq, "entries in_hit in_slow_tot in_slow_mc in_no_route in_brd in_martian_dst in_martian_src out_hit out_slow_tot out_slow_mc gc_total gc_ignored gc_goal_miss gc_dst_overflow in_hlist_search out_hlist_search\n"); return 0; } seq_printf(seq,"%08x %08x %08x %08x %08x %08x %08x %08x " " %08x %08x %08x %08x %08x %08x %08x %08x %08x \n", <API key>(&ipv4_dst_ops), 0, /* st->in_hit */ st->in_slow_tot, st->in_slow_mc, st->in_no_route, st->in_brd, st->in_martian_dst, st->in_martian_src, 0, /* st->out_hit */ st->out_slow_tot, st->out_slow_mc, 0, /* st->gc_total */ 0, /* st->gc_ignored */ 0, /* st->gc_goal_miss */ 0, /* st->gc_dst_overflow */ 0, /* st->in_hlist_search */ 0 /* st->out_hlist_search */ ); return 0; } static const struct seq_operations rt_cpu_seq_ops = { .start = rt_cpu_seq_start, .next = rt_cpu_seq_next, .stop = rt_cpu_seq_stop, .show = rt_cpu_seq_show, }; static int rt_cpu_seq_open(struct inode *inode, struct file *file) { return seq_open(file, &rt_cpu_seq_ops); } static const struct file_operations rt_cpu_seq_fops = { .owner = THIS_MODULE, .open = rt_cpu_seq_open, .read = seq_read, .llseek = seq_lseek, .release = seq_release, }; #ifdef <API key> static int rt_acct_proc_show(struct seq_file *m, void *v) { struct ip_rt_acct *dst, *src; unsigned int i, j; dst = kcalloc(256, sizeof(struct ip_rt_acct), GFP_KERNEL); if (!dst) return -ENOMEM; <API key>(i) { src = (struct ip_rt_acct *)per_cpu_ptr(ip_rt_acct, i); for (j = 0; j < 256; j++) { dst[j].o_bytes += src[j].o_bytes; dst[j].o_packets += src[j].o_packets; dst[j].i_bytes += src[j].i_bytes; dst[j].i_packets += src[j].i_packets; } } seq_write(m, dst, 256 * sizeof(struct ip_rt_acct)); kfree(dst); return 0; } static int rt_acct_proc_open(struct inode *inode, struct file *file) { return single_open(file, rt_acct_proc_show, NULL); } static const struct file_operations rt_acct_proc_fops = { .owner = THIS_MODULE, .open = rt_acct_proc_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; #endif static int __net_init ip_rt_do_proc_init(struct net *net) { struct proc_dir_entry *pde; pde = proc_create("rt_cache", S_IRUGO, net->proc_net, &rt_cache_seq_fops); if (!pde) goto err1; pde = proc_create("rt_cache", S_IRUGO, net->proc_net_stat, &rt_cpu_seq_fops); if (!pde) goto err2; #ifdef <API key> pde = proc_create("rt_acct", 0, net->proc_net, &rt_acct_proc_fops); if (!pde) goto err3; #endif return 0; #ifdef <API key> err3: remove_proc_entry("rt_cache", net->proc_net_stat); #endif err2: remove_proc_entry("rt_cache", net->proc_net); err1: return -ENOMEM; } static void __net_exit ip_rt_do_proc_exit(struct net *net) { remove_proc_entry("rt_cache", net->proc_net_stat); remove_proc_entry("rt_cache", net->proc_net); #ifdef <API key> remove_proc_entry("rt_acct", net->proc_net); #endif } static struct pernet_operations ip_rt_proc_ops __net_initdata = { .init = ip_rt_do_proc_init, .exit = ip_rt_do_proc_exit, }; static int __init ip_rt_proc_init(void) { return <API key>(&ip_rt_proc_ops); } #else static inline int ip_rt_proc_init(void) { return 0; } #endif /* CONFIG_PROC_FS */ static inline bool rt_is_expired(const struct rtable *rth) { return rth->rt_genid != rt_genid_ipv4(dev_net(rth->dst.dev)); } void rt_cache_flush(struct net *net) { rt_genid_bump_ipv4(net); } static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, struct sk_buff *skb, const void *daddr) { struct net_device *dev = dst->dev; const __be32 *pkey = daddr; const struct rtable *rt; struct neighbour *n; rt = (const struct rtable *) dst; if (rt->rt_gateway) pkey = (const __be32 *) &rt->rt_gateway; else if (skb) pkey = &ip_hdr(skb)->daddr; n = __ipv4_neigh_lookup(dev, *(__force u32 *)pkey); if (n) return n; return neigh_create(&arp_tbl, pkey, dev); } #define IP_IDENTS_SZ 2048u struct ip_ident_bucket { atomic_t id; u32 stamp32; }; static struct ip_ident_bucket *ip_idents __read_mostly; /* In order to protect privacy, we add a perturbation to identifiers * if one generator is seldom used. This makes hard for an attacker * to infer how many packets were sent between two points in time. */ u32 ip_idents_reserve(u32 hash, int segs) { struct ip_ident_bucket *bucket = ip_idents + hash % IP_IDENTS_SZ; u32 old = ACCESS_ONCE(bucket->stamp32); u32 now = (u32)jiffies; u32 delta = 0; if (old != now && cmpxchg(&bucket->stamp32, old, now) == old) delta = prandom_u32_max(now - old); return atomic_add_return(segs + delta, &bucket->id) - segs; } EXPORT_SYMBOL(ip_idents_reserve); void __ip_select_ident(struct iphdr *iph, int segs) { static u32 ip_idents_hashrnd __read_mostly; u32 hash, id; net_get_random_once(&ip_idents_hashrnd, sizeof(ip_idents_hashrnd)); hash = jhash_3words((__force u32)iph->daddr, (__force u32)iph->saddr, iph->protocol, ip_idents_hashrnd); id = ip_idents_reserve(hash, segs); iph->id = htons(id); } EXPORT_SYMBOL(__ip_select_ident); static void __build_flow_key(struct flowi4 *fl4, const struct sock *sk, const struct iphdr *iph, int oif, u8 tos, u8 prot, u32 mark, int flow_flags) { if (sk) { const struct inet_sock *inet = inet_sk(sk); oif = sk->sk_bound_dev_if; mark = sk->sk_mark; tos = RT_CONN_FLAGS(sk); prot = inet->hdrincl ? IPPROTO_RAW : sk->sk_protocol; } flowi4_init_output(fl4, oif, mark, tos, RT_SCOPE_UNIVERSE, prot, flow_flags, iph->daddr, iph->saddr, 0, 0); } static void build_skb_flow_key(struct flowi4 *fl4, const struct sk_buff *skb, const struct sock *sk) { const struct iphdr *iph = ip_hdr(skb); int oif = skb->dev->ifindex; u8 tos = RT_TOS(iph->tos); u8 prot = iph->protocol; u32 mark = skb->mark; __build_flow_key(fl4, sk, iph, oif, tos, prot, mark, 0); } static void build_sk_flow_key(struct flowi4 *fl4, const struct sock *sk) { const struct inet_sock *inet = inet_sk(sk); const struct ip_options_rcu *inet_opt; __be32 daddr = inet->inet_daddr; rcu_read_lock(); inet_opt = rcu_dereference(inet->inet_opt); if (inet_opt && inet_opt->opt.srr) daddr = inet_opt->opt.faddr; flowi4_init_output(fl4, sk->sk_bound_dev_if, sk->sk_mark, RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, inet->hdrincl ? IPPROTO_RAW : sk->sk_protocol, inet_sk_flowi_flags(sk), daddr, inet->inet_saddr, 0, 0); rcu_read_unlock(); } static void <API key>(struct flowi4 *fl4, const struct sock *sk, const struct sk_buff *skb) { if (skb) build_skb_flow_key(fl4, skb, sk); else build_sk_flow_key(fl4, sk); } static inline void rt_free(struct rtable *rt) { call_rcu(&rt->dst.rcu_head, dst_rcu_free); } static DEFINE_SPINLOCK(fnhe_lock); static void fnhe_flush_routes(struct fib_nh_exception *fnhe) { struct rtable *rt; rt = rcu_dereference(fnhe->fnhe_rth_input); if (rt) { RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL); rt_free(rt); } rt = rcu_dereference(fnhe->fnhe_rth_output); if (rt) { RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL); rt_free(rt); } } static struct fib_nh_exception *fnhe_oldest(struct fnhe_hash_bucket *hash) { struct fib_nh_exception *fnhe, *oldest; oldest = rcu_dereference(hash->chain); for (fnhe = rcu_dereference(oldest->fnhe_next); fnhe; fnhe = rcu_dereference(fnhe->fnhe_next)) { if (time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp)) oldest = fnhe; } fnhe_flush_routes(oldest); return oldest; } static inline u32 fnhe_hashfun(__be32 daddr) { static u32 fnhe_hashrnd __read_mostly; u32 hval; net_get_random_once(&fnhe_hashrnd, sizeof(fnhe_hashrnd)); hval = jhash_1word((__force u32) daddr, fnhe_hashrnd); return hash_32(hval, FNHE_HASH_SHIFT); } static void <API key>(struct rtable *rt, struct fib_nh_exception *fnhe) { rt->rt_pmtu = fnhe->fnhe_pmtu; rt->dst.expires = fnhe->fnhe_expires; if (fnhe->fnhe_gw) { rt->rt_flags |= RTCF_REDIRECTED; rt->rt_gateway = fnhe->fnhe_gw; rt->rt_uses_gateway = 1; } } static void <API key>(struct fib_nh *nh, __be32 daddr, __be32 gw, u32 pmtu, unsigned long expires) { struct fnhe_hash_bucket *hash; struct fib_nh_exception *fnhe; struct rtable *rt; unsigned int i; int depth; u32 hval = fnhe_hashfun(daddr); spin_lock_bh(&fnhe_lock); hash = rcu_dereference(nh->nh_exceptions); if (!hash) { hash = kzalloc(FNHE_HASH_SIZE * sizeof(*hash), GFP_ATOMIC); if (!hash) goto out_unlock; rcu_assign_pointer(nh->nh_exceptions, hash); } hash += hval; depth = 0; for (fnhe = rcu_dereference(hash->chain); fnhe; fnhe = rcu_dereference(fnhe->fnhe_next)) { if (fnhe->fnhe_daddr == daddr) break; depth++; } if (fnhe) { if (gw) fnhe->fnhe_gw = gw; if (pmtu) { fnhe->fnhe_pmtu = pmtu; fnhe->fnhe_expires = max(1UL, expires); } /* Update all cached dsts too */ rt = rcu_dereference(fnhe->fnhe_rth_input); if (rt) <API key>(rt, fnhe); rt = rcu_dereference(fnhe->fnhe_rth_output); if (rt) <API key>(rt, fnhe); } else { if (depth > FNHE_RECLAIM_DEPTH) fnhe = fnhe_oldest(hash); else { fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC); if (!fnhe) goto out_unlock; fnhe->fnhe_next = hash->chain; rcu_assign_pointer(hash->chain, fnhe); } fnhe->fnhe_genid = fnhe_genid(dev_net(nh->nh_dev)); fnhe->fnhe_daddr = daddr; fnhe->fnhe_gw = gw; fnhe->fnhe_pmtu = pmtu; fnhe->fnhe_expires = expires; /* Exception created; mark the cached routes for the nexthop * stale, so anyone caching it rechecks if this exception * applies to them. */ rt = rcu_dereference(nh->nh_rth_input); if (rt) rt->dst.obsolete = DST_OBSOLETE_KILL; <API key>(i) { struct rtable __rcu **prt; prt = per_cpu_ptr(nh->nh_pcpu_rth_output, i); rt = rcu_dereference(*prt); if (rt) rt->dst.obsolete = DST_OBSOLETE_KILL; } } fnhe->fnhe_stamp = jiffies; out_unlock: spin_unlock_bh(&fnhe_lock); } static void __ip_do_redirect(struct rtable *rt, struct sk_buff *skb, struct flowi4 *fl4, bool kill_route) { __be32 new_gw = icmp_hdr(skb)->un.gateway; __be32 old_gw = ip_hdr(skb)->saddr; struct net_device *dev = skb->dev; struct in_device *in_dev; struct fib_result res; struct neighbour *n; struct net *net; switch (icmp_hdr(skb)->code & 7) { case ICMP_REDIR_NET: case ICMP_REDIR_NETTOS: case ICMP_REDIR_HOST: case ICMP_REDIR_HOSTTOS: break; default: return; } if (rt->rt_gateway != old_gw) return; in_dev = __in_dev_get_rcu(dev); if (!in_dev) return; net = dev_net(dev); if (new_gw == old_gw || !IN_DEV_RX_REDIRECTS(in_dev) || ipv4_is_multicast(new_gw) || ipv4_is_lbcast(new_gw) || ipv4_is_zeronet(new_gw)) goto reject_redirect; if (!IN_DEV_SHARED_MEDIA(in_dev)) { if (!inet_addr_onlink(in_dev, new_gw, old_gw)) goto reject_redirect; if (<API key>(in_dev) && <API key>(new_gw, dev)) goto reject_redirect; } else { if (inet_addr_type(net, new_gw) != RTN_UNICAST) goto reject_redirect; } n = ipv4_neigh_lookup(&rt->dst, NULL, &new_gw); if (!IS_ERR(n)) { if (!(n->nud_state & NUD_VALID)) { neigh_event_send(n, NULL); } else { if (fib_lookup(net, fl4, &res) == 0) { struct fib_nh *nh = &FIB_RES_NH(res); <API key>(nh, fl4->daddr, new_gw, 0, 0); } if (kill_route) rt->dst.obsolete = DST_OBSOLETE_KILL; <API key>(<API key>, n); } neigh_release(n); } return; reject_redirect: #ifdef <API key> if (IN_DEV_LOG_MARTIANS(in_dev)) { const struct iphdr *iph = (const struct iphdr *) skb->data; __be32 daddr = iph->daddr; __be32 saddr = iph->saddr; <API key>("Redirect from %pI4 on %s about %pI4 ignored\n" " Advised path = %pI4 -> %pI4\n", &old_gw, dev->name, &new_gw, &saddr, &daddr); } #endif ; } static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb) { struct rtable *rt; struct flowi4 fl4; const struct iphdr *iph = (const struct iphdr *) skb->data; int oif = skb->dev->ifindex; u8 tos = RT_TOS(iph->tos); u8 prot = iph->protocol; u32 mark = skb->mark; rt = (struct rtable *) dst; __build_flow_key(&fl4, sk, iph, oif, tos, prot, mark, 0); __ip_do_redirect(rt, skb, &fl4, true); } static struct dst_entry *<API key>(struct dst_entry *dst) { struct rtable *rt = (struct rtable *)dst; struct dst_entry *ret = dst; if (rt) { if (dst->obsolete > 0) { ip_rt_put(rt); ret = NULL; } else if ((rt->rt_flags & RTCF_REDIRECTED) || rt->dst.expires) { ip_rt_put(rt); ret = NULL; } } return ret; } /* * Algorithm: * 1. The first <API key> redirects are sent * with exponential backoff, then we stop sending them at all, * assuming that the host ignores our redirects. * 2. If we did not see packets requiring redirects * during <API key>, we assume that the host * forgot redirected route and start to send redirects again. * * This algorithm is much cheaper and more intelligent than dumb load limiting * in icmp.c. * * NOTE. Do not forget to inhibit load limiting for redirects (redundant) * and "frag. need" (breaks PMTU discovery) in icmp.c. */ void ip_rt_send_redirect(struct sk_buff *skb) { struct rtable *rt = skb_rtable(skb); struct in_device *in_dev; struct inet_peer *peer; struct net *net; int log_martians; rcu_read_lock(); in_dev = __in_dev_get_rcu(rt->dst.dev); if (!in_dev || !IN_DEV_TX_REDIRECTS(in_dev)) { rcu_read_unlock(); return; } log_martians = IN_DEV_LOG_MARTIANS(in_dev); rcu_read_unlock(); net = dev_net(rt->dst.dev); peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr, 1); if (!peer) { icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, rt_nexthop(rt, ip_hdr(skb)->daddr)); return; } /* No redirected packets during <API key>; * reset the algorithm. */ if (time_after(jiffies, peer->rate_last + <API key>)) peer->rate_tokens = 0; /* Too many ignored redirects; do not send anything * set dst.rate_last to the last seen redirected packet. */ if (peer->rate_tokens >= <API key>) { peer->rate_last = jiffies; goto out_put_peer; } /* Check for load limit; set rate_last to the latest sent * redirect. */ if (peer->rate_tokens == 0 || time_after(jiffies, (peer->rate_last + (ip_rt_redirect_load << peer->rate_tokens)))) { __be32 gw = rt_nexthop(rt, ip_hdr(skb)->daddr); icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, gw); peer->rate_last = jiffies; ++peer->rate_tokens; #ifdef <API key> if (log_martians && peer->rate_tokens == <API key>) <API key>("host %pI4/if%d ignores redirects for %pI4 to %pI4\n", &ip_hdr(skb)->saddr, inet_iif(skb), &ip_hdr(skb)->daddr, &gw); #endif } out_put_peer: inet_putpeer(peer); } static int ip_error(struct sk_buff *skb) { struct in_device *in_dev = __in_dev_get_rcu(skb->dev); struct rtable *rt = skb_rtable(skb); struct inet_peer *peer; unsigned long now; struct net *net; bool send; int code; net = dev_net(rt->dst.dev); if (!IN_DEV_FORWARD(in_dev)) { switch (rt->dst.error) { case EHOSTUNREACH: IP_INC_STATS_BH(net, <API key>); break; case ENETUNREACH: IP_INC_STATS_BH(net, <API key>); break; } goto out; } switch (rt->dst.error) { case EINVAL: default: goto out; case EHOSTUNREACH: code = ICMP_HOST_UNREACH; break; case ENETUNREACH: code = ICMP_NET_UNREACH; IP_INC_STATS_BH(net, <API key>); break; case EACCES: code = ICMP_PKT_FILTERED; break; } peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr, 1); send = true; if (peer) { now = jiffies; peer->rate_tokens += now - peer->rate_last; if (peer->rate_tokens > ip_rt_error_burst) peer->rate_tokens = ip_rt_error_burst; peer->rate_last = now; if (peer->rate_tokens >= ip_rt_error_cost) peer->rate_tokens -= ip_rt_error_cost; else send = false; inet_putpeer(peer); } if (send) icmp_send(skb, ICMP_DEST_UNREACH, code, 0); out: kfree_skb(skb); return 0; } static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu) { struct dst_entry *dst = &rt->dst; struct fib_result res; if (dst_metric_locked(dst, RTAX_MTU)) return; if (dst->dev->mtu < mtu) return; if (mtu < ip_rt_min_pmtu) mtu = ip_rt_min_pmtu; if (rt->rt_pmtu == mtu && time_before(jiffies, dst->expires - ip_rt_mtu_expires / 2)) return; rcu_read_lock(); if (fib_lookup(dev_net(dst->dev), fl4, &res) == 0) { struct fib_nh *nh = &FIB_RES_NH(res); <API key>(nh, fl4->daddr, 0, mtu, jiffies + ip_rt_mtu_expires); } rcu_read_unlock(); } static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb, u32 mtu) { struct rtable *rt = (struct rtable *) dst; struct flowi4 fl4; <API key>(&fl4, sk, skb); __ip_rt_update_pmtu(rt, &fl4, mtu); } void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu, int oif, u32 mark, u8 protocol, int flow_flags) { const struct iphdr *iph = (const struct iphdr *) skb->data; struct flowi4 fl4; struct rtable *rt; if (!mark) mark = IP4_REPLY_MARK(net, skb->mark); __build_flow_key(&fl4, NULL, iph, oif, RT_TOS(iph->tos), protocol, mark, flow_flags); rt = <API key>(net, &fl4); if (!IS_ERR(rt)) { __ip_rt_update_pmtu(rt, &fl4, mtu); ip_rt_put(rt); } } EXPORT_SYMBOL_GPL(ipv4_update_pmtu); static void <API key>(struct sk_buff *skb, struct sock *sk, u32 mtu) { const struct iphdr *iph = (const struct iphdr *) skb->data; struct flowi4 fl4; struct rtable *rt; __build_flow_key(&fl4, sk, iph, 0, 0, 0, 0, 0); if (!fl4.flowi4_mark) fl4.flowi4_mark = IP4_REPLY_MARK(sock_net(sk), skb->mark); rt = <API key>(sock_net(sk), &fl4); if (!IS_ERR(rt)) { __ip_rt_update_pmtu(rt, &fl4, mtu); ip_rt_put(rt); } } void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) { const struct iphdr *iph = (const struct iphdr *) skb->data; struct flowi4 fl4; struct rtable *rt; struct dst_entry *odst = NULL; bool new = false; bh_lock_sock(sk); if (!ip_sk_accept_pmtu(sk)) goto out; odst = sk_dst_get(sk); if (sock_owned_by_user(sk) || !odst) { <API key>(skb, sk, mtu); goto out; } __build_flow_key(&fl4, sk, iph, 0, 0, 0, 0, 0); rt = (struct rtable *)odst; if (odst->obsolete && odst->ops->check(odst, 0) == NULL) { rt = <API key>(sock_net(sk), &fl4, sk); if (IS_ERR(rt)) goto out; new = true; } __ip_rt_update_pmtu((struct rtable *) rt->dst.path, &fl4, mtu); if (!dst_check(&rt->dst, 0)) { if (new) dst_release(&rt->dst); rt = <API key>(sock_net(sk), &fl4, sk); if (IS_ERR(rt)) goto out; new = true; } if (new) sk_dst_set(sk, &rt->dst); out: bh_unlock_sock(sk); dst_release(odst); } EXPORT_SYMBOL_GPL(ipv4_sk_update_pmtu); void ipv4_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark, u8 protocol, int flow_flags) { const struct iphdr *iph = (const struct iphdr *) skb->data; struct flowi4 fl4; struct rtable *rt; __build_flow_key(&fl4, NULL, iph, oif, RT_TOS(iph->tos), protocol, mark, flow_flags); rt = <API key>(net, &fl4); if (!IS_ERR(rt)) { __ip_do_redirect(rt, skb, &fl4, false); ip_rt_put(rt); } } EXPORT_SYMBOL_GPL(ipv4_redirect); void ipv4_sk_redirect(struct sk_buff *skb, struct sock *sk) { const struct iphdr *iph = (const struct iphdr *) skb->data; struct flowi4 fl4; struct rtable *rt; __build_flow_key(&fl4, sk, iph, 0, 0, 0, 0, 0); rt = <API key>(sock_net(sk), &fl4); if (!IS_ERR(rt)) { __ip_do_redirect(rt, skb, &fl4, false); ip_rt_put(rt); } } EXPORT_SYMBOL_GPL(ipv4_sk_redirect); static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) { struct rtable *rt = (struct rtable *) dst; /* All IPV4 dsts are created with ->obsolete set to the value * <API key> which forces validation calls down * into this function always. * * When a PMTU/redirect information update invalidates a route, * this is indicated by setting obsolete to DST_OBSOLETE_KILL or * DST_OBSOLETE_DEAD by dst_free(). */ if (dst->obsolete != <API key> || rt_is_expired(rt)) return NULL; return dst; } static void ipv4_link_failure(struct sk_buff *skb) { struct rtable *rt; icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0); rt = skb_rtable(skb); if (rt) dst_set_expires(&rt->dst, 0); } static int ip_rt_bug(struct sock *sk, struct sk_buff *skb) { pr_debug("%s: %pI4 -> %pI4, %s\n", __func__, &ip_hdr(skb)->saddr, &ip_hdr(skb)->daddr, skb->dev ? skb->dev->name : "?"); kfree_skb(skb); WARN_ON(1); return 0; } /* We do not cache source address of outgoing interface, because it is used only by IP RR, TS and SRR options, so that it out of fast path. BTW remember: "addr" is allowed to be not aligned in IP options! */ void ip_rt_get_source(u8 *addr, struct sk_buff *skb, struct rtable *rt) { __be32 src; if (rt_is_output_route(rt)) src = ip_hdr(skb)->saddr; else { struct fib_result res; struct flowi4 fl4; struct iphdr *iph; iph = ip_hdr(skb); memset(&fl4, 0, sizeof(fl4)); fl4.daddr = iph->daddr; fl4.saddr = iph->saddr; fl4.flowi4_tos = RT_TOS(iph->tos); fl4.flowi4_oif = rt->dst.dev->ifindex; fl4.flowi4_iif = skb->dev->ifindex; fl4.flowi4_mark = skb->mark; rcu_read_lock(); if (fib_lookup(dev_net(rt->dst.dev), &fl4, &res) == 0) src = FIB_RES_PREFSRC(dev_net(rt->dst.dev), res); else src = inet_select_addr(rt->dst.dev, rt_nexthop(rt, iph->daddr), RT_SCOPE_UNIVERSE); rcu_read_unlock(); } memcpy(addr, &src, 4); } #ifdef <API key> static void set_class_tag(struct rtable *rt, u32 tag) { if (!(rt->dst.tclassid & 0xFFFF)) rt->dst.tclassid |= tag & 0xFFFF; if (!(rt->dst.tclassid & 0xFFFF0000)) rt->dst.tclassid |= tag & 0xFFFF0000; } #endif static unsigned int ipv4_default_advmss(const struct dst_entry *dst) { unsigned int advmss = dst_metric_raw(dst, RTAX_ADVMSS); if (advmss == 0) { advmss = max_t(unsigned int, dst->dev->mtu - 40, ip_rt_min_advmss); if (advmss > 65535 - 40) advmss = 65535 - 40; } return advmss; } static unsigned int ipv4_mtu(const struct dst_entry *dst) { const struct rtable *rt = (const struct rtable *) dst; unsigned int mtu = rt->rt_pmtu; if (!mtu || time_after_eq(jiffies, rt->dst.expires)) mtu = dst_metric_raw(dst, RTAX_MTU); if (mtu) return mtu; mtu = dst->dev->mtu; if (unlikely(dst_metric_locked(dst, RTAX_MTU))) { if (rt->rt_uses_gateway && mtu > 576) mtu = 576; } return min_t(unsigned int, mtu, IP_MAX_MTU); } static struct fib_nh_exception *find_exception(struct fib_nh *nh, __be32 daddr) { struct fnhe_hash_bucket *hash = rcu_dereference(nh->nh_exceptions); struct fib_nh_exception *fnhe; u32 hval; if (!hash) return NULL; hval = fnhe_hashfun(daddr); for (fnhe = rcu_dereference(hash[hval].chain); fnhe; fnhe = rcu_dereference(fnhe->fnhe_next)) { if (fnhe->fnhe_daddr == daddr) return fnhe; } return NULL; } static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe, __be32 daddr) { bool ret = false; spin_lock_bh(&fnhe_lock); if (daddr == fnhe->fnhe_daddr) { struct rtable __rcu **porig; struct rtable *orig; int genid = fnhe_genid(dev_net(rt->dst.dev)); if (rt_is_input_route(rt)) porig = &fnhe->fnhe_rth_input; else porig = &fnhe->fnhe_rth_output; orig = rcu_dereference(*porig); if (fnhe->fnhe_genid != genid) { fnhe->fnhe_genid = genid; fnhe->fnhe_gw = 0; fnhe->fnhe_pmtu = 0; fnhe->fnhe_expires = 0; fnhe_flush_routes(fnhe); orig = NULL; } <API key>(rt, fnhe); if (!rt->rt_gateway) rt->rt_gateway = daddr; if (!(rt->dst.flags & DST_NOCACHE)) { rcu_assign_pointer(*porig, rt); if (orig) rt_free(orig); ret = true; } fnhe->fnhe_stamp = jiffies; } spin_unlock_bh(&fnhe_lock); return ret; } static bool rt_cache_route(struct fib_nh *nh, struct rtable *rt) { struct rtable *orig, *prev, **p; bool ret = true; if (rt_is_input_route(rt)) { p = (struct rtable **)&nh->nh_rth_input; } else { p = (struct rtable **)raw_cpu_ptr(nh->nh_pcpu_rth_output); } orig = *p; prev = cmpxchg(p, orig, rt); if (prev == orig) { if (orig) rt_free(orig); } else ret = false; return ret; } static DEFINE_SPINLOCK(rt_uncached_lock); static LIST_HEAD(rt_uncached_list); static void <API key>(struct rtable *rt) { spin_lock_bh(&rt_uncached_lock); list_add_tail(&rt->rt_uncached, &rt_uncached_list); spin_unlock_bh(&rt_uncached_lock); } static void ipv4_dst_destroy(struct dst_entry *dst) { struct rtable *rt = (struct rtable *) dst; if (!list_empty(&rt->rt_uncached)) { spin_lock_bh(&rt_uncached_lock); list_del(&rt->rt_uncached); spin_unlock_bh(&rt_uncached_lock); } } void rt_flush_dev(struct net_device *dev) { if (!list_empty(&rt_uncached_list)) { struct net *net = dev_net(dev); struct rtable *rt; spin_lock_bh(&rt_uncached_lock); list_for_each_entry(rt, &rt_uncached_list, rt_uncached) { if (rt->dst.dev != dev) continue; rt->dst.dev = net->loopback_dev; dev_hold(rt->dst.dev); dev_put(dev); } spin_unlock_bh(&rt_uncached_lock); } } static bool rt_cache_valid(const struct rtable *rt) { return rt && rt->dst.obsolete == <API key> && !rt_is_expired(rt); } static void rt_set_nexthop(struct rtable *rt, __be32 daddr, const struct fib_result *res, struct fib_nh_exception *fnhe, struct fib_info *fi, u16 type, u32 itag) { bool cached = false; if (fi) { struct fib_nh *nh = &FIB_RES_NH(*res); if (nh->nh_gw && nh->nh_scope == RT_SCOPE_LINK) { rt->rt_gateway = nh->nh_gw; rt->rt_uses_gateway = 1; } dst_init_metrics(&rt->dst, fi->fib_metrics, true); #ifdef <API key> rt->dst.tclassid = nh->nh_tclassid; #endif if (unlikely(fnhe)) cached = rt_bind_exception(rt, fnhe, daddr); else if (!(rt->dst.flags & DST_NOCACHE)) cached = rt_cache_route(nh, rt); if (unlikely(!cached)) { /* Routes we intend to cache in nexthop exception or * FIB nexthop have the DST_NOCACHE bit clear. * However, if we are unsuccessful at storing this * route into the cache we really need to set it. */ rt->dst.flags |= DST_NOCACHE; if (!rt->rt_gateway) rt->rt_gateway = daddr; <API key>(rt); } } else <API key>(rt); #ifdef <API key> #ifdef <API key> set_class_tag(rt, res->tclassid); #endif set_class_tag(rt, itag); #endif } static struct rtable *rt_dst_alloc(struct net_device *dev, bool nopolicy, bool noxfrm, bool will_cache) { return dst_alloc(&ipv4_dst_ops, dev, 1, <API key>, (will_cache ? 0 : (DST_HOST | DST_NOCACHE)) | (nopolicy ? DST_NOPOLICY : 0) | (noxfrm ? DST_NOXFRM : 0)); } /* called in rcu_read_lock() section */ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, u8 tos, struct net_device *dev, int our) { struct rtable *rth; struct in_device *in_dev = __in_dev_get_rcu(dev); u32 itag = 0; int err; /* Primary sanity checks. */ if (in_dev == NULL) return -EINVAL; if (ipv4_is_multicast(saddr) || ipv4_is_lbcast(saddr) || skb->protocol != htons(ETH_P_IP)) goto e_inval; if (likely(!<API key>(in_dev))) if (ipv4_is_loopback(saddr)) goto e_inval; if (ipv4_is_zeronet(saddr)) { if (!<API key>(daddr)) goto e_inval; } else { err = fib_validate_source(skb, saddr, 0, tos, 0, dev, in_dev, &itag); if (err < 0) goto e_err; } rth = rt_dst_alloc(dev_net(dev)->loopback_dev, IN_DEV_CONF_GET(in_dev, NOPOLICY), false, false); if (!rth) goto e_nobufs; #ifdef <API key> rth->dst.tclassid = itag; #endif rth->dst.output = ip_rt_bug; rth->rt_genid = rt_genid_ipv4(dev_net(dev)); rth->rt_flags = RTCF_MULTICAST; rth->rt_type = RTN_MULTICAST; rth->rt_is_input= 1; rth->rt_iif = 0; rth->rt_pmtu = 0; rth->rt_gateway = 0; rth->rt_uses_gateway = 0; INIT_LIST_HEAD(&rth->rt_uncached); if (our) { rth->dst.input= ip_local_deliver; rth->rt_flags |= RTCF_LOCAL; } #ifdef CONFIG_IP_MROUTE if (!<API key>(daddr) && IN_DEV_MFORWARD(in_dev)) rth->dst.input = ip_mr_input; #endif RT_CACHE_STAT_INC(in_slow_mc); skb_dst_set(skb, &rth->dst); return 0; e_nobufs: return -ENOBUFS; e_inval: return -EINVAL; e_err: return err; } static void <API key>(struct net_device *dev, struct in_device *in_dev, struct sk_buff *skb, __be32 daddr, __be32 saddr) { RT_CACHE_STAT_INC(in_martian_src); #ifdef <API key> if (IN_DEV_LOG_MARTIANS(in_dev) && net_ratelimit()) { /* * RFC1812 recommendation, if source is martian, * the only hint is MAC header. */ pr_warn("martian source %pI4 from %pI4, on dev %s\n", &daddr, &saddr, dev->name); if (dev->hard_header_len && <API key>(skb)) { print_hex_dump(KERN_WARNING, "ll header: ", DUMP_PREFIX_OFFSET, 16, 1, skb_mac_header(skb), dev->hard_header_len, true); } } #endif } /* called in rcu_read_lock() section */ static int __mkroute_input(struct sk_buff *skb, const struct fib_result *res, struct in_device *in_dev, __be32 daddr, __be32 saddr, u32 tos) { struct fib_nh_exception *fnhe; struct rtable *rth; int err; struct in_device *out_dev; unsigned int flags = 0; bool do_cache; u32 itag = 0; /* get a working reference to the output device */ out_dev = __in_dev_get_rcu(FIB_RES_DEV(*res)); if (out_dev == NULL) { <API key>("Bug in ip_route_input_slow(). Please report.\n"); return -EINVAL; } err = fib_validate_source(skb, saddr, daddr, tos, FIB_RES_OIF(*res), in_dev->dev, in_dev, &itag); if (err < 0) { <API key>(in_dev->dev, in_dev, skb, daddr, saddr); goto cleanup; } do_cache = res->fi && !itag; if (out_dev == in_dev && err && IN_DEV_TX_REDIRECTS(out_dev) && (IN_DEV_SHARED_MEDIA(out_dev) || inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res)))) { flags |= RTCF_DOREDIRECT; do_cache = false; } if (skb->protocol != htons(ETH_P_IP)) { /* Not IP (i.e. ARP). Do not create route, if it is * invalid for proxy arp. DNAT routes are always valid. * * Proxy arp feature have been extended to allow, ARP * replies back to the same interface, to support * Private VLAN switch technologies. See arp.c. */ if (out_dev == in_dev && <API key>(in_dev) == 0) { err = -EINVAL; goto cleanup; } } fnhe = find_exception(&FIB_RES_NH(*res), daddr); if (do_cache) { if (fnhe != NULL) rth = rcu_dereference(fnhe->fnhe_rth_input); else rth = rcu_dereference(FIB_RES_NH(*res).nh_rth_input); if (rt_cache_valid(rth)) { skb_dst_set_noref(skb, &rth->dst); goto out; } } rth = rt_dst_alloc(out_dev->dev, IN_DEV_CONF_GET(in_dev, NOPOLICY), IN_DEV_CONF_GET(out_dev, NOXFRM), do_cache); if (!rth) { err = -ENOBUFS; goto cleanup; } rth->rt_genid = rt_genid_ipv4(dev_net(rth->dst.dev)); rth->rt_flags = flags; rth->rt_type = res->type; rth->rt_is_input = 1; rth->rt_iif = 0; rth->rt_pmtu = 0; rth->rt_gateway = 0; rth->rt_uses_gateway = 0; INIT_LIST_HEAD(&rth->rt_uncached); RT_CACHE_STAT_INC(in_slow_tot); rth->dst.input = ip_forward; rth->dst.output = ip_output; rt_set_nexthop(rth, daddr, res, fnhe, res->fi, res->type, itag); skb_dst_set(skb, &rth->dst); out: err = 0; cleanup: return err; } static int ip_mkroute_input(struct sk_buff *skb, struct fib_result *res, const struct flowi4 *fl4, struct in_device *in_dev, __be32 daddr, __be32 saddr, u32 tos) { #ifdef <API key> if (res->fi && res->fi->fib_nhs > 1) <API key>(res); #endif /* create a routing cache entry */ return __mkroute_input(skb, res, in_dev, daddr, saddr, tos); } /* * NOTE. We drop all the packets that has local source * addresses, because every properly looped back packet * must have correct destination already attached by output routine. * * Such approach solves two big problems: * 1. Not simplex devices are handled properly. * 2. IP spoofing attempts are filtered with 100% of guarantee. * called with rcu_read_lock() */ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, u8 tos, struct net_device *dev) { struct fib_result res; struct in_device *in_dev = __in_dev_get_rcu(dev); struct flowi4 fl4; unsigned int flags = 0; u32 itag = 0; struct rtable *rth; int err = -EINVAL; struct net *net = dev_net(dev); bool do_cache; /* IP on this device is disabled. */ if (!in_dev) goto out; /* Check for the most weird martians, which can be not detected by fib_lookup. */ if (ipv4_is_multicast(saddr) || ipv4_is_lbcast(saddr)) goto martian_source; res.fi = NULL; if (ipv4_is_lbcast(daddr) || (saddr == 0 && daddr == 0)) goto brd_input; /* Accept zero addresses only to limited broadcast; * I even do not know to fix it or not. Waiting for complains :-) */ if (ipv4_is_zeronet(saddr)) goto martian_source; if (ipv4_is_zeronet(daddr)) goto martian_destination; /* Following code try to avoid calling <API key>(), * and call it once if daddr or/and saddr are loopback addresses */ if (ipv4_is_loopback(daddr)) { if (!<API key>(in_dev, net)) goto martian_destination; } else if (ipv4_is_loopback(saddr)) { if (!<API key>(in_dev, net)) goto martian_source; } /* * Now we are ready to route packet. */ fl4.flowi4_oif = 0; fl4.flowi4_iif = dev->ifindex; fl4.flowi4_mark = skb->mark; fl4.flowi4_tos = tos; fl4.flowi4_scope = RT_SCOPE_UNIVERSE; fl4.daddr = daddr; fl4.saddr = saddr; err = fib_lookup(net, &fl4, &res); if (err != 0) { if (!IN_DEV_FORWARD(in_dev)) err = -EHOSTUNREACH; goto no_route; } if (res.type == RTN_BROADCAST) goto brd_input; if (res.type == RTN_LOCAL) { err = fib_validate_source(skb, saddr, daddr, tos, 0, dev, in_dev, &itag); if (err < 0) goto <API key>; goto local_input; } if (!IN_DEV_FORWARD(in_dev)) { err = -EHOSTUNREACH; goto no_route; } if (res.type != RTN_UNICAST) goto martian_destination; err = ip_mkroute_input(skb, &res, &fl4, in_dev, daddr, saddr, tos); out: return err; brd_input: if (skb->protocol != htons(ETH_P_IP)) goto e_inval; if (!ipv4_is_zeronet(saddr)) { err = fib_validate_source(skb, saddr, 0, tos, 0, dev, in_dev, &itag); if (err < 0) goto <API key>; } flags |= RTCF_BROADCAST; res.type = RTN_BROADCAST; RT_CACHE_STAT_INC(in_brd); local_input: do_cache = false; if (res.fi) { if (!itag) { rth = rcu_dereference(FIB_RES_NH(res).nh_rth_input); if (rt_cache_valid(rth)) { skb_dst_set_noref(skb, &rth->dst); err = 0; goto out; } do_cache = true; } } rth = rt_dst_alloc(net->loopback_dev, IN_DEV_CONF_GET(in_dev, NOPOLICY), false, do_cache); if (!rth) goto e_nobufs; rth->dst.input= ip_local_deliver; rth->dst.output= ip_rt_bug; #ifdef <API key> rth->dst.tclassid = itag; #endif rth->rt_genid = rt_genid_ipv4(net); rth->rt_flags = flags|RTCF_LOCAL; rth->rt_type = res.type; rth->rt_is_input = 1; rth->rt_iif = 0; rth->rt_pmtu = 0; rth->rt_gateway = 0; rth->rt_uses_gateway = 0; INIT_LIST_HEAD(&rth->rt_uncached); RT_CACHE_STAT_INC(in_slow_tot); if (res.type == RTN_UNREACHABLE) { rth->dst.input= ip_error; rth->dst.error= -err; rth->rt_flags &= ~RTCF_LOCAL; } if (do_cache) { if (unlikely(!rt_cache_route(&FIB_RES_NH(res), rth))) { rth->dst.flags |= DST_NOCACHE; <API key>(rth); } } skb_dst_set(skb, &rth->dst); err = 0; goto out; no_route: RT_CACHE_STAT_INC(in_no_route); res.type = RTN_UNREACHABLE; goto local_input; /* * Do not cache martian addresses: they should be logged (RFC1812) */ martian_destination: RT_CACHE_STAT_INC(in_martian_dst); #ifdef <API key> if (IN_DEV_LOG_MARTIANS(in_dev)) <API key>("martian destination %pI4 from %pI4, dev %s\n", &daddr, &saddr, dev->name); #endif e_inval: err = -EINVAL; goto out; e_nobufs: err = -ENOBUFS; goto out; martian_source: err = -EINVAL; <API key>: <API key>(dev, in_dev, skb, daddr, saddr); goto out; } int <API key>(struct sk_buff *skb, __be32 daddr, __be32 saddr, u8 tos, struct net_device *dev) { int res; rcu_read_lock(); /* Multicast recognition logic is moved from route cache to here. The problem was that too many Ethernet cards have broken/missing hardware multicast filters :-( As result the host on multicasting network acquires a lot of useless route cache entries, sort of SDR messages from all the world. Now we try to get rid of them. Really, provided software IP multicast filter is organized reasonably (at least, hashed), it does not result in a slowdown comparing with route cache reject entries. Note, that multicast routers are not affected, because route cache entry is created eventually. */ if (ipv4_is_multicast(daddr)) { struct in_device *in_dev = __in_dev_get_rcu(dev); if (in_dev) { int our = ip_check_mc_rcu(in_dev, daddr, saddr, ip_hdr(skb)->protocol); if (our #ifdef CONFIG_IP_MROUTE || (!<API key>(daddr) && IN_DEV_MFORWARD(in_dev)) #endif ) { int res = ip_route_input_mc(skb, daddr, saddr, tos, dev, our); rcu_read_unlock(); return res; } } rcu_read_unlock(); return -EINVAL; } res = ip_route_input_slow(skb, daddr, saddr, tos, dev); rcu_read_unlock(); return res; } EXPORT_SYMBOL(<API key>); /* called with rcu_read_lock() */ static struct rtable *__mkroute_output(const struct fib_result *res, const struct flowi4 *fl4, int orig_oif, struct net_device *dev_out, unsigned int flags) { struct fib_info *fi = res->fi; struct fib_nh_exception *fnhe; struct in_device *in_dev; u16 type = res->type; struct rtable *rth; bool do_cache; in_dev = __in_dev_get_rcu(dev_out); if (!in_dev) return ERR_PTR(-EINVAL); if (likely(!<API key>(in_dev))) if (ipv4_is_loopback(fl4->saddr) && !(dev_out->flags & IFF_LOOPBACK)) return ERR_PTR(-EINVAL); if (ipv4_is_lbcast(fl4->daddr)) type = RTN_BROADCAST; else if (ipv4_is_multicast(fl4->daddr)) type = RTN_MULTICAST; else if (ipv4_is_zeronet(fl4->daddr)) return ERR_PTR(-EINVAL); if (dev_out->flags & IFF_LOOPBACK) flags |= RTCF_LOCAL; do_cache = true; if (type == RTN_BROADCAST) { flags |= RTCF_BROADCAST | RTCF_LOCAL; fi = NULL; } else if (type == RTN_MULTICAST) { flags |= RTCF_MULTICAST | RTCF_LOCAL; if (!ip_check_mc_rcu(in_dev, fl4->daddr, fl4->saddr, fl4->flowi4_proto)) flags &= ~RTCF_LOCAL; else do_cache = false; /* If multicast route do not exist use * default one, but do not gateway in this case. * Yes, it is hack. */ if (fi && res->prefixlen < 4) fi = NULL; } fnhe = NULL; do_cache &= fi != NULL; if (do_cache) { struct rtable __rcu **prth; struct fib_nh *nh = &FIB_RES_NH(*res); fnhe = find_exception(nh, fl4->daddr); if (fnhe) prth = &fnhe->fnhe_rth_output; else { if (unlikely(fl4->flowi4_flags & FLOWI_FLAG_KNOWN_NH && !(nh->nh_gw && nh->nh_scope == RT_SCOPE_LINK))) { do_cache = false; goto add; } prth = raw_cpu_ptr(nh->nh_pcpu_rth_output); } rth = rcu_dereference(*prth); if (rt_cache_valid(rth)) { dst_hold(&rth->dst); return rth; } } add: rth = rt_dst_alloc(dev_out, IN_DEV_CONF_GET(in_dev, NOPOLICY), IN_DEV_CONF_GET(in_dev, NOXFRM), do_cache); if (!rth) return ERR_PTR(-ENOBUFS); rth->dst.output = ip_output; rth->rt_genid = rt_genid_ipv4(dev_net(dev_out)); rth->rt_flags = flags; rth->rt_type = type; rth->rt_is_input = 0; rth->rt_iif = orig_oif ? : 0; rth->rt_pmtu = 0; rth->rt_gateway = 0; rth->rt_uses_gateway = 0; INIT_LIST_HEAD(&rth->rt_uncached); RT_CACHE_STAT_INC(out_slow_tot); if (flags & RTCF_LOCAL) rth->dst.input = ip_local_deliver; if (flags & (RTCF_BROADCAST | RTCF_MULTICAST)) { if (flags & RTCF_LOCAL && !(dev_out->flags & IFF_LOOPBACK)) { rth->dst.output = ip_mc_output; RT_CACHE_STAT_INC(out_slow_mc); } #ifdef CONFIG_IP_MROUTE if (type == RTN_MULTICAST) { if (IN_DEV_MFORWARD(in_dev) && !<API key>(fl4->daddr)) { rth->dst.input = ip_mr_input; rth->dst.output = ip_mc_output; } } #endif } rt_set_nexthop(rth, fl4->daddr, res, fnhe, fi, type, 0); return rth; } /* * Major route resolver routine. */ struct rtable *<API key>(struct net *net, struct flowi4 *fl4) { struct net_device *dev_out = NULL; __u8 tos = RT_FL_TOS(fl4); unsigned int flags = 0; struct fib_result res; struct rtable *rth; int orig_oif; res.tclassid = 0; res.fi = NULL; res.table = NULL; orig_oif = fl4->flowi4_oif; fl4->flowi4_iif = LOOPBACK_IFINDEX; fl4->flowi4_tos = tos & IPTOS_RT_MASK; fl4->flowi4_scope = ((tos & RTO_ONLINK) ? RT_SCOPE_LINK : RT_SCOPE_UNIVERSE); rcu_read_lock(); if (fl4->saddr) { rth = ERR_PTR(-EINVAL); if (ipv4_is_multicast(fl4->saddr) || ipv4_is_lbcast(fl4->saddr) || ipv4_is_zeronet(fl4->saddr)) goto out; /* I removed check for oif == dev_out->oif here. It was wrong for two reasons: 1. ip_dev_find(net, saddr) can return wrong iface, if saddr is assigned to multiple interfaces. 2. Moreover, we are allowed to send packets with saddr of another iface. --ANK */ if (fl4->flowi4_oif == 0 && (ipv4_is_multicast(fl4->daddr) || ipv4_is_lbcast(fl4->daddr))) { /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */ dev_out = __ip_dev_find(net, fl4->saddr, false); if (dev_out == NULL) goto out; /* Special hack: user can direct multicasts and limited broadcast via necessary interface without fiddling with IP_MULTICAST_IF or IP_PKTINFO. This hack is not just for fun, it allows vic,vat and friends to work. They bind socket to loopback, set ttl to zero and expect that it will work. From the viewpoint of routing cache they are broken, because we are not allowed to build multicast path with loopback source addr (look, routing cache cannot know, that ttl is zero, so that packet will not leave this host and route is valid). Luckily, this hack is good workaround. */ fl4->flowi4_oif = dev_out->ifindex; goto make_route; } if (!(fl4->flowi4_flags & FLOWI_FLAG_ANYSRC)) { /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */ if (!__ip_dev_find(net, fl4->saddr, false)) goto out; } } if (fl4->flowi4_oif) { dev_out = <API key>(net, fl4->flowi4_oif); rth = ERR_PTR(-ENODEV); if (dev_out == NULL) goto out; /* RACE: Check return value of inet_select_addr instead. */ if (!(dev_out->flags & IFF_UP) || !__in_dev_get_rcu(dev_out)) { rth = ERR_PTR(-ENETUNREACH); goto out; } if (<API key>(fl4->daddr) || ipv4_is_lbcast(fl4->daddr)) { if (!fl4->saddr) fl4->saddr = inet_select_addr(dev_out, 0, RT_SCOPE_LINK); goto make_route; } if (!fl4->saddr) { if (ipv4_is_multicast(fl4->daddr)) fl4->saddr = inet_select_addr(dev_out, 0, fl4->flowi4_scope); else if (!fl4->daddr) fl4->saddr = inet_select_addr(dev_out, 0, RT_SCOPE_HOST); } } if (!fl4->daddr) { fl4->daddr = fl4->saddr; if (!fl4->daddr) fl4->daddr = fl4->saddr = htonl(INADDR_LOOPBACK); dev_out = net->loopback_dev; fl4->flowi4_oif = LOOPBACK_IFINDEX; res.type = RTN_LOCAL; flags |= RTCF_LOCAL; goto make_route; } if (fib_lookup(net, fl4, &res)) { res.fi = NULL; res.table = NULL; if (fl4->flowi4_oif) { /* Apparently, routing tables are wrong. Assume, that the destination is on link. WHY? DW. Because we are allowed to send to iface even if it has NO routes and NO assigned addresses. When oif is specified, routing tables are looked up with only one purpose: to catch if destination is gatewayed, rather than direct. Moreover, if MSG_DONTROUTE is set, we send packet, ignoring both routing tables and ifaddr state. --ANK We could make it even if oif is unknown, likely IPv6, but we do not. */ if (fl4->saddr == 0) fl4->saddr = inet_select_addr(dev_out, 0, RT_SCOPE_LINK); res.type = RTN_UNICAST; goto make_route; } rth = ERR_PTR(-ENETUNREACH); goto out; } if (res.type == RTN_LOCAL) { if (!fl4->saddr) { if (res.fi->fib_prefsrc) fl4->saddr = res.fi->fib_prefsrc; else fl4->saddr = fl4->daddr; } dev_out = net->loopback_dev; fl4->flowi4_oif = dev_out->ifindex; flags |= RTCF_LOCAL; goto make_route; } #ifdef <API key> if (res.fi->fib_nhs > 1 && fl4->flowi4_oif == 0) <API key>(&res); else #endif if (!res.prefixlen && res.table->tb_num_default > 1 && res.type == RTN_UNICAST && !fl4->flowi4_oif) fib_select_default(&res); if (!fl4->saddr) fl4->saddr = FIB_RES_PREFSRC(net, res); dev_out = FIB_RES_DEV(res); fl4->flowi4_oif = dev_out->ifindex; make_route: rth = __mkroute_output(&res, fl4, orig_oif, dev_out, flags); out: rcu_read_unlock(); return rth; } EXPORT_SYMBOL_GPL(<API key>); static struct dst_entry *<API key>(struct dst_entry *dst, u32 cookie) { return NULL; } static unsigned int ipv4_blackhole_mtu(const struct dst_entry *dst) { unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); return mtu ? : dst->dev->mtu; } static void <API key>(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb, u32 mtu) { } static void <API key>(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb) { } static u32 *<API key>(struct dst_entry *dst, unsigned long old) { return NULL; } static struct dst_ops <API key> = { .family = AF_INET, .protocol = cpu_to_be16(ETH_P_IP), .check = <API key>, .mtu = ipv4_blackhole_mtu, .default_advmss = ipv4_default_advmss, .update_pmtu = <API key>, .redirect = <API key>, .cow_metrics = <API key>, .neigh_lookup = ipv4_neigh_lookup, }; struct dst_entry *<API key>(struct net *net, struct dst_entry *dst_orig) { struct rtable *ort = (struct rtable *) dst_orig; struct rtable *rt; rt = dst_alloc(&<API key>, NULL, 1, DST_OBSOLETE_NONE, 0); if (rt) { struct dst_entry *new = &rt->dst; new->__use = 1; new->input = dst_discard; new->output = dst_discard_sk; new->dev = ort->dst.dev; if (new->dev) dev_hold(new->dev); rt->rt_is_input = ort->rt_is_input; rt->rt_iif = ort->rt_iif; rt->rt_pmtu = ort->rt_pmtu; rt->rt_genid = rt_genid_ipv4(net); rt->rt_flags = ort->rt_flags; rt->rt_type = ort->rt_type; rt->rt_gateway = ort->rt_gateway; rt->rt_uses_gateway = ort->rt_uses_gateway; INIT_LIST_HEAD(&rt->rt_uncached); dst_free(new); } dst_release(dst_orig); return rt ? &rt->dst : ERR_PTR(-ENOMEM); } struct rtable *<API key>(struct net *net, struct flowi4 *flp4, struct sock *sk) { struct rtable *rt = <API key>(net, flp4); if (IS_ERR(rt)) return rt; if (flp4->flowi4_proto) rt = (struct rtable *)xfrm_lookup_route(net, &rt->dst, flowi4_to_flowi(flp4), sk, 0); return rt; } EXPORT_SYMBOL_GPL(<API key>); static int rt_fill_info(struct net *net, __be32 dst, __be32 src, struct flowi4 *fl4, struct sk_buff *skb, u32 portid, u32 seq, int event, int nowait, unsigned int flags) { struct rtable *rt = skb_rtable(skb); struct rtmsg *r; struct nlmsghdr *nlh; unsigned long expires = 0; u32 error; u32 metrics[RTAX_MAX]; nlh = nlmsg_put(skb, portid, seq, event, sizeof(*r), flags); if (nlh == NULL) return -EMSGSIZE; r = nlmsg_data(nlh); r->rtm_family = AF_INET; r->rtm_dst_len = 32; r->rtm_src_len = 0; r->rtm_tos = fl4->flowi4_tos; r->rtm_table = RT_TABLE_MAIN; if (nla_put_u32(skb, RTA_TABLE, RT_TABLE_MAIN)) goto nla_put_failure; r->rtm_type = rt->rt_type; r->rtm_scope = RT_SCOPE_UNIVERSE; r->rtm_protocol = RTPROT_UNSPEC; r->rtm_flags = (rt->rt_flags & ~0xFFFF) | RTM_F_CLONED; if (rt->rt_flags & RTCF_NOTIFY) r->rtm_flags |= RTM_F_NOTIFY; if (nla_put_be32(skb, RTA_DST, dst)) goto nla_put_failure; if (src) { r->rtm_src_len = 32; if (nla_put_be32(skb, RTA_SRC, src)) goto nla_put_failure; } if (rt->dst.dev && nla_put_u32(skb, RTA_OIF, rt->dst.dev->ifindex)) goto nla_put_failure; #ifdef <API key> if (rt->dst.tclassid && nla_put_u32(skb, RTA_FLOW, rt->dst.tclassid)) goto nla_put_failure; #endif if (!rt_is_input_route(rt) && fl4->saddr != src) { if (nla_put_be32(skb, RTA_PREFSRC, fl4->saddr)) goto nla_put_failure; } if (rt->rt_uses_gateway && nla_put_be32(skb, RTA_GATEWAY, rt->rt_gateway)) goto nla_put_failure; expires = rt->dst.expires; if (expires) { unsigned long now = jiffies; if (time_before(now, expires)) expires -= now; else expires = 0; } memcpy(metrics, dst_metrics_ptr(&rt->dst), sizeof(metrics)); if (rt->rt_pmtu && expires) metrics[RTAX_MTU - 1] = rt->rt_pmtu; if (<API key>(skb, metrics) < 0) goto nla_put_failure; if (fl4->flowi4_mark && nla_put_u32(skb, RTA_MARK, fl4->flowi4_mark)) goto nla_put_failure; error = rt->dst.error; if (rt_is_input_route(rt)) { #ifdef CONFIG_IP_MROUTE if (ipv4_is_multicast(dst) && !<API key>(dst) && IPV4_DEVCONF_ALL(net, MC_FORWARDING)) { int err = ipmr_get_route(net, skb, fl4->saddr, fl4->daddr, r, nowait); if (err <= 0) { if (!nowait) { if (err == 0) return 0; goto nla_put_failure; } else { if (err == -EMSGSIZE) goto nla_put_failure; error = err; } } } else #endif if (nla_put_u32(skb, RTA_IIF, skb->dev->ifindex)) goto nla_put_failure; } if (rtnl_put_cacheinfo(skb, &rt->dst, 0, expires, error) < 0) goto nla_put_failure; return nlmsg_end(skb, nlh); nla_put_failure: nlmsg_cancel(skb, nlh); return -EMSGSIZE; } static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh) { struct net *net = sock_net(in_skb->sk); struct rtmsg *rtm; struct nlattr *tb[RTA_MAX+1]; struct rtable *rt = NULL; struct flowi4 fl4; __be32 dst = 0; __be32 src = 0; u32 iif; int err; int mark; struct sk_buff *skb; err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv4_policy); if (err < 0) goto errout; rtm = nlmsg_data(nlh); skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); if (skb == NULL) { err = -ENOBUFS; goto errout; } /* Reserve room for dummy headers, this skb can pass through good chunk of routing engine. */ <API key>(skb); <API key>(skb); /* Bugfix: need to give ip_route_input enough of an IP header to not gag. */ ip_hdr(skb)->protocol = IPPROTO_ICMP; skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr)); src = tb[RTA_SRC] ? nla_get_be32(tb[RTA_SRC]) : 0; dst = tb[RTA_DST] ? nla_get_be32(tb[RTA_DST]) : 0; iif = tb[RTA_IIF] ? nla_get_u32(tb[RTA_IIF]) : 0; mark = tb[RTA_MARK] ? nla_get_u32(tb[RTA_MARK]) : 0; memset(&fl4, 0, sizeof(fl4)); fl4.daddr = dst; fl4.saddr = src; fl4.flowi4_tos = rtm->rtm_tos; fl4.flowi4_oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0; fl4.flowi4_mark = mark; if (iif) { struct net_device *dev; dev = __dev_get_by_index(net, iif); if (dev == NULL) { err = -ENODEV; goto errout_free; } skb->protocol = htons(ETH_P_IP); skb->dev = dev; skb->mark = mark; local_bh_disable(); err = ip_route_input(skb, dst, src, rtm->rtm_tos, dev); local_bh_enable(); rt = skb_rtable(skb); if (err == 0 && rt->dst.error) err = -rt->dst.error; } else { rt = ip_route_output_key(net, &fl4); err = 0; if (IS_ERR(rt)) err = PTR_ERR(rt); } if (err) goto errout_free; skb_dst_set(skb, &rt->dst); if (rtm->rtm_flags & RTM_F_NOTIFY) rt->rt_flags |= RTCF_NOTIFY; err = rt_fill_info(net, dst, src, &fl4, skb, NETLINK_CB(in_skb).portid, nlh->nlmsg_seq, RTM_NEWROUTE, 0, 0); if (err <= 0) goto errout_free; err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid); errout: return err; errout_free: kfree_skb(skb); goto errout; } void <API key>(struct in_device *in_dev) { rt_cache_flush(dev_net(in_dev->dev)); } #ifdef CONFIG_SYSCTL static int ip_rt_gc_timeout __read_mostly = RT_GC_TIMEOUT; static int ip_rt_gc_interval __read_mostly = 60 * HZ; static int <API key> __read_mostly = HZ / 2; static int ip_rt_gc_elasticity __read_mostly = 8; static int <API key>(struct ctl_table *__ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { struct net *net = (struct net *)__ctl->extra1; if (write) { rt_cache_flush(net); fnhe_genid_bump(net); return 0; } return -EINVAL; } static struct ctl_table ipv4_route_table[] = { { .procname = "gc_thresh", .data = &ipv4_dst_ops.gc_thresh, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec, }, { .procname = "max_size", .data = &ip_rt_max_size, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec, }, { /* Deprecated. Use gc_min_interval_ms */ .procname = "gc_min_interval", .data = &<API key>, .maxlen = sizeof(int), .mode = 0644, .proc_handler = <API key>, }, { .procname = "gc_min_interval_ms", .data = &<API key>, .maxlen = sizeof(int), .mode = 0644, .proc_handler = <API key>, }, { .procname = "gc_timeout", .data = &ip_rt_gc_timeout, .maxlen = sizeof(int), .mode = 0644, .proc_handler = <API key>, }, { .procname = "gc_interval", .data = &ip_rt_gc_interval, .maxlen = sizeof(int), .mode = 0644, .proc_handler = <API key>, }, { .procname = "redirect_load", .data = &ip_rt_redirect_load, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec, }, { .procname = "redirect_number", .data = &<API key>, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec, }, { .procname = "redirect_silence", .data = &<API key>, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec, }, { .procname = "error_cost", .data = &ip_rt_error_cost, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec, }, { .procname = "error_burst", .data = &ip_rt_error_burst, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec, }, { .procname = "gc_elasticity", .data = &ip_rt_gc_elasticity, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec, }, { .procname = "mtu_expires", .data = &ip_rt_mtu_expires, .maxlen = sizeof(int), .mode = 0644, .proc_handler = <API key>, }, { .procname = "min_pmtu", .data = &ip_rt_min_pmtu, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec, }, { .procname = "min_adv_mss", .data = &ip_rt_min_advmss, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec, }, { } }; static struct ctl_table <API key>[] = { { .procname = "flush", .maxlen = sizeof(int), .mode = 0200, .proc_handler = <API key>, }, { }, }; static __net_init int <API key>(struct net *net) { struct ctl_table *tbl; tbl = <API key>; if (!net_eq(net, &init_net)) { tbl = kmemdup(tbl, sizeof(<API key>), GFP_KERNEL); if (tbl == NULL) goto err_dup; /* Don't export sysctls to unprivileged users */ if (net->user_ns != &init_user_ns) tbl[0].procname = NULL; } tbl[0].extra1 = net; net->ipv4.route_hdr = register_net_sysctl(net, "net/ipv4/route", tbl); if (net->ipv4.route_hdr == NULL) goto err_reg; return 0; err_reg: if (tbl != <API key>) kfree(tbl); err_dup: return -ENOMEM; } static __net_exit void <API key>(struct net *net) { struct ctl_table *tbl; tbl = net->ipv4.route_hdr->ctl_table_arg; <API key>(net->ipv4.route_hdr); BUG_ON(tbl == <API key>); kfree(tbl); } static __net_initdata struct pernet_operations sysctl_route_ops = { .init = <API key>, .exit = <API key>, }; #endif static __net_init int rt_genid_init(struct net *net) { atomic_set(&net->ipv4.rt_genid, 0); atomic_set(&net->fnhe_genid, 0); get_random_bytes(&net->ipv4.dev_addr_genid, sizeof(net->ipv4.dev_addr_genid)); return 0; } static __net_initdata struct pernet_operations rt_genid_ops = { .init = rt_genid_init, }; static int __net_init ipv4_inetpeer_init(struct net *net) { struct inet_peer_base *bp = kmalloc(sizeof(*bp), GFP_KERNEL); if (!bp) return -ENOMEM; inet_peer_base_init(bp); net->ipv4.peers = bp; return 0; } static void __net_exit ipv4_inetpeer_exit(struct net *net) { struct inet_peer_base *bp = net->ipv4.peers; net->ipv4.peers = NULL; <API key>(bp); kfree(bp); } static __net_initdata struct pernet_operations ipv4_inetpeer_ops = { .init = ipv4_inetpeer_init, .exit = ipv4_inetpeer_exit, }; #ifdef <API key> struct ip_rt_acct __percpu *ip_rt_acct __read_mostly; #endif /* <API key> */ int __init ip_rt_init(void) { int rc = 0; ip_idents = kmalloc(IP_IDENTS_SZ * sizeof(*ip_idents), GFP_KERNEL); if (!ip_idents) panic("IP: failed to allocate ip_idents\n"); prandom_bytes(ip_idents, IP_IDENTS_SZ * sizeof(*ip_idents)); #ifdef <API key> ip_rt_acct = __alloc_percpu(256 * sizeof(struct ip_rt_acct), __alignof__(struct ip_rt_acct)); if (!ip_rt_acct) panic("IP: failed to allocate ip_rt_acct\n"); #endif ipv4_dst_ops.kmem_cachep = kmem_cache_create("ip_dst_cache", sizeof(struct rtable), 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); <API key>.kmem_cachep = ipv4_dst_ops.kmem_cachep; if (dst_entries_init(&ipv4_dst_ops) < 0) panic("IP: failed to allocate ipv4_dst_ops counter\n"); if (dst_entries_init(&<API key>) < 0) panic("IP: failed to allocate <API key> counter\n"); ipv4_dst_ops.gc_thresh = ~0; ip_rt_max_size = INT_MAX; devinet_init(); ip_fib_init(); if (ip_rt_proc_init()) pr_err("Unable to create route proc files\n"); #ifdef CONFIG_XFRM xfrm_init(); xfrm4_init(); #endif rtnl_register(PF_INET, RTM_GETROUTE, inet_rtm_getroute, NULL, NULL); #ifdef CONFIG_SYSCTL <API key>(&sysctl_route_ops); #endif <API key>(&rt_genid_ops); <API key>(&ipv4_inetpeer_ops); return rc; } #ifdef CONFIG_SYSCTL /* * We really need to sanitize the damn ipv4 init order, then all * this nonsense will go away. */ void __init <API key>(void) { register_net_sysctl(&init_net, "net/ipv4/route", ipv4_route_table); } #endif
var utils = require('./connection_utils'), inherits = require('util').inherits, net = require('net'), EventEmitter = require('events').EventEmitter, inherits = require('util').inherits, MongoReply = require("../responses/mongo_reply").MongoReply, Connection = require("./connection").Connection; var ConnectionPool = exports.ConnectionPool = function(host, port, poolSize, bson, socketOptions) { if(typeof host !== 'string' || typeof port !== 'number') throw "host and port must be specified [" + host + ":" + port + "]"; // Set up event emitter EventEmitter.call(this); // Keep all options for the socket in a specific collection allowing the user to specify the // Wished upon socket connection parameters this.socketOptions = typeof socketOptions === 'object' ? socketOptions : {}; this.socketOptions.host = host; this.socketOptions.port = port; this.bson = bson; // PoolSize is always + 1 for special reserved "measurment" socket (like ping, stats etc) this.poolSize = poolSize; this.minPoolSize = Math.floor(this.poolSize / 2) + 1; // Set default settings for the socket options utils.setIntegerParameter(this.socketOptions, 'timeout', 0); // Delay before writing out the data to the server utils.setBooleanParameter(this.socketOptions, 'noDelay', true); // Delay before writing out the data to the server utils.setIntegerParameter(this.socketOptions, 'keepAlive', 0); // Set the encoding of the data read, default is binary == null utils.setStringParameter(this.socketOptions, 'encoding', null); // Allows you to set a throttling bufferSize if you need to stop overflows utils.setIntegerParameter(this.socketOptions, 'bufferSize', 0); // Internal structures this.openConnections = []; // Assign connection id's this.connectionId = 0; // Current index for selection of pool connection this.<API key> = 0; // The pool state this._poolState = 'disconnected'; // timeout control this._timeout = false; } inherits(ConnectionPool, EventEmitter); ConnectionPool.prototype.setMaxBsonSize = function(maxBsonSize) { if(maxBsonSize == null){ maxBsonSize = Connection.<API key>; } for(var i = 0; i < this.openConnections.length; i++) { this.openConnections[i].maxBsonSize = maxBsonSize; } } // Start a function var _connect = function(_self) { return new function() { // Create a new connection instance var connection = new Connection(_self.connectionId++, _self.socketOptions); // Set logger on pool connection.logger = _self.logger; // Connect handler connection.on("connect", function(err, connection) { // Add connection to list of open connections _self.openConnections.push(connection); // If the number of open connections is equal to the poolSize signal ready pool if(_self.openConnections.length === _self.poolSize && _self._poolState !== 'disconnected') { // Set connected _self._poolState = 'connected'; // Emit pool ready _self.emit("poolReady"); } else if(_self.openConnections.length < _self.poolSize) { // We need to open another connection, make sure it's in the next // tick so we don't get a cascade of errors process.nextTick(function() { _connect(_self); }); } }); var numberOfErrors = 0 // Error handler connection.on("error", function(err, connection) { numberOfErrors++; // If we are already disconnected ignore the event if(_self._poolState != 'disconnected' && _self.listeners("error").length > 0) { _self.emit("error", err); } // Set disconnected _self._poolState = 'disconnected'; // Stop _self.stop(); }); // Close handler connection.on("close", function() { // If we are already disconnected ignore the event if(_self._poolState !== 'disconnected' && _self.listeners("close").length > 0) { _self.emit("close"); } // Set disconnected _self._poolState = 'disconnected'; // Stop _self.stop(); }); // Timeout handler connection.on("timeout", function(err, connection) { // If we are already disconnected ignore the event if(_self._poolState !== 'disconnected' && _self.listeners("timeout").length > 0) { _self.emit("timeout", err); } // Set disconnected _self._poolState = 'disconnected'; // Stop _self.stop(); }); // Parse error, needs a complete shutdown of the pool connection.on("parseError", function() { // If we are already disconnected ignore the event if(_self._poolState !== 'disconnected' && _self.listeners("parseError").length > 0) { _self.emit("parseError", new Error("parseError occured")); } _self.stop(); }); connection.on("message", function(message) { _self.emit("message", message); }); // Start connection in the next tick connection.start(); }(); } // Start method, will throw error if no listeners are available // Pass in an instance of the listener that contains the api for // finding callbacks for a given message etc. ConnectionPool.prototype.start = function() { var markerDate = new Date().getTime(); var self = this; if(this.listeners("poolReady").length == 0) { throw "pool must have at least one listener ready that responds to the [poolReady] event"; } // Set pool state to connecting this._poolState = 'connecting'; this._timeout = false; _connect(self); } // Restart a connection pool (on a close the pool might be in a wrong state) ConnectionPool.prototype.restart = function() { // Close all connections this.stop(false); // Now restart the pool this.start(); } // Stop the connections in the pool ConnectionPool.prototype.stop = function(removeListeners) { removeListeners = removeListeners == null ? true : removeListeners; // Set disconnected this._poolState = 'disconnected'; // Clear all listeners if specified if(removeListeners) { this.<API key>(); } // Close all connections for(var i = 0; i < this.openConnections.length; i++) { this.openConnections[i].close(); } // Clean up this.openConnections = []; } // Check the status of the connection ConnectionPool.prototype.isConnected = function() { return this._poolState === 'connected'; } // Checkout a connection from the pool for usage, or grab a specific pool instance ConnectionPool.prototype.checkoutConnection = function(id) { var index = (this.<API key>++ % (this.openConnections.length)); var connection = this.openConnections[index]; return connection; } ConnectionPool.prototype.getAllConnections = function() { return this.openConnections; } // Remove all non-needed event listeners ConnectionPool.prototype.<API key> = function() { this.removeAllListeners("close"); this.removeAllListeners("error"); this.removeAllListeners("timeout"); this.removeAllListeners("connect"); this.removeAllListeners("end"); this.removeAllListeners("parseError"); this.removeAllListeners("message"); this.removeAllListeners("poolReady"); }
// <API key>.h // openHAB iOS User Interface // This program is free software: you can redistribute it and/or modify // (at your option) any later version. // This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #import <UIKit/UIKit.h> #import "openhab.h" @protocol <API key>; @interface <API key> : <API key> <<API key>> { UIPopoverController *thePopover; UIBarButtonItem*theButton; } // Everything for the <API key> @property (strong, nonatomic) UIViewController <<API key>> *<API key>; @property (strong,nonatomic) UIPopoverController *thePopover; @property (strong,nonatomic) UIBarButtonItem*theButton; @end @protocol <API key> -(void)showButton:(UIBarButtonItem*)button pop:(UIPopoverController*)popover; -(void)hideButton:(UIBarButtonItem*)button; @end
using System; using System.Collections.Generic; using System.Web; using System.Web.Mvc; using SmartStore.Core.Domain.Tasks; namespace SmartStore.Core.Events { <summary> to initialize scheduled tasks in Application_Start </summary> public class <API key> { public IList<ScheduleTask> ScheduledTasks { get; set; } } }
#include <iostream> #include <seqan/stream.h> using namespace seqan; int main(int argc, char const ** argv) { if (argc != 2) { std::cerr << "USAGE: tutorial_solution1 VALUE\n"; return 1; } // Lexical casting with the 1-argument lexicalCast(). { int i = 0; unsigned u = 0; double d = 0; try { d = lexicalCast<double>(argv[1]); i = lexicalCast<int>(argv[1]); u = lexicalCast<unsigned>(argv[1]); } catch (BadLexicalCast & e) { std::cerr << e.what() << std::endl; } std::cout << "lexicalCast<int>(" << argv[1] << ") == " << i << '\n'; std::cout << "lexicalCast<unsinged>(" << argv[1] << ") == " << u << '\n'; std::cout << "lexicalCast<double>(" << argv[1] << ") == " << d << '\n'; } // Lexical casting with the 2-argument lexicalCast(). { int i = 0; unsigned u = 0; double d = 0; bool bi = lexicalCast(i, argv[1]); bool bu = lexicalCast(u, argv[1]); bool bd = lexicalCast(d, argv[1]); std::cout << "lexicalCast2<int>(" << argv[1] << ") == (" << bi << ", " << i << ")\n"; std::cout << "lexicalCast2<unsigned>(" << argv[1] << ") == (" << bu << ", " << u << ")\n"; std::cout << "lexicalCast2<double>(" << argv[1] << ") == (" << bd << ", " << d << ")\n"; } // Lexical casting with the 2-argument lexicalCast() that throws exceptions. { int i = 0; unsigned u = 0; double d = 0; try { <API key>(d, argv[1]); <API key>(i, argv[1]); <API key>(u, argv[1]); } catch (BadLexicalCast & e) { std::cerr << e.what() << std::endl; } std::cout << "lexicalCast2<int>(" << argv[1] << ") == (" << i << ")\n"; std::cout << "lexicalCast2<unsigned>(" << argv[1] << ") == (" << u << ")\n"; std::cout << "lexicalCast2<double>(" << argv[1] << ") == (" << d << ")\n"; } return 0; }
#include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> #include <linux/device.h> #include <linux/kdev_t.h> #include <linux/fs.h> #include <linux/cdev.h> #include <linux/platform_device.h> #include <linux/dma-mapping.h> #include <linux/mm_types.h> #include <linux/mm.h> #include <linux/jiffies.h> #include <linux/sched.h> #include <asm/uaccess.h> #include <asm/page.h> #include <linux/vmalloc.h> #include <linux/interrupt.h> #include <mach/irqs.h> //#include <mach/x_define_irq.h> #include <linux/wait.h> #include <linux/proc_fs.h> #include <linux/semaphore.h> #include <mach/dma.h> #include <linux/delay.h> #include "mach/sync_write.h" //#include "mach/mt_reg_base.h" #if !defined(CONFIG_MTK_LEGACY) #include <linux/clk.h> #else /* defined(CONFIG_MTK_LEGACY) */ #include "mach/mt_clkmgr.h" #endif /* !defined(CONFIG_MTK_LEGACY) */ #ifdef <API key> #include "mach/mtk_hibernate_dpm.h" #endif #include "<API key>.h" #include <asm/cacheflush.h> #include <asm/io.h> #include <asm/sizes.h> #include "val_types_private.h" #include "hal_types_private.h" #include "val_api_private.h" #include "val_log.h" #include "drv_api.h" #include <linux/of.h> #include <linux/of_address.h> #include <linux/of_irq.h> #if IS_ENABLED(CONFIG_COMPAT) #include <linux/uaccess.h> #include <linux/compat.h> #endif #define ENABLE_MMDVFS_VDEC #ifdef ENABLE_MMDVFS_VDEC #include <mt_smi.h> #define DROP_PERCENTAGE 50 #define RAISE_PERCENTAGE 90 #define MONITOR_DURATION_MS 4000 #define DVFS_LOW MMDVFS_VOLTAGE_LOW #define DVFS_HIGH MMDVFS_VOLTAGE_HIGH #define DVFS_DEFAULT MMDVFS_VOLTAGE_HIGH #define <API key> 0 #define SW_OVERHEAD_MS 1 static VAL_BOOL_T <API key> = VAL_FALSE; static VAL_BOOL_T gFirstDvfsLock = VAL_FALSE; static VAL_UINT32_T <API key> = 0; static VAL_TIME_T <API key>; static VAL_TIME_T <API key>; static VAL_TIME_T <API key>; static VAL_UINT32_T gHWLockInterval = 0; static VAL_INT32_T gHWLockMaxDuration = 0; VAL_UINT32_T TimeDiffMs(VAL_TIME_T timeOld, VAL_TIME_T timeNew) { //MFV_LOGE ("@@ timeOld(%d, %d), timeNew(%d, %d)", timeOld.u4Sec, timeOld.u4uSec, timeNew.u4Sec, timeNew.u4uSec); return (((((timeNew.u4Sec - timeOld.u4Sec) * 1000000) + timeNew.u4uSec) - timeOld.u4uSec) / 1000); } // raise/drop voltage void SendDvfsRequest(int level) { int ret = 0; if (level == MMDVFS_VOLTAGE_LOW) { MFV_LOGE("[VCODEC][MMDVFS_VDEC] SendDvfsRequest(MMDVFS_VOLTAGE_LOW)"); #if defined(CONFIG_MTK_LEGACY) clkmux_sel(MT_MUX_VDEC, 3, "MMDVFS_VOLTAGE_LOW"); // 136.5MHz #else // #if !defined(CONFIG_MTK_LEGACY) // [ToDo] #endif // #if defined(CONFIG_MTK_LEGACY) ret = mmdvfs_set_step(SMI_BWC_SCEN_VP, MMDVFS_VOLTAGE_LOW); } else if (level == MMDVFS_VOLTAGE_HIGH) { MFV_LOGE("[VCODEC][MMDVFS_VDEC] SendDvfsRequest(MMDVFS_VOLTAGE_HIGH)"); ret = mmdvfs_set_step(SMI_BWC_SCEN_VP, MMDVFS_VOLTAGE_HIGH); #if defined(CONFIG_MTK_LEGACY) clkmux_sel(MT_MUX_VDEC, 1, "MMDVFS_VOLTAGE_HIGH"); // 273MHz #else // #if !defined(CONFIG_MTK_LEGACY) // [ToDo] #endif // #if defined(CONFIG_MTK_LEGACY) } else { MFV_LOGE("[VCODEC][MMDVFS_VDEC] @@ OOPS: level = %d\n", level); } if (0 != ret) { MFV_LOGE("[VCODEC][MMDVFS_VDEC] @@ OOPS: mmdvfs_set_step error!"); } } void VdecDvfsBegin(void) { <API key> = VAL_TRUE; <API key> = 0; gHWLockInterval = 0; gFirstDvfsLock = VAL_TRUE; gHWLockMaxDuration = 0; MFV_LOGE("[VCODEC][MMDVFS_VDEC] @@ VdecDvfsBegin"); //eVideoGetTimeOfDay(&<API key>, sizeof(VAL_TIME_T)); } VAL_UINT32_T <API key>(void) { eVideoGetTimeOfDay(&<API key>, sizeof(VAL_TIME_T)); return TimeDiffMs(<API key>, <API key>); } void VdecDvfsEnd(int level) { MFV_LOGE("[VCODEC][MMDVFS_VDEC] @@ VdecDVFS monitor %dms, decoded %d frames, total time %d, max duration %d, target lv %d", MONITOR_DURATION_MS, <API key>, gHWLockInterval, gHWLockMaxDuration, level); <API key> = VAL_FALSE; <API key> = 0; gHWLockInterval = 0; gHWLockMaxDuration = 0; } VAL_UINT32_T VdecDvfsStep(void) { VAL_TIME_T _now; VAL_UINT32_T _diff = 0; eVideoGetTimeOfDay(&_now, sizeof(VAL_TIME_T)); _diff = TimeDiffMs(<API key>, _now); if (_diff > gHWLockMaxDuration) { gHWLockMaxDuration = _diff; } gHWLockInterval += (_diff + SW_OVERHEAD_MS); return _diff; } #endif #define VDO_HW_WRITE(ptr,data) mt_reg_sync_writel(data,ptr) #define VDO_HW_READ(ptr) (*((volatile unsigned int * const)(ptr))) #define VCODEC_DEVNAME "Vcodec" #define <API key> 160 //189 //#define VENC_USE_L2C static dev_t vcodec_devno = MKDEV(<API key>, 0); static struct cdev *vcodec_cdev; static struct class *vcodec_class = NULL; static struct device *vcodec_device = NULL; #if !defined(CONFIG_MTK_LEGACY) static struct clk *<API key>; /* MM_DISP0_SMI_COMMON */ static struct clk *<API key>; /* VDEC0_VDEC */ static struct clk *<API key>; /* VDEC1_LARB */ static struct clk *clk_MT_CG_VENC_VENC; /* VENC_VENC */ static struct clk *clk_MT_CG_VENC_LARB; /* VENC_LARB */ #endif /* !defined(CONFIG_MTK_LEGACY) */ static DEFINE_MUTEX(IsOpenedLock); static DEFINE_MUTEX(PWRLock); static DEFINE_MUTEX(VdecHWLock); static DEFINE_MUTEX(VencHWLock); static DEFINE_MUTEX(EncEMILock); static DEFINE_MUTEX(L2CLock); static DEFINE_MUTEX(DecEMILock); static DEFINE_MUTEX(DriverOpenCountLock); static DEFINE_MUTEX(<API key>); static DEFINE_MUTEX(<API key>); static DEFINE_MUTEX(VdecPWRLock); static DEFINE_MUTEX(VencPWRLock); static DEFINE_SPINLOCK(DecIsrLock); static DEFINE_SPINLOCK(EncIsrLock); static DEFINE_SPINLOCK(LockDecHWCountLock); static DEFINE_SPINLOCK(LockEncHWCountLock); static DEFINE_SPINLOCK(DecISRCountLock); static DEFINE_SPINLOCK(EncISRCountLock); static VAL_EVENT_T DecHWLockEvent; //mutex : <API key> static VAL_EVENT_T EncHWLockEvent; //mutex : <API key> static VAL_EVENT_T DecIsrEvent; //mutex : <API key> static VAL_EVENT_T EncIsrEvent; //mutex : <API key> static VAL_INT32_T Driver_Open_Count; //mutex : DriverOpenCountLock static VAL_UINT32_T gu4PWRCounter = 0; //mutex : PWRLock static VAL_UINT32_T gu4EncEMICounter = 0; //mutex : EncEMILock static VAL_UINT32_T gu4DecEMICounter = 0; //mutex : DecEMILock static VAL_UINT32_T gu4L2CCounter = 0; //mutex : L2CLock static VAL_BOOL_T bIsOpened = VAL_FALSE; //mutex : IsOpenedLock static VAL_UINT32_T gu4HwVencIrqStatus = 0; //hardware VENC IRQ status (VP8/H264) static VAL_UINT32_T gu4VdecPWRCounter = 0; //mutex : VdecPWRLock static VAL_UINT32_T gu4VencPWRCounter = 0; //mutex : VencPWRLock static VAL_UINT32_T gLockTimeOutCount = 0; static VAL_UINT32_T gu4VdecLockThreadId = 0; //#define VCODEC_DEBUG #ifdef VCODEC_DEBUG #undef VCODEC_DEBUG #define VCODEC_DEBUG MFV_LOGE #undef MFV_LOGD #define MFV_LOGD MFV_LOGE #else #define VCODEC_DEBUG(...) #undef MFV_LOGD #define MFV_LOGD(...) #endif // VENC physical base address #undef VENC_BASE #define VENC_BASE 0x17002000 #define VENC_REGION 0x1000 // VDEC virtual base address #define VDEC_BASE_PHY 0x16000000 #define VDEC_REGION 0x29000 #define HW_BASE 0x7FFF000 #define HW_REGION 0x2000 #define INFO_BASE 0x10000000 #define INFO_REGION 0x1000 #if 0 #define <API key> VENC_BASE + 0x05C #define VENC_IRQ_ACK_addr VENC_BASE + 0x060 #define <API key> VENC_BASE + 0x678 #define <API key> VENC_BASE + 0x67C #define <API key> VENC_BASE + 0x688 #define <API key> VENC_BASE + 0x680 #define <API key> VENC_BASE + 0x668 #define <API key> VENC_BASE + 0x664 #define <API key> VENC_BASE + 0x6E4 #endif #define VENC_IRQ_STATUS_SPS 0x1 #define VENC_IRQ_STATUS_PPS 0x2 #define VENC_IRQ_STATUS_FRM 0x4 #define <API key> 0x8 #define <API key> 0x10 #define <API key> 0x20 //#define VENC_PWR_FPGA // Cheng-Jung 20120621 VENC power physical base address (FPGA only, should use API) [ #ifdef VENC_PWR_FPGA #define CLK_CFG_0_addr 0x10000140 #define CLK_CFG_4_addr 0x10000150 #define VENC_PWR_addr 0x10006230 #define VENCSYS_CG_SET_addr 0x15000004 #define PWR_ONS_1_D 3 #define PWR_CKD_1_D 4 #define PWR_ONN_1_D 2 #define PWR_ISO_1_D 1 #define PWR_RST_0_D 0 #define PWR_ON_SEQ_0 ((0x1 << PWR_ONS_1_D) | (0x1 << PWR_CKD_1_D) | (0x1 << PWR_ONN_1_D) | (0x1 << PWR_ISO_1_D) | (0x0 << PWR_RST_0_D)) #define PWR_ON_SEQ_1 ((0x1 << PWR_ONS_1_D) | (0x0 << PWR_CKD_1_D) | (0x1 << PWR_ONN_1_D) | (0x1 << PWR_ISO_1_D) | (0x0 << PWR_RST_0_D)) #define PWR_ON_SEQ_2 ((0x1 << PWR_ONS_1_D) | (0x0 << PWR_CKD_1_D) | (0x1 << PWR_ONN_1_D) | (0x0 << PWR_ISO_1_D) | (0x0 << PWR_RST_0_D)) #define PWR_ON_SEQ_3 ((0x1 << PWR_ONS_1_D) | (0x0 << PWR_CKD_1_D) | (0x1 << PWR_ONN_1_D) | (0x0 << PWR_ISO_1_D) | (0x1 << PWR_RST_0_D)) #endif #if 0 // VDEC virtual base address #define VDEC_MISC_BASE VDEC_BASE + 0x0000 #define VDEC_VLD_BASE VDEC_BASE + 0x1000 #endif VAL_ULONG_T <API key>, <API key>, KVA_VENC_BASE; VAL_ULONG_T KVA_VDEC_MISC_BASE, KVA_VDEC_VLD_BASE, KVA_VDEC_BASE, KVA_VDEC_GCON_BASE; VAL_UINT32_T VENC_IRQ_ID, VDEC_IRQ_ID; #ifdef VENC_PWR_FPGA // Cheng-Jung 20120621 VENC power physical base address (FPGA only, should use API) [ VAL_ULONG_T <API key>, <API key>, KVA_VENC_PWR_ADDR, <API key>; #endif extern unsigned long pmem_user_v2p_video(unsigned long va); #if defined(VENC_USE_L2C) extern int config_L2(int option); #endif void vdec_power_on(void) { int ret; mutex_lock(&VdecPWRLock); gu4VdecPWRCounter++; mutex_unlock(&VdecPWRLock); #if defined(CONFIG_MTK_LEGACY) // Central power on enable_clock(<API key>, "VDEC"); enable_clock(MT_CG_VDEC0_VDEC, "VDEC"); enable_clock(MT_CG_VDEC1_LARB, "VDEC"); #ifdef VDEC_USE_L2C //enable_clock(<API key>, "VDEC"); #endif #else //#if !defined(CONFIG_MTK_LEGACY) ret = clk_prepare_enable(<API key>); if (ret) { // print error log & error handling MFV_LOGE("[VCODEC][ERROR][vdec_power_on] <API key> is not enabled, ret = %d\n", ret); } ret = clk_prepare_enable(<API key>); if (ret) { // print error log & error handling MFV_LOGE("[VCODEC][ERROR][vdec_power_on] <API key> is not enabled, ret = %d\n", ret); } ret = clk_prepare_enable(<API key>); if (ret) { // print error log & error handling MFV_LOGE("[VCODEC][ERROR][vdec_power_on] <API key> is not enabled, ret = %d\n", ret); } #endif //#if defined(CONFIG_MTK_LEGACY) } void vdec_power_off(void) { mutex_lock(&VdecPWRLock); if (gu4VdecPWRCounter == 0) { } else { gu4VdecPWRCounter #if defined(CONFIG_MTK_LEGACY) // Central power off disable_clock(MT_CG_VDEC0_VDEC, "VDEC"); disable_clock(MT_CG_VDEC1_LARB, "VDEC"); disable_clock(<API key>, "VDEC"); #ifdef VDEC_USE_L2C //disable_clock(<API key>, "VDEC"); #endif #else //#if !defined(CONFIG_MTK_LEGACY) <API key>(<API key>); <API key>(<API key>); <API key>(<API key>); #endif //#if defined(CONFIG_MTK_LEGACY) } mutex_unlock(&VdecPWRLock); } void venc_power_on(void) { int ret; mutex_lock(&VencPWRLock); gu4VencPWRCounter++; mutex_unlock(&VencPWRLock); MFV_LOGD("[VCODEC] venc_power_on +\n"); #if defined(CONFIG_MTK_LEGACY) enable_clock(<API key>, "VENC"); enable_clock(MT_CG_VENC_VENC, "VENC"); enable_clock(MT_CG_VENC_LARB , "VENC"); #ifdef VENC_USE_L2C enable_clock(<API key>, "VENC"); #endif #else //#if !defined(CONFIG_MTK_LEGACY) ret = clk_prepare_enable(<API key>); if (ret) { // print error log & error handling MFV_LOGE("[VCODEC][ERROR][venc_power_on] <API key> is not enabled, ret = %d\n", ret); } ret = clk_prepare_enable(clk_MT_CG_VENC_VENC); if (ret) { // print error log & error handling MFV_LOGE("[VCODEC][ERROR][venc_power_on] clk_MT_CG_VENC_VENC is not enabled, ret = %d\n", ret); } ret = clk_prepare_enable(clk_MT_CG_VENC_LARB); if (ret) { // print error log & error handling MFV_LOGE("[VCODEC][ERROR][venc_power_on] clk_MT_CG_VENC_LARB is not enabled, ret = %d\n", ret); } #endif //#if defined(CONFIG_MTK_LEGACY) MFV_LOGD("[VCODEC] venc_power_on -\n"); } void venc_power_off(void) { mutex_lock(&VencPWRLock); if (gu4VencPWRCounter == 0) { } else { gu4VencPWRCounter MFV_LOGD("[VCODEC] venc_power_off +\n"); #if defined(CONFIG_MTK_LEGACY) disable_clock(MT_CG_VENC_VENC, "VENC"); disable_clock(MT_CG_VENC_LARB, "VENC"); disable_clock(<API key>, "VENC"); #ifdef VENC_USE_L2C disable_clock(<API key>, "VENC"); #endif #else //#if !defined(CONFIG_MTK_LEGACY) <API key>(clk_MT_CG_VENC_LARB); <API key>(clk_MT_CG_VENC_VENC); <API key>(<API key>); #endif //#if defined(CONFIG_MTK_LEGACY) MFV_LOGD("[VCODEC] venc_power_off -\n"); } mutex_unlock(&VencPWRLock); } void dec_isr(void) { VAL_RESULT_T eValRet; VAL_ULONG_T ulFlags, ulFlagsISR, ulFlagsLockHW; VAL_UINT32_T u4TempDecISRCount = 0; VAL_UINT32_T <API key> = 0; VAL_UINT32_T u4CgStatus = 0; VAL_UINT32_T u4DecDoneStatus = 0; u4CgStatus = VDO_HW_READ(KVA_VDEC_GCON_BASE); if ((u4CgStatus & 0x10) != 0) { MFV_LOGE("[VCODEC][ERROR] DEC ISR, VDEC active is not 0x0 (0x%08x)", u4CgStatus); return; } u4DecDoneStatus = VDO_HW_READ(KVA_VDEC_BASE + 0xA4); if ((u4DecDoneStatus & (0x1 << 16)) != 0x10000) { MFV_LOGE("[VCODEC][ERROR] DEC ISR, Decode done status is not 0x1 (0x%08x)", u4DecDoneStatus); return; } spin_lock_irqsave(&DecISRCountLock, ulFlagsISR); gu4DecISRCount++; u4TempDecISRCount = gu4DecISRCount; <API key>(&DecISRCountLock, ulFlagsISR); spin_lock_irqsave(&LockDecHWCountLock, ulFlagsLockHW); <API key> = gu4LockDecHWCount; <API key>(&LockDecHWCountLock, ulFlagsLockHW); if (u4TempDecISRCount != <API key>) { //MFV_LOGE("[INFO] Dec ISRCount: 0x%x, LockHWCount:0x%x\n", u4TempDecISRCount, <API key>); } // Clear interrupt VDO_HW_WRITE(KVA_VDEC_MISC_BASE + 41 * 4, VDO_HW_READ(KVA_VDEC_MISC_BASE + 41 * 4) | 0x11); VDO_HW_WRITE(KVA_VDEC_MISC_BASE + 41 * 4, VDO_HW_READ(KVA_VDEC_MISC_BASE + 41 * 4) & ~0x10); spin_lock_irqsave(&DecIsrLock, ulFlags); eValRet = eVideoSetEvent(&DecIsrEvent, sizeof(VAL_EVENT_T)); if (VAL_RESULT_NO_ERROR != eValRet) { MFV_LOGE("[VCODEC][ERROR] ISR set DecIsrEvent error\n"); } <API key>(&DecIsrLock, ulFlags); return; } void enc_isr(void) { VAL_RESULT_T eValRet; VAL_ULONG_T ulFlagsISR, ulFlagsLockHW; VAL_UINT32_T u4TempEncISRCount = 0; VAL_UINT32_T <API key> = 0; spin_lock_irqsave(&EncISRCountLock, ulFlagsISR); gu4EncISRCount++; u4TempEncISRCount = gu4EncISRCount; <API key>(&EncISRCountLock, ulFlagsISR); spin_lock_irqsave(&LockEncHWCountLock, ulFlagsLockHW); <API key> = gu4LockEncHWCount; <API key>(&LockEncHWCountLock, ulFlagsLockHW); if (u4TempEncISRCount != <API key>) { //MFV_LOGE("[INFO] Enc ISRCount: 0x%x, LockHWCount:0x%x\n", u4TempEncISRCount, <API key>); } if (grVcodecEncHWLock.pvHandle == 0) { MFV_LOGE("[VCODEC][ERROR] NO one Lock Enc HW, please check!!\n"); // Clear all status //VDO_HW_WRITE(<API key>, 1); VDO_HW_WRITE(<API key>, <API key>); //VDO_HW_WRITE(<API key>, <API key>); VDO_HW_WRITE(<API key>, <API key>); VDO_HW_WRITE(<API key>, <API key>); VDO_HW_WRITE(<API key>, VENC_IRQ_STATUS_SPS); VDO_HW_WRITE(<API key>, VENC_IRQ_STATUS_PPS); VDO_HW_WRITE(<API key>, VENC_IRQ_STATUS_FRM); return; } if (grVcodecEncHWLock.eDriverType == <API key>) // hardwire { gu4HwVencIrqStatus = VDO_HW_READ(<API key>); if (gu4HwVencIrqStatus & <API key>) { VDO_HW_WRITE(<API key>, <API key>); } if (gu4HwVencIrqStatus & <API key>) { VDO_HW_WRITE(<API key>, <API key>); } if (gu4HwVencIrqStatus & <API key>) { VDO_HW_WRITE(<API key>, <API key>); } if (gu4HwVencIrqStatus & VENC_IRQ_STATUS_SPS) { VDO_HW_WRITE(<API key>, VENC_IRQ_STATUS_SPS); } if (gu4HwVencIrqStatus & VENC_IRQ_STATUS_PPS) { VDO_HW_WRITE(<API key>, VENC_IRQ_STATUS_PPS); } if (gu4HwVencIrqStatus & VENC_IRQ_STATUS_FRM) { VDO_HW_WRITE(<API key>, VENC_IRQ_STATUS_FRM); } } else if (grVcodecEncHWLock.eDriverType == <API key>) // hardwire { MFV_LOGE("[VCODEC][enc_isr] <API key>!!\n"); } else { MFV_LOGE("[VCODEC][ERROR] Invalid lock holder driver type = %d\n", grVcodecEncHWLock.eDriverType); } eValRet = eVideoSetEvent(&EncIsrEvent, sizeof(VAL_EVENT_T)); if (VAL_RESULT_NO_ERROR != eValRet) { MFV_LOGE("[VCODEC][ERROR] ISR set EncIsrEvent error\n"); } } static irqreturn_t video_intr_dlr(int irq, void *dev_id) { dec_isr(); return IRQ_HANDLED; } static irqreturn_t video_intr_dlr2(int irq, void *dev_id) { enc_isr(); return IRQ_HANDLED; } static long <API key>(struct file *file, unsigned int cmd, unsigned long arg) { VAL_LONG_T ret; VAL_UINT8_T *user_data_addr; VAL_RESULT_T eValRet; VAL_ULONG_T ulFlags, ulFlagsLockHW; VAL_HW_LOCK_T rHWLock; VAL_BOOL_T bLockedHW = VAL_FALSE; VAL_UINT32_T FirstUseDecHW = 0; VAL_UINT32_T FirstUseEncHW = 0; VAL_TIME_T rCurTime; VAL_UINT32_T u4TimeInterval; VAL_ISR_T val_isr; <API key> rTempCoreLoading; <API key> rCpuOppLimit; VAL_INT32_T temp_nr_cpu_ids; VAL_POWER_T rPowerParam; VAL_MEMORY_T rTempMem; #ifdef ENABLE_MMDVFS_VDEC VAL_UINT32_T _monitor_duration = 0; VAL_UINT32_T _diff = 0; VAL_UINT32_T _perc = 0; #endif #if 0 <API key> rDrvCmdQueue; P_VCODEC_DRV_CMD_T cmd_queue = VAL_NULL; VAL_UINT32_T u4Size, uValue, nCount; #endif switch (cmd) { case <API key>: { MFV_LOGE("<API key> [EMPTY] + tid = %d\n", current->pid); MFV_LOGE("<API key> [EMPTY] - tid = %d\n", current->pid); } break; case <API key>: { MFV_LOGE("<API key> + tid = %d\n", current->pid); user_data_addr = (VAL_UINT8_T *)arg; ret = copy_from_user(&rTempMem, user_data_addr, sizeof(VAL_MEMORY_T)); if (ret) { MFV_LOGE("[ERROR] <API key>, copy_from_user failed: %lu\n", ret); return -EFAULT; } rTempMem.u4ReservedSize /*kernel va*/ = (VAL_ULONG_T)dma_alloc_coherent(0, rTempMem.u4MemSize, (dma_addr_t *)&rTempMem.pvMemPa, GFP_KERNEL); if ((0 == rTempMem.u4ReservedSize) || (0 == rTempMem.pvMemPa)) { MFV_LOGE("[ERROR] dma_alloc_coherent fail in <API key>\n"); return -EFAULT; } MFV_LOGD("[VCODEC] kernel va = 0x%lx, kernel pa = 0x%lx, memory size = %lu\n", (VAL_ULONG_T)rTempMem.u4ReservedSize, (VAL_ULONG_T)rTempMem.pvMemPa, (VAL_ULONG_T)rTempMem.u4MemSize); //mutex_lock(&<API key>); //<API key>(rTempMem.u4ReservedSize, (VAL_UINT32_T)rTempMem.pvMemPa, (VAL_UINT32_T)rTempMem.u4MemSize, 0, 0); //mutex_unlock(&<API key>); ret = copy_to_user(user_data_addr, &rTempMem, sizeof(VAL_MEMORY_T)); if (ret) { MFV_LOGE("[ERROR] <API key>, copy_to_user failed: %lu\n", ret); return -EFAULT; } MFV_LOGE("<API key> - tid = %d\n", current->pid); } break; case <API key>: { MFV_LOGE("<API key> + tid = %d\n", current->pid); user_data_addr = (VAL_UINT8_T *)arg; ret = copy_from_user(&rTempMem, user_data_addr, sizeof(VAL_MEMORY_T)); if (ret) { MFV_LOGE("[ERROR] <API key>, copy_from_user failed: %lu\n", ret); return -EFAULT; } dma_free_coherent(0, rTempMem.u4MemSize, (void *)rTempMem.u4ReservedSize, (dma_addr_t)rTempMem.pvMemPa); //mutex_lock(&<API key>); //<API key>(rTempMem.u4ReservedSize, (VAL_UINT32_T)rTempMem.pvMemPa); //mutex_unlock(&<API key>); rTempMem.u4ReservedSize = 0; rTempMem.pvMemPa = NULL; ret = copy_to_user(user_data_addr, &rTempMem, sizeof(VAL_MEMORY_T)); if (ret) { MFV_LOGE("[ERROR] <API key>, copy_to_user failed: %lu\n", ret); return -EFAULT; } MFV_LOGE("<API key> - tid = %d\n", current->pid); } break; case <API key>: { MFV_LOGD("<API key> + tid = %d\n", current->pid); mutex_lock(&DecEMILock); gu4DecEMICounter++; MFV_LOGE("[VCODEC] DEC_EMI_USER = %d\n", gu4DecEMICounter); user_data_addr = (VAL_UINT8_T *)arg; ret = copy_to_user(user_data_addr, &gu4DecEMICounter, sizeof(VAL_UINT32_T)); if (ret) { MFV_LOGE("[ERROR] <API key>, copy_to_user failed: %lu\n", ret); mutex_unlock(&DecEMILock); return -EFAULT; } mutex_unlock(&DecEMILock); #ifdef ENABLE_MMDVFS_VDEC // MM DVFS related MFV_LOGE("[VCODEC][MMDVFS_VDEC] @@ INC_DEC_EMI MM DVFS init"); // raise voltage SendDvfsRequest(DVFS_DEFAULT); VdecDvfsBegin(); #endif MFV_LOGD("<API key> - tid = %d\n", current->pid); } break; case <API key>: { MFV_LOGD("<API key> + tid = %d\n", current->pid); mutex_lock(&DecEMILock); gu4DecEMICounter MFV_LOGE("[VCODEC] DEC_EMI_USER = %d\n", gu4DecEMICounter); user_data_addr = (VAL_UINT8_T *)arg; ret = copy_to_user(user_data_addr, &gu4DecEMICounter, sizeof(VAL_UINT32_T)); if (ret) { MFV_LOGE("[ERROR] <API key>, copy_to_user failed: %lu\n", ret); mutex_unlock(&DecEMILock); return -EFAULT; } mutex_unlock(&DecEMILock); MFV_LOGD("<API key> - tid = %d\n", current->pid); } break; case <API key>: { MFV_LOGD("<API key> + tid = %d\n", current->pid); mutex_lock(&EncEMILock); gu4EncEMICounter++; MFV_LOGE("[VCODEC] ENC_EMI_USER = %d\n", gu4EncEMICounter); user_data_addr = (VAL_UINT8_T *)arg; ret = copy_to_user(user_data_addr, &gu4EncEMICounter, sizeof(VAL_UINT32_T)); if (ret) { MFV_LOGE("[ERROR] <API key>, copy_to_user failed: %lu\n", ret); mutex_unlock(&EncEMILock); return -EFAULT; } mutex_unlock(&EncEMILock); MFV_LOGD("<API key> - tid = %d\n", current->pid); } break; case <API key>: { MFV_LOGD("<API key> + tid = %d\n", current->pid); mutex_lock(&EncEMILock); gu4EncEMICounter MFV_LOGE("[VCODEC] ENC_EMI_USER = %d\n", gu4EncEMICounter); user_data_addr = (VAL_UINT8_T *)arg; ret = copy_to_user(user_data_addr, &gu4EncEMICounter, sizeof(VAL_UINT32_T)); if (ret) { MFV_LOGE("[ERROR] <API key>, copy_to_user failed: %lu\n", ret); mutex_unlock(&EncEMILock); return -EFAULT; } mutex_unlock(&EncEMILock); MFV_LOGD("<API key> - tid = %d\n", current->pid); } break; case VCODEC_LOCKHW: { MFV_LOGD("VCODEC_LOCKHW + tid = %d\n", current->pid); user_data_addr = (VAL_UINT8_T *)arg; ret = copy_from_user(&rHWLock, user_data_addr, sizeof(VAL_HW_LOCK_T)); if (ret) { MFV_LOGE("[ERROR] VCODEC_LOCKHW, copy_from_user failed: %lu\n", ret); return -EFAULT; } MFV_LOGD("[VCODEC] LOCKHW eDriverType = %d\n", rHWLock.eDriverType); eValRet = <API key>; if (rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key>) { while (bLockedHW == VAL_FALSE) { mutex_lock(&<API key>); if (DecHWLockEvent.u4TimeoutMs == 1) { MFV_LOGE("VCODEC_LOCKHW, First Use Dec HW!!\n"); FirstUseDecHW = 1; } else { FirstUseDecHW = 0; } mutex_unlock(&<API key>); if (FirstUseDecHW == 1) { eValRet = eVideoWaitEvent(&DecHWLockEvent, sizeof(VAL_EVENT_T)); } mutex_lock(&<API key>); if (DecHWLockEvent.u4TimeoutMs != 1000) { DecHWLockEvent.u4TimeoutMs = 1000; FirstUseDecHW = 1; } else { FirstUseDecHW = 0; } mutex_unlock(&<API key>); mutex_lock(&VdecHWLock); // one process try to lock twice if (grVcodecDecHWLock.pvHandle == (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle)) { MFV_LOGE("[WARNING] VCODEC_LOCKHW, one decoder instance try to lock twice, may cause lock HW timeout!! instance = 0x%lx, CurrentTID = %d\n", (VAL_ULONG_T)grVcodecDecHWLock.pvHandle, current->pid); } mutex_unlock(&VdecHWLock); if (FirstUseDecHW == 0) { MFV_LOGD("VCODEC_LOCKHW, Not first time use HW, timeout = %d\n", DecHWLockEvent.u4TimeoutMs); eValRet = eVideoWaitEvent(&DecHWLockEvent, sizeof(VAL_EVENT_T)); } if (<API key> == eValRet) { MFV_LOGE("[ERROR] VCODEC_LOCKHW, DecHWLockEvent TimeOut, CurrentTID = %d\n", current->pid); if (FirstUseDecHW != 1) { mutex_lock(&VdecHWLock); if (grVcodecDecHWLock.pvHandle == 0) { MFV_LOGE("[WARNING] VCODEC_LOCKHW, maybe mediaserver restart before, please check!!\n"); } else { MFV_LOGE("[WARNING] VCODEC_LOCKHW, someone use HW, and check timeout value!!\n"); } mutex_unlock(&VdecHWLock); } } else if (<API key> == eValRet) { MFV_LOGE("[WARNING] VCODEC_LOCKHW, <API key> return when HWLock!!\n"); return -ERESTARTSYS; } mutex_lock(&VdecHWLock); if (grVcodecDecHWLock.pvHandle == 0) // No one holds dec hw lock now { gu4VdecLockThreadId = current->pid; grVcodecDecHWLock.pvHandle = (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle); grVcodecDecHWLock.eDriverType = rHWLock.eDriverType; eVideoGetTimeOfDay(&grVcodecDecHWLock.rLockedTime, sizeof(VAL_TIME_T)); MFV_LOGD("VCODEC_LOCKHW, No process use dec HW, so current process can use HW\n"); MFV_LOGD("VCODEC_LOCKHW, LockInstance = 0x%lx CurrentTID = %d, rLockedTime(s, us) = %d, %d\n", (VAL_ULONG_T)grVcodecDecHWLock.pvHandle, current->pid, grVcodecDecHWLock.rLockedTime.u4Sec, grVcodecDecHWLock.rLockedTime.u4uSec); bLockedHW = VAL_TRUE; if (<API key> == eValRet && FirstUseDecHW != 1) { MFV_LOGE("[WARNING] VCODEC_LOCKHW, reset power/irq when HWLock!!\n"); vdec_power_off(); disable_irq(VDEC_IRQ_ID); } vdec_power_on(); if (rHWLock.bSecureInst == VAL_FALSE) { enable_irq(VDEC_IRQ_ID); } #ifdef ENABLE_MMDVFS_VDEC // MM DVFS related if (VAL_FALSE == <API key>) { // Continous monitoring VdecDvfsBegin(); } if (VAL_TRUE == <API key>) { MFV_LOGD("[VCODEC][MMDVFS_VDEC] @@ LOCK 1"); if (<API key> > <API key>) { if (VAL_TRUE == gFirstDvfsLock) { gFirstDvfsLock = VAL_FALSE; MFV_LOGE("[VCODEC][MMDVFS_VDEC] @@ LOCK 1 start monitor"); eVideoGetTimeOfDay(&<API key>, sizeof(VAL_TIME_T)); } eVideoGetTimeOfDay(&<API key>, sizeof(VAL_TIME_T)); } } #endif } else // Another one holding dec hw now { MFV_LOGE("VCODEC_LOCKHW E\n"); eVideoGetTimeOfDay(&rCurTime, sizeof(VAL_TIME_T)); u4TimeInterval = (((((rCurTime.u4Sec - grVcodecDecHWLock.rLockedTime.u4Sec) * 1000000) + rCurTime.u4uSec) - grVcodecDecHWLock.rLockedTime.u4uSec) / 1000); MFV_LOGD("VCODEC_LOCKHW, someone use dec HW, and check timeout value\n"); MFV_LOGD("VCODEC_LOCKHW, Instance = 0x%lx CurrentTID = %d, TimeInterval(ms) = %d, TimeOutValue(ms)) = %d\n", (VAL_ULONG_T)grVcodecDecHWLock.pvHandle, current->pid, u4TimeInterval, rHWLock.u4TimeoutMs); MFV_LOGE("VCODEC_LOCKHW Lock Instance = 0x%lx, Lock TID = %d, CurrentTID = %d, rLockedTime(%d s, %d us), rCurTime(%d s, %d us)\n", (VAL_ULONG_T)grVcodecDecHWLock.pvHandle, gu4VdecLockThreadId, current->pid, grVcodecDecHWLock.rLockedTime.u4Sec, grVcodecDecHWLock.rLockedTime.u4uSec, rCurTime.u4Sec, rCurTime.u4uSec ); // 2012/12/16. Cheng-Jung Never steal hardware lock if (0) //if (u4TimeInterval >= rHWLock.u4TimeoutMs) { grVcodecDecHWLock.pvHandle = (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle); grVcodecDecHWLock.eDriverType = rHWLock.eDriverType; eVideoGetTimeOfDay(&grVcodecDecHWLock.rLockedTime, sizeof(VAL_TIME_T)); bLockedHW = VAL_TRUE; vdec_power_on(); // TODO: Error handling, VDEC break, reset? } } mutex_unlock(&VdecHWLock); spin_lock_irqsave(&LockDecHWCountLock, ulFlagsLockHW); gu4LockDecHWCount++; <API key>(&LockDecHWCountLock, ulFlagsLockHW); } } else if (rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key>) { while (bLockedHW == VAL_FALSE) { // Early break for JPEG VENC if (rHWLock.u4TimeoutMs == 0) { if (grVcodecEncHWLock.pvHandle != 0) { break; } } // Wait to acquire Enc HW lock mutex_lock(&<API key>); if (EncHWLockEvent.u4TimeoutMs == 1) { MFV_LOGE("VCODEC_LOCKHW, First Use Enc HW %d!!\n", rHWLock.eDriverType); FirstUseEncHW = 1; } else { FirstUseEncHW = 0; } mutex_unlock(&<API key>); if (FirstUseEncHW == 1) { eValRet = eVideoWaitEvent(&EncHWLockEvent, sizeof(VAL_EVENT_T)); } mutex_lock(&<API key>); if (EncHWLockEvent.u4TimeoutMs == 1) { EncHWLockEvent.u4TimeoutMs = 1000; FirstUseEncHW = 1; } else { FirstUseEncHW = 0; if (rHWLock.u4TimeoutMs == 0) { EncHWLockEvent.u4TimeoutMs = 0; // No wait } else { EncHWLockEvent.u4TimeoutMs = 1000; // Wait indefinitely } } mutex_unlock(&<API key>); mutex_lock(&VencHWLock); // one process try to lock twice if (grVcodecEncHWLock.pvHandle == (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle)) { MFV_LOGE("[WARNING] VCODEC_LOCKHW, one encoder instance try to lock twice, may cause lock HW timeout!! instance = 0x%lx, CurrentTID = %d, type:%d\n", (VAL_ULONG_T)grVcodecEncHWLock.pvHandle, current->pid, rHWLock.eDriverType); } mutex_unlock(&VencHWLock); if (FirstUseEncHW == 0) { eValRet = eVideoWaitEvent(&EncHWLockEvent, sizeof(VAL_EVENT_T)); } if (<API key> == eValRet) { MFV_LOGE("[ERROR] VCODEC_LOCKHW EncHWLockEvent TimeOut, CurrentTID = %d\n", current->pid); if (FirstUseEncHW != 1) { mutex_lock(&VencHWLock); if (grVcodecEncHWLock.pvHandle == 0) { MFV_LOGE("[WARNING] VCODEC_LOCKHW, maybe mediaserver restart before, please check!!\n"); } else { MFV_LOGE("[WARNING] VCODEC_LOCKHW, someone use HW, and check timeout value!! %d\n", gLockTimeOutCount); ++gLockTimeOutCount; if (gLockTimeOutCount > 30) { MFV_LOGE("[ERROR] VCODEC_LOCKHW - ID %d fail, someone locked HW time out more than 30 times 0x%lx, %lx, 0x%lx, type:%d\n", current->pid, (VAL_ULONG_T)grVcodecEncHWLock.pvHandle, pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle), (VAL_ULONG_T)rHWLock.pvHandle, rHWLock.eDriverType); gLockTimeOutCount = 0; mutex_unlock(&VencHWLock); return -EFAULT; } if (rHWLock.u4TimeoutMs == 0) { MFV_LOGE("[ERROR] VCODEC_LOCKHW - ID %d fail, someone locked HW already 0x%lx, %lx, 0x%lx, type:%d\n", current->pid, (VAL_ULONG_T)grVcodecEncHWLock.pvHandle, pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle), (VAL_ULONG_T)rHWLock.pvHandle, rHWLock.eDriverType); gLockTimeOutCount = 0; mutex_unlock(&VencHWLock); return -EFAULT; } } mutex_unlock(&VencHWLock); } } else if (<API key> == eValRet) { return -ERESTARTSYS; } mutex_lock(&VencHWLock); if (grVcodecEncHWLock.pvHandle == 0) //No process use HW, so current process can use HW { if (rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key>) { grVcodecEncHWLock.pvHandle = (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle); MFV_LOGD("VCODEC_LOCKHW, No process use HW, so current process can use HW, handle = 0x%lx\n", (VAL_ULONG_T)grVcodecEncHWLock.pvHandle); grVcodecEncHWLock.eDriverType = rHWLock.eDriverType; eVideoGetTimeOfDay(&grVcodecEncHWLock.rLockedTime, sizeof(VAL_TIME_T)); MFV_LOGD("VCODEC_LOCKHW, No process use HW, so current process can use HW\n"); MFV_LOGD("VCODEC_LOCKHW, LockInstance = 0x%lx CurrentTID = %d, rLockedTime(s, us) = %d, %d\n", (VAL_ULONG_T)grVcodecEncHWLock.pvHandle, current->pid, grVcodecEncHWLock.rLockedTime.u4Sec, grVcodecEncHWLock.rLockedTime.u4uSec); bLockedHW = VAL_TRUE; if (rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key>) { venc_power_on(); //enable_irq(MT_VENC_IRQ_ID); enable_irq(VENC_IRQ_ID); } } } else //someone use HW, and check timeout value { if (rHWLock.u4TimeoutMs == 0) { bLockedHW = VAL_FALSE; mutex_unlock(&VencHWLock); break; } eVideoGetTimeOfDay(&rCurTime, sizeof(VAL_TIME_T)); u4TimeInterval = (((((rCurTime.u4Sec - grVcodecEncHWLock.rLockedTime.u4Sec) * 1000000) + rCurTime.u4uSec) - grVcodecEncHWLock.rLockedTime.u4uSec) / 1000); MFV_LOGD("VCODEC_LOCKHW, someone use enc HW, and check timeout value\n"); MFV_LOGD("VCODEC_LOCKHW, LockInstance = 0x%lx, CurrentInstance = 0x%lx, CurrentTID = %d, TimeInterval(ms) = %d, TimeOutValue(ms)) = %d\n", (VAL_ULONG_T)grVcodecEncHWLock.pvHandle, pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle), current->pid, u4TimeInterval, rHWLock.u4TimeoutMs); MFV_LOGD("VCODEC_LOCKHW, LockInstance = 0x%lx, CurrentInstance = 0x%lx, CurrentTID = %d, rLockedTime(s, us) = %d, %d, rCurTime(s, us) = %d, %d\n", (VAL_ULONG_T)grVcodecEncHWLock.pvHandle, pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle), current->pid, grVcodecEncHWLock.rLockedTime.u4Sec, grVcodecEncHWLock.rLockedTime.u4uSec, rCurTime.u4Sec, rCurTime.u4uSec ); ++gLockTimeOutCount; if (gLockTimeOutCount > 30) { MFV_LOGE("[ERROR] VCODEC_LOCKHW - ID %d fail, someone locked HW over 30 times without timeout 0x%lx, %lx, 0x%lx, type:%d\n", current->pid, (VAL_ULONG_T)grVcodecEncHWLock.pvHandle, pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle), (VAL_ULONG_T)rHWLock.pvHandle, rHWLock.eDriverType); gLockTimeOutCount = 0; mutex_unlock(&VencHWLock); return -EFAULT; } // 2013/04/10. Cheng-Jung Never steal hardware lock if (0) //if (u4TimeInterval >= rHWLock.u4TimeoutMs) { if (rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key>) { grVcodecEncHWLock.pvHandle = (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle); grVcodecEncHWLock.eDriverType = rHWLock.eDriverType; eVideoGetTimeOfDay(&grVcodecEncHWLock.rLockedTime, sizeof(VAL_TIME_T)); MFV_LOGD("VCODEC_LOCKHW, LockInstance = 0x%lx, CurrentTID = %d, rLockedTime(s, us) = %d, %d\n", (VAL_ULONG_T)grVcodecEncHWLock.pvHandle, current->pid, grVcodecEncHWLock.rLockedTime.u4Sec, grVcodecEncHWLock.rLockedTime.u4uSec); bLockedHW = VAL_TRUE; if (rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key>) { venc_power_on(); } } } } if (VAL_TRUE == bLockedHW) { MFV_LOGD("VCODEC_LOCKHW, Lock ok grVcodecEncHWLock.pvHandle = 0x%lx, va:%lx, type:%d", (VAL_ULONG_T)grVcodecEncHWLock.pvHandle, (VAL_ULONG_T)rHWLock.pvHandle, rHWLock.eDriverType); gLockTimeOutCount = 0; } mutex_unlock(&VencHWLock); } if (VAL_FALSE == bLockedHW) { MFV_LOGE("[ERROR] VCODEC_LOCKHW - ID %d fail, someone locked HW already , 0x%lx, %lx, 0x%lx, type:%d\n", current->pid, (VAL_ULONG_T)grVcodecEncHWLock.pvHandle, pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle), (VAL_ULONG_T)rHWLock.pvHandle, rHWLock.eDriverType); gLockTimeOutCount = 0; return -EFAULT; } spin_lock_irqsave(&LockEncHWCountLock, ulFlagsLockHW); gu4LockEncHWCount++; <API key>(&LockEncHWCountLock, ulFlagsLockHW); MFV_LOGD("VCODEC_LOCKHW, get locked - ObjId =%d\n", current->pid); MFV_LOGD("VCODEC_LOCKHWed - tid = %d\n", current->pid); } else { MFV_LOGE("[WARNING] VCODEC_LOCKHW Unknown instance\n"); return -EFAULT; } MFV_LOGD("VCODEC_LOCKHW - tid = %d\n", current->pid); } break; case VCODEC_UNLOCKHW: { MFV_LOGD("VCODEC_UNLOCKHW + tid = %d\n", current->pid); user_data_addr = (VAL_UINT8_T *)arg; ret = copy_from_user(&rHWLock, user_data_addr, sizeof(VAL_HW_LOCK_T)); if (ret) { MFV_LOGE("[ERROR] VCODEC_UNLOCKHW, copy_from_user failed: %lu\n", ret); return -EFAULT; } MFV_LOGD("VCODEC_UNLOCKHW eDriverType = %d\n", rHWLock.eDriverType); eValRet = <API key>; if (rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key>) { mutex_lock(&VdecHWLock); if (grVcodecDecHWLock.pvHandle == (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle)) // Current owner give up hw lock { grVcodecDecHWLock.pvHandle = 0; grVcodecDecHWLock.eDriverType = <API key>; if (rHWLock.bSecureInst == VAL_FALSE) { disable_irq(VDEC_IRQ_ID); } // TODO: check if turning power off is ok vdec_power_off(); #ifdef ENABLE_MMDVFS_VDEC // MM DVFS related if (VAL_TRUE == <API key> && <API key> > <API key>) { _monitor_duration = <API key>(); if (_monitor_duration < MONITOR_DURATION_MS) { _diff = VdecDvfsStep(); MFV_LOGD("[VCODEC][MMDVFS_VDEC] @@ UNLOCK - lock time(%d ms, %d ms), cnt=%d, _monitor_duration=%d", _diff, gHWLockInterval, <API key>, _monitor_duration); } else { VdecDvfsStep(); _perc = (VAL_UINT32_T)(100 * gHWLockInterval / _monitor_duration); MFV_LOGE("[VCODEC][MMDVFS_VDEC] @@ UNLOCK - reset monitor duration (%d ms), percent: %d, (DROP_PERCENTAGE = %d, RAISE_PERCENTAGE = %d)", _monitor_duration, _perc, DROP_PERCENTAGE, RAISE_PERCENTAGE); if (_perc < DROP_PERCENTAGE) { SendDvfsRequest(DVFS_LOW); VdecDvfsEnd(DVFS_LOW); } else if (_perc > RAISE_PERCENTAGE) { SendDvfsRequest(DVFS_HIGH); VdecDvfsEnd(DVFS_HIGH); } else { VdecDvfsEnd(-1); } } } <API key> ++; #endif } else // Not current owner { MFV_LOGE("[ERROR] VCODEC_UNLOCKHW, Not owner trying to unlock dec hardware 0x%lx\n", pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle)); mutex_unlock(&VdecHWLock); return -EFAULT; } mutex_unlock(&VdecHWLock); eValRet = eVideoSetEvent(&DecHWLockEvent, sizeof(VAL_EVENT_T)); } else if (rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key>) { mutex_lock(&VencHWLock); if (grVcodecEncHWLock.pvHandle == (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle)) // Current owner give up hw lock { grVcodecEncHWLock.pvHandle = 0; grVcodecEncHWLock.eDriverType = <API key>; if (rHWLock.eDriverType == <API key> || rHWLock.eDriverType == <API key>) { //disable_irq(MT_VENC_IRQ_ID); disable_irq(VENC_IRQ_ID); // turn venc power off venc_power_off(); } } else // Not current owner { // [TODO] error handling MFV_LOGE("[ERROR] VCODEC_UNLOCKHW, Not owner trying to unlock enc hardware 0x%lx, pa:%lx, va:%lx type:%d\n", (VAL_ULONG_T)grVcodecEncHWLock.pvHandle, pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle), (VAL_ULONG_T)rHWLock.pvHandle, rHWLock.eDriverType); mutex_unlock(&VencHWLock); return -EFAULT; } mutex_unlock(&VencHWLock); eValRet = eVideoSetEvent(&EncHWLockEvent, sizeof(VAL_EVENT_T)); } else { MFV_LOGE("[WARNING] VCODEC_UNLOCKHW Unknown instance\n"); return -EFAULT; } MFV_LOGD("VCODEC_UNLOCKHW - tid = %d\n", current->pid); } break; case VCODEC_INC_PWR_USER: { MFV_LOGD("VCODEC_INC_PWR_USER + tid = %d\n", current->pid); user_data_addr = (VAL_UINT8_T *)arg; ret = copy_from_user(&rPowerParam, user_data_addr, sizeof(VAL_POWER_T)); if (ret) { MFV_LOGE("[ERROR] VCODEC_INC_PWR_USER, copy_from_user failed: %lu\n", ret); return -EFAULT; } MFV_LOGD("[VCODEC] INC_PWR_USER eDriverType = %d\n", rPowerParam.eDriverType); mutex_lock(&L2CLock); #ifdef VENC_USE_L2C if (rPowerParam.eDriverType == <API key>) { gu4L2CCounter++; MFV_LOGD("[VCODEC] INC_PWR_USER L2C counter = %d\n", gu4L2CCounter); if (1 == gu4L2CCounter) { if (config_L2(0)) { MFV_LOGE("[VCODEC][ERROR] Switch L2C size to 512K failed\n"); mutex_unlock(&L2CLock); return -EFAULT; } else { MFV_LOGE("[VCODEC] Switch L2C size to 512K successful\n"); } } } #endif mutex_unlock(&L2CLock); MFV_LOGD("VCODEC_INC_PWR_USER - tid = %d\n", current->pid); } break; case VCODEC_DEC_PWR_USER: { MFV_LOGD("VCODEC_DEC_PWR_USER + tid = %d\n", current->pid); user_data_addr = (VAL_UINT8_T *)arg; ret = copy_from_user(&rPowerParam, user_data_addr, sizeof(VAL_POWER_T)); if (ret) { MFV_LOGE("[ERROR] VCODEC_DEC_PWR_USER, copy_from_user failed: %lu\n", ret); return -EFAULT; } MFV_LOGD("[VCODEC] DEC_PWR_USER eDriverType = %d\n", rPowerParam.eDriverType); mutex_lock(&L2CLock); #ifdef VENC_USE_L2C if (rPowerParam.eDriverType == <API key>) { gu4L2CCounter MFV_LOGD("[VCODEC] DEC_PWR_USER L2C counter = %d\n", gu4L2CCounter); if (0 == gu4L2CCounter) { if (config_L2(1)) { MFV_LOGE("[VCODEC][ERROR] Switch L2C size to 0K failed\n"); mutex_unlock(&L2CLock); return -EFAULT; } else { MFV_LOGE("[VCODEC] Switch L2C size to 0K successful\n"); } } } #endif mutex_unlock(&L2CLock); MFV_LOGD("VCODEC_DEC_PWR_USER - tid = %d\n", current->pid); } break; case VCODEC_WAITISR: { MFV_LOGD("VCODEC_WAITISR + tid = %d\n", current->pid); user_data_addr = (VAL_UINT8_T *)arg; ret = copy_from_user(&val_isr, user_data_addr, sizeof(VAL_ISR_T)); if (ret) { MFV_LOGE("[ERROR] VCODEC_WAITISR, copy_from_user failed: %lu\n", ret); return -EFAULT; } if (val_isr.eDriverType == <API key> || val_isr.eDriverType == <API key> || val_isr.eDriverType == <API key> || val_isr.eDriverType == <API key> || val_isr.eDriverType == <API key> || val_isr.eDriverType == <API key> || val_isr.eDriverType == <API key>) { mutex_lock(&VdecHWLock); if (grVcodecDecHWLock.pvHandle == (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)val_isr.pvHandle)) { bLockedHW = VAL_TRUE; } else { } mutex_unlock(&VdecHWLock); if (bLockedHW == VAL_FALSE) { MFV_LOGE("[ERROR] VCODEC_WAITISR, DO NOT have HWLock, so return fail\n"); break; } spin_lock_irqsave(&DecIsrLock, ulFlags); DecIsrEvent.u4TimeoutMs = val_isr.u4TimeoutMs; <API key>(&DecIsrLock, ulFlags); eValRet = eVideoWaitEvent(&DecIsrEvent, sizeof(VAL_EVENT_T)); if (<API key> == eValRet) { return -2; } else if (<API key> == eValRet) { MFV_LOGE("[WARNING] VCODEC_WAITISR, <API key> return when WAITISR!!\n"); return -ERESTARTSYS; } } else if (val_isr.eDriverType == <API key> || val_isr.eDriverType == <API key>) { mutex_lock(&VencHWLock); if (grVcodecEncHWLock.pvHandle == (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)val_isr.pvHandle)) { bLockedHW = VAL_TRUE; } else { } mutex_unlock(&VencHWLock); if (bLockedHW == VAL_FALSE) { MFV_LOGE("[ERROR] VCODEC_WAITISR, DO NOT have enc HWLock, so return fail pa:%lx, va:%lx\n", pmem_user_v2p_video((VAL_ULONG_T)val_isr.pvHandle), (VAL_ULONG_T)val_isr.pvHandle); break; } spin_lock_irqsave(&EncIsrLock, ulFlags); EncIsrEvent.u4TimeoutMs = val_isr.u4TimeoutMs; <API key>(&EncIsrLock, ulFlags); eValRet = eVideoWaitEvent(&EncIsrEvent, sizeof(VAL_EVENT_T)); if (<API key> == eValRet) { return -2; } else if (<API key> == eValRet) { MFV_LOGE("[WARNING] VCODEC_WAITISR, <API key> return when WAITISR!!\n"); return -ERESTARTSYS; } if (val_isr.u4IrqStatusNum > 0) { val_isr.u4IrqStatus[0] = gu4HwVencIrqStatus; ret = copy_to_user(user_data_addr, &val_isr, sizeof(VAL_ISR_T)); if (ret) { MFV_LOGE("[ERROR] VCODEC_WAITISR, copy_to_user failed: %lu\n", ret); return -EFAULT; } } } else { MFV_LOGE("[WARNING] VCODEC_WAITISR Unknown instance\n"); return -EFAULT; } MFV_LOGD("VCODEC_WAITISR - tid = %d\n", current->pid); } break; case VCODEC_INITHWLOCK: { MFV_LOGE("VCODEC_INITHWLOCK [EMPTY] + - tid = %d\n", current->pid); MFV_LOGE("VCODEC_INITHWLOCK [EMPTY] - - tid = %d\n", current->pid); } break; case VCODEC_DEINITHWLOCK: { MFV_LOGE("VCODEC_DEINITHWLOCK [EMPTY] + - tid = %d\n", current->pid); MFV_LOGE("VCODEC_DEINITHWLOCK [EMPTY] - - tid = %d\n", current->pid); } break; case <API key>: { VAL_UINT8_T *user_data_addr; <API key> _temp; MFV_LOGD("<API key> +\n"); user_data_addr = (VAL_UINT8_T *)arg; // TODO: #if 0 // Morris Yang 20120112 mark temporarily _temp._cpu_idle_time = mt_get_cpu_idle(0); _temp._thread_cpu_time = <API key>(0); spin_lock_irqsave(&OalHWContextLock, ulFlags); _temp._inst_count = getCurInstanceCount(); <API key>(&OalHWContextLock, ulFlags); _temp._sched_clock = mt_sched_clock(); #endif ret = copy_to_user(user_data_addr, &_temp, sizeof(<API key>)); if (ret) { MFV_LOGE("[ERROR] <API key>, copy_to_user failed: %lu\n", ret); return -EFAULT; } MFV_LOGD("<API key> -\n"); } break; case <API key>: { MFV_LOGD("<API key> + - tid = %d\n", current->pid); user_data_addr = (VAL_UINT8_T *)arg; ret = copy_from_user(&rTempCoreLoading, user_data_addr, sizeof(<API key>)); if (ret) { MFV_LOGE("[ERROR] <API key>, copy_from_user failed: %lu\n", ret); return -EFAULT; } rTempCoreLoading.Loading = get_cpu_load(rTempCoreLoading.CPUid); ret = copy_to_user(user_data_addr, &rTempCoreLoading, sizeof(<API key>)); if (ret) { MFV_LOGE("[ERROR] <API key>, copy_to_user failed: %lu\n", ret); return -EFAULT; } MFV_LOGD("<API key> - - tid = %d\n", current->pid); } break; case <API key>: { MFV_LOGD("<API key> + - tid = %d\n", current->pid); user_data_addr = (VAL_UINT8_T *)arg; temp_nr_cpu_ids = nr_cpu_ids; ret = copy_to_user(user_data_addr, &temp_nr_cpu_ids, sizeof(int)); if (ret) { MFV_LOGE("[ERROR] <API key>, copy_to_user failed: %lu\n", ret); return -EFAULT; } MFV_LOGD("<API key> - - tid = %d\n", current->pid); } break; case <API key>: { MFV_LOGE("<API key> [EMPTY] + - tid = %d\n", current->pid); user_data_addr = (VAL_UINT8_T *)arg; ret = copy_from_user(&rCpuOppLimit, user_data_addr, sizeof(<API key>)); if (ret) { MFV_LOGE("[ERROR] <API key>, copy_from_user failed: %lu\n", ret); return -EFAULT; } MFV_LOGE("+<API key> (%d, %d, %d), tid = %d\n", rCpuOppLimit.limited_freq, rCpuOppLimit.limited_cpu, rCpuOppLimit.enable, current->pid); // TODO: Check if cpu_opp_limit is available //ret = cpu_opp_limit(EVENT_VIDEO, rCpuOppLimit.limited_freq, rCpuOppLimit.limited_cpu, rCpuOppLimit.enable); // 0: PASS, other: FAIL if (ret) { MFV_LOGE("[VCODEC][ERROR] cpu_opp_limit failed: %lu\n", ret); return -EFAULT; } MFV_LOGE("-<API key> tid = %d, ret = %lu\n", current->pid, ret); MFV_LOGE("<API key> [EMPTY] - - tid = %d\n", current->pid); } break; case VCODEC_MB: { mb(); } break; #if 0 case MFV_SET_CMD_CMD: MFV_LOGD("[MFV] MFV_SET_CMD_CMD\n"); MFV_LOGD("[MFV] Arg = %x\n", arg); user_data_addr = (VAL_UINT8_T *)arg; ret = copy_from_user(&rDrvCmdQueue, user_data_addr, sizeof(<API key>)); MFV_LOGD("[MFV] CmdNum = %d\n", rDrvCmdQueue.CmdNum); u4Size = (rDrvCmdQueue.CmdNum) * sizeof(VCODEC_DRV_CMD_T); cmd_queue = (P_VCODEC_DRV_CMD_T)kmalloc(u4Size, GFP_ATOMIC); if (cmd_queue != VAL_NULL && rDrvCmdQueue.pCmd != VAL_NULL) { ret = copy_from_user(cmd_queue, rDrvCmdQueue.pCmd, u4Size); while (cmd_queue->type != END_CMD) { switch (cmd_queue->type) { case ENABLE_HW_CMD: break; case DISABLE_HW_CMD: break; case WRITE_REG_CMD: VDO_HW_WRITE(cmd_queue->address + cmd_queue->offset, cmd_queue->value); break; case READ_REG_CMD: uValue = VDO_HW_READ(cmd_queue->address + cmd_queue->offset); copy_to_user((void *)cmd_queue->value, &uValue, sizeof(VAL_UINT32_T)); break; case WRITE_SYSRAM_CMD: VDO_HW_WRITE(cmd_queue->address + cmd_queue->offset, cmd_queue->value); break; case READ_SYSRAM_CMD: uValue = VDO_HW_READ(cmd_queue->address + cmd_queue->offset); copy_to_user((void *)cmd_queue->value, &uValue, sizeof(VAL_UINT32_T)); break; case MASTER_WRITE_CMD: uValue = VDO_HW_READ(cmd_queue->address + cmd_queue->offset); VDO_HW_WRITE(cmd_queue->address + cmd_queue->offset, cmd_queue->value | (uValue & cmd_queue->mask)); break; case SETUP_ISR_CMD: break; case WAIT_ISR_CMD: MFV_LOGD("<API key>: WAIT_ISR_CMD+\n"); MFV_LOGD("<API key>: WAIT_ISR_CMD-\n"); break; case TIMEOUT_CMD: break; case <API key>: break; case <API key>: break; case POLL_REG_STATUS_CMD: uValue = VDO_HW_READ(cmd_queue->address + cmd_queue->offset); nCount = 0; while ((uValue & cmd_queue->mask) != 0) { nCount++; if (nCount > 1000) { break; } uValue = VDO_HW_READ(cmd_queue->address + cmd_queue->offset); } break; default: break; } cmd_queue++; } } break; #endif default: { MFV_LOGE("========[ERROR] vcodec_ioctl default case======== %u\n", cmd); } break; } return 0xFF; } #if IS_ENABLED(CONFIG_COMPAT) typedef enum { VAL_HW_LOCK_TYPE = 0, VAL_POWER_TYPE, VAL_ISR_TYPE, VAL_MEMORY_TYPE } STRUCT_TYPE; typedef enum { COPY_FROM_USER = 0, COPY_TO_USER, } COPY_DIRECTION; typedef struct COMPAT_VAL_HW_LOCK { compat_uptr_t pvHandle; ///< [IN] The video codec driver handle compat_uint_t u4HandleSize; ///< [IN] The size of video codec driver handle compat_uptr_t pvLock; ///< [IN/OUT] The Lock discriptor compat_uint_t u4TimeoutMs; ///< [IN] The timeout ms compat_uptr_t pvReserved; ///< [IN/OUT] The reserved parameter compat_uint_t u4ReservedSize; ///< [IN] The size of reserved parameter structure compat_uint_t eDriverType; ///< [IN] The driver type char bSecureInst; ///< [IN] True if this is a secure instance // <API key> } <API key>; typedef struct COMPAT_VAL_POWER { compat_uptr_t pvHandle; ///< [IN] The video codec driver handle compat_uint_t u4HandleSize; ///< [IN] The size of video codec driver handle compat_uint_t eDriverType; ///< [IN] The driver type char fgEnable; ///< [IN] Enable or not. compat_uptr_t pvReserved; ///< [IN/OUT] The reserved parameter compat_uint_t u4ReservedSize; ///< [IN] The size of reserved parameter structure //VAL_UINT32_T u4L2CUser; ///< [OUT] The number of power user right now } COMPAT_VAL_POWER_T; typedef struct COMPAT_VAL_ISR { compat_uptr_t pvHandle; ///< [IN] The video codec driver handle compat_uint_t u4HandleSize; ///< [IN] The size of video codec driver handle compat_uint_t eDriverType; ///< [IN] The driver type compat_uptr_t pvIsrFunction; ///< [IN] The isr function compat_uptr_t pvReserved; ///< [IN/OUT] The reserved parameter compat_uint_t u4ReservedSize; ///< [IN] The size of reserved parameter structure compat_uint_t u4TimeoutMs; ///< [IN] The timeout in ms compat_uint_t u4IrqStatusNum; ///< [IN] The num of return registers when HW done compat_uint_t u4IrqStatus[IRQ_STATUS_MAX_NUM]; ///< [IN/OUT] The value of return registers when HW done } COMPAT_VAL_ISR_T; typedef struct COMPAT_VAL_MEMORY { compat_uint_t eMemType; ///< [IN] The allocation memory type compat_ulong_t u4MemSize; ///< [IN] The size of memory allocation compat_uptr_t pvMemVa; ///< [IN/OUT] The memory virtual address compat_uptr_t pvMemPa; ///< [IN/OUT] The memory physical address compat_uint_t eAlignment; ///< [IN] The memory byte alignment setting compat_uptr_t pvAlignMemVa; ///< [IN/OUT] The align memory virtual address compat_uptr_t pvAlignMemPa; ///< [IN/OUT] The align memory physical address compat_uint_t eMemCodec; ///< [IN] The memory codec for VENC or VDEC compat_uint_t i4IonShareFd; compat_uptr_t pIonBufhandle; compat_uptr_t pvReserved; ///< [IN/OUT] The reserved parameter compat_ulong_t u4ReservedSize; ///< [IN] The size of reserved parameter structure } COMPAT_VAL_MEMORY_T; static int compat_copy_struct( STRUCT_TYPE eType, COPY_DIRECTION eDirection, void __user *data32, void __user *data) { compat_uint_t u; compat_ulong_t l; compat_uptr_t p; char c; int err = 0; switch (eType) { case VAL_HW_LOCK_TYPE: { if (eDirection == COPY_FROM_USER) { <API key> __user *from32 = (<API key> *)data32; VAL_HW_LOCK_T __user *to = (VAL_HW_LOCK_T *)data; err = get_user(p, &(from32->pvHandle)); err |= put_user(p, &(to->pvHandle)); err |= get_user(u, &(from32->u4HandleSize)); err |= put_user(u, &(to->u4HandleSize)); err |= get_user(p, &(from32->pvLock)); err |= put_user(p, &(to->pvLock)); err |= get_user(u, &(from32->u4TimeoutMs)); err |= put_user(u, &(to->u4TimeoutMs)); err |= get_user(p, &(from32->pvReserved)); err |= put_user(p, &(to->pvReserved)); err |= get_user(u, &(from32->u4ReservedSize)); err |= put_user(u, &(to->u4ReservedSize)); err |= get_user(u, &(from32->eDriverType)); err |= put_user(u, &(to->eDriverType)); err |= get_user(c, &(from32->bSecureInst)); err |= put_user(c, &(to->bSecureInst)); } else { <API key> __user *to32 = (<API key> *)data32; VAL_HW_LOCK_T __user *from = (VAL_HW_LOCK_T *)data; err = get_user(p, &(from->pvHandle)); err |= put_user(p, &(to32->pvHandle)); err |= get_user(u, &(from->u4HandleSize)); err |= put_user(u, &(to32->u4HandleSize)); err |= get_user(p, &(from->pvLock)); err |= put_user(p, &(to32->pvLock)); err |= get_user(u, &(from->u4TimeoutMs)); err |= put_user(u, &(to32->u4TimeoutMs)); err |= get_user(p, &(from->pvReserved)); err |= put_user(p, &(to32->pvReserved)); err |= get_user(u, &(from->u4ReservedSize)); err |= put_user(u, &(to32->u4ReservedSize)); err |= get_user(u, &(from->eDriverType)); err |= put_user(u, &(to32->eDriverType)); err |= get_user(c, &(from->bSecureInst)); err |= put_user(c, &(to32->bSecureInst)); } } break; case VAL_POWER_TYPE: { if (eDirection == COPY_FROM_USER) { COMPAT_VAL_POWER_T __user *from32 = (COMPAT_VAL_POWER_T *)data32; VAL_POWER_T __user *to = (VAL_POWER_T *)data; err = get_user(p, &(from32->pvHandle)); err |= put_user(p, &(to->pvHandle)); err |= get_user(u, &(from32->u4HandleSize)); err |= put_user(u, &(to->u4HandleSize)); err |= get_user(u, &(from32->eDriverType)); err |= put_user(u, &(to->eDriverType)); err |= get_user(c, &(from32->fgEnable)); err |= put_user(c, &(to->fgEnable)); err |= get_user(p, &(from32->pvReserved)); err |= put_user(p, &(to->pvReserved)); err |= get_user(u, &(from32->u4ReservedSize)); err |= put_user(u, &(to->u4ReservedSize)); } else { COMPAT_VAL_POWER_T __user *to32 = (COMPAT_VAL_POWER_T *)data32; VAL_POWER_T __user *from = (VAL_POWER_T *)data; err = get_user(p, &(from->pvHandle)); err |= put_user(p, &(to32->pvHandle)); err |= get_user(u, &(from->u4HandleSize)); err |= put_user(u, &(to32->u4HandleSize)); err |= get_user(u, &(from->eDriverType)); err |= put_user(u, &(to32->eDriverType)); err |= get_user(c, &(from->fgEnable)); err |= put_user(c, &(to32->fgEnable)); err |= get_user(p, &(from->pvReserved)); err |= put_user(p, &(to32->pvReserved)); err |= get_user(u, &(from->u4ReservedSize)); err |= put_user(u, &(to32->u4ReservedSize)); } } break; case VAL_ISR_TYPE: { int i = 0; if (eDirection == COPY_FROM_USER) { COMPAT_VAL_ISR_T __user *from32 = (COMPAT_VAL_ISR_T *)data32; VAL_ISR_T __user *to = (VAL_ISR_T *)data; err = get_user(p, &(from32->pvHandle)); err |= put_user(p, &(to->pvHandle)); err |= get_user(u, &(from32->u4HandleSize)); err |= put_user(u, &(to->u4HandleSize)); err |= get_user(u, &(from32->eDriverType)); err |= put_user(u, &(to->eDriverType)); err |= get_user(p, &(from32->pvIsrFunction)); err |= put_user(p, &(to->pvIsrFunction)); err |= get_user(p, &(from32->pvReserved)); err |= put_user(p, &(to->pvReserved)); err |= get_user(u, &(from32->u4ReservedSize)); err |= put_user(u, &(to->u4ReservedSize)); err |= get_user(u, &(from32->u4TimeoutMs)); err |= put_user(u, &(to->u4TimeoutMs)); err |= get_user(u, &(from32->u4IrqStatusNum)); err |= put_user(u, &(to->u4IrqStatusNum)); for (; i < IRQ_STATUS_MAX_NUM; i++) { err |= get_user(u, &(from32->u4IrqStatus[i])); err |= put_user(u, &(to->u4IrqStatus[i])); } return err; } else { COMPAT_VAL_ISR_T __user *to32 = (COMPAT_VAL_ISR_T *)data32; VAL_ISR_T __user *from = (VAL_ISR_T *)data; err = get_user(p, &(from->pvHandle)); err |= put_user(p, &(to32->pvHandle)); err |= get_user(u, &(from->u4HandleSize)); err |= put_user(u, &(to32->u4HandleSize)); err |= get_user(u, &(from->eDriverType)); err |= put_user(u, &(to32->eDriverType)); err |= get_user(p, &(from->pvIsrFunction)); err |= put_user(p, &(to32->pvIsrFunction)); err |= get_user(p, &(from->pvReserved)); err |= put_user(p, &(to32->pvReserved)); err |= get_user(u, &(from->u4ReservedSize)); err |= put_user(u, &(to32->u4ReservedSize)); err |= get_user(u, &(from->u4TimeoutMs)); err |= put_user(u, &(to32->u4TimeoutMs)); err |= get_user(u, &(from->u4IrqStatusNum)); err |= put_user(u, &(to32->u4IrqStatusNum)); for (; i < IRQ_STATUS_MAX_NUM; i++) { err |= get_user(u, &(from->u4IrqStatus[i])); err |= put_user(u, &(to32->u4IrqStatus[i])); } } } break; case VAL_MEMORY_TYPE: { if (eDirection == COPY_FROM_USER) { COMPAT_VAL_MEMORY_T __user *from32 = (COMPAT_VAL_MEMORY_T *)data32; VAL_MEMORY_T __user *to = (VAL_MEMORY_T *)data; err = get_user(u, &(from32->eMemType)); err |= put_user(u, &(to->eMemType)); err |= get_user(l, &(from32->u4MemSize)); err |= put_user(l, &(to->u4MemSize)); err |= get_user(p, &(from32->pvMemVa)); err |= put_user(p, &(to->pvMemVa)); err |= get_user(p, &(from32->pvMemPa)); err |= put_user(p, &(to->pvMemPa)); err |= get_user(u, &(from32->eAlignment)); err |= put_user(u, &(to->eAlignment)); err |= get_user(p, &(from32->pvAlignMemVa)); err |= put_user(p, &(to->pvAlignMemVa)); err |= get_user(p, &(from32->pvAlignMemPa)); err |= put_user(p, &(to->pvAlignMemPa)); err |= get_user(u, &(from32->eMemCodec)); err |= put_user(u, &(to->eMemCodec)); err |= get_user(u, &(from32->i4IonShareFd)); err |= put_user(u, &(to->i4IonShareFd)); err |= get_user(p, &(from32->pIonBufhandle)); err |= put_user(p, &(to->pIonBufhandle)); err |= get_user(p, &(from32->pvReserved)); err |= put_user(p, &(to->pvReserved)); err |= get_user(l, &(from32->u4ReservedSize)); err |= put_user(l, &(to->u4ReservedSize)); return err; } else { COMPAT_VAL_MEMORY_T __user *to32 = (COMPAT_VAL_MEMORY_T *)data32; VAL_MEMORY_T __user *from = (VAL_MEMORY_T *)data; err = get_user(u, &(from->eMemType)); err |= put_user(u, &(to32->eMemType)); err |= get_user(l, &(from->u4MemSize)); err |= put_user(l, &(to32->u4MemSize)); err |= get_user(p, &(from->pvMemVa)); err |= put_user(p, &(to32->pvMemVa)); err |= get_user(p, &(from->pvMemPa)); err |= put_user(p, &(to32->pvMemPa)); err |= get_user(u, &(from->eAlignment)); err |= put_user(u, &(to32->eAlignment)); err |= get_user(p, &(from->pvAlignMemVa)); err |= put_user(p, &(to32->pvAlignMemVa)); err |= get_user(p, &(from->pvAlignMemPa)); err |= put_user(p, &(to32->pvAlignMemPa)); err |= get_user(u, &(from->eMemCodec)); err |= put_user(u, &(to32->eMemCodec)); err |= get_user(u, &(from->i4IonShareFd)); err |= put_user(u, &(to32->i4IonShareFd)); err |= get_user(p, &(from->pIonBufhandle)); err |= put_user(p, &(to32->pIonBufhandle)); err |= get_user(p, &(from->pvReserved)); err |= put_user(p, &(to32->pvReserved)); err |= get_user(l, &(from->u4ReservedSize)); err |= put_user(l, &(to32->u4ReservedSize)); } } break; default: break; } return err; } static long <API key>(struct file *file, unsigned int cmd, unsigned long arg) { long ret = 0; MFV_LOGD("<API key>: 0x%x\n", cmd); switch (cmd) { case <API key>: case <API key>: { COMPAT_VAL_MEMORY_T __user *data32; VAL_MEMORY_T __user *data; int err; data32 = compat_ptr(arg); data = <API key>(sizeof(VAL_MEMORY_T)); if (data == NULL) { return -EFAULT; } err = compat_copy_struct(VAL_MEMORY_TYPE, COPY_FROM_USER, (void *)data32, (void *)data); if (err) { return err; } ret = file->f_op->unlocked_ioctl(file, cmd, (unsigned long)data); err = compat_copy_struct(VAL_MEMORY_TYPE, COPY_TO_USER, (void *)data32, (void *)data); if (err) { return err; } return ret; } break; case VCODEC_LOCKHW: case VCODEC_UNLOCKHW: { <API key> __user *data32; VAL_HW_LOCK_T __user *data; int err; data32 = compat_ptr(arg); data = <API key>(sizeof(VAL_HW_LOCK_T)); if (data == NULL) { return -EFAULT; } err = compat_copy_struct(VAL_HW_LOCK_TYPE, COPY_FROM_USER, (void *)data32, (void *)data); if (err) { return err; } ret = file->f_op->unlocked_ioctl(file, cmd, (unsigned long)data); err = compat_copy_struct(VAL_HW_LOCK_TYPE, COPY_TO_USER, (void *)data32, (void *)data); if (err) { return err; } return ret; } break; case VCODEC_INC_PWR_USER: case VCODEC_DEC_PWR_USER: { COMPAT_VAL_POWER_T __user *data32; VAL_POWER_T __user *data; int err; data32 = compat_ptr(arg); data = <API key>(sizeof(VAL_POWER_T)); if (data == NULL) { return -EFAULT; } err = compat_copy_struct(VAL_POWER_TYPE, COPY_FROM_USER, (void *)data32, (void *)data); if (err) { return err; } ret = file->f_op->unlocked_ioctl(file, cmd, (unsigned long)data); err = compat_copy_struct(VAL_POWER_TYPE, COPY_TO_USER, (void *)data32, (void *)data); if (err) { return err; } return ret; } break; case VCODEC_WAITISR: { COMPAT_VAL_ISR_T __user *data32; VAL_ISR_T __user *data; int err; data32 = compat_ptr(arg); data = <API key>(sizeof(VAL_ISR_T)); if (data == NULL) { return -EFAULT; } err = compat_copy_struct(VAL_ISR_TYPE, COPY_FROM_USER, (void *)data32, (void *)data); if (err) { return err; } ret = file->f_op->unlocked_ioctl(file, VCODEC_WAITISR, (unsigned long)data); err = compat_copy_struct(VAL_ISR_TYPE, COPY_TO_USER, (void *)data32, (void *)data); if (err) { return err; } return ret; } break; default: { return <API key>(file, cmd, arg); } break; } return 0; } #else #define <API key> NULL #endif static int vcodec_open(struct inode *inode, struct file *file) { MFV_LOGD("vcodec_open\n"); mutex_lock(&DriverOpenCountLock); Driver_Open_Count++; MFV_LOGE("vcodec_open pid = %d, Driver_Open_Count %d\n", current->pid, Driver_Open_Count); mutex_unlock(&DriverOpenCountLock); // TODO: Check upper limit of concurrent users? return 0; } static int vcodec_flush(struct file *file, fl_owner_t id) { MFV_LOGD("vcodec_flush, curr_tid =%d\n", current->pid); MFV_LOGE("vcodec_flush pid = %d, Driver_Open_Count %d\n", current->pid, Driver_Open_Count); return 0; } static int vcodec_release(struct inode *inode, struct file *file) { VAL_ULONG_T ulFlagsLockHW, ulFlagsISR; //dump_stack(); MFV_LOGD("vcodec_release, curr_tid =%d\n", current->pid); mutex_lock(&DriverOpenCountLock); MFV_LOGE("vcodec_release pid = %d, Driver_Open_Count %d\n", current->pid, Driver_Open_Count); Driver_Open_Count if (Driver_Open_Count == 0) { mutex_lock(&VdecHWLock); gu4VdecLockThreadId = 0; grVcodecDecHWLock.pvHandle = 0; grVcodecDecHWLock.eDriverType = <API key>; grVcodecDecHWLock.rLockedTime.u4Sec = 0; grVcodecDecHWLock.rLockedTime.u4uSec = 0; mutex_unlock(&VdecHWLock); mutex_lock(&VencHWLock); grVcodecEncHWLock.pvHandle = 0; grVcodecEncHWLock.eDriverType = <API key>; grVcodecEncHWLock.rLockedTime.u4Sec = 0; grVcodecEncHWLock.rLockedTime.u4uSec = 0; mutex_unlock(&VencHWLock); mutex_lock(&DecEMILock); gu4DecEMICounter = 0; mutex_unlock(&DecEMILock); mutex_lock(&EncEMILock); gu4EncEMICounter = 0; mutex_unlock(&EncEMILock); mutex_lock(&PWRLock); gu4PWRCounter = 0; mutex_unlock(&PWRLock); #if defined(VENC_USE_L2C) mutex_lock(&L2CLock); if (gu4L2CCounter != 0) { MFV_LOGE("vcodec_flush pid = %d, L2 user = %d, force restore L2 settings\n", current->pid, gu4L2CCounter); if (config_L2(1)) { MFV_LOGE("[VCODEC][ERROR] restore L2 settings failed\n"); } } gu4L2CCounter = 0; mutex_unlock(&L2CLock); #endif spin_lock_irqsave(&LockDecHWCountLock, ulFlagsLockHW); gu4LockDecHWCount = 0; <API key>(&LockDecHWCountLock, ulFlagsLockHW); spin_lock_irqsave(&LockEncHWCountLock, ulFlagsLockHW); gu4LockEncHWCount = 0; <API key>(&LockEncHWCountLock, ulFlagsLockHW); spin_lock_irqsave(&DecISRCountLock, ulFlagsISR); gu4DecISRCount = 0; <API key>(&DecISRCountLock, ulFlagsISR); spin_lock_irqsave(&EncISRCountLock, ulFlagsISR); gu4EncISRCount = 0; <API key>(&EncISRCountLock, ulFlagsISR); #ifdef ENABLE_MMDVFS_VDEC if (VAL_TRUE == <API key>) { <API key> = VAL_FALSE; <API key> = 0; gHWLockInterval = 0; gHWLockMaxDuration = 0; SendDvfsRequest(DVFS_LOW); } #endif } #ifdef ENABLE_MMDVFS_VDEC mutex_lock(&DecEMILock); if (VAL_TRUE == <API key> && 0 == gu4DecEMICounter) { <API key> = VAL_FALSE; <API key> = 0; gHWLockInterval = 0; gHWLockMaxDuration = 0; SendDvfsRequest(DVFS_LOW); } mutex_unlock(&DecEMILock); #endif mutex_unlock(&DriverOpenCountLock); return 0; } void vcodec_vma_open(struct vm_area_struct *vma) { MFV_LOGD("vcodec VMA open, virt %lx, phys %lx\n", vma->vm_start, vma->vm_pgoff << PAGE_SHIFT); } void vcodec_vma_close(struct vm_area_struct *vma) { MFV_LOGD("vcodec VMA close, virt %lx, phys %lx\n", vma->vm_start, vma->vm_pgoff << PAGE_SHIFT); } static struct <API key> vcodec_remap_vm_ops = { .open = vcodec_vma_open, .close = vcodec_vma_close, }; static int vcodec_mmap(struct file *file, struct vm_area_struct *vma) { #if 1 VAL_UINT32_T u4I = 0; VAL_ULONG_T length; VAL_ULONG_T pfn; length = vma->vm_end - vma->vm_start; pfn = vma->vm_pgoff << PAGE_SHIFT; if (((length > VENC_REGION) || (pfn < VENC_BASE) || (pfn > VENC_BASE + VENC_REGION)) && ((length > VDEC_REGION) || (pfn < VDEC_BASE_PHY) || (pfn > VDEC_BASE_PHY + VDEC_REGION)) && ((length > HW_REGION) || (pfn < HW_BASE) || (pfn > HW_BASE + HW_REGION)) && ((length > INFO_REGION) || (pfn < INFO_BASE) || (pfn > INFO_BASE + INFO_REGION)) ) { VAL_ULONG_T ulAddr, ulSize; for (u4I = 0; u4I < <API key>; u4I++) { if ((<API key>[u4I].ulKVA != -1L) && (<API key>[u4I].ulKPA != -1L)) { ulAddr = <API key>[u4I].ulKPA; ulSize = (<API key>[u4I].ulSize + 0x1000 - 1) & ~(0x1000 - 1); if ((length == ulSize) && (pfn == ulAddr)) { MFV_LOGD("[VCODEC] cache idx %d \n", u4I); break; } } } if (u4I == <API key>) { MFV_LOGE("[VCODEC][ERROR] mmap region error: Length(0x%lx), pfn(0x%lx)\n", (VAL_ULONG_T)length, pfn); return -EAGAIN; } } #endif vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); MFV_LOGE("[VCODEC][mmap] vma->start 0x%lx, vma->end 0x%lx, vma->pgoff 0x%lx\n", (VAL_ULONG_T)vma->vm_start, (VAL_ULONG_T)vma->vm_end, (VAL_ULONG_T)vma->vm_pgoff); if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, vma->vm_end - vma->vm_start, vma->vm_page_prot)) { return -EAGAIN; } vma->vm_ops = &vcodec_remap_vm_ops; vcodec_vma_open(vma); return 0; } static struct file_operations vcodec_fops = { .owner = THIS_MODULE, .unlocked_ioctl = <API key>, .open = vcodec_open, .flush = vcodec_flush, .release = vcodec_release, .mmap = vcodec_mmap, #if IS_ENABLED(CONFIG_COMPAT) .compat_ioctl = <API key>, #endif }; static int vcodec_probe(struct platform_device *dev) { int ret; MFV_LOGD("+vcodec_probe\n"); mutex_lock(&DecEMILock); gu4DecEMICounter = 0; mutex_unlock(&DecEMILock); mutex_lock(&EncEMILock); gu4EncEMICounter = 0; mutex_unlock(&EncEMILock); mutex_lock(&PWRLock); gu4PWRCounter = 0; mutex_unlock(&PWRLock); mutex_lock(&L2CLock); gu4L2CCounter = 0; mutex_unlock(&L2CLock); ret = <API key>(vcodec_devno, 1, VCODEC_DEVNAME); if (ret) { MFV_LOGE("[ERROR] Can't Get Major number for VCodec Device\n"); } vcodec_cdev = cdev_alloc(); vcodec_cdev->owner = THIS_MODULE; vcodec_cdev->ops = &vcodec_fops; ret = cdev_add(vcodec_cdev, vcodec_devno, 1); if (ret) { MFV_LOGE("[ERROR] Can't add Vcodec Device\n"); } vcodec_class = class_create(THIS_MODULE, VCODEC_DEVNAME); if (IS_ERR(vcodec_class)) { ret = PTR_ERR(vcodec_class); MFV_LOGE("[VCODEC][ERROR] Unable to create class, err = %d", ret); return ret; } vcodec_device = device_create(vcodec_class, NULL, vcodec_devno, NULL, VCODEC_DEVNAME); //if (request_irq(MT_VDEC_IRQ_ID , (irq_handler_t)video_intr_dlr, IRQF_TRIGGER_LOW, VCODEC_DEVNAME, NULL) < 0) if (request_irq(VDEC_IRQ_ID , (irq_handler_t)video_intr_dlr, IRQF_TRIGGER_LOW, VCODEC_DEVNAME, NULL) < 0) { MFV_LOGE("[VCODEC][ERROR] error to request dec irq\n"); } else { MFV_LOGD("[VCODEC] success to request dec irq: %d\n", VDEC_IRQ_ID); } //if (request_irq(MT_VENC_IRQ_ID , (irq_handler_t)video_intr_dlr2, IRQF_TRIGGER_LOW, VCODEC_DEVNAME, NULL) < 0) if (request_irq(VENC_IRQ_ID , (irq_handler_t)video_intr_dlr2, IRQF_TRIGGER_LOW, VCODEC_DEVNAME, NULL) < 0) { MFV_LOGD("[VCODEC][ERROR] error to request enc irq\n"); } else { MFV_LOGD("[VCODEC] success to request enc irq: %d\n", VENC_IRQ_ID); } //disable_irq(MT_VDEC_IRQ_ID); disable_irq(VDEC_IRQ_ID); //disable_irq(MT_VENC_IRQ_ID); disable_irq(VENC_IRQ_ID); #if !defined(CONFIG_MTK_LEGACY) <API key> = devm_clk_get(&dev->dev, "<API key>"); if (IS_ERR(<API key>)) { MFV_LOGE("[VCODEC][ERROR] Unable to devm_clk_get <API key>\n"); return PTR_ERR(<API key>); } <API key> = devm_clk_get(&dev->dev, "MT_CG_VDEC0_VDEC"); if (IS_ERR(<API key>)) { MFV_LOGE("[VCODEC][ERROR] Unable to devm_clk_get MT_CG_VDEC0_VDEC\n"); return PTR_ERR(<API key>); } <API key> = devm_clk_get(&dev->dev, "MT_CG_VDEC1_LARB"); if (IS_ERR(<API key>)) { MFV_LOGE("[VCODEC][ERROR] Unable to devm_clk_get MT_CG_VDEC1_LARB\n"); return PTR_ERR(<API key>); } clk_MT_CG_VENC_VENC = devm_clk_get(&dev->dev, "MT_CG_VENC_VENC"); if (IS_ERR(clk_MT_CG_VENC_VENC)) { MFV_LOGE("[VCODEC][ERROR] Unable to devm_clk_get MT_CG_VENC_VENC\n"); return PTR_ERR(clk_MT_CG_VENC_VENC); } clk_MT_CG_VENC_LARB = devm_clk_get(&dev->dev, "MT_CG_VENC_LARB"); if (IS_ERR(clk_MT_CG_VENC_LARB)) { MFV_LOGE("[VCODEC][ERROR] Unable to devm_clk_get MT_CG_VENC_LARB\n"); return PTR_ERR(clk_MT_CG_VENC_LARB); } #endif /* !defined(CONFIG_MTK_LEGACY) */ MFV_LOGD("vcodec_probe Done\n"); return 0; } static int vcodec_remove(struct platform_device *pDev) { MFV_LOGD("vcodec_remove\n"); return 0; } #ifdef <API key> extern void mt_irq_set_sens(unsigned int irq, unsigned int sens); extern void mt_irq_set_polarity(unsigned int irq, unsigned int polarity); static int <API key>(struct device *device) { // vdec: IRQF_TRIGGER_LOW mt_irq_set_sens(VDEC_IRQ_ID, MT_LEVEL_SENSITIVE); mt_irq_set_polarity(VDEC_IRQ_ID, MT_POLARITY_LOW); // venc: IRQF_TRIGGER_LOW mt_irq_set_sens(VENC_IRQ_ID, MT_LEVEL_SENSITIVE); mt_irq_set_polarity(VENC_IRQ_ID, MT_POLARITY_LOW); return 0; } #endif static const struct of_device_id vcodec_of_match[] = { { .compatible = "mediatek,VDEC_GCON", }, {/* sentinel */} }; MODULE_DEVICE_TABLE(of, vcodec_of_match); static struct platform_driver vcodec_driver = { .probe = vcodec_probe, .remove = vcodec_remove, /* .suspend = vcodec_suspend, .resume = vcodec_resume, */ .driver = { .name = VCODEC_DEVNAME, .owner = THIS_MODULE, .of_match_table = vcodec_of_match, }, }; static int __init vcodec_driver_init(void) { VAL_RESULT_T eValHWLockRet; VAL_ULONG_T ulFlags, ulFlagsLockHW, ulFlagsISR; MFV_LOGD("+vcodec_driver_init !!\n"); mutex_lock(&DriverOpenCountLock); Driver_Open_Count = 0; mutex_unlock(&DriverOpenCountLock); { struct device_node *node = NULL; node = <API key>(NULL, NULL, "mediatek,VENC"); KVA_VENC_BASE = (VAL_ULONG_T)of_iomap(node, 0); VENC_IRQ_ID = <API key>(node, 0); <API key> = KVA_VENC_BASE + 0x05C; <API key> = KVA_VENC_BASE + 0x060; } { struct device_node *node = NULL; node = <API key>(NULL, NULL, "mediatek,VDEC_FULL_TOP"); KVA_VDEC_BASE = (VAL_ULONG_T)of_iomap(node, 0); VDEC_IRQ_ID = <API key>(node, 0); KVA_VDEC_MISC_BASE = KVA_VDEC_BASE + 0x0000; KVA_VDEC_VLD_BASE = KVA_VDEC_BASE + 0x1000; } { struct device_node *node = NULL; node = <API key>(NULL, NULL, "mediatek,VDEC_GCON"); KVA_VDEC_GCON_BASE = (VAL_ULONG_T)of_iomap(node, 0); MFV_LOGD("[VCODEC][DeviceTree] KVA_VENC_BASE(0x%lx), KVA_VDEC_BASE(0x%lx), KVA_VDEC_GCON_BASE(0x%lx)", KVA_VENC_BASE, KVA_VDEC_BASE, KVA_VDEC_GCON_BASE); MFV_LOGD("[VCODEC][DeviceTree] VDEC_IRQ_ID(%d), VENC_IRQ_ID(%d)", VDEC_IRQ_ID, VENC_IRQ_ID); } // <API key> = (VAL_ULONG_T)ioremap(<API key>, 4); // <API key> = (VAL_ULONG_T)ioremap(VENC_IRQ_ACK_addr, 4); #ifdef VENC_PWR_FPGA // useless 2014_3_4 <API key> = (VAL_ULONG_T)ioremap(CLK_CFG_0_addr, 4); <API key> = (VAL_ULONG_T)ioremap(CLK_CFG_4_addr, 4); KVA_VENC_PWR_ADDR = (VAL_ULONG_T)ioremap(VENC_PWR_addr, 4); <API key> = (VAL_ULONG_T)ioremap(VENCSYS_CG_SET_addr, 4); #endif spin_lock_irqsave(&LockDecHWCountLock, ulFlagsLockHW); gu4LockDecHWCount = 0; <API key>(&LockDecHWCountLock, ulFlagsLockHW); spin_lock_irqsave(&LockEncHWCountLock, ulFlagsLockHW); gu4LockEncHWCount = 0; <API key>(&LockEncHWCountLock, ulFlagsLockHW); spin_lock_irqsave(&DecISRCountLock, ulFlagsISR); gu4DecISRCount = 0; <API key>(&DecISRCountLock, ulFlagsISR); spin_lock_irqsave(&EncISRCountLock, ulFlagsISR); gu4EncISRCount = 0; <API key>(&EncISRCountLock, ulFlagsISR); mutex_lock(&VdecPWRLock); gu4VdecPWRCounter = 0; mutex_unlock(&VdecPWRLock); mutex_lock(&VencPWRLock); gu4VencPWRCounter = 0; mutex_unlock(&VencPWRLock); mutex_lock(&IsOpenedLock); if (VAL_FALSE == bIsOpened) { bIsOpened = VAL_TRUE; //vcodec_probe(NULL); } mutex_unlock(&IsOpenedLock); mutex_lock(&VdecHWLock); gu4VdecLockThreadId = 0; grVcodecDecHWLock.pvHandle = 0; grVcodecDecHWLock.eDriverType = <API key>; grVcodecDecHWLock.rLockedTime.u4Sec = 0; grVcodecDecHWLock.rLockedTime.u4uSec = 0; mutex_unlock(&VdecHWLock); mutex_lock(&VencHWLock); grVcodecEncHWLock.pvHandle = 0; grVcodecEncHWLock.eDriverType = <API key>; grVcodecEncHWLock.rLockedTime.u4Sec = 0; grVcodecEncHWLock.rLockedTime.u4uSec = 0; mutex_unlock(&VencHWLock); //HWLockEvent part mutex_lock(&<API key>); DecHWLockEvent.pvHandle = "DECHWLOCK_EVENT"; DecHWLockEvent.u4HandleSize = sizeof("DECHWLOCK_EVENT") + 1; DecHWLockEvent.u4TimeoutMs = 1; mutex_unlock(&<API key>); eValHWLockRet = eVideoCreateEvent(&DecHWLockEvent, sizeof(VAL_EVENT_T)); if (VAL_RESULT_NO_ERROR != eValHWLockRet) { MFV_LOGE("[VCODEC][ERROR] create dec hwlock event error\n"); } mutex_lock(&<API key>); EncHWLockEvent.pvHandle = "ENCHWLOCK_EVENT"; EncHWLockEvent.u4HandleSize = sizeof("ENCHWLOCK_EVENT") + 1; EncHWLockEvent.u4TimeoutMs = 1; mutex_unlock(&<API key>); eValHWLockRet = eVideoCreateEvent(&EncHWLockEvent, sizeof(VAL_EVENT_T)); if (VAL_RESULT_NO_ERROR != eValHWLockRet) { MFV_LOGE("[VCODEC][ERROR] create enc hwlock event error\n"); } //IsrEvent part spin_lock_irqsave(&DecIsrLock, ulFlags); DecIsrEvent.pvHandle = "DECISR_EVENT"; DecIsrEvent.u4HandleSize = sizeof("DECISR_EVENT") + 1; DecIsrEvent.u4TimeoutMs = 1; <API key>(&DecIsrLock, ulFlags); eValHWLockRet = eVideoCreateEvent(&DecIsrEvent, sizeof(VAL_EVENT_T)); if (VAL_RESULT_NO_ERROR != eValHWLockRet) { MFV_LOGE("[VCODEC][ERROR] create dec isr event error\n"); } spin_lock_irqsave(&EncIsrLock, ulFlags); EncIsrEvent.pvHandle = "ENCISR_EVENT"; EncIsrEvent.u4HandleSize = sizeof("ENCISR_EVENT") + 1; EncIsrEvent.u4TimeoutMs = 1; <API key>(&EncIsrLock, ulFlags); eValHWLockRet = eVideoCreateEvent(&EncIsrEvent, sizeof(VAL_EVENT_T)); if (VAL_RESULT_NO_ERROR != eValHWLockRet) { MFV_LOGE("[VCODEC][ERROR] create enc isr event error\n"); } MFV_LOGD("vcodec_driver_init Done\n"); #ifdef <API key> <API key>(ID_M_VCODEC, <API key>, NULL); #endif return <API key>(&vcodec_driver); } static void __exit vcodec_driver_exit(void) { VAL_RESULT_T eValHWLockRet; MFV_LOGD("vcodec_driver_exit\n"); mutex_lock(&IsOpenedLock); if (VAL_TRUE == bIsOpened) { bIsOpened = VAL_FALSE; } mutex_unlock(&IsOpenedLock); cdev_del(vcodec_cdev); <API key>(vcodec_devno, 1); // [TODO] iounmap the following? #if 0 iounmap((void *)<API key>); iounmap((void *)<API key>); #endif #ifdef VENC_PWR_FPGA iounmap((void *)<API key>); iounmap((void *)<API key>); iounmap((void *)KVA_VENC_PWR_ADDR); iounmap((void *)<API key>); #endif // [TODO] free IRQ here //free_irq(MT_VENC_IRQ_ID, NULL); free_irq(VENC_IRQ_ID, NULL); //free_irq(MT_VDEC_IRQ_ID, NULL); free_irq(VDEC_IRQ_ID, NULL); //MT6589_HWLockEvent part eValHWLockRet = eVideoCloseEvent(&DecHWLockEvent, sizeof(VAL_EVENT_T)); if (VAL_RESULT_NO_ERROR != eValHWLockRet) { MFV_LOGE("[VCODEC][ERROR] close dec hwlock event error\n"); } eValHWLockRet = eVideoCloseEvent(&EncHWLockEvent, sizeof(VAL_EVENT_T)); if (VAL_RESULT_NO_ERROR != eValHWLockRet) { MFV_LOGE("[VCODEC][ERROR] close enc hwlock event error\n"); } //MT6589_IsrEvent part eValHWLockRet = eVideoCloseEvent(&DecIsrEvent, sizeof(VAL_EVENT_T)); if (VAL_RESULT_NO_ERROR != eValHWLockRet) { MFV_LOGE("[VCODEC][ERROR] close dec isr event error\n"); } eValHWLockRet = eVideoCloseEvent(&EncIsrEvent, sizeof(VAL_EVENT_T)); if (VAL_RESULT_NO_ERROR != eValHWLockRet) { MFV_LOGE("[VCODEC][ERROR] close enc isr event error\n"); } #ifdef <API key> <API key>(ID_M_VCODEC); #endif <API key>(&vcodec_driver); } module_init(vcodec_driver_init); module_exit(vcodec_driver_exit); MODULE_AUTHOR("Legis, Lu <legis.lu@mediatek.com>"); MODULE_DESCRIPTION("Denali-1 Vcodec Driver"); MODULE_LICENSE("GPL");
define( ({ "collapse": "Spusti traku s alatima editora", "expand": "Proširi traku s alatima editora" }) );
package upgrader import ( "github.com/juju/juju/agent/tools" "github.com/juju/juju/version" ) // UpgradeReadyError is returned by an Upgrader to report that // an upgrade is ready to be performed and a restart is due. type UpgradeReadyError struct { AgentName string OldTools version.Binary NewTools version.Binary DataDir string } func (e *UpgradeReadyError) Error() string { return "must restart: an agent upgrade is available" } // ChangeAgentTools does the actual agent upgrade. // It should be called just before an agent exits, so that // it will restart running the new tools. func (e *UpgradeReadyError) ChangeAgentTools() error { agentTools, err := tools.ChangeAgentTools(e.DataDir, e.AgentName, e.NewTools) if err != nil { return err } logger.Infof("upgraded from %v to %v (%q)", e.OldTools, agentTools.Version, agentTools.URL) return nil }
// stdafx.cpp : source file that includes just the standard includes // xpad.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file string format(const char* fmt, ...) { va_list args; va_start(args, fmt); int result = -1, length = 256; char* buffer = NULL; while(result == -1) { if(buffer) delete [] buffer; buffer = new char[length + 1]; memset(buffer, 0, length + 1); result = _vsnprintf(buffer, length, fmt, args); length *= 2; } va_end(args); string s(buffer); delete [] buffer; return s; }
<!DOCTYPE html> <html> <head> <title>dom_test</title> <script src="test_bootstrap.js"></script> <script type="text/javascript"> goog.require('bot.dom.core'); goog.require('bot.userAgent'); goog.require('goog.testing.jsunit'); goog.require('goog.userAgent'); </script> <body> <script type="text/javascript"> function <API key>() { var toTest = [ {input: "Left: 0px; Text-align: center;", expected: "left: 0px; text-align: center;"}, {input: "background-image: url('testdata/kitten3.jpg');", expected: "background-image: url('testdata/kitten3.jpg');"}, {input: "-ms-filter: 'progid:DXImageTransform(strength=50)," + " progid:DXImageTransform.(mirror=1)';", expected: "-ms-filter: 'progid:DXImageTransform(strength=50)," + " progid:DXImageTransform.(mirror=1)';"} ]; for (var i = 0; i < toTest.length; i++) { assertObjectEquals(toTest[i].expected, bot.dom.core.<API key>(toTest[i].input)); } } function <API key>() { assertEquals("background-color:green; width:100px; height:50px;", bot.dom.core.<API key>( "background-color:green; width:100px; height:50px") ); } function <API key>() { if (goog.userAgent.IE && !bot.userAgent.isProductVersion(7)) { // IE6 cannot properly parse the embedded semicolons in the strings below. return; } var toTest = [ {input: "key:value", expected: "key:value;"}, {input: "key:value;", expected: "key:value;"}, {input: "key1:value1; key2: value2", expected: "key1:value1; key2: value2;"}, {input: "key1:value1; key2: value2(semi;colons;in;here;)", expected: "key1:value1; key2: value2(semi;colons;in;here;);"}, {input: "key1:value1; key2: 'string; with; semicolons; and more';", expected: "key1:value1; key2: 'string; with; semicolons; and more';"}, {input: "key1:value1; key2: 'string; with; semicolons; and more'", expected: "key1:value1; key2: 'string; with; semicolons; and more';"}, {input: "key1:value1;" + " key2: url('something;with;semicolons;?oh=yeah&x=y');" + " key3:'string;with;semicolons;'", expected: "key1:value1;" + " key2: url('something;with;semicolons;?oh=yeah&x=y');" + " key3:'string;with;semicolons;';"}, {input: "key1:\"double;quoted;string!\";" + " key2:'single;quoted;string;';" + " key3:it(is;in;parens);", expected: "key1:\"double;quoted;string!\";" + " key2:'single;quoted;string;'; key3:it(is;in;parens);"} ]; for (var i = 0; i < toTest.length; i++) { assertObjectEquals(toTest[i].expected, bot.dom.core.<API key>(toTest[i].input)); } } </script> </body> </html>
using System.Collections.Generic; using Microsoft.CodeAnalysis.Operations; using Microsoft.CodeAnalysis.Shared.Utilities; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.PopulateSwitch { internal static class <API key> { public const string MissingCases = nameof(MissingCases); public const string MissingDefaultCase = nameof(MissingDefaultCase); public static bool HasDefaultCase(ISwitchOperation switchStatement) { for (var index = switchStatement.Cases.Length - 1; index >= 0; index { if (HasDefaultCase(switchStatement.Cases[index])) { return true; } } return false; } private static bool HasDefaultCase(<API key> switchCase) { foreach (var clause in switchCase.Clauses) { if (clause.CaseKind == CaseKind.Default) { return true; } } return false; } public static ICollection<ISymbol> <API key>(ISwitchOperation switchStatement) { var switchExpression = switchStatement.Value; var <API key> = switchExpression?.Type; var enumMembers = new Dictionary<long, ISymbol>(); if (<API key>?.TypeKind == TypeKind.Enum) { if (!<API key>(<API key>, enumMembers) || !<API key>(switchStatement, enumMembers)) { return <API key>.EmptyCollection<ISymbol>(); } } return enumMembers.Values; } private static bool <API key>(ISwitchOperation switchStatement, Dictionary<long, ISymbol> enumValues) { foreach (var switchCase in switchStatement.Cases) { foreach (var clause in switchCase.Clauses) { switch (clause.CaseKind) { default: case CaseKind.None: case CaseKind.Relational: case CaseKind.Range: // This was some sort of complex switch. For now just ignore // these and assume that they're complete. return false; case CaseKind.Default: // ignore the 'default/else' clause. continue; case CaseKind.SingleValue: var value = ((<API key>)clause).Value; if (value == null || !value.ConstantValue.HasValue) { // We had a case which didn't resolve properly. // Assume the switch is complete. return false; } var caseValue = IntegerUtilities.ToInt64(value.ConstantValue.Value); enumValues.Remove(caseValue); break; } } } return true; } private static bool <API key>( ITypeSymbol enumType, Dictionary<long, ISymbol> enumValues) { foreach (var member in enumType.GetMembers()) { // skip `.ctor` and `__value` var fieldSymbol = member as IFieldSymbol; if (fieldSymbol == null || fieldSymbol.Type.SpecialType != SpecialType.None) { continue; } if (fieldSymbol.ConstantValue == null) { // We have an enum that has problems with it (i.e. non-const members). We won't // be able to determine properly if the switch is complete. Assume it is so we // don't offer to do anything. return false; } // Multiple enum members may have the same value. Only consider the first one // we run int. var enumValue = IntegerUtilities.ToInt64(fieldSymbol.ConstantValue); if (!enumValues.ContainsKey(enumValue)) { enumValues.Add(enumValue, fieldSymbol); } } return true; } } }
'use strict'; angular.module('openshiftConsole') .directive('overviewDeployment', function($location, $timeout, LabelFilter) { return { restrict: 'E', scope: { // Replication controller / deployment fields rc: '=', deploymentConfigId: '=', <API key>: '=', <API key>: '=', // Nested podTemplate fields <API key>: '=', builds: '=', // Pods pods: '=' }, templateUrl: 'views/<API key>.html', controller: function($scope) { $scope.<API key> = function(deployment) { $location.url("/project/" + deployment.metadata.namespace + "/browse/pods"); $timeout(function() { LabelFilter.setLabelSelector(new LabelSelector(deployment.spec.selector, true)); }, 1); }; } }; }) .directive('overviewMonopod', function() { return { restrict: 'E', scope: { pod: '=' }, templateUrl: 'views/_overview-monopod.html' }; }) .directive('podTemplate', function() { return { restrict: 'E', scope: { podTemplate: '=', <API key>: '=', builds: '=' }, templateUrl: 'views/_pod-template.html' }; }) .directive('pods', function() { return { restrict: 'E', scope: { pods: '=', projectName: '@?' //TODO optional for now }, templateUrl: 'views/_pods.html', controller: function($scope) { $scope.phases = [ "Failed", "Pending", "Running", "Succeeded", "Unknown" ]; $scope.expandedPhase = null; $scope.warningsExpanded = false; $scope.expandPhase = function(phase, warningsExpanded, $event) { $scope.expandedPhase = phase; $scope.warningsExpanded = warningsExpanded; if ($event) { $event.stopPropagation(); } }; } }; }) .directive('podContent', function() { // sub-directive used by the pods directive return { restrict: 'E', scope: { pod: '=', troubled: '=' }, templateUrl: 'views/directives/_pod-content.html' }; }) .directive('triggers', function() { var hideBuildKey = function(build) { return 'hide/build/' + build.metadata.namespace + '/' + build.metadata.name; }; return { restrict: 'E', scope: { triggers: '=' }, link: function(scope) { scope.isBuildHidden = function(build) { var key = hideBuildKey(build); return sessionStorage.getItem(key) === 'true'; }; scope.hideBuild = function(build) { var key = hideBuildKey(build); sessionStorage.setItem(key, 'true'); }; }, templateUrl: 'views/_triggers.html' }; }) .directive('<API key>', function() { return { restrict: 'E', scope: { deploymentConfigId: '=', exists: '=', differentService: '=' }, templateUrl: 'views/<API key>.html' }; });
<!DOCTYPE HTML PUBLIC "- <!--NewPage <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0-google-internal) on Wed Dec 30 10:35:12 PST 2009 --> <TITLE> Uses of Interface com.google.common.collect.Multimap (Google Collections Library 1.0 (FINAL)) </TITLE> <META NAME="date" CONTENT="2009-12-30"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Interface com.google.common.collect.Multimap (Google Collections Library 1.0 (FINAL))"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <A NAME="navbar_top"></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?com/google/common/collect//class-useMultimap.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="Multimap.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <! if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <HR> <CENTER> <H2> <B>Uses of Interface<br>com.google.common.collect.Multimap</B></H2> </CENTER> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Packages that use <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#com.google.common.collect"><B>com.google.common.collect</B></A></TD> <TD>This package contains generic collection interfaces and implementations, and other utilities for working with collections.&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <A NAME="com.google.common.collect"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A> in <A HREF="../../../../../com/google/common/collect/package-summary.html">com.google.common.collect</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="<API key>"> <TH ALIGN="left" COLSPAN="2">Subinterfaces of <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A> in <A HREF="../../../../../com/google/common/collect/package-summary.html">com.google.common.collect</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;interface</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/google/common/collect/ListMultimap.html" title="interface in com.google.common.collect">ListMultimap&lt;K,V&gt;</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A <code>Multimap</code> that can hold duplicate key-value pairs and that maintains the insertion ordering of values for a given key.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;interface</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/google/common/collect/SetMultimap.html" title="interface in com.google.common.collect">SetMultimap&lt;K,V&gt;</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A <code>Multimap</code> that cannot hold duplicate key-value pairs.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;interface</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/google/common/collect/SortedSetMultimap.html" title="interface in com.google.common.collect">SortedSetMultimap&lt;K,V&gt;</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A <code>SetMultimap</code> whose set of values for a given key are kept sorted; that is, they comprise a <A HREF="http://java.sun.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util"><CODE>SortedSet</CODE></A>.</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="<API key>"> <TH ALIGN="left" COLSPAN="2">Classes in <A HREF="../../../../../com/google/common/collect/package-summary.html">com.google.common.collect</A> that implement <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/google/common/collect/ArrayListMultimap.html" title="class in com.google.common.collect">ArrayListMultimap&lt;K,V&gt;</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Implementation of <code>Multimap</code> that uses an <code>ArrayList</code> to store the values for a given key.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/google/common/collect/ForwardingMultimap.html" title="class in com.google.common.collect">ForwardingMultimap&lt;K,V&gt;</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A multimap which forwards all its method calls to another multimap.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/google/common/collect/HashMultimap.html" title="class in com.google.common.collect">HashMultimap&lt;K,V&gt;</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Implementation of <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect"><CODE>Multimap</CODE></A> using hash tables.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/google/common/collect/<API key>.html" title="class in com.google.common.collect"><API key>&lt;K,V&gt;</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;An immutable <A HREF="../../../../../com/google/common/collect/ListMultimap.html" title="interface in com.google.common.collect"><CODE>ListMultimap</CODE></A> with reliable user-specified key and value iteration order.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/google/common/collect/ImmutableMultimap.html" title="class in com.google.common.collect">ImmutableMultimap&lt;K,V&gt;</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;An immutable <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect"><CODE>Multimap</CODE></A>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/google/common/collect/<API key>.html" title="class in com.google.common.collect"><API key>&lt;K,V&gt;</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;An immutable <A HREF="../../../../../com/google/common/collect/SetMultimap.html" title="interface in com.google.common.collect"><CODE>SetMultimap</CODE></A> with reliable user-specified key and value iteration order.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/google/common/collect/LinkedHashMultimap.html" title="class in com.google.common.collect">LinkedHashMultimap&lt;K,V&gt;</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Implementation of <code>Multimap</code> that does not allow duplicate key-value entries and that returns collections whose iterators follow the ordering in which the data was added to the multimap.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/google/common/collect/LinkedListMultimap.html" title="class in com.google.common.collect">LinkedListMultimap&lt;K,V&gt;</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;An implementation of <code>ListMultimap</code> that supports deterministic iteration order for both keys and values.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/google/common/collect/TreeMultimap.html" title="class in com.google.common.collect">TreeMultimap&lt;K,V&gt;</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Implementation of <code>Multimap</code> whose keys and values are ordered by their natural ordering or by supplied comparators.</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="<API key>"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../com/google/common/collect/package-summary.html">com.google.common.collect</A> with type parameters of type <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE>&lt;K,V,M extends <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;K,V&gt;&gt; <BR> M</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B>Multimaps.</B><B><A HREF="../../../../../com/google/common/collect/Multimaps.html#invertFrom(com.google.common.collect.Multimap, M)">invertFrom</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;? extends V,? extends K&gt;&nbsp;source, M&nbsp;dest)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Copies each key-value mapping in <code>source</code> into <code>dest</code>, with its key and value reversed.</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="<API key>"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../com/google/common/collect/package-summary.html">com.google.common.collect</A> that return <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected abstract &nbsp;<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;<A HREF="../../../../../com/google/common/collect/ForwardingMultimap.html" title="type parameter in ForwardingMultimap">K</A>,<A HREF="../../../../../com/google/common/collect/ForwardingMultimap.html" title="type parameter in ForwardingMultimap">V</A>&gt;</CODE></FONT></TD> <TD><CODE><B>ForwardingMultimap.</B><B><A HREF="../../../../../com/google/common/collect/ForwardingMultimap.html#delegate()">delegate</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE>&lt;K,V&gt; <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;K,V&gt;</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B>Multimaps.</B><B><A HREF="../../../../../com/google/common/collect/Multimaps.html <A HREF="../../../../../com/google/common/base/Supplier.html" title="interface in com.google.common.base">Supplier</A>&lt;? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A>&lt;V&gt;&gt;&nbsp;factory)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a new <code>Multimap</code> that uses the provided map and factory.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE>&lt;K,V&gt; <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;K,V&gt;</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B>Multimaps.</B><B><A HREF="../../../../../com/google/common/collect/Multimaps.html#<API key>(com.google.common.collect.Multimap)"><API key></A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;K,V&gt;&nbsp;multimap)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a synchronized (thread-safe) multimap backed by the specified multimap.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE>&lt;K,V&gt; <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;K,V&gt;</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B>Multimaps.</B><B><A HREF="../../../../../com/google/common/collect/Multimaps.html#<API key>(com.google.common.collect.Multimap)"><API key></A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;K,V&gt;&nbsp;delegate)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an unmodifiable view of the specified multimap.</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="<API key>"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../com/google/common/collect/package-summary.html">com.google.common.collect</A> with parameters of type <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE>&lt;K,V&gt; <A HREF="../../../../../com/google/common/collect/<API key>.html" title="class in com.google.common.collect"><API key></A>&lt;K,V&gt;</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><API key>.</B><B><A HREF="../../../../../com/google/common/collect/<API key>.html#copyOf(com.google.common.collect.Multimap)">copyOf</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;? extends K,? extends V&gt;&nbsp;multimap)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an immutable multimap containing the same mappings as <code>multimap</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE>&lt;K,V&gt; <A HREF="../../../../../com/google/common/collect/<API key>.html" title="class in com.google.common.collect"><API key></A>&lt;K,V&gt;</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><API key>.</B><B><A HREF="../../../../../com/google/common/collect/<API key>.html#copyOf(com.google.common.collect.Multimap)">copyOf</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;? extends K,? extends V&gt;&nbsp;multimap)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an immutable set multimap containing the same mappings as <code>multimap</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE>&lt;K,V&gt; <A HREF="../../../../../com/google/common/collect/ImmutableMultimap.html" title="class in com.google.common.collect">ImmutableMultimap</A>&lt;K,V&gt;</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B>ImmutableMultimap.</B><B><A HREF="../../../../../com/google/common/collect/ImmutableMultimap.html#copyOf(com.google.common.collect.Multimap)">copyOf</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;? extends K,? extends V&gt;&nbsp;multimap)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an immutable multimap containing the same mappings as <code>multimap</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE>&lt;K extends <A HREF="http: <BR> <A HREF="../../../../../com/google/common/collect/TreeMultimap.html" title="class in com.google.common.collect">TreeMultimap</A>&lt;K,V&gt;</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B>TreeMultimap.</B><B><A HREF="../../../../../com/google/common/collect/TreeMultimap.html#create(com.google.common.collect.Multimap)">create</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;? extends K,? extends V&gt;&nbsp;multimap)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a <code>TreeMultimap</code>, ordered by the natural ordering of its keys and values, with the same mappings as the specified multimap.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE>&lt;K,V&gt; <A HREF="../../../../../com/google/common/collect/HashMultimap.html" title="class in com.google.common.collect">HashMultimap</A>&lt;K,V&gt;</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B>HashMultimap.</B><B><A HREF="../../../../../com/google/common/collect/HashMultimap.html#create(com.google.common.collect.Multimap)">create</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;? extends K,? extends V&gt;&nbsp;multimap)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a <code>HashMultimap</code> with the same mappings as the specified multimap.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE>&lt;K,V&gt; <A HREF="../../../../../com/google/common/collect/ArrayListMultimap.html" title="class in com.google.common.collect">ArrayListMultimap</A>&lt;K,V&gt;</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B>ArrayListMultimap.</B><B><A HREF="../../../../../com/google/common/collect/ArrayListMultimap.html#create(com.google.common.collect.Multimap)">create</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;? extends K,? extends V&gt;&nbsp;multimap)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs an <code>ArrayListMultimap</code> with the same mappings as the specified multimap.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE>&lt;K,V&gt; <A HREF="../../../../../com/google/common/collect/LinkedListMultimap.html" title="class in com.google.common.collect">LinkedListMultimap</A>&lt;K,V&gt;</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B>LinkedListMultimap.</B><B><A HREF="../../../../../com/google/common/collect/LinkedListMultimap.html#create(com.google.common.collect.Multimap)">create</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;? extends K,? extends V&gt;&nbsp;multimap)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a <code>LinkedListMultimap</code> with the same mappings as the specified <code>Multimap</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE>&lt;K,V&gt; <A HREF="../../../../../com/google/common/collect/LinkedHashMultimap.html" title="class in com.google.common.collect">LinkedHashMultimap</A>&lt;K,V&gt;</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B>LinkedHashMultimap.</B><B><A HREF="../../../../../com/google/common/collect/LinkedHashMultimap.html#create(com.google.common.collect.Multimap)">create</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;? extends K,? extends V&gt;&nbsp;multimap)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a <code>LinkedHashMultimap</code> with the same mappings as the specified multimap.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE>&lt;K,V,M extends <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;K,V&gt;&gt; <BR> M</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B>Multimaps.</B><B><A HREF="../../../../../com/google/common/collect/Multimaps.html#invertFrom(com.google.common.collect.Multimap, M)">invertFrom</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;? extends V,? extends K&gt;&nbsp;source, M&nbsp;dest)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Copies each key-value mapping in <code>source</code> into <code>dest</code>, with its key and value reversed.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../com/google/common/collect/<API key>.Builder.html" title="class in com.google.common.collect"><API key>.Builder</A>&lt;<A HREF="../../../../../com/google/common/collect/<API key>.Builder.html" title="type parameter in <API key>.Builder">K</A>,<A HREF="../../../../../com/google/common/collect/<API key>.Builder.html" title="type parameter in <API key>.Builder">V</A>&gt;</CODE></FONT></TD> <TD><CODE><B><API key>.Builder.</B><B><A HREF="../../../../../com/google/common/collect/<API key>.Builder.html#putAll(com.google.common.collect.Multimap)">putAll</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;? extends <A HREF="../../../../../com/google/common/collect/<API key>.Builder.html" title="type parameter in <API key>.Builder">K</A>,? extends <A HREF="../../../../../com/google/common/collect/<API key>.Builder.html" title="type parameter in <API key>.Builder">V</A>&gt;&nbsp;multimap)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Stores another multimap's entries in the built multimap.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../com/google/common/collect/<API key>.Builder.html" title="class in com.google.common.collect"><API key>.Builder</A>&lt;<A HREF="../../../../../com/google/common/collect/<API key>.Builder.html" title="type parameter in <API key>.Builder">K</A>,<A HREF="../../../../../com/google/common/collect/<API key>.Builder.html" title="type parameter in <API key>.Builder">V</A>&gt;</CODE></FONT></TD> <TD><CODE><B><API key>.Builder.</B><B><A HREF="../../../../../com/google/common/collect/<API key>.Builder.html#putAll(com.google.common.collect.Multimap)">putAll</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;? extends <A HREF="../../../../../com/google/common/collect/<API key>.Builder.html" title="type parameter in <API key>.Builder">K</A>,? extends <A HREF="../../../../../com/google/common/collect/<API key>.Builder.html" title="type parameter in <API key>.Builder">V</A>&gt;&nbsp;multimap)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Stores another multimap's entries in the built multimap.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;boolean</CODE></FONT></TD> <TD><CODE><B>ForwardingMultimap.</B><B><A HREF="../../../../../com/google/common/collect/ForwardingMultimap.html#putAll(com.google.common.collect.Multimap)">putAll</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;? extends <A HREF="../../../../../com/google/common/collect/ForwardingMultimap.html" title="type parameter in ForwardingMultimap">K</A>,? extends <A HREF="../../../../../com/google/common/collect/ForwardingMultimap.html" title="type parameter in ForwardingMultimap">V</A>&gt;&nbsp;multimap)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;boolean</CODE></FONT></TD> <TD><CODE><B>Multimap.</B><B><A HREF="../../../../../com/google/common/collect/Multimap.html#putAll(com.google.common.collect.Multimap)">putAll</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;? extends <A HREF="../../../../../com/google/common/collect/Multimap.html" title="type parameter in Multimap">K</A>,? extends <A HREF="../../../../../com/google/common/collect/Multimap.html" title="type parameter in Multimap">V</A>&gt;&nbsp;multimap)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Copies all of another multimap's key-value pairs into this multimap.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;boolean</CODE></FONT></TD> <TD><CODE><B>LinkedListMultimap.</B><B><A HREF="../../../../../com/google/common/collect/LinkedListMultimap.html#putAll(com.google.common.collect.Multimap)">putAll</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;? extends <A HREF="../../../../../com/google/common/collect/LinkedListMultimap.html" title="type parameter in LinkedListMultimap">K</A>,? extends <A HREF="../../../../../com/google/common/collect/LinkedListMultimap.html" title="type parameter in LinkedListMultimap">V</A>&gt;&nbsp;multimap)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;boolean</CODE></FONT></TD> <TD><CODE><B>ImmutableMultimap.</B><B><A HREF="../../../../../com/google/common/collect/ImmutableMultimap.html#putAll(com.google.common.collect.Multimap)">putAll</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;? extends <A HREF="../../../../../com/google/common/collect/ImmutableMultimap.html" title="type parameter in ImmutableMultimap">K</A>,? extends <A HREF="../../../../../com/google/common/collect/ImmutableMultimap.html" title="type parameter in ImmutableMultimap">V</A>&gt;&nbsp;multimap)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Guaranteed to throw an exception and leave the multimap unmodified.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../com/google/common/collect/ImmutableMultimap.Builder.html" title="class in com.google.common.collect">ImmutableMultimap.Builder</A>&lt;<A HREF="../../../../../com/google/common/collect/ImmutableMultimap.Builder.html" title="type parameter in ImmutableMultimap.Builder">K</A>,<A HREF="../../../../../com/google/common/collect/ImmutableMultimap.Builder.html" title="type parameter in ImmutableMultimap.Builder">V</A>&gt;</CODE></FONT></TD> <TD><CODE><B>ImmutableMultimap.Builder.</B><B><A HREF="../../../../../com/google/common/collect/ImmutableMultimap.Builder.html#putAll(com.google.common.collect.Multimap)">putAll</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;? extends <A HREF="../../../../../com/google/common/collect/ImmutableMultimap.Builder.html" title="type parameter in ImmutableMultimap.Builder">K</A>,? extends <A HREF="../../../../../com/google/common/collect/ImmutableMultimap.Builder.html" title="type parameter in ImmutableMultimap.Builder">V</A>&gt;&nbsp;multimap)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Stores another multimap's entries in the built multimap.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE>&lt;K,V&gt; <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;K,V&gt;</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B>Multimaps.</B><B><A HREF="../../../../../com/google/common/collect/Multimaps.html#<API key>(com.google.common.collect.Multimap)"><API key></A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;K,V&gt;&nbsp;multimap)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a synchronized (thread-safe) multimap backed by the specified multimap.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE>&lt;K,V&gt; <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;K,V&gt;</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B>Multimaps.</B><B><A HREF="../../../../../com/google/common/collect/Multimaps.html#<API key>(com.google.common.collect.Multimap)"><API key></A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A>&lt;K,V&gt;&nbsp;delegate)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an unmodifiable view of the specified multimap.</TD> </TR> </TABLE> &nbsp; <P> <HR> <A NAME="navbar_bottom"></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="<API key>"></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?com/google/common/collect//class-useMultimap.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="Multimap.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <! if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <HR> </BODY> </HTML>
/** * @file rv40vlc2.h * RV40 VLC tables used for macroblock information decoding */ #ifndef FFMPEG_RV40VLC2_H #define FFMPEG_RV40VLC2_H #include <stdint.h> /** * codes used for the first four block types */ #define AIC_TOP_BITS 8 #define AIC_TOP_SIZE 16 static const uint8_t <API key>[AIC_TOP_SIZE] = { 0x01, 0x05, 0x01, 0x00, 0x03, 0x3D, 0x1D, 0x02, 0x04, 0x3C, 0x3F, 0x1C, 0x0D, 0x3E, 0x0C, 0x01 }; static const uint8_t <API key>[AIC_TOP_SIZE] = { 1, 4, 5, 5, 5, 7, 6, 5, 4, 7, 7, 6, 5, 7, 5, 3 }; /** * codes used for determining a pair of block types */ #define AIC_MODE2_NUM 20 #define AIC_MODE2_SIZE 81 #define AIC_MODE2_BITS 9 static const uint16_t aic_mode2_vlc_codes[AIC_MODE2_NUM][AIC_MODE2_SIZE] = { { 0x0001, 0x0001, 0x0005, 0x01F5, 0x0011, 0x0049, 0x0000, 0x0048, 0x004B, 0x0035, 0x0003, 0x0034, 0x03C9, 0x01F4, 0x00C9, 0x004A, 0x0FD9, 0x03C8, 0x0010, 0x0037, 0x0001, 0x00C8, 0x0075, 0x01F7, 0x00CB, 0x0074, 0x0002, 0x01F6, 0x00CA, 0x01F1, 0x01F0, 0x1F81, 0x07F9, 0x1F80, 0x1F83, 0x07F8, 0x0077, 0x00F5, 0x0036, 0x07FB, 0x0076, 0x1F82, 0x00F4, 0x00F7, 0x07FA, 0x0071, 0x00F6, 0x03CB, 0x03CA, 0x0FD8, 0x00F1, 0x03F5, 0x1F8D, 0x07E5, 0x0013, 0x0031, 0x00F0, 0x0FDB, 0x00F3, 0x07E4, 0x0030, 0x01F3, 0x07E7, 0x03F4, 0x07E6, 0x0070, 0x3F19, 0x01F2, 0x3F18, 0x0FDA, 0x0033, 0x07E1, 0x01FD, 0x01FC, 0x0073, 0x01FF, 0x0FC5, 0x0FC4, 0x0FC7, 0x03F7, 0x0072, }, { 0x0005, 0x0005, 0x0005, 0x0079, 0x0005, 0x000D, 0x001D, 0x0078, 0x0069, 0x0004, 0x0001, 0x0007, 0x0068, 0x001C, 0x001F, 0x0004, 0x006B, 0x000C, 0x0004, 0x001E, 0x0006, 0x006A, 0x0015, 0x000F, 0x0014, 0x0017, 0x0007, 0x0016, 0x000E, 0x0011, 0x0009, 0x00D1, 0x00D0, 0x0181, 0x00D3, 0x007B, 0x0010, 0x0013, 0x0004, 0x00D2, 0x0007, 0x0319, 0x0008, 0x007A, 0x00DD, 0x0019, 0x0006, 0x000B, 0x0065, 0x00DC, 0x0012, 0x0064, 0x0180, 0x00DF, 0x0006, 0x0018, 0x0001, 0x00DE, 0x001D, 0x00D9, 0x001B, 0x0067, 0x000A, 0x00D8, 0x00DB, 0x001C, 0x0318, 0x00DA, 0x0635, 0x0183, 0x0000, 0x00C5, 0x0066, 0x0061, 0x0035, 0x00C4, 0x0182, 0x0634, 0x031B, 0x00C7, 0x001F, }, { 0x0005, 0x0001, 0x001D, 0x01C1, 0x0035, 0x00F1, 0x006D, 0x00F0, 0x0049, 0x0000, 0x0004, 0x0003, 0x00F3, 0x0048, 0x0034, 0x006C, 0x01C0, 0x01C3, 0x0007, 0x0006, 0x0001, 0x006F, 0x0002, 0x004B, 0x006E, 0x001C, 0x0005, 0x0069, 0x0068, 0x006B, 0x0037, 0x01C2, 0x00F2, 0x0395, 0x01CD, 0x00FD, 0x006A, 0x0036, 0x0015, 0x01CC, 0x0014, 0x0394, 0x004A, 0x00FC, 0x00FF, 0x0017, 0x0031, 0x00FE, 0x01CF, 0x0397, 0x00F9, 0x01CE, 0x0725, 0x0396, 0x0016, 0x0030, 0x0075, 0x0724, 0x00F8, 0x0727, 0x0033, 0x0391, 0x0390, 0x0011, 0x0032, 0x001F, 0x00FB, 0x0074, 0x0726, 0x00FA, 0x001E, 0x0077, 0x0019, 0x0018, 0x0004, 0x0010, 0x003D, 0x0076, 0x0071, 0x0013, 0x0001, }, { 0x000D, 0x0019, 0x0011, 0x0015, 0x0061, 0x0019, 0x0014, 0x01AD, 0x0060, 0x0018, 0x0001, 0x0005, 0x001B, 0x0010, 0x0019, 0x0005, 0x0017, 0x0018, 0x0016, 0x0004, 0x0004, 0x0013, 0x000C, 0x0012, 0x001A, 0x0018, 0x0005, 0x000F, 0x001B, 0x0004, 0x001D, 0x0011, 0x001C, 0x0010, 0x000E, 0x001B, 0x0013, 0x001F, 0x001A, 0x0029, 0x0005, 0x0063, 0x001E, 0x0009, 0x0062, 0x0008, 0x0007, 0x0007, 0x0019, 0x0004, 0x001A, 0x0018, 0x006D, 0x0007, 0x001B, 0x0007, 0x001A, 0x006C, 0x0006, 0x0012, 0x0005, 0x006F, 0x000B, 0x006E, 0x0069, 0x001D, 0x0359, 0x0028, 0x002B, 0x002A, 0x001C, 0x00D5, 0x0358, 0x001F, 0x0001, 0x001E, 0x0068, 0x00D4, 0x00D7, 0x0019, 0x0000, }, { 0x00B9, 0x0061, 0x0060, 0x00B8, 0x02B5, 0x01AD, 0x00BB, 0x0AF5, 0x0151, 0x0001, 0x0001, 0x0005, 0x0000, 0x0003, 0x0005, 0x0004, 0x0063, 0x0025, 0x00BA, 0x0004, 0x0007, 0x0062, 0x00A5, 0x0024, 0x006D, 0x0002, 0x006C, 0x02B4, 0x000D, 0x006F, 0x0027, 0x00A4, 0x0026, 0x01AC, 0x0150, 0x01AF, 0x01AE, 0x0021, 0x006E, 0x02B7, 0x0020, 0x0153, 0x0023, 0x00A7, 0x0152, 0x00A6, 0x0006, 0x000C, 0x0022, 0x01A9, 0x0019, 0x002D, 0x02B6, 0x01A8, 0x000F, 0x0007, 0x000E, 0x00A1, 0x0069, 0x002C, 0x0001, 0x01AB, 0x00A0, 0x02B1, 0x00A3, 0x002F, 0x0AF4, 0x02B0, 0x0AF7, 0x02B3, 0x0068, 0x015D, 0x0AF6, 0x01AA, 0x0055, 0x015C, 0x02B2, 0x0579, 0x0578, 0x015F, 0x00A2, }, { 0x0905, 0x013D, 0x013C, 0x0904, 0x121D, 0x049D, 0x049C, 0x243D, 0x0907, 0x00ED, 0x0001, 0x0015, 0x0041, 0x013F, 0x0031, 0x0014, 0x025D, 0x025C, 0x013E, 0x000D, 0x0000, 0x0040, 0x0139, 0x0043, 0x0030, 0x0017, 0x0033, 0x0906, 0x0032, 0x0042, 0x00EC, 0x025F, 0x00EF, 0x025E, 0x049F, 0x0138, 0x0901, 0x013B, 0x0259, 0x121C, 0x049E, 0x0900, 0x0258, 0x243C, 0x121F, 0x0903, 0x003D, 0x00EE, 0x025B, 0x025A, 0x004D, 0x013A, 0x0902, 0x0245, 0x00E9, 0x0016, 0x00E8, 0x0499, 0x0125, 0x0244, 0x004C, 0x0498, 0x090D, 0x00EB, 0x003C, 0x0011, 0x049B, 0x049A, 0x0485, 0x00EA, 0x003F, 0x0124, 0x090C, 0x003E, 0x0039, 0x0095, 0x0247, 0x0246, 0x0484, 0x0094, 0x0038, }, { 0x0F09, 0x00CD, 0x01FD, 0x0791, 0x1E6D, 0x0790, 0x03D9, 0x3CD1, 0x3CD0, 0x0075, 0x0001, 0x0001, 0x0035, 0x00CC, 0x0011, 0x0000, 0x03D8, 0x01FC, 0x03DB, 0x0010, 0x0003, 0x00CF, 0x03DA, 0x00CE, 0x0074, 0x0034, 0x0077, 0x0793, 0x0013, 0x0076, 0x0071, 0x03C5, 0x0070, 0x01FF, 0x0792, 0x01FE, 0x01F9, 0x0037, 0x00C9, 0x0F08, 0x01F8, 0x03C4, 0x00C8, 0x0F0B, 0x079D, 0x03C7, 0x0001, 0x0012, 0x0073, 0x00CB, 0x0005, 0x0036, 0x03C6, 0x0072, 0x007D, 0x0002, 0x00CA, 0x079C, 0x01FB, 0x00F5, 0x0031, 0x079F, 0x0F0A, 0x0F35, 0x079E, 0x01FA, 0x1E6C, 0x1E6F, 0x3CD3, 0x0799, 0x03C1, 0x1E6E, 0x3CD2, 0x0030, 0x00F4, 0x007C, 0x03C0, 0x03C3, 0x0798, 0x01E5, 0x00F7, }, { 0x01A5, 0x0001, 0x001D, 0x0021, 0x00A1, 0x000D, 0x0061, 0x06B9, 0x00A0, 0x0060, 0x0001, 0x0005, 0x000C, 0x0020, 0x001C, 0x0004, 0x01A4, 0x01A7, 0x00A3, 0x001F, 0x001E, 0x0023, 0x0022, 0x002D, 0x002C, 0x0063, 0x0062, 0x1A81, 0x01A6, 0x01A1, 0x06B8, 0x06BB, 0x00A2, 0x06BA, 0x0D59, 0x06A5, 0x01A0, 0x000F, 0x006D, 0x06A4, 0x002F, 0x00AD, 0x006C, 0x06A7, 0x00AC, 0x0D58, 0x000E, 0x01A3, 0x00AF, 0x00AE, 0x006F, 0x01A2, 0x0D5B, 0x00A9, 0x0019, 0x0001, 0x0009, 0x00A8, 0x006E, 0x002E, 0x0000, 0x01AD, 0x00AB, 0x00AA, 0x0355, 0x0029, 0x1A80, 0x1A83, 0x1A82, 0x0354, 0x01AC, 0x0D5A, 0x1A8D, 0x01AF, 0x0357, 0x0D45, 0x0D44, 0x0D47, 0x1A8C, 0x06A6, 0x06A1, }, { 0x0001, 0x0011, 0x0005, 0x0775, 0x00F9, 0x00F8, 0x0031, 0x0030, 0x0049, 0x00FB, 0x0010, 0x0033, 0x0EC9, 0x038D, 0x038C, 0x00FA, 0x038F, 0x0774, 0x0048, 0x0032, 0x0000, 0x01D5, 0x00E5, 0x038E, 0x00E4, 0x0013, 0x000D, 0x0389, 0x0777, 0x0388, 0x038B, 0x1DF9, 0x0EC8, 0x3BC9, 0x1DF8, 0x038A, 0x03B5, 0x0776, 0x00E7, 0x3BC8, 0x01D4, 0x3BCB, 0x0ECB, 0x0771, 0x0ECA, 0x01D7, 0x03B4, 0x01D6, 0x1DFB, 0x0EF5, 0x0770, 0x0EF4, 0x3BCA, 0x0773, 0x00E6, 0x03B7, 0x004B, 0x1DFA, 0x03B6, 0x0EF7, 0x00E1, 0x0EF6, 0x0EF1, 0x03B1, 0x01D1, 0x003D, 0x0EF0, 0x0772, 0x077D, 0x077C, 0x003C, 0x01D0, 0x03B0, 0x01D3, 0x003F, 0x03B3, 0x01D2, 0x0EF3, 0x077F, 0x00E0, 0x004A, }, { 0x0015, 0x0049, 0x0014, 0x07D1, 0x03FD, 0x03FC, 0x01C1, 0x01C0, 0x00F1, 0x0017, 0x0001, 0x0001, 0x01C3, 0x0048, 0x004B, 0x0016, 0x0031, 0x01C2, 0x004A, 0x0011, 0x0000, 0x01CD, 0x00F0, 0x01CC, 0x0075, 0x0010, 0x000D, 0x03FF, 0x01CF, 0x01CE, 0x07D0, 0x0F81, 0x07D3, 0x1F1D, 0x0F80, 0x07D2, 0x01C9, 0x03FE, 0x0074, 0x07DD, 0x00F3, 0x1F1C, 0x07DC, 0x03F9, 0x07DF, 0x00F2, 0x00FD, 0x0077, 0x07DE, 0x07D9, 0x01C8, 0x07D8, 0x0F83, 0x03F8, 0x0030, 0x0076, 0x0013, 0x0F82, 0x00FC, 0x03FB, 0x0033, 0x03FA, 0x03E5, 0x03E4, 0x01CB, 0x0032, 0x1F1F, 0x03E7, 0x07DB, 0x07DA, 0x003D, 0x01CA, 0x07C5, 0x03E6, 0x0071, 0x0F8D, 0x07C4, 0x1F1E, 0x0F8C, 0x03E1, 0x01F5, }, { 0x0019, 0x0065, 0x0018, 0x0351, 0x0350, 0x0353, 0x0021, 0x0020, 0x0064, 0x001D, 0x0005, 0x0005, 0x01A5, 0x0023, 0x0067, 0x0005, 0x0066, 0x0022, 0x001B, 0x0004, 0x0001, 0x0004, 0x001C, 0x0061, 0x001A, 0x0005, 0x0004, 0x0007, 0x002D, 0x0006, 0x002C, 0x01A4, 0x002F, 0x0352, 0x035D, 0x0060, 0x0001, 0x002E, 0x001F, 0x035C, 0x0000, 0x06B1, 0x01A7, 0x0029, 0x01A6, 0x0028, 0x0063, 0x0062, 0x035F, 0x01A1, 0x002B, 0x06B0, 0x06B3, 0x01A0, 0x0003, 0x006D, 0x001E, 0x035E, 0x006C, 0x06B2, 0x0002, 0x01A3, 0x01A2, 0x000D, 0x0005, 0x0007, 0x01AD, 0x006F, 0x002A, 0x006E, 0x0004, 0x0004, 0x000C, 0x0007, 0x0006, 0x000F, 0x000E, 0x00D5, 0x0009, 0x0006, 0x0007, }, { 0x0065, 0x0181, 0x0064, 0x36C9, 0x06D5, 0x0DB5, 0x0379, 0x0180, 0x0183, 0x00D5, 0x001D, 0x001C, 0x0DB4, 0x0182, 0x0378, 0x00D4, 0x00D7, 0x06D4, 0x0067, 0x001F, 0x0001, 0x00D6, 0x00D1, 0x018D, 0x0066, 0x0001, 0x0000, 0x037B, 0x06D7, 0x037A, 0x0DB7, 0x36C8, 0x06D6, 0x0DB6, 0x1B79, 0x0DB1, 0x018C, 0x0365, 0x00D0, 0x1B78, 0x00D3, 0x1B7B, 0x0364, 0x06D1, 0x06D0, 0x018F, 0x018E, 0x00D2, 0x36CB, 0x0367, 0x0366, 0x06D3, 0x0DB0, 0x06D2, 0x0361, 0x06DD, 0x0189, 0x36CA, 0x0360, 0x36F5, 0x0188, 0x0DB3, 0x36F4, 0x0009, 0x0008, 0x0005, 0x06DC, 0x00DD, 0x018B, 0x00DC, 0x0004, 0x000B, 0x018A, 0x0061, 0x0003, 0x0363, 0x00DF, 0x06DF, 0x0362, 0x000A, 0x001E, }, { 0x001D, 0x0061, 0x000D, 0x0D55, 0x06B9, 0x06B8, 0x01A5, 0x0021, 0x0020, 0x0023, 0x000C, 0x0060, 0x0D54, 0x00AD, 0x00AC, 0x0022, 0x00AF, 0x06BB, 0x000F, 0x001C, 0x0001, 0x002D, 0x0063, 0x01A4, 0x000E, 0x0001, 0x0005, 0x01A7, 0x06BA, 0x01A6, 0x06A5, 0x0D57, 0x0D56, 0x1ABD, 0x0D51, 0x00AE, 0x002C, 0x00A9, 0x002F, 0x0D50, 0x01A1, 0x1ABC, 0x06A4, 0x06A7, 0x06A6, 0x00A8, 0x06A1, 0x01A0, 0x1ABF, 0x0D53, 0x06A0, 0x0D52, 0x1ABE, 0x06A3, 0x0062, 0x002E, 0x0009, 0x0D5D, 0x01A3, 0x0D5C, 0x006D, 0x00AB, 0x06A2, 0x006C, 0x001F, 0x0001, 0x06AD, 0x0029, 0x01A2, 0x0028, 0x0004, 0x001E, 0x01AD, 0x006F, 0x0000, 0x01AC, 0x01AF, 0x06AC, 0x00AA, 0x006E, 0x0019, }, { 0x0019, 0x007D, 0x0018, 0x01B5, 0x000D, 0x01B4, 0x007C, 0x007F, 0x01B7, 0x000C, 0x001B, 0x001A, 0x01B6, 0x000F, 0x00D5, 0x0019, 0x007E, 0x00D4, 0x0018, 0x001B, 0x0001, 0x000E, 0x0011, 0x0009, 0x0005, 0x0005, 0x0005, 0x00D7, 0x01B1, 0x0008, 0x01B0, 0x0079, 0x06FD, 0x0371, 0x0370, 0x00D6, 0x0078, 0x01B3, 0x0010, 0x0373, 0x0013, 0x06FC, 0x007B, 0x007A, 0x00D1, 0x00D0, 0x00D3, 0x0065, 0x0372, 0x06FF, 0x0064, 0x06FE, 0x037D, 0x00D2, 0x00DD, 0x0067, 0x0004, 0x037C, 0x0012, 0x01B2, 0x0007, 0x0066, 0x01BD, 0x0006, 0x0061, 0x0004, 0x01BC, 0x001A, 0x0060, 0x001D, 0x0004, 0x001C, 0x0063, 0x0001, 0x0007, 0x000B, 0x0000, 0x0062, 0x000A, 0x0005, 0x0007, }, { 0x0069, 0x0045, 0x0068, 0x04BD, 0x0255, 0x04BC, 0x00E5, 0x00E4, 0x0031, 0x0030, 0x0019, 0x0001, 0x0121, 0x00E7, 0x00E6, 0x0033, 0x00E1, 0x00E0, 0x006B, 0x0018, 0x0001, 0x0044, 0x0032, 0x0047, 0x006A, 0x001B, 0x0005, 0x003D, 0x0046, 0x0015, 0x0041, 0x0120, 0x0123, 0x04BF, 0x0122, 0x0040, 0x003C, 0x00E3, 0x0014, 0x0254, 0x0043, 0x0975, 0x012D, 0x00E2, 0x00ED, 0x0042, 0x00EC, 0x004D, 0x0257, 0x0256, 0x0251, 0x04BE, 0x0974, 0x0250, 0x00EF, 0x00EE, 0x004C, 0x04B9, 0x012C, 0x04B8, 0x004F, 0x04BB, 0x0253, 0x003F, 0x0017, 0x0001, 0x0252, 0x00E9, 0x00E8, 0x00EB, 0x0000, 0x0003, 0x0016, 0x0002, 0x0004, 0x004E, 0x003E, 0x00EA, 0x0049, 0x000D, 0x0007, }, { 0x000D, 0x01BD, 0x000C, 0x0D31, 0x0D30, 0x0D33, 0x0359, 0x0358, 0x002D, 0x0065, 0x001D, 0x001C, 0x0D32, 0x035B, 0x035A, 0x002C, 0x01BC, 0x0345, 0x000F, 0x001F, 0x0001, 0x002F, 0x0064, 0x01BF, 0x0067, 0x0001, 0x0005, 0x0066, 0x002E, 0x0061, 0x0029, 0x0695, 0x0694, 0x0697, 0x0696, 0x0060, 0x01BE, 0x0D3D, 0x0028, 0x1A49, 0x0344, 0x1A48, 0x1A4B, 0x0D3C, 0x0691, 0x002B, 0x01B9, 0x002A, 0x0D3F, 0x0690, 0x0347, 0x0D3E, 0x1A4A, 0x0346, 0x00D5, 0x0341, 0x0063, 0x0D39, 0x0340, 0x0D38, 0x01B8, 0x0D3B, 0x0D3A, 0x00D4, 0x0062, 0x0000, 0x0693, 0x01BB, 0x0343, 0x0342, 0x001E, 0x000E, 0x006D, 0x0009, 0x0001, 0x006C, 0x00D7, 0x034D, 0x01BA, 0x0008, 0x0004, }, { 0x0075, 0x00CD, 0x0035, 0x03C1, 0x03C0, 0x07F9, 0x03C3, 0x1F8D, 0x00CC, 0x0074, 0x0011, 0x0010, 0x03C2, 0x0FD9, 0x01F1, 0x00CF, 0x03CD, 0x00CE, 0x0034, 0x0001, 0x0001, 0x0037, 0x00C9, 0x00C8, 0x0036, 0x0000, 0x0001, 0x0FD8, 0x03CC, 0x00CB, 0x01F0, 0x07F8, 0x03CF, 0x07FB, 0x07FA, 0x00CA, 0x01F3, 0x03CE, 0x00F5, 0x0FDB, 0x00F4, 0x07E5, 0x07E4, 0x07E7, 0x01F2, 0x07E6, 0x03C9, 0x01FD, 0x0FDA, 0x1F8C, 0x07E1, 0x1F8F, 0x1F8E, 0x03C8, 0x03CB, 0x0077, 0x0076, 0x0FC5, 0x03CA, 0x07E0, 0x00F7, 0x0FC4, 0x03F5, 0x00F6, 0x01FC, 0x0003, 0x03F4, 0x0071, 0x03F7, 0x00F1, 0x0013, 0x0031, 0x0030, 0x0070, 0x0005, 0x0012, 0x0073, 0x01FF, 0x0072, 0x007D, 0x0002, }, { 0x0061, 0x0055, 0x0060, 0x02C9, 0x02C8, 0x02CB, 0x0171, 0x00B5, 0x0054, 0x0001, 0x0001, 0x0001, 0x0057, 0x0001, 0x0063, 0x001D, 0x0062, 0x0039, 0x006D, 0x0000, 0x0005, 0x0038, 0x0056, 0x00B4, 0x006C, 0x0003, 0x001C, 0x006F, 0x003B, 0x0002, 0x003A, 0x0170, 0x00B7, 0x0173, 0x0051, 0x006E, 0x0025, 0x0050, 0x0069, 0x02CA, 0x0024, 0x0027, 0x0172, 0x00B6, 0x00B1, 0x000D, 0x000C, 0x001F, 0x017D, 0x0026, 0x0068, 0x0053, 0x017C, 0x006B, 0x001E, 0x000F, 0x0004, 0x017F, 0x006A, 0x02F5, 0x0019, 0x0021, 0x0052, 0x02F4, 0x02F7, 0x0020, 0x0BCD, 0x05E5, 0x05E4, 0x0BCC, 0x0023, 0x00B0, 0x02F6, 0x00B3, 0x0022, 0x02F1, 0x02F0, 0x0BCF, 0x0BCE, 0x017E, 0x005D, }, { 0x00BD, 0x0025, 0x01A1, 0x0159, 0x0299, 0x00BC, 0x0024, 0x0505, 0x0504, 0x01A0, 0x0001, 0x001D, 0x006D, 0x001C, 0x0001, 0x0005, 0x0027, 0x01A3, 0x0158, 0x001F, 0x001E, 0x01A2, 0x0026, 0x0021, 0x000D, 0x0020, 0x0023, 0x0298, 0x006C, 0x0022, 0x00BF, 0x00BE, 0x01AD, 0x002D, 0x029B, 0x00B9, 0x01AC, 0x00B8, 0x01AF, 0x029A, 0x006F, 0x015B, 0x006E, 0x0285, 0x0284, 0x01AE, 0x0019, 0x002C, 0x01A9, 0x01A8, 0x000C, 0x000F, 0x015A, 0x00BB, 0x000E, 0x0000, 0x0069, 0x01AB, 0x0018, 0x01AA, 0x0004, 0x0055, 0x00BA, 0x0507, 0x0145, 0x0054, 0x0506, 0x00A5, 0x0501, 0x00A4, 0x0057, 0x0500, 0x0A05, 0x0144, 0x00A7, 0x0287, 0x0286, 0x0503, 0x0147, 0x0A04, 0x0146, }, { 0x0759, 0x0041, 0x00E5, 0x03BD, 0x0E9D, 0x012D, 0x012C, 0x3A1D, 0x03BC, 0x012F, 0x000D, 0x0040, 0x00E4, 0x03BF, 0x0043, 0x0042, 0x0758, 0x03BE, 0x00E7, 0x0001, 0x0000, 0x003D, 0x00E6, 0x0015, 0x0014, 0x0017, 0x003C, 0x743D, 0x012E, 0x03B9, 0x03B8, 0x0E9C, 0x03BB, 0x075B, 0x3A1C, 0x0E9F, 0x0129, 0x00E1, 0x0128, 0x0E9E, 0x012B, 0x075A, 0x00E0, 0x0E99, 0x0745, 0x3A1F, 0x03BA, 0x0744, 0x0E98, 0x1D0D, 0x03A5, 0x0E9B, 0x743C, 0x0E9A, 0x012A, 0x004D, 0x00E3, 0x0E85, 0x01D5, 0x0E84, 0x004C, 0x0747, 0x1D0C, 0x01D4, 0x003F, 0x0016, 0x0746, 0x03A4, 0x0741, 0x004F, 0x003E, 0x01D7, 0x0740, 0x000C, 0x0011, 0x004E, 0x00E2, 0x00ED, 0x00EC, 0x0049, 0x0048, }, }; static const uint8_t aic_mode2_vlc_bits[AIC_MODE2_NUM][AIC_MODE2_SIZE] = { { 1, 5, 4, 10, 6, 8, 5, 8, 8, 7, 5, 7, 11, 10, 9, 8, 13, 11, 6, 7, 3, 9, 8, 10, 9, 8, 5, 10, 9, 10, 10, 14, 12, 14, 14, 12, 8, 9, 7, 12, 8, 14, 9, 9, 12, 8, 9, 11, 11, 13, 9, 11, 14, 12, 6, 7, 9, 13, 9, 12, 7, 10, 12, 11, 12, 8, 15, 10, 15, 13, 7, 12, 10, 10, 8, 10, 13, 13, 13, 11, 8, }, { 4, 6, 5, 11, 8, 10, 7, 11, 9, 4, 1, 4, 9, 7, 7, 5, 9, 10, 6, 7, 4, 9, 9, 10, 9, 9, 6, 9, 10, 9, 10, 12, 12, 13, 12, 11, 9, 9, 8, 12, 8, 14, 10, 11, 12, 7, 8, 10, 11, 12, 9, 11, 13, 12, 6, 7, 8, 12, 9, 12, 7, 11, 10, 12, 12, 9, 14, 12, 15, 13, 8, 12, 11, 11, 10, 12, 13, 15, 14, 12, 9, }, { 5, 7, 6, 12, 9, 11, 8, 11, 10, 7, 5, 7, 11, 10, 9, 8, 12, 12, 5, 5, 1, 8, 7, 10, 8, 6, 4, 8, 8, 8, 9, 12, 11, 13, 12, 11, 8, 9, 8, 12, 8, 13, 10, 11, 11, 8, 9, 11, 12, 13, 11, 12, 14, 13, 8, 9, 10, 14, 11, 14, 9, 13, 13, 8, 9, 6, 11, 10, 14, 11, 6, 10, 6, 6, 4, 8, 9, 10, 10, 8, 5, }, { 11, 7, 8, 10, 12, 9, 10, 14, 12, 7, 1, 5, 7, 8, 6, 4, 10, 9, 10, 5, 4, 8, 11, 8, 7, 6, 7, 11, 6, 7, 8, 10, 8, 10, 11, 9, 10, 8, 9, 13, 9, 12, 8, 11, 12, 11, 4, 7, 8, 9, 6, 8, 12, 9, 8, 5, 8, 12, 9, 10, 6, 12, 11, 12, 12, 10, 15, 13, 13, 13, 10, 13, 15, 10, 9, 10, 12, 13, 13, 10, 9, }, { 11, 8, 8, 11, 13, 10, 11, 15, 12, 7, 1, 4, 7, 7, 5, 4, 8, 9, 11, 5, 5, 8, 11, 9, 8, 7, 8, 13, 7, 8, 9, 11, 9, 10, 12, 10, 10, 9, 8, 13, 9, 12, 9, 11, 12, 11, 5, 7, 9, 10, 6, 9, 13, 10, 7, 4, 7, 11, 8, 9, 5, 10, 11, 13, 11, 9, 15, 13, 15, 13, 8, 12, 15, 10, 10, 12, 13, 14, 14, 12, 11, }, { 12, 9, 9, 12, 13, 11, 11, 14, 12, 8, 2, 5, 7, 9, 6, 5, 10, 10, 9, 4, 2, 7, 9, 7, 6, 5, 6, 12, 6, 7, 8, 10, 8, 10, 11, 9, 12, 9, 10, 13, 11, 12, 10, 14, 13, 12, 6, 8, 10, 10, 7, 9, 12, 10, 8, 5, 8, 11, 9, 10, 7, 11, 12, 8, 6, 5, 11, 11, 11, 8, 6, 9, 12, 6, 6, 8, 10, 10, 11, 8, 6, }, { 13, 9, 10, 12, 14, 12, 11, 15, 15, 8, 1, 5, 7, 9, 6, 5, 11, 10, 11, 6, 5, 9, 11, 9, 8, 7, 8, 12, 6, 8, 8, 11, 8, 10, 12, 10, 10, 7, 9, 13, 10, 11, 9, 13, 12, 11, 3, 6, 8, 9, 4, 7, 11, 8, 8, 5, 9, 12, 10, 9, 7, 12, 13, 13, 12, 10, 14, 14, 15, 12, 11, 14, 15, 7, 9, 8, 11, 11, 12, 10, 9, }, { 10, 5, 6, 9, 11, 7, 8, 12, 11, 8, 1, 4, 7, 9, 6, 4, 10, 10, 11, 6, 6, 9, 9, 9, 9, 8, 8, 14, 10, 10, 12, 12, 11, 12, 13, 12, 10, 7, 8, 12, 9, 11, 8, 12, 11, 13, 7, 10, 11, 11, 8, 10, 13, 11, 6, 3, 7, 11, 8, 9, 5, 10, 11, 11, 11, 9, 14, 14, 14, 11, 10, 13, 14, 10, 11, 13, 13, 13, 14, 12, 12, }, { 2, 5, 3, 11, 8, 8, 6, 6, 7, 8, 5, 6, 12, 10, 10, 8, 10, 11, 7, 6, 2, 9, 8, 10, 8, 5, 4, 10, 11, 10, 10, 13, 12, 14, 13, 10, 10, 11, 8, 14, 9, 14, 12, 11, 12, 9, 10, 9, 13, 12, 11, 12, 14, 11, 8, 10, 7, 13, 10, 12, 8, 12, 12, 10, 9, 6, 12, 11, 11, 11, 6, 9, 10, 9, 6, 10, 9, 12, 11, 8, 7, }, { 6, 8, 6, 12, 11, 11, 10, 10, 9, 6, 1, 3, 10, 8, 8, 6, 7, 10, 8, 6, 3, 10, 9, 10, 8, 6, 5, 11, 10, 10, 12, 13, 12, 14, 13, 12, 10, 11, 8, 12, 9, 14, 12, 11, 12, 9, 9, 8, 12, 12, 10, 12, 13, 11, 7, 8, 6, 13, 9, 11, 7, 11, 11, 11, 10, 7, 14, 11, 12, 12, 7, 10, 12, 11, 8, 13, 12, 14, 13, 11, 10, }, { 7, 10, 7, 13, 13, 13, 11, 11, 10, 8, 5, 6, 12, 11, 10, 9, 10, 11, 7, 5, 1, 9, 8, 10, 7, 4, 4, 9, 11, 9, 11, 12, 11, 13, 13, 10, 9, 11, 8, 13, 9, 14, 12, 11, 12, 11, 10, 10, 13, 12, 11, 14, 14, 12, 9, 10, 8, 13, 10, 14, 9, 12, 12, 9, 7, 4, 12, 10, 11, 10, 6, 7, 9, 7, 4, 9, 9, 11, 9, 7, 5, }, { 7, 9, 7, 14, 11, 12, 10, 9, 9, 8, 5, 5, 12, 9, 10, 8, 8, 11, 7, 5, 2, 8, 8, 9, 7, 4, 4, 10, 11, 10, 12, 14, 11, 12, 13, 12, 9, 10, 8, 13, 8, 13, 10, 11, 11, 9, 9, 8, 14, 10, 10, 11, 12, 11, 10, 11, 9, 14, 10, 14, 9, 12, 14, 6, 6, 3, 11, 8, 9, 8, 3, 6, 9, 7, 4, 10, 8, 11, 10, 6, 5, }, { 6, 8, 7, 13, 12, 12, 10, 9, 9, 9, 7, 8, 13, 11, 11, 9, 11, 12, 7, 6, 1, 9, 8, 10, 7, 5, 4, 10, 12, 10, 12, 13, 13, 14, 13, 11, 9, 11, 9, 13, 10, 14, 12, 12, 12, 11, 12, 10, 14, 13, 12, 13, 14, 12, 8, 9, 7, 13, 10, 13, 8, 11, 12, 8, 6, 3, 12, 9, 10, 9, 4, 6, 10, 8, 5, 10, 10, 12, 11, 8, 6, }, { 7, 10, 7, 12, 9, 12, 10, 10, 12, 9, 7, 7, 12, 9, 11, 6, 10, 11, 6, 6, 1, 9, 8, 9, 7, 4, 5, 11, 12, 9, 12, 10, 14, 13, 13, 11, 10, 12, 8, 13, 8, 14, 10, 10, 11, 11, 11, 10, 13, 14, 10, 14, 13, 11, 11, 10, 7, 13, 8, 12, 7, 10, 12, 7, 10, 4, 12, 6, 10, 8, 5, 8, 10, 7, 4, 9, 7, 10, 9, 6, 5, }, { 7, 9, 7, 13, 12, 13, 10, 10, 8, 8, 5, 6, 11, 10, 10, 8, 10, 10, 7, 5, 2, 9, 8, 9, 7, 5, 3, 8, 9, 7, 9, 11, 11, 13, 11, 9, 8, 10, 7, 12, 9, 14, 11, 10, 10, 9, 10, 9, 12, 12, 12, 13, 14, 12, 10, 10, 9, 13, 11, 13, 9, 13, 12, 8, 7, 4, 12, 10, 10, 10, 6, 6, 7, 6, 3, 9, 8, 10, 9, 6, 3, }, { 7, 10, 7, 13, 13, 13, 11, 11, 9, 8, 6, 6, 13, 11, 11, 9, 10, 11, 7, 6, 1, 9, 8, 10, 8, 5, 4, 8, 9, 8, 9, 12, 12, 12, 12, 8, 10, 13, 9, 14, 11, 14, 14, 13, 12, 9, 10, 9, 13, 12, 11, 13, 14, 11, 9, 11, 8, 13, 11, 13, 10, 13, 13, 9, 8, 5, 12, 10, 11, 11, 6, 7, 8, 7, 3, 8, 9, 11, 10, 7, 4, }, { 8, 9, 7, 11, 11, 12, 11, 14, 9, 8, 6, 6, 11, 13, 10, 9, 11, 9, 7, 5, 1, 7, 9, 9, 7, 5, 3, 13, 11, 9, 10, 12, 11, 12, 12, 9, 10, 11, 9, 13, 9, 12, 12, 12, 10, 12, 11, 10, 13, 14, 12, 14, 14, 11, 11, 8, 8, 13, 11, 12, 9, 13, 11, 9, 10, 5, 11, 8, 11, 9, 6, 7, 7, 8, 4, 6, 8, 10, 8, 8, 5, }, { 8, 10, 8, 13, 13, 13, 12, 11, 10, 5, 1, 3, 10, 7, 8, 6, 8, 9, 8, 7, 4, 9, 10, 11, 8, 7, 6, 8, 9, 7, 9, 12, 11, 12, 10, 8, 9, 10, 8, 13, 9, 9, 12, 11, 11, 7, 7, 6, 12, 9, 8, 10, 12, 8, 6, 7, 4, 12, 8, 13, 6, 9, 10, 13, 13, 9, 15, 14, 14, 15, 9, 11, 13, 11, 9, 13, 13, 15, 15, 12, 10, }, { 10, 8, 9, 11, 12, 10, 8, 13, 13, 9, 2, 5, 7, 5, 4, 3, 8, 9, 11, 5, 5, 9, 8, 8, 6, 8, 8, 12, 7, 8, 10, 10, 9, 8, 12, 10, 9, 10, 9, 12, 7, 11, 7, 12, 12, 9, 5, 8, 9, 9, 6, 6, 11, 10, 6, 4, 7, 9, 5, 9, 3, 9, 10, 13, 11, 9, 13, 10, 13, 10, 9, 13, 14, 11, 10, 12, 12, 13, 11, 14, 11, }, { 11, 7, 8, 10, 12, 9, 9, 14, 10, 9, 4, 7, 8, 10, 7, 7, 11, 10, 8, 2, 2, 6, 8, 5, 5, 5, 6, 15, 9, 10, 10, 12, 10, 11, 14, 12, 9, 8, 9, 12, 9, 11, 8, 12, 11, 14, 10, 11, 12, 13, 10, 12, 15, 12, 9, 7, 8, 12, 9, 12, 7, 11, 13, 9, 6, 5, 11, 10, 11, 7, 6, 9, 11, 4, 5, 7, 8, 8, 8, 7, 7, }, }; /** * Codes used for determining block type */ #define AIC_MODE1_NUM 90 #define AIC_MODE1_SIZE 9 #define AIC_MODE1_BITS 7 static const uint8_t aic_mode1_vlc_codes[AIC_MODE1_NUM][AIC_MODE1_SIZE] = { { 0x01, 0x01, 0x01, 0x11, 0x00, 0x09, 0x03, 0x10, 0x05,}, { 0x09, 0x01, 0x01, 0x05, 0x11, 0x00, 0x03, 0x21, 0x20,}, { 0x01, 0x01, 0x01, 0x11, 0x09, 0x10, 0x05, 0x00, 0x03,}, { 0x01, 0x01, 0x00, 0x03, 0x21, 0x05, 0x09, 0x20, 0x11,}, { 0x01, 0x09, 0x00, 0x29, 0x08, 0x15, 0x03, 0x0B, 0x28,}, { 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x03, 0x02,}, { 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x01, 0x09, 0x08,}, { 0x01, 0x01, 0x01, 0x09, 0x01, 0x08, 0x00, 0x03, 0x05,}, { 0x01, 0x01, 0x01, 0x00, 0x05, 0x11, 0x09, 0x10, 0x03,}, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}, { 0x01, 0x01, 0x01, 0x05, 0x01, 0x00, 0x03, 0x09, 0x08,}, { 0x09, 0x01, 0x01, 0x05, 0x11, 0x00, 0x03, 0x21, 0x20,}, { 0x01, 0x01, 0x01, 0x0D, 0x05, 0x04, 0x00, 0x07, 0x0C,}, { 0x01, 0x01, 0x00, 0x05, 0x11, 0x03, 0x09, 0x21, 0x20,}, { 0x05, 0x01, 0x01, 0x11, 0x00, 0x09, 0x03, 0x21, 0x20,}, { 0x09, 0x01, 0x01, 0x00, 0x05, 0x01, 0x03, 0x11, 0x10,}, { 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x03, 0x02,}, { 0x01, 0x01, 0x01, 0x09, 0x00, 0x05, 0x01, 0x03, 0x08,}, { 0x01, 0x01, 0x01, 0x09, 0x11, 0x05, 0x00, 0x10, 0x03,}, { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}, { 0x01, 0x00, 0x01, 0x09, 0x08, 0x15, 0x14, 0x0B, 0x03,}, { 0x0D, 0x01, 0x01, 0x05, 0x0C, 0x04, 0x01, 0x00, 0x07,}, { 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x03, 0x01, 0x01,}, { 0x05, 0x01, 0x01, 0x04, 0x19, 0x07, 0x18, 0x0D, 0x00,}, { 0x11, 0x09, 0x01, 0x21, 0x05, 0x20, 0x01, 0x00, 0x03,}, { 0x41, 0x01, 0x00, 0x05, 0x40, 0x03, 0x09, 0x21, 0x11,}, { 0x29, 0x01, 0x00, 0x28, 0x09, 0x15, 0x03, 0x08, 0x0B,}, { 0x01, 0x00, 0x01, 0x11, 0x09, 0x10, 0x05, 0x01, 0x03,}, { 0x05, 0x01, 0x01, 0x04, 0x0D, 0x0C, 0x07, 0x00, 0x01,}, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}, { 0x01, 0x00, 0x03, 0x05, 0x11, 0x10, 0x25, 0x24, 0x13,}, { 0x21, 0x01, 0x01, 0x00, 0x11, 0x03, 0x05, 0x20, 0x09,}, { 0x01, 0x01, 0x01, 0x00, 0x09, 0x11, 0x10, 0x05, 0x03,}, { 0x21, 0x05, 0x01, 0x01, 0x09, 0x00, 0x11, 0x20, 0x03,}, { 0x05, 0x01, 0x00, 0x04, 0x01, 0x19, 0x07, 0x18, 0x0D,}, { 0x11, 0x01, 0x00, 0x01, 0x09, 0x01, 0x03, 0x10, 0x05,}, { 0x1D, 0x01, 0x05, 0x0D, 0x0C, 0x04, 0x00, 0x1C, 0x0F,}, { 0x05, 0x19, 0x01, 0x04, 0x00, 0x18, 0x1B, 0x1A, 0x07,}, { 0x09, 0x01, 0x00, 0x01, 0x05, 0x03, 0x11, 0x10, 0x01,}, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}, { 0x01, 0x00, 0x03, 0x41, 0x05, 0x40, 0x09, 0x11, 0x21,}, { 0x05, 0x01, 0x01, 0x19, 0x04, 0x07, 0x00, 0x18, 0x0D,}, { 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x01, 0x00, 0x03,}, { 0x01, 0x05, 0x00, 0x0D, 0x01, 0x04, 0x07, 0x19, 0x18,}, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,}, { 0x31, 0x01, 0x05, 0x19, 0x04, 0x07, 0x00, 0x30, 0x0D,}, { 0x01, 0x00, 0x03, 0x11, 0x01, 0x05, 0x01, 0x09, 0x10,}, { 0x01, 0x05, 0x01, 0x11, 0x01, 0x10, 0x00, 0x03, 0x09,}, { 0x01, 0x09, 0x00, 0x29, 0x03, 0x08, 0x28, 0x15, 0x0B,}, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}, { 0x01, 0x01, 0x00, 0x09, 0x15, 0x03, 0x08, 0x14, 0x0B,}, { 0x11, 0x01, 0x01, 0x00, 0x09, 0x01, 0x03, 0x10, 0x05,}, { 0x01, 0x00, 0x03, 0x25, 0x11, 0x05, 0x10, 0x24, 0x13,}, { 0x11, 0x01, 0x00, 0x01, 0x09, 0x01, 0x05, 0x10, 0x03,}, { 0x05, 0x01, 0x00, 0x0D, 0x0C, 0x04, 0x0F, 0x1D, 0x1C,}, { 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x03, 0x02,}, { 0x21, 0x01, 0x05, 0x09, 0x11, 0x00, 0x03, 0x41, 0x40,}, { 0x05, 0x01, 0x00, 0x1D, 0x1C, 0x0D, 0x0C, 0x0F, 0x04,}, { 0x05, 0x01, 0x00, 0x0D, 0x31, 0x04, 0x19, 0x30, 0x07,}, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}, { 0x01, 0x01, 0x00, 0x21, 0x05, 0x11, 0x03, 0x09, 0x20,}, { 0x01, 0x01, 0x00, 0x11, 0x03, 0x05, 0x01, 0x09, 0x10,}, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,}, { 0x05, 0x01, 0x04, 0x19, 0x07, 0x0D, 0x00, 0x31, 0x30,}, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,}, { 0x05, 0x01, 0x01, 0x11, 0x09, 0x00, 0x03, 0x21, 0x20,}, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,}, { 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x01, 0x01, 0x02,}, { 0x09, 0x01, 0x00, 0x29, 0x08, 0x15, 0x03, 0x28, 0x0B,}, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}, { 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x00, 0x01, 0x03,}, { 0x09, 0x01, 0x00, 0x29, 0x28, 0x15, 0x08, 0x03, 0x0B,}, { 0x01, 0x00, 0x01, 0x11, 0x05, 0x10, 0x09, 0x01, 0x03,}, { 0x05, 0x04, 0x01, 0x1D, 0x0D, 0x0C, 0x1C, 0x00, 0x0F,}, { 0x09, 0x11, 0x01, 0x41, 0x00, 0x40, 0x05, 0x03, 0x21,}, { 0x0D, 0x05, 0x01, 0x1D, 0x1C, 0x0C, 0x04, 0x00, 0x0F,}, { 0x41, 0x09, 0x01, 0x40, 0x00, 0x11, 0x05, 0x03, 0x21,}, { 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x00, 0x01, 0x03,}, { 0x05, 0x04, 0x01, 0x0D, 0x01, 0x0C, 0x07, 0x01, 0x00,}, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}, { 0x05, 0x04, 0x01, 0x07, 0x19, 0x31, 0x30, 0x0D, 0x00,}, { 0x21, 0x01, 0x01, 0x00, 0x11, 0x09, 0x20, 0x05, 0x03,}, { 0x05, 0x01, 0x01, 0x04, 0x07, 0x0D, 0x0C, 0x00, 0x01,}, { 0x21, 0x09, 0x01, 0x00, 0x20, 0x05, 0x23, 0x22, 0x03,}, { 0x31, 0x0D, 0x01, 0x19, 0x05, 0x30, 0x04, 0x07, 0x00,}, { 0x31, 0x05, 0x01, 0x04, 0x19, 0x00, 0x0D, 0x30, 0x07,}, { 0x31, 0x01, 0x00, 0x0D, 0x05, 0x19, 0x04, 0x30, 0x07,}, { 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02, 0x01, 0x01,}, { 0x01, 0x00, 0x01, 0x01, 0x05, 0x09, 0x08, 0x03, 0x01,}, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}, }; static const uint8_t aic_mode1_vlc_bits[AIC_MODE1_NUM][AIC_MODE1_SIZE] = { { 1, 4, 2, 7, 4, 6, 4, 7, 5,}, { 5, 1, 3, 4, 6, 3, 3, 7, 7,}, { 1, 4, 2, 7, 6, 7, 5, 4, 4,}, { 1, 3, 3, 3, 7, 4, 5, 7, 6,}, { 2, 4, 2, 6, 4, 5, 2, 4, 6,}, { 7, 2, 3, 4, 7, 1, 5, 7, 7,}, { 5, 1, 3, 6, 5, 5, 2, 7, 7,}, { 2, 5, 1, 7, 3, 7, 5, 5, 6,}, { 2, 4, 1, 4, 5, 7, 6, 7, 4,}, { 0, 0, 0, 0, 0, 0, 0, 0, 0,}, { 2, 1, 3, 6, 5, 5, 5, 7, 7,}, { 5, 1, 3, 4, 6, 3, 3, 7, 7,}, { 4, 1, 2, 6, 5, 5, 4, 5, 6,}, { 3, 1, 3, 4, 6, 3, 5, 7, 7,}, { 4, 1, 3, 6, 3, 5, 3, 7, 7,}, { 6, 1, 4, 4, 5, 2, 4, 7, 7,}, { 7, 1, 5, 7, 4, 3, 2, 7, 7,}, { 5, 3, 2, 7, 5, 6, 1, 5, 7,}, { 4, 1, 2, 6, 7, 5, 4, 7, 4,}, { 1, 0, 1, 0, 0, 0, 0, 0, 0,}, { 3, 3, 1, 5, 5, 6, 6, 5, 3,}, { 6, 2, 1, 5, 6, 5, 4, 4, 5,}, { 6, 4, 1, 7, 6, 7, 6, 3, 2,}, { 4, 3, 1, 4, 6, 4, 6, 5, 3,}, { 6, 5, 1, 7, 4, 7, 3, 3, 3,}, { 7, 2, 2, 3, 7, 2, 4, 6, 5,}, { 6, 2, 2, 6, 4, 5, 2, 4, 4,}, { 4, 4, 1, 7, 6, 7, 5, 2, 4,}, { 5, 4, 1, 5, 6, 6, 5, 4, 2,}, { 0, 0, 0, 0, 0, 0, 0, 0, 0,}, { 2, 2, 2, 3, 5, 5, 6, 6, 5,}, { 7, 1, 3, 3, 6, 3, 4, 7, 5,}, { 2, 4, 1, 4, 6, 7, 7, 5, 4,}, { 7, 4, 3, 1, 5, 3, 6, 7, 3,}, { 4, 3, 3, 4, 1, 6, 4, 6, 5,}, { 7, 4, 4, 2, 6, 1, 4, 7, 5,}, { 5, 2, 3, 4, 4, 3, 2, 5, 4,}, { 3, 5, 2, 3, 2, 5, 5, 5, 3,}, { 6, 4, 4, 2, 5, 4, 7, 7, 1,}, { 0, 0, 0, 0, 0, 0, 0, 0, 0,}, { 2, 2, 2, 7, 3, 7, 4, 5, 6,}, { 4, 1, 3, 6, 4, 4, 3, 6, 5,}, { 2, 4, 1, 7, 3, 7, 6, 6, 6,}, { 3, 4, 3, 5, 1, 4, 4, 6, 6,}, { 4, 5, 2, 7, 1, 7, 3, 7, 7,}, { 6, 2, 3, 5, 3, 3, 2, 6, 4,}, { 4, 4, 4, 7, 2, 5, 1, 6, 7,}, { 4, 5, 2, 7, 1, 7, 4, 4, 6,}, { 2, 4, 2, 6, 2, 4, 6, 5, 4,}, { 0, 0, 0, 0, 0, 0, 0, 0, 0,}, { 1, 3, 3, 5, 6, 3, 5, 6, 5,}, { 7, 1, 4, 4, 6, 2, 4, 7, 5,}, { 2, 2, 2, 6, 5, 3, 5, 6, 5,}, { 7, 4, 4, 2, 6, 1, 5, 7, 4,}, { 3, 2, 2, 4, 4, 3, 4, 5, 5,}, { 7, 2, 5, 3, 7, 1, 4, 7, 7,}, { 6, 2, 3, 4, 5, 2, 2, 7, 7,}, { 3, 2, 2, 5, 5, 4, 4, 4, 3,}, { 3, 2, 2, 4, 6, 3, 5, 6, 3,}, { 0, 0, 0, 0, 0, 0, 0, 0, 0,}, { 1, 3, 3, 7, 4, 6, 3, 5, 7,}, { 4, 1, 4, 7, 4, 5, 2, 6, 7,}, { 2, 4, 1, 7, 5, 7, 3, 7, 7,}, { 3, 2, 3, 5, 3, 4, 2, 6, 6,}, { 3, 5, 4, 7, 2, 7, 1, 7, 7,}, { 4, 1, 3, 6, 5, 3, 3, 7, 7,}, { 4, 2, 5, 7, 3, 7, 1, 7, 7,}, { 7, 4, 1, 7, 3, 7, 2, 5, 7,}, { 4, 2, 2, 6, 4, 5, 2, 6, 4,}, { 0, 0, 0, 0, 0, 0, 0, 0, 0,}, { 3, 4, 1, 7, 6, 7, 6, 2, 6,}, { 4, 2, 2, 6, 6, 5, 4, 2, 4,}, { 4, 4, 1, 7, 5, 7, 6, 2, 4,}, { 3, 3, 2, 5, 4, 4, 5, 2, 4,}, { 4, 5, 2, 7, 2, 7, 3, 2, 6,}, { 4, 3, 2, 5, 5, 4, 3, 2, 4,}, { 7, 4, 2, 7, 2, 5, 3, 2, 6,}, { 4, 6, 2, 7, 3, 7, 6, 1, 6,}, { 5, 5, 1, 6, 4, 6, 5, 2, 4,}, { 0, 0, 0, 0, 0, 0, 0, 0, 0,}, { 3, 3, 2, 3, 5, 6, 6, 4, 2,}, { 7, 1, 3, 3, 6, 5, 7, 4, 3,}, { 5, 4, 1, 5, 5, 6, 6, 4, 2,}, { 6, 4, 2, 2, 6, 3, 6, 6, 2,}, { 6, 4, 2, 5, 3, 6, 3, 3, 2,}, { 6, 3, 2, 3, 5, 2, 4, 6, 3,}, { 6, 2, 2, 4, 3, 5, 3, 6, 3,}, { 7, 5, 1, 7, 4, 7, 7, 3, 2,}, { 5, 5, 2, 3, 6, 7, 7, 5, 1,}, { 0, 0, 0, 0, 0, 0, 0, 0, 0,}, }; #define PBTYPE_ESCAPE 0xFF /** tables used for P-frame macroblock type decoding */ #define NUM_PTYPE_VLCS 7 #define PTYPE_VLC_SIZE 8 #define PTYPE_VLC_BITS 7 static const uint8_t ptype_vlc_codes[NUM_PTYPE_VLCS][PTYPE_VLC_SIZE] = { { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }, { 0x0D, 0x05, 0x01, 0x04, 0x01, 0x00, 0x07, 0x0C }, { 0x09, 0x11, 0x01, 0x00, 0x05, 0x03, 0x21, 0x20 }, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 } }; static const uint8_t ptype_vlc_bits[NUM_PTYPE_VLCS][PTYPE_VLC_SIZE] = { { 1, 2, 3, 6, 5, 4, 7, 7 }, { 3, 1, 2, 7, 6, 5, 4, 7 }, { 5, 4, 1, 4, 3, 3, 4, 5 }, { 4, 5, 2, 2, 3, 2, 6, 6 }, { 5, 6, 1, 4, 2, 3, 7, 7 }, { 5, 6, 1, 4, 3, 2, 7, 7 }, { 6, 3, 2, 7, 5, 4, 1, 7 } }; static const uint8_t ptype_vlc_syms[PTYPE_VLC_SIZE] = { 0, 1, 2, 3, 8, 9, 11, PBTYPE_ESCAPE }; /** reverse of ptype_vlc_syms */ static const uint8_t <API key>[12] = { 0, 1, 2, 3, 0, 0, 2, 0, 4, 5, 0, 6 }; /** tables used for P-frame macroblock type decoding */ #define NUM_BTYPE_VLCS 6 #define BTYPE_VLC_SIZE 7 #define BTYPE_VLC_BITS 6 static const uint8_t btype_vlc_codes[NUM_BTYPE_VLCS][BTYPE_VLC_SIZE] = { { 0x01, 0x05, 0x00, 0x03, 0x11, 0x09, 0x10 }, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }, { 0x09, 0x01, 0x00, 0x01, 0x05, 0x03, 0x08 }, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }, { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 } }; static const uint8_t btype_vlc_bits[NUM_BTYPE_VLCS][PTYPE_VLC_SIZE] = { { 2, 3, 2, 2, 5, 4, 5 }, { 4, 1, 3, 2, 6, 5, 6 }, { 6, 4, 1, 2, 5, 3, 6 }, { 5, 3, 3, 1, 4, 3, 5 }, { 6, 5, 3, 2, 4, 1, 6 }, { 6, 5, 3, 1, 4, 2, 6 } }; static const uint8_t btype_vlc_syms[BTYPE_VLC_SIZE] = { 0, 1, 4, 5, 10, 7, PBTYPE_ESCAPE }; /** reverse of btype_vlc_syms */ static const uint8_t <API key>[12] = { 0, 1, 0, 0, 2, 3, 0, 5, 0, 0, 4, 0 }; #endif /* FFMPEG_RV40VLC2_H */
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Module: zrender/tool/http</title> <meta property="og:title" content=""/> <meta property="og:type" content="website"/> <meta property="og:image" content=""/> <meta property="og:url" content=""/> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <script src="scripts/jquery.min.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif] <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/bootstrap.min.css"> <link type="text/css" rel="stylesheet" href="styles/jaguar.css"> <script> var config = {"monospaceLinks":false,"cleverLinks":false,"applicationName":"ZRender","disqus":"","googleAnalytics":"","openGraph":{"title":"","type":"website","image":"","site_name":"","url":""},"meta":{"title":"","description":"","keyword":""},"default":{}}; </script> </head> <body> <div id="wrap" class="clearfix"> <div class="navigation"> <h3 class="applicationName"><a href="index.html">ZRender</a></h3> <div class="search"> <input id="search" type="text" class="form-control input-sm" placeholder="Search Documentations"> </div> <ul class="list"> <li class="item" data-name="module:zrender"> <span class="title"> <a href="module-zrender.html">module:zrender</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender.version"><a href="module-zrender.html#.version">version</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender.delInstance"><a href="module-zrender.html#.delInstance">delInstance</a></li> <li data-name="module:zrender.dispose"><a href="module-zrender.html#.dispose">dispose</a></li> <li data-name="module:zrender.getInstance"><a href="module-zrender.html#.getInstance">getInstance</a></li> <li data-name="module:zrender.init"><a href="module-zrender.html#.init">init</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/animation/Animation"> <span class="title"> <a href="<API key>.html">module:zrender/animation/Animation</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/animation/Animation~IZRenderStage"><a href="<API key>.html#~IZRenderStage">IZRenderStage</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/animation/Animation#add"><a href="<API key>.html#add">add</a></li> <li data-name="module:zrender/animation/Animation#animate"><a href="<API key>.html#animate">animate</a></li> <li data-name="module:zrender/animation/Animation#clear"><a href="<API key>.html#clear">clear</a></li> <li data-name="module:zrender/animation/Animation#remove"><a href="<API key>.html#remove">remove</a></li> <li data-name="module:zrender/animation/Animation#start"><a href="<API key>.html#start">start</a></li> <li data-name="module:zrender/animation/Animation#stop"><a href="<API key>.html#stop">stop</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/animation/easing"> <span class="title"> <a href="<API key>.html">module:zrender/animation/easing</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/animation/easing.BackIn"><a href="<API key>.html#.BackIn">BackIn</a></li> <li data-name="module:zrender/animation/easing.BackInOut"><a href="<API key>.html#.BackInOut">BackInOut</a></li> <li data-name="module:zrender/animation/easing.BackOut"><a href="<API key>.html#.BackOut">BackOut</a></li> <li data-name="module:zrender/animation/easing.BounceIn"><a href="<API key>.html#.BounceIn">BounceIn</a></li> <li data-name="module:zrender/animation/easing.BounceInOut"><a href="<API key>.html#.BounceInOut">BounceInOut</a></li> <li data-name="module:zrender/animation/easing.BounceOut"><a href="<API key>.html#.BounceOut">BounceOut</a></li> <li data-name="module:zrender/animation/easing.CircularIn"><a href="<API key>.html#.CircularIn">CircularIn</a></li> <li data-name="module:zrender/animation/easing.CircularInOut"><a href="<API key>.html#.CircularInOut">CircularInOut</a></li> <li data-name="module:zrender/animation/easing.CircularOut"><a href="<API key>.html#.CircularOut">CircularOut</a></li> <li data-name="module:zrender/animation/easing.CubicIn"><a href="<API key>.html#.CubicIn">CubicIn</a></li> <li data-name="module:zrender/animation/easing.CubicInOut"><a href="<API key>.html#.CubicInOut">CubicInOut</a></li> <li data-name="module:zrender/animation/easing.CubicOut"><a href="<API key>.html#.CubicOut">CubicOut</a></li> <li data-name="module:zrender/animation/easing.ElasticIn"><a href="<API key>.html#.ElasticIn">ElasticIn</a></li> <li data-name="module:zrender/animation/easing.ElasticInOut"><a href="<API key>.html#.ElasticInOut">ElasticInOut</a></li> <li data-name="module:zrender/animation/easing.ElasticOut"><a href="<API key>.html#.ElasticOut">ElasticOut</a></li> <li data-name="module:zrender/animation/easing.ExponentialIn"><a href="<API key>.html#.ExponentialIn">ExponentialIn</a></li> <li data-name="module:zrender/animation/easing.ExponentialInOut"><a href="<API key>.html#.ExponentialInOut">ExponentialInOut</a></li> <li data-name="module:zrender/animation/easing.ExponentialOut"><a href="<API key>.html#.ExponentialOut">ExponentialOut</a></li> <li data-name="module:zrender/animation/easing.Linear"><a href="<API key>.html#.Linear">Linear</a></li> <li data-name="module:zrender/animation/easing.QuadraticIn"><a href="<API key>.html#.QuadraticIn">QuadraticIn</a></li> <li data-name="module:zrender/animation/easing.QuadraticInOut"><a href="<API key>.html#.QuadraticInOut">QuadraticInOut</a></li> <li data-name="module:zrender/animation/easing.QuadraticOut"><a href="<API key>.html#.QuadraticOut">QuadraticOut</a></li> <li data-name="module:zrender/animation/easing.QuarticIn"><a href="<API key>.html#.QuarticIn">QuarticIn</a></li> <li data-name="module:zrender/animation/easing.QuarticInOut"><a href="<API key>.html#.QuarticInOut">QuarticInOut</a></li> <li data-name="module:zrender/animation/easing.QuarticOut"><a href="<API key>.html#.QuarticOut">QuarticOut</a></li> <li data-name="module:zrender/animation/easing.QuinticIn"><a href="<API key>.html#.QuinticIn">QuinticIn</a></li> <li data-name="module:zrender/animation/easing.QuinticInOut"><a href="<API key>.html#.QuinticInOut">QuinticInOut</a></li> <li data-name="module:zrender/animation/easing.QuinticOut"><a href="<API key>.html#.QuinticOut">QuinticOut</a></li> <li data-name="module:zrender/animation/easing.SinusoidalIn"><a href="<API key>.html#.SinusoidalIn">SinusoidalIn</a></li> <li data-name="module:zrender/animation/easing.SinusoidalInOut"><a href="<API key>.html#.SinusoidalInOut">SinusoidalInOut</a></li> <li data-name="module:zrender/animation/easing.SinusoidalOut"><a href="<API key>.html#.SinusoidalOut">SinusoidalOut</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/config"> <span class="title"> <a href="<API key>.html">module:zrender/config</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/config.debugMode"><a href="<API key>.html#.debugMode">debugMode</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/Group"> <span class="title"> <a href="<API key>.html">module:zrender/Group</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/Group#clipShape"><a href="<API key>.html#clipShape">clipShape</a></li> <li data-name="module:zrender/Group#id"><a href="<API key>.html#id">id</a></li> <li data-name="module:zrender/Group#ignore"><a href="<API key>.html#ignore">ignore</a></li> <li data-name="module:zrender/Group#type"><a href="<API key>.html#type">type</a></li> <li data-name="module:zrender/Group#position"><a href="<API key>.html#position">position</a></li> <li data-name="module:zrender/Group#rotation"><a href="<API key>.html#rotation">rotation</a></li> <li data-name="module:zrender/Group#scale"><a href="<API key>.html#scale">scale</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/Group#addChild"><a href="<API key>.html#addChild">addChild</a></li> <li data-name="module:zrender/Group#childAt"><a href="<API key>.html#childAt">childAt</a></li> <li data-name="module:zrender/Group#children"><a href="<API key>.html#children">children</a></li> <li data-name="module:zrender/Group#clearChildren"><a href="<API key>.html#clearChildren">clearChildren</a></li> <li data-name="module:zrender/Group#eachChild"><a href="<API key>.html#eachChild">eachChild</a></li> <li data-name="module:zrender/Group#removeChild"><a href="<API key>.html#removeChild">removeChild</a></li> <li data-name="module:zrender/Group#traverse"><a href="<API key>.html#traverse">traverse</a></li> <li data-name="module:zrender/Group#bind"><a href="<API key>.html#bind">bind</a></li> <li data-name="module:zrender/Group#decomposeTransform"><a href="<API key>.html#decomposeTransform">decomposeTransform</a></li> <li data-name="module:zrender/Group#dispatch"><a href="<API key>.html#dispatch">dispatch</a></li> <li data-name="module:zrender/Group#dispatchWithContext"><a href="<API key>.html#dispatchWithContext">dispatchWithContext</a></li> <li data-name="module:zrender/Group#lookAt"><a href="<API key>.html#lookAt">lookAt</a></li> <li data-name="module:zrender/Group#one"><a href="<API key>.html#one">one</a></li> <li data-name="module:zrender/Group#setTransform"><a href="<API key>.html#setTransform">setTransform</a></li> <li data-name="module:zrender/Group#<API key>"><a href="<API key>.html#<API key>"><API key></a></li> <li data-name="module:zrender/Group#unbind"><a href="<API key>.html#unbind">unbind</a></li> <li data-name="module:zrender/Group#updateTransform"><a href="<API key>.html#updateTransform">updateTransform</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="module:zrender/Group#event:onclick"><a href="<API key>.html#event:onclick">onclick</a></li> <li data-name="module:zrender/Group#event:ondragend"><a href="<API key>.html#event:ondragend">ondragend</a></li> <li data-name="module:zrender/Group#event:ondragenter"><a href="<API key>.html#event:ondragenter">ondragenter</a></li> <li data-name="module:zrender/Group#event:ondragleave"><a href="<API key>.html#event:ondragleave">ondragleave</a></li> <li data-name="module:zrender/Group#event:ondragover"><a href="<API key>.html#event:ondragover">ondragover</a></li> <li data-name="module:zrender/Group#event:ondragstart"><a href="<API key>.html#event:ondragstart">ondragstart</a></li> <li data-name="module:zrender/Group#event:ondrop"><a href="<API key>.html#event:ondrop">ondrop</a></li> <li data-name="module:zrender/Group#event:onmousedown"><a href="<API key>.html#event:onmousedown">onmousedown</a></li> <li data-name="module:zrender/Group#event:onmousemove"><a href="<API key>.html#event:onmousemove">onmousemove</a></li> <li data-name="module:zrender/Group#event:onmouseout"><a href="<API key>.html#event:onmouseout">onmouseout</a></li> <li data-name="module:zrender/Group#event:onmouseover"><a href="<API key>.html#event:onmouseover">onmouseover</a></li> <li data-name="module:zrender/Group#event:onmouseup"><a href="<API key>.html#event:onmouseup">onmouseup</a></li> <li data-name="module:zrender/Group#event:onmousewheel"><a href="<API key>.html#event:onmousewheel">onmousewheel</a></li> </ul> </li> <li class="item" data-name="module:zrender/Handler"> <span class="title"> <a href="<API key>.html">module:zrender/Handler</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/Handler#dispose"><a href="<API key>.html#dispose">dispose</a></li> <li data-name="module:zrender/Handler#on"><a href="<API key>.html#on">on</a></li> <li data-name="module:zrender/Handler#trigger"><a href="<API key>.html#trigger">trigger</a></li> <li data-name="module:zrender/Handler#un"><a href="<API key>.html#un">un</a></li> <li data-name="module:zrender/Handler#bind"><a href="<API key>.html#bind">bind</a></li> <li data-name="module:zrender/Handler#dispatch"><a href="<API key>.html#dispatch">dispatch</a></li> <li data-name="module:zrender/Handler#dispatchWithContext"><a href="<API key>.html#dispatchWithContext">dispatchWithContext</a></li> <li data-name="module:zrender/Handler#one"><a href="<API key>.html#one">one</a></li> <li data-name="module:zrender/Handler#unbind"><a href="<API key>.html#unbind">unbind</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="module:zrender/Handler#event:onclick"><a href="<API key>.html#event:onclick">onclick</a></li> <li data-name="module:zrender/Handler#event:ondragend"><a href="<API key>.html#event:ondragend">ondragend</a></li> <li data-name="module:zrender/Handler#event:ondragenter"><a href="<API key>.html#event:ondragenter">ondragenter</a></li> <li data-name="module:zrender/Handler#event:ondragleave"><a href="<API key>.html#event:ondragleave">ondragleave</a></li> <li data-name="module:zrender/Handler#event:ondragover"><a href="<API key>.html#event:ondragover">ondragover</a></li> <li data-name="module:zrender/Handler#event:ondragstart"><a href="<API key>.html#event:ondragstart">ondragstart</a></li> <li data-name="module:zrender/Handler#event:ondrop"><a href="<API key>.html#event:ondrop">ondrop</a></li> <li data-name="module:zrender/Handler#event:onmousedown"><a href="<API key>.html#event:onmousedown">onmousedown</a></li> <li data-name="module:zrender/Handler#event:onmousemove"><a href="<API key>.html#event:onmousemove">onmousemove</a></li> <li data-name="module:zrender/Handler#event:onmouseout"><a href="<API key>.html#event:onmouseout">onmouseout</a></li> <li data-name="module:zrender/Handler#event:onmouseover"><a href="<API key>.html#event:onmouseover">onmouseover</a></li> <li data-name="module:zrender/Handler#event:onmouseup"><a href="<API key>.html#event:onmouseup">onmouseup</a></li> <li data-name="module:zrender/Handler#event:onmousewheel"><a href="<API key>.html#event:onmousewheel">onmousewheel</a></li> </ul> </li> <li class="item" data-name="module:zrender/Layer"> <span class="title"> <a href="<API key>.html">module:zrender/Layer</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/Layer#clearColor"><a href="<API key>.html#clearColor">clearColor</a></li> <li data-name="module:zrender/Layer#lastFrameAlpha"><a href="<API key>.html#lastFrameAlpha">lastFrameAlpha</a></li> <li data-name="module:zrender/Layer#motionBlur"><a href="<API key>.html#motionBlur">motionBlur</a></li> <li data-name="module:zrender/Layer#panable"><a href="<API key>.html#panable">panable</a></li> <li data-name="module:zrender/Layer#zoomable"><a href="<API key>.html#zoomable">zoomable</a></li> <li data-name="module:zrender/Layer#position"><a href="<API key>.html#position">position</a></li> <li data-name="module:zrender/Layer#rotation"><a href="<API key>.html#rotation">rotation</a></li> <li data-name="module:zrender/Layer#scale"><a href="<API key>.html#scale">scale</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/Layer#clear"><a href="<API key>.html#clear">clear</a></li> <li data-name="module:zrender/Layer#resize"><a href="<API key>.html#resize">resize</a></li> <li data-name="module:zrender/Layer#decomposeTransform"><a href="<API key>.html#decomposeTransform">decomposeTransform</a></li> <li data-name="module:zrender/Layer#lookAt"><a href="<API key>.html#lookAt">lookAt</a></li> <li data-name="module:zrender/Layer#setTransform"><a href="<API key>.html#setTransform">setTransform</a></li> <li data-name="module:zrender/Layer#<API key>"><a href="<API key>.html#<API key>"><API key></a></li> <li data-name="module:zrender/Layer#updateTransform"><a href="<API key>.html#updateTransform">updateTransform</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/mixin/Eventful"> <span class="title"> <a href="<API key>.html">module:zrender/mixin/Eventful</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/mixin/Eventful#bind"><a href="<API key>.html#bind">bind</a></li> <li data-name="module:zrender/mixin/Eventful#dispatch"><a href="<API key>.html#dispatch">dispatch</a></li> <li data-name="module:zrender/mixin/Eventful#dispatchWithContext"><a href="<API key>.html#dispatchWithContext">dispatchWithContext</a></li> <li data-name="module:zrender/mixin/Eventful#one"><a href="<API key>.html#one">one</a></li> <li data-name="module:zrender/mixin/Eventful#unbind"><a href="<API key>.html#unbind">unbind</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="module:zrender/mixin/Eventful#event:onclick"><a href="<API key>.html#event:onclick">onclick</a></li> <li data-name="module:zrender/mixin/Eventful#event:ondragend"><a href="<API key>.html#event:ondragend">ondragend</a></li> <li data-name="module:zrender/mixin/Eventful#event:ondragenter"><a href="<API key>.html#event:ondragenter">ondragenter</a></li> <li data-name="module:zrender/mixin/Eventful#event:ondragleave"><a href="<API key>.html#event:ondragleave">ondragleave</a></li> <li data-name="module:zrender/mixin/Eventful#event:ondragover"><a href="<API key>.html#event:ondragover">ondragover</a></li> <li data-name="module:zrender/mixin/Eventful#event:ondragstart"><a href="<API key>.html#event:ondragstart">ondragstart</a></li> <li data-name="module:zrender/mixin/Eventful#event:ondrop"><a href="<API key>.html#event:ondrop">ondrop</a></li> <li data-name="module:zrender/mixin/Eventful#event:onmousedown"><a href="<API key>.html#event:onmousedown">onmousedown</a></li> <li data-name="module:zrender/mixin/Eventful#event:onmousemove"><a href="<API key>.html#event:onmousemove">onmousemove</a></li> <li data-name="module:zrender/mixin/Eventful#event:onmouseout"><a href="<API key>.html#event:onmouseout">onmouseout</a></li> <li data-name="module:zrender/mixin/Eventful#event:onmouseover"><a href="<API key>.html#event:onmouseover">onmouseover</a></li> <li data-name="module:zrender/mixin/Eventful#event:onmouseup"><a href="<API key>.html#event:onmouseup">onmouseup</a></li> <li data-name="module:zrender/mixin/Eventful#event:onmousewheel"><a href="<API key>.html#event:onmousewheel">onmousewheel</a></li> </ul> </li> <li class="item" data-name="module:zrender/mixin/Transformable"> <span class="title"> <a href="<API key>.html">module:zrender/mixin/Transformable</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/mixin/Transformable#needTransform"><a href="<API key>.html#needTransform">needTransform</a></li> <li data-name="module:zrender/mixin/Transformable#position"><a href="<API key>.html#position">position</a></li> <li data-name="module:zrender/mixin/Transformable#rotation"><a href="<API key>.html#rotation">rotation</a></li> <li data-name="module:zrender/mixin/Transformable#scale"><a href="<API key>.html#scale">scale</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/mixin/Transformable#decomposeTransform"><a href="<API key>.html#decomposeTransform">decomposeTransform</a></li> <li data-name="module:zrender/mixin/Transformable#lookAt"><a href="<API key>.html#lookAt">lookAt</a></li> <li data-name="module:zrender/mixin/Transformable#setTransform"><a href="<API key>.html#setTransform">setTransform</a></li> <li data-name="module:zrender/mixin/Transformable#<API key>"><a href="<API key>.html#<API key>"><API key></a></li> <li data-name="module:zrender/mixin/Transformable#updateTransform"><a href="<API key>.html#updateTransform">updateTransform</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/Painter"> <span class="title"> <a href="<API key>.html">module:zrender/Painter</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/Painter#root"><a href="<API key>.html#root">root</a></li> <li data-name="module:zrender/Painter#storage"><a href="<API key>.html#storage">storage</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/Painter#clear"><a href="<API key>.html#clear">clear</a></li> <li data-name="module:zrender/Painter#clearHover"><a href="<API key>.html#clearHover">clearHover</a></li> <li data-name="module:zrender/Painter#clearLayer"><a href="<API key>.html#clearLayer">clearLayer</a></li> <li data-name="module:zrender/Painter#delLayer"><a href="<API key>.html#delLayer">delLayer</a></li> <li data-name="module:zrender/Painter#dispose"><a href="<API key>.html#dispose">dispose</a></li> <li data-name="module:zrender/Painter#getHeight"><a href="<API key>.html#getHeight">getHeight</a></li> <li data-name="module:zrender/Painter#getLayer"><a href="<API key>.html#getLayer">getLayer</a></li> <li data-name="module:zrender/Painter#getLayers"><a href="<API key>.html#getLayers">getLayers</a></li> <li data-name="module:zrender/Painter#getWidth"><a href="<API key>.html#getWidth">getWidth</a></li> <li data-name="module:zrender/Painter#hideLoading"><a href="<API key>.html#hideLoading">hideLoading</a></li> <li data-name="module:zrender/Painter#isLoading"><a href="<API key>.html#isLoading">isLoading</a></li> <li data-name="module:zrender/Painter#modLayer"><a href="<API key>.html#modLayer">modLayer</a></li> <li data-name="module:zrender/Painter#refresh"><a href="<API key>.html#refresh">refresh</a></li> <li data-name="module:zrender/Painter#refreshHover"><a href="<API key>.html#refreshHover">refreshHover</a></li> <li data-name="module:zrender/Painter#refreshShapes"><a href="<API key>.html#refreshShapes">refreshShapes</a></li> <li data-name="module:zrender/Painter#render"><a href="<API key>.html#render">render</a></li> <li data-name="module:zrender/Painter#resize"><a href="<API key>.html#resize">resize</a></li> <li data-name="module:zrender/Painter#setLoadingEffect"><a href="<API key>.html#setLoadingEffect">setLoadingEffect</a></li> <li data-name="module:zrender/Painter#showLoading"><a href="<API key>.html#showLoading">showLoading</a></li> <li data-name="module:zrender/Painter#toDataURL"><a href="<API key>.html#toDataURL">toDataURL</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/shape/Base"> <span class="title"> <a href="<API key>.html">module:zrender/shape/Base</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/Base#clickable"><a href="<API key>.html#clickable">clickable</a></li> <li data-name="module:zrender/shape/Base#draggable"><a href="<API key>.html#draggable">draggable</a></li> <li data-name="module:zrender/shape/Base#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/Base#hoverable"><a href="<API key>.html#hoverable">hoverable</a></li> <li data-name="module:zrender/shape/Base#id"><a href="<API key>.html#id">id</a></li> <li data-name="module:zrender/shape/Base#ignore"><a href="<API key>.html#ignore">ignore</a></li> <li data-name="module:zrender/shape/Base#invisible"><a href="<API key>.html#invisible">invisible</a></li> <li data-name="module:zrender/shape/Base#parent"><a href="<API key>.html#parent">parent</a></li> <li data-name="module:zrender/shape/Base#style"><a href="<API key>.html#style">style</a></li> <li data-name="module:zrender/shape/Base#z"><a href="<API key>.html#z">z</a></li> <li data-name="module:zrender/shape/Base#zlevel"><a href="<API key>.html#zlevel">zlevel</a></li> <li data-name="module:zrender/shape/Base#position"><a href="<API key>.html#position">position</a></li> <li data-name="module:zrender/shape/Base#rotation"><a href="<API key>.html#rotation">rotation</a></li> <li data-name="module:zrender/shape/Base#scale"><a href="<API key>.html#scale">scale</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/Base~IBaseShapeStyle"><a href="<API key>.html#~IBaseShapeStyle">IBaseShapeStyle</a></li> <li data-name="module:zrender/shape/Base~IBoundingRect"><a href="<API key>.html#~IBoundingRect">IBoundingRect</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/shape/Base#afterBrush"><a href="<API key>.html#afterBrush">afterBrush</a></li> <li data-name="module:zrender/shape/Base#beforeBrush"><a href="<API key>.html#beforeBrush">beforeBrush</a></li> <li data-name="module:zrender/shape/Base#brush"><a href="<API key>.html#brush">brush</a></li> <li data-name="module:zrender/shape/Base#buildPath"><a href="<API key>.html#buildPath">buildPath</a></li> <li data-name="module:zrender/shape/Base#drawText"><a href="<API key>.html#drawText">drawText</a></li> <li data-name="module:zrender/shape/Base#drift"><a href="<API key>.html#drift">drift</a></li> <li data-name="module:zrender/shape/Base#getHighlightStyle"><a href="<API key>.html#getHighlightStyle">getHighlightStyle</a></li> <li data-name="module:zrender/shape/Base#getRect"><a href="<API key>.html#getRect">getRect</a></li> <li data-name="module:zrender/shape/Base#isCover"><a href="<API key>.html#isCover">isCover</a></li> <li data-name="module:zrender/shape/Base#isSilent"><a href="<API key>.html#isSilent">isSilent</a></li> <li data-name="module:zrender/shape/Base#setContext"><a href="<API key>.html#setContext">setContext</a></li> <li data-name="module:zrender/shape/Base#bind"><a href="<API key>.html#bind">bind</a></li> <li data-name="module:zrender/shape/Base#decomposeTransform"><a href="<API key>.html#decomposeTransform">decomposeTransform</a></li> <li data-name="module:zrender/shape/Base#dispatch"><a href="<API key>.html#dispatch">dispatch</a></li> <li data-name="module:zrender/shape/Base#dispatchWithContext"><a href="<API key>.html#dispatchWithContext">dispatchWithContext</a></li> <li data-name="module:zrender/shape/Base#lookAt"><a href="<API key>.html#lookAt">lookAt</a></li> <li data-name="module:zrender/shape/Base#one"><a href="<API key>.html#one">one</a></li> <li data-name="module:zrender/shape/Base#setTransform"><a href="<API key>.html#setTransform">setTransform</a></li> <li data-name="module:zrender/shape/Base#<API key>"><a href="<API key>.html#<API key>"><API key></a></li> <li data-name="module:zrender/shape/Base#unbind"><a href="<API key>.html#unbind">unbind</a></li> <li data-name="module:zrender/shape/Base#updateTransform"><a href="<API key>.html#updateTransform">updateTransform</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="module:zrender/shape/Base#event:onclick"><a href="<API key>.html#event:onclick">onclick</a></li> <li data-name="module:zrender/shape/Base#event:ondragend"><a href="<API key>.html#event:ondragend">ondragend</a></li> <li data-name="module:zrender/shape/Base#event:ondragenter"><a href="<API key>.html#event:ondragenter">ondragenter</a></li> <li data-name="module:zrender/shape/Base#event:ondragleave"><a href="<API key>.html#event:ondragleave">ondragleave</a></li> <li data-name="module:zrender/shape/Base#event:ondragover"><a href="<API key>.html#event:ondragover">ondragover</a></li> <li data-name="module:zrender/shape/Base#event:ondragstart"><a href="<API key>.html#event:ondragstart">ondragstart</a></li> <li data-name="module:zrender/shape/Base#event:ondrop"><a href="<API key>.html#event:ondrop">ondrop</a></li> <li data-name="module:zrender/shape/Base#event:onmousedown"><a href="<API key>.html#event:onmousedown">onmousedown</a></li> <li data-name="module:zrender/shape/Base#event:onmousemove"><a href="<API key>.html#event:onmousemove">onmousemove</a></li> <li data-name="module:zrender/shape/Base#event:onmouseout"><a href="<API key>.html#event:onmouseout">onmouseout</a></li> <li data-name="module:zrender/shape/Base#event:onmouseover"><a href="<API key>.html#event:onmouseover">onmouseover</a></li> <li data-name="module:zrender/shape/Base#event:onmouseup"><a href="<API key>.html#event:onmouseup">onmouseup</a></li> <li data-name="module:zrender/shape/Base#event:onmousewheel"><a href="<API key>.html#event:onmousewheel">onmousewheel</a></li> </ul> </li> <li class="item" data-name="module:zrender/shape/BezierCurve"> <span class="title"> <a href="<API key>.html">module:zrender/shape/BezierCurve</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/BezierCurve#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/BezierCurve#style"><a href="<API key>.html#style">style</a></li> <li data-name="module:zrender/shape/BezierCurve#id"><a href="<API key>.html#id">id</a></li> <li data-name="module:zrender/shape/BezierCurve#parent"><a href="<API key>.html#parent">parent</a></li> <li data-name="module:zrender/shape/BezierCurve#position"><a href="<API key>.html#position">position</a></li> <li data-name="module:zrender/shape/BezierCurve#rotation"><a href="<API key>.html#rotation">rotation</a></li> <li data-name="module:zrender/shape/BezierCurve#scale"><a href="<API key>.html#scale">scale</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/BezierCurve~IBezierCurveStyle"><a href="<API key>.html#~IBezierCurveStyle">IBezierCurveStyle</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/shape/BezierCurve#buildPath"><a href="<API key>.html#buildPath">buildPath</a></li> <li data-name="module:zrender/shape/BezierCurve#getRect"><a href="<API key>.html#getRect">getRect</a></li> <li data-name="module:zrender/shape/BezierCurve#afterBrush"><a href="<API key>.html#afterBrush">afterBrush</a></li> <li data-name="module:zrender/shape/BezierCurve#beforeBrush"><a href="<API key>.html#beforeBrush">beforeBrush</a></li> <li data-name="module:zrender/shape/BezierCurve#bind"><a href="<API key>.html#bind">bind</a></li> <li data-name="module:zrender/shape/BezierCurve#brush"><a href="<API key>.html#brush">brush</a></li> <li data-name="module:zrender/shape/BezierCurve#decomposeTransform"><a href="<API key>.html#decomposeTransform">decomposeTransform</a></li> <li data-name="module:zrender/shape/BezierCurve#dispatch"><a href="<API key>.html#dispatch">dispatch</a></li> <li data-name="module:zrender/shape/BezierCurve#dispatchWithContext"><a href="<API key>.html#dispatchWithContext">dispatchWithContext</a></li> <li data-name="module:zrender/shape/BezierCurve#drawText"><a href="<API key>.html#drawText">drawText</a></li> <li data-name="module:zrender/shape/BezierCurve#drift"><a href="<API key>.html#drift">drift</a></li> <li data-name="module:zrender/shape/BezierCurve#getHighlightStyle"><a href="<API key>.html#getHighlightStyle">getHighlightStyle</a></li> <li data-name="module:zrender/shape/BezierCurve#isCover"><a href="<API key>.html#isCover">isCover</a></li> <li data-name="module:zrender/shape/BezierCurve#isSilent"><a href="<API key>.html#isSilent">isSilent</a></li> <li data-name="module:zrender/shape/BezierCurve#lookAt"><a href="<API key>.html#lookAt">lookAt</a></li> <li data-name="module:zrender/shape/BezierCurve#one"><a href="<API key>.html#one">one</a></li> <li data-name="module:zrender/shape/BezierCurve#setContext"><a href="<API key>.html#setContext">setContext</a></li> <li data-name="module:zrender/shape/BezierCurve#setTransform"><a href="<API key>.html#setTransform">setTransform</a></li> <li data-name="module:zrender/shape/BezierCurve#<API key>"><a href="<API key>.html#<API key>"><API key></a></li> <li data-name="module:zrender/shape/BezierCurve#unbind"><a href="<API key>.html#unbind">unbind</a></li> <li data-name="module:zrender/shape/BezierCurve#updateTransform"><a href="<API key>.html#updateTransform">updateTransform</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="module:zrender/shape/BezierCurve#event:onclick"><a href="<API key>.html#event:onclick">onclick</a></li> <li data-name="module:zrender/shape/BezierCurve#event:ondragend"><a href="<API key>.html#event:ondragend">ondragend</a></li> <li data-name="module:zrender/shape/BezierCurve#event:ondragenter"><a href="<API key>.html#event:ondragenter">ondragenter</a></li> <li data-name="module:zrender/shape/BezierCurve#event:ondragleave"><a href="<API key>.html#event:ondragleave">ondragleave</a></li> <li data-name="module:zrender/shape/BezierCurve#event:ondragover"><a href="<API key>.html#event:ondragover">ondragover</a></li> <li data-name="module:zrender/shape/BezierCurve#event:ondragstart"><a href="<API key>.html#event:ondragstart">ondragstart</a></li> <li data-name="module:zrender/shape/BezierCurve#event:ondrop"><a href="<API key>.html#event:ondrop">ondrop</a></li> <li data-name="module:zrender/shape/BezierCurve#event:onmousedown"><a href="<API key>.html#event:onmousedown">onmousedown</a></li> <li data-name="module:zrender/shape/BezierCurve#event:onmousemove"><a href="<API key>.html#event:onmousemove">onmousemove</a></li> <li data-name="module:zrender/shape/BezierCurve#event:onmouseout"><a href="<API key>.html#event:onmouseout">onmouseout</a></li> <li data-name="module:zrender/shape/BezierCurve#event:onmouseover"><a href="<API key>.html#event:onmouseover">onmouseover</a></li> <li data-name="module:zrender/shape/BezierCurve#event:onmouseup"><a href="<API key>.html#event:onmouseup">onmouseup</a></li> <li data-name="module:zrender/shape/BezierCurve#event:onmousewheel"><a href="<API key>.html#event:onmousewheel">onmousewheel</a></li> </ul> </li> <li class="item" data-name="module:zrender/shape/Circle"> <span class="title"> <a href="<API key>.html">module:zrender/shape/Circle</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/Circle#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/Circle#style"><a href="<API key>.html#style">style</a></li> <li data-name="module:zrender/shape/Circle#id"><a href="<API key>.html#id">id</a></li> <li data-name="module:zrender/shape/Circle#parent"><a href="<API key>.html#parent">parent</a></li> <li data-name="module:zrender/shape/Circle#position"><a href="<API key>.html#position">position</a></li> <li data-name="module:zrender/shape/Circle#rotation"><a href="<API key>.html#rotation">rotation</a></li> <li data-name="module:zrender/shape/Circle#scale"><a href="<API key>.html#scale">scale</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/Circle~ICircleStyle"><a href="<API key>.html#~ICircleStyle">ICircleStyle</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/shape/Circle#buildPath"><a href="<API key>.html#buildPath">buildPath</a></li> <li data-name="module:zrender/shape/Circle#getRect"><a href="<API key>.html#getRect">getRect</a></li> <li data-name="module:zrender/shape/Circle#afterBrush"><a href="<API key>.html#afterBrush">afterBrush</a></li> <li data-name="module:zrender/shape/Circle#beforeBrush"><a href="<API key>.html#beforeBrush">beforeBrush</a></li> <li data-name="module:zrender/shape/Circle#bind"><a href="<API key>.html#bind">bind</a></li> <li data-name="module:zrender/shape/Circle#brush"><a href="<API key>.html#brush">brush</a></li> <li data-name="module:zrender/shape/Circle#decomposeTransform"><a href="<API key>.html#decomposeTransform">decomposeTransform</a></li> <li data-name="module:zrender/shape/Circle#dispatch"><a href="<API key>.html#dispatch">dispatch</a></li> <li data-name="module:zrender/shape/Circle#dispatchWithContext"><a href="<API key>.html#dispatchWithContext">dispatchWithContext</a></li> <li data-name="module:zrender/shape/Circle#drawText"><a href="<API key>.html#drawText">drawText</a></li> <li data-name="module:zrender/shape/Circle#drift"><a href="<API key>.html#drift">drift</a></li> <li data-name="module:zrender/shape/Circle#getHighlightStyle"><a href="<API key>.html#getHighlightStyle">getHighlightStyle</a></li> <li data-name="module:zrender/shape/Circle#isCover"><a href="<API key>.html#isCover">isCover</a></li> <li data-name="module:zrender/shape/Circle#isSilent"><a href="<API key>.html#isSilent">isSilent</a></li> <li data-name="module:zrender/shape/Circle#lookAt"><a href="<API key>.html#lookAt">lookAt</a></li> <li data-name="module:zrender/shape/Circle#one"><a href="<API key>.html#one">one</a></li> <li data-name="module:zrender/shape/Circle#setContext"><a href="<API key>.html#setContext">setContext</a></li> <li data-name="module:zrender/shape/Circle#setTransform"><a href="<API key>.html#setTransform">setTransform</a></li> <li data-name="module:zrender/shape/Circle#<API key>"><a href="<API key>.html#<API key>"><API key></a></li> <li data-name="module:zrender/shape/Circle#unbind"><a href="<API key>.html#unbind">unbind</a></li> <li data-name="module:zrender/shape/Circle#updateTransform"><a href="<API key>.html#updateTransform">updateTransform</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="module:zrender/shape/Circle#event:onclick"><a href="<API key>.html#event:onclick">onclick</a></li> <li data-name="module:zrender/shape/Circle#event:ondragend"><a href="<API key>.html#event:ondragend">ondragend</a></li> <li data-name="module:zrender/shape/Circle#event:ondragenter"><a href="<API key>.html#event:ondragenter">ondragenter</a></li> <li data-name="module:zrender/shape/Circle#event:ondragleave"><a href="<API key>.html#event:ondragleave">ondragleave</a></li> <li data-name="module:zrender/shape/Circle#event:ondragover"><a href="<API key>.html#event:ondragover">ondragover</a></li> <li data-name="module:zrender/shape/Circle#event:ondragstart"><a href="<API key>.html#event:ondragstart">ondragstart</a></li> <li data-name="module:zrender/shape/Circle#event:ondrop"><a href="<API key>.html#event:ondrop">ondrop</a></li> <li data-name="module:zrender/shape/Circle#event:onmousedown"><a href="<API key>.html#event:onmousedown">onmousedown</a></li> <li data-name="module:zrender/shape/Circle#event:onmousemove"><a href="<API key>.html#event:onmousemove">onmousemove</a></li> <li data-name="module:zrender/shape/Circle#event:onmouseout"><a href="<API key>.html#event:onmouseout">onmouseout</a></li> <li data-name="module:zrender/shape/Circle#event:onmouseover"><a href="<API key>.html#event:onmouseover">onmouseover</a></li> <li data-name="module:zrender/shape/Circle#event:onmouseup"><a href="<API key>.html#event:onmouseup">onmouseup</a></li> <li data-name="module:zrender/shape/Circle#event:onmousewheel"><a href="<API key>.html#event:onmousewheel">onmousewheel</a></li> </ul> </li> <li class="item" data-name="module:zrender/shape/Droplet"> <span class="title"> <a href="<API key>.html">module:zrender/shape/Droplet</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/Droplet#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/Droplet#style"><a href="<API key>.html#style">style</a></li> <li data-name="module:zrender/shape/Droplet#id"><a href="<API key>.html#id">id</a></li> <li data-name="module:zrender/shape/Droplet#parent"><a href="<API key>.html#parent">parent</a></li> <li data-name="module:zrender/shape/Droplet#position"><a href="<API key>.html#position">position</a></li> <li data-name="module:zrender/shape/Droplet#rotation"><a href="<API key>.html#rotation">rotation</a></li> <li data-name="module:zrender/shape/Droplet#scale"><a href="<API key>.html#scale">scale</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/Droplet~IDropletStyle"><a href="<API key>.html#~IDropletStyle">IDropletStyle</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/shape/Droplet#buildPath"><a href="<API key>.html#buildPath">buildPath</a></li> <li data-name="module:zrender/shape/Droplet#getRect"><a href="<API key>.html#getRect">getRect</a></li> <li data-name="module:zrender/shape/Droplet#afterBrush"><a href="<API key>.html#afterBrush">afterBrush</a></li> <li data-name="module:zrender/shape/Droplet#beforeBrush"><a href="<API key>.html#beforeBrush">beforeBrush</a></li> <li data-name="module:zrender/shape/Droplet#bind"><a href="<API key>.html#bind">bind</a></li> <li data-name="module:zrender/shape/Droplet#brush"><a href="<API key>.html#brush">brush</a></li> <li data-name="module:zrender/shape/Droplet#decomposeTransform"><a href="<API key>.html#decomposeTransform">decomposeTransform</a></li> <li data-name="module:zrender/shape/Droplet#dispatch"><a href="<API key>.html#dispatch">dispatch</a></li> <li data-name="module:zrender/shape/Droplet#dispatchWithContext"><a href="<API key>.html#dispatchWithContext">dispatchWithContext</a></li> <li data-name="module:zrender/shape/Droplet#drawText"><a href="<API key>.html#drawText">drawText</a></li> <li data-name="module:zrender/shape/Droplet#drift"><a href="<API key>.html#drift">drift</a></li> <li data-name="module:zrender/shape/Droplet#getHighlightStyle"><a href="<API key>.html#getHighlightStyle">getHighlightStyle</a></li> <li data-name="module:zrender/shape/Droplet#isCover"><a href="<API key>.html#isCover">isCover</a></li> <li data-name="module:zrender/shape/Droplet#isSilent"><a href="<API key>.html#isSilent">isSilent</a></li> <li data-name="module:zrender/shape/Droplet#lookAt"><a href="<API key>.html#lookAt">lookAt</a></li> <li data-name="module:zrender/shape/Droplet#one"><a href="<API key>.html#one">one</a></li> <li data-name="module:zrender/shape/Droplet#setContext"><a href="<API key>.html#setContext">setContext</a></li> <li data-name="module:zrender/shape/Droplet#setTransform"><a href="<API key>.html#setTransform">setTransform</a></li> <li data-name="module:zrender/shape/Droplet#<API key>"><a href="<API key>.html#<API key>"><API key></a></li> <li data-name="module:zrender/shape/Droplet#unbind"><a href="<API key>.html#unbind">unbind</a></li> <li data-name="module:zrender/shape/Droplet#updateTransform"><a href="<API key>.html#updateTransform">updateTransform</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="module:zrender/shape/Droplet#event:onclick"><a href="<API key>.html#event:onclick">onclick</a></li> <li data-name="module:zrender/shape/Droplet#event:ondragend"><a href="<API key>.html#event:ondragend">ondragend</a></li> <li data-name="module:zrender/shape/Droplet#event:ondragenter"><a href="<API key>.html#event:ondragenter">ondragenter</a></li> <li data-name="module:zrender/shape/Droplet#event:ondragleave"><a href="<API key>.html#event:ondragleave">ondragleave</a></li> <li data-name="module:zrender/shape/Droplet#event:ondragover"><a href="<API key>.html#event:ondragover">ondragover</a></li> <li data-name="module:zrender/shape/Droplet#event:ondragstart"><a href="<API key>.html#event:ondragstart">ondragstart</a></li> <li data-name="module:zrender/shape/Droplet#event:ondrop"><a href="<API key>.html#event:ondrop">ondrop</a></li> <li data-name="module:zrender/shape/Droplet#event:onmousedown"><a href="<API key>.html#event:onmousedown">onmousedown</a></li> <li data-name="module:zrender/shape/Droplet#event:onmousemove"><a href="<API key>.html#event:onmousemove">onmousemove</a></li> <li data-name="module:zrender/shape/Droplet#event:onmouseout"><a href="<API key>.html#event:onmouseout">onmouseout</a></li> <li data-name="module:zrender/shape/Droplet#event:onmouseover"><a href="<API key>.html#event:onmouseover">onmouseover</a></li> <li data-name="module:zrender/shape/Droplet#event:onmouseup"><a href="<API key>.html#event:onmouseup">onmouseup</a></li> <li data-name="module:zrender/shape/Droplet#event:onmousewheel"><a href="<API key>.html#event:onmousewheel">onmousewheel</a></li> </ul> </li> <li class="item" data-name="module:zrender/shape/Ellipse"> <span class="title"> <a href="<API key>.html">module:zrender/shape/Ellipse</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/Ellipse#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/Ellipse#style"><a href="<API key>.html#style">style</a></li> <li data-name="module:zrender/shape/Ellipse#id"><a href="<API key>.html#id">id</a></li> <li data-name="module:zrender/shape/Ellipse#parent"><a href="<API key>.html#parent">parent</a></li> <li data-name="module:zrender/shape/Ellipse#position"><a href="<API key>.html#position">position</a></li> <li data-name="module:zrender/shape/Ellipse#rotation"><a href="<API key>.html#rotation">rotation</a></li> <li data-name="module:zrender/shape/Ellipse#scale"><a href="<API key>.html#scale">scale</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/Ellipse~IEllipseStyle"><a href="<API key>.html#~IEllipseStyle">IEllipseStyle</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/shape/Ellipse#buildPath"><a href="<API key>.html#buildPath">buildPath</a></li> <li data-name="module:zrender/shape/Ellipse#getRect"><a href="<API key>.html#getRect">getRect</a></li> <li data-name="module:zrender/shape/Ellipse#afterBrush"><a href="<API key>.html#afterBrush">afterBrush</a></li> <li data-name="module:zrender/shape/Ellipse#beforeBrush"><a href="<API key>.html#beforeBrush">beforeBrush</a></li> <li data-name="module:zrender/shape/Ellipse#bind"><a href="<API key>.html#bind">bind</a></li> <li data-name="module:zrender/shape/Ellipse#brush"><a href="<API key>.html#brush">brush</a></li> <li data-name="module:zrender/shape/Ellipse#decomposeTransform"><a href="<API key>.html#decomposeTransform">decomposeTransform</a></li> <li data-name="module:zrender/shape/Ellipse#dispatch"><a href="<API key>.html#dispatch">dispatch</a></li> <li data-name="module:zrender/shape/Ellipse#dispatchWithContext"><a href="<API key>.html#dispatchWithContext">dispatchWithContext</a></li> <li data-name="module:zrender/shape/Ellipse#drawText"><a href="<API key>.html#drawText">drawText</a></li> <li data-name="module:zrender/shape/Ellipse#drift"><a href="<API key>.html#drift">drift</a></li> <li data-name="module:zrender/shape/Ellipse#getHighlightStyle"><a href="<API key>.html#getHighlightStyle">getHighlightStyle</a></li> <li data-name="module:zrender/shape/Ellipse#isCover"><a href="<API key>.html#isCover">isCover</a></li> <li data-name="module:zrender/shape/Ellipse#isSilent"><a href="<API key>.html#isSilent">isSilent</a></li> <li data-name="module:zrender/shape/Ellipse#lookAt"><a href="<API key>.html#lookAt">lookAt</a></li> <li data-name="module:zrender/shape/Ellipse#one"><a href="<API key>.html#one">one</a></li> <li data-name="module:zrender/shape/Ellipse#setContext"><a href="<API key>.html#setContext">setContext</a></li> <li data-name="module:zrender/shape/Ellipse#setTransform"><a href="<API key>.html#setTransform">setTransform</a></li> <li data-name="module:zrender/shape/Ellipse#<API key>"><a href="<API key>.html#<API key>"><API key></a></li> <li data-name="module:zrender/shape/Ellipse#unbind"><a href="<API key>.html#unbind">unbind</a></li> <li data-name="module:zrender/shape/Ellipse#updateTransform"><a href="<API key>.html#updateTransform">updateTransform</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="module:zrender/shape/Ellipse#event:onclick"><a href="<API key>.html#event:onclick">onclick</a></li> <li data-name="module:zrender/shape/Ellipse#event:ondragend"><a href="<API key>.html#event:ondragend">ondragend</a></li> <li data-name="module:zrender/shape/Ellipse#event:ondragenter"><a href="<API key>.html#event:ondragenter">ondragenter</a></li> <li data-name="module:zrender/shape/Ellipse#event:ondragleave"><a href="<API key>.html#event:ondragleave">ondragleave</a></li> <li data-name="module:zrender/shape/Ellipse#event:ondragover"><a href="<API key>.html#event:ondragover">ondragover</a></li> <li data-name="module:zrender/shape/Ellipse#event:ondragstart"><a href="<API key>.html#event:ondragstart">ondragstart</a></li> <li data-name="module:zrender/shape/Ellipse#event:ondrop"><a href="<API key>.html#event:ondrop">ondrop</a></li> <li data-name="module:zrender/shape/Ellipse#event:onmousedown"><a href="<API key>.html#event:onmousedown">onmousedown</a></li> <li data-name="module:zrender/shape/Ellipse#event:onmousemove"><a href="<API key>.html#event:onmousemove">onmousemove</a></li> <li data-name="module:zrender/shape/Ellipse#event:onmouseout"><a href="<API key>.html#event:onmouseout">onmouseout</a></li> <li data-name="module:zrender/shape/Ellipse#event:onmouseover"><a href="<API key>.html#event:onmouseover">onmouseover</a></li> <li data-name="module:zrender/shape/Ellipse#event:onmouseup"><a href="<API key>.html#event:onmouseup">onmouseup</a></li> <li data-name="module:zrender/shape/Ellipse#event:onmousewheel"><a href="<API key>.html#event:onmousewheel">onmousewheel</a></li> </ul> </li> <li class="item" data-name="module:zrender/shape/Heart"> <span class="title"> <a href="<API key>.html">module:zrender/shape/Heart</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/Heart#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/Heart#style"><a href="<API key>.html#style">style</a></li> <li data-name="module:zrender/shape/Heart#id"><a href="<API key>.html#id">id</a></li> <li data-name="module:zrender/shape/Heart#parent"><a href="<API key>.html#parent">parent</a></li> <li data-name="module:zrender/shape/Heart#position"><a href="<API key>.html#position">position</a></li> <li data-name="module:zrender/shape/Heart#rotation"><a href="<API key>.html#rotation">rotation</a></li> <li data-name="module:zrender/shape/Heart#scale"><a href="<API key>.html#scale">scale</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/Heart~IHeartStyle"><a href="<API key>.html#~IHeartStyle">IHeartStyle</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/shape/Heart#buildPath"><a href="<API key>.html#buildPath">buildPath</a></li> <li data-name="module:zrender/shape/Heart#getRect"><a href="<API key>.html#getRect">getRect</a></li> <li data-name="module:zrender/shape/Heart#afterBrush"><a href="<API key>.html#afterBrush">afterBrush</a></li> <li data-name="module:zrender/shape/Heart#beforeBrush"><a href="<API key>.html#beforeBrush">beforeBrush</a></li> <li data-name="module:zrender/shape/Heart#bind"><a href="<API key>.html#bind">bind</a></li> <li data-name="module:zrender/shape/Heart#brush"><a href="<API key>.html#brush">brush</a></li> <li data-name="module:zrender/shape/Heart#decomposeTransform"><a href="<API key>.html#decomposeTransform">decomposeTransform</a></li> <li data-name="module:zrender/shape/Heart#dispatch"><a href="<API key>.html#dispatch">dispatch</a></li> <li data-name="module:zrender/shape/Heart#dispatchWithContext"><a href="<API key>.html#dispatchWithContext">dispatchWithContext</a></li> <li data-name="module:zrender/shape/Heart#drawText"><a href="<API key>.html#drawText">drawText</a></li> <li data-name="module:zrender/shape/Heart#drift"><a href="<API key>.html#drift">drift</a></li> <li data-name="module:zrender/shape/Heart#getHighlightStyle"><a href="<API key>.html#getHighlightStyle">getHighlightStyle</a></li> <li data-name="module:zrender/shape/Heart#isCover"><a href="<API key>.html#isCover">isCover</a></li> <li data-name="module:zrender/shape/Heart#isSilent"><a href="<API key>.html#isSilent">isSilent</a></li> <li data-name="module:zrender/shape/Heart#lookAt"><a href="<API key>.html#lookAt">lookAt</a></li> <li data-name="module:zrender/shape/Heart#one"><a href="<API key>.html#one">one</a></li> <li data-name="module:zrender/shape/Heart#setContext"><a href="<API key>.html#setContext">setContext</a></li> <li data-name="module:zrender/shape/Heart#setTransform"><a href="<API key>.html#setTransform">setTransform</a></li> <li data-name="module:zrender/shape/Heart#<API key>"><a href="<API key>.html#<API key>"><API key></a></li> <li data-name="module:zrender/shape/Heart#unbind"><a href="<API key>.html#unbind">unbind</a></li> <li data-name="module:zrender/shape/Heart#updateTransform"><a href="<API key>.html#updateTransform">updateTransform</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="module:zrender/shape/Heart#event:onclick"><a href="<API key>.html#event:onclick">onclick</a></li> <li data-name="module:zrender/shape/Heart#event:ondragend"><a href="<API key>.html#event:ondragend">ondragend</a></li> <li data-name="module:zrender/shape/Heart#event:ondragenter"><a href="<API key>.html#event:ondragenter">ondragenter</a></li> <li data-name="module:zrender/shape/Heart#event:ondragleave"><a href="<API key>.html#event:ondragleave">ondragleave</a></li> <li data-name="module:zrender/shape/Heart#event:ondragover"><a href="<API key>.html#event:ondragover">ondragover</a></li> <li data-name="module:zrender/shape/Heart#event:ondragstart"><a href="<API key>.html#event:ondragstart">ondragstart</a></li> <li data-name="module:zrender/shape/Heart#event:ondrop"><a href="<API key>.html#event:ondrop">ondrop</a></li> <li data-name="module:zrender/shape/Heart#event:onmousedown"><a href="<API key>.html#event:onmousedown">onmousedown</a></li> <li data-name="module:zrender/shape/Heart#event:onmousemove"><a href="<API key>.html#event:onmousemove">onmousemove</a></li> <li data-name="module:zrender/shape/Heart#event:onmouseout"><a href="<API key>.html#event:onmouseout">onmouseout</a></li> <li data-name="module:zrender/shape/Heart#event:onmouseover"><a href="<API key>.html#event:onmouseover">onmouseover</a></li> <li data-name="module:zrender/shape/Heart#event:onmouseup"><a href="<API key>.html#event:onmouseup">onmouseup</a></li> <li data-name="module:zrender/shape/Heart#event:onmousewheel"><a href="<API key>.html#event:onmousewheel">onmousewheel</a></li> </ul> </li> <li class="item" data-name="module:zrender/shape/Image"> <span class="title"> <a href="<API key>.html">module:zrender/shape/Image</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/Image#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/Image#style"><a href="<API key>.html#style">style</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/Image~IImageStyle"><a href="<API key>.html#~IImageStyle">IImageStyle</a></li> </ul> <ul class="methods itemMembers"> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/shape/Isogon"> <span class="title"> <a href="<API key>.html">module:zrender/shape/Isogon</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/Isogon#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/Isogon#style"><a href="<API key>.html#style">style</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/Isogon~IIsogonStyle"><a href="<API key>.html#~IIsogonStyle">IIsogonStyle</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/shape/Isogon#buildPath"><a href="<API key>.html#buildPath">buildPath</a></li> <li data-name="module:zrender/shape/Isogon#getRect"><a href="<API key>.html#getRect">getRect</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/shape/Line"> <span class="title"> <a href="<API key>.html">module:zrender/shape/Line</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/Line#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/Line#style"><a href="<API key>.html#style">style</a></li> <li data-name="module:zrender/shape/Line#id"><a href="<API key>.html#id">id</a></li> <li data-name="module:zrender/shape/Line#parent"><a href="<API key>.html#parent">parent</a></li> <li data-name="module:zrender/shape/Line#position"><a href="<API key>.html#position">position</a></li> <li data-name="module:zrender/shape/Line#rotation"><a href="<API key>.html#rotation">rotation</a></li> <li data-name="module:zrender/shape/Line#scale"><a href="<API key>.html#scale">scale</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/Line~ILineStyle"><a href="<API key>.html#~ILineStyle">ILineStyle</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/shape/Line#buildPath"><a href="<API key>.html#buildPath">buildPath</a></li> <li data-name="module:zrender/shape/Line#getRect"><a href="<API key>.html#getRect">getRect</a></li> <li data-name="module:zrender/shape/Line#afterBrush"><a href="<API key>.html#afterBrush">afterBrush</a></li> <li data-name="module:zrender/shape/Line#beforeBrush"><a href="<API key>.html#beforeBrush">beforeBrush</a></li> <li data-name="module:zrender/shape/Line#bind"><a href="<API key>.html#bind">bind</a></li> <li data-name="module:zrender/shape/Line#brush"><a href="<API key>.html#brush">brush</a></li> <li data-name="module:zrender/shape/Line#decomposeTransform"><a href="<API key>.html#decomposeTransform">decomposeTransform</a></li> <li data-name="module:zrender/shape/Line#dispatch"><a href="<API key>.html#dispatch">dispatch</a></li> <li data-name="module:zrender/shape/Line#dispatchWithContext"><a href="<API key>.html#dispatchWithContext">dispatchWithContext</a></li> <li data-name="module:zrender/shape/Line#drawText"><a href="<API key>.html#drawText">drawText</a></li> <li data-name="module:zrender/shape/Line#drift"><a href="<API key>.html#drift">drift</a></li> <li data-name="module:zrender/shape/Line#getHighlightStyle"><a href="<API key>.html#getHighlightStyle">getHighlightStyle</a></li> <li data-name="module:zrender/shape/Line#isCover"><a href="<API key>.html#isCover">isCover</a></li> <li data-name="module:zrender/shape/Line#isSilent"><a href="<API key>.html#isSilent">isSilent</a></li> <li data-name="module:zrender/shape/Line#lookAt"><a href="<API key>.html#lookAt">lookAt</a></li> <li data-name="module:zrender/shape/Line#one"><a href="<API key>.html#one">one</a></li> <li data-name="module:zrender/shape/Line#setContext"><a href="<API key>.html#setContext">setContext</a></li> <li data-name="module:zrender/shape/Line#setTransform"><a href="<API key>.html#setTransform">setTransform</a></li> <li data-name="module:zrender/shape/Line#<API key>"><a href="<API key>.html#<API key>"><API key></a></li> <li data-name="module:zrender/shape/Line#unbind"><a href="<API key>.html#unbind">unbind</a></li> <li data-name="module:zrender/shape/Line#updateTransform"><a href="<API key>.html#updateTransform">updateTransform</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="module:zrender/shape/Line#event:onclick"><a href="<API key>.html#event:onclick">onclick</a></li> <li data-name="module:zrender/shape/Line#event:ondragend"><a href="<API key>.html#event:ondragend">ondragend</a></li> <li data-name="module:zrender/shape/Line#event:ondragenter"><a href="<API key>.html#event:ondragenter">ondragenter</a></li> <li data-name="module:zrender/shape/Line#event:ondragleave"><a href="<API key>.html#event:ondragleave">ondragleave</a></li> <li data-name="module:zrender/shape/Line#event:ondragover"><a href="<API key>.html#event:ondragover">ondragover</a></li> <li data-name="module:zrender/shape/Line#event:ondragstart"><a href="<API key>.html#event:ondragstart">ondragstart</a></li> <li data-name="module:zrender/shape/Line#event:ondrop"><a href="<API key>.html#event:ondrop">ondrop</a></li> <li data-name="module:zrender/shape/Line#event:onmousedown"><a href="<API key>.html#event:onmousedown">onmousedown</a></li> <li data-name="module:zrender/shape/Line#event:onmousemove"><a href="<API key>.html#event:onmousemove">onmousemove</a></li> <li data-name="module:zrender/shape/Line#event:onmouseout"><a href="<API key>.html#event:onmouseout">onmouseout</a></li> <li data-name="module:zrender/shape/Line#event:onmouseover"><a href="<API key>.html#event:onmouseover">onmouseover</a></li> <li data-name="module:zrender/shape/Line#event:onmouseup"><a href="<API key>.html#event:onmouseup">onmouseup</a></li> <li data-name="module:zrender/shape/Line#event:onmousewheel"><a href="<API key>.html#event:onmousewheel">onmousewheel</a></li> </ul> </li> <li class="item" data-name="module:zrender/shape/Path"> <span class="title"> <a href="<API key>.html">module:zrender/shape/Path</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/Path#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/Path#style"><a href="<API key>.html#style">style</a></li> <li data-name="module:zrender/shape/Path#id"><a href="<API key>.html#id">id</a></li> <li data-name="module:zrender/shape/Path#parent"><a href="<API key>.html#parent">parent</a></li> <li data-name="module:zrender/shape/Path#position"><a href="<API key>.html#position">position</a></li> <li data-name="module:zrender/shape/Path#rotation"><a href="<API key>.html#rotation">rotation</a></li> <li data-name="module:zrender/shape/Path#scale"><a href="<API key>.html#scale">scale</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/Path~IPathStyle"><a href="<API key>.html#~IPathStyle">IPathStyle</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/shape/Path#buildPath"><a href="<API key>.html#buildPath">buildPath</a></li> <li data-name="module:zrender/shape/Path#getRect"><a href="<API key>.html#getRect">getRect</a></li> <li data-name="module:zrender/shape/Path#afterBrush"><a href="<API key>.html#afterBrush">afterBrush</a></li> <li data-name="module:zrender/shape/Path#beforeBrush"><a href="<API key>.html#beforeBrush">beforeBrush</a></li> <li data-name="module:zrender/shape/Path#bind"><a href="<API key>.html#bind">bind</a></li> <li data-name="module:zrender/shape/Path#brush"><a href="<API key>.html#brush">brush</a></li> <li data-name="module:zrender/shape/Path#decomposeTransform"><a href="<API key>.html#decomposeTransform">decomposeTransform</a></li> <li data-name="module:zrender/shape/Path#dispatch"><a href="<API key>.html#dispatch">dispatch</a></li> <li data-name="module:zrender/shape/Path#dispatchWithContext"><a href="<API key>.html#dispatchWithContext">dispatchWithContext</a></li> <li data-name="module:zrender/shape/Path#drawText"><a href="<API key>.html#drawText">drawText</a></li> <li data-name="module:zrender/shape/Path#drift"><a href="<API key>.html#drift">drift</a></li> <li data-name="module:zrender/shape/Path#getHighlightStyle"><a href="<API key>.html#getHighlightStyle">getHighlightStyle</a></li> <li data-name="module:zrender/shape/Path#isCover"><a href="<API key>.html#isCover">isCover</a></li> <li data-name="module:zrender/shape/Path#isSilent"><a href="<API key>.html#isSilent">isSilent</a></li> <li data-name="module:zrender/shape/Path#lookAt"><a href="<API key>.html#lookAt">lookAt</a></li> <li data-name="module:zrender/shape/Path#one"><a href="<API key>.html#one">one</a></li> <li data-name="module:zrender/shape/Path#setContext"><a href="<API key>.html#setContext">setContext</a></li> <li data-name="module:zrender/shape/Path#setTransform"><a href="<API key>.html#setTransform">setTransform</a></li> <li data-name="module:zrender/shape/Path#<API key>"><a href="<API key>.html#<API key>"><API key></a></li> <li data-name="module:zrender/shape/Path#unbind"><a href="<API key>.html#unbind">unbind</a></li> <li data-name="module:zrender/shape/Path#updateTransform"><a href="<API key>.html#updateTransform">updateTransform</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="module:zrender/shape/Path#event:onclick"><a href="<API key>.html#event:onclick">onclick</a></li> <li data-name="module:zrender/shape/Path#event:ondragend"><a href="<API key>.html#event:ondragend">ondragend</a></li> <li data-name="module:zrender/shape/Path#event:ondragenter"><a href="<API key>.html#event:ondragenter">ondragenter</a></li> <li data-name="module:zrender/shape/Path#event:ondragleave"><a href="<API key>.html#event:ondragleave">ondragleave</a></li> <li data-name="module:zrender/shape/Path#event:ondragover"><a href="<API key>.html#event:ondragover">ondragover</a></li> <li data-name="module:zrender/shape/Path#event:ondragstart"><a href="<API key>.html#event:ondragstart">ondragstart</a></li> <li data-name="module:zrender/shape/Path#event:ondrop"><a href="<API key>.html#event:ondrop">ondrop</a></li> <li data-name="module:zrender/shape/Path#event:onmousedown"><a href="<API key>.html#event:onmousedown">onmousedown</a></li> <li data-name="module:zrender/shape/Path#event:onmousemove"><a href="<API key>.html#event:onmousemove">onmousemove</a></li> <li data-name="module:zrender/shape/Path#event:onmouseout"><a href="<API key>.html#event:onmouseout">onmouseout</a></li> <li data-name="module:zrender/shape/Path#event:onmouseover"><a href="<API key>.html#event:onmouseover">onmouseover</a></li> <li data-name="module:zrender/shape/Path#event:onmouseup"><a href="<API key>.html#event:onmouseup">onmouseup</a></li> <li data-name="module:zrender/shape/Path#event:onmousewheel"><a href="<API key>.html#event:onmousewheel">onmousewheel</a></li> </ul> </li> <li class="item" data-name="module:zrender/shape/Polygon"> <span class="title"> <a href="<API key>.html">module:zrender/shape/Polygon</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/Polygon#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/Polygon#style"><a href="<API key>.html#style">style</a></li> <li data-name="module:zrender/shape/Polygon#id"><a href="<API key>.html#id">id</a></li> <li data-name="module:zrender/shape/Polygon#parent"><a href="<API key>.html#parent">parent</a></li> <li data-name="module:zrender/shape/Polygon#position"><a href="<API key>.html#position">position</a></li> <li data-name="module:zrender/shape/Polygon#rotation"><a href="<API key>.html#rotation">rotation</a></li> <li data-name="module:zrender/shape/Polygon#scale"><a href="<API key>.html#scale">scale</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/Polygon~IPolygonStyle"><a href="<API key>.html#~IPolygonStyle">IPolygonStyle</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/shape/Polygon#buildPath"><a href="<API key>.html#buildPath">buildPath</a></li> <li data-name="module:zrender/shape/Polygon#getRect"><a href="<API key>.html#getRect">getRect</a></li> <li data-name="module:zrender/shape/Polygon#afterBrush"><a href="<API key>.html#afterBrush">afterBrush</a></li> <li data-name="module:zrender/shape/Polygon#beforeBrush"><a href="<API key>.html#beforeBrush">beforeBrush</a></li> <li data-name="module:zrender/shape/Polygon#bind"><a href="<API key>.html#bind">bind</a></li> <li data-name="module:zrender/shape/Polygon#brush"><a href="<API key>.html#brush">brush</a></li> <li data-name="module:zrender/shape/Polygon#decomposeTransform"><a href="<API key>.html#decomposeTransform">decomposeTransform</a></li> <li data-name="module:zrender/shape/Polygon#dispatch"><a href="<API key>.html#dispatch">dispatch</a></li> <li data-name="module:zrender/shape/Polygon#dispatchWithContext"><a href="<API key>.html#dispatchWithContext">dispatchWithContext</a></li> <li data-name="module:zrender/shape/Polygon#drawText"><a href="<API key>.html#drawText">drawText</a></li> <li data-name="module:zrender/shape/Polygon#drift"><a href="<API key>.html#drift">drift</a></li> <li data-name="module:zrender/shape/Polygon#getHighlightStyle"><a href="<API key>.html#getHighlightStyle">getHighlightStyle</a></li> <li data-name="module:zrender/shape/Polygon#isCover"><a href="<API key>.html#isCover">isCover</a></li> <li data-name="module:zrender/shape/Polygon#isSilent"><a href="<API key>.html#isSilent">isSilent</a></li> <li data-name="module:zrender/shape/Polygon#lookAt"><a href="<API key>.html#lookAt">lookAt</a></li> <li data-name="module:zrender/shape/Polygon#one"><a href="<API key>.html#one">one</a></li> <li data-name="module:zrender/shape/Polygon#setContext"><a href="<API key>.html#setContext">setContext</a></li> <li data-name="module:zrender/shape/Polygon#setTransform"><a href="<API key>.html#setTransform">setTransform</a></li> <li data-name="module:zrender/shape/Polygon#<API key>"><a href="<API key>.html#<API key>"><API key></a></li> <li data-name="module:zrender/shape/Polygon#unbind"><a href="<API key>.html#unbind">unbind</a></li> <li data-name="module:zrender/shape/Polygon#updateTransform"><a href="<API key>.html#updateTransform">updateTransform</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="module:zrender/shape/Polygon#event:onclick"><a href="<API key>.html#event:onclick">onclick</a></li> <li data-name="module:zrender/shape/Polygon#event:ondragend"><a href="<API key>.html#event:ondragend">ondragend</a></li> <li data-name="module:zrender/shape/Polygon#event:ondragenter"><a href="<API key>.html#event:ondragenter">ondragenter</a></li> <li data-name="module:zrender/shape/Polygon#event:ondragleave"><a href="<API key>.html#event:ondragleave">ondragleave</a></li> <li data-name="module:zrender/shape/Polygon#event:ondragover"><a href="<API key>.html#event:ondragover">ondragover</a></li> <li data-name="module:zrender/shape/Polygon#event:ondragstart"><a href="<API key>.html#event:ondragstart">ondragstart</a></li> <li data-name="module:zrender/shape/Polygon#event:ondrop"><a href="<API key>.html#event:ondrop">ondrop</a></li> <li data-name="module:zrender/shape/Polygon#event:onmousedown"><a href="<API key>.html#event:onmousedown">onmousedown</a></li> <li data-name="module:zrender/shape/Polygon#event:onmousemove"><a href="<API key>.html#event:onmousemove">onmousemove</a></li> <li data-name="module:zrender/shape/Polygon#event:onmouseout"><a href="<API key>.html#event:onmouseout">onmouseout</a></li> <li data-name="module:zrender/shape/Polygon#event:onmouseover"><a href="<API key>.html#event:onmouseover">onmouseover</a></li> <li data-name="module:zrender/shape/Polygon#event:onmouseup"><a href="<API key>.html#event:onmouseup">onmouseup</a></li> <li data-name="module:zrender/shape/Polygon#event:onmousewheel"><a href="<API key>.html#event:onmousewheel">onmousewheel</a></li> </ul> </li> <li class="item" data-name="module:zrender/shape/Polyline"> <span class="title"> <a href="<API key>.html">module:zrender/shape/Polyline</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/Polyline#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/Polyline#style"><a href="<API key>.html#style">style</a></li> <li data-name="module:zrender/shape/Polyline#id"><a href="<API key>.html#id">id</a></li> <li data-name="module:zrender/shape/Polyline#parent"><a href="<API key>.html#parent">parent</a></li> <li data-name="module:zrender/shape/Polyline#position"><a href="<API key>.html#position">position</a></li> <li data-name="module:zrender/shape/Polyline#rotation"><a href="<API key>.html#rotation">rotation</a></li> <li data-name="module:zrender/shape/Polyline#scale"><a href="<API key>.html#scale">scale</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/Polyline~IPolylineStyle"><a href="<API key>.html#~IPolylineStyle">IPolylineStyle</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/shape/Polyline#buildPath"><a href="<API key>.html#buildPath">buildPath</a></li> <li data-name="module:zrender/shape/Polyline#getRect"><a href="<API key>.html#getRect">getRect</a></li> <li data-name="module:zrender/shape/Polyline#afterBrush"><a href="<API key>.html#afterBrush">afterBrush</a></li> <li data-name="module:zrender/shape/Polyline#beforeBrush"><a href="<API key>.html#beforeBrush">beforeBrush</a></li> <li data-name="module:zrender/shape/Polyline#bind"><a href="<API key>.html#bind">bind</a></li> <li data-name="module:zrender/shape/Polyline#brush"><a href="<API key>.html#brush">brush</a></li> <li data-name="module:zrender/shape/Polyline#decomposeTransform"><a href="<API key>.html#decomposeTransform">decomposeTransform</a></li> <li data-name="module:zrender/shape/Polyline#dispatch"><a href="<API key>.html#dispatch">dispatch</a></li> <li data-name="module:zrender/shape/Polyline#dispatchWithContext"><a href="<API key>.html#dispatchWithContext">dispatchWithContext</a></li> <li data-name="module:zrender/shape/Polyline#drawText"><a href="<API key>.html#drawText">drawText</a></li> <li data-name="module:zrender/shape/Polyline#drift"><a href="<API key>.html#drift">drift</a></li> <li data-name="module:zrender/shape/Polyline#getHighlightStyle"><a href="<API key>.html#getHighlightStyle">getHighlightStyle</a></li> <li data-name="module:zrender/shape/Polyline#isCover"><a href="<API key>.html#isCover">isCover</a></li> <li data-name="module:zrender/shape/Polyline#isSilent"><a href="<API key>.html#isSilent">isSilent</a></li> <li data-name="module:zrender/shape/Polyline#lookAt"><a href="<API key>.html#lookAt">lookAt</a></li> <li data-name="module:zrender/shape/Polyline#one"><a href="<API key>.html#one">one</a></li> <li data-name="module:zrender/shape/Polyline#setContext"><a href="<API key>.html#setContext">setContext</a></li> <li data-name="module:zrender/shape/Polyline#setTransform"><a href="<API key>.html#setTransform">setTransform</a></li> <li data-name="module:zrender/shape/Polyline#<API key>"><a href="<API key>.html#<API key>"><API key></a></li> <li data-name="module:zrender/shape/Polyline#unbind"><a href="<API key>.html#unbind">unbind</a></li> <li data-name="module:zrender/shape/Polyline#updateTransform"><a href="<API key>.html#updateTransform">updateTransform</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="module:zrender/shape/Polyline#event:onclick"><a href="<API key>.html#event:onclick">onclick</a></li> <li data-name="module:zrender/shape/Polyline#event:ondragend"><a href="<API key>.html#event:ondragend">ondragend</a></li> <li data-name="module:zrender/shape/Polyline#event:ondragenter"><a href="<API key>.html#event:ondragenter">ondragenter</a></li> <li data-name="module:zrender/shape/Polyline#event:ondragleave"><a href="<API key>.html#event:ondragleave">ondragleave</a></li> <li data-name="module:zrender/shape/Polyline#event:ondragover"><a href="<API key>.html#event:ondragover">ondragover</a></li> <li data-name="module:zrender/shape/Polyline#event:ondragstart"><a href="<API key>.html#event:ondragstart">ondragstart</a></li> <li data-name="module:zrender/shape/Polyline#event:ondrop"><a href="<API key>.html#event:ondrop">ondrop</a></li> <li data-name="module:zrender/shape/Polyline#event:onmousedown"><a href="<API key>.html#event:onmousedown">onmousedown</a></li> <li data-name="module:zrender/shape/Polyline#event:onmousemove"><a href="<API key>.html#event:onmousemove">onmousemove</a></li> <li data-name="module:zrender/shape/Polyline#event:onmouseout"><a href="<API key>.html#event:onmouseout">onmouseout</a></li> <li data-name="module:zrender/shape/Polyline#event:onmouseover"><a href="<API key>.html#event:onmouseover">onmouseover</a></li> <li data-name="module:zrender/shape/Polyline#event:onmouseup"><a href="<API key>.html#event:onmouseup">onmouseup</a></li> <li data-name="module:zrender/shape/Polyline#event:onmousewheel"><a href="<API key>.html#event:onmousewheel">onmousewheel</a></li> </ul> </li> <li class="item" data-name="module:zrender/shape/Rectangle"> <span class="title"> <a href="<API key>.html">module:zrender/shape/Rectangle</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/Rectangle#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/Rectangle#style"><a href="<API key>.html#style">style</a></li> <li data-name="module:zrender/shape/Rectangle#id"><a href="<API key>.html#id">id</a></li> <li data-name="module:zrender/shape/Rectangle#parent"><a href="<API key>.html#parent">parent</a></li> <li data-name="module:zrender/shape/Rectangle#position"><a href="<API key>.html#position">position</a></li> <li data-name="module:zrender/shape/Rectangle#rotation"><a href="<API key>.html#rotation">rotation</a></li> <li data-name="module:zrender/shape/Rectangle#scale"><a href="<API key>.html#scale">scale</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/Rectangle~IRectangleStyle"><a href="<API key>.html#~IRectangleStyle">IRectangleStyle</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/shape/Rectangle#buildPath"><a href="<API key>.html#buildPath">buildPath</a></li> <li data-name="module:zrender/shape/Rectangle#getRect"><a href="<API key>.html#getRect">getRect</a></li> <li data-name="module:zrender/shape/Rectangle#afterBrush"><a href="<API key>.html#afterBrush">afterBrush</a></li> <li data-name="module:zrender/shape/Rectangle#beforeBrush"><a href="<API key>.html#beforeBrush">beforeBrush</a></li> <li data-name="module:zrender/shape/Rectangle#bind"><a href="<API key>.html#bind">bind</a></li> <li data-name="module:zrender/shape/Rectangle#brush"><a href="<API key>.html#brush">brush</a></li> <li data-name="module:zrender/shape/Rectangle#decomposeTransform"><a href="<API key>.html#decomposeTransform">decomposeTransform</a></li> <li data-name="module:zrender/shape/Rectangle#dispatch"><a href="<API key>.html#dispatch">dispatch</a></li> <li data-name="module:zrender/shape/Rectangle#dispatchWithContext"><a href="<API key>.html#dispatchWithContext">dispatchWithContext</a></li> <li data-name="module:zrender/shape/Rectangle#drawText"><a href="<API key>.html#drawText">drawText</a></li> <li data-name="module:zrender/shape/Rectangle#drift"><a href="<API key>.html#drift">drift</a></li> <li data-name="module:zrender/shape/Rectangle#getHighlightStyle"><a href="<API key>.html#getHighlightStyle">getHighlightStyle</a></li> <li data-name="module:zrender/shape/Rectangle#isCover"><a href="<API key>.html#isCover">isCover</a></li> <li data-name="module:zrender/shape/Rectangle#isSilent"><a href="<API key>.html#isSilent">isSilent</a></li> <li data-name="module:zrender/shape/Rectangle#lookAt"><a href="<API key>.html#lookAt">lookAt</a></li> <li data-name="module:zrender/shape/Rectangle#one"><a href="<API key>.html#one">one</a></li> <li data-name="module:zrender/shape/Rectangle#setContext"><a href="<API key>.html#setContext">setContext</a></li> <li data-name="module:zrender/shape/Rectangle#setTransform"><a href="<API key>.html#setTransform">setTransform</a></li> <li data-name="module:zrender/shape/Rectangle#<API key>"><a href="<API key>.html#<API key>"><API key></a></li> <li data-name="module:zrender/shape/Rectangle#unbind"><a href="<API key>.html#unbind">unbind</a></li> <li data-name="module:zrender/shape/Rectangle#updateTransform"><a href="<API key>.html#updateTransform">updateTransform</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="module:zrender/shape/Rectangle#event:onclick"><a href="<API key>.html#event:onclick">onclick</a></li> <li data-name="module:zrender/shape/Rectangle#event:ondragend"><a href="<API key>.html#event:ondragend">ondragend</a></li> <li data-name="module:zrender/shape/Rectangle#event:ondragenter"><a href="<API key>.html#event:ondragenter">ondragenter</a></li> <li data-name="module:zrender/shape/Rectangle#event:ondragleave"><a href="<API key>.html#event:ondragleave">ondragleave</a></li> <li data-name="module:zrender/shape/Rectangle#event:ondragover"><a href="<API key>.html#event:ondragover">ondragover</a></li> <li data-name="module:zrender/shape/Rectangle#event:ondragstart"><a href="<API key>.html#event:ondragstart">ondragstart</a></li> <li data-name="module:zrender/shape/Rectangle#event:ondrop"><a href="<API key>.html#event:ondrop">ondrop</a></li> <li data-name="module:zrender/shape/Rectangle#event:onmousedown"><a href="<API key>.html#event:onmousedown">onmousedown</a></li> <li data-name="module:zrender/shape/Rectangle#event:onmousemove"><a href="<API key>.html#event:onmousemove">onmousemove</a></li> <li data-name="module:zrender/shape/Rectangle#event:onmouseout"><a href="<API key>.html#event:onmouseout">onmouseout</a></li> <li data-name="module:zrender/shape/Rectangle#event:onmouseover"><a href="<API key>.html#event:onmouseover">onmouseover</a></li> <li data-name="module:zrender/shape/Rectangle#event:onmouseup"><a href="<API key>.html#event:onmouseup">onmouseup</a></li> <li data-name="module:zrender/shape/Rectangle#event:onmousewheel"><a href="<API key>.html#event:onmousewheel">onmousewheel</a></li> </ul> </li> <li class="item" data-name="module:zrender/shape/Ring"> <span class="title"> <a href="<API key>.html">module:zrender/shape/Ring</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/Ring#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/Ring#style"><a href="<API key>.html#style">style</a></li> <li data-name="module:zrender/shape/Ring#id"><a href="<API key>.html#id">id</a></li> <li data-name="module:zrender/shape/Ring#parent"><a href="<API key>.html#parent">parent</a></li> <li data-name="module:zrender/shape/Ring#position"><a href="<API key>.html#position">position</a></li> <li data-name="module:zrender/shape/Ring#rotation"><a href="<API key>.html#rotation">rotation</a></li> <li data-name="module:zrender/shape/Ring#scale"><a href="<API key>.html#scale">scale</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/Ring~IRingStyle"><a href="<API key>.html#~IRingStyle">IRingStyle</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/shape/Ring#buildPath"><a href="<API key>.html#buildPath">buildPath</a></li> <li data-name="module:zrender/shape/Ring#getRect"><a href="<API key>.html#getRect">getRect</a></li> <li data-name="module:zrender/shape/Ring#afterBrush"><a href="<API key>.html#afterBrush">afterBrush</a></li> <li data-name="module:zrender/shape/Ring#beforeBrush"><a href="<API key>.html#beforeBrush">beforeBrush</a></li> <li data-name="module:zrender/shape/Ring#bind"><a href="<API key>.html#bind">bind</a></li> <li data-name="module:zrender/shape/Ring#brush"><a href="<API key>.html#brush">brush</a></li> <li data-name="module:zrender/shape/Ring#decomposeTransform"><a href="<API key>.html#decomposeTransform">decomposeTransform</a></li> <li data-name="module:zrender/shape/Ring#dispatch"><a href="<API key>.html#dispatch">dispatch</a></li> <li data-name="module:zrender/shape/Ring#dispatchWithContext"><a href="<API key>.html#dispatchWithContext">dispatchWithContext</a></li> <li data-name="module:zrender/shape/Ring#drawText"><a href="<API key>.html#drawText">drawText</a></li> <li data-name="module:zrender/shape/Ring#drift"><a href="<API key>.html#drift">drift</a></li> <li data-name="module:zrender/shape/Ring#getHighlightStyle"><a href="<API key>.html#getHighlightStyle">getHighlightStyle</a></li> <li data-name="module:zrender/shape/Ring#isCover"><a href="<API key>.html#isCover">isCover</a></li> <li data-name="module:zrender/shape/Ring#isSilent"><a href="<API key>.html#isSilent">isSilent</a></li> <li data-name="module:zrender/shape/Ring#lookAt"><a href="<API key>.html#lookAt">lookAt</a></li> <li data-name="module:zrender/shape/Ring#one"><a href="<API key>.html#one">one</a></li> <li data-name="module:zrender/shape/Ring#setContext"><a href="<API key>.html#setContext">setContext</a></li> <li data-name="module:zrender/shape/Ring#setTransform"><a href="<API key>.html#setTransform">setTransform</a></li> <li data-name="module:zrender/shape/Ring#<API key>"><a href="<API key>.html#<API key>"><API key></a></li> <li data-name="module:zrender/shape/Ring#unbind"><a href="<API key>.html#unbind">unbind</a></li> <li data-name="module:zrender/shape/Ring#updateTransform"><a href="<API key>.html#updateTransform">updateTransform</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="module:zrender/shape/Ring#event:onclick"><a href="<API key>.html#event:onclick">onclick</a></li> <li data-name="module:zrender/shape/Ring#event:ondragend"><a href="<API key>.html#event:ondragend">ondragend</a></li> <li data-name="module:zrender/shape/Ring#event:ondragenter"><a href="<API key>.html#event:ondragenter">ondragenter</a></li> <li data-name="module:zrender/shape/Ring#event:ondragleave"><a href="<API key>.html#event:ondragleave">ondragleave</a></li> <li data-name="module:zrender/shape/Ring#event:ondragover"><a href="<API key>.html#event:ondragover">ondragover</a></li> <li data-name="module:zrender/shape/Ring#event:ondragstart"><a href="<API key>.html#event:ondragstart">ondragstart</a></li> <li data-name="module:zrender/shape/Ring#event:ondrop"><a href="<API key>.html#event:ondrop">ondrop</a></li> <li data-name="module:zrender/shape/Ring#event:onmousedown"><a href="<API key>.html#event:onmousedown">onmousedown</a></li> <li data-name="module:zrender/shape/Ring#event:onmousemove"><a href="<API key>.html#event:onmousemove">onmousemove</a></li> <li data-name="module:zrender/shape/Ring#event:onmouseout"><a href="<API key>.html#event:onmouseout">onmouseout</a></li> <li data-name="module:zrender/shape/Ring#event:onmouseover"><a href="<API key>.html#event:onmouseover">onmouseover</a></li> <li data-name="module:zrender/shape/Ring#event:onmouseup"><a href="<API key>.html#event:onmouseup">onmouseup</a></li> <li data-name="module:zrender/shape/Ring#event:onmousewheel"><a href="<API key>.html#event:onmousewheel">onmousewheel</a></li> </ul> </li> <li class="item" data-name="module:zrender/shape/Rose"> <span class="title"> <a href="<API key>.html">module:zrender/shape/Rose</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/Rose#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/Rose#style"><a href="<API key>.html#style">style</a></li> <li data-name="module:zrender/shape/Rose#id"><a href="<API key>.html#id">id</a></li> <li data-name="module:zrender/shape/Rose#parent"><a href="<API key>.html#parent">parent</a></li> <li data-name="module:zrender/shape/Rose#position"><a href="<API key>.html#position">position</a></li> <li data-name="module:zrender/shape/Rose#rotation"><a href="<API key>.html#rotation">rotation</a></li> <li data-name="module:zrender/shape/Rose#scale"><a href="<API key>.html#scale">scale</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/Rose~IRoseStyle"><a href="<API key>.html#~IRoseStyle">IRoseStyle</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/shape/Rose#buildPath"><a href="<API key>.html#buildPath">buildPath</a></li> <li data-name="module:zrender/shape/Rose#getRect"><a href="<API key>.html#getRect">getRect</a></li> <li data-name="module:zrender/shape/Rose#afterBrush"><a href="<API key>.html#afterBrush">afterBrush</a></li> <li data-name="module:zrender/shape/Rose#beforeBrush"><a href="<API key>.html#beforeBrush">beforeBrush</a></li> <li data-name="module:zrender/shape/Rose#bind"><a href="<API key>.html#bind">bind</a></li> <li data-name="module:zrender/shape/Rose#brush"><a href="<API key>.html#brush">brush</a></li> <li data-name="module:zrender/shape/Rose#decomposeTransform"><a href="<API key>.html#decomposeTransform">decomposeTransform</a></li> <li data-name="module:zrender/shape/Rose#dispatch"><a href="<API key>.html#dispatch">dispatch</a></li> <li data-name="module:zrender/shape/Rose#dispatchWithContext"><a href="<API key>.html#dispatchWithContext">dispatchWithContext</a></li> <li data-name="module:zrender/shape/Rose#drawText"><a href="<API key>.html#drawText">drawText</a></li> <li data-name="module:zrender/shape/Rose#drift"><a href="<API key>.html#drift">drift</a></li> <li data-name="module:zrender/shape/Rose#getHighlightStyle"><a href="<API key>.html#getHighlightStyle">getHighlightStyle</a></li> <li data-name="module:zrender/shape/Rose#isCover"><a href="<API key>.html#isCover">isCover</a></li> <li data-name="module:zrender/shape/Rose#isSilent"><a href="<API key>.html#isSilent">isSilent</a></li> <li data-name="module:zrender/shape/Rose#lookAt"><a href="<API key>.html#lookAt">lookAt</a></li> <li data-name="module:zrender/shape/Rose#one"><a href="<API key>.html#one">one</a></li> <li data-name="module:zrender/shape/Rose#setContext"><a href="<API key>.html#setContext">setContext</a></li> <li data-name="module:zrender/shape/Rose#setTransform"><a href="<API key>.html#setTransform">setTransform</a></li> <li data-name="module:zrender/shape/Rose#<API key>"><a href="<API key>.html#<API key>"><API key></a></li> <li data-name="module:zrender/shape/Rose#unbind"><a href="<API key>.html#unbind">unbind</a></li> <li data-name="module:zrender/shape/Rose#updateTransform"><a href="<API key>.html#updateTransform">updateTransform</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="module:zrender/shape/Rose#event:onclick"><a href="<API key>.html#event:onclick">onclick</a></li> <li data-name="module:zrender/shape/Rose#event:ondragend"><a href="<API key>.html#event:ondragend">ondragend</a></li> <li data-name="module:zrender/shape/Rose#event:ondragenter"><a href="<API key>.html#event:ondragenter">ondragenter</a></li> <li data-name="module:zrender/shape/Rose#event:ondragleave"><a href="<API key>.html#event:ondragleave">ondragleave</a></li> <li data-name="module:zrender/shape/Rose#event:ondragover"><a href="<API key>.html#event:ondragover">ondragover</a></li> <li data-name="module:zrender/shape/Rose#event:ondragstart"><a href="<API key>.html#event:ondragstart">ondragstart</a></li> <li data-name="module:zrender/shape/Rose#event:ondrop"><a href="<API key>.html#event:ondrop">ondrop</a></li> <li data-name="module:zrender/shape/Rose#event:onmousedown"><a href="<API key>.html#event:onmousedown">onmousedown</a></li> <li data-name="module:zrender/shape/Rose#event:onmousemove"><a href="<API key>.html#event:onmousemove">onmousemove</a></li> <li data-name="module:zrender/shape/Rose#event:onmouseout"><a href="<API key>.html#event:onmouseout">onmouseout</a></li> <li data-name="module:zrender/shape/Rose#event:onmouseover"><a href="<API key>.html#event:onmouseover">onmouseover</a></li> <li data-name="module:zrender/shape/Rose#event:onmouseup"><a href="<API key>.html#event:onmouseup">onmouseup</a></li> <li data-name="module:zrender/shape/Rose#event:onmousewheel"><a href="<API key>.html#event:onmousewheel">onmousewheel</a></li> </ul> </li> <li class="item" data-name="module:zrender/shape/Sector"> <span class="title"> <a href="<API key>.html">module:zrender/shape/Sector</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/Sector#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/Sector#style"><a href="<API key>.html#style">style</a></li> <li data-name="module:zrender/shape/Sector#id"><a href="<API key>.html#id">id</a></li> <li data-name="module:zrender/shape/Sector#parent"><a href="<API key>.html#parent">parent</a></li> <li data-name="module:zrender/shape/Sector#position"><a href="<API key>.html#position">position</a></li> <li data-name="module:zrender/shape/Sector#rotation"><a href="<API key>.html#rotation">rotation</a></li> <li data-name="module:zrender/shape/Sector#scale"><a href="<API key>.html#scale">scale</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/Sector~ISectorStyle"><a href="<API key>.html#~ISectorStyle">ISectorStyle</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/shape/Sector#buildPath"><a href="<API key>.html#buildPath">buildPath</a></li> <li data-name="module:zrender/shape/Sector#getRect"><a href="<API key>.html#getRect">getRect</a></li> <li data-name="module:zrender/shape/Sector#afterBrush"><a href="<API key>.html#afterBrush">afterBrush</a></li> <li data-name="module:zrender/shape/Sector#beforeBrush"><a href="<API key>.html#beforeBrush">beforeBrush</a></li> <li data-name="module:zrender/shape/Sector#bind"><a href="<API key>.html#bind">bind</a></li> <li data-name="module:zrender/shape/Sector#brush"><a href="<API key>.html#brush">brush</a></li> <li data-name="module:zrender/shape/Sector#decomposeTransform"><a href="<API key>.html#decomposeTransform">decomposeTransform</a></li> <li data-name="module:zrender/shape/Sector#dispatch"><a href="<API key>.html#dispatch">dispatch</a></li> <li data-name="module:zrender/shape/Sector#dispatchWithContext"><a href="<API key>.html#dispatchWithContext">dispatchWithContext</a></li> <li data-name="module:zrender/shape/Sector#drawText"><a href="<API key>.html#drawText">drawText</a></li> <li data-name="module:zrender/shape/Sector#drift"><a href="<API key>.html#drift">drift</a></li> <li data-name="module:zrender/shape/Sector#getHighlightStyle"><a href="<API key>.html#getHighlightStyle">getHighlightStyle</a></li> <li data-name="module:zrender/shape/Sector#isCover"><a href="<API key>.html#isCover">isCover</a></li> <li data-name="module:zrender/shape/Sector#isSilent"><a href="<API key>.html#isSilent">isSilent</a></li> <li data-name="module:zrender/shape/Sector#lookAt"><a href="<API key>.html#lookAt">lookAt</a></li> <li data-name="module:zrender/shape/Sector#one"><a href="<API key>.html#one">one</a></li> <li data-name="module:zrender/shape/Sector#setContext"><a href="<API key>.html#setContext">setContext</a></li> <li data-name="module:zrender/shape/Sector#setTransform"><a href="<API key>.html#setTransform">setTransform</a></li> <li data-name="module:zrender/shape/Sector#<API key>"><a href="<API key>.html#<API key>"><API key></a></li> <li data-name="module:zrender/shape/Sector#unbind"><a href="<API key>.html#unbind">unbind</a></li> <li data-name="module:zrender/shape/Sector#updateTransform"><a href="<API key>.html#updateTransform">updateTransform</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="module:zrender/shape/Sector#event:onclick"><a href="<API key>.html#event:onclick">onclick</a></li> <li data-name="module:zrender/shape/Sector#event:ondragend"><a href="<API key>.html#event:ondragend">ondragend</a></li> <li data-name="module:zrender/shape/Sector#event:ondragenter"><a href="<API key>.html#event:ondragenter">ondragenter</a></li> <li data-name="module:zrender/shape/Sector#event:ondragleave"><a href="<API key>.html#event:ondragleave">ondragleave</a></li> <li data-name="module:zrender/shape/Sector#event:ondragover"><a href="<API key>.html#event:ondragover">ondragover</a></li> <li data-name="module:zrender/shape/Sector#event:ondragstart"><a href="<API key>.html#event:ondragstart">ondragstart</a></li> <li data-name="module:zrender/shape/Sector#event:ondrop"><a href="<API key>.html#event:ondrop">ondrop</a></li> <li data-name="module:zrender/shape/Sector#event:onmousedown"><a href="<API key>.html#event:onmousedown">onmousedown</a></li> <li data-name="module:zrender/shape/Sector#event:onmousemove"><a href="<API key>.html#event:onmousemove">onmousemove</a></li> <li data-name="module:zrender/shape/Sector#event:onmouseout"><a href="<API key>.html#event:onmouseout">onmouseout</a></li> <li data-name="module:zrender/shape/Sector#event:onmouseover"><a href="<API key>.html#event:onmouseover">onmouseover</a></li> <li data-name="module:zrender/shape/Sector#event:onmouseup"><a href="<API key>.html#event:onmouseup">onmouseup</a></li> <li data-name="module:zrender/shape/Sector#event:onmousewheel"><a href="<API key>.html#event:onmousewheel">onmousewheel</a></li> </ul> </li> <li class="item" data-name="module:zrender/shape/ShapeBundle"> <span class="title"> <a href="<API key>.html">module:zrender/shape/ShapeBundle</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/ShapeBundle#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/ShapeBundle#style"><a href="<API key>.html#style">style</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/ShapeBundle~IShapeBundleStyle"><a href="<API key>.html#~IShapeBundleStyle">IShapeBundleStyle</a></li> </ul> <ul class="methods itemMembers"> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/shape/Star"> <span class="title"> <a href="<API key>.html">module:zrender/shape/Star</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/Star#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/Star#style"><a href="<API key>.html#style">style</a></li> <li data-name="module:zrender/shape/Star#id"><a href="<API key>.html#id">id</a></li> <li data-name="module:zrender/shape/Star#parent"><a href="<API key>.html#parent">parent</a></li> <li data-name="module:zrender/shape/Star#position"><a href="<API key>.html#position">position</a></li> <li data-name="module:zrender/shape/Star#rotation"><a href="<API key>.html#rotation">rotation</a></li> <li data-name="module:zrender/shape/Star#scale"><a href="<API key>.html#scale">scale</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/Star~IStarStyle"><a href="<API key>.html#~IStarStyle">IStarStyle</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/shape/Star#buildPath"><a href="<API key>.html#buildPath">buildPath</a></li> <li data-name="module:zrender/shape/Star#getRect"><a href="<API key>.html#getRect">getRect</a></li> <li data-name="module:zrender/shape/Star#afterBrush"><a href="<API key>.html#afterBrush">afterBrush</a></li> <li data-name="module:zrender/shape/Star#beforeBrush"><a href="<API key>.html#beforeBrush">beforeBrush</a></li> <li data-name="module:zrender/shape/Star#bind"><a href="<API key>.html#bind">bind</a></li> <li data-name="module:zrender/shape/Star#brush"><a href="<API key>.html#brush">brush</a></li> <li data-name="module:zrender/shape/Star#decomposeTransform"><a href="<API key>.html#decomposeTransform">decomposeTransform</a></li> <li data-name="module:zrender/shape/Star#dispatch"><a href="<API key>.html#dispatch">dispatch</a></li> <li data-name="module:zrender/shape/Star#dispatchWithContext"><a href="<API key>.html#dispatchWithContext">dispatchWithContext</a></li> <li data-name="module:zrender/shape/Star#drawText"><a href="<API key>.html#drawText">drawText</a></li> <li data-name="module:zrender/shape/Star#drift"><a href="<API key>.html#drift">drift</a></li> <li data-name="module:zrender/shape/Star#getHighlightStyle"><a href="<API key>.html#getHighlightStyle">getHighlightStyle</a></li> <li data-name="module:zrender/shape/Star#isCover"><a href="<API key>.html#isCover">isCover</a></li> <li data-name="module:zrender/shape/Star#isSilent"><a href="<API key>.html#isSilent">isSilent</a></li> <li data-name="module:zrender/shape/Star#lookAt"><a href="<API key>.html#lookAt">lookAt</a></li> <li data-name="module:zrender/shape/Star#one"><a href="<API key>.html#one">one</a></li> <li data-name="module:zrender/shape/Star#setContext"><a href="<API key>.html#setContext">setContext</a></li> <li data-name="module:zrender/shape/Star#setTransform"><a href="<API key>.html#setTransform">setTransform</a></li> <li data-name="module:zrender/shape/Star#<API key>"><a href="<API key>.html#<API key>"><API key></a></li> <li data-name="module:zrender/shape/Star#unbind"><a href="<API key>.html#unbind">unbind</a></li> <li data-name="module:zrender/shape/Star#updateTransform"><a href="<API key>.html#updateTransform">updateTransform</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="module:zrender/shape/Star#event:onclick"><a href="<API key>.html#event:onclick">onclick</a></li> <li data-name="module:zrender/shape/Star#event:ondragend"><a href="<API key>.html#event:ondragend">ondragend</a></li> <li data-name="module:zrender/shape/Star#event:ondragenter"><a href="<API key>.html#event:ondragenter">ondragenter</a></li> <li data-name="module:zrender/shape/Star#event:ondragleave"><a href="<API key>.html#event:ondragleave">ondragleave</a></li> <li data-name="module:zrender/shape/Star#event:ondragover"><a href="<API key>.html#event:ondragover">ondragover</a></li> <li data-name="module:zrender/shape/Star#event:ondragstart"><a href="<API key>.html#event:ondragstart">ondragstart</a></li> <li data-name="module:zrender/shape/Star#event:ondrop"><a href="<API key>.html#event:ondrop">ondrop</a></li> <li data-name="module:zrender/shape/Star#event:onmousedown"><a href="<API key>.html#event:onmousedown">onmousedown</a></li> <li data-name="module:zrender/shape/Star#event:onmousemove"><a href="<API key>.html#event:onmousemove">onmousemove</a></li> <li data-name="module:zrender/shape/Star#event:onmouseout"><a href="<API key>.html#event:onmouseout">onmouseout</a></li> <li data-name="module:zrender/shape/Star#event:onmouseover"><a href="<API key>.html#event:onmouseover">onmouseover</a></li> <li data-name="module:zrender/shape/Star#event:onmouseup"><a href="<API key>.html#event:onmouseup">onmouseup</a></li> <li data-name="module:zrender/shape/Star#event:onmousewheel"><a href="<API key>.html#event:onmousewheel">onmousewheel</a></li> </ul> </li> <li class="item" data-name="module:zrender/shape/Text"> <span class="title"> <a href="<API key>.html">module:zrender/shape/Text</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/Text#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/Text#style"><a href="<API key>.html#style">style</a></li> <li data-name="module:zrender/shape/Text#id"><a href="<API key>.html#id">id</a></li> <li data-name="module:zrender/shape/Text#parent"><a href="<API key>.html#parent">parent</a></li> <li data-name="module:zrender/shape/Text#position"><a href="<API key>.html#position">position</a></li> <li data-name="module:zrender/shape/Text#rotation"><a href="<API key>.html#rotation">rotation</a></li> <li data-name="module:zrender/shape/Text#scale"><a href="<API key>.html#scale">scale</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/Text~ITextStyle"><a href="<API key>.html#~ITextStyle">ITextStyle</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/shape/Text#getRect"><a href="<API key>.html#getRect">getRect</a></li> <li data-name="module:zrender/shape/Text#afterBrush"><a href="<API key>.html#afterBrush">afterBrush</a></li> <li data-name="module:zrender/shape/Text#beforeBrush"><a href="<API key>.html#beforeBrush">beforeBrush</a></li> <li data-name="module:zrender/shape/Text#bind"><a href="<API key>.html#bind">bind</a></li> <li data-name="module:zrender/shape/Text#brush"><a href="<API key>.html#brush">brush</a></li> <li data-name="module:zrender/shape/Text#buildPath"><a href="<API key>.html#buildPath">buildPath</a></li> <li data-name="module:zrender/shape/Text#decomposeTransform"><a href="<API key>.html#decomposeTransform">decomposeTransform</a></li> <li data-name="module:zrender/shape/Text#dispatch"><a href="<API key>.html#dispatch">dispatch</a></li> <li data-name="module:zrender/shape/Text#dispatchWithContext"><a href="<API key>.html#dispatchWithContext">dispatchWithContext</a></li> <li data-name="module:zrender/shape/Text#drawText"><a href="<API key>.html#drawText">drawText</a></li> <li data-name="module:zrender/shape/Text#drift"><a href="<API key>.html#drift">drift</a></li> <li data-name="module:zrender/shape/Text#getHighlightStyle"><a href="<API key>.html#getHighlightStyle">getHighlightStyle</a></li> <li data-name="module:zrender/shape/Text#isCover"><a href="<API key>.html#isCover">isCover</a></li> <li data-name="module:zrender/shape/Text#isSilent"><a href="<API key>.html#isSilent">isSilent</a></li> <li data-name="module:zrender/shape/Text#lookAt"><a href="<API key>.html#lookAt">lookAt</a></li> <li data-name="module:zrender/shape/Text#one"><a href="<API key>.html#one">one</a></li> <li data-name="module:zrender/shape/Text#setContext"><a href="<API key>.html#setContext">setContext</a></li> <li data-name="module:zrender/shape/Text#setTransform"><a href="<API key>.html#setTransform">setTransform</a></li> <li data-name="module:zrender/shape/Text#<API key>"><a href="<API key>.html#<API key>"><API key></a></li> <li data-name="module:zrender/shape/Text#unbind"><a href="<API key>.html#unbind">unbind</a></li> <li data-name="module:zrender/shape/Text#updateTransform"><a href="<API key>.html#updateTransform">updateTransform</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="module:zrender/shape/Text#event:onclick"><a href="<API key>.html#event:onclick">onclick</a></li> <li data-name="module:zrender/shape/Text#event:ondragend"><a href="<API key>.html#event:ondragend">ondragend</a></li> <li data-name="module:zrender/shape/Text#event:ondragenter"><a href="<API key>.html#event:ondragenter">ondragenter</a></li> <li data-name="module:zrender/shape/Text#event:ondragleave"><a href="<API key>.html#event:ondragleave">ondragleave</a></li> <li data-name="module:zrender/shape/Text#event:ondragover"><a href="<API key>.html#event:ondragover">ondragover</a></li> <li data-name="module:zrender/shape/Text#event:ondragstart"><a href="<API key>.html#event:ondragstart">ondragstart</a></li> <li data-name="module:zrender/shape/Text#event:ondrop"><a href="<API key>.html#event:ondrop">ondrop</a></li> <li data-name="module:zrender/shape/Text#event:onmousedown"><a href="<API key>.html#event:onmousedown">onmousedown</a></li> <li data-name="module:zrender/shape/Text#event:onmousemove"><a href="<API key>.html#event:onmousemove">onmousemove</a></li> <li data-name="module:zrender/shape/Text#event:onmouseout"><a href="<API key>.html#event:onmouseout">onmouseout</a></li> <li data-name="module:zrender/shape/Text#event:onmouseover"><a href="<API key>.html#event:onmouseover">onmouseover</a></li> <li data-name="module:zrender/shape/Text#event:onmouseup"><a href="<API key>.html#event:onmouseup">onmouseup</a></li> <li data-name="module:zrender/shape/Text#event:onmousewheel"><a href="<API key>.html#event:onmousewheel">onmousewheel</a></li> </ul> </li> <li class="item" data-name="module:zrender/shape/tool/PathProxy"> <span class="title"> <a href="<API key>.html">module:zrender/shape/tool/PathProxy</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/tool/PathProxy#pathCommands"><a href="<API key>.html#pathCommands">pathCommands</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/shape/tool/PathProxy#arc"><a href="<API key>.html#arc">arc</a></li> <li data-name="module:zrender/shape/tool/PathProxy#begin"><a href="<API key>.html#begin">begin</a></li> <li data-name="module:zrender/shape/tool/PathProxy#bezierCurveTo"><a href="<API key>.html#bezierCurveTo">bezierCurveTo</a></li> <li data-name="module:zrender/shape/tool/PathProxy#closePath"><a href="<API key>.html#closePath">closePath</a></li> <li data-name="module:zrender/shape/tool/PathProxy#fastBoundingRect"><a href="<API key>.html#fastBoundingRect">fastBoundingRect</a></li> <li data-name="module:zrender/shape/tool/PathProxy#isEmpty"><a href="<API key>.html#isEmpty">isEmpty</a></li> <li data-name="module:zrender/shape/tool/PathProxy#lineTo"><a href="<API key>.html#lineTo">lineTo</a></li> <li data-name="module:zrender/shape/tool/PathProxy#moveTo"><a href="<API key>.html#moveTo">moveTo</a></li> <li data-name="module:zrender/shape/tool/PathProxy#quadraticCurveTo"><a href="<API key>.html#quadraticCurveTo">quadraticCurveTo</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/shape/Trochold"> <span class="title"> <a href="<API key>.html">module:zrender/shape/Trochold</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/shape/Trochold#highlightStyle"><a href="<API key>.html#highlightStyle">highlightStyle</a></li> <li data-name="module:zrender/shape/Trochold#style"><a href="<API key>.html#style">style</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/shape/Trochold~ITrocholdStyle"><a href="<API key>.html#~ITrocholdStyle">ITrocholdStyle</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/shape/Trochold#buildPath"><a href="<API key>.html#buildPath">buildPath</a></li> <li data-name="module:zrender/shape/Trochold#getRect"><a href="<API key>.html#getRect">getRect</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/shape/util/smoothBezier"> <span class="title"> <a href="<API key>.html">module:zrender/shape/util/smoothBezier</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/shape/util/smoothSpline"> <span class="title"> <a href="<API key>.html">module:zrender/shape/util/smoothSpline</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/Storage"> <span class="title"> <a href="<API key>.html">module:zrender/Storage</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/Storage#addHover"><a href="<API key>.html#addHover">addHover</a></li> <li data-name="module:zrender/Storage#addRoot"><a href="<API key>.html#addRoot">addRoot</a></li> <li data-name="module:zrender/Storage#delHover"><a href="<API key>.html#delHover">delHover</a></li> <li data-name="module:zrender/Storage#delRoot"><a href="<API key>.html#delRoot">delRoot</a></li> <li data-name="module:zrender/Storage#dispose"><a href="<API key>.html#dispose">dispose</a></li> <li data-name="module:zrender/Storage#drift"><a href="<API key>.html#drift">drift</a></li> <li data-name="module:zrender/Storage#getHoverShapes"><a href="<API key>.html#getHoverShapes">getHoverShapes</a></li> <li data-name="module:zrender/Storage#getShapeList"><a href="<API key>.html#getShapeList">getShapeList</a></li> <li data-name="module:zrender/Storage#hasHoverShape"><a href="<API key>.html#hasHoverShape">hasHoverShape</a></li> <li data-name="module:zrender/Storage#iterShape"><a href="<API key>.html#iterShape">iterShape</a></li> <li data-name="module:zrender/Storage#mod"><a href="<API key>.html#mod">mod</a></li> <li data-name="module:zrender/Storage#updateShapeList"><a href="<API key>.html#updateShapeList">updateShapeList</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/tool/color"> <span class="title"> <a href="<API key>.html">module:zrender/tool/color</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/tool/color.alpha"><a href="<API key>.html#.alpha">alpha</a></li> <li data-name="module:zrender/tool/color.getColor"><a href="<API key>.html#.getColor">getColor</a></li> <li data-name="module:zrender/tool/color.getGradientColors"><a href="<API key>.html#.getGradientColors">getGradientColors</a></li> <li data-name="module:zrender/tool/color.getRadialGradient"><a href="<API key>.html#.getRadialGradient">getRadialGradient</a></li> <li data-name="module:zrender/tool/color.lift"><a href="<API key>.html#.lift">lift</a></li> <li data-name="module:zrender/tool/color.mix"><a href="<API key>.html#.mix">mix</a></li> <li data-name="module:zrender/tool/color.normalize"><a href="<API key>.html#.normalize">normalize</a></li> <li data-name="module:zrender/tool/color.reverse"><a href="<API key>.html#.reverse">reverse</a></li> <li data-name="module:zrender/tool/color.toArray"><a href="<API key>.html#.toArray">toArray</a></li> <li data-name="module:zrender/tool/color.toHSB"><a href="<API key>.html#.toHSB">toHSB</a></li> <li data-name="module:zrender/tool/color.toHSBA"><a href="<API key>.html#.toHSBA">toHSBA</a></li> <li data-name="module:zrender/tool/color.toHSL"><a href="<API key>.html#.toHSL">toHSL</a></li> <li data-name="module:zrender/tool/color.toHSLA"><a href="<API key>.html#.toHSLA">toHSLA</a></li> <li data-name="module:zrender/tool/color.toHSV"><a href="<API key>.html#.toHSV">toHSV</a></li> <li data-name="module:zrender/tool/color.toHSVA"><a href="<API key>.html#.toHSVA">toHSVA</a></li> <li data-name="module:zrender/tool/color.toHex"><a href="<API key>.html#.toHex">toHex</a></li> <li data-name="module:zrender/tool/color.toRGB"><a href="<API key>.html#.toRGB">toRGB</a></li> <li data-name="module:zrender/tool/color.toRGBA"><a href="<API key>.html#.toRGBA">toRGBA</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/tool/computeBoundingBox"> <span class="title"> <a href="<API key>.html">module:zrender/tool/computeBoundingBox</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/tool/computeBoundingBox.<API key>"><a href="<API key>.html#.<API key>"><API key></a></li> <li data-name="module:zrender/tool/computeBoundingBox.<API key>"><a href="<API key>.html#.<API key>"><API key></a></li> <li data-name="module:zrender/tool/computeBoundingBox.<API key>"><a href="<API key>.html#.<API key>"><API key></a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/tool/curve"> <span class="title"> <a href="<API key>.html">module:zrender/tool/curve</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/tool/curve.cubicAt"><a href="<API key>.html#.cubicAt">cubicAt</a></li> <li data-name="module:zrender/tool/curve.cubicDerivativeAt"><a href="<API key>.html#.cubicDerivativeAt">cubicDerivativeAt</a></li> <li data-name="module:zrender/tool/curve.cubicExtrema"><a href="<API key>.html#.cubicExtrema">cubicExtrema</a></li> <li data-name="module:zrender/tool/curve.cubicRootAt"><a href="<API key>.html#.cubicRootAt">cubicRootAt</a></li> <li data-name="module:zrender/tool/curve.cubicSubdivide"><a href="<API key>.html#.cubicSubdivide">cubicSubdivide</a></li> <li data-name="module:zrender/tool/curve.quadraticExtremum"><a href="<API key>.html#.quadraticExtremum">quadraticExtremum</a></li> <li data-name="module:zrender/tool/curve.quadraticSubdivide"><a href="<API key>.html#.quadraticSubdivide">quadraticSubdivide</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/tool/event"> <span class="title"> <a href="<API key>.html">module:zrender/tool/event</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/tool/event.getDelta"><a href="<API key>.html#.getDelta">getDelta</a></li> <li data-name="module:zrender/tool/event.getX"><a href="<API key>.html#.getX">getX</a></li> <li data-name="module:zrender/tool/event.getY"><a href="<API key>.html#.getY">getY</a></li> <li data-name="module:zrender/tool/event.stop"><a href="<API key>.html#.stop">stop</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/tool/http"> <span class="title"> <a href="<API key>.html">module:zrender/tool/http</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="module:zrender/tool/http~IHTTPGetOption"><a href="<API key>.html#~IHTTPGetOption">IHTTPGetOption</a></li> </ul> <ul class="methods itemMembers"> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/tool/matrix"> <span class="title"> <a href="<API key>.html">module:zrender/tool/matrix</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/tool/matrix.copy"><a href="<API key>.html#.copy">copy</a></li> <li data-name="module:zrender/tool/matrix.create"><a href="<API key>.html#.create">create</a></li> <li data-name="module:zrender/tool/matrix.identity"><a href="<API key>.html#.identity">identity</a></li> <li data-name="module:zrender/tool/matrix.invert"><a href="<API key>.html#.invert">invert</a></li> <li data-name="module:zrender/tool/matrix.mul"><a href="<API key>.html#.mul">mul</a></li> <li data-name="module:zrender/tool/matrix.rotate"><a href="<API key>.html#.rotate">rotate</a></li> <li data-name="module:zrender/tool/matrix.scale"><a href="<API key>.html#.scale">scale</a></li> <li data-name="module:zrender/tool/matrix.translate"><a href="<API key>.html#.translate">translate</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/tool/util"> <span class="title"> <a href="<API key>.html">module:zrender/tool/util</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/tool/util.clone"><a href="<API key>.html#.clone">clone</a></li> <li data-name="module:zrender/tool/util.each"><a href="<API key>.html#.each">each</a></li> <li data-name="module:zrender/tool/util.filter"><a href="<API key>.html#.filter">filter</a></li> <li data-name="module:zrender/tool/util.indexOf"><a href="<API key>.html#.indexOf">indexOf</a></li> <li data-name="module:zrender/tool/util.inherits"><a href="<API key>.html#.inherits">inherits</a></li> <li data-name="module:zrender/tool/util.map"><a href="<API key>.html#.map">map</a></li> <li data-name="module:zrender/tool/util.merge"><a href="<API key>.html#.merge">merge</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/tool/vector"> <span class="title"> <a href="<API key>.html">module:zrender/tool/vector</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/tool/vector.add"><a href="<API key>.html#.add">add</a></li> <li data-name="module:zrender/tool/vector.applyTransform"><a href="<API key>.html#.applyTransform">applyTransform</a></li> <li data-name="module:zrender/tool/vector.clone"><a href="<API key>.html#.clone">clone</a></li> <li data-name="module:zrender/tool/vector.copy"><a href="<API key>.html#.copy">copy</a></li> <li data-name="module:zrender/tool/vector.create"><a href="<API key>.html#.create">create</a></li> <li data-name="module:zrender/tool/vector.distance"><a href="<API key>.html#.distance">distance</a></li> <li data-name="module:zrender/tool/vector.distanceSquare"><a href="<API key>.html#.distanceSquare">distanceSquare</a></li> <li data-name="module:zrender/tool/vector.div"><a href="<API key>.html#.div">div</a></li> <li data-name="module:zrender/tool/vector.dot"><a href="<API key>.html#.dot">dot</a></li> <li data-name="module:zrender/tool/vector.len"><a href="<API key>.html#.len">len</a></li> <li data-name="module:zrender/tool/vector.lenSquare"><a href="<API key>.html#.lenSquare">lenSquare</a></li> <li data-name="module:zrender/tool/vector.lerp"><a href="<API key>.html#.lerp">lerp</a></li> <li data-name="module:zrender/tool/vector.max"><a href="<API key>.html#.max">max</a></li> <li data-name="module:zrender/tool/vector.min"><a href="<API key>.html#.min">min</a></li> <li data-name="module:zrender/tool/vector.mul"><a href="<API key>.html#.mul">mul</a></li> <li data-name="module:zrender/tool/vector.negate"><a href="<API key>.html#.negate">negate</a></li> <li data-name="module:zrender/tool/vector.normalize"><a href="<API key>.html#.normalize">normalize</a></li> <li data-name="module:zrender/tool/vector.scale"><a href="<API key>.html#.scale">scale</a></li> <li data-name="module:zrender/tool/vector.scaleAndAdd"><a href="<API key>.html#.scaleAndAdd">scaleAndAdd</a></li> <li data-name="module:zrender/tool/vector.set"><a href="<API key>.html#.set">set</a></li> <li data-name="module:zrender/tool/vector.sub"><a href="<API key>.html#.sub">sub</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="module:zrender/ZRender"> <span class="title"> <a href="<API key>.html">module:zrender/ZRender</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="module:zrender/ZRender#animation"><a href="<API key>.html#animation">animation</a></li> <li data-name="module:zrender/ZRender#id"><a href="<API key>.html#id">id</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="module:zrender/ZRender#addElement"><a href="<API key>.html#addElement">addElement</a></li> <li data-name="module:zrender/ZRender#addGroup"><a href="<API key>.html#addGroup">addGroup</a></li> <li data-name="module:zrender/ZRender#addHoverShape"><a href="<API key>.html#addHoverShape">addHoverShape</a></li> <li data-name="module:zrender/ZRender#addShape"><a href="<API key>.html#addShape">addShape</a></li> <li data-name="module:zrender/ZRender#animate"><a href="<API key>.html#animate">animate</a></li> <li data-name="module:zrender/ZRender#clear"><a href="<API key>.html#clear">clear</a></li> <li data-name="module:zrender/ZRender#clearAnimation"><a href="<API key>.html#clearAnimation">clearAnimation</a></li> <li data-name="module:zrender/ZRender#delElement"><a href="<API key>.html#delElement">delElement</a></li> <li data-name="module:zrender/ZRender#delGroup"><a href="<API key>.html#delGroup">delGroup</a></li> <li data-name="module:zrender/ZRender#delShape"><a href="<API key>.html#delShape">delShape</a></li> <li data-name="module:zrender/ZRender#dispose"><a href="<API key>.html#dispose">dispose</a></li> <li data-name="module:zrender/ZRender#getHeight"><a href="<API key>.html#getHeight">getHeight</a></li> <li data-name="module:zrender/ZRender#getId"><a href="<API key>.html#getId">getId</a></li> <li data-name="module:zrender/ZRender#getWidth"><a href="<API key>.html#getWidth">getWidth</a></li> <li data-name="module:zrender/ZRender#hideLoading"><a href="<API key>.html#hideLoading">hideLoading</a></li> <li data-name="module:zrender/ZRender#modElement"><a href="<API key>.html#modElement">modElement</a></li> <li data-name="module:zrender/ZRender#modGroup"><a href="<API key>.html#modGroup">modGroup</a></li> <li data-name="module:zrender/ZRender#modLayer"><a href="<API key>.html#modLayer">modLayer</a></li> <li data-name="module:zrender/ZRender#modShape"><a href="<API key>.html#modShape">modShape</a></li> <li data-name="module:zrender/ZRender#on"><a href="<API key>.html#on">on</a></li> <li data-name="module:zrender/ZRender#refresh"><a href="<API key>.html#refresh">refresh</a></li> <li data-name="module:zrender/ZRender#refreshHover"><a href="<API key>.html#refreshHover">refreshHover</a></li> <li data-name="module:zrender/ZRender#refreshNextFrame"><a href="<API key>.html#refreshNextFrame">refreshNextFrame</a></li> <li data-name="module:zrender/ZRender#refreshShapes"><a href="<API key>.html#refreshShapes">refreshShapes</a></li> <li data-name="module:zrender/ZRender#render"><a href="<API key>.html#render">render</a></li> <li data-name="module:zrender/ZRender#resize"><a href="<API key>.html#resize">resize</a></li> <li data-name="module:zrender/ZRender#shapeToImage"><a href="<API key>.html#shapeToImage">shapeToImage</a></li> <li data-name="module:zrender/ZRender#showLoading"><a href="<API key>.html#showLoading">showLoading</a></li> <li data-name="module:zrender/ZRender#stopAnimation"><a href="<API key>.html#stopAnimation">stopAnimation</a></li> <li data-name="module:zrender/ZRender#toDataURL"><a href="<API key>.html#toDataURL">toDataURL</a></li> <li data-name="module:zrender/ZRender#trigger"><a href="<API key>.html#trigger">trigger</a></li> <li data-name="module:zrender/ZRender#un"><a href="<API key>.html#un">un</a></li> </ul> <ul class="events itemMembers"> </ul> </li> </ul> </div> <div class="main"> <h1 class="page-title" data-filename="<API key>.html">Module: zrender/tool/http</h1> <section> <header> <h2> zrender/tool/http </h2> </header> <article> <div class="container-overview"> <dl class="details"> </dl> </div> <h3 class="subsection-title">Type Definitions</h3> <dl> <dt> <div class="nameContainer"> <h4 class="name" id="~IHTTPGetOption"> IHTTPGetOption<span class="type-signature type object">Object</span> </h4> </div> </dt> <dd> <dl class="details"> <h5 class="subsection-title">Properties:</h5> <dl> <table class="props"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>url</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>onsuccess</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="attributes"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>onerror</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"></td> </tr> </tbody> </table></dl> </dl> </dd> </dl> </article> </section> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Thu May 28 2015 14:42:44 GMT+0800 (CST) </footer> </div> </div> <script>prettyPrint();</script> <script src="scripts/linenumber.js"></script> <script src="scripts/main.js"></script> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Canvas Test</title> <script type="text/javascript" src="../doc/asset/js/esl/esl.js"></script> <style> html, body, #main { margin: 0; } </style> </head> <body> <div id="main"></div> <script type="text/javascript"> require.config({ packages: [ { name: 'zrender', location: '../src', main: 'zrender' } ] }); require( [ "zrender", "zrender/graphic/shape/Rectangle" ], function(zrender, RectangleShape) { for (var i = 0; i < 200; i++) { var dom = document.createElement('div'); dom.style.width = '700px'; dom.style.height = '400px'; document.getElementById('main').appendChild(dom); var zr = zrender.init(dom, { // renderer: 'svg' }); for (var j = 0; j < 50; j++) { zr.addElement(new RectangleShape({ shape: { x: j * 14, width: 10, height: Math.round(Math.random() * 300) }, style: { // fill: '#02f', fill: '#f20' } })); } } } ) </script> </body> </html>
@import Foundation; @protocol KZPComponent <NSObject> @required + (void)reset; @end
#!/usr/bin/env bash echo " Please run download-db.sh to download the PlasmidFinder database to ${PLASMID_DB}. If you have a database in custom path, please use "plasmidfinder.py" with the option "-p". " >> ${PREFIX}/.messages.txt printf '%s\n' "${URLS[@]}" >> "${PREFIX}/.messages.txt" 2>&1
<!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif] <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif] <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif] <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width"> <link rel="stylesheet" href="css/bootstrap.min.css"> <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script> <script src="../bower_components/angular/angular.js"></script> <script src="../dist/ng-table.js"></script> <link rel="stylesheet" href="../dist/ng-table.css"> <style> @media only screen and (max-width: 800px){ .demo-reponsiveTable table, .demo-reponsiveTable thead, .demo-reponsiveTable tbody, .demo-reponsiveTable th, .demo-reponsiveTable td, .demo-reponsiveTable tr { display: block; } /* Hide table sorting (but not display: none;, for accessibility) */ /* Note: we're hiding the sorting because it looks terrible! Making this pretty is an exercise for the reader*/ .demo-reponsiveTable thead tr:first-child { position: absolute; top: -9999px; left: -9999px; } .demo-reponsiveTable tr { border: 1px solid #ccc; } .demo-reponsiveTable table>tbody>tr>td, .demo-reponsiveTable table>thead>tr>th { /* Behave like a "row" */ border: none; border-bottom: 1px solid #eee; position: relative; padding-left: 50%; white-space: normal; text-align: left; } .demo-reponsiveTable table>tbody>tr>td:before, .demo-reponsiveTable table>thead>tr>th:before { /* Now like a table header */ position: absolute; /* Top/left values mimic padding */ top: 6px; left: 6px; width: 45%; padding-right: 10px; white-space: nowrap; text-align: left; font-weight: bold; /* Label the data */ content: attr(data-title-text); } } </style> </head> <body ng-app="main"> <h1>Responsive table</h1> <p><strong>Resize the the width of browser window to see table switch to <em>'card view'</em></strong></p> <div ng-controller="DemoCtrl" class="demo-reponsiveTable clearfix"> <button class="btn btn-default" ng-click="removeFilters()">Remove filters</button> <button class="btn btn-default" ng-click="addFilters()">Add filters</button> <table ng-table="tableParams" class="table table-bordered table-striped"> <tr ng-repeat="user in $data"> <td title="'Full Name'" title-alt="'Name'" sortable="'name'" filter="filters.name"> {{user.name}} </td> <td title="'Age'" sortable="'age'" filter="filters.age"> {{user.age}} </td> </tr> </table> <script> var app = angular.module('main', ['ngTable']). controller('DemoCtrl', function ($scope, $filter, NgTableParams) { var data = [ {name: "Moroni", age: 50}, {name: "Tiancum", age: 43}, {name: "Jacob", age: 27}, {name: "Nephi", age: 29}, {name: "Enos", age: 34}, {name: "Tiancum", age: 43}, {name: "Jacob", age: 27}, {name: "Nephi", age: 29}, {name: "Enos", age: 34}, {name: "Tiancum", age: 43}, {name: "Jacob", age: 27}, {name: "Nephi", age: 29}, {name: "Enos", age: 34}, {name: "Tiancum", age: 43}, {name: "Jacob", age: 27}, {name: "Nephi", age: 29}, {name: "Enos", age: 34} ]; $scope.data = data; $scope.removeFilters = function(){ $scope.filters = { name: false, age: false }; }; $scope.addFilters = function(){ $scope.filters = { name: { 'name': 'text' }, age: { 'age': 'number' } }; }; $scope.addFilters(); $scope.tableParams = new NgTableParams({ page: 1, // show first page count: 10, // count per page filter: { //name: 'M' // initial filter }, sorting: { //name: 'asc' // initial sorting } }, { filterOptions: { filterDelay: 0 }, total: data.length, // length of data getData: function ($defer, params) { // use built-in angular filter var filteredData = params.filter() ? $filter('filter')(data, params.filter()) : data; var orderedData = params.sorting() ? $filter('orderBy')(filteredData, params.orderBy()) : data; params.total(orderedData.length); // set total for recalc pagination $defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count())); } }); }) </script> </div> </body> </html>
package Multibound1; interface A {} interface B {} class C<T extends A&B> {} class D implements A {} class E extends C<D> {}
#include <linux/ipc.h> #include <linux/msg.h> #include <linux/ipc_namespace.h> #include <linux/rcupdate.h> #include <linux/nsproxy.h> #include <linux/slab.h> #include <linux/fs.h> #include <linux/mount.h> #include <linux/user_namespace.h> #include <linux/proc_fs.h> #include "util.h" static struct ipc_namespace *create_ipc_ns(void) { struct ipc_namespace *ns; int err; ns = kmalloc(sizeof(struct ipc_namespace), GFP_KERNEL); if (ns == NULL) return ERR_PTR(-ENOMEM); err = proc_alloc_inum(&ns->proc_inum); if (err) { kfree(ns); return ERR_PTR(err); } atomic_set(&ns->count, 1); err = mq_init_ns(ns); if (err) { proc_free_inum(ns->proc_inum); kfree(ns); return ERR_PTR(err); } atomic_inc(&nr_ipc_ns); sem_init_ns(ns); msg_init_ns(ns); shm_init_ns(ns); /* * msgmni has already been computed for the new ipc ns. * Thus, do the ipcns creation notification before registering that * new ipcns in the chain. */ ipcns_notify(IPCNS_CREATED); <API key>(ns); return ns; } struct ipc_namespace *copy_ipcs(unsigned long flags, struct ipc_namespace *ns) { if (!(flags & CLONE_NEWIPC)) return get_ipc_ns(ns); return create_ipc_ns(); } /* * free_ipcs - free all ipcs of one type * @ns: the namespace to remove the ipcs from * @ids: the table of ipcs to free * @free: the function called to free each individual ipc * * Called for each kind of ipc when an ipc_namespace exits. */ void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids, void (*free)(struct ipc_namespace *, struct kern_ipc_perm *)) { struct kern_ipc_perm *perm; int next_id; int total, in_use; down_write(&ids->rw_mutex); in_use = ids->in_use; for (total = 0, next_id = 0; total < in_use; next_id++) { perm = idr_find(&ids->ipcs_idr, next_id); if (perm == NULL) continue; ipc_lock_by_ptr(perm); free(ns, perm); total++; } up_write(&ids->rw_mutex); } static void free_ipc_ns(struct ipc_namespace *ns) { /* * Unregistering the hotplug notifier at the beginning guarantees * that the ipc namespace won't be freed while we are inside the * callback routine. Since the <API key> routines * hold a rw lock on the notifier list, <API key>() * won't take the rw lock before <API key>() has * released the rd lock. */ <API key>(ns); sem_exit_ns(ns); msg_exit_ns(ns); shm_exit_ns(ns); proc_free_inum(ns->proc_inum); kfree(ns); atomic_dec(&nr_ipc_ns); /* * Do the ipcns removal notification after decrementing nr_ipc_ns in * order to have a correct value when recomputing msgmni. */ ipcns_notify(IPCNS_REMOVED); } /* * put_ipc_ns - drop a reference to an ipc namespace. * @ns: the namespace to put * * If this is the last task in the namespace exiting, and * it is dropping the refcount to 0, then it can race with * a task in another ipc namespace but in a mounts namespace * which has this ipcns's mqueuefs mounted, doing some action * with one of the mqueuefs files. That can raise the refcount. * So dropping the refcount, and raising the refcount when * accessing it through the VFS, are protected with mq_lock. * * (Clearly, a task raising the refcount on its own ipc_ns * needn't take mq_lock since it can't race with the last task * in the ipcns exiting). */ void put_ipc_ns(struct ipc_namespace *ns) { if (atomic_dec_and_lock(&ns->count, &mq_lock)) { mq_clear_sbinfo(ns); spin_unlock(&mq_lock); mq_put_mnt(ns); free_ipc_ns(ns); } } static void *ipcns_get(struct task_struct *task) { struct ipc_namespace *ns = NULL; struct nsproxy *nsproxy; rcu_read_lock(); nsproxy = task_nsproxy(task); if (nsproxy) ns = get_ipc_ns(nsproxy->ipc_ns); rcu_read_unlock(); return ns; } static void ipcns_put(void *ns) { return put_ipc_ns(ns); } static int ipcns_install(struct nsproxy *nsproxy, void *ns) { /* Ditch state from the old ipc namespace */ exit_sem(current); put_ipc_ns(nsproxy->ipc_ns); nsproxy->ipc_ns = get_ipc_ns(ns); return 0; } static unsigned int ipcns_inum(void *vp) { struct ipc_namespace *ns = vp; return ns->proc_inum; } const struct proc_ns_operations ipcns_operations = { .name = "ipc", .type = CLONE_NEWIPC, .get = ipcns_get, .put = ipcns_put, .install = ipcns_install, .inum = ipcns_inum, };
#ifndef __MUIC_H__ #define __MUIC_H__ /* Status of IF PMIC chip (suspend and resume) */ enum { MUIC_SUSPEND = 0, MUIC_RESUME, }; /* MUIC Interrupt */ enum { MUIC_INTR_DETACH = 0, MUIC_INTR_ATTACH }; /* MUIC Dock Observer Callback parameter */ enum { MUIC_DOCK_DETACHED = 0, MUIC_DOCK_DESKDOCK = 1, MUIC_DOCK_CARDOCK = 2, MUIC_DOCK_AUDIODOCK = 7, MUIC_DOCK_SMARTDOCK = 8, MUIC_DOCK_HMT = 11, }; /* MUIC Path */ enum { MUIC_PATH_USB_AP = 0, MUIC_PATH_USB_CP, MUIC_PATH_UART_AP, MUIC_PATH_UART_CP, MUIC_PATH_OPEN, MUIC_PATH_AUDIO, }; #ifdef <API key> enum { HV_9V = 0, HV_5V, }; #endif /* bootparam SWITCH_SEL */ enum { SWITCH_SEL_USB_MASK = 0x1, <API key> = 0x2, <API key> = 0x8, <API key> = 0x100, }; /* MUIC ADC table */ typedef enum { ADC_GND = 0x00, ADC_SEND_END = 0x01, /* 0x00001 2K ohm */ ADC_REMOTE_S11 = 0x0c, /* 0x01100 20.5K ohm */ ADC_REMOTE_S12 = 0x0d, /* 0x01101 24.07K ohm */ ADC_RESERVED_VZW = 0x0e, /* 0x01110 28.7K ohm */ <API key> = 0x0f, /* 0x01111 34K ohm */ ADC_SMARTDOCK = 0x10, /* 0x10000 40.2K ohm */ ADC_HMT = 0x11, /* 0x10001 49.9K ohm */ ADC_AUDIODOCK = 0x12, /* 0x10010 64.9K ohm */ ADC_USB_LANHUB = 0x13, /* 0x10011 80.07K ohm */ ADC_CHARGING_CABLE = 0x14, /* 0x10100 102K ohm */ <API key> = 0x15, /* 0x10101 121K ohm */ ADC_UART_CABLE = 0x16, /* 0x10110 150K ohm */ <API key> = 0x17, /* 0x10111 200K ohm */ ADC_JIG_USB_OFF = 0x18, /* 0x11000 255K ohm */ ADC_JIG_USB_ON = 0x19, /* 0x11001 301K ohm */ ADC_DESKDOCK = 0x1a, /* 0x11010 365K ohm */ <API key> = 0x1b, /* 0x11011 442K ohm */ ADC_JIG_UART_OFF = 0x1c, /* 0x11100 523K ohm */ ADC_JIG_UART_ON = 0x1d, /* 0x11101 619K ohm */ <API key> = 0x1e, /* 0x11110 1000K ohm */ ADC_OPEN = 0x1f, ADC_OPEN_219 = 0xfb, /* ADC open or 219.3K ohm */ ADC_219 = 0xfc, /* ADC open or 219.3K ohm */ ADC_UNDEFINED = 0xfd, /* Undefied range */ ADC_DONTCARE = 0xfe, /* ADC don't care for MHL */ ADC_ERROR = 0xff, /* ADC value read error */ } muic_adc_t; /* MUIC attached device type */ typedef enum { <API key> = 0, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, /* VBUS enabled */ <API key>, /* for otg test */ <API key>, /* for fuelgauge test */ <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, ATTACHED_DEV_NUM, } muic_attached_dev_t; #ifdef <API key> /* MUIC attached device type */ typedef enum { SILENT_CHG_DONE = 0, SILENT_CHG_CHANGING = 1, SILENT_CHG_NUM, } <API key>; #endif /* muic common callback driver internal data structure * that setted at muic-core.c file */ struct muic_platform_data { int irq_gpio; int switch_sel; /* muic current USB/UART path */ int usb_path; int uart_path; int gpio_uart_sel; bool rustproof_on; bool afc_disable; bool wireless; #ifdef <API key> int hv_sel; int <API key>; #endif /* muic switch dev register function for DockObserver */ void (*init_switch_dev_cb) (void); void (*<API key>) (void); /* muic GPIO control function */ int (*init_gpio_cb) (int switch_sel); int (*set_gpio_usb_sel) (int usb_path); int (*set_gpio_uart_sel) (int uart_path); int (*set_safeout) (int safeout_path); /* muic path switch function for rustproof */ void (*<API key>) (struct device *dev); void (*<API key>) (struct device *dev); }; int get_switch_sel(void); #endif /* __MUIC_H__ */
#megaMenu ul.megaMenu{ background-color:#222; border:1px solid #222; } #megaMenu ul.megaMenu > li > a{ font-size:12px; color:#d9d9d9; text-shadow:none; font-weight:bold; text-transform:uppercase; text-shadow:0px 1px 1px #000; } #megaMenu ul.megaMenu > li:hover > a, #megaMenu ul.megaMenu > li > a:hover, #megaMenu ul.megaMenu > li.megaHover > a{ background-color:#111; color:#fff; text-shadow:0px 1px 1px #000; } #megaMenu ul.megaMenu > li:hover > a, #megaMenu ul.megaMenu > li.megaHover > a{ border-color:transparent; } #megaMenu ul.megaMenu > li.ss-nav-menu-mega > ul.sub-menu-1, #megaMenu ul.megaMenu li.ss-nav-menu-reg ul.sub-menu{ border-color:#000; color:#777; text-shadow:0px 1px 1px #fff; } #megaMenu ul.megaMenu > li.ss-nav-menu-mega:hover > a, #megaMenu ul.megaMenu > li.ss-nav-menu-reg.mega-with-sub:hover > a, #megaMenu ul.megaMenu > li.ss-nav-menu-mega.megaHover > a, #megaMenu ul.megaMenu > li.ss-nav-menu-reg.mega-with-sub.megaHover > a{ border-bottom-color:#000; } #megaMenu.megaMenuHorizontal ul ul.sub-menu-1{ top:100% !important; } #megaMenu li.ss-nav-menu-mega ul.sub-menu.sub-menu-1, #megaMenu li.ss-nav-menu-reg ul.sub-menu{ background-color:#e9e9e9; } #megaMenu ul li.ss-nav-menu-mega ul ul.sub-menu li a, #megaMenu ul ul.sub-menu li a{ color:#444; font-size:12px; text-shadow:0px 1px 1px #fff; } #megaMenu ul li.ss-nav-menu-mega ul.sub-menu-1 > li > a, #megaMenu ul li.ss-nav-menu-mega ul.sub-menu-1 > li:hover > a, #megaMenu ul li.ss-nav-menu-mega ul ul.sub-menu .ss-nav-menu-header > a, .wpmega-widgetarea h2.widgettitle{ color:#222; font-size:12px; font-weight:bold; text-shadow:0px 1px 1px #fff; text-transform:uppercase; } #megaMenu ul li.ss-nav-menu-mega ul ul.sub-menu li a:hover, #megaMenu ul ul.sub-menu > li:hover > a{ /*background-color:#222; color:#fff; text-shadow:0px 1px 1px #000;*/ color:#000; } #megaMenu ul li.ss-nav-menu-mega ul.sub-menu li.<API key> > a, #megaMenu ul li.ss-nav-menu-reg ul.sub-menu li.<API key> > a{ color:#8f0000; } .<API key> .wpmega-link-title, .<API key> .<API key>{ /*padding-left:20px;*/ } .<API key>{ min-height:20px; } #megaMenu ul.megaMenu > li.ss-nav-menu-reg ul.sub-menu > li > ul.sub-menu{ top:-1px; border-left-color:#e9e9e9; } .<API key>{ font-size:9px; } #megaMenu ul li.ss-nav-menu-mega ul.sub-menu li ul.wpmega-postlist img { background:#fff; border:1px solid #ddd; float:left; padding:4px; } /* IE7 Hacks */ #megaMenu.megaMenuHorizontal ul.megaMenu{ *border-bottom:none; } #megaMenu.megaMenuVertical ul.megaMenu{ *border-right:none; } /* Top Level Searchbar */ #megaMenu > ul.megaMenu > li > .wpmega-widgetarea > ul > li > form#searchform input[type="text"]{ background:#d9d9d9; color:#444; text-shadow:0px 1px 1px #fff; } #megaMenu > ul.megaMenu > li > .wpmega-widgetarea > ul > li > form#searchform input[type="submit"]{ background-color:#aaa; border-color:#000; }
/* link this software with independent modules, and to copy and distribute the resulting */ /* executable under terms of your choice, provided that you also meet, for each linked */ /* An independent module is a module which is not derived from this software. The special */ /* exception does not apply to any modifications of the software. */ /* Notwithstanding the above, under no circumstances may you combine this software in any */ /* without Broadcom's express prior written consent. */ /* Date : Generated on 6/27/2013 16:58:22 */ /* RDB file : //JAVA/ */ #ifndef <API key> #define <API key> #define <API key> 0x00000000 #define <API key> UInt32 #define <API key> 0xFFFFCEEE #define <API key> 12 #define <API key> 0x00003000 #define <API key> 8 #define <API key> 0x00000100 #define <API key> 4 #define <API key> 0x00000010 #define <API key> 0 #define <API key> 0x00000001 #define <API key> 0x00000004 #define <API key> UInt32 #define <API key> 0xFFFFFC00 #define <API key> 0 #define <API key> 0x000003FF #define <API key> 0x00000008 #define <API key> UInt32 #define <API key> 0xFFFFFC00 #define <API key> 0 #define <API key> 0x000003FF #define <API key> 0x00000010 #define <API key> UInt32 #define <API key> 0xFF80FCCE #define <API key> 16 #define <API key> 0x007F0000 #define <API key> 9 #define <API key> 0x00000200 #define <API key> 8 #define <API key> 0x00000100 #define <API key> 5 #define <API key> 0x00000020 #define <API key> 4 #define <API key> 0x00000010 #define <API key> 0 #define <API key> 0x00000001 #define <API key> 0x00000014 #define <API key> UInt32 #define <API key> 0xFFFFFC00 #define <API key> 0 #define <API key> 0x000003FF #define <API key> 0x00000018 #define <API key> UInt32 #define <API key> 0xFFFFFC00 #define <API key> 0 #define <API key> 0x000003FF #define <API key> 0x0000001C #define <API key> UInt32 #define <API key> 0xFFFFFC00 #define <API key> 0 #define <API key> 0x000003FF #define <API key> 0x00000020 #define <API key> UInt32 #define <API key> 0xFFFFFC00 #define <API key> 0 #define <API key> 0x000003FF #define <API key> 0x00000024 #define <API key> UInt32 #define <API key> 0xFFFFFC00 #define <API key> 0 #define <API key> 0x000003FF #define <API key> 0x00000028 #define <API key> UInt32 #define <API key> 0xFFFFFC00 #define <API key> 0 #define <API key> 0x000003FF #define <API key> 0x0000002C #define <API key> UInt32 #define <API key> 0xFFFFFF8E #define <API key> 4 #define <API key> 0x00000070 #define <API key> 0 #define <API key> 0x00000001 #endif /* <API key> */
/* * CHRP pci routines. */ #include <linux/kernel.h> #include <linux/pci.h> #include <linux/delay.h> #include <linux/string.h> #include <linux/init.h> #include <asm/io.h> #include <asm/pgtable.h> #include <asm/irq.h> #include <asm/hydra.h> #include <asm/prom.h> #include <asm/machdep.h> #include <asm/sections.h> #include <asm/pci-bridge.h> #include <asm/grackle.h> #include <asm/rtas.h> #include "chrp.h" #include "gg2.h" /* LongTrail */ void __iomem *gg2_pci_config_base; /* * The VLSI Golden Gate II has only 512K of PCI configuration space, so we * limit the bus number to 3 bits */ int gg2_read_config(struct pci_bus *bus, unsigned int devfn, int off, int len, u32 *val) { volatile void __iomem *cfg_data; struct pci_controller *hose = pci_bus_to_host(bus); if (bus->number > 7) return <API key>; /* * Note: the caller has already checked that off is * suitably aligned and that len is 1, 2 or 4. */ cfg_data = hose->cfg_data + ((bus->number<<16) | (devfn<<8) | off); switch (len) { case 1: *val = in_8(cfg_data); break; case 2: *val = in_le16(cfg_data); break; default: *val = in_le32(cfg_data); break; } return PCIBIOS_SUCCESSFUL; } int gg2_write_config(struct pci_bus *bus, unsigned int devfn, int off, int len, u32 val) { volatile void __iomem *cfg_data; struct pci_controller *hose = pci_bus_to_host(bus); if (bus->number > 7) return <API key>; /* * Note: the caller has already checked that off is * suitably aligned and that len is 1, 2 or 4. */ cfg_data = hose->cfg_data + ((bus->number<<16) | (devfn<<8) | off); switch (len) { case 1: out_8(cfg_data, val); break; case 2: out_le16(cfg_data, val); break; default: out_le32(cfg_data, val); break; } return PCIBIOS_SUCCESSFUL; } static struct pci_ops gg2_pci_ops = { .read = gg2_read_config, .write = gg2_write_config, }; /* * Access functions for PCI config space using RTAS calls. */ int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset, int len, u32 *val) { struct pci_controller *hose = pci_bus_to_host(bus); unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8) | (((bus->number - hose->first_busno) & 0xff) << 16) | (hose->global_number << 24); int ret = -1; int rval; rval = rtas_call(rtas_token("read-pci-config"), 2, 2, &ret, addr, len); *val = ret; return rval? <API key>: PCIBIOS_SUCCESSFUL; } int rtas_write_config(struct pci_bus *bus, unsigned int devfn, int offset, int len, u32 val) { struct pci_controller *hose = pci_bus_to_host(bus); unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8) | (((bus->number - hose->first_busno) & 0xff) << 16) | (hose->global_number << 24); int rval; rval = rtas_call(rtas_token("write-pci-config"), 3, 1, NULL, addr, len, val); return rval? <API key>: PCIBIOS_SUCCESSFUL; } static struct pci_ops rtas_pci_ops = { .read = rtas_read_config, .write = rtas_write_config, }; volatile struct Hydra __iomem *Hydra = NULL; int __init hydra_init(void) { struct device_node *np; struct resource r; np = <API key>(NULL, "mac-io"); if (np == NULL || <API key>(np, 0, &r)) { of_node_put(np); return 0; } of_node_put(np); Hydra = ioremap(r.start, r.end-r.start); printk("Hydra Mac I/O at %llx\n", (unsigned long long)r.start); printk("Hydra Feature_Control was %x", in_le32(&Hydra->Feature_Control)); out_le32(&Hydra->Feature_Control, (<API key> | <API key> | <API key> | <API key> | HYDRA_FC_ARB_BYPASS | <API key> | <API key> | <API key>)); printk(", now %x\n", in_le32(&Hydra->Feature_Control)); return 1; } #define PRG_CL_RESET_VALID 0x00010000 static void __init setup_python(struct pci_controller *hose, struct device_node *dev) { u32 __iomem *reg; u32 val; struct resource r; if (<API key>(dev, 0, &r)) { printk(KERN_ERR "No address for Python PCI controller\n"); return; } /* Clear the magic go-slow bit */ reg = ioremap(r.start + 0xf6000, 0x40); BUG_ON(!reg); val = in_be32(&reg[12]); if (val & PRG_CL_RESET_VALID) { out_be32(&reg[12], val & ~PRG_CL_RESET_VALID); in_be32(&reg[12]); } iounmap(reg); setup_indirect_pci(hose, r.start + 0xf8000, r.start + 0xf8010, 0); } /* Marvell Discovery II based Pegasos 2 */ static void __init setup_peg2(struct pci_controller *hose, struct device_node *dev) { struct device_node *root = <API key>("/"); struct device_node *rtas; rtas = <API key> (root, "rtas"); if (rtas) { hose->ops = &rtas_pci_ops; of_node_put(rtas); } else { printk ("RTAS supporting Pegasos OF not found, please upgrade" " your firmware\n"); } pci_add_flags(<API key>); /* keep the reference to the root node */ } void __init chrp_find_bridges(void) { struct device_node *dev; const int *bus_range; int len, index = -1; struct pci_controller *hose; const unsigned int *dma; const char *model, *machine; int is_longtrail = 0, is_mot = 0, is_pegasos = 0; struct device_node *root = <API key>("/"); struct resource r; /* * The PCI host bridge nodes on some machines don't have * properties to adequately identify them, so we have to * look at what sort of machine this is as well. */ machine = of_get_property(root, "model", NULL); if (machine != NULL) { is_longtrail = strncmp(machine, "IBM,LongTrail", 13) == 0; is_mot = strncmp(machine, "MOT", 3) == 0; if (strncmp(machine, "Pegasos2", 8) == 0) is_pegasos = 2; else if (strncmp(machine, "Pegasos", 7) == 0) is_pegasos = 1; } for (dev = root->child; dev != NULL; dev = dev->sibling) { if (dev->type == NULL || strcmp(dev->type, "pci") != 0) continue; ++index; /* The GG2 bridge on the LongTrail doesn't have an address */ if (<API key>(dev, 0, &r) && !is_longtrail) { printk(KERN_WARNING "Can't use %s: no address\n", dev->full_name); continue; } bus_range = of_get_property(dev, "bus-range", &len); if (bus_range == NULL || len < 2 * sizeof(int)) { printk(KERN_WARNING "Can't get bus-range for %s\n", dev->full_name); continue; } if (bus_range[1] == bus_range[0]) printk(KERN_INFO "PCI bus %d", bus_range[0]); else printk(KERN_INFO "PCI buses %d..%d", bus_range[0], bus_range[1]); printk(" controlled by %s", dev->full_name); if (!is_longtrail) printk(" at %llx", (unsigned long long)r.start); printk("\n"); hose = <API key>(dev); if (!hose) { printk("Can't allocate PCI controller structure for %s\n", dev->full_name); continue; } hose->first_busno = hose->self_busno = bus_range[0]; hose->last_busno = bus_range[1]; model = of_get_property(dev, "model", NULL); if (model == NULL) model = "<none>"; if (strncmp(model, "IBM, Python", 11) == 0) { setup_python(hose, dev); } else if (is_mot || strncmp(model, "Motorola, Grackle", 17) == 0) { setup_grackle(hose); } else if (is_longtrail) { void __iomem *p = ioremap(GG2_PCI_CONFIG_BASE, 0x80000); hose->ops = &gg2_pci_ops; hose->cfg_data = p; gg2_pci_config_base = p; } else if (is_pegasos == 1) { setup_indirect_pci(hose, 0xfec00cf8, 0xfee00cfc, 0); } else if (is_pegasos == 2) { setup_peg2(hose, dev); } else if (!strncmp(model, "IBM,CPC710", 10)) { setup_indirect_pci(hose, r.start + 0x000f8000, r.start + 0x000f8010, 0); if (index == 0) { dma = of_get_property(dev, "system-dma-base", &len); if (dma && len >= sizeof(*dma)) { dma = (unsigned int *) (((unsigned long)dma) + len - sizeof(*dma)); pci_dram_offset = *dma; } } } else { printk("No methods for %s (model %s), using RTAS\n", dev->full_name, model); hose->ops = &rtas_pci_ops; } <API key>(hose, dev, index == 0); /* check the first bridge for a property that we can use to set pci_dram_offset */ dma = of_get_property(dev, "ibm,dma-ranges", &len); if (index == 0 && dma != NULL && len >= 6 * sizeof(*dma)) { pci_dram_offset = dma[2] - dma[3]; printk("pci_dram_offset = %lx\n", pci_dram_offset); } } of_node_put(root); } /* SL82C105 IDE Control/Status Register */ #define SL82C105_IDECSR 0x40 /* Fixup for Winbond ATA quirk, required for briq mostly because the * 8259 is configured for level sensitive IRQ 14 and so wants the * ATA controller to be set to fully native mode or bad things * will happen. */ static void __devinit <API key>(struct pci_dev *sl82c105) { u8 progif; /* If non-briq machines need that fixup too, please speak up */ if (!machine_is(chrp) || _chrp_type != _CHRP_briq) return; if ((sl82c105->class & 5) != 5) { printk("W83C553: Switching SL82C105 IDE to PCI native mode\n"); /* Enable SL82C105 PCI native IDE mode */ <API key>(sl82c105, PCI_CLASS_PROG, &progif); <API key>(sl82c105, PCI_CLASS_PROG, progif | 0x05); sl82c105->class |= 0x05; /* Disable SL82C105 second port */ <API key>(sl82c105, SL82C105_IDECSR, 0x0003); /* Clear IO BARs, they will be reassigned */ <API key>(sl82c105, PCI_BASE_ADDRESS_0, 0); <API key>(sl82c105, PCI_BASE_ADDRESS_1, 0); <API key>(sl82c105, PCI_BASE_ADDRESS_2, 0); <API key>(sl82c105, PCI_BASE_ADDRESS_3, 0); } } <API key>(<API key>, <API key>, <API key>); /* Pegasos2 firmware version 20040810 configures the built-in IDE controller * in legacy mode, but sets the PCI registers to PCI native mode. * The chip can only operate in legacy mode, so force the PCI class into legacy * mode as well. The same fixup must be done to the class-code property in * the IDE node /pci@80000000/ide@C,1 */ static void <API key>(struct pci_dev *viaide) { u8 progif; struct pci_dev *viaisa; if (!machine_is(chrp) || _chrp_type != _CHRP_Pegasos) return; if (viaide->irq != 14) return; viaisa = pci_get_device(PCI_VENDOR_ID_VIA, <API key>, NULL); if (!viaisa) return; dev_info(&viaide->dev, "Fixing VIA IDE, force legacy mode on\n"); <API key>(viaide, PCI_CLASS_PROG, &progif); <API key>(viaide, PCI_CLASS_PROG, progif & ~0x5); viaide->class &= ~0x5; pci_dev_put(viaisa); } <API key>(PCI_VENDOR_ID_VIA, <API key>, <API key>);
#ifndef <API key> #define <API key> #include <linux/device.h> #include <linux/firewire.h> #include <linux/firewire-constants.h> #include <linux/module.h> #include <linux/mod_devicetable.h> #include <linux/mutex.h> #include <linux/slab.h> #include <linux/compat.h> #include <linux/sched/signal.h> #include <sound/core.h> #include <sound/info.h> #include <sound/rawmidi.h> #include <sound/pcm.h> #include <sound/pcm_params.h> #include <sound/hwdep.h> #include <sound/firewire.h> #include "../lib.h" #include "../amdtp-stream.h" #include "../iso-resources.h" #define <API key> 9 #define <API key> 2 #define <API key> 2 #define <API key> 0x0000801c0000ull /* For block write request. */ #define <API key> 0x0000801c0000ull #define <API key> 0x0000801c0004ull enum snd_ff_stream_mode { <API key> = 0, <API key>, <API key>, <API key>, }; struct snd_ff_protocol; struct snd_ff_spec { const char *const name; const unsigned int <API key>[<API key>]; const unsigned int <API key>[<API key>]; unsigned int midi_in_ports; unsigned int midi_out_ports; const struct snd_ff_protocol *protocol; u64 midi_high_addr; }; struct snd_ff { struct snd_card *card; struct fw_unit *unit; struct mutex mutex; spinlock_t lock; bool registered; struct delayed_work dwork; const struct snd_ff_spec *spec; /* To handle MIDI tx. */ struct <API key> *tx_midi_substreams[<API key>]; struct fw_address_handler async_handler; /* TO handle MIDI rx. */ struct <API key> *rx_midi_substreams[<API key>]; u8 running_status[<API key>]; __le32 msg_buf[<API key>][<API key>]; struct work_struct rx_midi_work[<API key>]; struct fw_transaction transactions[<API key>]; ktime_t next_ktime[<API key>]; bool rx_midi_error[<API key>]; unsigned int rx_bytes[<API key>]; unsigned int substreams_counter; struct amdtp_stream tx_stream; struct amdtp_stream rx_stream; struct fw_iso_resources tx_resources; struct fw_iso_resources rx_resources; int dev_lock_count; bool dev_lock_changed; wait_queue_head_t hwdep_wait; }; enum snd_ff_clock_src { <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, /* TODO: perhaps TCO exists. */ }; struct snd_ff_protocol { void (*handle_midi_msg)(struct snd_ff *ff, __le32 *buf, size_t length); int (*begin_session)(struct snd_ff *ff, unsigned int rate); void (*finish_session)(struct snd_ff *ff); }; extern const struct snd_ff_protocol <API key>; extern const struct snd_ff_protocol <API key>; int <API key>(struct snd_ff *ff, unsigned int *rate, enum snd_ff_clock_src *src); int <API key>(struct snd_ff *ff); int <API key>(struct snd_ff *ff); void <API key>(struct snd_ff *ff); int <API key>(struct amdtp_stream *s, unsigned int rate, unsigned int pcm_channels); int <API key>(struct amdtp_stream *s, struct snd_pcm_runtime *runtime); int amdtp_ff_init(struct amdtp_stream *s, struct fw_unit *unit, enum <API key> dir); int <API key>(enum cip_sfc sfc, enum snd_ff_stream_mode *mode); int <API key>(struct snd_ff *ff); void <API key>(struct snd_ff *ff); int <API key>(struct snd_ff *ff, unsigned int rate); void <API key>(struct snd_ff *ff); void <API key>(struct snd_ff *ff); void <API key>(struct snd_ff *ff); int <API key>(struct snd_ff *ff); void <API key>(struct snd_ff *ff); void snd_ff_proc_init(struct snd_ff *ff); int <API key>(struct snd_ff *ff); int <API key>(struct snd_ff *ff); int <API key>(struct snd_ff *ff); #endif
/* * Implementation of the userspace SID hashtable. * * Author : Eamon Walsh, <ewalsh@epoch.ncsc.mil> */ #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include "selinux_internal.h" #include <selinux/avc.h> #include "avc_sidtab.h" #include "avc_internal.h" static inline unsigned sidtab_hash(const char * key) { char *p, *keyp; unsigned int size; unsigned int val; val = 0; keyp = (char *)key; size = strlen(keyp); for (p = keyp; (unsigned int)(p - keyp) < size; p++) val = (val << 4 | (val >> (8 * sizeof(unsigned int) - 4))) ^ (*p); return val & (SIDTAB_SIZE - 1); } int sidtab_init(struct sidtab *s) { int i, rc = 0; s->htable = (struct sidtab_node **)avc_malloc (sizeof(struct sidtab_node *) * SIDTAB_SIZE); if (!s->htable) { rc = -1; goto out; } for (i = 0; i < SIDTAB_SIZE; i++) s->htable[i] = NULL; s->nel = 0; out: return rc; } int sidtab_insert(struct sidtab *s, const char * ctx) { int hvalue, rc = 0; struct sidtab_node *newnode; char * newctx; newnode = (struct sidtab_node *)avc_malloc(sizeof(*newnode)); if (!newnode) { rc = -1; goto out; } newctx = (char *) strdup(ctx); if (!newctx) { rc = -1; avc_free(newnode); goto out; } hvalue = sidtab_hash(newctx); newnode->next = s->htable[hvalue]; newnode->sid_s.ctx = newctx; newnode->sid_s.refcnt = 1; /* unused */ s->htable[hvalue] = newnode; s->nel++; out: return rc; } int <API key>(struct sidtab *s, const char * ctx, security_id_t * sid) { int hvalue, rc = 0; struct sidtab_node *cur; *sid = NULL; hvalue = sidtab_hash(ctx); loop: cur = s->htable[hvalue]; while (cur != NULL && strcmp(cur->sid_s.ctx, ctx)) cur = cur->next; if (cur == NULL) { /* need to make a new entry */ rc = sidtab_insert(s, ctx); if (rc) goto out; goto loop; /* find the newly inserted node */ } *sid = &cur->sid_s; out: return rc; } void sidtab_sid_stats(struct sidtab *h, char *buf, int buflen) { int i, chain_len, slots_used, max_chain_len; struct sidtab_node *cur; slots_used = 0; max_chain_len = 0; for (i = 0; i < SIDTAB_SIZE; i++) { cur = h->htable[i]; if (cur) { slots_used++; chain_len = 0; while (cur) { chain_len++; cur = cur->next; } if (chain_len > max_chain_len) max_chain_len = chain_len; } } snprintf(buf, buflen, "%s: %d SID entries and %d/%d buckets used, longest " "chain length %d\n", avc_prefix, h->nel, slots_used, SIDTAB_SIZE, max_chain_len); } void sidtab_destroy(struct sidtab *s) { int i; struct sidtab_node *cur, *temp; if (!s) return; for (i = 0; i < SIDTAB_SIZE; i++) { cur = s->htable[i]; while (cur != NULL) { temp = cur; cur = cur->next; freecon(temp->sid_s.ctx); avc_free(temp); } s->htable[i] = NULL; } avc_free(s->htable); s->htable = NULL; }
#define JPEG_INTERNALS #include "../jinclude.h" #include "../jpeglib.h" #include "../jsimd.h" #include "../jdct.h" #include "../jsimddct.h" #include "jsimd.h" /* * In the PIC cases, we have no guarantee that constants will keep * their alignment. This macro allows us to verify it at runtime. */ #define IS_ALIGNED(ptr, order) (((unsigned)ptr & ((1 << order) - 1)) == 0) #define IS_ALIGNED_SSE(ptr) (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */ static unsigned int simd_support = ~0; /* * Check what SIMD accelerations are supported. * * FIXME: This code is racy under a multi-threaded environment. */ LOCAL(void) init_simd (void) { char *env = NULL; if (simd_support != ~0U) return; simd_support = <API key>(); /* Force different settings through environment variables */ env = getenv("JSIMD_FORCEMMX"); if ((env != NULL) && (strcmp(env, "1") == 0)) simd_support &= JSIMD_MMX; env = getenv("JSIMD_FORCE3DNOW"); if ((env != NULL) && (strcmp(env, "1") == 0)) simd_support &= JSIMD_3DNOW|JSIMD_MMX; env = getenv("JSIMD_FORCESSE"); if ((env != NULL) && (strcmp(env, "1") == 0)) simd_support &= JSIMD_SSE|JSIMD_MMX; env = getenv("JSIMD_FORCESSE2"); if ((env != NULL) && (strcmp(env, "1") == 0)) simd_support &= JSIMD_SSE2; env = getenv("JSIMD_FORCENONE"); if ((env != NULL) && (strcmp(env, "1") == 0)) simd_support = 0; } GLOBAL(int) jsimd_can_rgb_ycc (void) { init_simd(); /* The code is optimised for these values only */ if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) return 0; if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) return 1; if (simd_support & JSIMD_MMX) return 1; return 0; } GLOBAL(int) jsimd_can_rgb_gray (void) { init_simd(); /* The code is optimised for these values only */ if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) return 0; if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) return 1; if (simd_support & JSIMD_MMX) return 1; return 0; } GLOBAL(int) jsimd_can_ycc_rgb (void) { init_simd(); /* The code is optimised for these values only */ if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) return 0; if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) return 1; if (simd_support & JSIMD_MMX) return 1; return 0; } GLOBAL(int) <API key> (void) { return 0; } GLOBAL(void) <API key> (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows) { void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); void (*mmxfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); switch(cinfo->in_color_space) { case JCS_EXT_RGB: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_RGBX: case JCS_EXT_RGBA: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_BGR: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_BGRX: case JCS_EXT_BGRA: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_XBGR: case JCS_EXT_ABGR: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_XRGB: case JCS_EXT_ARGB: sse2fct=<API key>; mmxfct=<API key>; break; default: sse2fct=<API key>; mmxfct=<API key>; break; } if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); else if (simd_support & JSIMD_MMX) mmxfct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); } GLOBAL(void) <API key> (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows) { void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); void (*mmxfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); switch(cinfo->in_color_space) { case JCS_EXT_RGB: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_RGBX: case JCS_EXT_RGBA: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_BGR: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_BGRX: case JCS_EXT_BGRA: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_XBGR: case JCS_EXT_ABGR: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_XRGB: case JCS_EXT_ARGB: sse2fct=<API key>; mmxfct=<API key>; break; default: sse2fct=<API key>; mmxfct=<API key>; break; } if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); else if (simd_support & JSIMD_MMX) mmxfct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); } GLOBAL(void) <API key> (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) { void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); switch(cinfo->out_color_space) { case JCS_EXT_RGB: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_RGBX: case JCS_EXT_RGBA: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_BGR: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_BGRX: case JCS_EXT_BGRA: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_XBGR: case JCS_EXT_ABGR: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_XRGB: case JCS_EXT_ARGB: sse2fct=<API key>; mmxfct=<API key>; break; default: sse2fct=<API key>; mmxfct=<API key>; break; } if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) sse2fct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); else if (simd_support & JSIMD_MMX) mmxfct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); } GLOBAL(void) <API key> (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) { } GLOBAL(int) <API key> (void) { init_simd(); /* The code is optimised for these values only */ if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if (simd_support & JSIMD_SSE2) return 1; if (simd_support & JSIMD_MMX) return 1; return 0; } GLOBAL(int) <API key> (void) { init_simd(); /* The code is optimised for these values only */ if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if (simd_support & JSIMD_SSE2) return 1; if (simd_support & JSIMD_MMX) return 1; return 0; } GLOBAL(void) <API key> (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { if (simd_support & JSIMD_SSE2) <API key>(cinfo->image_width, cinfo->max_v_samp_factor, compptr->v_samp_factor, compptr->width_in_blocks, input_data, output_data); else if (simd_support & JSIMD_MMX) <API key>(cinfo->image_width, cinfo->max_v_samp_factor, compptr->v_samp_factor, compptr->width_in_blocks, input_data, output_data); } GLOBAL(void) <API key> (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { if (simd_support & JSIMD_SSE2) <API key>(cinfo->image_width, cinfo->max_v_samp_factor, compptr->v_samp_factor, compptr->width_in_blocks, input_data, output_data); else if (simd_support & JSIMD_MMX) <API key>(cinfo->image_width, cinfo->max_v_samp_factor, compptr->v_samp_factor, compptr->width_in_blocks, input_data, output_data); } GLOBAL(int) <API key> (void) { init_simd(); /* The code is optimised for these values only */ if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if (simd_support & JSIMD_SSE2) return 1; if (simd_support & JSIMD_MMX) return 1; return 0; } GLOBAL(int) <API key> (void) { init_simd(); /* The code is optimised for these values only */ if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if (simd_support & JSIMD_SSE2) return 1; if (simd_support & JSIMD_MMX) return 1; return 0; } GLOBAL(void) jsimd_h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { if (simd_support & JSIMD_SSE2) <API key>(cinfo->max_v_samp_factor, cinfo->output_width, input_data, output_data_ptr); else if (simd_support & JSIMD_MMX) <API key>(cinfo->max_v_samp_factor, cinfo->output_width, input_data, output_data_ptr); } GLOBAL(void) jsimd_h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { if (simd_support & JSIMD_SSE2) <API key>(cinfo->max_v_samp_factor, cinfo->output_width, input_data, output_data_ptr); else if (simd_support & JSIMD_MMX) <API key>(cinfo->max_v_samp_factor, cinfo->output_width, input_data, output_data_ptr); } GLOBAL(int) <API key> (void) { init_simd(); /* The code is optimised for these values only */ if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) return 1; if (simd_support & JSIMD_MMX) return 1; return 0; } GLOBAL(int) <API key> (void) { init_simd(); /* The code is optimised for these values only */ if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) return 1; if (simd_support & JSIMD_MMX) return 1; return 0; } GLOBAL(void) <API key> (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) <API key>(cinfo->max_v_samp_factor, compptr->downsampled_width, input_data, output_data_ptr); else if (simd_support & JSIMD_MMX) <API key>(cinfo->max_v_samp_factor, compptr->downsampled_width, input_data, output_data_ptr); } GLOBAL(void) <API key> (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) <API key>(cinfo->max_v_samp_factor, compptr->downsampled_width, input_data, output_data_ptr); else if (simd_support & JSIMD_MMX) <API key>(cinfo->max_v_samp_factor, compptr->downsampled_width, input_data, output_data_ptr); } GLOBAL(int) <API key> (void) { init_simd(); /* The code is optimised for these values only */ if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) return 1; if (simd_support & JSIMD_MMX) return 1; return 0; } GLOBAL(int) <API key> (void) { init_simd(); /* The code is optimised for these values only */ if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) return 1; if (simd_support & JSIMD_MMX) return 1; return 0; } GLOBAL(void) <API key> (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) { void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); switch(cinfo->out_color_space) { case JCS_EXT_RGB: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_RGBX: case JCS_EXT_RGBA: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_BGR: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_BGRX: case JCS_EXT_BGRA: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_XBGR: case JCS_EXT_ABGR: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_XRGB: case JCS_EXT_ARGB: sse2fct=<API key>; mmxfct=<API key>; break; default: sse2fct=<API key>; mmxfct=<API key>; break; } if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); else if (simd_support & JSIMD_MMX) mmxfct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); } GLOBAL(void) <API key> (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) { void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); switch(cinfo->out_color_space) { case JCS_EXT_RGB: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_RGBX: case JCS_EXT_RGBA: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_BGR: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_BGRX: case JCS_EXT_BGRA: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_XBGR: case JCS_EXT_ABGR: sse2fct=<API key>; mmxfct=<API key>; break; case JCS_EXT_XRGB: case JCS_EXT_ARGB: sse2fct=<API key>; mmxfct=<API key>; break; default: sse2fct=<API key>; mmxfct=<API key>; break; } if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); else if (simd_support & JSIMD_MMX) mmxfct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); } GLOBAL(int) jsimd_can_convsamp (void) { init_simd(); /* The code is optimised for these values only */ if (DCTSIZE != 8) return 0; if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if (sizeof(DCTELEM) != 2) return 0; if (simd_support & JSIMD_SSE2) return 1; if (simd_support & JSIMD_MMX) return 1; return 0; } GLOBAL(int) <API key> (void) { init_simd(); /* The code is optimised for these values only */ if (DCTSIZE != 8) return 0; if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if (sizeof(FAST_FLOAT) != 4) return 0; if (simd_support & JSIMD_SSE2) return 1; if (simd_support & JSIMD_SSE) return 1; if (simd_support & JSIMD_3DNOW) return 1; return 0; } GLOBAL(void) jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM * workspace) { if (simd_support & JSIMD_SSE2) jsimd_convsamp_sse2(sample_data, start_col, workspace); else if (simd_support & JSIMD_MMX) jsimd_convsamp_mmx(sample_data, start_col, workspace); } GLOBAL(void) <API key> (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT * workspace) { if (simd_support & JSIMD_SSE2) <API key>(sample_data, start_col, workspace); else if (simd_support & JSIMD_SSE) <API key>(sample_data, start_col, workspace); else if (simd_support & JSIMD_3DNOW) <API key>(sample_data, start_col, workspace); } GLOBAL(int) <API key> (void) { init_simd(); /* The code is optimised for these values only */ if (DCTSIZE != 8) return 0; if (sizeof(DCTELEM) != 2) return 0; if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) return 1; if (simd_support & JSIMD_MMX) return 1; return 0; } GLOBAL(int) <API key> (void) { init_simd(); /* The code is optimised for these values only */ if (DCTSIZE != 8) return 0; if (sizeof(DCTELEM) != 2) return 0; if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) return 1; if (simd_support & JSIMD_MMX) return 1; return 0; } GLOBAL(int) <API key> (void) { init_simd(); /* The code is optimised for these values only */ if (DCTSIZE != 8) return 0; if (sizeof(FAST_FLOAT) != 4) return 0; if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(<API key>)) return 1; if (simd_support & JSIMD_3DNOW) return 1; return 0; } GLOBAL(void) jsimd_fdct_islow (DCTELEM * data) { if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) <API key>(data); else if (simd_support & JSIMD_MMX) <API key>(data); } GLOBAL(void) jsimd_fdct_ifast (DCTELEM * data) { if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) <API key>(data); else if (simd_support & JSIMD_MMX) <API key>(data); } GLOBAL(void) jsimd_fdct_float (FAST_FLOAT * data) { if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(<API key>)) <API key>(data); else if (simd_support & JSIMD_3DNOW) <API key>(data); } GLOBAL(int) jsimd_can_quantize (void) { init_simd(); /* The code is optimised for these values only */ if (DCTSIZE != 8) return 0; if (sizeof(JCOEF) != 2) return 0; if (sizeof(DCTELEM) != 2) return 0; if (simd_support & JSIMD_SSE2) return 1; if (simd_support & JSIMD_MMX) return 1; return 0; } GLOBAL(int) <API key> (void) { init_simd(); /* The code is optimised for these values only */ if (DCTSIZE != 8) return 0; if (sizeof(JCOEF) != 2) return 0; if (sizeof(FAST_FLOAT) != 4) return 0; if (simd_support & JSIMD_SSE2) return 1; if (simd_support & JSIMD_SSE) return 1; if (simd_support & JSIMD_3DNOW) return 1; return 0; } GLOBAL(void) jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors, DCTELEM * workspace) { if (simd_support & JSIMD_SSE2) jsimd_quantize_sse2(coef_block, divisors, workspace); else if (simd_support & JSIMD_MMX) jsimd_quantize_mmx(coef_block, divisors, workspace); } GLOBAL(void) <API key> (JCOEFPTR coef_block, FAST_FLOAT * divisors, FAST_FLOAT * workspace) { if (simd_support & JSIMD_SSE2) <API key>(coef_block, divisors, workspace); else if (simd_support & JSIMD_SSE) <API key>(coef_block, divisors, workspace); else if (simd_support & JSIMD_3DNOW) <API key>(coef_block, divisors, workspace); } GLOBAL(int) jsimd_can_idct_2x2 (void) { init_simd(); /* The code is optimised for these values only */ if (DCTSIZE != 8) return 0; if (sizeof(JCOEF) != 2) return 0; if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if (sizeof(ISLOW_MULT_TYPE) != 2) return 0; if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) return 1; if (simd_support & JSIMD_MMX) return 1; return 0; } GLOBAL(int) jsimd_can_idct_4x4 (void) { init_simd(); /* The code is optimised for these values only */ if (DCTSIZE != 8) return 0; if (sizeof(JCOEF) != 2) return 0; if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if (sizeof(ISLOW_MULT_TYPE) != 2) return 0; if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) return 1; if (simd_support & JSIMD_MMX) return 1; return 0; } GLOBAL(void) jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) jsimd_idct_2x2_sse2(compptr->dct_table, coef_block, output_buf, output_col); else if (simd_support & JSIMD_MMX) jsimd_idct_2x2_mmx(compptr->dct_table, coef_block, output_buf, output_col); } GLOBAL(void) jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) jsimd_idct_4x4_sse2(compptr->dct_table, coef_block, output_buf, output_col); else if (simd_support & JSIMD_MMX) jsimd_idct_4x4_mmx(compptr->dct_table, coef_block, output_buf, output_col); } GLOBAL(int) <API key> (void) { init_simd(); /* The code is optimised for these values only */ if (DCTSIZE != 8) return 0; if (sizeof(JCOEF) != 2) return 0; if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if (sizeof(ISLOW_MULT_TYPE) != 2) return 0; if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) return 1; if (simd_support & JSIMD_MMX) return 1; return 0; } GLOBAL(int) <API key> (void) { init_simd(); /* The code is optimised for these values only */ if (DCTSIZE != 8) return 0; if (sizeof(JCOEF) != 2) return 0; if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if (sizeof(IFAST_MULT_TYPE) != 2) return 0; if (IFAST_SCALE_BITS != 2) return 0; if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) return 1; if (simd_support & JSIMD_MMX) return 1; return 0; } GLOBAL(int) <API key> (void) { init_simd(); if (DCTSIZE != 8) return 0; if (sizeof(JCOEF) != 2) return 0; if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if (sizeof(FAST_FLOAT) != 4) return 0; if (sizeof(FLOAT_MULT_TYPE) != 4) return 0; if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) return 1; if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(<API key>)) return 1; if (simd_support & JSIMD_3DNOW) return 1; return 0; } GLOBAL(void) jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) <API key>(compptr->dct_table, coef_block, output_buf, output_col); else if (simd_support & JSIMD_MMX) <API key>(compptr->dct_table, coef_block, output_buf, output_col); } GLOBAL(void) jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) <API key>(compptr->dct_table, coef_block, output_buf, output_col); else if (simd_support & JSIMD_MMX) <API key>(compptr->dct_table, coef_block, output_buf, output_col); } GLOBAL(void) jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(<API key>)) <API key>(compptr->dct_table, coef_block, output_buf, output_col); else if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(<API key>)) <API key>(compptr->dct_table, coef_block, output_buf, output_col); else if (simd_support & JSIMD_3DNOW) <API key>(compptr->dct_table, coef_block, output_buf, output_col); }
<!DOCTYPE html> <html lang="en" > <head> <meta charset="utf-8"/> <title>CSS3 Text, linebreaks: 3087 HIRAGANA LETTER SMALL YO </title> <link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'> <meta name='flags' content='font'> <style type='text/css'> @font-face { font-family: 'mplus-1p-regular'; src: url('support/mplus-1p-regular.woff') format('woff'); /* filesize: 803K */ } .test, .ref { font-size: 30px; font-family: mplus-1p-regular, sans-serif; width: 95px; padding: 0; border: 1px solid orange; line-height: 1em; } </style> </head> <body> <p class="instructions">Test passes if the two orange boxes are identical.</p> <div class='ref'><br />&#x3087;</div> <div class='ref'><br />&#x3087;</div> </body> </html>