1280924Sdteske\ Copyright (c) 2014 M. Warner Losh <imp@FreeBSD.org>
2271406Simp\ All rights reserved.
3271406Simp\
4271406Simp\ Redistribution and use in source and binary forms, with or without
5271406Simp\ modification, are permitted provided that the following conditions
6271406Simp\ are met:
7271406Simp\ 1. Redistributions of source code must retain the above copyright
8271406Simp\    notice, this list of conditions and the following disclaimer.
9271406Simp\ 2. Redistributions in binary form must reproduce the above copyright
10271406Simp\    notice, this list of conditions and the following disclaimer in the
11271406Simp\    documentation and/or other materials provided with the distribution.
12271406Simp\
13271406Simp\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14271406Simp\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15271406Simp\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16271406Simp\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17271406Simp\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18271406Simp\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19271406Simp\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20271406Simp\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21271406Simp\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22271406Simp\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23271406Simp\ SUCH DAMAGE.
24271406Simp\
25271406Simp\ $FreeBSD: releng/11.0/sys/boot/forth/pcibios.4th 280924 2015-03-31 22:32:35Z dteske $
26271406Simp
27271406Simponly forth also support-functions also builtins definitions
28271406Simp
29271406Simp\ pci-device-count pci-id
30271406Simp\
31271406Simp\ Counts the number of instances of pci-id in the system and reports
32271406Simp\ it to the user.
33271406Simp: pci-device-count
34271406Simp  0= if ( interpreted ) get_arguments then
35271406Simp
36271406Simp  0= if ." Need an argument" cr abort then
37271406Simp  \ First argument is 0 when we're interprated.  See support.4th
38271406Simp  \ for get_arguments reading the rest of the line and parsing it
39271406Simp  \ stack: argN lenN ... arg1 len1 N
40271406Simp  hex ?number decimal 
41271406Simp  0= if ." Bad pci-id given (must be legal hex value)" cr abort then
42271406Simp  dup pcibios-device-count ." Found " . ." instances of " hex . decimal cr
43271406Simp;
44271406Simp
45271406Simpalso forth definitions also builtins
46271406Simp
47271406Simpbuiltin: pci-device-count
48