1 \ Copyright (c) 2000 Daniel C. Sobral <dcs@FreeBSD.org>
4 \ Redistribution and use in source and binary forms, with or without
5 \ modification, are permitted provided that the following conditions
7 \ 1. Redistributions of source code must retain the above copyright
8 \ notice, this list of conditions and the following disclaimer.
9 \ 2. Redistributions in binary form must reproduce the above copyright
10 \ notice, this list of conditions and the following disclaimer in the
11 \ documentation and/or other materials provided with the distribution.
13 \ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 \ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 \ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 \ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 \ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 \ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 \ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 \ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 \ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 \ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 \ The following pnp code is used in pnp.4th and pnp.c
29 structure: STAILQ_HEAD
30 ptr stqh_first \ type*
31 ptr stqh_last \ type**
34 structure: STAILQ_ENTRY
44 ptr pnpid.ident \ char*
45 sizeof STAILQ_ENTRY cells member: pnpid.link \ pnpident
48 structure: pnpinfo \ sync with sys/boot/config/bootstrap.h
51 ptr pnpi.module \ (char*) module args
54 ptr pnpi.handler \ pnphandler
55 sizeof STAILQ_HEAD member: pnpi.ident \ pnpident
56 sizeof STAILQ_ENTRY member: pnpi.link \ pnpinfo
66 ." Probing " dup @ pnph.name @ dup strlen type ." ..." cr
67 0 over @ pnph.enumerate @ ccall drop
73 ." PNP scan summary:" cr
74 pnpdevices stqh_first @
78 dup pnpi.ident stqh_first @ pnpid.ident @ dup strlen type
79 dup pnpi.desc @ ?dup if
89 : compare-pnpid ( addr addr' -- flag )
91 over c@ over c@ <> if drop drop false exit then
99 : search-pnpid ( id -- flag )
101 pnpdevices stqh_first @
105 dup pnpi.ident stqh_first @
106 begin ( pnpinfo pnpident )
107 dup pnpid.ident @ r@ compare-pnpid
110 \ XXX Temporary debugging message
111 ." Found " pnpid.ident @ dup strlen type
113 ." : " dup strlen type
119 pnpid.link stqe_next @
122 pnpi.link stqe_next @
129 : skip-space ( addr -- addr' )
138 : skip-to-space ( addr -- addr' )
148 : premature-end? ( addr -- addr flag )
149 postpone dup postpone c@ postpone 0=
150 postpone if postpone exit postpone then
157 only forth also support-functions
163 \ Search for filename
164 skip-space premature-end?
166 \ Search for end of filename
167 skip-to-space premature-end?
169 \ Search for timestamp
170 skip-space premature-end?
172 skip-to-space premature-end?
176 skip-space premature-end?
178 skip-to-space dup c@ >r
181 filename dup strlen 1 ['] (load) catch if
183 ." Error loading " filename dup strlen type cr
194 s" /boot/pnpid.conf" O_RDONLY fopen fd !