Compare commits

...
50 Commits
Author SHA1 Message Date
Glen Barber 335d6b4a0e Update releng/9.2 to -RELEASE status as part of the 9.2-RELEASE
process.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2013-09-26 18:10:19 +00:00
Glen Barber f6587d9d67 Bump entity versions.
Approved by:	re (implicit)
2013-09-26 16:07:30 +00:00
Glen Barber d0673efba0 Trim the release notes article to the basics, purely for inclusion
in the release build.  The release notes will be updated on the
website as normal.

Discussed with:	hrs
Approved by:	re (implicit)
2013-09-26 15:46:32 +00:00
Glen Barber 0374e3a7f9 - Bump Copyright year
- Trim old entries from releng/9.1

Approved by:	re (implicit)
2013-09-26 15:17:49 +00:00
Glen Barber 9dfe4a21ce - Bump Copyright year
Approved by:	re (implicit)
2013-09-26 14:41:53 +00:00
Glen Barber 946b6deb59 - Bump Copyright year
- Trim old entries from releng/9.1
- Update URLs for 9.2 where needed
- Note CVS/cvsup are not supported methods to update src/

Approved by:	re (implicit)
2013-09-26 14:39:13 +00:00
Glen Barber 13a47ca36a - Bump Copyright year
- Trim old entries from the releng/9.1 branch

Approved by:	re (implicit)
2013-09-26 14:30:02 +00:00
Glen Barber b4b943f46f Update releng/9.2 to -RC4.
Approved by:	re (implicit)
2013-09-11 00:42:50 +00:00
Glen Barber 6d9936ffaf Reintegrate r250907 (previously reverted as r254754) plus MFS r254947,
r255443:

r250907 (scottl):
  MFC r248830, r250027, r250409: Several fixes and improvements
  to sendfile()

r254947 (kib):
  NFS implementation of VOP_READ() sometimes upgrades the vnode lock,
  which causes drop of the shared lock and sleep for exclusive.  As
  result, busying of the page before the call to vn_rdwr() makes NFS
  code to wait for vnode lock while page is busy, which contradicts the
  proper order of vnode lock -> busy.

r255443 (des):
  Fix the length calculation for the final block of a sendfile(2)
  transmission which could be tricked into rounding up to the nearest
  page size, leaking up to a page of kernel memory.  [13:11]

Approved by:	re (delphij)
Sponsored by:	The FreeBSD Foundation
2013-09-10 19:00:32 +00:00
Dag-Erling Smørgrav e2630701b4 In IPv6 and NetATM, stop SIOCSIFADDR, SIOCSIFBRDADDR, SIOCSIFDSTADDR
and SIOCSIFNETMASK at the socket layer rather than pass them on to the
link layer without validation or credential checks.  [SA-13:12]

Prevent cross-mount hardlinks between different nullfs mounts of the
same underlying filesystem.  [SA-13:13]

Security:	CVE-2013-5691
Security:	FreeBSD-SA-13:12.ifioctl
Security:	CVE-2013-5710
Security:	FreeBSD-SA-13:13.nullfs
Approved by:	re
2013-09-10 10:08:20 +00:00
Xin LI 44f4d2208a MFS r255435: MFC r255320:
Return BUS_PROBE_DEFAULT instead of BUS_PROBE_SPECIFIC.

Approved by:	re (hrs)
2013-09-10 01:38:41 +00:00
Dag-Erling Smørgrav adf82fbc25 MFH (r255243): create /var/authpf with correct ownership and permissions.
Approved by:	re (glebius)
2013-09-08 19:29:45 +00:00
Dag-Erling Smørgrav 47da79014e MFH (r254684, r254955): fix segfault on reload.
MFH (r255156): silence an error message on non-IPv6 interfaces.

Approved by:    re (glebius)
2013-09-08 18:27:26 +00:00
Dimitry Andric 1c1f9c5f39 MFS9 r255306:
MFC r245428:

Add CLOCK_PROCESS_CPUTIME_ID to <time.h>, to synchronize the CLOCK_*
values with those in <sys/time.h>.  Otherwise, if a program includes
<time.h> before <sys/time.h>, the CLOCK_PROCESS_CPUTIME_ID macro never
gets defined.

Reviewed by:	davidxu
Approved by:	re (kib)
2013-09-06 15:38:40 +00:00
Kirk McKusick d15fba2690 MFS of 255104:
MFC of 253998:

This bug fix is in a code path in rename taken when there is a
collision between a rename and an open system call for the same
target file. Here, rename releases its vnode references, waits for
the open to finish, and then restarts by reacquiring its needed
vnode locks. In this case, rename was unlocking but failing to
release its reference to one of its held vnodes. The effect was
that even after all the actual references to the vnode had gone,
the vnode still showed active references. For files that had been
removed, their space was not reclaimed until the filesystem was
forcibly unmounted.

This bug manifested itself in the Postgres server which would
leak/lose hundreds of files per day amounting to many gigabytes of
disk space. This bug required shutting down Postgres, forcibly
unmounting its filesystem, remounting its filesystem and restarting
Postgres every few days to recover the lost space.

Reported by: Dan Thomas and Palle Girgensohn
Bug-fix by:  kib
Tested by:   Dan Thomas and Palle Girgensohn

Approved by: re@ (Marius Strobl <[email protected]>)
2013-09-05 04:00:48 +00:00
Glen Barber 11720a8fdf Reduce the disc1.iso image size by setting WITHOUT_CLANG=1 for the
'system' target.  Since clang is not enabled by default for releng/9.2,
this has no user visible changes by default.

This brings 9.2-R* well enough below the 700MB mark so that we do not
need to be concerned with it fitting on standard CD-ROM medium.

This is a direct commit to releng/9.2, pending further review for head/
and stable/9/.

Discussed with:	delphij, hrs
Approved by:	re (marius)
Sponsored by:	The FreeBSD Foundation
2013-09-04 18:20:24 +00:00
Devin Teske 9219231a82 MFS9 r254953, itself an MFC of r254942 and r254952:
Make alternate layout ``opt-in'' and add support for named releases.
Minor edit to version.4th(8) manual and stack-leak fixes while here.

Approved by:	re (gjb)
2013-08-29 15:29:48 +00:00
Devin Teske ab5450e01f MFS9 r254966:
Add missing mergeinfo from head for stabe/9 revisions: 252995 253168 253169

Reviewed by:	gjb
Approved by:	re (gjb)
2013-08-29 15:12:58 +00:00
Glen Barber 320598646d Update releng/9.2 to -RC3.
Approved by:	re (implicit)
2013-08-24 16:17:33 +00:00
Glen Barber a2d91af3f2 Default net.inet.tcp.experimental.initcwnd10 to 0 in releng/9.2.
Concerns have been raised regarding enabling initcwnd10 by default
in the stable/ branch, so as a cautionary measure, turn this off
for the 9.2-RELEASE.  This sysctl is still available for those
who want to enable this on their own systems.

This is a direct commit to releng/9.2.

Discussed with:	re
Approved by:	re (marius)
2013-08-24 15:09:05 +00:00
Ed Maste 7e6171d327 MFS r254728:
Pull in r182983 from upstream clang trunk:

    Fix handling of braced-init-list as reference initializer within
    aggregate initialization. Previously we would incorrectly require an
    extra set of braces around such initializers.

  Pull in r188718 from upstream clang trunk:

    Handle init lists and _Atomic fields.

    Fixes PR16931.

  These fixes are needed for the atomic_flag type to work correctly in our
  stdatomic.h.

Approved by:	re
2013-08-24 14:33:11 +00:00
Ed Maste 71e454818c MF9 r254783: Correct implementation of atomic_flag_test_and_set
Approved by:	re
2013-08-24 13:58:17 +00:00
Glen Barber b6b4f514e1 Revert r250907 from releng/9.2:
Reports of NFS deadlocks on -stable@ suggest that reverting
 this change resolves the problem.

 This is a direct reverse-merge to releng/9.2, pending further
 review and analysis on the stable/9 branch.

Approved by:	re (marius)
Discussed on:	stable
2013-08-24 00:26:15 +00:00
Xin LI bbd43032ee Fix an integer overflow in computing the size of a temporary buffer
can result in a buffer which is too small for the requested
operation.

Security:	CVE-2013-3077
Security:	FreeBSD-SA-13:09.ip_multicast
Approved by:	re (kib)
2013-08-22 00:51:43 +00:00
Jack F Vogel d94e0506bc MFC r254008,254262: Improve the MSIX setup logic, making sure the requested
number of vectors are actually obtained, and if not cleaning up before falling
back to MSI. Also make the fallback decision as early as possible.

Approved by: re
2013-08-20 17:50:30 +00:00
Glen Barber a0143f7406 MFC r254397:
Mark the makefs(8) '-p' flag as deprecated in preference for
  the '-Z' flag for compatibility with NetBSD.

Approved by:	re (rodrigc)
2013-08-20 01:14:16 +00:00
Glen Barber d103d6c74b MFC r254525:
Add entry for packages-9.2-release directory.

Approved by:	re (implicit)
2013-08-19 14:42:39 +00:00
Devin Teske 81c8b88bbb MFS9 SVN r254331:
Add optional support for default override of standard setup; but only if
corresponding functions are provided. If override function does not exist,
boot remains unmodified. This patch should not result in any changes.

This includes changes to take advantage of the new functionality.

Approved by:	re (marius)
2013-08-15 15:34:26 +00:00
Glen Barber 981363393e Update releng/9.2 to -RC2.
Approved by:	re (implicit)
2013-08-15 14:41:39 +00:00
Andrey V. Elsukov fb4e36f79b Merge r254366:
Make the check for number of entries less strict.
  Some partitioning tools can create GPT with number of entries less
  than 128.

Approved by:	re (marius)
2013-08-15 14:33:09 +00:00
Scott Long 63e0f0f0c2 Merge r254306:
Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCI
 command register.  The lazy BAR allocation code in FreeBSD sometimes
 disables this bit when it detects a range conflict, and will re-enable
 it on demand when a driver allocates the BAR.  Thus, the bit is no longer
 a reliable indication of capability, and should not be checked.  This
 results in the elimination of a lot of code from drivers, and also gives
 the opportunity to simplify a lot of drivers to use a helper API to set
 the busmaster enable bit.

 This changes fixes some recent reports of disk controllers and their
 associated drives/enclosures disappearing during boot.

Submitted by:	jhb
Reviewed by:	jfv, marius, adrian, achim
Approved by:	re
2013-08-15 12:19:16 +00:00
Glen Barber 8a1372723b MFC r254265:
Make sure bootonly.iso for -BETAs and -RCs use the releases/
 directory on the FTP mirrors to fetch distributions, since
 these are always pushed to releases/ during the release cycle.

Approved by:	re (marius)
2013-08-15 10:38:10 +00:00
Jeremie Le Hen 9d99ea26a5 MFC r253853:
Include /usr/local/etc/libmap.d/ by default.

  PR:             180568
  Reviewed by:    bapt
  Obtained from:  kib

Approved by:      re (delphij)
2013-08-15 08:12:16 +00:00
Michael Tuexen 94890e2328 MFC r254352:
Don't send uninitialized memory (two instances of 4 bytes) in
every cookie on the wire. This bug was reported in
https://bugzilla.mozilla.org/show_bug.cgi?id=905080

Approved by:	re@
2013-08-15 05:14:20 +00:00
Gregory Neil Shapiro 6ce432c79d MFC: Temporarily revert sendmail 8.14.7 change to getipnodebyname() flags
to prevent problems between the resolver and Microsoft DNS servers with
     AAAA lookups.  The upstream open source project will work on a more
     permanent fix for the next release.  Issue noted by Pavel Timofeev.

Approved by:	re (glebius)
2013-08-15 01:31:31 +00:00
Erwin Lansing 04243eb9b0 MFC 254132, 254270:
Add empty zones for Shared Address Space (RFC 6598)

Approved by:  re (glebius), delphij (mentor)
Sponsored by: DK Hostmaster A/S
2013-08-14 06:06:39 +00:00
Devin Teske 84f0eb3005 Synchronize releng/9.2 Forth code with stable/9 via MFS of 2 revisions:
First, MFS of SVN r254109: itself an MFC of 22 revisions:
227727, 233941, 235560, 238431, 241310, 241361, 241363, 241365, 241367,
241523, 242667-242669, 242923, 243114, 243660, 244048, 244089, 244158,
253715, 254105, and 254108.

This includes critical fixes that sadly should have been merged prior.
Namely, SVN r244158 fixes a possible regression.

Second, MFS of SVN r254146: Itself an MFC of r242688.

Approved by:	re (marius)
2013-08-12 01:21:14 +00:00
Marius Strobl 684428cf6c MFC: r254004
As it turns out, MSIs are broken with 2820SA so introduce an AAC_FLAGS_NOMSI
quirk and apply it to these controllers [1]. The same problem was reported
for 2230S, in which case it wasn't actually clear whether the culprit is the
controller or the mainboard, though. In order to be on the safe side, flag
MSIs as being broken with the latter type of controller as well. Given that
these are the only reports of MSI-related breakage with aac(4) so far and
OSes like OpenSolaris unconditionally employ MSIs for all adapters of this
family, however, it doesn't seem warranted to generally disable the use of
MSIs in aac(4).
While at it, simplify the MSI allocation logic a bit; there's no need to
check for the presence of the MSI capability on our own as pci_alloc_msi(9)
will just fail when these kind of interrupts are not available.
Reported and tested by: David Boyd [1]

Approved by:	re (kib)
2013-08-09 18:57:18 +00:00
Jack F Vogel 38ce1e32a9 Automate inet option file creation for module build, change module name to
if_ixgbe, this sync's the Makefile with HEAD.

Approved by:	re
2013-08-09 16:34:12 +00:00
David Chisnall 3dc24e1188 Merge alignment fix for libcxxrt header.
Approved by:	re
2013-08-09 11:26:26 +00:00
Marcel Moolenaar 84148324bd Merge r254075 from stable/9. This fixes the ISO images.
Approved by:	re (gjb@)
2013-08-09 05:27:38 +00:00
Devin Teske 2220ad5a45 Sync-up bsdinstall(8)/bsdconfig(8) list of mirrors.
SVN r253543:
Update mirror list to more closely match
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/mirrors-ftp.html

SVN r253545:
Sync-up with bsdinstall(8) FTP mirrorselect changes.

SVN r253566:
Remove ftp2.tr.freebsd.org, it is out of date.

Reviewed by:	gavin
Approved by:	re (glebius)
2013-08-08 21:35:26 +00:00
Devin Teske a06d2ba7db Sync-up bsdinstall(8)/bsdconfig(8) list of mirrors.
SVN r253543:
Update mirror list to more closely match
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/mirrors-ftp.html

SVN r253545:
Sync-up with bsdinstall(8) FTP mirrorselect changes.

SVN r253566:
Remove ftp2.tr.freebsd.org, it is out of date.

Reviewed by:	gavin
Approved by:	re (glebius)
2013-08-08 21:33:54 +00:00
Hiroki Sato bff522ef3c MFC 253887,253977:
- Use pget(PGET_CANDEBUG | PGET_NOTWEXIT) to determine if the specified
  PID is valid for monitoring in FILEMON_SET_PID ioctl.

- Set the monitored PID to -1 when the process exits.

Suggested by:	jilles
Tested by:	sjg
Approved by:	re (kib)
2013-08-08 20:30:22 +00:00
Jack F Vogel f60ac5764e MFC 253176,253179: make sure the rxbuf->flags is cleared when the RX ring is reset
Approved by: re
2013-08-08 18:16:13 +00:00
Konstantin Belousov bbe825ef49 Revert the MFC of the r244237, done as r244806. There are indeed bugs
in XEN pmap.  The revert hides a panic with the cost of non-working
vfork(2), which means more obscure misbehaviour in the usermode.
Revert is only done on the stable branch to maintain the consistent
erratic behaviour.

PR:	kern/180788
Approved by:	re (marius)
2013-08-07 10:07:55 +00:00
Jack F Vogel db348f4cf2 When the igb driver is static there are cases when early interrupts occur,
resulting in a panic in refresh_mbufs, to prevent this add a check to the
interrupt handler for DRV_RUNNING.

Approved by: re
2013-08-06 21:16:00 +00:00
John Baldwin 73e24a94df MFC 253048,253423,253449,253653,253774,253785:
- Allow mlx4 devices to switch between Ethernet and Infiniband:
  - Fix sysfs attribute handling by using sysctl_handle_string() and
    properly handling trailing newlines in attribute values.
  - Remove check forbidding requests that would result in one port being
    set to Ethernet and the subsequent port being set to IB.
- Avoid trashing IP fragments by correctly managing hardware checksumming.
- Fix panics when downing or unloading the mlx4 driver.

PR:		kern/179999, kern/174213, kern/180430, kern/180791
Approved by:	re (kib)
2013-08-06 20:04:44 +00:00
Jack F Vogel 60f32d33ef MFC r253865: Fixes to RX_COPY optimization code allowing the removal of rearm_queues
routine used in the local_timer.
    r253965: Correct the queue mask bit clearing in the link irq handler.

Approved by: re
2013-08-06 17:22:06 +00:00
Glen Barber fbaf7617a1 - Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
- Update branch name to -RC1.
- Bump __FreeBSD_version.

Approved by:	kib (mentor, implicit)
Approved by:	re (implicit)
2013-08-03 12:41:21 +00:00
148 changed files with 2543 additions and 2499 deletions

No files matched your search

