This commit is contained in:
Attilio Rao 2011-05-27 16:09:10 +00:00
commit 9cb46334ee
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/largeSMP/; revision=222364
30 changed files with 757 additions and 98 deletions

View File

@ -27,10 +27,8 @@ programs is:
mkbuiltins builtins builtins.h builtins.c
mkinit *.c init.c
mknodes nodetypes nodes.h nodes.c
mksignames - signames.h signames.c
mksyntax - syntax.h syntax.c
mktokens - token.h
bltin/mkexpr unary_op binary_op operators.h operators.c
There are undoubtedly too many of these. Mkinit searches all the
C source files for entries looking like:
@ -64,14 +62,6 @@ tion:
Preprocessor #define statements are copied to init.c without any
special action to request this.
INDENTATION: The ash source is indented in multiples of six
spaces. The only study that I have heard of on the subject con-
cluded that the optimal amount to indent is in the range of four
to six spaces. I use six spaces since it is not too big a jump
from the widely used eight spaces. If you really hate six space
indentation, use the adjind (source included) program to change
it to something else.
EXCEPTIONS: Code for dealing with exceptions appears in
exceptions.c. The C language doesn't include exception handling,
so I implement it using setjmp and longjmp. The global variable
@ -115,7 +105,7 @@ repeatedly parses and executes commands.
OPTIONS.C: This file contains the option processing code. It is
called from main to parse the shell arguments when the shell is
invoked, and it also contains the set builtin. The -i and -j op-
invoked, and it also contains the set builtin. The -i and -m op-
tions (the latter turns on job control) require changes in signal
handling. The routines setjobctl (in jobs.c) and setinteractive
(in trap.c) are called to handle changes to these options.
@ -123,10 +113,11 @@ handling. The routines setjobctl (in jobs.c) and setinteractive
PARSING: The parser code is all in parser.c. A recursive des-
cent parser is used. Syntax tables (generated by mksyntax) are
used to classify characters during lexical analysis. There are
three tables: one for normal use, one for use when inside single
quotes, and one for use when inside double quotes. The tables
are machine dependent because they are indexed by character vari-
ables and the range of a char varies from machine to machine.
four tables: one for normal use, one for use when inside single
quotes and dollar single quotes, one for use when inside double
quotes and one for use in arithmetic. The tables are machine
dependent because they are indexed by character variables and
the range of a char varies from machine to machine.
PARSE OUTPUT: The output of the parser consists of a tree of
nodes. The various types of nodes are defined in the file node-
@ -242,12 +233,7 @@ The routine shellexec is the interface to the exec system call.
EXPAND.C: Arguments are processed in three passes. The first
(performed by the routine argstr) performs variable and command
substitution. The second (ifsbreakup) performs word splitting
and the third (expandmeta) performs file name generation. If the
"/u" directory is simulated, then when "/u/username" is replaced
by the user's home directory, the flag "didudir" is set. This
tells the cd command that it should print out the directory name,
just as it would if the "/u" directory were implemented using
symbolic links.
and the third (expandmeta) performs file name generation.
VAR.C: Variables are stored in a hash table. Probably we should
switch to extensible hashing. The variable name is stored in the
@ -292,14 +278,7 @@ when the program is linked into ash. This #define should appear
before bltin.h is included; bltin.h will #undef main if the pro-
gram is to be compiled stand-alone.
CD.C: This file defines the cd and pwd builtins. The pwd com-
mand runs /bin/pwd the first time it is invoked (unless the user
has already done a cd to an absolute pathname), but then
remembers the current directory and updates it when the cd com-
mand is run, so subsequent pwd commands run very fast. The main
complication in the cd command is in the docd command, which
resolves symbolic links into actual names and informs the user
where the user ended up if he crossed a symbolic link.
CD.C: This file defines the cd and pwd builtins.
SIGNALS: Trap.c implements the trap command. The routine set-
signal figures out what action should be taken when a signal is

View File

@ -761,7 +761,8 @@ evalvar(char *p, int flag)
break;
record:
recordregion(startloc, expdest - stackblock(),
varflags & VSQUOTE);
varflags & VSQUOTE || (ifsset() && ifsval()[0] == '\0' &&
(*var == '@' || *var == '*')));
break;
case VSPLUS:
@ -947,7 +948,9 @@ varvalue(char *name, int quoted, int subtype, int flag)
sep = ' ';
for (ap = shellparam.p ; (p = *ap++) != NULL ; ) {
strtodest(p, flag, subtype, quoted);
if (*ap && sep)
if (!*ap)
break;
if (sep || (flag & EXP_FULL && !quoted && **ap != '\0'))
STPUTC(sep, expdest);
}
break;

View File