+1 -1
View File
@@ -80,7 +80,7 @@ struct _Unwind_Exception
_Unwind_Exception_Cleanup_Fn exception_cleanup;
unsigned long private_1;
unsigned long private_2;
} __attribute__((__aligned__));
};
extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *);
extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *,
+10 -5
View File
@@ -774,6 +774,11 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity,
InitListExpr *StructuredList,
unsigned &StructuredIndex) {
Expr *expr = IList->getInit(Index);
if (ElemType->isReferenceType())
return CheckReferenceType(Entity, IList, ElemType, Index,
StructuredList, StructuredIndex);
if (InitListExpr *SubInitList = dyn_cast<InitListExpr>(expr)) {
if (!ElemType->isRecordType() || ElemType->isAggregateType()) {
unsigned newIndex = 0;
@@ -793,13 +798,13 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity,
// C++ initialization is handled later.
}
if (ElemType->isScalarType()) {
// FIXME: Need to handle atomic aggregate types with implicit init lists.
if (ElemType->isScalarType() || ElemType->isAtomicType())
return CheckScalarType(Entity, IList, ElemType, Index,
StructuredList, StructuredIndex);
} else if (ElemType->isReferenceType()) {
return CheckReferenceType(Entity, IList, ElemType, Index,
StructuredList, StructuredIndex);
}
assert((ElemType->isRecordType() || ElemType->isVectorType() ||
ElemType->isArrayType()) && "Unexpected type");
if (const ArrayType *arrayType = SemaRef.Context.getAsArrayType(ElemType)) {
// arrayType can be incomplete if we're initializing a flexible
@@ -39,3 +39,7 @@
#ifndef SM_CONF_MSG
# define SM_CONF_MSG 1
#endif /* SM_CONF_MSG */
#ifndef SM_IPNODEBYNAME_FLAGS
# define SM_IPNODEBYNAME_FLAGS AI_DEFAULT|AI_ALL
#endif /* SM_IPNODEBYNAME_FLAGS */
+1
View File
@@ -22,6 +22,7 @@ BIN1= crontab \
hosts.equiv \
inetd.conf \
libalias.conf \
libmap.conf \
login.access \
login.conf \
mac.conf \
+2
View File
@@ -0,0 +1,2 @@
# $FreeBSD$
includedir /usr/local/etc/libmap.d
+2
View File
@@ -23,6 +23,8 @@
remote uname=auditdistd gname=wheel mode=0700
..
..
authpf uname=root gname=authpf mode=0770
..
/set gname=wheel
backups
..
+66
View File
@@ -153,6 +153,72 @@ zone "30.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "31.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "168.192.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
// Shared Address Space (RFC 6598)
zone "64.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "65.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "66.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "67.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "68.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "69.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "70.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "71.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "72.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "73.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "74.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "75.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "76.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "77.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "78.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "79.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "80.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "81.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "82.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "83.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "84.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "85.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "86.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "87.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "88.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "89.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "90.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "91.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "92.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "93.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "94.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "95.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "96.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "97.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "98.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "99.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "100.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "101.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "102.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "103.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "104.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "105.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "106.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "107.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "108.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "109.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "110.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "111.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "112.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "113.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "114.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "115.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "116.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "117.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "118.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "119.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "120.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "121.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "122.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "123.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "124.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "125.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "126.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "127.100.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
// Link-local/APIPA (RFCs 3927, 5735 and 6303)
zone "254.169.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
+1 -1
View File
@@ -322,7 +322,7 @@ typedef atomic_bool atomic_flag;
#define atomic_flag_clear_explicit(object, order) \
atomic_store_explicit(object, 0, order)
#define atomic_flag_test_and_set_explicit(object, order) \
atomic_compare_exchange_strong_explicit(object, 0, 1, order, order)
atomic_exchange_explicit(object, 1, order)
#define atomic_flag_clear(object) \
atomic_flag_clear_explicit(object, memory_order_seq_cst)
+1
View File
@@ -105,6 +105,7 @@ typedef __timer_t timer_t;
#define CLOCK_MONOTONIC_FAST 12 /* FreeBSD-specific. */
#define CLOCK_SECOND 13 /* FreeBSD-specific. */
#define CLOCK_THREAD_CPUTIME_ID 14
#define CLOCK_PROCESS_CPUTIME_ID 15
#endif /* !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112 */
#if !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112
+2 -1
View File
@@ -122,7 +122,8 @@ system: packagesystem
# Install system
mkdir -p release
cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
DESTDIR=${.OBJDIR}/release WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1
DESTDIR=${.OBJDIR}/release WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1 \
WITHOUT_CLANG=1
# Copy distfiles
mkdir -p release/usr/freebsd-dist
cp *.txz MANIFEST release/usr/freebsd-dist
+1 -1
View File
@@ -24,7 +24,7 @@
# Set these, release builder!
#
# Fixed version:
#BUILDNAME=9.2-BETA2
#BUILDNAME=9.2-RELEASE
#
# Automatic SNAP versioning:
DATE != date +%Y%m%d
+5 -81
View File
@@ -28,7 +28,7 @@
<pubdate>$FreeBSD$</pubdate>
<copyright>
<year>2012</year>
<year>2013</year>
<holder role="mailto:[email protected]">The &os; Documentation Project</holder>
</copyright>
@@ -106,59 +106,9 @@
<tbody>
<row>
<entry><ulink url="http://security.freebsd.org/advisories/FreeBSD-SA-12:01.openssl.asc"
>SA-12:01.openssl</ulink></entry>
<entry>3&nbsp;May&nbsp;2012</entry>
<entry><para>OpenSSL multiple vulnerabilities</para></entry>
</row>
<row>
<entry><ulink url="http://security.freebsd.org/advisories/FreeBSD-SA-12:02.crypt.asc"
>SA-12:02.crypt</ulink></entry>
<entry>30&nbsp;May&nbsp;2012</entry>
<entry><para>Incorrect <function>crypt()</function> hashing</para></entry>
</row>
<row>
<entry><ulink url="http://security.freebsd.org/advisories/FreeBSD-SA-12:03.bind.asc"
>SA-12:03.bind</ulink></entry>
<entry>12&nbsp;June&nbsp;2012</entry>
<entry><para>Incorrect handling of zero-length RDATA fields in &man.named.8;</para></entry>
</row>
<row>
<entry><ulink url="http://security.freebsd.org/advisories/FreeBSD-SA-12:04.sysret.asc"
>SA-12:04.sysret</ulink></entry>
<entry>12&nbsp;June&nbsp;2012</entry>
<entry><para>Privilege escalation when returning from kernel</para></entry>
</row>
<row>
<entry><ulink url="http://security.freebsd.org/advisories/FreeBSD-SA-12:05.bind.asc"
>SA-12:05.bind</ulink></entry>
<entry>6&nbsp;August&nbsp;2012</entry>
<entry><para>&man.named.8; DNSSEC validation Denial of Service</para></entry>
</row>
<row>
<entry><ulink url="http://security.freebsd.org/advisories/FreeBSD-SA-12:06.bind.asc"
>SA-12:06.bind</ulink></entry>
<entry>22&nbsp;November&nbsp;2012</entry>
<entry><para>Multiple Denial of Service vulnerabilities with &man.named.8;</para></entry>
</row>
<row>
<entry><ulink url="http://security.freebsd.org/advisories/FreeBSD-SA-12:07.hostapd.asc"
>SA-12:07.hostapd</ulink></entry>
<entry>22&nbsp;November&nbsp;2012</entry>
<entry><para>Insufficient message length validation for EAP-TLS messages</para></entry>
</row>
<row>
<entry><ulink url="http://security.freebsd.org/advisories/FreeBSD-SA-12:08.linux.asc"
>SA-12:08.linux</ulink></entry>
<entry>22&nbsp;November&nbsp;2012</entry>
<entry><para>Linux compatibility layer input validation error</para></entry>
<entry>No security advisories to display.</entry>
<entry>&nbsp;</entry>
<entry>&nbsp;</entry>
</row>
</tbody>
</tgroup>
@@ -168,33 +118,7 @@
<sect1 id="late-news">
<title>Late-Breaking News</title>
<para>[November 2, 2012] The current &man.mfi.4; driver has an
overflow bug when handling disks larger than 2^32 sectors in
SYSPD volumes, also known as JBODs, which will cause data
corruption. This bug has been fixed on this &os;-CURRENT but
was too late for inclusion in this release. An Errata Notice
for &release.current; is planned.</para>
<para>No news items available.</para>
<para>[December 25, 2012] The Installtion Instructions had the
following wrong information about upgrading procedure. All of
them have been fixed in the online version.</para>
<itemizedlist>
<listitem>
<para>The link URL of <quote>upgrading section in the Release
Notes</quote>, branch names where upcoming Security
Advisories or Errata Notices will be applied, and a
command line argument of &man.freebsd-update.8; were ones
for 9.0-RELEASE, not for &release.current;.</para>
</listitem>
<listitem>
<para>The list of releases supported by &man.freebsd-update.8;
utility were incorrect. For 9.X, The following versions are
supported: <literal>9.0-RELEASE</literal>,
<literal>9.1-BETA1</literal>, and
<literal>9.1-RC[123]</literal>.</para>
</listitem>
</itemizedlist>
</sect1>
</article>
@@ -14,7 +14,7 @@
<pubdate>$FreeBSD$</pubdate>
<copyright>
<year>2012</year>
<year>2013</year>
<holder role="mailto:[email protected]">The &os; Documentation Project</holder>
</copyright>
@@ -51,7 +51,7 @@
<para>If you are upgrading from a previous release of &os;, please
read <ulink
url="http://www.FreeBSD.org/releases/9.1R/relnotes-detailed.html#upgrade">upgrading
url="http://www.FreeBSD.org/releases/9.2R/relnotes-detailed.html#upgrade">upgrading
section in the Release Notes</ulink> for notable
incompatibilities carefully.</para>
@@ -63,10 +63,15 @@
<ulink url="&url.books.handbook;/synching.html"></ulink> and
<ulink url="&url.books.handbook;/makeworld.html"></ulink>.</para>
<para>For SVN use the <filename>releng/9.1</filename> branch
<para>For SVN use the <filename>releng/9.2</filename> branch
which will be where any upcoming Security Advisories or Errata
Notices will be applied. The branch tag to use for updating
the source is <literal>RELENG_9_1</literal> for CVS.</para>
Notices will be applied.</para>
<note>
<para>CVS and cvsup are both deprecated, and not supported
methods for updating the <filename role="directory">src/</filename>
tree.</para>
</note>
</sect2>
<sect2>
@@ -76,17 +81,10 @@
upgrades of &arch.i386; and &arch.amd64; systems running
earlier FreeBSD releases. Systems running
<literal>7.[34]-RELEASE</literal>,
<literal>8.[12]-RELEASE</literal>,
<literal>8.[1234]-RELEASE</literal>,
<literal>9.0-RELEASE</literal>,
<literal>9.1-BETA1</literal>, or
<literal>9.1-RC[123]</literal> can upgrade as follows:</para>
<para>First, ensure that your current system is up to date; a
change was recently made to &man.freebsd-update.8; (Errata
Notice <ulink
url="http://security.FreeBSD.org/advisories/FreeBSD-EN-12:01.freebsd-update.asc">FreeBSD-EN-12:01.freebsd-update</ulink>)
which is needed in order to upgrade to &os;
&release.current;.</para>
<literal>9.1-RELEASE</literal>, or
<literal>9.2-RC[1234]</literal> can upgrade as follows:</para>
<screen>&prompt.root; freebsd-update fetch
&prompt.root; freebsd-update install</screen>
@@ -96,7 +94,7 @@
&man.freebsd-update.8; will ask for help in merging
configuration files.</para>
<screen>&prompt.root; freebsd-update upgrade -r 9.1-RELEASE</screen>
<screen>&prompt.root; freebsd-update upgrade -r 9.2-RELEASE</screen>
<para>Due to changes in the way that &os; is packaged on the
release media, two complications may arise in this process if
@@ -14,7 +14,7 @@
<pubdate>$FreeBSD$</pubdate>
<copyright>
<year>2012</year>
<year>2013</year>
<holder role="mailto:[email protected]">The &os; Documentation Project</holder>
</copyright>
File diff suppressed because it is too large. Load diff
+5 -5
View File
@@ -6,18 +6,18 @@
<!-- Version of the OS we're describing. This needs to be updated
with each new release. -->
<!ENTITY release.current "9.1-RELEASE">
<!ENTITY release.current "9.2-RELEASE">
<!-- The previous version used for comparison in the "What's New"
section. For -CURRENT, we might point back to the last
branchpoint. -->
<!ENTITY release.prev "9.0-RELEASE">
<!ENTITY release.prev "9.1-RELEASE">
<!-- The next version to be released, usually used for snapshots. -->
<!ENTITY release.next "9.2-RELEASE">
<!ENTITY release.next "9.3-RELEASE">
<!-- The name of this branch. -->
<!ENTITY release.branch "9.1-STABLE">
<!ENTITY release.branch "9.2-STABLE">
<!-- The URL for obtaining this version of FreeBSD. -->
<!ENTITY release.url "http://www.FreeBSD.org/releases/">
@@ -48,7 +48,7 @@
<!ENTITY release.manpath.xorg "7.5.2">
<!ENTITY release.manpath.netbsd "6.0">
<!ENTITY release.manpath.freebsd-ports "Ports">
<!ENTITY release.manpath.freebsd "9.1-RELEASE">
<!ENTITY release.manpath.freebsd "9.2-RELEASE">
<!-- Text constants which probably don't need to be changed.-->
+3
View File
@@ -63,10 +63,13 @@ if [ $bootable = yes ]; then
if [ -s $BASE/boot/mfsroot.gz ]; then
cp $BASE/boot/mfsroot.gz $MNT/boot
fi
cp $BASE/boot/color.4th $MNT/boot
cp $BASE/boot/support.4th $MNT/boot
cp $BASE/boot/check-password.4th $MNT/boot
cp $BASE/boot/screen.4th $MNT/boot
mv $MNT/boot/loader.efi $MNT/efi/boot/bootia64.efi
echo kern.cam.boot_delay=\"3000\" >> $MNT/boot/loader.conf
echo vfs.root.mountfrom=\"cd9660:iso9660/$LABEL\" >> $MNT/boot/loader.conf
umount $MNT
mdconfig -d -u $md
BOOTOPTS="-o bootimage=i386;$EFIPART -o no-emul-boot"
+1
View File
@@ -64,6 +64,7 @@ MAN+= ../forth/delay.4th.8
MAN+= ../forth/loader.conf.5
MAN+= ../forth/loader.4th.8
MAN+= ../forth/menu.4th.8
MAN+= ../forth/menusets.4th.8
MAN+= ../forth/version.4th.8
.endif
+9 -6
View File
@@ -181,7 +181,7 @@ gpt_checkhdr(struct gpt_hdr *hdr, uint64_t lba_self, uint64_t lba_last,
}
hdr->hdr_entries = le32toh(hdr->hdr_entries);
hdr->hdr_entsz = le32toh(hdr->hdr_entsz);
if (hdr->hdr_entries < 128 ||
if (hdr->hdr_entries == 0 ||
hdr->hdr_entsz < sizeof(struct gpt_ent) ||
sectorsize % hdr->hdr_entsz != 0) {
DEBUG("invalid entry size or number of entries");
@@ -203,11 +203,14 @@ gpt_checktbl(const struct gpt_hdr *hdr, u_char *tbl, size_t size,
int i, cnt;
cnt = size / hdr->hdr_entsz;
/* Check CRC only when buffer size is enough for table. */
if (hdr->hdr_entries <= cnt &&
crc32(tbl, size) != hdr->hdr_crc_table) {
DEBUG("GPT table's CRC doesn't match");
return (-1);
if (hdr->hdr_entries <= cnt) {
cnt = hdr->hdr_entries;
/* Check CRC only when buffer size is enough for table. */
if (hdr->hdr_crc_table !=
crc32(tbl, hdr->hdr_entries * hdr->hdr_entsz)) {
DEBUG("GPT table's CRC doesn't match");
return (-1);
}
}
ent = (struct gpt_ent *)tbl;
for (i = 0; i < cnt; i++, ent++) {
+93 -4
View File
@@ -1,6 +1,6 @@
\ Copyright (c) 2003 Scott Long <[email protected]>
\ Copyright (c) 2003 Aleksander Fafula <[email protected]>
\ Copyright (c) 2006-2011 Devin Teske <devinteske@hotmail.com>
\ Copyright (c) 2006-2013 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@@ -28,7 +28,6 @@
marker task-beastie.4th
include /boot/color.4th
include /boot/delay.4th
variable logoX
@@ -124,6 +123,76 @@ variable logoY
0 25 at-xy
;
: tribute-art ( x y -- ) \ see tribute[bw]-logo
\ Disable the brand art (we're going to use that space)
s" set loader_brand=none" evaluate
\ Blank out the frame of the menu and move the title to left
s" set loader_menu_title=" evaluate
s" set loader_menu_frame=none" evaluate
\ Move the menu to the center of the screen
s" set loader_menu_x=26" evaluate
s" set loader_menu_y=12" evaluate
s" set loader_menu_timeout_x=21" evaluate
s" set loader_menu_timeout_y=24" evaluate
2 - swap 39 - swap \ top-left (see `fbsdbw-logo' comments above)
2dup at-xy 11 spaces ." ,d b." 1+
2dup at-xy ." ,d88] [88b." 1+
2dup at-xy ." ,d888P" 34 emit ." ,d88b. " 34 emit ." Y888b." 1+
2dup at-xy ." , <888P" 34 emit ." ,dP" 34 emit ." ,db." 34 emit
." Yb. " 34 emit ." Y888> ," 1+
2dup at-xy ." <88b.~ ,d888 " 34 emit ." YP" 34 emit
." 888b. ~,d88>" 1+
2dup at-xy ." ," 34 emit ." Y888888P" 34 emit ." ,db.,db." 34 emit
." Y888888P" 34 emit ." ," 1+
2dup at-xy ." <88b." 34 emit ." YP" 34 emit ." _ " 34 emit
." YP" 34 emit 34 emit ." YP" 34 emit ." _ " 34 emit
." YP" 34 emit ." ,d88>" 1+
2dup at-xy ." " 34 emit ." Y88b.,dP Yb.,d88P" 34 emit 1+
at-xy ." " 34 emit ." YP" 34 emit ." " 34 emit
." YP" 34 emit ." "
;
: tribute-text ( x y -- ) \ see tribute[bw]-logo
swap 2 - swap \ beastie adjustment (see `fbsdbw-logo' comments above)
2dup at-xy ." CEO Workstation" 1+
1+
2dup at-xy ." Nakatomi Socrates FreeBSD 9.2" 1+
2dup at-xy ." Z-Level Central Core" 1+
1+
at-xy ." Preliminary Clearance Approved."
;
: tribute-logo ( x y -- ) \ color Socrates tribute (16 rows x 32 columns)
\ Produce the tribute art in bright green
2dup at-xy ." " 2dup tribute-art ." "
\ Produce the tribute text in regular green
2dup at-xy ." " 2dup tribute-text ." "
\ Distinguish the ``Free'' in tribute-text
2 + swap 16 + swap at-xy ." Free"
\ Put the cursor back at the bottom
0 25 at-xy
;
: tributebw-logo ( x y -- ) \ Socrates tribute (16 rows x 32 columns)
\ Produce the tribute art and text
2dup tribute-art tribute-text
\ Put the cursor back at the bottom
0 25 at-xy
;
: orb-logo ( x y -- ) \ color Orb mascot (15 rows x 30 columns)
3 + \ beastie adjustment (see `fbsdbw-logo' comments above)
@@ -182,8 +251,10 @@ variable logoY
\ beastie Color ``Helper Daemon'' mascot (19 rows x 34 columns)
\ beastiebw B/W ``Helper Daemon'' mascot (19 rows x 34 columns)
\ fbsdbw "FreeBSD" logo in B/W (13 rows x 21 columns)
\ orb Color ``Orb'' mascot (15 rows x 30 columns)
\ orbbw B/W ``Orb'' mascot (15 rows x 32 columns) (default)
\ orb Color ``Orb'' mascot (15 rows x 30 columns) (2nd default)
\ orbbw B/W ``Orb'' mascot (15 rows x 32 columns)
\ tribute Color ``Tribute'' (must fit 19 rows x 34 columns) (default)
\ tributebw B/W ``Tribute'' (must fit 19 rows x 34 columns)
\
\ NOTE: Setting `loader_logo' to an undefined value (such as "none") will
\ prevent beastie from being drawn.
@@ -231,6 +302,24 @@ variable logoY
logoX @ logoY @ orbbw-logo
2drop exit
then
2dup s" tribute" compare-insensitive 0= if
logoX @ logoY @
s" tribute-logo" sfind if
execute
else
drop orb-logo
then
2drop exit
then
2dup s" tributebw" compare-insensitive 0= if
logoX @ logoY @
s" tributebw-logo" sfind if
execute
else
drop orbbw-logo
then
2drop exit
then
2drop
;
+5 -4
View File
@@ -1,4 +1,4 @@
.\" Copyright (c) 2011 Devin Teske
.\" Copyright (c) 2011-2012 Devin Teske
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -94,8 +94,9 @@ The
variable can be configured in
.Xr loader.conf 5
to the number of seconds you would like to delay loading the boot menu.
During the delay the user can press Ctrl-C to fall back to autoboot or ENTER
to proceed.
During the delay the user can press Ctrl-C to fall back to
.Ic autoboot
or ENTER to proceed.
The default behavior is to not delay.
.El
.Pp
@@ -168,4 +169,4 @@ set of commands was written by
.An Scott Long Aq [email protected] ,
.An Aleksander Fafula Aq [email protected]
and
.An Devin Teske Aq devinteske@hotmail.com .
.An Devin Teske Aq dteske@FreeBSD.org .
+1 -1
View File
@@ -1,4 +1,4 @@
\ Copyright (c) 2006-2011 Devin Teske <devinteske@hotmail.com>
\ Copyright (c) 2006-2011 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
+1 -1
View File
@@ -122,4 +122,4 @@ The
.Nm
set of commands was written by
.An -nosplit
.An Devin Teske Aq devinteske@hotmail.com .
.An Devin Teske Aq dteske@FreeBSD.org .
+28 -14
View File
@@ -1,4 +1,4 @@
\ Copyright (c) 2006-2011 Devin Teske <devinteske@hotmail.com>
\ Copyright (c) 2006-2012 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@@ -74,7 +74,7 @@ variable readlen \ input length
again
;
: read ( -- String prompt )
: read ( String prompt -- )
0 25 at-xy \ Move the cursor to the bottom-left
dup 1+ read-start ! \ Store X offset after the prompt
@@ -134,23 +134,37 @@ variable readlen \ input length
: check-password ( -- )
\ Exit if a password was not set
s" password" getenv dup -1 = if
drop exit
\ Do not allow the user to proceed beyond this point if a boot-lock
\ password has been set (preventing even boot from proceeding)
s" bootlock_password" getenv dup -1 <> if
begin
s" Boot Password: " read ( prompt -- )
2dup readval readlen @ compare 0<>
while
3000 ms ." loader: incorrect password" 10 emit
repeat
2drop ( c-addr/u )
else
drop ( -1 ) \ getenv cruft
then
begin \ Loop as long as it takes to get the right password
\ Exit if a password was not set
s" password" getenv -1 = if exit else drop then
s" Password: " \ Output a prompt for a password
read \ Read the user's input until Enter
\ We should prevent the user from visiting the menu or dropping to the
\ interactive loader(8) prompt, but still allow the machine to boot...
0 autoboot
\ Only reached if autoboot fails for any reason (including if/when
\ the user aborts/escapes the countdown sequence leading to boot).
s" password" getenv
begin
s" Password: " read ( prompt -- )
2dup readval readlen @ compare 0= if
2drop exit \ Correct password
then
\ Bad Password
3000 ms
." loader: incorrect password" 10 emit
again \ Not the right password; repeat
3000 ms ." loader: incorrect password" 10 emit
again
;
+35 -19
View File
@@ -1,4 +1,4 @@
.\" Copyright (c) 2011 Devin Teske
.\" Copyright (c) 2011-2012 Devin Teske
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd May 18, 2011
.Dd December 10, 2012
.Dt CHECK-PASSWORD.4TH 8
.Os
.Sh NAME
@@ -33,7 +33,8 @@
.Sh DESCRIPTION
The file that goes by the name of
.Nm
is a set of commands designed to prevent booting without the proper password.
is a set of commands designed to either prevent booting or prevent modification
of boot options without an appropriately configured password.
The commands of
.Nm
by themselves are not enough for most uses.
@@ -57,30 +58,36 @@ The commands provided by it are:
.Pp
.Bl -tag -width disable-module_module -compact -offset indent
.It Ic check-password
Once called, the user cannot continue until the correct password is entered.
If the user enters the correct password the function returns.
Dual-purpose function that can either protect the interactive boot menu or
prevent boot without password (separately).
.Pp
The password that is required is configured by setting the
.Ic password
variable in
.Xr loader.conf 5 .
First checks
.Va bootlock_password
and if-set, the user cannot continue until the correct password is entered.
.Pp
Subsequent calls after a successful password
has been entered will not cause reprompting
\(em the function will silently return.
Next checks
.Va password
and if-set, tries to
.Ic autoboot
and only prompts for password on failure or user-interrupt.
See
.Xr loader.conf 5
for additional information.
.El
.Pp
The environment variables that effect its behavior are:
.Bl -tag -width bootfile -offset indent
.Bl -tag -width bootlock_password -offset indent
.It Va bootlock_password
Sets the bootlock password (up to 16 characters long) that is required by
.Ic check-password
to be entered before the system is allowed to boot.
.It Va password
Sets the password (up to 16 characters long) that is required by
.Ic check-password
to be entered before the system is allowed to boot. If unset (default) or NULL,
.Ic check-password
will silently abort.
before the user is allowed to visit the boot menu.
.El
.Sh FILES
.Bl -tag -width /boot/loader.4th -compact
.Bl -tag -width /boot/check-password.4th -compact
.It Pa /boot/loader
The
.Xr loader 8 .
@@ -101,11 +108,20 @@ check-password
.Ed
.Pp
Set a password in
.Xr loader.conf 5 :
.Xr loader.conf 5
to prevent modification of boot options:
.Pp
.Bd -literal -offset indent -compact
password="abc123"
.Ed
.Pp
Set a password in
.Xr loader.conf 5
to prevent booting without password:
.Pp
.Bd -literal -offset indent -compact
bootlock_password="boot"
.Ed
.Sh SEE ALSO
.Xr loader.conf 5 ,
.Xr loader 8 ,
@@ -120,4 +136,4 @@ The
.Nm
set of commands was written by
.An -nosplit
.An Devin Teske Aq devinteske@hotmail.com .
.An Devin Teske Aq dteske@FreeBSD.org .
+9 -8
View File
@@ -1,4 +1,4 @@
\ Copyright (c) 2011 Devin Teske <devinteske@hotmail.com>
\ Copyright (c) 2011-2013 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@@ -26,23 +26,24 @@
marker task-color.4th
\ This function returns TRUE if the `loader_color' environment variable is set
\ to YES, yes, or 1. Otherwise, FALSE is returned.
\ This function returns FALSE if the `loader_color' environment variable is set
\ to NO, no, or 0. Otherwise, TRUE is returned (unless booting serial).
\
: loader_color? ( -- N )
s" loader_color" getenv dup -1 <> if
2dup s" YES" compare-insensitive 0= if
2dup s" NO" compare-insensitive 0= if
2drop
TRUE exit
FALSE exit
then
2dup s" 1" compare 0= if
2dup s" 0" compare 0= if
2drop
TRUE exit
FALSE exit
then
drop
then
drop
drop FALSE exit
boot_serial? if FALSE else TRUE then
;
+12 -13
View File
@@ -1,4 +1,4 @@
.\" Copyright (c) 2011 Devin Teske
.\" Copyright (c) 2011-2013 Devin Teske
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd May 18, 2011
.Dd August 6, 2013
.Dt COLOR.4TH 8
.Os
.Sh NAME
@@ -50,33 +50,33 @@ through the command:
.Dl include color.4th
.Pp
This line is present in
.Pa /boot/beastie.4th
.Pa /boot/loader.4th
file, so it is not needed (and should not be re-issued) in a normal setup.
.Pp
The commands provided by it are:
.Pp
.Bl -tag -width disable-module_module -compact -offset indent
.It Ic loader_color?
Returns TRUE if the
Returns FALSE if the
.Ic loader_color
environment variable is set to
.Dq YES
.Dq NO
(case-insensitive) or
.Dq 1 .
Otherwise returns FALSE.
.Dq 0 .
Otherwise returns TRUE
.Pq unless booting serial .
.El
.Pp
The environment variables that effect its behavior are:
.Bl -tag -width bootfile -offset indent
.It Va loader_color
If set to
.Dq YES
.Dq NO
(case-insensitive) or
.Dq 1 ,
.Dq 0 ,
causes
.Ic loader_color?
to return TRUE, indicating to many other modules that color should be used
whenever/wherever possible.
to return FALSE, indicating to many modules that color should not be used.
.El
.Sh FILES
.Bl -tag -width /boot/loader.4th -compact
@@ -102,7 +102,6 @@ loader_color="YES"
.Sh SEE ALSO
.Xr loader.conf 5 ,
.Xr loader 8 ,
.Xr beastie.4th 8 ,
.Xr loader.4th 8
.Sh HISTORY
The
@@ -114,4 +113,4 @@ The
.Nm
set of commands was written by
.An -nosplit
.An Devin Teske Aq devinteske@hotmail.com .
.An Devin Teske Aq dteske@FreeBSD.org .
+1 -1
View File
@@ -1,4 +1,4 @@
\ Copyright (c) 2008-2011 Devin Teske <devinteske@hotmail.com>
\ Copyright (c) 2008-2011 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
+1 -1
View File
@@ -123,4 +123,4 @@ The
.Nm
set of commands was written by
.An -nosplit
.An Devin Teske Aq devinteske@hotmail.com .
.An Devin Teske Aq dteske@FreeBSD.org .
+16
View File
@@ -12,6 +12,11 @@ variable rt_el
variable rb_el
variable fill
\ ASCII frames (used when serial console is detected)
45 constant ascii_dash
124 constant ascii_pipe
43 constant ascii_plus
s" arch-pc98" environment? [if]
\ Single frames
149 constant sh_el
@@ -63,7 +68,17 @@ s" arch-pc98" environment? [if]
loop
;
: f_ascii ( -- ) ( -- ) \ set frames to ascii
ascii_dash h_el !
ascii_pipe v_el !
ascii_plus lt_el !
ascii_plus lb_el !
ascii_plus rt_el !
ascii_plus rb_el !
;
: f_single ( -- ) \ set frames to single
boot_serial? if f_ascii exit then
sh_el h_el !
sv_el v_el !
slt_el lt_el !
@@ -73,6 +88,7 @@ s" arch-pc98" environment? [if]
;
: f_double ( -- ) \ set frames to double
boot_serial? if f_ascii exit then
dh_el h_el !
dv_el v_el !
dlt_el lt_el !
+13
View File
@@ -40,6 +40,7 @@ s" arch-i386" environment? [if] [if]
2048 dictincrease ! \ 2048 additional cells each time
include /boot/support.4th
include /boot/color.4th
only forth also support-functions also builtins definitions
@@ -59,11 +60,23 @@ only forth also support-functions also builtins definitions
else
drop
then
s" menusets-unset"
sfind if
execute
else
drop
then
;
: boot
0= if ( interpreted ) get_arguments then
loader_color? if
." Booting..." cr
else
." Booting..." cr
then
\ Unload only if a path was passed
dup if
>r over r> swap
+1 -1
View File
@@ -99,7 +99,7 @@ This
is the command used in the default
.Pa /boot/loader.rc
file, and it uses the
.Pa autoboot
.Ic autoboot
command (see
.Xr loader 8 ) ,
so it can be stopped for further interaction with
+1 -1
View File
@@ -48,7 +48,7 @@ bitmap_type="splash_image_data" # and place it on the module_path
# escape to the loader prompt, set to
# "NO" to disable autobooting
#beastie_disable="NO" # Turn the beastie boot menu on and off
#loader_logo="fbsdbw" # Desired logo: fbsdbw, beastiebw, beastie, none
#loader_logo="orbbw" # Desired logo: orbbw, orb, fbsdbw, beastiebw, beastie, none
#comconsole_speed="9600" # Set the current serial console speed
#console="vidconsole" # A comma separated list of console(s)
#currdev="disk1s1a" # Set the current device
+18 -3
View File
@@ -23,7 +23,7 @@
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd July 20, 2011
.Dd August 6, 2013
.Dt LOADER.CONF 5
.Os
.Sh NAME
@@ -113,8 +113,23 @@ that contains a kernel.
.It Ar kernel_options
Flags to be passed to the kernel.
.It Ar password
Protect boot menu with a password without interrupting
.Ic autoboot
process.
The password should be in clear text format.
If a password is set, boot menu will not appear until any key is pressed during
countdown period specified by
.Va autoboot_delay
variable or
.Ic autoboot
process fails.
In both cases user should provide specified password to be able to access boot
menu.
.It Ar bootlock_password
Provides a password to be required by check-password before execution is
allowed to continue.
The password should be in clear text format.
If a password is set, the user must provide specified password to boot.
.It Ar verbose_loading
If set to
.Dq YES ,
@@ -230,8 +245,8 @@ and
.Dq Li none .
.It Va loader_color
If set to
.Dq YES ,
the beastie boot menu will be displayed using ANSI coloring where possible.
.Dq NO ,
the beastie boot menu will be displayed without ANSI coloring.
.El
.Sh FILES
.Bl -tag -width /boot/defaults/loader.conf -compact
+4
View File
@@ -10,5 +10,9 @@ start
\ Tests for password -- executes autoboot first if a password was defined
check-password
\ Uncomment to enable boot menu
\ include /boot/beastie.4th
\ beastie-start
\ Unless set otherwise, autoboot is automatic at this point
+219 -63
View File
@@ -1,4 +1,4 @@
\ Copyright (c) 2006-2011 Devin Teske <devinteske@hotmail.com>
\ Copyright (c) 2006-2012 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@@ -26,6 +26,60 @@
marker task-menu-commands.4th
include /boot/menusets.4th
variable kernel_state
variable root_state
\
\ Boot
\
: init_boot ( N -- N )
dup
s" boot_single" getenv -1 <> if
drop ( n n c-addr -- n n ) \ unused
toggle_menuitem ( n n -- n n )
s" set menu_keycode[N]=115" \ base command to execute
else
s" set menu_keycode[N]=98" \ base command to execute
then
17 +c! \ replace 'N' with ASCII numeral
evaluate
;
\
\ Alternate Boot
\
: init_altboot ( N -- N )
dup
s" boot_single" getenv -1 <> if
drop ( n c-addr -- n ) \ unused
toggle_menuitem ( n -- n )
s" set menu_keycode[N]=109" \ base command to execute
else
s" set menu_keycode[N]=115" \ base command to execute
then
17 +c! \ replace 'N' with ASCII numeral
evaluate
;
: altboot ( -- )
s" boot_single" 2dup getenv -1 <> if
drop ( c-addr/u c-addr -- c-addr/u ) \ unused
unsetenv ( c-addr/u -- )
else
2drop ( c-addr/u -- ) \ unused
s" set boot_single=YES" evaluate
then
0 boot ( state -- )
;
\
\ ACPI
\
: acpi_enable ( -- )
s" set acpi_load=YES" evaluate \ XXX deprecated but harmless
s" set hint.acpi.0.disabled=0" evaluate
@@ -53,39 +107,51 @@ marker task-menu-commands.4th
TRUE \ loop menu again
;
\
\ Safe Mode
\
: safemode_enabled? ( -- flag )
s" kern.smp.disabled" getenv -1 <> dup if
swap drop ( c-addr flag -- flag )
then
;
: safemode_enable ( -- )
s" set kern.smp.disabled=1" evaluate
s" set hw.ata.ata_dma=0" evaluate
s" set hw.ata.atapi_dma=0" evaluate
s" set hw.ata.wc=0" evaluate
s" set hw.eisa_slots=0" evaluate
s" set kern.eventtimer.periodic=1" evaluate
s" set kern.geom.part.check_integrity=0" evaluate
;
: safemode_disable ( -- )
s" kern.smp.disabled" unsetenv
s" hw.ata.ata_dma" unsetenv
s" hw.ata.atapi_dma" unsetenv
s" hw.ata.wc" unsetenv
s" hw.eisa_slots" unsetenv
s" kern.eventtimer.periodic" unsetenv
s" kern.geom.part.check_integrity" unsetenv
;
: init_safemode ( N -- N )
safemode_enabled? if
toggle_menuitem ( n -- n )
then
;
: toggle_safemode ( N -- N TRUE )
toggle_menuitem
\ Now we're going to make the change effective
s" toggle_stateN @" \ base name of toggle state var
-rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral
evaluate 0= if
s" hint.apic.0.disabled" unsetenv
s" hw.ata.ata_dma" unsetenv
s" hw.ata.atapi_dma" unsetenv
s" hw.ata.wc" unsetenv
s" hw.eisa_slots" unsetenv
s" hint.kbdmux.0.disabled" unsetenv
dup toggle_stateN @ 0= if
safemode_disable
else
\
\ Toggle ACPI elements if necessary
\
acpipresent? if acpienabled? if
menuacpi @ dup 0<> if
toggle_menuitem ( N -- N )
then
drop
acpi_disable
then then
s" set hint.apic.0.disabled=1" evaluate
s" set hw.ata.ata_dma=0" evaluate
s" set hw.ata.atapi_dma=0" evaluate
s" set hw.ata.wc=0" evaluate
s" set hw.eisa_slots=0" evaluate
s" set hint.kbdmux.0.disabled=1" evaluate
safemode_enable
then
menu-redraw
@@ -93,42 +159,88 @@ marker task-menu-commands.4th
TRUE \ loop menu again
;
\
\ Single User Mode
\
: singleuser_enabled? ( -- flag )
s" boot_single" getenv -1 <> dup if
swap drop ( c-addr flag -- flag )
then
;
: singleuser_enable ( -- )
s" set boot_single=YES" evaluate
;
: singleuser_disable ( -- )
s" boot_single" unsetenv
;
: init_singleuser ( N -- N )
singleuser_enabled? if
toggle_menuitem ( n -- n )
then
;
: toggle_singleuser ( N -- N TRUE )
toggle_menuitem
menu-redraw
\ Now we're going to make the change effective
s" toggle_stateN @" \ base name of toggle state var
-rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral
evaluate 0= if
s" boot_single" unsetenv
dup toggle_stateN @ 0= if
singleuser_disable
else
s" set boot_single=YES" evaluate
singleuser_enable
then
TRUE \ loop menu again
;
\
\ Verbose Boot
\
: verbose_enabled? ( -- flag )
s" boot_verbose" getenv -1 <> dup if
swap drop ( c-addr flag -- flag )
then
;
: verbose_enable ( -- )
s" set boot_verbose=YES" evaluate
;
: verbose_disable ( -- )
s" boot_verbose" unsetenv
;
: init_verbose ( N -- N )
verbose_enabled? if
toggle_menuitem ( n -- n )
then
;
: toggle_verbose ( N -- N TRUE )
toggle_menuitem
menu-redraw
\ Now we're going to make the change effective
s" toggle_stateN @" \ base name of toggle state var
-rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral
evaluate 0= if
s" boot_verbose" unsetenv
dup toggle_stateN @ 0= if
verbose_disable
else
s" set boot_verbose=YES" evaluate
verbose_enable
then
TRUE \ loop menu again
;
\
\ Escape to Prompt
\
: goto_prompt ( N -- N FALSE )
s" set autoboot_delay=NO" evaluate
@@ -141,50 +253,94 @@ marker task-menu-commands.4th
FALSE \ exit the menu
;
\
\ Cyclestate (used by kernel/root below)
\
: init_cyclestate ( N K -- N )
over cycle_stateN ( n k -- n k addr )
begin
tuck @ ( n k addr -- n addr k c )
over <> ( n addr k c -- n addr k 0|-1 )
while
rot ( n addr k -- addr k n )
cycle_menuitem
swap rot ( addr k n -- n k addr )
repeat
2drop ( n k addr -- n )
;
\
\ Kernel
\
: init_kernel ( N -- N )
kernel_state @ ( n -- n k )
init_cyclestate ( n k -- n )
;
: cycle_kernel ( N -- N TRUE )
cycle_menuitem
menu-redraw
\ Now we're going to make the change effective
s" cycle_stateN" \ base name of array state var
-rot 2dup 11 + c! rot \ replace 'N' with ASCII numeral
evaluate \ translate name into address
@ \ dereference address into value
dup cycle_stateN @
dup kernel_state ! \ save a copy for re-initialization
48 + \ convert to ASCII numeral
\ Since we are [in this file] going to override the standard `boot'
\ routine with a custom one, you should know that we use $kernel
\ when referencing the desired kernel. Set $kernel below.
s" set kernel=${kernel_prefix}${kernel[N]}${kernel_suffix}"
\ command to assemble full kernel-path
-rot tuck 36 + c! swap \ replace 'N' with array index value
evaluate \ sets $kernel to full kernel-path
36 +c! \ replace 'N' with ASCII numeral
evaluate \ sets $kernel to full kernel-path
TRUE \ loop menu again
;
\
\ Root
\
: init_root ( N -- N )
root_state @ ( n -- n k )
init_cyclestate ( n k -- n )
;
: cycle_root ( N -- N TRUE )
cycle_menuitem
menu-redraw
\ Now we're going to make the change effective
s" cycle_stateN" \ base name of array state var
-rot 2dup 11 + c! rot \ replace 'N' with ASCII numeral
evaluate \ translate name into address
@ \ dereference address into value
dup cycle_stateN @
dup root_state ! \ save a copy for re-initialization
48 + \ convert to ASCII numeral
\ Since we are [in this file] going to override the standard `boot'
\ routine with a custom one, you should know that we use $root when
\ booting. Set $root below.
s" set root=${root_prefix}${root[N]}${root_prefix}"
\ command to assemble full kernel-path
-rot tuck 30 + c! swap \ replace 'N' with array index value
evaluate \ sets $kernel to full kernel-path
s" set root=${root_prefix}${root[N]}${root_suffix}"
30 +c! \ replace 'N' with ASCII numeral
evaluate \ sets $root to full root-path
TRUE \ loop menu again
;
\
\ Menusets
\
: goto_menu ( N M -- N TRUE )
menu-unset
menuset-loadsetnum ( n m -- n )
menu-redraw
TRUE \ Loop menu again
;
\
\ Defaults
\
: set_default_boot_options ( N -- N TRUE )
acpi_enable
safemode_disable
singleuser_disable
verbose_disable
2 goto_menu
;
+285 -237
View File
@@ -1,6 +1,6 @@
\ Copyright (c) 2003 Scott Long <[email protected]>
\ Copyright (c) 2003 Aleksander Fafula <[email protected]>
\ Copyright (c) 2006-2011 Devin Teske <devinteske@hotmail.com>
\ Copyright (c) 2006-2013 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@@ -35,6 +35,8 @@ f_double \ Set frames to double (see frames.4th). Replace with
\ f_single if you want single frames.
46 constant dot \ ASCII definition of a period (in decimal)
5 constant menu_default_x \ default column position of timeout
10 constant menu_default_y \ default row position of timeout msg
4 constant menu_timeout_default_x \ default column position of timeout
23 constant menu_timeout_default_y \ default row position of timeout msg
10 constant menu_timeout_default \ default timeout (in seconds)
@@ -76,6 +78,16 @@ variable menu_timeout \ determined configurable delay duration
variable menu_timeout_x \ column position of timeout message
variable menu_timeout_y \ row position of timeout message
\ Menu initialization status variables
variable init_state1
variable init_state2
variable init_state3
variable init_state4
variable init_state5
variable init_state6
variable init_state7
variable init_state8
\ Boolean option status variables
variable toggle_state1
variable toggle_state2
@@ -106,6 +118,52 @@ create init_text6 255 allot
create init_text7 255 allot
create init_text8 255 allot
: +c! ( N C-ADDR/U K -- C-ADDR/U )
3 pick 3 pick ( n c-addr/u k -- n c-addr/u k n c-addr )
rot + c! ( n c-addr/u k n c-addr -- n c-addr/u )
rot drop ( n c-addr/u -- c-addr/u )
;
: menukeyN ( N -- ADDR ) s" menukeyN" 7 +c! evaluate ;
: init_stateN ( N -- ADDR ) s" init_stateN" 10 +c! evaluate ;
: toggle_stateN ( N -- ADDR ) s" toggle_stateN" 12 +c! evaluate ;
: cycle_stateN ( N -- ADDR ) s" cycle_stateN" 11 +c! evaluate ;
: init_textN ( N -- C-ADDR ) s" init_textN" 9 +c! evaluate ;
: str_loader_menu_frame ( -- C-ADDR/U ) s" loader_menu_frame" ;
: str_loader_menu_title ( -- C-ADDR/U ) s" loader_menu_title" ;
: str_loader_menu_title_align ( -- C-ADDR/U ) s" loader_menu_title_align" ;
: str_loader_menu_x ( -- C-ADDR/U ) s" loader_menu_x" ;
: str_loader_menu_y ( -- C-ADDR/U ) s" loader_menu_y" ;
: str_loader_menu_timeout_x ( -- C-ADDR/U ) s" loader_menu_timeout_x" ;
: str_loader_menu_timeout_y ( -- C-ADDR/U ) s" loader_menu_timeout_y" ;
: str_menu_init ( -- C-ADDR/U ) s" menu_init" ;
: str_menu_timeout_command ( -- C-ADDR/U ) s" menu_timeout_command" ;
: str_menu_reboot ( -- C-ADDR/U ) s" menu_reboot" ;
: str_menu_acpi ( -- C-ADDR/U ) s" menu_acpi" ;
: str_menu_options ( -- C-ADDR/U ) s" menu_options" ;
: str_menu_optionstext ( -- C-ADDR/U ) s" menu_optionstext" ;
: str_menu_init[x] ( -- C-ADDR/U ) s" menu_init[x]" ;
: str_menu_command[x] ( -- C-ADDR/U ) s" menu_command[x]" ;
: str_menu_caption[x] ( -- C-ADDR/U ) s" menu_caption[x]" ;
: str_ansi_caption[x] ( -- C-ADDR/U ) s" ansi_caption[x]" ;
: str_menu_keycode[x] ( -- C-ADDR/U ) s" menu_keycode[x]" ;
: str_toggled_text[x] ( -- C-ADDR/U ) s" toggled_text[x]" ;
: str_toggled_ansi[x] ( -- C-ADDR/U ) s" toggled_ansi[x]" ;
: str_menu_caption[x][y] ( -- C-ADDR/U ) s" menu_caption[x][y]" ;
: str_ansi_caption[x][y] ( -- C-ADDR/U ) s" ansi_caption[x][y]" ;
: menu_init[x] ( N -- C-ADDR/U ) str_menu_init[x] 10 +c! ;
: menu_command[x] ( N -- C-ADDR/U ) str_menu_command[x] 13 +c! ;
: menu_caption[x] ( N -- C-ADDR/U ) str_menu_caption[x] 13 +c! ;
: ansi_caption[x] ( N -- C-ADDR/U ) str_ansi_caption[x] 13 +c! ;
: menu_keycode[x] ( N -- C-ADDR/U ) str_menu_keycode[x] 13 +c! ;
: toggled_text[x] ( N -- C-ADDR/U ) str_toggled_text[x] 13 +c! ;
: toggled_ansi[x] ( N -- C-ADDR/U ) str_toggled_ansi[x] 13 +c! ;
: menu_caption[x][y] ( N M -- C-ADDR/U ) str_menu_caption[x][y] 16 +c! 13 +c! ;
: ansi_caption[x][y] ( N M -- C-ADDR/U ) str_ansi_caption[x][y] 16 +c! 13 +c! ;
: arch-i386? ( -- BOOL ) \ Returns TRUE (-1) on i386, FALSE (0) otherwise.
s" arch-i386" environment? dup if
drop
@@ -162,30 +220,24 @@ create init_text8 255 allot
\ ASCII numeral equal to user-selected menu item must be on the stack.
\ We do not modify the stack, so the ASCII numeral is left on top.
s" init_textN" \ base name of buffer
-rot 2dup 9 + c! rot \ replace 'N' with ASCII num
evaluate c@ 0= if
dup init_textN c@ 0= if
\ NOTE: no need to check toggle_stateN since the first time we
\ are called, we will populate init_textN. Further, we don't
\ need to test whether menu_caption[x] (ansi_caption[x] when
\ loader_color=1) is available since we would not have been
\ loader_color?=1) is available since we would not have been
\ called if the caption was NULL.
\ base name of environment variable
dup ( n -- n n ) \ key pressed
loader_color? if
s" ansi_caption[x]"
ansi_caption[x]
else
s" menu_caption[x]"
menu_caption[x]
then
-rot 2dup 13 + c! rot \ replace 'x' with ASCII numeral
getenv dup -1 <> if
s" init_textN" \ base name of buffer
4 pick \ copy ASCII num to top
rot tuck 9 + c! swap \ replace 'N' with ASCII num
evaluate
2 pick ( n c-addr/u -- n c-addr/u n )
init_textN ( n c-addr/u n -- n c-addr/u c-addr )
\ now we have the buffer c-addr on top
\ ( followed by c-addr/u of current caption )
@@ -217,67 +269,49 @@ create init_text8 255 allot
\ negate the toggled state so that we reverse the flow on subsequent
\ calls.
s" toggle_stateN @" \ base name of toggle state var
-rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral
evaluate 0= if
dup toggle_stateN @ 0= if
\ state is OFF, toggle to ON
\ base name of toggled text var
dup ( n -- n n ) \ key pressed
loader_color? if
s" toggled_ansi[x]"
toggled_ansi[x]
else
s" toggled_text[x]"
toggled_text[x]
then
-rot 2dup 13 + c! rot \ replace 'x' with ASCII num
getenv dup -1 <> if
\ Assign toggled text to menu caption
\ base name of caption var
2 pick ( n c-addr/u -- n c-addr/u n ) \ key pressed
loader_color? if
s" ansi_caption[x]"
ansi_caption[x]
else
s" menu_caption[x]"
menu_caption[x]
then
4 pick \ copy ASCII num to top
rot tuck 13 + c! swap \ replace 'x' with ASCII num
setenv \ set new caption
setenv
else
\ No toggled text, keep the same caption
drop
drop ( n -1 -- n ) \ getenv cruft
then
true \ new value of toggle state var (to be stored later)
else
\ state is ON, toggle to OFF
s" init_textN" \ base name of initial text buffer
-rot 2dup 9 + c! rot \ replace 'N' with ASCII numeral
evaluate \ convert string to c-addr
count \ convert c-addr to c-addr/u
dup init_textN count ( n -- n c-addr/u )
\ base name of caption var
\ Assign init_textN text to menu caption
2 pick ( n c-addr/u -- n c-addr/u n ) \ key pressed
loader_color? if
s" ansi_caption[x]"
ansi_caption[x]
else
s" menu_caption[x]"
menu_caption[x]
then
4 pick \ copy ASCII num to top
rot tuck 13 + c! swap \ replace 'x' with ASCII numeral
setenv
setenv \ set new caption
false \ new value of toggle state var (to be stored below)
false \ new value of toggle state var (to be stored below)
then
\ now we'll store the new toggle state (on top of stack)
s" toggle_stateN" \ base name of toggle state var
3 pick \ copy ASCII numeral to top
rot tuck 12 + c! swap \ replace 'N' with ASCII numeral
evaluate \ convert string to addr
! \ store new value
over toggle_stateN !
;
: cycle_menuitem ( N -- N ) \ cycles through array of choices for a menuitem
@@ -285,28 +319,23 @@ create init_text8 255 allot
\ ASCII numeral equal to user-selected menu item must be on the stack.
\ We do not modify the stack, so the ASCII numeral is left on top.
s" cycle_stateN" \ base name of array state var
-rot 2dup 11 + c! rot \ replace 'N' with ASCII numeral
evaluate \ we now have a pointer to the proper variable
dup @ \ resolve the pointer (but leave it on the stack)
1+ \ increment the value
dup cycle_stateN dup @ 1+ \ get value and increment
\ Before assigning the (incremented) value back to the pointer,
\ let's test for the existence of this particular array element.
\ If the element exists, we'll store index value and move on.
\ Otherwise, we'll loop around to zero and store that.
dup 48 + \ duplicate Array index and convert to ASCII numeral
dup 48 + ( n addr k -- n addr k k' )
\ duplicate array index and convert to ASCII numeral
\ base name of array caption text
3 pick swap ( n addr k k' -- n addr k n k' ) \ (n,k') as (x,y)
loader_color? if
s" ansi_caption[x][y]"
ansi_caption[x][y]
else
s" menu_caption[x][y]"
menu_caption[x][y]
then
-rot tuck 16 + c! swap \ replace 'y' with Array index
4 pick rot tuck 13 + c! swap \ replace 'x' with menu choice
( n addr k n k' -- n addr k c-addr/u )
\ Now test for the existence of our incremented array index in the
\ form of $menu_caption[x][y] ($ansi_caption[x][y] with loader_color
@@ -315,48 +344,47 @@ create init_text8 255 allot
getenv dup -1 = if
\ No caption set for this array index. Loop back to zero.
drop ( getenv cruft )
drop ( incremented array index )
0 ( new array index that will be stored later )
drop ( n addr k -1 -- n addr k ) \ getenv cruft
drop 0 ( n addr k -- n addr 0 ) \ new value to store later
\ base name of caption var
2 pick [char] 0 ( n addr 0 -- n addr 0 n 48 ) \ (n,48) as (x,y)
loader_color? if
s" ansi_caption[x][0]"
ansi_caption[x][y]
else
s" menu_caption[x][0]"
menu_caption[x][y]
then
4 pick rot tuck 13 + c! swap \ replace 'x' with menu choice
( n addr 0 n 48 -- n addr 0 c-addr/u )
getenv dup -1 = if
\ This is highly unlikely to occur, but to make
\ sure that things move along smoothly, allocate
\ a temporary NULL string
s" "
drop ( n addr 0 -1 -- n addr 0 ) \ getenv cruft
s" " ( n addr 0 -- n addr 0 c-addr/u )
then
then
\ At this point, we should have the following on the stack (in order,
\ from bottom to top):
\
\ N - Ascii numeral representing the menu choice (inherited)
\ Addr - address of our internal cycle_stateN variable
\ N - zero-based number we intend to store to the above
\ C-Addr - string value we intend to store to menu_caption[x]
\ (or ansi_caption[x] with loader_color enabled)
\ n - Ascii numeral representing the menu choice (inherited)
\ addr - address of our internal cycle_stateN variable
\ k - zero-based number we intend to store to the above
\ c-addr/u - string value we intend to store to menu_caption[x]
\ (or ansi_caption[x] with loader_color enabled)
\
\ Let's perform what we need to with the above.
\ base name of menuitem caption var
\ Assign array value text to menu caption
4 pick ( n addr k c-addr/u -- n addr k c-addr/u n )
loader_color? if
s" ansi_caption[x]"
ansi_caption[x]
else
s" menu_caption[x]"
menu_caption[x]
then
6 pick rot tuck 13 + c! swap \ replace 'x' with menu choice
setenv \ set the new caption
setenv
swap ! \ update array state variable
swap ! ( n addr k -- n ) \ update array state variable
;
: acpipresent? ( -- flag ) \ Returns TRUE if ACPI is present, FALSE otherwise
@@ -384,21 +412,21 @@ create init_text8 255 allot
\ ACPI option is to be presented to the user, otherwise returns -1. Used
\ internally by menu-create, you need not (nor should you) call this directly.
\
: acpimenuitem ( -- C-Addr | -1 )
: acpimenuitem ( -- C-Addr/U | -1 )
arch-i386? if
acpipresent? if
acpienabled? if
loader_color? if
s" toggled_ansi[x]"
str_toggled_ansi[x]
else
s" toggled_text[x]"
str_toggled_text[x]
then
else
loader_color? if
s" ansi_caption[x]"
str_ansi_caption[x]
else
s" menu_caption[x]"
str_menu_caption[x]
then
then
else
@@ -416,10 +444,37 @@ create init_text8 255 allot
: menu-create ( -- )
\ Print the frame caption at (x,y)
s" loader_menu_title" getenv dup -1 = if
str_loader_menu_title getenv dup -1 = if
drop s" Welcome to FreeBSD"
then
24 over 2 / - 9 at-xy type
TRUE ( use default alignment )
str_loader_menu_title_align getenv dup -1 <> if
2dup s" left" compare-insensitive 0= if ( 1 )
2drop ( c-addr/u ) drop ( bool )
menuX @ menuY @ 1-
FALSE ( don't use default alignment )
else ( 1 ) 2dup s" right" compare-insensitive 0= if ( 2 )
2drop ( c-addr/u ) drop ( bool )
menuX @ 42 + 4 - over - menuY @ 1-
FALSE ( don't use default alignment )
else ( 2 ) 2drop ( c-addr/u ) then ( 1 ) then
else
drop ( getenv cruft )
then
if ( use default center alignement? )
menuX @ 19 + over 2 / - menuY @ 1-
then
at-xy type
\ If $menu_init is set, evaluate it (allowing for whole menus to be
\ constructed dynamically -- as this function could conceivably set
\ the remaining environment variables to construct the menu entirely).
\
str_menu_init getenv dup -1 <> if
evaluate
else
drop
then
\ Print our menu options with respective key/variable associations.
\ `printmenuitem' ends by adding the decimal ASCII value for the
@@ -440,7 +495,7 @@ create init_text8 255 allot
\ Initialize the ACPI option status.
\
0 menuacpi !
s" menu_acpi" getenv -1 <> if
str_menu_acpi getenv -1 <> if
c@ dup 48 > over 57 < and if ( '1' <= c1 <= '8' )
menuacpi !
arch-i386? if acpipresent? if
@@ -448,10 +503,7 @@ create init_text8 255 allot
\ Set menu toggle state to active state
\ (required by generic toggle_menuitem)
\
menuacpi @
s" acpienabled? toggle_stateN !"
-rot tuck 25 + c! swap
evaluate
acpienabled? menuacpi @ toggle_stateN !
then then
else
drop
@@ -462,7 +514,7 @@ create init_text8 255 allot
\ Initialize the menu_options visual separator.
\
0 menuoptions !
s" menu_options" getenv -1 <> if
str_menu_options getenv -1 <> if
c@ dup 48 > over 57 < and if ( '1' <= c1 <= '8' )
menuoptions !
else
@@ -473,12 +525,16 @@ create init_text8 255 allot
\ Initialize "Reboot" menu state variable (prevents double-entry)
false menurebootadded !
menu_start
1- menuidx ! \ Initialize the starting index for the menu
0 menurow ! \ Initialize the starting position for the menu
49 \ Iterator start (loop range 49 to 56; ASCII '1' to '8')
begin
\ If the "Options:" separator, print it.
dup menuoptions @ = if
\ Optionally add a reboot option to the menu
s" menu_reboot" getenv -1 <> if
str_menu_reboot getenv -1 <> if
drop
s" Reboot" printmenuitem menureboot !
true menurebootadded !
@@ -488,42 +544,57 @@ create init_text8 255 allot
menurow @ 2 + menurow !
menurow @ menuY @ +
at-xy
." Options:"
str_menu_optionstext getenv dup -1 <> if
type
else
drop ." Options:"
then
then
\ If this is the ACPI menu option, act accordingly.
dup menuacpi @ = if
acpimenuitem ( -- C-Addr | -1 )
else
loader_color? if
s" ansi_caption[x]"
dup acpimenuitem ( n -- n n c-addr/u | n n -1 )
dup -1 <> if
13 +c! ( n n c-addr/u -- n c-addr/u )
\ replace 'x' with n
else
s" menu_caption[x]"
swap drop ( n n -1 -- n -1 )
over menu_command[x] unsetenv
then
else
\ make sure we have not already initialized this item
dup init_stateN dup @ 0= if
1 swap !
\ If this menuitem has an initializer, run it
dup menu_init[x]
getenv dup -1 <> if
evaluate
else
drop
then
else
drop
then
dup
loader_color? if
ansi_caption[x]
else
menu_caption[x]
then
then
( C-Addr | -1 )
dup -1 <> if
\ replace 'x' with current iteration
-rot 2dup 13 + c! rot
\ test for environment variable
getenv dup -1 <> if
printmenuitem ( C-Addr -- N )
s" menukeyN !" \ generate cmd to store result
-rot 2dup 7 + c! rot
evaluate
printmenuitem ( c-addr/u -- n )
dup menukeyN !
else
drop
then
else
drop
s" menu_command[x]"
-rot 2dup 13 + c! rot ( replace 'x' )
unsetenv
then
1+ dup 56 > \ add 1 to iterator, continue if less than 57
@@ -532,7 +603,7 @@ create init_text8 255 allot
\ Optionally add a reboot option to the menu
menurebootadded @ true <> if
s" menu_reboot" getenv -1 <> if
str_menu_reboot getenv -1 <> if
drop \ no need for the value
s" Reboot" \ menu caption (required by printmenuitem)
@@ -550,45 +621,22 @@ create init_text8 255 allot
\
: menu-timeout-update ( N -- )
dup 9 > if ( N N 9 -- N )
drop ( N -- )
9 ( maximum: -- N )
then
\ Enforce minimum/maximum
dup 9 > if drop 9 then
dup 0 < if drop 0 then
dup 0 < if ( N N 0 -- N )
drop ( N -- )
0 ( minimum: -- N )
then
s" Autoboot in N seconds. [Space] to pause" ( n -- n c-addr/u )
48 + ( convert single-digit numeral to ASCII: N 48 -- N )
s" Autoboot in N seconds. [Space] to pause" ( N -- N Addr C )
2 pick 48 - 0> if ( N Addr C N 48 -- N Addr C )
\ Modify 'N' (Addr+12) above to reflect time-left
-rot ( N Addr C -- C N Addr )
tuck ( C N Addr -- C Addr N Addr )
12 + ( C Addr N Addr -- C Addr N Addr2 )
c! ( C Addr N Addr2 -- C Addr )
swap ( C Addr -- Addr C )
menu_timeout_x @
menu_timeout_y @
at-xy ( position cursor: Addr C N N -- Addr C )
type ( print message: Addr C -- )
else ( N Addr C N -- N Addr C )
menu_timeout_x @
menu_timeout_y @
at-xy ( position cursor: N Addr C N N -- N Addr C )
spaces ( erase message: N Addr C -- N Addr )
2drop ( N Addr -- )
2 pick 0> if
rot 48 + -rot ( n c-addr/u -- n' c-addr/u ) \ convert to ASCII
12 +c! ( n' c-addr/u -- c-addr/u ) \ replace 'N' above
menu_timeout_x @ menu_timeout_y @ at-xy \ position cursor
type ( c-addr/u -- ) \ print message
else
menu_timeout_x @ menu_timeout_y @ at-xy \ position cursor
spaces ( n c-addr/u -- n c-addr ) \ erase message
2drop ( n c-addr -- )
then
0 25 at-xy ( position cursor back at bottom-left )
@@ -636,7 +684,7 @@ create init_text8 255 allot
\ (user did not cancel by pressing ANY
\ key)
s" menu_timeout_command" getenv dup
str_menu_timeout_command getenv dup
-1 = if
drop \ clean-up
else
@@ -708,8 +756,45 @@ create init_text8 255 allot
menu_start
1- menuidx ! \ Initialize the starting index for the menu
0 menurow ! \ Initialize the starting position for the menu
42 13 2 9 box \ Draw frame (w,h,x,y)
0 25 at-xy \ Move cursor to the bottom for output
\ Assign configuration values
str_loader_menu_y getenv dup -1 = if
drop \ no custom row position
menu_default_y
else
\ make sure custom position is a number
?number 0= if
menu_default_y \ or use default
then
then
menuY !
str_loader_menu_x getenv dup -1 = if
drop \ no custom column position
menu_default_x
else
\ make sure custom position is a number
?number 0= if
menu_default_x \ or use default
then
then
menuX !
\ Interpret a custom frame type for the menu
TRUE ( draw a box? default yes, but might be altered below )
str_loader_menu_frame getenv dup -1 = if ( 1 )
drop \ no custom frame type
else ( 1 ) 2dup s" single" compare-insensitive 0= if ( 2 )
f_single ( see frames.4th )
else ( 2 ) 2dup s" double" compare-insensitive 0= if ( 3 )
f_double ( see frames.4th )
else ( 3 ) s" none" compare-insensitive 0= if ( 4 )
drop FALSE \ don't draw a box
( 4 ) then ( 3 ) then ( 2 ) then ( 1 ) then
if
42 13 menuX @ 3 - menuY @ 1- box \ Draw frame (w,h,x,y)
then
0 25 at-xy \ Move cursor to the bottom for output
;
\ Main function. Call this from your `loader.rc' file.
@@ -719,7 +804,7 @@ create init_text8 255 allot
0 menu_timeout_enabled ! \ start with automatic timeout disabled
\ check indication that automatic execution after delay is requested
s" menu_timeout_command" getenv -1 <> if ( Addr C -1 -- | Addr )
str_menu_timeout_command getenv -1 <> if ( Addr C -1 -- | Addr )
drop ( just testing existence right now: Addr -- )
\ initialize state variables
@@ -755,7 +840,7 @@ create init_text8 255 allot
menu_timeout_enabled @ 1 = if
\ read custom column position (if set)
s" loader_menu_timeout_x" getenv dup -1 = if
str_loader_menu_timeout_x getenv dup -1 = if
drop \ no custom column position
menu_timeout_default_x \ use default setting
else
@@ -767,7 +852,7 @@ create init_text8 255 allot
menu_timeout_x ! ( store value on stack from above )
\ read custom row position (if set)
s" loader_menu_timeout_y" getenv dup -1 = if
str_loader_menu_timeout_y getenv dup -1 = if
drop \ no custom row position
menu_timeout_default_y \ use default setting
else
@@ -799,17 +884,15 @@ create init_text8 255 allot
exit ( pedantic; never reached )
then
dup menureboot @ = if 0 reboot then
\ Evaluate the decimal ASCII value against known menu item
\ key associations and act accordingly
49 \ Iterator start (loop range 49 to 56; ASCII '1' to '8')
begin
s" menukeyN @"
\ replace 'N' with current iteration
-rot 2dup 7 + c! rot
evaluate rot tuck = if
dup menukeyN @
rot tuck = if
\ Adjust for missing ACPI menuitem on non-i386
arch-i386? true <> menuacpi @ 0<> and if
@@ -820,13 +903,8 @@ create init_text8 255 allot
then
then
\ base env name for the value (x is a number)
s" menu_command[x]"
\ Copy ASCII number to string at offset 13
-rot 2dup 13 + c! rot
\ Test for the environment variable
dup menu_command[x]
getenv dup -1 <> if
\ Execute the stored procedure
evaluate
@@ -861,16 +939,14 @@ create init_text8 255 allot
\
\ Check for menu keycode shortcut(s)
\
s" menu_keycode[x]"
-rot 2dup 13 + c! rot
dup menu_keycode[x]
getenv dup -1 = if
drop
else
?number 0<> if
rot tuck = if
swap
s" menu_command[x]"
-rot 2dup 13 + c! rot
dup menu_command[x]
getenv dup -1 <> if
evaluate
0= if
@@ -890,8 +966,7 @@ create init_text8 255 allot
\ continue if less than 57
until
drop \ loop iterator
menureboot @ = if 0 reboot then
drop \ key pressed
again \ Non-operational key was pressed; repeat
;
@@ -903,77 +978,43 @@ create init_text8 255 allot
49 \ Iterator start (loop range 49 to 56; ASCII '1' to '8')
begin
\ Unset variables in-order of appearance in menu.4th(8)
dup menu_init[x] unsetenv \ menu initializer
dup menu_command[x] unsetenv \ menu command
dup menu_caption[x] unsetenv \ menu caption
dup ansi_caption[x] unsetenv \ ANSI caption
dup menu_keycode[x] unsetenv \ menu keycode
dup toggled_text[x] unsetenv \ toggle_menuitem caption
dup toggled_ansi[x] unsetenv \ toggle_menuitem ANSI caption
s" menu_caption[x]" \ basename for caption variable
-rot 2dup 13 + c! rot \ replace 'x' with current iteration
unsetenv \ not erroneous to unset unknown var
s" menu_command[x]" \ command basename
-rot 2dup 13 + c! rot \ replace 'x'
unsetenv
s" menu_keycode[x]" \ keycode basename
-rot 2dup 13 + c! rot \ replace 'x'
unsetenv
s" ansi_caption[x]" \ ANSI caption basename
-rot 2dup 13 + c! rot \ replace 'x'
unsetenv
s" toggled_text[x]" \ toggle_menuitem caption basename
-rot 2dup 13 + c! rot \ replace 'x'
unsetenv
s" toggled_ansi[x]" \ toggle_menuitem ANSI caption basename
-rot 2dup 13 + c! rot \ replace 'x'
unsetenv
s" menu_caption[x][y]" \ cycle_menuitem caption
-rot 2dup 13 + c! rot \ replace 'x'
49 -rot
48 \ Iterator start (inner range 48 to 57; ASCII '0' to '9')
begin
16 2over rot + c! \ replace 'y'
2dup unsetenv
rot 1+ dup 56 > 2swap rot
\ cycle_menuitem caption and ANSI caption
2dup menu_caption[x][y] unsetenv
2dup ansi_caption[x][y] unsetenv
1+ dup 57 >
until
2drop drop
drop \ inner iterator
s" ansi_caption[x][y]" \ cycle_menuitem ANSI caption
-rot 2dup 13 + c! rot \ replace 'x'
49 -rot
begin
16 2over rot + c! \ replace 'y'
2dup unsetenv
rot 1+ dup 56 > 2swap rot
until
2drop drop
s" 0 menukeyN !" \ basename for key association var
-rot 2dup 9 + c! rot \ replace 'N' with current iteration
evaluate \ assign zero (0) to key assoc. var
0 over menukeyN ! \ used by menu-create, menu-display
0 over init_stateN ! \ used by menu-create
0 over toggle_stateN ! \ used by toggle_menuitem
0 over init_textN c! \ used by toggle_menuitem
0 over cycle_stateN ! \ used by cycle_menuitem
1+ dup 56 > \ increment, continue if less than 57
until
drop \ iterator
\ unset the timeout command
s" menu_timeout_command" unsetenv
str_menu_timeout_command unsetenv \ menu timeout command
str_menu_reboot unsetenv \ Reboot menu option flag
str_menu_acpi unsetenv \ ACPI menu option flag
str_menu_options unsetenv \ Options separator flag
str_menu_optionstext unsetenv \ separator display text
str_menu_init unsetenv \ menu initializer
\ clear the "Reboot" menu option flag
s" menu_reboot" unsetenv
0 menureboot !
\ clear the ACPI menu option flag
s" menu_acpi" unsetenv
0 menuacpi !
\ clear the "Options" menu separator flag
s" menu_options" unsetenv
0 menuoptions !
;
\ This function both unsets menu variables and visually erases the menu area
@@ -984,10 +1025,17 @@ create init_text8 255 allot
menu-erase
;
\ Assign configuration values
bullet menubllt !
10 menuY !
5 menuX !
\ Initialize our menu initialization state variables
0 init_state1 !
0 init_state2 !
0 init_state3 !
0 init_state4 !
0 init_state5 !
0 init_state6 !
0 init_state7 !
0 init_state8 !
\ Initialize our boolean state variables
0 toggle_state1 !
+44 -15
View File
@@ -1,4 +1,4 @@
.\" Copyright (c) 2011 Devin Teske
.\" Copyright (c) 2011-2013 Devin Teske
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd February 25, 2012
.Dd August 6, 2013
.Dt MENU.4TH 8
.Os
.Sh NAME
@@ -83,13 +83,14 @@ The environment variables that effect its behavior are:
.Bl -tag -width bootfile -offset indent
.It Va loader_color
If set to
.Dq Li YES
.Dq Li NO
(case-insensitive) or
.Dq Li 1 ,
causes the menu to be displayed in color wherever possible.
This includes the
use of ANSI bold for numbers appearing to the left of menuitems and the use of
special
.Dq Li 0 ,
causes the menu to be displayed without color.
The default is to use ANSI coloring whenever possible.
If serial boot is enabled, color is disabled by default.
Color features include the use of ANSI bold for numbers appearing to the left
of menuitems and the use of special
.Dq Li ansi
variables described below.
.It Va autoboot_delay
@@ -108,8 +109,9 @@ will wait for user input and never execute
If set to
.Dq Li -1 ,
.Ic menu-display
will boot immediately, preventing both interruption of the autoboot process and
escaping to the loader prompt.
will boot immediately, preventing both interruption of the
.Ic autoboot
process and escaping to the loader prompt.
Default is
.Dq Li 10 .
See
@@ -121,6 +123,14 @@ The command to be executed after
seconds if a key is not pressed.
The default is
.Ic boot .
.It Va loader_menu_frame
Sets the desired box style to draw around the boot menu.
Possible values are:
.Dq Li single
.Pq the default ,
.Dq Li double ,
and
.Dq Li none .
.It Va loader_menu_timeout_x
Sets the desired column position of the timeout countdown text.
Default is 4.
@@ -128,9 +138,24 @@ Default is 4.
Sets the desired row position of the timeout countdown text.
Default is 23.
.It Va loader_menu_title
The text to display centered above the menu.
The text to display above the menu.
Default is
.Dq Li "Welcome to FreeBSD" .
.It Va loader_menu_title_align
Default is to align
.Ic loader_menu_title
centered above the menu. This can be set to
.Dq Li left
or
.Dq Li right
to instead display the title left-or-right justified
.Pq respectively .
.It Va loader_menu_x
Sets the desired column position of the boot menu.
Default is 5.
.It Va loader_menu_y
Sets the desired row position of the boot menu.
Default is 10.
.It Va menu_caption[x]
The text to be displayed for the numbered menuitem
.Dq Li x .
@@ -147,7 +172,9 @@ When pressed, will cause the execution of
.It Va ansi_caption[x]
If
.Va loader_color
is set, use this caption for menuitem
is set
.Pq enabled by default ,
use this caption for menuitem
.Dq Li x
instead of
.Va menu_caption[x] .
@@ -164,7 +191,8 @@ Like
.Va toggled_text[x]
except used when
.Va loader_color
is enabled.
is enabled
.Pq default .
.It Va menu_caption[x][y]
For menuitems where
.Va menu_command[x]
@@ -178,7 +206,8 @@ Like
.Va menu_caption[x][y]
except used when
.Va loader_color
is enabled.
is enabled
.Pq default .
.It Va menu_acpi
When set to a number
.Dq Li x
@@ -320,4 +349,4 @@ The
.Nm
set of commands was written by
.An -nosplit
.An Devin Teske Aq devinteske@hotmail.com .
.An Devin Teske Aq dteske@FreeBSD.org .
+82 -36
View File
@@ -16,56 +16,100 @@ draw-brand \ draw the FreeBSD title (top-left; see `brand.4th')
menu-init \ initialize the menu area (see `menu.4th')
\ Initialize main menu constructs (see `menu.4th')
\ NOTE: To use the `ansi' variants, add `loader_color=1' to loader.conf(5)
\ NOTE: To use `non-ansi' variants, add `loader_color=0' to loader.conf(5)
set menu_caption[1]="Boot [Enter]"
set menu_command[1]="boot"
set ansi_caption[1]="Boot [Enter]"
set menu_keycode[1]="98"
\
\ MAIN MENU
\
set menu_caption[2]="[Esc]ape to loader prompt"
set menu_command[2]="goto_prompt"
set menu_keycode[2]="27"
set ansi_caption[2]="Escape to loader prompt"
set menuset_name1="main"
set mainmenu_init[1]="init_boot"
set mainmenu_caption[1]="Boot Multi User [Enter]"
set maintoggled_text[1]="Boot [S]ingle User [Enter]"
set mainmenu_command[1]="boot"
set mainansi_caption[1]="Boot Multi User [Enter]"
set maintoggled_ansi[1]="Boot Single User [Enter]"
\ keycode set by init_boot
set mainmenu_init[2]="init_altboot"
set mainmenu_caption[2]="Boot [S]ingle User"
set maintoggled_text[2]="Boot [M]ulti User"
set mainmenu_command[2]="altboot"
set mainansi_caption[2]="Boot Single User"
set maintoggled_ansi[2]="Boot Multi User"
\ keycode set by init_altboot
set mainmenu_caption[3]="[Esc]ape to loader prompt"
set mainmenu_command[3]="goto_prompt"
set mainmenu_keycode[3]=27
set mainansi_caption[3]="Escape to loader prompt"
\ Enable built-in "Reboot" trailing menuitem
\ NOTE: appears before menu_options if configured
\
set menu_reboot
set mainmenu_reboot
\ Enable "Options:" separator. When set to a numerical value (1-8), a visual
\ separator is inserted before that menuitem number.
\
set menu_options=4
set mainmenu_options=5
set menu_caption[4]="[A]CPI Support off"
set toggled_text[4]="[A]CPI Support On"
set menu_command[4]="toggle_acpi"
set menu_keycode[4]="97"
set menu_acpi=4
set ansi_caption[4]="ACPI Support Off"
set toggled_ansi[4]="ACPI Support On"
set mainmenu_caption[5]="Configure Boot [O]ptions..."
set mainmenu_command[5]="2 goto_menu"
set mainmenu_keycode[5]=111
set mainansi_caption[5]="Configure Boot Options..."
set menu_caption[5]="Safe [M]ode... off"
set toggled_text[5]="Safe [M]ode... On"
set menu_command[5]="toggle_safemode"
set menu_keycode[5]="109"
set ansi_caption[5]="Safe Mode... Off"
set toggled_ansi[5]="Safe Mode... On"
\
\ BOOT OPTIONS MENU
\
set menu_caption[6]="[S]ingle User. off"
set toggled_text[6]="[S]ingle User. On"
set menu_command[6]="toggle_singleuser"
set menu_keycode[6]="115"
set ansi_caption[6]="Single User. Off"
set toggled_ansi[6]="Single User. On"
set menuset_name2="options"
set menu_caption[7]="[V]erbose..... off"
set toggled_text[7]="[V]erbose..... On"
set menu_command[7]="toggle_verbose"
set menu_keycode[7]="118"
set ansi_caption[7]="Verbose..... Off"
set toggled_ansi[7]="Verbose..... On"
set optionsmenu_caption[1]="Back to Main Menu [Backspace]"
set optionsmenu_command[1]="1 goto_menu"
set optionsmenu_keycode[1]=8
set optionsansi_caption[1]="Back to Main Menu [Backspace]"
set optionsmenu_caption[2]="Load System [D]efaults"
set optionsmenu_command[2]="set_default_boot_options"
set optionsmenu_keycode[2]=100
set optionsansi_caption[2]="Load System Defaults"
set optionsmenu_options=3
set optionsmenu_optionstext="Boot Options:"
set optionsmenu_acpi=3
set optionsmenu_caption[3]="[A]CPI Support off"
set optionstoggled_text[3]="[A]CPI Support On"
set optionsmenu_command[3]="toggle_acpi"
set optionsmenu_keycode[3]=97
set optionsansi_caption[3]="ACPI Support Off"
set optionstoggled_ansi[3]="ACPI Support On"
set optionsmenu_init[4]="init_safemode"
set optionsmenu_caption[4]="Safe [M]ode... off"
set optionstoggled_text[4]="Safe [M]ode... On"
set optionsmenu_command[4]="toggle_safemode"
set optionsmenu_keycode[4]=109
set optionsansi_caption[4]="Safe Mode... Off"
set optionstoggled_ansi[4]="Safe Mode... On"
set optionsmenu_init[5]="init_singleuser"
set optionsmenu_caption[5]="[S]ingle User. off"
set optionstoggled_text[5]="[S]ingle User. On"
set optionsmenu_command[5]="toggle_singleuser"
set optionsmenu_keycode[5]=115
set optionsansi_caption[5]="Single User. Off"
set optionstoggled_ansi[5]="Single User. On"
set optionsmenu_init[6]="init_verbose"
set optionsmenu_caption[6]="[V]erbose..... off"
set optionstoggled_text[6]="[V]erbose..... On"
set optionsmenu_command[6]="toggle_verbose"
set optionsmenu_keycode[6]=118
set optionsansi_caption[6]="Verbose..... Off"
set optionstoggled_ansi[6]="Verbose..... On"
\ Enable automatic booting (add ``autoboot_delay=N'' to loader.conf(5) to
\ customize the timeout; default is 10-seconds)
@@ -73,4 +117,6 @@ set toggled_ansi[7]="Verbose..... On"
set menu_timeout_command="boot"
\ Display the main menu (see `menu.4th')
set menuset_initial=1
menuset-loadinitial
menu-display
+610
View File
@@ -0,0 +1,610 @@
\ Copyright (c) 2012 Devin Teske <[email protected]>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
\ modification, are permitted provided that the following conditions
\ are met:
\ 1. Redistributions of source code must retain the above copyright
\ notice, this list of conditions and the following disclaimer.
\ 2. Redistributions in binary form must reproduce the above copyright
\ notice, this list of conditions and the following disclaimer in the
\ documentation and/or other materials provided with the distribution.
\
\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
\ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
\ SUCH DAMAGE.
\
\ $FreeBSD$
marker task-menusets.4th
variable menuset_use_name
create menuset_affixbuf 255 allot
create menuset_x 1 allot
create menuset_y 1 allot
: menuset-loadvar ( -- )
\ menuset_use_name is true or false
\ $type should be set to one of:
\ menu toggled ansi
\ $var should be set to one of:
\ caption command keycode text ...
\ $affix is either prefix (menuset_use_name is true)
\ or infix (menuset_use_name is false)
s" set cmdbuf='set ${type}_${var}=\$'" evaluate
s" cmdbuf" getenv swap drop ( -- u1 ) \ get string length
menuset_use_name @ true = if
s" set cmdbuf=${cmdbuf}${affix}${type}_${var}"
( u1 -- u1 c-addr2 u2 )
else
s" set cmdbuf=${cmdbuf}${type}set${affix}_${var}"
( u1 -- u1 c-addr2 u2 )
then
evaluate ( u1 c-addr2 u2 -- u1 )
s" cmdbuf" getenv ( u1 -- u1 c-addr2 u2 )
rot 2 pick 2 pick over + -rot + tuck -
( u1 c-addr2 u2 -- c-addr2 u2 c-addr1 u1 )
\ Generate a string representing rvalue inheritance var
getenv dup -1 = if
( c-addr2 u2 c-addr1 u1 -- c-addr2 u2 -1 )
\ NOT set -- clean up the stack
drop ( c-addr2 u2 -1 -- c-addr2 u2 )
2drop ( c-addr2 u2 -- )
else
( c-addr2 u2 c-addr1 u1 -- c-addr2 u2 c-addr1 u1 )
\ SET -- execute cmdbuf (c-addr2/u2) to inherit value
2drop ( c-addr2 u2 c-addr1 u1 -- c-addr2 u2 )
evaluate ( c-addr2 u2 -- )
then
s" cmdbuf" unsetenv
;
: menuset-unloadvar ( -- )
\ menuset_use_name is true or false
\ $type should be set to one of:
\ menu toggled ansi
\ $var should be set to one of:
\ caption command keycode text ...
\ $affix is either prefix (menuset_use_name is true)
\ or infix (menuset_use_name is false)
menuset_use_name @ true = if
s" set buf=${affix}${type}_${var}"
else
s" set buf=${type}set${affix}_${var}"
then
evaluate
s" buf" getenv unsetenv
s" buf" unsetenv
;
: menuset-loadmenuvar ( -- )
s" set type=menu" evaluate
menuset-loadvar
;
: menuset-unloadmenuvar ( -- )
s" set type=menu" evaluate
menuset-unloadvar
;
: menuset-loadxvar ( -- )
\ menuset_use_name is true or false
\ $type should be set to one of:
\ menu toggled ansi
\ $var should be set to one of:
\ caption command keycode text ...
\ $x is "1" through "8"
\ $affix is either prefix (menuset_use_name is true)
\ or infix (menuset_use_name is false)
s" set cmdbuf='set ${type}_${var}[${x}]=\$'" evaluate
s" cmdbuf" getenv swap drop ( -- u1 ) \ get string length
menuset_use_name @ true = if
s" set cmdbuf=${cmdbuf}${affix}${type}_${var}[${x}]"
( u1 -- u1 c-addr2 u2 )
else
s" set cmdbuf=${cmdbuf}${type}set${affix}_${var}[${x}]"
( u1 -- u1 c-addr2 u2 )
then
evaluate ( u1 c-addr2 u2 -- u1 )
s" cmdbuf" getenv ( u1 -- u1 c-addr2 u2 )
rot 2 pick 2 pick over + -rot + tuck -
( u1 c-addr2 u2 -- c-addr2 u2 c-addr1 u1 )
\ Generate a string representing rvalue inheritance var
getenv dup -1 = if
( c-addr2 u2 c-addr1 u1 -- c-addr2 u2 -1 )
\ NOT set -- clean up the stack
drop ( c-addr2 u2 -1 -- c-addr2 u2 )
2drop ( c-addr2 u2 -- )
else
( c-addr2 u2 c-addr1 u1 -- c-addr2 u2 c-addr1 u1 )
\ SET -- execute cmdbuf (c-addr2/u2) to inherit value
2drop ( c-addr2 u2 c-addr1 u1 -- c-addr2 u2 )
evaluate ( c-addr2 u2 -- )
then
s" cmdbuf" unsetenv
;
: menuset-unloadxvar ( -- )
\ menuset_use_name is true or false
\ $type should be set to one of:
\ menu toggled ansi
\ $var should be set to one of:
\ caption command keycode text ...
\ $x is "1" through "8"
\ $affix is either prefix (menuset_use_name is true)
\ or infix (menuset_use_name is false)
menuset_use_name @ true = if
s" set buf=${affix}${type}_${var}[${x}]"
else
s" set buf=${type}set${affix}_${var}[${x}]"
then
evaluate
s" buf" getenv unsetenv
s" buf" unsetenv
;
: menuset-loadansixvar ( -- )
s" set type=ansi" evaluate
menuset-loadxvar
;
: menuset-unloadansixvar ( -- )
s" set type=ansi" evaluate
menuset-unloadxvar
;
: menuset-loadmenuxvar ( -- )
s" set type=menu" evaluate
menuset-loadxvar
;
: menuset-unloadmenuxvar ( -- )
s" set type=menu" evaluate
menuset-unloadxvar
;
: menuset-loadtoggledxvar ( -- )
s" set type=toggled" evaluate
menuset-loadxvar
;
: menuset-unloadtoggledxvar ( -- )
s" set type=toggled" evaluate
menuset-unloadxvar
;
: menuset-loadxyvar ( -- )
\ menuset_use_name is true or false
\ $type should be set to one of:
\ menu toggled ansi
\ $var should be set to one of:
\ caption command keycode text ...
\ $x is "1" through "8"
\ $y is "0" through "9"
\ $affix is either prefix (menuset_use_name is true)
\ or infix (menuset_use_name is false)
s" set cmdbuf='set ${type}_${var}[${x}][${y}]=\$'" evaluate
s" cmdbuf" getenv swap drop ( -- u1 ) \ get string length
menuset_use_name @ true = if
s" set cmdbuf=${cmdbuf}${affix}${type}_${var}[${x}][${y}]"
( u1 -- u1 c-addr2 u2 )
else
s" set cmdbuf=${cmdbuf}${type}set${affix}_${var}[${x}][${y}]"
( u1 -- u1 c-addr2 u2 )
then
evaluate ( u1 c-addr2 u2 -- u1 )
s" cmdbuf" getenv ( u1 -- u1 c-addr2 u2 )
rot 2 pick 2 pick over + -rot + tuck -
( u1 c-addr2 u2 -- c-addr2 u2 c-addr1 u1 )
\ Generate a string representing rvalue inheritance var
getenv dup -1 = if
( c-addr2 u2 c-addr1 u1 -- c-addr2 u2 -1 )
\ NOT set -- clean up the stack
drop ( c-addr2 u2 -1 -- c-addr2 u2 )
2drop ( c-addr2 u2 -- )
else
( c-addr2 u2 c-addr1 u1 -- c-addr2 u2 c-addr1 u1 )
\ SET -- execute cmdbuf (c-addr2/u2) to inherit value
2drop ( c-addr2 u2 c-addr1 u1 -- c-addr2 u2 )
evaluate ( c-addr2 u2 -- )
then
s" cmdbuf" unsetenv
;
: menuset-unloadxyvar ( -- )
\ menuset_use_name is true or false
\ $type should be set to one of:
\ menu toggled ansi
\ $var should be set to one of:
\ caption command keycode text ...
\ $x is "1" through "8"
\ $y is "0" through "9"
\ $affix is either prefix (menuset_use_name is true)
\ or infix (menuset_use_name is false)
menuset_use_name @ true = if
s" set buf=${affix}${type}_${var}[${x}][${y}]"
else
s" set buf=${type}set${affix}_${var}[${x}][${y}]"
then
evaluate
s" buf" getenv unsetenv
s" buf" unsetenv
;
: menuset-loadansixyvar ( -- )
s" set type=ansi" evaluate
menuset-loadxyvar
;
: menuset-unloadansixyvar ( -- )
s" set type=ansi" evaluate
menuset-unloadxyvar
;
: menuset-loadmenuxyvar ( -- )
s" set type=menu" evaluate
menuset-loadxyvar
;
: menuset-unloadmenuxyvar ( -- )
s" set type=menu" evaluate
menuset-unloadxyvar
;
: menuset-setnum-namevar ( N -- C-Addr/U )
s" menuset_nameNNNNN" ( n -- n c-addr1 u1 ) \ variable basename
drop 12 ( n c-addr1 u1 -- n c-addr1 12 ) \ remove "NNNNN"
rot ( n c-addr1 12 -- c-addr1 12 n ) \ move number on top
\ convert to string
s>d <# #s #> ( c-addr1 12 n -- c-addr1 12 c-addr2 u2 )
\ Combine strings
begin ( using u2 in c-addr2/u2 pair as countdown to zero )
over ( c-addr1 u1 c-addr2 u2 -- continued below )
( c-addr1 u1 c-addr2 u2 c-addr2 ) \ copy src-addr
c@ ( c-addr1 u1 c-addr2 u2 c-addr2 -- continued below )
( c-addr1 u1 c-addr2 u2 c ) \ get next src-addr byte
4 pick 4 pick
( c-addr1 u1 c-addr2 u2 c -- continued below )
( c-addr1 u1 c-addr2 u2 c c-addr1 u1 )
\ get destination c-addr1/u1 pair
+ ( c-addr1 u1 c-addr2 u2 c c-addr1 u1 -- cont. below )
( c-addr1 u1 c-addr2 u2 c c-addr3 )
\ combine dest-c-addr to get dest-addr for byte
c! ( c-addr1 u1 c-addr2 u2 c c-addr3 -- continued below )
( c-addr1 u1 c-addr2 u2 )
\ store the current src-addr byte into dest-addr
2swap 1+ 2swap \ increment u1 in destination c-addr1/u1 pair
swap 1+ swap \ increment c-addr2 in source c-addr2/u2 pair
1- \ decrement u2 in the source c-addr2/u2 pair
dup 0= \ time to break?
until
2drop ( c-addr1 u1 c-addr2 u2 -- c-addr1 u1 )
\ drop temporary number-format conversion c-addr2/u2
;
: menuset-checksetnum ( N -- )
\
\ adjust input to be both positive and no-higher than 65535
\
abs dup 65535 > if drop 65535 then ( n -- n )
\
\ The next few blocks will determine if we should use the default
\ methodology (referencing the original numeric stack-input), or if-
\ instead $menuset_name{N} has been defined wherein we would then
\ use the value thereof as the prefix to every menu variable.
\
false menuset_use_name ! \ assume name is not set
menuset-setnum-namevar
\
\ We now have a string that is the assembled variable name to check
\ for... $menuset_name{N}. Let's check for it.
\
2dup ( c-addr1 u1 -- c-addr1 u1 c-addr1 u1 ) \ save a copy
getenv dup -1 <> if ( c-addr1 u1 c-addr1 u1 -- c-addr1 u1 c-addr2 u2 )
\ The variable is set. Let's clean up the stack leaving only
\ its value for later use.
true menuset_use_name !
2swap 2drop ( c-addr1 u1 c-addr2 u2 -- c-addr2 u2 )
\ drop assembled variable name, leave the value
else ( c-addr1 u1 c-addr1 u1 -- c-addr1 u1 -1 ) \ no such variable
\ The variable is not set. Let's clean up the stack leaving the
\ string [portion] representing the original numeric input.
drop ( c-addr1 u1 -1 -- c-addr1 u1 ) \ drop -1 result
12 - swap 12 + swap ( c-addr1 u1 -- c-addr2 u2 )
\ truncate to original numeric stack-input
then
\
\ Now, depending on whether $menuset_name{N} has been set, we have
\ either the value thereof to be used as a prefix to all menu_*
\ variables or we have a string representing the numeric stack-input
\ to be used as a "set{N}" infix to the same menu_* variables.
\
\ For example, if the stack-input is 1 and menuset_name1 is NOT set
\ the following variables will be referenced:
\ ansiset1_caption[x] -> ansi_caption[x]
\ ansiset1_caption[x][y] -> ansi_caption[x][y]
\ menuset1_acpi -> menu_acpi
\ menuset1_caption[x] -> menu_caption[x]
\ menuset1_caption[x][y] -> menu_caption[x][y]
\ menuset1_command[x] -> menu_command[x]
\ menuset1_init -> ``evaluated''
\ menuset1_init[x] -> menu_init[x]
\ menuset1_keycode[x] -> menu_keycode[x]
\ menuset1_options -> menu_options
\ menuset1_optionstext -> menu_optionstext
\ menuset1_reboot -> menu_reboot
\ toggledset1_ansi[x] -> toggled_ansi[x]
\ toggledset1_text[x] -> toggled_text[x]
\ otherwise, the following variables are referenced (where {name}
\ represents the value of $menuset_name1 (given 1 as stack-input):
\ {name}ansi_caption[x] -> ansi_caption[x]
\ {name}ansi_caption[x][y] -> ansi_caption[x][y]
\ {name}menu_acpi -> menu_acpi
\ {name}menu_caption[x] -> menu_caption[x]
\ {name}menu_caption[x][y] -> menu_caption[x][y]
\ {name}menu_command[x] -> menu_command[x]
\ {name}menu_init -> ``evaluated''
\ {name}menu_init[x] -> menu_init[x]
\ {name}menu_keycode[x] -> menu_keycode[x]
\ {name}menu_options -> menu_options
\ {name}menu_optionstext -> menu_optionstext
\ {name}menu_reboot -> menu_reboot
\ {name}toggled_ansi[x] -> toggled_ansi[x]
\ {name}toggled_text[x] -> toggled_text[x]
\
\ Note that menuset{N}_init and {name}menu_init are the initializers
\ for the entire menu (for wholly dynamic menus) opposed to the per-
\ menuitem initializers (with [x] afterward). The whole-menu init
\ routine is evaluated and not passed down to $menu_init (which
\ would result in double evaluation). By doing this, the initializer
\ can initialize the menuset before we transfer it to active-duty.
\
\
\ Copy our affixation (prefix or infix depending on menuset_use_name)
\ to our buffer so that we can safely use the s-quote (s") buf again.
\
menuset_affixbuf 0 2swap ( c-addr2 u2 -- c-addr1 0 c-addr2 u2 )
begin ( using u2 in c-addr2/u2 pair as countdown to zero )
over ( c-addr1 u1 c-addr2 u2 -- c-addr1 u1 c-addr2 u2 c-addr2 )
c@ ( c-addr1 u1 c-addr2 u2 -- c-addr1 u1 c-addr2 u2 c )
4 pick 4 pick
( c-addr1 u1 c-addr2 u2 c -- continued below )
( c-addr1 u1 c-addr2 u2 c c-addr1 u1 )
+ ( c-addr1 u1 c-addr2 u2 c c-addr1 u1 -- continued below )
( c-addr1 u1 c-addr2 u2 c c-addr3 )
c! ( c-addr1 u1 c-addr2 u2 c c-addr3 -- continued below )
( c-addr1 u1 c-addr2 u2 )
2swap 1+ 2swap \ increment affixbuf byte position/count
swap 1+ swap \ increment strbuf pointer (source c-addr2)
1- \ decrement strbuf byte count (source u2)
dup 0= \ time to break?
until
2drop ( c-addr1 u1 c-addr2 u2 -- c-addr1 u1 ) \ drop strbuf c-addr2/u2
\
\ Create a variable for referencing our affix data (prefix or infix
\ depending on menuset_use_name as described above). This variable will
\ be temporary and only used to simplify cmdbuf assembly.
\
s" affix" setenv ( c-addr1 u1 -- )
;
: menuset-cleanup ( -- )
s" type" unsetenv
s" var" unsetenv
s" x" unsetenv
s" y" unsetenv
s" affix" unsetenv
;
: menuset-loadsetnum ( N -- )
menuset-checksetnum ( n -- )
\
\ From here out, we use temporary environment variables to make
\ dealing with variable-length strings easier.
\
\ menuset_use_name is true or false
\ $affix should be used appropriately w/respect to menuset_use_name
\
\ ... menu_init ...
s" set var=init" evaluate
menuset-loadmenuvar
\ If menu_init was set by the above, evaluate it here-and-now
\ so that the remaining variables are influenced by its actions
s" menu_init" 2dup getenv dup -1 <> if
2swap unsetenv \ don't want later menu-create to re-call this
evaluate
else
drop 2drop ( n c-addr u -1 -- n )
then
[char] 1 ( -- x ) \ Loop range ASCII '1' (49) to '8' (56)
begin
dup menuset_x tuck c! 1 s" x" setenv \ set loop iterator and $x
s" set var=caption" evaluate
\ ... menu_caption[x] ...
menuset-loadmenuxvar
\ ... ansi_caption[x] ...
menuset-loadansixvar
[char] 0 ( x -- x y ) \ Inner Loop ASCII '1' (48) to '9' (57)
begin
dup menuset_y tuck c! 1 s" y" setenv
\ set inner loop iterator and $y
\ ... menu_caption[x][y] ...
menuset-loadmenuxyvar
\ ... ansi_caption[x][y] ...
menuset-loadansixyvar
1+ dup 57 > ( x y -- y' 0|-1 ) \ increment and test
until
drop ( x y -- x )
\ ... menu_command[x] ...
s" set var=command" evaluate
menuset-loadmenuxvar
\ ... menu_init[x] ...
s" set var=init" evaluate
menuset-loadmenuxvar
\ ... menu_keycode[x] ...
s" set var=keycode" evaluate
menuset-loadmenuxvar
\ ... toggled_text[x] ...
s" set var=text" evaluate
menuset-loadtoggledxvar
\ ... toggled_ansi[x] ...
s" set var=ansi" evaluate
menuset-loadtoggledxvar
1+ dup 56 > ( x -- x' 0|-1 ) \ increment iterator
\ continue if less than 57
until
drop ( x -- ) \ loop iterator
\ ... menu_reboot ...
s" set var=reboot" evaluate
menuset-loadmenuvar
\ ... menu_acpi ...
s" set var=acpi" evaluate
menuset-loadmenuvar
\ ... menu_options ...
s" set var=options" evaluate
menuset-loadmenuvar
\ ... menu_optionstext ...
s" set var=optionstext" evaluate
menuset-loadmenuvar
menuset-cleanup
;
: menuset-loadinitial ( -- )
s" menuset_initial" getenv dup -1 <> if
?number 0<> if
menuset-loadsetnum
then
else
drop \ cruft
then
;
: menusets-unset ( -- )
s" menuset_initial" unsetenv
1 begin
dup menuset-checksetnum ( n n -- n )
dup menuset-setnum-namevar ( n n -- n )
unsetenv
\ If the current menuset does not populate the first menuitem,
\ we stop completely.
menuset_use_name @ true = if
s" set buf=${affix}menu_caption[1]"
else
s" set buf=menuset${affix}_caption[1]"
then
evaluate s" buf" getenv getenv -1 = if
drop ( n -- )
s" buf" unsetenv
menuset-cleanup
exit
else
drop ( n c-addr2 -- n ) \ unused
then
[char] 1 ( n -- n x ) \ Loop range ASCII '1' (49) to '8' (56)
begin
dup menuset_x tuck c! 1 s" x" setenv \ set $x to x
s" set var=caption" evaluate
menuset-unloadmenuxvar
menuset-unloadmenuxvar
menuset-unloadansixvar
[char] 0 ( n x -- n x y ) \ Inner loop '0' to '9'
begin
dup menuset_y tuck c! 1 s" y" setenv
\ sets $y to y
menuset-unloadmenuxyvar
menuset-unloadansixyvar
1+ dup 57 > ( n x y -- n x y' 0|-1 )
until
drop ( n x y -- n x )
s" set var=command" evaluate menuset-unloadmenuxvar
s" set var=init" evaluate menuset-unloadmenuxvar
s" set var=keycode" evaluate menuset-unloadmenuxvar
s" set var=text" evaluate menuset-unloadtoggledxvar
s" set var=ansi" evaluate menuset-unloadtoggledxvar
1+ dup 56 > ( x -- x' 0|-1 ) \ increment and test
until
drop ( n x -- n ) \ loop iterator
s" set var=acpi" evaluate menuset-unloadmenuvar
s" set var=init" evaluate menuset-unloadmenuvar
s" set var=options" evaluate menuset-unloadmenuvar
s" set var=optionstext" evaluate menuset-unloadmenuvar
s" set var=reboot" evaluate menuset-unloadmenuvar
1+ dup 65535 > ( n -- n' 0|-1 ) \ increment and test
until
drop ( n' -- ) \ loop iterator
s" buf" unsetenv
menuset-cleanup
;
+372
View File
@@ -0,0 +1,372 @@
.\" Copyright (c) 2012 Devin Teske
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd November 5, 2012
.Dt MENUSETS.4TH 8
.Os
.Sh NAME
.Nm menusets.4th
.Nd FreeBSD dynamic submenu boot module
.Sh DESCRIPTION
The file that goes by the name of
.Nm
is a set of commands designed to add submenu functionality to the dynamic menu
system provided by
.Xr menu.4th 8 .
Submenus are managed through a system of carefully named environment variables.
The commands of
.Nm
by themselves are not enough for most uses.
Please refer to the examples below for the most common situations, and to
.Xr menu.4th 8
for additional commands.
.Pp
Before using any of the commands provided in
.Nm ,
it must be included
through the command:
.Pp
.Dl include menusets.4th
.Pp
This line is present in the default
.Pa /boot/menu-commands.4th
file, so it is not needed (and should not be re-issued) in a normal setup.
.Pp
The commands provided by it are:
.Pp
.Bl -tag -width menuset-loadinitial -compact -offset indent
.It Ic menuset-loadsetnum
Takes a single integer on the stack to identify the menuset environment
variables to be activated (see environment variables below).
.It Ic menuset-loadinitial
If $menuset_initial is set, passes the value to menuset-loadsetnum.
The value must be a number.
.It Ic menusets-unset
Unsets the environment variables associated with all menusets.
Increments starting at 1 and stops at the first unconfigured menuset.
A menuset is considered configured if the caption for item 1 is set.
.El
.Pp
The environment variables that effect its behavior are:
.Bl -tag -width bootfile -offset indent
.It Va menuset_initial
Number to pass to menuset-loadsetnum when menuset-loadinitial is called.
.It Va menuset_nameN
Used to give a name to a menuset.
.El
.Pp
When a menuset is NOT given a name (the default),
menuset N is comprised of the following environment variables:
.Pp
.Bl -tag -width menusetN_caption[x][y] -compact -offset indent
.It Va ansisetN_caption[x]
-> ansi_caption[x]
.It Va ansisetN_caption[x][y]
-> ansi_caption[x][y]
.It Va menusetN_acpi
-> menu_acpi
.It Va menusetN_caption[x]
-> menu_caption[x]
.It Va menusetN_caption[x][y]
-> menu_caption[x][y]
.It Va menusetN_command[x]
-> menu_command[x]
.It Va menusetN_init
->
.Dq Li evaluated
.It Va menusetN_init[x]
-> menu_init[x]
.It Va menusetN_keycode[x]
-> menu_keycode[x]
.It Va menusetN_options
-> menu_options
.It Va menusetN_optionstext
-> menu_optionstext
.It Va menusetN_reboot
-> menu_reboot
.It Va toggledsetN_ansi[x]
-> toggled_ansi[x]
.It Va toggledsetN_text[x]
-> toggled_text[x]
.El
.Pp
When you choose to give a menuset a name (by setting $menuset_nameN),
menuset N is instead comprised of the following environment variables:
.Pp
.Bl -tag -width NAMEmenu_caption[x][y] -compact -offset indent
.It Va NAMEansi_caption[x]
-> ansi_caption[x]
.It Va NAMEansi_caption[x][y]
-> ansi_caption[x][y]
.It Va NAMEmenu_acpi
-> menu_acpi
.It Va NAMEmenu_caption[x]
-> menu_caption[x]
.It Va NAMEmenu_caption[x][y]
-> menu_caption[x][y]
.It Va NAMEmenu_command[x]
-> menu_command[x]
.It Va NAMEmenu_init
->
.Dq Li evaluated
.It Va NAMEmenu_init[x]
-> menu_init[x]
.It Va NAMEmenu_keycode[x]
-> menu_keycode[x]
.It Va NAMEmenu_options
-> menu_options
.It Va NAMEmenu_optionstext
-> menu_optionstext
.It Va NAMEmenu_reboot
-> menu_reboot
.It Va NAMEtoggled_ansi[x]
-> toggled_ansi[x]
.It Va NAMEtoggled_text[x]
-> toggled_text[x]
.El
.Pp
where
.Dq Li NAME
is the value of $menuset_nameN.
In the case of $NAMEmenu_init ($menusetN_init when $menuset_nameN is unset),
the value is evaluated as an FICL statement.
This can be used to dynamically adjust the menuset variables right before the
menu is activated.
.Pp
In addition,
.Nm
provides the following FICL words:
.Pp
.Bl -tag -width menuset -compact -offset indent
.It Ic menuset-checksetnum ( N -- )
Given a single integer on the stack, sets a global variable
.Va menuset_use_name
to a boolean based on whether $menuset_nameN is set (true) or not (false).
Also sets $affix temporary variable (prefix or infix depending on
menuset_use_name).
Automatically called by menuset-loadsetnum and menusets-unset.
.It Ic menuset-loadvar ( -- )
Used indirectly to shorten syntax and mitigate dictionary size.
Requires the following temporary environment variables:
.Pp
.Bl -tag -width affix -compact -offset indent
.It Va type
should be set to one of: menu toggled ansi
.It Va var
should be set to one of: caption command keycode text ...
.It Va affix
either a prefix (menuset_use_name is true) or infix (menuset_use_name is false)
.El
.Pp
If the global
.Va menuset_use_name
is true, the variable ${type}_${var} is made to
equal the value of the variable ${affix}${type}_${var}
(note: in this case menuset-checksetnum has set $affix to $menuset_nameN).
Otherwise (when
.Va menuset_use_name
is false), the variable ${type}_${var} is made to
equal the value of the variable ${type}set${affix}_${var}
(note: in this case menuset-checksetnum has set $affix to N).
.Pp
Both the global variable
.Va menuset_use_name
and the environment variable $affix are automatically handled by
menuset-checksetnum above (which is automatically called by
menuset-loadsetnum).
.It Ic menuset-unloadvar ( -- )
Used indirectly to shorten syntax and mitigate dictionary size.
Like menuset-loadvar except it unsets the menuset variable.
If global
.Va menuset_use_name
is true ($affix is $menuset_nameN),
variable ${affix}${type}_${var} is unset.
Otherwise, $affix is N and variable ${type}set${affix}_${var} is unset.
.It Ic menuset-loadmenuvar ( -- )
Sets $type to
.Dq menu
and calls menuset-loadvar.
.It Ic menuset-unloadmenuvar ( -- )
Sets $type to
.Dq menu
and calls menuset-unloadvar.
.It Ic menuset-loadxvar ( -- )
Like menuset-loadvar except it takes an additional temporary variable $x.
If the global
.Va menuset_use_name
is true (making $affix equal $menuset_nameN),
sets variable ${type}_${var}[${x}] to variable ${affix}${type}_${var}[${x}].
Otherwise ($affix being N), sets the same variable to instead
${type}set{affix}_${var}[${x}].
.It Ic menuset-unloadxvar ( -- )
Like menuset-loadxvar except it unsets the menuset variable.
If global
.Va menuset_use_name
is true, unsets ${affix}${type}_${var}[${x}].
Otherwise, unsets ${type}set${affix}_${var}[${x}].
.It Ic menuset-loadansixvar ( -- )
Sets $type to
.Dq ansi
and calls menuset-loadxvar
.It Ic menuset-unloadansixvar ( -- )
Sets $type to
.Dq ansi
and calls menuset-unloadxvar
.It Ic menuset-loadmenuxvar ( -- )
Sets $type to
.Dq ansi
and calls menuset-loadxvar
.It Ic menuset-unloadmenuxvar ( -- )
Sets $type to
.Dq ansi
and calls menuset-unloadxvar
.It Ic menuset-loadtoggledxvar ( -- )
Sets $type to
.Dq toggled
and calls menuset-loadxvar
.It Ic menuset-unloadtoggledxvar ( -- )
Sets $type to
.Dq toggled
and calls menuset-unloadxvar
.It Ic menuset-loadxyvar ( -- )
Like menuset-loadxvar except it takes an additional temporary variable $y.
If the global
.Va menuset_use_name
is true ($affix is $menuset_nameN),
sets variable ${type}_${var}[${x}][${y}] to ${affix}${type}_${var}[${x}][${y}].
Otherwise ($affix is N) sets the same variable to instead
${type}set${affix}_${var}[${x}][${y}].
.It Ic menuset-unloadxyvar ( -- )
Like menuset-loadxyvar except it unsets the menuset variable.
If the global
.Va menuset_use_name
is true, unsets ${affix}${type}_${var}[${x}][${y}].
Otherwise, unsets ${type}set${affix}_${var}[${x}][${y}].
.It Ic menuset-loadansixyvar ( -- )
Sets $type to
.Dq ansi
and calls menuset-loadxyvar.
.It Ic menuset-unloadansixyvar ( -- )
Sets $type to
.Dq ansi
and calls menuset-unloadxyvar.
.It Ic menuset-loadmenuxyvar ( -- )
Sets $type to
.Dq menu
and calls menuset-loadxyvar.
.It Ic menuset-unloadmenuxyvar ( -- )
Sets $type to
.Dq menu
and calls menuset-unloadxyvar.
.It Ic menuset-setnum-namevar ( N -- C-Addr/U )
Takes a single integer on the stack and replaces it with a string (in c-addr/u
format) whose value is
.Dq menuset_nameN .
For example, if given 1 returns
.Dq menuset_name1 .
.It Ic menuset-cleanup ( N -- )
Unsets all the various temporary variables, currently
.Va type ,
.Va var ,
.Va x ,
.Va y ,
and
.Va affix .
.El
.Pp
For all values of
.Dq Li x
above, use any number between 1 through 9. Sorry, double-digits are not
currently supported.
For all values of
.Dq Li N
above, use any number between 1 and 65535.
.Sh FILES
.Bl -tag -width /boot/menu-commands.4th -compact
.It Pa /boot/loader
The
.Xr loader 8 .
.It Pa /boot/menu.4th
Dynamic menu module.
.It Pa /boot/menu-commands.4th
Contains the goto_menu command.
.It Pa /boot/menusets.4th
.Nm
itself.
.It Pa /boot/loader.rc
.Xr loader 8
bootstrapping script.
.El
.Sh EXAMPLES
A simple boot menu with a submenu:
.Pp
.Bd -literal -offset indent -compact
include /boot/menu.4th
include /boot/menu-commands.4th
menu-init
set menuset1_caption[1]="Boot"
set menuset1_command[1]="boot"
set menuset1_caption[2]="Submenu..."
set menuset1_command[2]="2 goto_menu"
set menuset2_caption[1]="Back"
set menuset2_command[1]="1 goto_menu"
set menuset_initial=2
menuset-loadinitial
menu-display
.Ed
.Pp
The same boot menu with named menusets:
.Pp
.Bd -literal -offset indent -compact
include /boot/menu.4th
include /boot/menu-commands.4th
menu-init
set menuset_name1=main
set mainmenu_caption[1]="Boot"
set mainmenu_command[1]="boot"
set mainmenu_caption[2]="Submenu..."
set mainmenu_command[2]="2 goto_menu"
set menuset_name2=sub
set submenu_caption[1]="Back"
set submenu_command[1]="1 goto_menu"
.Ed
.Sh SEE ALSO
.Xr loader.conf 5 ,
.Xr loader 8 ,
.Xr loader.4th 8 ,
.Xr menu.4th 8 ,
.Xr beastie.4th 8
.Sh HISTORY
The
.Nm
set of commands first appeared in
.Fx 10.0 .
.Sh AUTHORS
The
.Nm
set of commands was written by
.An -nosplit
.An Devin Teske Aq [email protected] .
+1 -1
View File
@@ -1,4 +1,4 @@
\ Copyright (c) 2008-2011 Devin Teske <devinteske@hotmail.com>
\ Copyright (c) 2008-2011 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
+40
View File
@@ -201,6 +201,46 @@ create last_module_option sizeof module.next allot 0 last_module_option !
: getenv? getenv -1 = if false else drop true then ;
\ determine if a word appears in a string, case-insensitive
: contains? ( addr1 len1 addr2 len2 -- 0 | -1 )
2 pick 0= if 2drop 2drop true exit then
dup 0= if 2drop 2drop false exit then
begin
begin
swap dup c@ dup 32 = over 9 = or over 10 = or
over 13 = or over 44 = or swap drop
while 1+ swap 1- repeat
swap 2 pick 1- over <
while
2over 2over drop over compare-insensitive 0= if
2 pick over = if 2drop 2drop true exit then
2 pick tuck - -rot + swap over c@ dup 32 =
over 9 = or over 10 = or over 13 = or over 44 = or
swap drop if 2drop 2drop true exit then
then begin
swap dup c@ dup 32 = over 9 = or over 10 = or
over 13 = or over 44 = or swap drop
if false else true then 2 pick 0> and
while 1+ swap 1- repeat
swap
repeat
2drop 2drop false
;
: boot_serial? ( -- 0 | -1 )
s" console" getenv dup -1 <> if
s" comconsole" 2swap contains?
else drop false then
s" boot_serial" getenv dup -1 <> if
swap drop 0>
else drop false then
or \ console contains comconsole ( or ) boot_serial
s" boot_multicons" getenv dup -1 <> if
swap drop 0>
else drop false then
or \ previous boolean ( or ) boot_multicons
;
\ Private definitions
vocabulary support-functions
+30 -3
View File
@@ -1,4 +1,4 @@
\ Copyright (c) 2006-2011 Devin Teske <devinteske@hotmail.com>
\ Copyright (c) 2006-2013 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,9 @@ marker task-version.4th
variable versionX
variable versionY
\ Default $loader_version value if not overridden or using tribute screen
: str_loader_version ( -- C-ADDR/U|-1 ) s" FreeBSD `Nakatomi Socrates' 9.2" ;
\ Initialize text placement to defaults
80 versionX ! \ NOTE: this is the ending column (text is right-justified)
24 versionY !
@@ -43,9 +46,33 @@ variable versionY
?number drop versionY ! -1
then drop
\ Exit if a version was not set
\ Default version if none was set
s" loader_version" getenv dup -1 = if
drop exit
drop
\ Default version if no logo is requested
s" loader_logo" getenv dup -1 = if
drop str_loader_version
else
2dup s" tribute" compare-insensitive 0= if
2drop
s" tribute-logo" sfind if
drop exit \ see beastie tribute-text
else
drop str_loader_version
then
else 2dup s" tributebw" compare-insensitive 0= if
2drop
s" tributebw-logo" sfind if
drop exit \ see beastie tribute-text
else
drop str_loader_version
then
else
2drop str_loader_version
then then
then
then dup -1 = if
drop exit \ default version (above) is disabled
then
\ Right justify the text
+9 -7
View File
@@ -1,4 +1,4 @@
.\" Copyright (c) 2011 Devin Teske
.\" Copyright (c) 2011-2013 Devin Teske
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd May 19, 2011
.Dd August 6, 2013
.Dt VERSION.4TH 8
.Os
.Sh NAME
@@ -84,13 +84,14 @@ Sets the desired ending row position of
Default is 24.
.It Va loader_color
If set to
.Dq Li YES
.Dq Li NO
(case-insensitive) or
.Dq Li 1 ,
causes the version to be printed in ANSI Cyan.
.Dq Li 0 ,
causes the version to be printed without color
.Pq default is ANSI Cyan .
.El
.Sh FILES
.Bl -tag -width /boot/loader.4th -compact
.Bl -tag -width /boot/version.4th -compact
.It Pa /boot/loader
The
.Xr loader 8 .
@@ -113,6 +114,7 @@ loader_version="loader 1.1"
.Sh SEE ALSO
.Xr loader.conf 5 ,
.Xr loader 8 ,
.Xr color.4th 8
.Sh HISTORY
The
.Nm
@@ -123,4 +125,4 @@ The
.Nm
set of commands was written by
.An -nosplit
.An Devin Teske Aq devinteske@hotmail.com .
.An Devin Teske Aq dteske@FreeBSD.org .
+1 -1
View File
@@ -100,7 +100,7 @@ FILESMODE_${LOADER}= ${BINMODE} -b
FILES+= loader.help loader.4th support.4th loader.conf
FILES+= screen.4th frames.4th beastie.4th
FILES+= brand.4th check-password.4th color.4th delay.4th
FILES+= menu.4th menu-commands.4th shortcuts.4th version.4th
FILES+= menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
FILESDIR_loader.conf= /boot/defaults
.if !exists(${DESTDIR}/boot/loader.rc)
+1 -1
View File
@@ -35,7 +35,7 @@ loader.help: help.common
FILES+= loader.4th support.4th loader.conf
FILES+= screen.4th frames.4th
FILES+= beastie.4th brand.4th check-password.4th color.4th delay.4th
FILES+= menu.4th menu-commands.4th shortcuts.4th version.4th
FILES+= menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
.if !exists(${DESTDIR}/boot/loader.rc)
FILES+= loader.rc
.endif
+1 -1
View File
@@ -88,7 +88,7 @@ FILESMODE_${LOADER}= ${BINMODE} -b
FILES+= loader.help loader.4th support.4th loader.conf
FILES+= screen.4th frames.4th beastie.4th
FILES+= brand.4th check-password.4th color.4th delay.4th
FILES+= menu.4th menu-commands.4th shortcuts.4th version.4th
FILES+= menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
FILESDIR_loader.conf= /boot/defaults
.if !exists(${DESTDIR}/boot/loader.rc)
+1 -1
View File
@@ -105,7 +105,7 @@ loader.help: help.common help.ofw
FILES= loader.help loader.4th support.4th loader.conf
FILES+= screen.4th frames.4th
FILES+= beastie.4th brand.4th check-password.4th color.4th delay.4th
FILES+= menu.4th menu-commands.4th shortcuts.4th version.4th
FILES+= menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
FILESDIR_loader.conf= /boot/defaults
.if !exists(${DESTDIR}/boot/loader.rc)
+1 -1
View File
@@ -116,7 +116,7 @@ loader.help: help.common help.ps3
FILES= loader.help loader.4th support.4th loader.conf
FILES+= screen.4th frames.4th
FILES+= beastie.4th brand.4th check-password.4th color.4th delay.4th
FILES+= menu.4th menu-commands.4th shortcuts.4th version.4th
FILES+= menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
FILESDIR_loader.conf= /boot/defaults
.if !exists(${DESTDIR}/boot/loader.rc)
+1 -1
View File
@@ -99,7 +99,7 @@ loader.help: help.common help.sparc64
FILES= loader.help loader.4th support.4th loader.conf
FILES+= screen.4th frames.4th
FILES+= beastie.4th brand.4th check-password.4th color.4th delay.4th
FILES+= menu.4th menu-commands.4th shortcuts.4th version.4th
FILES+= menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
FILESDIR_loader.conf= /boot/defaults
.if !exists(${DESTDIR}/boot/loader.rc)
+1 -1
View File
@@ -32,7 +32,7 @@
TYPE="FreeBSD"
REVISION="9.2"
BRANCH="BETA2"
BRANCH="RELEASE"
if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
BRANCH=${BRANCH_OVERRIDE}
fi
+37 -36
View File
@@ -139,7 +139,7 @@ static const struct aac_ident
"Adaptec SATA RAID 21610SA"},
{0x9005, 0x0285, 0x103c, 0x3227, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB,
"HP ML110 G2 (Adaptec 2610SA)"},
{0x9005, 0x0286, 0x9005, 0x028c, AAC_HWIF_RKT, 0,
{0x9005, 0x0286, 0x9005, 0x028c, AAC_HWIF_RKT, AAC_FLAGS_NOMSI,
"Adaptec SCSI RAID 2230S"},
{0x9005, 0x0286, 0x9005, 0x028d, AAC_HWIF_RKT, 0,
"Adaptec SCSI RAID 2130S"},
@@ -157,7 +157,7 @@ static const struct aac_ident
"Adaptec SCSI RAID 2020ZCR"},
{0x9005, 0x0285, 0x9005, 0x028b, AAC_HWIF_I960RX, 0,
"Adaptec SCSI RAID 2025ZCR"},
{0x9005, 0x0286, 0x9005, 0x029b, AAC_HWIF_RKT, 0,
{0x9005, 0x0286, 0x9005, 0x029b, AAC_HWIF_RKT, AAC_FLAGS_NOMSI,
"Adaptec SATA RAID 2820SA"},
{0x9005, 0x0286, 0x9005, 0x029c, AAC_HWIF_RKT, 0,
"Adaptec SATA RAID 2620SA"},
@@ -311,7 +311,6 @@ aac_find_ident(device_t dev)
if ((m->vendor == vendid) && (m->device == devid))
return (m);
}
return (NULL);
}
@@ -340,7 +339,7 @@ aac_pci_attach(device_t dev)
{
struct aac_softc *sc;
const struct aac_ident *id;
int count, error, reg, rid;
int count, error, rid;
fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
@@ -362,6 +361,38 @@ aac_pci_attach(device_t dev)
goto out;
}
/*
* Detect the hardware interface version, set up the bus interface
* indirection.
*/
id = aac_find_ident(dev);
sc->aac_hwif = id->hwif;
switch(sc->aac_hwif) {
case AAC_HWIF_I960RX:
case AAC_HWIF_NARK:
fwprintf(sc, HBA_FLAGS_DBG_INIT_B,
"set hardware up for i960Rx/NARK");
sc->aac_if = &aac_rx_interface;
break;
case AAC_HWIF_STRONGARM:
fwprintf(sc, HBA_FLAGS_DBG_INIT_B,
"set hardware up for StrongARM");
sc->aac_if = &aac_sa_interface;
break;
case AAC_HWIF_RKT:
fwprintf(sc, HBA_FLAGS_DBG_INIT_B,
"set hardware up for Rocket/MIPS");
sc->aac_if = &aac_rkt_interface;
break;
default:
sc->aac_hwif = AAC_HWIF_UNKNOWN;
device_printf(dev, "unknown hardware type\n");
goto out;
}
/* Set up quirks */
sc->flags = id->quirks;
/*
* Allocate the PCI register window(s).
*/
@@ -395,8 +426,8 @@ aac_pci_attach(device_t dev)
*/
rid = 0;
count = 0;
if (aac_enable_msi != 0 && pci_find_cap(dev, PCIY_MSI, &reg) == 0) {
count = pci_msi_count(dev);
if (aac_enable_msi != 0 && (sc->flags & AAC_FLAGS_NOMSI) == 0 &&
(count = pci_msi_count(dev)) != 0) {
if (count > 1)
count = 1;
else
@@ -430,36 +461,6 @@ aac_pci_attach(device_t dev)
goto out;
}
/*
* Detect the hardware interface version, set up the bus interface
* indirection.
*/
id = aac_find_ident(dev);
sc->aac_hwif = id->hwif;
switch(sc->aac_hwif) {
case AAC_HWIF_I960RX:
case AAC_HWIF_NARK:
fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for i960Rx/NARK");
sc->aac_if = &aac_rx_interface;
break;
case AAC_HWIF_STRONGARM:
fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for StrongARM");
sc->aac_if = &aac_sa_interface;
break;
case AAC_HWIF_RKT:
fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for Rocket/MIPS");
sc->aac_if = &aac_rkt_interface;
break;
default:
sc->aac_hwif = AAC_HWIF_UNKNOWN;
device_printf(dev, "unknown hardware type\n");
error = ENXIO;
goto out;
}
/* Set up quirks */
sc->flags = id->quirks;
/*
* Do bus-independent initialisation.
*/
+4 -4
View File
@@ -62,7 +62,7 @@ SYSCTL_DECL(_hw_aac);
* The firmware interface allows for a 16-bit s/g list length. We limit
* ourselves to a reasonable maximum and ensure alignment.
*/
#define AAC_MAXSGENTRIES 64 /* max S/G entries, limit 65535 */
#define AAC_MAXSGENTRIES 64 /* max S/G entries, limit 65535 */
/*
* We allocate a small set of FIBs for the adapter to use to send us messages.
@@ -224,7 +224,7 @@ struct aac_common {
/* buffer for text messages from the controller */
char ac_printf[AAC_PRINTF_BUFSIZE];
/* fib for synchronous commands */
struct aac_fib ac_sync_fib;
};
@@ -406,12 +406,13 @@ struct aac_softc
#define AAC_FLAGS_NO4GB (1 << 6) /* Can't access host mem >2GB */
#define AAC_FLAGS_256FIBS (1 << 7) /* Can only do 256 commands */
#define AAC_FLAGS_BROKEN_MEMMAP (1 << 8) /* Broken HostPhysMemPages */
#define AAC_FLAGS_SLAVE (1 << 9)
#define AAC_FLAGS_SLAVE (1 << 9)
#define AAC_FLAGS_MASTER (1 << 10)
#define AAC_FLAGS_NEW_COMM (1 << 11) /* New comm. interface supported */
#define AAC_FLAGS_RAW_IO (1 << 12) /* Raw I/O interface */
#define AAC_FLAGS_ARRAY_64BIT (1 << 13) /* 64-bit array size */
#define AAC_FLAGS_LBA_64BIT (1 << 14) /* 64-bit LBA support */
#define AAC_FLAGS_NOMSI (1 << 31) /* Broken MSI */
u_int32_t supported_options;
u_int32_t scsi_method_id;
@@ -527,7 +528,6 @@ struct aac_code_lookup {
sc->aac_qstat[qname].q_max = 0; \
} while (0)
#define AACQ_COMMAND_QUEUE(name, index) \
static __inline void \
aac_initq_ ## name (struct aac_softc *sc) \
+1 -7
View File
@@ -169,18 +169,12 @@ aacraid_pci_attach(device_t dev)
/*
* Verify that the adapter is correctly set up in PCI space.
*/
command = pci_read_config(sc->aac_dev, PCIR_COMMAND, 2);
command |= PCIM_CMD_BUSMASTEREN;
pci_write_config(dev, PCIR_COMMAND, command, 2);
pci_enable_busmaster(dev);
command = pci_read_config(sc->aac_dev, PCIR_COMMAND, 2);
if (!(command & PCIM_CMD_BUSMASTEREN)) {
device_printf(sc->aac_dev, "can't enable bus-master feature\n");
goto out;
}
if ((command & PCIM_CMD_MEMEN) == 0) {
device_printf(sc->aac_dev, "memory window not available\n");
goto out;
}
/*
* Detect the hardware interface version, set up the bus interface
+6 -9
View File
@@ -199,14 +199,13 @@ adw_pci_attach(device_t dev)
{
struct adw_softc *adw;
struct adw_pci_identity *entry;
u_int32_t command;
u_int16_t command;
struct resource *regs;
int regs_type;
int regs_id;
int error;
int zero;
command = pci_read_config(dev, PCIR_COMMAND, /*bytes*/1);
entry = adw_find_pci_device(dev);
if (entry == NULL)
return (ENXIO);
@@ -214,14 +213,11 @@ adw_pci_attach(device_t dev)
regs_type = 0;
regs_id = 0;
#ifdef ADW_ALLOW_MEMIO
if ((command & PCIM_CMD_MEMEN) != 0) {
regs_type = SYS_RES_MEMORY;
regs_id = ADW_PCI_MEMBASE;
regs = bus_alloc_resource_any(dev, regs_type,
&regs_id, RF_ACTIVE);
}
regs_type = SYS_RES_MEMORY;
regs_id = ADW_PCI_MEMBASE;
regs = bus_alloc_resource_any(dev, regs_type, &regs_id, RF_ACTIVE);
#endif
if (regs == NULL && (command & PCIM_CMD_PORTEN) != 0) {
if (regs == NULL) {
regs_type = SYS_RES_IOPORT;
regs_id = ADW_PCI_IOBASE;
regs = bus_alloc_resource_any(dev, regs_type,
@@ -296,6 +292,7 @@ adw_pci_attach(device_t dev)
* 'control_flag' CONTROL_FLAG_IGNORE_PERR flag to tell the microcode
* to ignore DMA parity errors.
*/
command = pci_read_config(dev, PCIR_COMMAND, /*bytes*/2);
if ((command & PCIM_CMD_PERRESPEN) == 0)
adw_lram_write_16(adw, ADW_MC_CONTROL_FLAG,
adw_lram_read_16(adw, ADW_MC_CONTROL_FLAG)
+2 -14
View File
@@ -139,12 +139,10 @@ int
ahc_pci_map_registers(struct ahc_softc *ahc)
{
struct resource *regs;
u_int command;
int regs_type;
int regs_id;
int allow_memio;
command = aic_pci_read_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/1);
regs = NULL;
regs_type = 0;
regs_id = 0;
@@ -166,7 +164,7 @@ ahc_pci_map_registers(struct ahc_softc *ahc)
#endif
}
if ((allow_memio != 0) && (command & PCIM_CMD_MEMEN) != 0) {
if (allow_memio != 0) {
regs_type = SYS_RES_MEMORY;
regs_id = AHC_PCI_MEMADDR;
@@ -190,16 +188,11 @@ ahc_pci_map_registers(struct ahc_softc *ahc)
bus_release_resource(ahc->dev_softc, regs_type,
regs_id, regs);
regs = NULL;
} else {
command &= ~PCIM_CMD_PORTEN;
aic_pci_write_config(ahc->dev_softc,
PCIR_COMMAND,
command, /*bytes*/1);
}
}
}
if (regs == NULL && (command & PCIM_CMD_PORTEN) != 0) {
if (regs == NULL) {
regs_type = SYS_RES_IOPORT;
regs_id = AHC_PCI_IOADDR;
regs = bus_alloc_resource_any(ahc->dev_softc, regs_type,
@@ -217,11 +210,6 @@ ahc_pci_map_registers(struct ahc_softc *ahc)
bus_release_resource(ahc->dev_softc, regs_type,
regs_id, regs);
regs = NULL;
} else {
command &= ~PCIM_CMD_MEMEN;
aic_pci_write_config(ahc->dev_softc,
PCIR_COMMAND,
command, /*bytes*/1);
}
}
}
+2 -13
View File
@@ -143,13 +143,11 @@ ahd_pci_map_registers(struct ahd_softc *ahd)
{
struct resource *regs;
struct resource *regs2;
u_int command;
int regs_type;
int regs_id;
int regs_id2;
int allow_memio;
command = aic_pci_read_config(ahd->dev_softc, PCIR_COMMAND, /*bytes*/1);
regs = NULL;
regs2 = NULL;
regs_type = 0;
@@ -165,8 +163,7 @@ ahd_pci_map_registers(struct ahd_softc *ahd)
allow_memio = 1;
}
if ((command & PCIM_CMD_MEMEN) != 0
&& (ahd->bugs & AHD_PCIX_MMAPIO_BUG) == 0
if ((ahd->bugs & AHD_PCIX_MMAPIO_BUG) == 0
&& allow_memio != 0) {
regs_type = SYS_RES_MEMORY;
@@ -199,15 +196,10 @@ ahd_pci_map_registers(struct ahd_softc *ahd)
regs_id, regs);
regs = NULL;
AHD_CORRECTABLE_ERROR(ahd);
} else {
command &= ~PCIM_CMD_PORTEN;
aic_pci_write_config(ahd->dev_softc,
PCIR_COMMAND,
command, /*bytes*/1);
}
}
}
if (regs == NULL && (command & PCIM_CMD_PORTEN) != 0) {
if (regs == NULL) {
regs_type = SYS_RES_IOPORT;
regs_id = AHD_PCI_IOADDR0;
regs = bus_alloc_resource_any(ahd->dev_softc, regs_type,
@@ -233,9 +225,6 @@ ahd_pci_map_registers(struct ahd_softc *ahd)
}
ahd->tags[1] = rman_get_bustag(regs2);
ahd->bshs[1] = rman_get_bushandle(regs2);
command &= ~PCIM_CMD_MEMEN;
aic_pci_write_config(ahd->dev_softc, PCIR_COMMAND,
command, /*bytes*/1);
ahd->platform_data->regs_res_type[1] = regs_type;
ahd->platform_data->regs_res_id[1] = regs_id2;
ahd->platform_data->regs[1] = regs2;
+1 -22
View File
@@ -184,7 +184,6 @@ amr_pci_attach(device_t dev)
struct amr_softc *sc;
struct amr_ident *id;
int rid, rtype, error;
u_int32_t command;
debug_called(1);
@@ -204,24 +203,8 @@ amr_pci_attach(device_t dev)
if ((id = amr_find_ident(dev)) == NULL)
return (ENXIO);
command = pci_read_config(dev, PCIR_COMMAND, 1);
if (id->flags & AMR_ID_QUARTZ) {
/*
* Make sure we are going to be able to talk to this board.
*/
if ((command & PCIM_CMD_MEMEN) == 0) {
device_printf(dev, "memory window not available\n");
return (ENXIO);
}
sc->amr_type |= AMR_TYPE_QUARTZ;
} else {
/*
* Make sure we are going to be able to talk to this board.
*/
if ((command & PCIM_CMD_PORTEN) == 0) {
device_printf(dev, "I/O window not available\n");
return (ENXIO);
}
}
if ((amr_force_sg32 == 0) && (id->flags & AMR_ID_DO_SG64) &&
@@ -231,11 +214,7 @@ amr_pci_attach(device_t dev)
}
/* force the busmaster enable bit on */
if (!(command & PCIM_CMD_BUSMASTEREN)) {
device_printf(dev, "busmaster bit not set, enabling\n");
command |= PCIM_CMD_BUSMASTEREN;
pci_write_config(dev, PCIR_COMMAND, command, 2);
}
pci_enable_busmaster(dev);
/*
* Allocate the PCI register window.
-14
View File
@@ -141,7 +141,6 @@ static int
an_attach_pci(dev)
device_t dev;
{
u_int32_t command;
struct an_softc *sc;
int flags, error = 0;
@@ -153,19 +152,6 @@ an_attach_pci(dev)
sc->mpi350 = 1;
sc->port_rid = PCIR_BAR(0);
} else {
/*
* Map control/status registers.
*/
command = pci_read_config(dev, PCIR_COMMAND, 4);
command |= PCIM_CMD_PORTEN;
pci_write_config(dev, PCIR_COMMAND, command, 4);
command = pci_read_config(dev, PCIR_COMMAND, 4);
if (!(command & PCIM_CMD_PORTEN)) {
device_printf(dev, "failed to enable I/O ports!\n");
error = ENXIO;
goto fail;
}
sc->port_rid = AN_PCI_LOIO;
}
error = an_alloc_port(dev, sc->port_rid, 1);
+1 -2
View File
@@ -4102,8 +4102,7 @@ static u_int32_t arcmsr_initialize(device_t dev)
pci_command |= PCIM_CMD_BUSMASTEREN;
pci_command |= PCIM_CMD_PERRESPEN;
pci_command |= PCIM_CMD_MWRICEN;
/* Enable Busmaster/Mem */
pci_command |= PCIM_CMD_MEMEN;
/* Enable Busmaster */
pci_write_config(dev, PCIR_COMMAND, pci_command, 2);
switch(acb->adapter_type) {
case ACB_ADAPTER_TYPE_A: {
+1 -3
View File
@@ -2428,9 +2428,7 @@ asr_attach(device_t dev)
return(ENXIO);
}
/* Enable if not formerly enabled */
pci_write_config(dev, PCIR_COMMAND,
pci_read_config(dev, PCIR_COMMAND, sizeof(char)) |
PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN, sizeof(char));
pci_enable_busmaster(dev);
sc->ha_pciBusNum = pci_get_bus(dev);
sc->ha_pciDeviceNum = (pci_get_slot(dev) << 3) | pci_get_function(dev);
+1 -4
View File
@@ -99,11 +99,8 @@ ata_pci_attach(device_t dev)
ctlr->dev = dev;
/* if needed try to enable busmastering */
pci_enable_busmaster(dev);
cmd = pci_read_config(dev, PCIR_COMMAND, 2);
if (!(cmd & PCIM_CMD_BUSMASTEREN)) {
pci_write_config(dev, PCIR_COMMAND, cmd | PCIM_CMD_BUSMASTEREN, 2);
cmd = pci_read_config(dev, PCIR_COMMAND, 2);
}
/* if busmastering mode "stuck" use it */
if ((cmd & PCIM_CMD_BUSMASTEREN) == PCIM_CMD_BUSMASTEREN) {
+1 -4
View File
@@ -318,7 +318,6 @@ bktr_attach( device_t dev )
{
u_long latency;
u_long fun;
u_long val;
unsigned int rev;
unsigned int unit;
int error = 0;
@@ -336,9 +335,7 @@ bktr_attach( device_t dev )
/*
* Enable bus mastering and Memory Mapped device
*/
val = pci_read_config(dev, PCIR_COMMAND, 4);
val |= (PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN);
pci_write_config(dev, PCIR_COMMAND, val, 4);
pci_enable_busmaster(dev);
/*
* Map control/status registers.
+7 -12
View File
@@ -57,24 +57,19 @@ __FBSDID("$FreeBSD$");
static int
bt_pci_alloc_resources(device_t dev)
{
int command, type = 0, rid, zero;
int type = 0, rid, zero;
struct resource *regs = 0;
struct resource *irq = 0;
command = pci_read_config(dev, PCIR_COMMAND, /*bytes*/1);
#if 0
/* XXX Memory Mapped I/O seems to cause problems */
if (command & PCIM_CMD_MEMEN) {
type = SYS_RES_MEMORY;
rid = BT_PCI_MEMADDR;
regs = bus_alloc_resource_any(dev, type, &rid, RF_ACTIVE);
}
type = SYS_RES_MEMORY;
rid = BT_PCI_MEMADDR;
regs = bus_alloc_resource_any(dev, type, &rid, RF_ACTIVE);
#else
if (!regs && (command & PCIM_CMD_PORTEN)) {
type = SYS_RES_IOPORT;
rid = BT_PCI_IOADDR;
regs = bus_alloc_resource_any(dev, type, &rid, RF_ACTIVE);
}
type = SYS_RES_IOPORT;
rid = BT_PCI_IOADDR;
regs = bus_alloc_resource_any(dev, type, &rid, RF_ACTIVE);
#endif
if (!regs)
return (ENOMEM);
+5 -11
View File
@@ -77,23 +77,17 @@ dpt_pci_attach (device_t dev)
dpt_softc_t * dpt;
int error = 0;
u_int32_t command;
dpt = device_get_softc(dev);
dpt->dev = dev;
dpt_alloc(dev);
command = pci_read_config(dev, PCIR_COMMAND, /*bytes*/1);
#ifdef DPT_ALLOW_MMIO
if ((command & PCIM_CMD_MEMEN) != 0) {
dpt->io_rid = DPT_PCI_MEMADDR;
dpt->io_type = SYS_RES_MEMORY;
dpt->io_res = bus_alloc_resource_any(dev, dpt->io_type,
&dpt->io_rid, RF_ACTIVE);
}
dpt->io_rid = DPT_PCI_MEMADDR;
dpt->io_type = SYS_RES_MEMORY;
dpt->io_res = bus_alloc_resource_any(dev, dpt->io_type,
&dpt->io_rid, RF_ACTIVE);
#endif
if (dpt->io_res == NULL && (command & PCIM_CMD_PORTEN) != 0) {
if (dpt->io_res == NULL) {
dpt->io_rid = DPT_PCI_IOADDR;
dpt->io_type = SYS_RES_IOPORT;
dpt->io_res = bus_alloc_resource_any(dev, dpt->io_type,
+22 -24
View File
@@ -2277,7 +2277,7 @@ em_local_timer(void *arg)
/* Mask to use in the irq trigger */
if (adapter->msix_mem)
trigger = rxr->ims; /* RX for 82574 */
trigger = rxr->ims;
else
trigger = E1000_ICS_RXDMT0;
@@ -2442,16 +2442,8 @@ em_identify_hardware(struct adapter *adapter)
device_t dev = adapter->dev;
/* Make sure our PCI config space has the necessary stuff set */
pci_enable_busmaster(dev);
adapter->hw.bus.pci_cmd_word = pci_read_config(dev, PCIR_COMMAND, 2);
if (!((adapter->hw.bus.pci_cmd_word & PCIM_CMD_BUSMASTEREN) &&
(adapter->hw.bus.pci_cmd_word & PCIM_CMD_MEMEN))) {
device_printf(dev, "Memory Access and/or Bus Master bits "
"were not set!\n");
adapter->hw.bus.pci_cmd_word |=
(PCIM_CMD_BUSMASTEREN | PCIM_CMD_MEMEN);
pci_write_config(dev, PCIR_COMMAND,
adapter->hw.bus.pci_cmd_word, 2);
}
/* Save off the information about this board */
adapter->hw.vendor_id = pci_get_vendor(dev);
@@ -2750,7 +2742,7 @@ static int
em_setup_msix(struct adapter *adapter)
{
device_t dev = adapter->dev;
int val = 0;
int val;
/*
** Setup MSI/X for Hartwell: tests have shown
@@ -2764,37 +2756,43 @@ em_setup_msix(struct adapter *adapter)
int rid = PCIR_BAR(EM_MSIX_BAR);
adapter->msix_mem = bus_alloc_resource_any(dev,
SYS_RES_MEMORY, &rid, RF_ACTIVE);
if (!adapter->msix_mem) {
if (adapter->msix_mem == NULL) {
/* May not be enabled */
device_printf(adapter->dev,
"Unable to map MSIX table \n");
goto msi;
}
val = pci_msix_count(dev);
/* We only need 3 vectors */
if (val > 3)
/* We only need/want 3 vectors */
if (val >= 3)
val = 3;
if ((val != 3) && (val != 5)) {
bus_release_resource(dev, SYS_RES_MEMORY,
PCIR_BAR(EM_MSIX_BAR), adapter->msix_mem);
adapter->msix_mem = NULL;
else {
device_printf(adapter->dev,
"MSIX: incorrect vectors, using MSI\n");
"MSIX: insufficient vectors, using MSI\n");
goto msi;
}
if (pci_alloc_msix(dev, &val) == 0) {
if ((pci_alloc_msix(dev, &val) == 0) && (val == 3)) {
device_printf(adapter->dev,
"Using MSIX interrupts "
"with %d vectors\n", val);
return (val);
}
return (val);
/*
** If MSIX alloc failed or provided us with
** less than needed, free and fall through to MSI
*/
pci_release_msi(dev);
}
msi:
val = pci_msi_count(dev);
if (val == 1 && pci_alloc_msi(dev, &val) == 0) {
adapter->msix = 1;
if (adapter->msix_mem != NULL) {
bus_release_resource(dev, SYS_RES_MEMORY,
PCIR_BAR(EM_MSIX_BAR), adapter->msix_mem);
adapter->msix_mem = NULL;
}
val = 1;
if (pci_alloc_msi(dev, &val) == 0) {
device_printf(adapter->dev,"Using an MSI interrupt\n");
return (val);
}
+33 -24
View File
@@ -972,7 +972,13 @@ igb_mq_start(struct ifnet *ifp, struct mbuf *m)
que = &adapter->queues[i];
err = drbr_enqueue(ifp, txr->br, m);
taskqueue_enqueue(que->tq, &txr->txq_task);
if (err)
return (err);
if (IGB_TX_TRYLOCK(txr)) {
err = igb_mq_start_locked(ifp, txr);
IGB_TX_UNLOCK(txr);
} else
taskqueue_enqueue(que->tq, &txr->txq_task);
return (err);
}
@@ -1572,6 +1578,10 @@ igb_msix_que(void *arg)
u32 newitr = 0;
bool more_rx;
/* Ignore spurious interrupts */
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
return;
E1000_WRITE_REG(&adapter->hw, E1000_EIMC, que->eims);
++que->irqs;
@@ -2406,16 +2416,8 @@ igb_identify_hardware(struct adapter *adapter)
device_t dev = adapter->dev;
/* Make sure our PCI config space has the necessary stuff set */
pci_enable_busmaster(dev);
adapter->hw.bus.pci_cmd_word = pci_read_config(dev, PCIR_COMMAND, 2);
if (!((adapter->hw.bus.pci_cmd_word & PCIM_CMD_BUSMASTEREN) &&
(adapter->hw.bus.pci_cmd_word & PCIM_CMD_MEMEN))) {
INIT_DEBUGOUT("Memory Access and/or Bus Master "
"bits were not set!\n");
adapter->hw.bus.pci_cmd_word |=
(PCIM_CMD_BUSMASTEREN | PCIM_CMD_MEMEN);
pci_write_config(dev, PCIR_COMMAND,
adapter->hw.bus.pci_cmd_word, 2);
}
/* Save off the information about this board */
adapter->hw.vendor_id = pci_get_vendor(dev);
@@ -2838,24 +2840,19 @@ igb_setup_msix(struct adapter *adapter)
goto msi;
/* First try MSI/X */
msgs = pci_msix_count(dev);
if (msgs == 0)
goto msi;
rid = PCIR_BAR(IGB_MSIX_BAR);
adapter->msix_mem = bus_alloc_resource_any(dev,
SYS_RES_MEMORY, &rid, RF_ACTIVE);
if (!adapter->msix_mem) {
if (adapter->msix_mem == NULL) {
/* May not be enabled */
device_printf(adapter->dev,
"Unable to map MSIX table \n");
goto msi;
}
msgs = pci_msix_count(dev);
if (msgs == 0) { /* system has msix disabled */
bus_release_resource(dev, SYS_RES_MEMORY,
PCIR_BAR(IGB_MSIX_BAR), adapter->msix_mem);
adapter->msix_mem = NULL;
goto msi;
}
/* Figure out a reasonable auto config value */
queues = (mp_ncpus > (msgs-1)) ? (msgs-1) : mp_ncpus;
@@ -2898,20 +2895,32 @@ igb_setup_msix(struct adapter *adapter)
"MSIX Configuration Problem, "
"%d vectors configured, but %d queues wanted!\n",
msgs, want);
return (0);
goto msi;
}
if ((msgs) && pci_alloc_msix(dev, &msgs) == 0) {
if ((pci_alloc_msix(dev, &msgs) == 0) && (msgs == want)) {
device_printf(adapter->dev,
"Using MSIX interrupts with %d vectors\n", msgs);
adapter->num_queues = queues;
return (msgs);
}
/*
** If MSIX alloc failed or provided us with
** less than needed, free and fall through to MSI
*/
pci_release_msi(dev);
msi:
msgs = pci_msi_count(dev);
if (msgs == 1 && pci_alloc_msi(dev, &msgs) == 0) {
device_printf(adapter->dev," Using MSI interrupt\n");
if (adapter->msix_mem != NULL) {
bus_release_resource(dev, SYS_RES_MEMORY,
PCIR_BAR(IGB_MSIX_BAR), adapter->msix_mem);
adapter->msix_mem = NULL;
}
msgs = 1;
if (pci_alloc_msi(dev, &msgs) == 0) {
device_printf(adapter->dev," Using an MSI interrupt\n");
return (msgs);
}
device_printf(adapter->dev," Using a Legacy interrupt\n");
return (0);
}
+1 -9
View File
@@ -2119,16 +2119,8 @@ lem_identify_hardware(struct adapter *adapter)
device_t dev = adapter->dev;
/* Make sure our PCI config space has the necessary stuff set */
pci_enable_busmaster(dev);
adapter->hw.bus.pci_cmd_word = pci_read_config(dev, PCIR_COMMAND, 2);
if (!((adapter->hw.bus.pci_cmd_word & PCIM_CMD_BUSMASTEREN) &&
(adapter->hw.bus.pci_cmd_word & PCIM_CMD_MEMEN))) {
device_printf(dev, "Memory Access and/or Bus Master bits "
"were not set!\n");
adapter->hw.bus.pci_cmd_word |=
(PCIM_CMD_BUSMASTEREN | PCIM_CMD_MEMEN);
pci_write_config(dev, PCIR_COMMAND,
adapter->hw.bus.pci_cmd_word, 2);
}
/* Save off the information about this board */
adapter->hw.vendor_id = pci_get_vendor(dev);
+2 -10
View File
@@ -2829,21 +2829,13 @@ fatm_attach(device_t dev)
ifp->if_linkmiblen = sizeof(IFP2IFATM(sc->ifp)->mib);
/*
* Enable memory and bustmaster
* Enable busmaster
*/
cfg = pci_read_config(dev, PCIR_COMMAND, 2);
cfg |= PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN;
pci_write_config(dev, PCIR_COMMAND, cfg, 2);
pci_enable_busmaster(dev);
/*
* Map memory
*/
cfg = pci_read_config(dev, PCIR_COMMAND, 2);
if (!(cfg & PCIM_CMD_MEMEN)) {
if_printf(ifp, "failed to enable memory mapping\n");
error = ENXIO;
goto fail;
}
sc->memid = 0x10;
sc->memres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->memid,
RF_ACTIVE);
+7 -1
View File
@@ -180,6 +180,7 @@ filemon_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag __unused,
{
int error = 0;
struct filemon *filemon;
struct proc *p;
#if __FreeBSD_version < 701000
filemon = dev->si_drv1;
@@ -202,7 +203,12 @@ filemon_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag __unused,
/* Set the monitored process ID. */
case FILEMON_SET_PID:
filemon->pid = *((pid_t *) data);
error = pget(*((pid_t *)data), PGET_CANDEBUG | PGET_NOTWEXIT,
&p);
if (error == 0) {
filemon->pid = p->p_pid;
PROC_UNLOCK(p);
}
break;
default:
+1
View File
@@ -574,6 +574,7 @@ filemon_wrapper_sys_exit(struct thread *td, struct sys_exit_args *uap)
(uintmax_t)now.tv_sec, (uintmax_t)now.tv_usec);
filemon_output(filemon, filemon->msgbufr, len);
filemon->pid = -1;
}
/* Unlock the found filemon structure. */
+1 -1
View File
@@ -242,7 +242,7 @@ fwohci_pci_init(device_t self)
uint16_t cmd;
cmd = pci_read_config(self, PCIR_COMMAND, 2);
cmd |= PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN | PCIM_CMD_MWRICEN;
cmd |= PCIM_CMD_BUSMASTEREN | PCIM_CMD_MWRICEN;
#if 1 /* for broken hardware */
cmd &= ~PCIM_CMD_MWRICEN;
#endif
+1 -1
View File
@@ -452,7 +452,6 @@ fxp_attach(device_t dev)
* Enable bus mastering.
*/
pci_enable_busmaster(dev);
val = pci_read_config(dev, PCIR_COMMAND, 2);
/*
* Figure out which we should try first - memory mapping or i/o mapping?
@@ -610,6 +609,7 @@ fxp_attach(device_t dev)
* is a valid cacheline size (8 or 16 dwords), then tell
* the board to turn on MWI.
*/
val = pci_read_config(dev, PCIR_COMMAND, 2);
if (val & PCIM_CMD_MWRICEN &&
pci_read_config(dev, PCIR_CACHELNSZ, 1) != 0)
sc->flags |= FXP_FLAG_MWI_ENABLE;
+1 -7
View File
@@ -1686,7 +1686,7 @@ hatm_attach(device_t dev)
* 4.2 BIOS Configuration
*/
v = pci_read_config(dev, PCIR_COMMAND, 2);
v |= PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN | PCIM_CMD_MWRICEN;
v |= PCIM_CMD_BUSMASTEREN | PCIM_CMD_MWRICEN;
pci_write_config(dev, PCIR_COMMAND, v, 2);
/*
@@ -1702,12 +1702,6 @@ hatm_attach(device_t dev)
/*
* Map memory
*/
v = pci_read_config(dev, PCIR_COMMAND, 2);
if (!(v & PCIM_CMD_MEMEN)) {
device_printf(dev, "failed to enable memory\n");
error = ENXIO;
goto failed;
}
sc->memid = PCIR_BAR(0);
sc->memres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->memid,
RF_ACTIVE);
+1 -1
View File
@@ -52,7 +52,7 @@ static int hpt_probe(device_t dev)
memset(hba, 0, sizeof(HBA));
hba->ext_type = EXT_TYPE_HBA;
hba->ldm_adapter.him = him;
return 0;
return (BUS_PROBE_DEFAULT);
}
}
}
-11
View File
@@ -236,19 +236,8 @@ ida_pci_attach(device_t dev)
struct ida_board *board = ida_pci_match(dev);
u_int32_t id = pci_get_devid(dev);
struct ida_softc *ida;
u_int command;
int error, rid;
command = pci_read_config(dev, PCIR_COMMAND, 1);
/*
* it appears that this board only does MEMIO access.
*/
if ((command & PCIM_CMD_MEMEN) == 0) {
device_printf(dev, "Only memory mapped I/O is supported\n");
return (ENXIO);
}
ida = (struct ida_softc *)device_get_softc(dev);
ida->dev = dev;
ida->cmd = *board->accessor;
+10 -15
View File
@@ -59,7 +59,6 @@ static int ips_pci_probe(device_t dev)
static int ips_pci_attach(device_t dev)
{
u_int32_t command;
ips_softc_t *sc;
@@ -95,22 +94,18 @@ static int ips_pci_attach(device_t dev)
} else
goto error;
/* make sure busmastering is on */
command = pci_read_config(dev, PCIR_COMMAND, 1);
command |= PCIM_CMD_BUSMASTEREN;
pci_write_config(dev, PCIR_COMMAND, command, 1);
pci_enable_busmaster(dev);
/* seting up io space */
sc->iores = NULL;
if(command & PCIM_CMD_MEMEN){
PRINTF(10, "trying MEMIO\n");
if(pci_get_device(dev) == IPS_COPPERHEAD_DEVICE_ID)
sc->rid = PCIR_BAR(1);
else
sc->rid = PCIR_BAR(0);
sc->iotype = SYS_RES_MEMORY;
sc->iores = bus_alloc_resource_any(dev, sc->iotype,
&sc->rid, RF_ACTIVE);
}
if(!sc->iores && command & PCIM_CMD_PORTEN){
PRINTF(10, "trying MEMIO\n");
if(pci_get_device(dev) == IPS_COPPERHEAD_DEVICE_ID)
sc->rid = PCIR_BAR(1);
else
sc->rid = PCIR_BAR(0);
sc->iotype = SYS_RES_MEMORY;
sc->iores = bus_alloc_resource_any(dev, sc->iotype, &sc->rid,
RF_ACTIVE);
if(!sc->iores){
PRINTF(10, "trying PORTIO\n");
sc->rid = PCIR_BAR(0);
sc->iotype = SYS_RES_IOPORT;
+5 -7
View File
@@ -706,13 +706,10 @@ isp_pci_attach(device_t dev)
pcs->irq = pcs->regs = NULL;
pcs->rgd = pcs->rtp = pcs->iqd = 0;
cmd = pci_read_config(dev, PCIR_COMMAND, 2);
if (cmd & m1) {
pcs->rtp = (m1 == PCIM_CMD_MEMEN)? SYS_RES_MEMORY : SYS_RES_IOPORT;
pcs->rgd = (m1 == PCIM_CMD_MEMEN)? MEM_MAP_REG : IO_MAP_REG;
pcs->regs = bus_alloc_resource_any(dev, pcs->rtp, &pcs->rgd, RF_ACTIVE);
}
if (pcs->regs == NULL && (cmd & m2)) {
pcs->rtp = (m1 == PCIM_CMD_MEMEN)? SYS_RES_MEMORY : SYS_RES_IOPORT;
pcs->rgd = (m1 == PCIM_CMD_MEMEN)? MEM_MAP_REG : IO_MAP_REG;
pcs->regs = bus_alloc_resource_any(dev, pcs->rtp, &pcs->rgd, RF_ACTIVE);
if (pcs->regs == NULL) {
pcs->rtp = (m2 == PCIM_CMD_MEMEN)? SYS_RES_MEMORY : SYS_RES_IOPORT;
pcs->rgd = (m2 == PCIM_CMD_MEMEN)? MEM_MAP_REG : IO_MAP_REG;
pcs->regs = bus_alloc_resource_any(dev, pcs->rtp, &pcs->rgd, RF_ACTIVE);
@@ -891,6 +888,7 @@ isp_pci_attach(device_t dev)
/*
* Make sure that SERR, PERR, WRITE INVALIDATE and BUSMASTER are set.
*/
cmd = pci_read_config(dev, PCIR_COMMAND, 2);
cmd |= PCIM_CMD_SEREN | PCIM_CMD_PERRESPEN | PCIM_CMD_BUSMASTEREN | PCIM_CMD_INVEN;
if (IS_2300(isp)) { /* per QLogic errata */
cmd &= ~PCIM_CMD_INVEN;
+2 -2
View File
@@ -455,12 +455,12 @@ iwn_attach(device_t dev)
pci_write_config(dev, 0x41, 0, 1);
/* Hardware bug workaround. */
reg = pci_read_config(dev, PCIR_COMMAND, 1);
reg = pci_read_config(dev, PCIR_COMMAND, 2);
if (reg & PCIM_CMD_INTxDIS) {
DPRINTF(sc, IWN_DEBUG_RESET, "%s: PCIe INTx Disable set\n",
__func__);
reg &= ~PCIM_CMD_INTxDIS;
pci_write_config(dev, PCIR_COMMAND, reg, 1);
pci_write_config(dev, PCIR_COMMAND, reg, 2);
}
/* Enable bus-mastering. */
+2 -8
View File
@@ -1209,15 +1209,9 @@ ixgb_identify_hardware(struct adapter * adapter)
device_t dev = adapter->dev;
/* Make sure our PCI config space has the necessary stuff set */
pci_enable_busmaster(dev);
adapter->hw.pci_cmd_word = pci_read_config(dev, PCIR_COMMAND, 2);
if (!((adapter->hw.pci_cmd_word & PCIM_CMD_BUSMASTEREN) &&
(adapter->hw.pci_cmd_word & PCIM_CMD_MEMEN))) {
device_printf(dev,
"Memory Access and/or Bus Master bits were not set!\n");
adapter->hw.pci_cmd_word |=
(PCIM_CMD_BUSMASTEREN | PCIM_CMD_MEMEN);
pci_write_config(dev, PCIR_COMMAND, adapter->hw.pci_cmd_word, 2);
}
/* Save off the information about this board */
adapter->hw.vendor_id = pci_get_vendor(dev);
adapter->hw.device_id = pci_get_device(dev);
+45 -41
View File
@@ -45,7 +45,7 @@ int ixgbe_display_debug_stats = 0;
/*********************************************************************
* Driver version
*********************************************************************/
char ixgbe_driver_version[] = "2.5.13";
char ixgbe_driver_version[] = "2.5.15";
/*********************************************************************
* PCI Device ID Table
@@ -297,6 +297,7 @@ TUNABLE_INT("hw.ixgbe.rxd", &ixgbe_rxd);
** doing so you are on your own :)
*/
static int allow_unsupported_sfp = FALSE;
TUNABLE_INT("hw.ixgbe.unsupported_sfp", &allow_unsupported_sfp);
/*
** HW RSC control:
@@ -1071,7 +1072,7 @@ ixgbe_init_locked(struct adapter *adapter)
u32 rxdctl, rxctrl;
mtx_assert(&adapter->core_mtx, MA_OWNED);
INIT_DEBUGOUT("ixgbe_init: begin");
INIT_DEBUGOUT("ixgbe_init_locked: begin");
hw->adapter_stopped = FALSE;
ixgbe_stop_adapter(hw);
callout_stop(&adapter->timer);
@@ -1382,23 +1383,6 @@ ixgbe_disable_queue(struct adapter *adapter, u32 vector)
}
}
static inline void
ixgbe_rearm_queues(struct adapter *adapter, u64 queues)
{
u32 mask;
if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
mask = (IXGBE_EIMS_RTX_QUEUE & queues);
IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, mask);
} else {
mask = (queues & 0xFFFFFFFF);
IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS_EX(0), mask);
mask = (queues >> 32);
IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS_EX(1), mask);
}
}
static void
ixgbe_handle_que(void *context, int pending)
{
@@ -1506,6 +1490,10 @@ ixgbe_msix_que(void *arg)
bool more;
u32 newitr = 0;
/* Protect against spurious interrupts */
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
return;
ixgbe_disable_queue(adapter, que->msix);
++que->irqs;
@@ -1592,6 +1580,8 @@ ixgbe_msix_link(void *arg)
/* First get the cause */
reg_eicr = IXGBE_READ_REG(hw, IXGBE_EICS);
/* Be sure the queue bits are not cleared */
reg_eicr &= ~IXGBE_EICR_RTX_QUEUE;
/* Clear interrupt with write */
IXGBE_WRITE_REG(hw, IXGBE_EICR, reg_eicr);
@@ -2067,7 +2057,6 @@ ixgbe_local_timer(void *arg)
goto watchdog;
out:
ixgbe_rearm_queues(adapter, adapter->que_mask);
callout_reset(&adapter->timer, hz, ixgbe_local_timer, adapter);
return;
@@ -2426,29 +2415,24 @@ ixgbe_setup_msix(struct adapter *adapter)
goto msi;
/* First try MSI/X */
msgs = pci_msix_count(dev);
if (msgs == 0)
goto msi;
rid = PCIR_BAR(MSIX_82598_BAR);
adapter->msix_mem = bus_alloc_resource_any(dev,
SYS_RES_MEMORY, &rid, RF_ACTIVE);
if (!adapter->msix_mem) {
if (adapter->msix_mem == NULL) {
rid += 4; /* 82599 maps in higher BAR */
adapter->msix_mem = bus_alloc_resource_any(dev,
SYS_RES_MEMORY, &rid, RF_ACTIVE);
}
if (!adapter->msix_mem) {
if (adapter->msix_mem == NULL) {
/* May not be enabled */
device_printf(adapter->dev,
"Unable to map MSIX table \n");
goto msi;
}
msgs = pci_msix_count(dev);
if (msgs == 0) { /* system has msix disabled */
bus_release_resource(dev, SYS_RES_MEMORY,
rid, adapter->msix_mem);
adapter->msix_mem = NULL;
goto msi;
}
/* Figure out a reasonable auto config value */
queues = (mp_ncpus > (msgs-1)) ? (msgs-1) : mp_ncpus;
@@ -2470,21 +2454,33 @@ ixgbe_setup_msix(struct adapter *adapter)
"MSIX Configuration Problem, "
"%d vectors but %d queues wanted!\n",
msgs, want);
return (0); /* Will go to Legacy setup */
goto msi;
}
if ((msgs) && pci_alloc_msix(dev, &msgs) == 0) {
if ((pci_alloc_msix(dev, &msgs) == 0) && (msgs == want)) {
device_printf(adapter->dev,
"Using MSIX interrupts with %d vectors\n", msgs);
adapter->num_queues = queues;
return (msgs);
}
/*
** If MSIX alloc failed or provided us with
** less than needed, free and fall through to MSI
*/
pci_release_msi(dev);
msi:
msgs = pci_msi_count(dev);
if (msgs == 1 && pci_alloc_msi(dev, &msgs) == 0)
if (adapter->msix_mem != NULL) {
bus_release_resource(dev, SYS_RES_MEMORY,
rid, adapter->msix_mem);
adapter->msix_mem = NULL;
}
msgs = 1;
if (pci_alloc_msi(dev, &msgs) == 0) {
device_printf(adapter->dev,"Using an MSI interrupt\n");
else
device_printf(adapter->dev,"Using a Legacy interrupt\n");
return (msgs);
return (msgs);
}
device_printf(adapter->dev,"Using a Legacy interrupt\n");
return (0);
}
@@ -3201,7 +3197,7 @@ ixgbe_free_transmit_buffers(struct tx_ring *txr)
struct ixgbe_tx_buf *tx_buffer;
int i;
INIT_DEBUGOUT("free_transmit_ring: begin");
INIT_DEBUGOUT("ixgbe_free_transmit_ring: begin");
if (txr->tx_buffers == NULL)
return;
@@ -3940,6 +3936,7 @@ ixgbe_free_receive_ring(struct rx_ring *rxr)
rxbuf->buf->m_flags |= M_PKTHDR;
m_freem(rxbuf->buf);
rxbuf->buf = NULL;
rxbuf->flags = 0;
}
}
}
@@ -4004,11 +4001,13 @@ ixgbe_setup_receive_ring(struct rx_ring *rxr)
addr = PNMB(slot + sj, &paddr);
netmap_load_map(rxr->ptag, rxbuf->pmap, addr);
/* Update descriptor */
/* Update descriptor and the cached value */
rxr->rx_base[j].read.pkt_addr = htole64(paddr);
rxbuf->addr = htole64(paddr);
continue;
}
#endif /* DEV_NETMAP */
rxbuf->flags = 0;
rxbuf->buf = m_getjcl(M_NOWAIT, MT_DATA,
M_PKTHDR, adapter->rx_mbuf_sz);
if (rxbuf->buf == NULL) {
@@ -4025,8 +4024,9 @@ ixgbe_setup_receive_ring(struct rx_ring *rxr)
goto fail;
bus_dmamap_sync(rxr->ptag,
rxbuf->pmap, BUS_DMASYNC_PREREAD);
/* Update descriptor */
/* Update the descriptor and the cached value */
rxr->rx_base[j].read.pkt_addr = htole64(seg[0].ds_addr);
rxbuf->addr = htole64(seg[0].ds_addr);
}
@@ -4243,6 +4243,8 @@ ixgbe_free_receive_structures(struct adapter *adapter)
{
struct rx_ring *rxr = adapter->rx_rings;
INIT_DEBUGOUT("ixgbe_free_receive_structures: begin");
for (int i = 0; i < adapter->num_queues; i++, rxr++) {
struct lro_ctrl *lro = &rxr->lro;
ixgbe_free_receive_buffers(rxr);
@@ -4267,7 +4269,7 @@ ixgbe_free_receive_buffers(struct rx_ring *rxr)
struct adapter *adapter = rxr->adapter;
struct ixgbe_rx_buf *rxbuf;
INIT_DEBUGOUT("free_receive_structures: begin");
INIT_DEBUGOUT("ixgbe_free_receive_buffers: begin");
/* Cleanup any existing buffers */
if (rxr->rx_buffers != NULL) {
@@ -4357,6 +4359,8 @@ ixgbe_rx_discard(struct rx_ring *rxr, int i)
m_free(rbuf->buf);
rbuf->buf = NULL;
}
rbuf->flags = 0;
return;
}
+12 -18
View File
@@ -1561,14 +1561,8 @@ ixv_identify_hardware(struct adapter *adapter)
** Make sure BUSMASTER is set, on a VM under
** KVM it may not be and will break things.
*/
pci_enable_busmaster(dev);
pci_cmd_word = pci_read_config(dev, PCIR_COMMAND, 2);
if (!((pci_cmd_word & PCIM_CMD_BUSMASTEREN) &&
(pci_cmd_word & PCIM_CMD_MEMEN))) {
INIT_DEBUGOUT("Memory Access and/or Bus Master "
"bits were not set!\n");
pci_cmd_word |= (PCIM_CMD_BUSMASTEREN | PCIM_CMD_MEMEN);
pci_write_config(dev, PCIR_COMMAND, pci_cmd_word, 2);
}
/* Save off the information about this board */
adapter->hw.vendor_id = pci_get_vendor(dev);
@@ -1686,37 +1680,37 @@ static int
ixv_setup_msix(struct adapter *adapter)
{
device_t dev = adapter->dev;
int rid, vectors, want = 2;
int rid, want;
/* First try MSI/X */
rid = PCIR_BAR(3);
adapter->msix_mem = bus_alloc_resource_any(dev,
SYS_RES_MEMORY, &rid, RF_ACTIVE);
if (!adapter->msix_mem) {
if (adapter->msix_mem == NULL) {
device_printf(adapter->dev,
"Unable to map MSIX table \n");
goto out;
}
vectors = pci_msix_count(dev);
if (vectors < 2) {
bus_release_resource(dev, SYS_RES_MEMORY,
rid, adapter->msix_mem);
adapter->msix_mem = NULL;
goto out;
}
/*
** Want two vectors: one for a queue,
** plus an additional for mailbox.
*/
if (pci_alloc_msix(dev, &want) == 0) {
want = 2;
if ((pci_alloc_msix(dev, &want) == 0) && (want == 2)) {
device_printf(adapter->dev,
"Using MSIX interrupts with %d vectors\n", want);
return (want);
}
/* Release in case alloc was insufficient */
pci_release_msi(dev);
out:
if (adapter->msix_mem != NULL) {
bus_release_resource(dev, SYS_RES_MEMORY,
rid, adapter->msix_mem);
adapter->msix_mem = NULL;
}
device_printf(adapter->dev,"MSIX config error\n");
return (ENXIO);
}
+2 -14
View File
@@ -187,7 +187,6 @@ mfi_pci_attach(device_t dev)
{
struct mfi_softc *sc;
struct mfi_ident *m;
uint32_t command;
int count, error;
sc = device_get_softc(dev);
@@ -196,19 +195,8 @@ mfi_pci_attach(device_t dev)
m = mfi_find_ident(dev);
sc->mfi_flags = m->flags;
/* Verify that the adapter can be set up in PCI space */
command = pci_read_config(dev, PCIR_COMMAND, 2);
command |= PCIM_CMD_BUSMASTEREN;
pci_write_config(dev, PCIR_COMMAND, command, 2);
command = pci_read_config(dev, PCIR_COMMAND, 2);
if ((command & PCIM_CMD_BUSMASTEREN) == 0) {
device_printf(dev, "Can't enable PCI busmaster\n");
return (ENXIO);
}
if ((command & PCIM_CMD_MEMEN) == 0) {
device_printf(dev, "PCI memory window not available\n");
return (ENXIO);
}
/* Ensure busmastering is enabled */
pci_enable_busmaster(dev);
/* Allocate PCI registers */
if ((sc->mfi_flags & MFI_FLAGS_1064R) ||
+1 -11
View File
@@ -113,21 +113,11 @@ mlx_pci_attach(device_t dev)
{
struct mlx_softc *sc;
int i, error;
u_int32_t command;
debug_called(1);
/*
* Make sure we are going to be able to talk to this board.
*/
command = pci_read_config(dev, PCIR_COMMAND, 2);
if ((command & PCIM_CMD_MEMEN) == 0) {
device_printf(dev, "memory window not available\n");
return(ENXIO);
}
/* force the busmaster enable bit on */
command |= PCIM_CMD_BUSMASTEREN;
pci_write_config(dev, PCIR_COMMAND, command, 2);
pci_enable_busmaster(dev);
/*
* Initialise softc.
+1 -15
View File
@@ -333,7 +333,6 @@ static int
mly_pci_attach(struct mly_softc *sc)
{
int i, error;
u_int32_t command;
debug_called(1);
@@ -342,21 +341,8 @@ mly_pci_attach(struct mly_softc *sc)
/*
* Verify that the adapter is correctly set up in PCI space.
*
* XXX we shouldn't do this; the PCI code should.
*/
command = pci_read_config(sc->mly_dev, PCIR_COMMAND, 2);
command |= PCIM_CMD_BUSMASTEREN;
pci_write_config(sc->mly_dev, PCIR_COMMAND, command, 2);
command = pci_read_config(sc->mly_dev, PCIR_COMMAND, 2);
if (!(command & PCIM_CMD_BUSMASTEREN)) {
mly_printf(sc, "can't enable busmaster feature\n");
goto fail;
}
if ((command & PCIM_CMD_MEMEN) == 0) {
mly_printf(sc, "memory window not available\n");
goto fail;
}
pci_enable_busmaster(sc->mly_dev);
/*
* Allocate the PCI register window.
+2 -2
View File
@@ -1364,9 +1364,9 @@ mn_attach (device_t self)
return(ENXIO);
}
u = pci_read_config(self, PCIR_COMMAND, 1);
u = pci_read_config(self, PCIR_COMMAND, 2);
printf("%x\n", u);
pci_write_config(self, PCIR_COMMAND, u | PCIM_CMD_PERRESPEN | PCIM_CMD_BUSMASTEREN | PCIM_CMD_MEMEN, 1);
pci_write_config(self, PCIR_COMMAND, u | PCIM_CMD_PERRESPEN | PCIM_CMD_BUSMASTEREN, 2);
#if 0
pci_write_config(self, PCIR_COMMAND, 0x02800046, 4);
#endif
+1 -13
View File
@@ -183,7 +183,6 @@ mps_pci_attach(device_t dev)
{
struct mps_softc *sc;
struct mps_ident *m;
uint16_t command;
int error;
sc = device_get_softc(dev);
@@ -193,18 +192,7 @@ mps_pci_attach(device_t dev)
sc->mps_flags = m->flags;
/* Twiddle basic PCI config bits for a sanity check */
command = pci_read_config(dev, PCIR_COMMAND, 2);
command |= PCIM_CMD_BUSMASTEREN;
pci_write_config(dev, PCIR_COMMAND, command, 2);
command = pci_read_config(dev, PCIR_COMMAND, 2);
if ((command & PCIM_CMD_BUSMASTEREN) == 0) {
device_printf(dev, "Cannot enable PCI busmaster\n");
return (ENXIO);
}
if ((command & PCIM_CMD_MEMEN) == 0) {
device_printf(dev, "PCI memory window not available\n");
return (ENXIO);
}
pci_enable_busmaster(dev);
/* Allocate the System Interface Register Set */
sc->mps_regs_rid = PCIR_BAR(1);
+1 -6
View File
@@ -394,16 +394,11 @@ mpt_pci_attach(device_t dev)
/* Print INFO level (if any) if bootverbose is set */
mpt->verbose += (bootverbose != 0)? 1 : 0;
}
/* Make sure memory access decoders are enabled */
cmd = pci_read_config(dev, PCIR_COMMAND, 2);
if ((cmd & PCIM_CMD_MEMEN) == 0) {
device_printf(dev, "Memory accesses disabled");
return (ENXIO);
}
/*
* Make sure that SERR, PERR, WRITE INVALIDATE and BUSMASTER are set.
*/
cmd = pci_read_config(dev, PCIR_COMMAND, 2);
cmd |=
PCIM_CMD_SERRESPEN | PCIM_CMD_PERRESPEN |
PCIM_CMD_BUSMASTEREN | PCIM_CMD_MWRICEN;
+3 -30
View File
@@ -120,29 +120,6 @@ mwl_pci_probe(device_t dev)
return ENXIO;
}
static u_int32_t
mwl_pci_setup(device_t dev)
{
u_int32_t cmd;
/*
* Enable memory mapping and bus mastering.
*/
cmd = pci_read_config(dev, PCIR_COMMAND, 4);
cmd |= PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN;
pci_write_config(dev, PCIR_COMMAND, cmd, 4);
cmd = pci_read_config(dev, PCIR_COMMAND, 4);
if ((cmd & PCIM_CMD_MEMEN) == 0) {
device_printf(dev, "failed to enable memory mapping\n");
return 0;
}
if ((cmd & PCIM_CMD_BUSMASTEREN) == 0) {
device_printf(dev, "failed to enable bus mastering\n");
return 0;
}
return 1;
}
static int
mwl_pci_attach(device_t dev)
{
@@ -152,11 +129,8 @@ mwl_pci_attach(device_t dev)
sc->sc_dev = dev;
/*
* Enable memory mapping and bus mastering.
*/
if (!mwl_pci_setup(dev))
return 0;
pci_enable_busmaster(dev);
/*
* Setup memory-mapping of PCI registers.
*/
@@ -285,8 +259,7 @@ mwl_pci_resume(device_t dev)
{
struct mwl_pci_softc *psc = device_get_softc(dev);
if (!mwl_pci_setup(dev))
return ENXIO;
pci_enable_busmaster(dev);
mwl_resume(&psc->sc_sc);
+1 -4
View File
@@ -3826,7 +3826,7 @@ mxge_setup_cfg_space(mxge_softc_t *sc)
{
device_t dev = sc->dev;
int reg;
uint16_t cmd, lnk, pectl;
uint16_t lnk, pectl;
/* find the PCIe link width and set max read request to 4KB*/
if (pci_find_cap(dev, PCIY_EXPRESS, &reg) == 0) {
@@ -3846,9 +3846,6 @@ mxge_setup_cfg_space(mxge_softc_t *sc)
/* Enable DMA and Memory space access */
pci_enable_busmaster(dev);
cmd = pci_read_config(dev, PCIR_COMMAND, 2);
cmd |= PCIM_CMD_MEMEN;
pci_write_config(dev, PCIR_COMMAND, cmd, 2);
}
static uint32_t
+1 -4
View File
@@ -471,10 +471,7 @@ cbb_chipinit(struct cbb_softc *sc)
pci_write_config(sc->dev, PCIR_SUBBUS_2, sc->subbus, 1);
/* Enable memory access */
PCI_MASK_CONFIG(sc->dev, PCIR_COMMAND,
| PCIM_CMD_MEMEN
| PCIM_CMD_PORTEN
| PCIM_CMD_BUSMASTEREN, 2);
pci_enable_busmaster(sc->dev);
/* disable Legacy IO */
switch (sc->chipset) {
+1 -3
View File
@@ -88,9 +88,7 @@ iop_pci_attach(device_t dev)
RF_SHAREABLE | RF_ACTIVE);
/* now setup the infrastructure to talk to the device */
pci_write_config(dev, PCIR_COMMAND,
pci_read_config(dev, PCIR_COMMAND, 1) |
PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN, 1);
pci_enable_busmaster(dev);
sc->ibase = rman_get_virtual(sc->r_mem);
sc->reg = (struct i2o_registers *)sc->ibase;
-8
View File
@@ -151,7 +151,6 @@ rp_pciattach(device_t dev)
CONTROLLER_t *ctlp;
int unit;
int retval;
u_int32_t stcmd;
ctlp = device_get_softc(dev);
bzero(ctlp, sizeof(*ctlp));
@@ -161,13 +160,6 @@ rp_pciattach(device_t dev)
ctlp->aiop2off = rp_pci_aiop2off;
ctlp->ctlmask = rp_pci_ctlmask;
/* Wake up the device. */
stcmd = pci_read_config(dev, PCIR_COMMAND, 4);
if ((stcmd & PCIM_CMD_PORTEN) == 0) {
stcmd |= (PCIM_CMD_PORTEN);
pci_write_config(dev, PCIR_COMMAND, 4, stcmd);
}
/* The IO ports of AIOPs for a PCI controller are continuous. */
ctlp->io_num = 1;
ctlp->io_rid = malloc(sizeof(*(ctlp->io_rid)) * ctlp->io_num, M_DEVBUF, M_NOWAIT | M_ZERO);
+2 -15
View File
@@ -220,28 +220,15 @@ safe_attach(device_t dev)
{
struct safe_softc *sc = device_get_softc(dev);
u_int32_t raddr;
u_int32_t cmd, i, devinfo;
u_int32_t i, devinfo;
int rid;
bzero(sc, sizeof (*sc));
sc->sc_dev = dev;
/* XXX handle power management */
cmd = pci_read_config(dev, PCIR_COMMAND, 4);
cmd |= PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN;
pci_write_config(dev, PCIR_COMMAND, cmd, 4);
cmd = pci_read_config(dev, PCIR_COMMAND, 4);
if (!(cmd & PCIM_CMD_MEMEN)) {
device_printf(dev, "failed to enable memory mapping\n");
goto bad;
}
if (!(cmd & PCIM_CMD_BUSMASTEREN)) {
device_printf(dev, "failed to enable bus mastering\n");
goto bad;
}
pci_enable_busmaster(dev);
/*
* Setup memory-mapping of PCI registers.
+1 -4
View File
@@ -806,16 +806,13 @@ static int
als_pci_attach(device_t dev)
{
struct sc_info *sc;
u_int32_t data;
char status[SND_STATUSLEN];
sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
sc->lock = snd_mtxcreate(device_get_nameunit(dev), "snd_als4000 softc");
sc->dev = dev;
data = pci_read_config(dev, PCIR_COMMAND, 2);
data |= (PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN);
pci_write_config(dev, PCIR_COMMAND, data, 2);
pci_enable_busmaster(dev);
/*
* By default the power to the various components on the
* ALS4000 is entirely controlled by the pci powerstate. We
+1 -5
View File
@@ -550,7 +550,6 @@ au_pci_probe(device_t dev)
static int
au_pci_attach(device_t dev)
{
u_int32_t data;
struct au_info *au;
int type[10];
int regid[10];
@@ -565,10 +564,7 @@ au_pci_attach(device_t dev)
au = malloc(sizeof(*au), M_DEVBUF, M_WAITOK | M_ZERO);
au->unit = device_get_unit(dev);
data = pci_read_config(dev, PCIR_COMMAND, 2);
data |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN);
pci_write_config(dev, PCIR_COMMAND, data, 2);
data = pci_read_config(dev, PCIR_COMMAND, 2);
pci_enable_busmaster(dev);
j=0;
/* XXX dfr: is this strictly necessary? */
+1 -5
View File
@@ -935,15 +935,11 @@ static int
cmi_attach(device_t dev)
{
struct sc_info *sc;
u_int32_t data;
char status[SND_STATUSLEN];
sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
sc->lock = snd_mtxcreate(device_get_nameunit(dev), "snd_cmi softc");
data = pci_read_config(dev, PCIR_COMMAND, 2);
data |= (PCIM_CMD_PORTEN|PCIM_CMD_BUSMASTEREN);
pci_write_config(dev, PCIR_COMMAND, data, 2);
data = pci_read_config(dev, PCIR_COMMAND, 2);
pci_enable_busmaster(dev);
sc->dev = dev;
sc->regid = PCIR_BAR(0);
+1 -4
View File
@@ -760,16 +760,13 @@ cs4281_pci_attach(device_t dev)
{
struct sc_info *sc;
struct ac97_info *codec = NULL;
u_int32_t data;
char status[SND_STATUSLEN];
sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
sc->dev = dev;
sc->type = pci_get_devid(dev);
data = pci_read_config(dev, PCIR_COMMAND, 2);
data |= (PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN);
pci_write_config(dev, PCIR_COMMAND, data, 2);
pci_enable_busmaster(dev);
#if __FreeBSD_version > 500000
if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) {
+1 -7
View File
@@ -242,7 +242,6 @@ csa_probe(device_t dev)
static int
csa_attach(device_t dev)
{
u_int32_t stcmd;
sc_p scp;
csa_res *resp;
struct sndcard_func *func;
@@ -254,12 +253,7 @@ csa_attach(device_t dev)
bzero(scp, sizeof(*scp));
scp->dev = dev;
/* Wake up the device. */
stcmd = pci_read_config(dev, PCIR_COMMAND, 2);
if ((stcmd & PCIM_CMD_MEMEN) == 0 || (stcmd & PCIM_CMD_BUSMASTEREN) == 0) {
stcmd |= (PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN);
pci_write_config(dev, PCIR_COMMAND, stcmd, 2);
}
pci_enable_busmaster(dev);
/* Allocate the resources. */
resp = &scp->res;
Loaded 100 of 148 files, more files were not shown because too many files have changed in this diff. Show more