@ -6,6 +6,18 @@ FBSD_1.2 {
__iconv;
__iconv_free_list;
__iconv_get_list;
_libiconv_version;
iconv_canonicalize;
libiconv;
libiconv_close;
libiconv_open;
libiconv_open_into;
libiconv_set_relocation_prefix;
libiconvctl;
libiconvlist;
};
FBSDprivate_1.0 {
_citrus_bcs_convert_to_lower;
_citrus_bcs_convert_to_upper;
_citrus_bcs_isalnum;
@ -89,13 +101,4 @@ FBSD_1.2 {
_citrus_stdenc_close;
_citrus_stdenc_open;
_citrus_unmap_file;
_libiconv_version;
iconv_canonicalize;
libiconv;
libiconv_close;
libiconv_open;
libiconv_open_into;
libiconv_set_relocation_prefix;
libiconvctl;
libiconvlist;
};

View File

@ -262,7 +262,7 @@ send_rrq(int peer, char *filename, char *mode)
n = sendto(peer, buf, size, 0,
(struct sockaddr *)&peer_sock, peer_sock.ss_len);
if (n != size) {
tftp_log(LOG_ERR, "send_rrq: %s", n, strerror(errno));
tftp_log(LOG_ERR, "send_rrq: %d %s", n, strerror(errno));
return (1);
}
return (0);

View File

@ -101,7 +101,7 @@ struct g_command PUBSYM(class_commands)[] = {
{ 'l', "label", G_VAL_OPTIONAL, G_TYPE_STRING },
{ 'f', "flags", GPART_FLAGS, G_TYPE_STRING },
G_OPT_SENTINEL },
"[-a alignment] [-b start] [-s size] -t type [-i index] "
"-t type [-a alignment] [-b start] [-s size] [-i index] "
"[-l label] [-f flags] geom"
},
{ "backup", 0, gpart_backup, G_NULL_OPTS,
@ -113,7 +113,7 @@ struct g_command PUBSYM(class_commands)[] = {
{ 'i', GPART_PARAM_INDEX, G_VAL_OPTIONAL, G_TYPE_NUMBER },
{ 'f', "flags", GPART_FLAGS, G_TYPE_STRING },
G_OPT_SENTINEL },
"[-b bootcode] [-p partcode] [-i index] [-f flags] geom"
"[-b bootcode] [-p partcode -i index] [-f flags] geom"
},
{ "commit", 0, gpart_issue, G_NULL_OPTS,
"geom"
@ -157,7 +157,7 @@ struct g_command PUBSYM(class_commands)[] = {
{ 'r', "show_rawtype", NULL, G_TYPE_BOOL },
{ 'p', "show_providers", NULL, G_TYPE_BOOL },
G_OPT_SENTINEL },
"[-lrp] [geom ...]"
"[-l | -r] [-p] [geom ...]"
},
{ "undo", 0, gpart_issue, G_NULL_OPTS,
"geom"
@ -175,7 +175,7 @@ struct g_command PUBSYM(class_commands)[] = {
{ 'i', GPART_PARAM_INDEX, NULL, G_TYPE_NUMBER },
{ 'f', "flags", GPART_FLAGS, G_TYPE_STRING },
G_OPT_SENTINEL },
"[-a alignment] [-s size] -i index [-f flags] geom"
"-i index [-a alignment] [-s size] [-f flags] geom"
},
{ "restore", 0, gpart_restore, {
{ 'F', "force", NULL, G_TYPE_BOOL },

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd May 03, 2011
.Dd May 27, 2011
.Dt GPART 8
.Os
.Sh NAME
@ -170,7 +170,8 @@ utility:
.\" ==== SHOW ====
.Nm
.Cm show
.Op Fl lrp
.Op Fl l | Fl r
.Op Fl p
.Op Ar geom ...
.\" ==== UNDO ====
.Nm
@ -841,6 +842,33 @@ partition that would contain UFS where the system boots from.
/sbin/gpart add -b 162 -s 1048576 -t freebsd-ufs ad0
.Ed
.Pp
Create MBR scheme on
.Pa ada0 ,
then create 30GB-sized FreeBSD slice, mark it active and
install boot0 boot manager:
.Bd -literal -offset indent
/sbin/gpart create -s MBR ada0
/sbin/gpart add -t freebsd -s 30G ada0
/sbin/gpart set -a active -i 1 ada0
/sbin/gpart bootcode -b /boot/boot0 ada0
.Ed
.Pp
Now create BSD scheme (BSD label) with ability to have up to 20 partitions:
.Bd -literal -offset indent
/sbin/gpart create -s BSD -n 20 ada0s1
.Ed
.Pp
Create 1GB-sized UFS partition and 4GB-sized swap partition:
.Bd -literal -offset indent
/sbin/gpart add -t freebsd-ufs -s 1G ada0s1
/sbin/gpart add -t freebsd-swap -s 4G ada0s1
.Ed
.Pp
Install bootstrap code for the BSD label:
.Bd -literal -offset indent
/sbin/gpart bootcode -b /boot/boot ada0s1
.Ed
.Pp
Create VTOC8 scheme on
.Pa da0 .
.Bd -literal -offset indent

View File

@ -47,8 +47,8 @@
* sectorsize <= DESFRAGSIZE <= DESBLKSIZE
* DESBLKSIZE / DESFRAGSIZE <= 8
*/
#define DFL_FRAGSIZE 2048
#define DFL_BLKSIZE 16384
#define DFL_FRAGSIZE 4096
#define DFL_BLKSIZE 32768
/*
* Cylinder groups may have up to MAXBLKSPERCG blocks. The actual

View File

@ -175,6 +175,7 @@ XFILES= BSD_daemon/FreeBSD.pfa \
ses/setobjstat/setobjstat.0 \
ses/srcs/chpmon.c \
ses/srcs/eltsub.c \
ses/srcs/eltsub.h \
ses/srcs/getencstat.c \
ses/srcs/getnobj.c \
ses/srcs/getobjmap.c \

View File

@ -85,6 +85,9 @@ geteltnm(int type)
case SESTYP_KEYPAD:
sprintf(rbuf, "Key pad entry device");
break;
case SESTYP_ENCLOSURE:
sprintf(rbuf, "Enclosure");
break;
case SESTYP_SCSIXVR:
sprintf(rbuf, "SCSI port/transceiver");
break;
@ -109,6 +112,15 @@ geteltnm(int type)
case SESTYP_SUBENC:
sprintf(rbuf, "Simple sub-enclosure");
break;
case SESTYP_ARRAY:
sprintf(rbuf, "Array device");
break;
case SESTYP_SASEXPANDER:
sprintf(rbuf, "SAS Expander");
break;
case SESTYP_SASCONNECTOR:
sprintf(rbuf, "SAS Connector");
break;
default:
(void) sprintf(rbuf, "<Type 0x%x>", type);
break;

View File

@ -101,6 +101,7 @@ typedef struct {
#define SESTYP_UPS 0x0b
#define SESTYP_DISPLAY 0x0c
#define SESTYP_KEYPAD 0x0d
#define SESTYP_ENCLOSURE 0x0e
#define SESTYP_SCSIXVR 0x0f
#define SESTYP_LANGUAGE 0x10
#define SESTYP_COMPORT 0x11
@ -109,6 +110,9 @@ typedef struct {
#define SESTYP_SCSI_TGT 0x14
#define SESTYP_SCSI_INI 0x15
#define SESTYP_SUBENC 0x16
#define SESTYP_ARRAY 0x17
#define SESTYP_SASEXPANDER 0x18
#define SESTYP_SASCONNECTOR 0x19
/*
* Overall Enclosure Status

View File

@ -113,8 +113,10 @@ sysevent_add_attr(sysevent_attr_list_t **ev_attr_list, char *name,
}
break;
default:
#if 0
printf("%s: type %d is not implemented\n", __func__,
se_value->value_type);
#endif
break;
}
@ -286,8 +288,10 @@ log_sysevent(sysevent_t *evp, int flag, sysevent_id_t *eid)
break;
}
default:
#if 0
printf("%s: type %d is not implemented\n", __func__,
nvpair_type(elem));
#endif
break;
}
}

View File

@ -604,6 +604,9 @@ dev/ath/ath_hal/ah_eeprom_v14.c \
dev/ath/ath_hal/ah_eeprom_v4k.c \
optional ath_hal | ath_ar9285 \
compile-with "${NORMAL_C} -I$S/dev/ath"
dev/ath/ath_hal/ah_eeprom_9287.c \
optional ath_hal | ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath"
dev/ath/ath_hal/ah_regdomain.c optional ath \
compile-with "${NORMAL_C} -I$S/dev/ath"
# ar5210
@ -651,111 +654,128 @@ dev/ath/ath_hal/ar5211/ar5211_xmit.c optional ath_hal | ath_ar5211 \
# ar5212
dev/ath/ath_hal/ar5212/ar5212_ani.c \
optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
ath_ar9285 \
ath_ar9285 ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5212/ar5212_attach.c \
optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
ath_ar9285 \
ath_ar9285 ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5212/ar5212_beacon.c \
optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
ath_ar9285 \
ath_ar9285 ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5212/ar5212_eeprom.c \
optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
ath_ar9285 \
ath_ar9285 ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5212/ar5212_gpio.c \
optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
ath_ar9285 \
ath_ar9285 ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5212/ar5212_interrupts.c \
optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
ath_ar9285 \
ath_ar9285 ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5212/ar5212_keycache.c \
optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
ath_ar9285 \
ath_ar9285 ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5212/ar5212_misc.c \
optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
ath_ar9285 \
ath_ar9285 ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5212/ar5212_phy.c \
optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
ath_ar9285 \
ath_ar9285 ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5212/ar5212_power.c \
optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
ath_ar9285 \
ath_ar9285 ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5212/ar5212_recv.c \
optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
ath_ar9285 \
ath_ar9285 ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5212/ar5212_reset.c \
optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
ath_ar9285 \
ath_ar9285 ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5212/ar5212_rfgain.c \
optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
ath_ar9285 \
ath_ar9285 ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5212/ar5212_xmit.c \
optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
ath_ar9285 \
ath_ar9285 ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
# ar5416 (depends on ar5212)
dev/ath/ath_hal/ar5416/ar5416_ani.c \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5416/ar5416_attach.c \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5416/ar5416_beacon.c \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5416/ar5416_cal.c \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5416/ar5416_cal_iq.c \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5416/ar5416_cal_adcgain.c \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5416/ar5416_cal_adcdc.c \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5416/ar5416_eeprom.c \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5416/ar5416_gpio.c \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5416/ar5416_interrupts.c \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5416/ar5416_keycache.c \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5416/ar5416_misc.c \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5416/ar5416_phy.c \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5416/ar5416_power.c \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5416/ar5416_recv.c \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5416/ar5416_reset.c \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar5416/ar5416_xmit.c \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 \
optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
# ar9130 (depends upon ar5416) - also requires AH_SUPPORT_AR9130
dev/ath/ath_hal/ar9001/ar9130_attach.c optional ath_hal | ath_ar9130 \
@ -786,6 +806,16 @@ dev/ath/ath_hal/ar9002/ar9285_phy.c optional ath_hal | ath_ar9285 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar9002/ar9285_diversity.c optional ath_hal | ath_ar9285 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
# ar9287 (depends on ar5416)
dev/ath/ath_hal/ar9002/ar9287_attach.c optional ath_hal | ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar9002/ar9287_reset.c optional ath_hal | ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar9002/ar9287_cal.c optional ath_hal | ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar9002/ar9287_olc.c optional ath_hal | ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
# rf backends
dev/ath/ath_hal/ar5212/ar2316.c optional ath_rf2316 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
@ -807,6 +837,8 @@ dev/ath/ath_hal/ar9002/ar9280.c optional ath_hal | ath_ar9280 | ath_ar9285 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar9002/ar9285.c optional ath_hal | ath_ar9285 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar9002/ar9287.c optional ath_hal | ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
# ath rate control algorithms
dev/ath/ath_rate/amrr/amrr.c optional ath_rate_amrr \
compile-with "${NORMAL_C} -I$S/dev/ath"

View File

@ -87,10 +87,8 @@ ar9285_check_div_comb(struct ath_hal *ah)
HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom;
const MODAL_EEP4K_HEADER *pModal = &ee->ee_base.modalHeader;
#if 0
/* For now, simply disable this until it's better debugged. -adrian */
return AH_FALSE;
#endif
if (! AR_SREV_KITE(ah))
return AH_FALSE;

View File

@ -36,7 +36,7 @@ struct ar9287State {
RF_HAL_FUNCS base; /* public state, must be first */
uint16_t pcdacTable[1]; /* XXX */
};
#define AR9280(ah) ((struct ar9287State *) AH5212(ah)->ah_rfHal)
#define AR9287(ah) ((struct ar9287State *) AH5212(ah)->ah_rfHal)
static HAL_BOOL ar9287GetChannelMaxMinPower(struct ath_hal *,
const struct ieee80211_channel *, int16_t *maxPow,int16_t *minPow);

View File

@ -1292,6 +1292,12 @@ puc_config_timedia(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port,
uint16_t subdev;
switch (cmd) {
case PUC_CFG_GET_CLOCK:
if (port < 2)
*res = DEFAULT_RCLK * 8;
else
*res = DEFAULT_RCLK;
return (0);
case PUC_CFG_GET_DESC:
snprintf(desc, sizeof(desc),
"Timedia technology %d Port Serial", (int)sc->sc_cfg_data);

View File

@ -1458,10 +1458,20 @@ nfs_sync(struct mount *mp, int waitfor)
td = curthread;
MNT_ILOCK(mp);
/*
* If a forced dismount is in progress, return from here so that
* the umount(2) syscall doesn't get stuck in VFS_SYNC() before
* calling VFS_UNMOUNT().
*/
if ((mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) {
MNT_IUNLOCK(mp);
return (EBADF);
}
/*
* Force stale buffer cache information to be flushed.
*/
MNT_ILOCK(mp);
loop:
MNT_VNODE_FOREACH(vp, mp, mvp) {
VI_LOCK(vp);

View File

@ -423,12 +423,13 @@ g_part_mbr_read(struct g_part_table *basetable, struct g_consumer *cp)
struct g_part_mbr_table *table;
struct g_part_mbr_entry *entry;
u_char *buf, *p;
off_t chs, msize;
off_t chs, msize, first;
u_int sectors, heads;
int error, index;
pp = cp->provider;
table = (struct g_part_mbr_table *)basetable;
first = basetable->gpt_sectors;
msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
buf = g_read_data(cp, 0L, pp->sectorsize, &error);
@ -461,7 +462,8 @@ g_part_mbr_read(struct g_part_table *basetable, struct g_consumer *cp)
basetable->gpt_heads = heads;
}
}
if (ent.dp_start < first)
first = ent.dp_start;
entry = (struct g_part_mbr_entry *)g_part_new_entry(basetable,
index + 1, ent.dp_start, ent.dp_start + ent.dp_size - 1);
entry->ent = ent;
@ -471,6 +473,9 @@ g_part_mbr_read(struct g_part_table *basetable, struct g_consumer *cp)
basetable->gpt_first = basetable->gpt_sectors;
basetable->gpt_last = msize - 1;
if (first < basetable->gpt_first)
basetable->gpt_first = 1;
g_free(buf);
return (0);
}

View File

@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
#include <sys/proc.h>
#include <sys/posix4.h>
#include <sys/pioctl.h>
#include <sys/racct.h>
#include <sys/resourcevar.h>
#include <sys/sdt.h>
#include <sys/sbuf.h>
@ -3173,14 +3174,15 @@ coredump(struct thread *td)
* if it is larger than the limit.
*/
limit = (off_t)lim_cur(p, RLIMIT_CORE);
PROC_UNLOCK(p);
if (limit == 0) {
if (limit == 0 || racct_get_available(p, RACCT_CORE) == 0) {
PROC_UNLOCK(p);
#ifdef AUDIT
audit_proc_coredump(td, name, EFBIG);
#endif
free(name, M_TEMP);
return (EFBIG);
}
PROC_UNLOCK(p);
restart:
NDINIT(&nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_SYSSPACE, name, td);

View File

@ -116,6 +116,12 @@ SRCS+= ar9280.c ar9280_attach.c ar9280_olc.c
SRCS+= ar9285.c ar9285_reset.c ar9285_attach.c ar9285_cal.c ar9285_phy.c
SRCS+= ar9285_diversity.c
# + AR9287 - Kiwi
.PATH: ${.CURDIR}/../../dev/ath/ath_hal
SRCS+= ah_eeprom_9287.c
.PATH: ${.CURDIR}/../../dev/ath/ath_hal/ar9002
SRCS+= ar9287.c ar9287_reset.c ar9287_attach.c ar9287_cal.c ar9287_olc.c
# NB: rate control is bound to the driver by symbol names so only pick one
.if ${ATH_RATE} == "sample"
.PATH: ${.CURDIR}/../../dev/ath/ath_rate/sample

View File

@ -554,8 +554,8 @@ void ipoib_cm_handle_rx_wc(struct ipoib_dev_priv *priv, struct ib_wc *wc)
ipoib_dma_mb(priv, mb, wc->byte_len);
++dev->if_opackets;
dev->if_obytes += mb->m_pkthdr.len;
++dev->if_ipackets;
dev->if_ibytes += mb->m_pkthdr.len;
mb->m_pkthdr.rcvif = dev;
proto = *mtod(mb, uint16_t *);

View File

@ -166,8 +166,11 @@ bare_timebase_freq(platform_t plat, struct cpuref *cpuref)
phandle_t cpus, child;
pcell_t freq;
/* Backward compatibility. See 8-STABLE. */
ticks = bootinfo[3] >> 3;
if (bootinfo != NULL) {
/* Backward compatibility. See 8-STABLE. */
ticks = bootinfo[3] >> 3;
} else
ticks = 0;
if ((cpus = OF_finddevice("/cpus")) == 0)
goto out;

View File

@ -644,8 +644,8 @@
#define SPR_MCSRR1 0x23b /* ..8 571 Machine check SRR1 */
#define SPR_SVR 0x3ff /* ..8 1023 System Version Register */
#define SVR_MPC8533 0x803c
#define SVR_MPC8533E 0x8034
#define SVR_MPC8533 0x8034
#define SVR_MPC8533E 0x803c
#define SVR_MPC8541 0x8072
#define SVR_MPC8541E 0x807a
#define SVR_MPC8548 0x8031
@ -654,6 +654,14 @@
#define SVR_MPC8555E 0x8079
#define SVR_MPC8572 0x80e0
#define SVR_MPC8572E 0x80e8
#define SVR_P1011 0x80e5
#define SVR_P1011E 0x80ed
#define SVR_P1020 0x80e4
#define SVR_P1020E 0x80ec
#define SVR_P2010 0x80e3
#define SVR_P2010E 0x80eb
#define SVR_P2020 0x80e2
#define SVR_P2020E 0x80ea
#define SVR_VER(svr) (((svr) >> 16) & 0xffff)
#define SPR_PID0 0x030 /* ..8 Process ID Register 0 */

View File

@ -1873,10 +1873,7 @@ ffs_blkfree_cg(ump, fs, devvp, bno, size, inum, dephd)
/* devvp is a normal disk device */
dev = devvp->v_rdev;
cgblkno = fsbtodb(fs, cgtod(fs, cg));
ASSERT_VOP_LOCKED(devvp, "ffs_blkfree");
if ((devvp->v_vflag & VV_COPYONWRITE) &&
ffs_snapblkfree(fs, devvp, bno, size, inum))
return;
ASSERT_VOP_LOCKED(devvp, "ffs_blkfree_cg");
}
#ifdef INVARIANTS
if ((u_int)size > fs->fs_bsize || fragoff(fs, size) != 0 ||
@ -2030,6 +2027,17 @@ ffs_blkfree(ump, fs, devvp, bno, size, inum, dephd)
struct bio *bip;
struct ffs_blkfree_trim_params *tp;
/*
* Check to see if a snapshot wants to claim the block.
* Check that devvp is a normal disk device, not a snapshot,
* it has a snapshot(s) associated with it, and one of the
* snapshots wants to claim the block.
*/
if (devvp->v_type != VREG &&
(devvp->v_vflag & VV_COPYONWRITE) &&
ffs_snapblkfree(fs, devvp, bno, size, inum)) {
return;
}
if (!ump->um_candelete) {
ffs_blkfree_cg(ump, fs, devvp, bno, size, inum, dephd);
return;

View File

@ -0,0 +1,39 @@
# $FreeBSD$
c=: e= s=' '
failures=''
ok=''
check_result() {
if [ "x$2" = "x$3" ]; then
ok=x$ok
else
failures=x$failures
echo "For $1, expected $3 actual $2"
fi
}
IFS='
'
set -- a b '' c
set -- $@
check_result 'set -- $@' "($#)($1)($2)($3)($4)" "(3)(a)(b)(c)()"
IFS=''
set -- a b '' c
set -- $@
check_result 'set -- $@' "($#)($1)($2)($3)($4)" "(3)(a)(b)(c)()"
set -- a b '' c
set -- $*
check_result 'set -- $*' "($#)($1)($2)($3)($4)" "(3)(a)(b)(c)()"
set -- a b '' c
set -- "$@"
check_result 'set -- "$@"' "($#)($1)($2)($3)($4)" "(4)(a)(b)()(c)"
set -- a b '' c
set -- "$*"
check_result 'set -- "$*"' "($#)($1)($2)($3)($4)" "(1)(abc)()()()"
test "x$failures" = x

View File

@ -0,0 +1,316 @@
/*
* Copyright (c) 2010-2011 Adrian Chadd, Xenion Pty Ltd.
*
* 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$
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <err.h>
typedef enum {
AH_FALSE = 0, /* NB: lots of code assumes false is zero */
AH_TRUE = 1,
} HAL_BOOL;
typedef enum {
HAL_OK = 0, /* No error */
} HAL_STATUS;
struct ath_hal;
#include "ah_eeprom_v14.h"
#include "ah_eeprom_9287.h"
void
eeprom_9287_base_print(uint16_t *buf)
{
HAL_EEPROM_9287 *eep = (HAL_EEPROM_9287 *) buf;
BASE_EEP_9287_HEADER *eh = &eep->ee_base.baseEepHeader;
int i;
printf("| Version: 0x%.4x | Length: 0x%.4x | Checksum: 0x%.4x ",
eh->version, eh->length, eh->checksum);
printf("| CapFlags: 0x%.2x | eepMisc: 0x%.2x | RegDomain: 0x%.4x 0x%.4x | \n",
eh->opCapFlags, eh->eepMisc, eh->regDmn[0], eh->regDmn[1]);
printf("| MAC: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x ",
eh->macAddr[0], eh->macAddr[1], eh->macAddr[2],
eh->macAddr[3], eh->macAddr[4], eh->macAddr[5]);
printf("| RxMask: 0x%.2x | TxMask: 0x%.2x | RfSilent: 0x%.4x | btOptions: 0x%.4x |\n",
eh->rxMask, eh->txMask, eh->rfSilent, eh->blueToothOptions);
printf("| DeviceCap: 0x%.4x | binBuildNumber: %.8x | deviceType: 0x%.2x | openLoopPwrCntl 0x%.2x |\n",
eh->deviceCap, eh->binBuildNumber, eh->deviceType, eh->openLoopPwrCntl);
printf("| pwrTableOffset: %d | tempSensSlope: %d | tempSensSlopePalOn: %d |\n",
eh->pwrTableOffset, eh->tempSensSlope, eh->tempSensSlopePalOn);
printf("Future:\n");
for (i = 0; i < sizeof(eh->futureBase) / sizeof(uint16_t); i++) {
printf("0x%.2x ", eh->futureBase[i]);
}
printf("\n");
}
void
eeprom_9287_custdata_print(uint16_t *buf)
{
HAL_EEPROM_9287 *eep = (HAL_EEPROM_9287 *) buf;
uint8_t *custdata = (uint8_t *) &eep->ee_base.custData;
int i;
printf("\n| Custdata: |\n");
for (i = 0; i < 20; i++) {
printf("%s0x%.2x %s",
i % 16 == 0 ? "| " : "",
custdata[i],
i % 16 == 15 ? "|\n" : "");
}
printf("\n");
}
void
eeprom_9287_modal_print(uint16_t *buf)
{
HAL_EEPROM_9287 *eep = (HAL_EEPROM_9287 *) buf;
MODAL_EEP_9287_HEADER *mh = &eep->ee_base.modalHeader;
int i;
printf("| antCtrlCommon: 0x%.8x |\n", mh->antCtrlCommon);
printf("| switchSettling: 0x%.2x |\n", mh->switchSettling);
printf("| adcDesiredSize: %d |\n", mh->adcDesiredSize);
for (i = 0; i < AR9287_MAX_CHAINS; i++) {
printf("| Chain %d:\n", i);
printf("| antCtrlChain: 0:0x%.4x |\n", mh->antCtrlChain[i]);
printf("| antennaGainCh: 0:0x%.2x |\n", mh->antennaGainCh[i]);
printf("| txRxAttenCh: 0:0x%.2x |\n", mh->txRxAttenCh[i]);
printf("| rxTxMarginCh: 0:0x%.2x |\n", mh->rxTxMarginCh[i]);
printf("| noiseFloorThresCh: 0:0x%.2x |\n", mh->noiseFloorThreshCh[i]);
printf("| iqCalICh: 0:0x%.2x |\n", mh->iqCalICh[i]);
printf("| iqCalQCh: 0:0x%.2x |\n", mh->iqCalQCh[i]);
printf("| bswAtten: 0:0x%.2x |\n", mh->bswAtten[i]);
printf("| bswMargin: 0:0x%.2x |\n", mh->bswMargin[i]);
printf("\n");
}
printf("| txEndToXpaOff: 0x%.2x | txEndToRxOn: 0x%.2x | txFrameToXpaOn: 0x%.2x |\n",
mh->txEndToXpaOff, mh->txEndToRxOn, mh->txFrameToXpaOn);
printf("| thres62: 0x%.2x\n", mh->thresh62);
printf("| xpdGain: 0x%.2x | xpd: 0x%.2x |\n", mh->xpdGain, mh->xpd);
printf("| pdGainOverlap: 0x%.2x xpaBiasLvl: 0x%.2x |\n", mh->pdGainOverlap, mh->xpaBiasLvl);
printf("| txFrameToDataStart: 0x%.2x | txFrameToPaOn: 0x%.2x |\n", mh->txFrameToDataStart, mh->txFrameToPaOn);
printf("| ht40PowerIncForPdadc: 0x%.2x |\n", mh->ht40PowerIncForPdadc);
printf("| swSettleHt40: 0x%.2x |\n", mh->swSettleHt40);
printf("| Modal Version: %.2x |\n", mh->version);
printf("| db1 = %d | db2 = %d |\n", mh->db1, mh->db2);
printf("| ob_cck = %d | ob_psk = %d | ob_qam = %d | ob_pal_off = %d |\n",
mh->ob_cck, mh->ob_psk, mh->ob_qam, mh->ob_pal_off);
printf("| futureModal: ");
for (i = 0; i < sizeof(mh->futureModal) / sizeof(uint16_t); i++) {
printf("0x%.2x ", mh->futureModal[i]);
}
printf("\n");
/* and now, spur channels */
for (i = 0; i < AR5416_EEPROM_MODAL_SPURS; i++) {
printf("| Spur %d: spurChan: 0x%.4x spurRangeLow: 0x%.2x spurRangeHigh: 0x%.2x |\n",
i, mh->spurChans[i].spurChan,
(int) mh->spurChans[i].spurRangeLow,
(int) mh->spurChans[i].spurRangeHigh);
}
}
static void
eeprom_9287_print_caldata_oploop(struct cal_data_op_loop_ar9287 *f)
{
int i, j;
/* XXX flesh out the rest */
for (i = 0; i < 2; i++) {
printf(" pwrPdg:");
for (j = 0; j < 5; j++) {
printf("[%d][%d]=%d, ", i, j, f->pwrPdg[i][j]);
}
printf("\n");
printf(" vpdPdg:");
for (j = 0; j < 5; j++) {
printf("[%d][%d]=%d, ", i, j, f->vpdPdg[i][j]);
}
printf("\n");
printf(" pcdac:");
for (j = 0; j < 5; j++) {
printf("[%d][%d]=%d, ", i, j, f->pcdac[i][j]);
}
printf("\n");
printf(" empty:");
for (j = 0; j < 5; j++) {
printf("[%d][%d]=%d, ", i, j, f->empty[i][j]);
}
printf("\n\n");
}
}
void
eeprom_9287_calfreqpiers_print(uint16_t *buf)
{
HAL_EEPROM_9287 *eep = (HAL_EEPROM_9287 *) buf;
int i, n;
/* 2ghz cal piers */
printf("calFreqPier2G: ");
for (i = 0; i < AR9287_NUM_2G_CAL_PIERS; i++) {
printf(" 0x%.2x ", eep->ee_base.calFreqPier2G[i]);
}
printf("|\n");
for (i = 0; i < AR9287_NUM_2G_CAL_PIERS; i++) {
if (eep->ee_base.calFreqPier2G[i] == 0xff)
continue;
printf("2Ghz Cal Pier %d\n", i);
for (n = 0; n < AR9287_MAX_CHAINS; n++) {
printf(" Chain %d:\n", n);
eeprom_9287_print_caldata_oploop((void *)&eep->ee_base.calPierData2G[n][i]);
}
}
printf("\n");
}
/* XXX these should just reference the v14 print routines */
static void
eeprom_v14_target_legacy_print(CAL_TARGET_POWER_LEG *l)
{
int i;
if (l->bChannel == 0xff)
return;
printf(" bChannel: %d;", l->bChannel);
for (i = 0; i < 4; i++) {
printf(" %.2f", (float) l->tPow2x[i] / 2.0);
}
printf(" (dBm)\n");
}
static void
eeprom_v14_target_ht_print(CAL_TARGET_POWER_HT *l)
{
int i;
if (l->bChannel == 0xff)
return;
printf(" bChannel: %d;", l->bChannel);
for (i = 0; i < 8; i++) {
printf(" %.2f", (float) l->tPow2x[i] / 2.0);
}
printf(" (dBm)\n");
}
void
eeprom_9287_print_targets(uint16_t *buf)
{
HAL_EEPROM_9287 *eep = (HAL_EEPROM_9287 *) buf;
int i;
/* 2ghz rates */
printf("2Ghz CCK:\n");
for (i = 0; i < AR9287_NUM_2G_CCK_TARGET_POWERS; i++) {
eeprom_v14_target_legacy_print(&eep->ee_base.calTargetPowerCck[i]);
}
printf("2Ghz 11g:\n");
for (i = 0; i < AR9287_NUM_2G_20_TARGET_POWERS; i++) {
eeprom_v14_target_legacy_print(&eep->ee_base.calTargetPower2G[i]);
}
printf("2Ghz HT20:\n");
for (i = 0; i < AR9287_NUM_2G_20_TARGET_POWERS; i++) {
eeprom_v14_target_ht_print(&eep->ee_base.calTargetPower2GHT20[i]);
}
printf("2Ghz HT40:\n");
for (i = 0; i < AR9287_NUM_2G_40_TARGET_POWERS; i++) {
eeprom_v14_target_ht_print(&eep->ee_base.calTargetPower2GHT40[i]);
}
}
static void
eeprom_9287_ctl_edge_print(struct cal_ctl_data_ar9287 *ctl)
{
int i, j;
uint8_t pow, flag;
for (i = 0; i < AR9287_MAX_CHAINS; i++) {
printf(" chain %d: ", i);
for (j = 0; j < AR9287_NUM_BAND_EDGES; j++) {
pow = ctl->ctlEdges[i][j].tPowerFlag & 0x3f;
flag = (ctl->ctlEdges[i][j].tPowerFlag & 0xc0) >> 6;
printf(" %d:pow=%d,flag=%.2x", j, pow, flag);
}
printf("\n");
}
}
void
eeprom_9287_ctl_print(uint16_t *buf)
{
HAL_EEPROM_9287 *eep = (HAL_EEPROM_9287 *) buf;
int i;
for (i = 0; i < AR9287_NUM_CTLS; i++) {
if (eep->ee_base.ctlIndex[i] == 0)
continue;
printf("| ctlIndex: offset %d, value %d\n", i, eep->ee_base.ctlIndex[i]);
eeprom_9287_ctl_edge_print(&eep->ee_base.ctlData[i]);
}
}
void
eeprom_9287_print_edges(uint16_t *buf)
{
HAL_EEPROM_9287 *eep = (HAL_EEPROM_9287 *) buf;
int i;
printf("| eeNumCtls: %d\n", eep->ee_numCtls);
for (i = 0; i < NUM_EDGES*eep->ee_numCtls; i++) {
/* XXX is flag 8 or 32 bits? */
printf("| edge %2d/%2d: rdEdge: %5d EdgePower: %.2f dBm Flag: 0x%.8x\n",
i / NUM_EDGES, i % NUM_EDGES,
eep->ee_rdEdgesPower[i].rdEdge,
(float) eep->ee_rdEdgesPower[i].twice_rdEdgePower / 2.0,
eep->ee_rdEdgesPower[i].flag);
if (i % NUM_EDGES == (NUM_EDGES -1))
printf("|\n");
}
}
void
eeprom_9287_print_other(uint16_t *buf)
{
HAL_EEPROM_9287 *eep = (HAL_EEPROM_9287 *) buf;
}

View File

@ -0,0 +1,15 @@
/* $FreeBSD$ */
#ifndef __9287_H__
#define __9287_H__
extern void eeprom_9287_base_print(uint16_t *buf);
extern void eeprom_9287_custdata_print(uint16_t *buf);
extern void eeprom_9287_modal_print(uint16_t *buf);
extern void eeprom_9287_calfreqpiers_print(uint16_t *buf);
extern void eeprom_9287_ctl_print(uint16_t *buf);
extern void eeprom_9287_print_targets(uint16_t *buf);
extern void eeprom_9287_print_edges(uint16_t *buf);
extern void eeprom_9287_print_other(uint16_t *buf);
#endif

View File

@ -0,0 +1,12 @@
# $FreeBSD$
.PATH: ${.CURDIR}/../../../../sys/dev/ath/ath_hal
PROG= ath_ee_9287_print
SRCS= main.c eeprom.c 9287.c
NOMAN= yes
NO_MAN= yes
.include <../Makefile.inc>
.include <bsd.prog.mk>

View File

@ -0,0 +1,72 @@
/*
* Copyright (c) 2010-2011 Adrian Chadd, Xenion Pty Ltd.
*
* 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$
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <err.h>
#include "eeprom.h"
void
load_eeprom_dump(const char *file, uint16_t *buf)
{
unsigned int r[8];
FILE *fp;
char b[1024];
int i;
fp = fopen(file, "r");
if (!fp)
err(1, "fopen");
while (!feof(fp)) {
if (fgets(b, 1024, fp) == NULL)
break;
if (feof(fp))
break;
if (strlen(b) > 0)
b[strlen(b)-1] = '\0';
if (strlen(b) == 0)
break;
sscanf(b, "%x: %x %x %x %x %x %x %x %x\n",
&i, &r[0], &r[1], &r[2], &r[3], &r[4],
&r[5], &r[6], &r[7]);
buf[i++] = r[0];
buf[i++] = r[1];
buf[i++] = r[2];
buf[i++] = r[3];
buf[i++] = r[4];
buf[i++] = r[5];
buf[i++] = r[6];
buf[i++] = r[7];
}
fclose(fp);
}

View File

@ -0,0 +1,8 @@
/* $FreeBSD$ */
#ifndef __EEPROM_H__
#define __EEPROM_H__
extern void load_eeprom_dump(const char *file, uint16_t *buf);
#endif

View File

@ -0,0 +1,85 @@
/*
* Copyright (c) 2010-2011 Adrian Chadd, Xenion Pty Ltd.
*
* 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$
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <err.h>
#include "eeprom.h"
#include "9287.h"
void
usage(char *argv[])
{
printf("Usage: %s <eeprom dump file>\n", argv[0]);
printf("\n");
printf(" The eeprom dump file is a text hexdump of an EEPROM.\n");
printf(" The lines must be formatted as follows:\n");
printf(" 0xAAAA: 0xDD 0xDD 0xDD 0xDD 0xDD 0xDD 0xDD 0xDD\n");
printf(" where each line must have exactly eight data bytes.\n");
exit(127);
}
int
main(int argc, char *argv[])
{
uint16_t *eep = NULL;
eep = calloc(4096, sizeof(int16_t));
if (argc < 2)
usage(argv);
load_eeprom_dump(argv[1], eep);
eeprom_9287_base_print(eep);
eeprom_9287_custdata_print(eep);
printf("\n2.4ghz:\n");
eeprom_9287_modal_print(eep);
printf("\n");
eeprom_9287_calfreqpiers_print(eep);
printf("\n");
eeprom_9287_print_targets(eep);
printf("\n");
eeprom_9287_ctl_print(eep);
printf("\n");
eeprom_9287_print_edges(eep);
printf("\n");
eeprom_9287_print_other(eep);
printf("\n");
free(eep);
exit(0);
}