svn commit: r221710 - in projects/largeSMP: contrib/top share/mk
sys/amd64/include sys/dev/ath/ath_hal/ar5416
sys/dev/ath/ath_hal/ar9002 sys/dev/bxe sys/dev/syscons
sys/i386/include sys/isa sys/pc9...
Attilio Rao
attilio at FreeBSD.org
Mon May 9 18:53:14 UTC 2011
Author: attilio
Date: Mon May 9 18:53:13 2011
New Revision: 221710
URL: http://svn.freebsd.org/changeset/base/221710
Log:
MFC
Modified:
projects/largeSMP/sys/amd64/include/clock.h
projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_phy.c
projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_phy.h
projects/largeSMP/sys/dev/bxe/if_bxe.c
projects/largeSMP/sys/dev/bxe/if_bxe.h
projects/largeSMP/sys/dev/syscons/syscons.c
projects/largeSMP/sys/dev/syscons/syscons.h
projects/largeSMP/sys/i386/include/clock.h
projects/largeSMP/sys/isa/syscons_isa.c
projects/largeSMP/sys/pc98/cbus/syscons_cbus.c
projects/largeSMP/sys/x86/isa/clock.c
projects/largeSMP/sys/x86/x86/tsc.c
Directory Properties:
projects/largeSMP/ (props changed)
projects/largeSMP/cddl/contrib/opensolaris/ (props changed)
projects/largeSMP/contrib/bind9/ (props changed)
projects/largeSMP/contrib/binutils/ (props changed)
projects/largeSMP/contrib/bzip2/ (props changed)
projects/largeSMP/contrib/dialog/ (props changed)
projects/largeSMP/contrib/ee/ (props changed)
projects/largeSMP/contrib/expat/ (props changed)
projects/largeSMP/contrib/file/ (props changed)
projects/largeSMP/contrib/gcc/ (props changed)
projects/largeSMP/contrib/gdb/ (props changed)
projects/largeSMP/contrib/gdtoa/ (props changed)
projects/largeSMP/contrib/gnu-sort/ (props changed)
projects/largeSMP/contrib/groff/ (props changed)
projects/largeSMP/contrib/less/ (props changed)
projects/largeSMP/contrib/libpcap/ (props changed)
projects/largeSMP/contrib/libstdc++/ (props changed)
projects/largeSMP/contrib/llvm/ (props changed)
projects/largeSMP/contrib/llvm/tools/clang/ (props changed)
projects/largeSMP/contrib/ncurses/ (props changed)
projects/largeSMP/contrib/netcat/ (props changed)
projects/largeSMP/contrib/ntp/ (props changed)
projects/largeSMP/contrib/one-true-awk/ (props changed)
projects/largeSMP/contrib/openbsm/ (props changed)
projects/largeSMP/contrib/openpam/ (props changed)
projects/largeSMP/contrib/pf/ (props changed)
projects/largeSMP/contrib/sendmail/ (props changed)
projects/largeSMP/contrib/tcpdump/ (props changed)
projects/largeSMP/contrib/tcsh/ (props changed)
projects/largeSMP/contrib/top/ (props changed)
projects/largeSMP/contrib/top/install-sh (props changed)
projects/largeSMP/contrib/tzcode/stdtime/ (props changed)
projects/largeSMP/contrib/tzcode/zic/ (props changed)
projects/largeSMP/contrib/tzdata/ (props changed)
projects/largeSMP/contrib/wpa/ (props changed)
projects/largeSMP/contrib/xz/ (props changed)
projects/largeSMP/crypto/openssh/ (props changed)
projects/largeSMP/crypto/openssl/ (props changed)
projects/largeSMP/gnu/lib/ (props changed)
projects/largeSMP/gnu/usr.bin/binutils/ (props changed)
projects/largeSMP/gnu/usr.bin/cc/cc_tools/ (props changed)
projects/largeSMP/gnu/usr.bin/gdb/ (props changed)
projects/largeSMP/lib/libc/ (props changed)
projects/largeSMP/lib/libc/stdtime/ (props changed)
projects/largeSMP/lib/libutil/ (props changed)
projects/largeSMP/lib/libz/ (props changed)
projects/largeSMP/sbin/ (props changed)
projects/largeSMP/sbin/ipfw/ (props changed)
projects/largeSMP/share/mk/bsd.arch.inc.mk (props changed)
projects/largeSMP/share/zoneinfo/ (props changed)
projects/largeSMP/sys/ (props changed)
projects/largeSMP/sys/amd64/include/xen/ (props changed)
projects/largeSMP/sys/boot/ (props changed)
projects/largeSMP/sys/boot/i386/efi/ (props changed)
projects/largeSMP/sys/boot/ia64/efi/ (props changed)
projects/largeSMP/sys/boot/ia64/ski/ (props changed)
projects/largeSMP/sys/boot/powerpc/boot1.chrp/ (props changed)
projects/largeSMP/sys/boot/powerpc/ofw/ (props changed)
projects/largeSMP/sys/cddl/contrib/opensolaris/ (props changed)
projects/largeSMP/sys/conf/ (props changed)
projects/largeSMP/sys/contrib/dev/acpica/ (props changed)
projects/largeSMP/sys/contrib/octeon-sdk/ (props changed)
projects/largeSMP/sys/contrib/pf/ (props changed)
projects/largeSMP/sys/contrib/x86emu/ (props changed)
projects/largeSMP/usr.bin/calendar/ (props changed)
projects/largeSMP/usr.bin/csup/ (props changed)
projects/largeSMP/usr.bin/procstat/ (props changed)
projects/largeSMP/usr.sbin/ndiscvt/ (props changed)
projects/largeSMP/usr.sbin/zic/ (props changed)
Modified: projects/largeSMP/sys/amd64/include/clock.h
==============================================================================
--- projects/largeSMP/sys/amd64/include/clock.h Mon May 9 18:46:53 2011 (r221709)
+++ projects/largeSMP/sys/amd64/include/clock.h Mon May 9 18:53:13 2011 (r221710)
@@ -29,7 +29,6 @@ void i8254_init(void);
void startrtclock(void);
void init_TSC(void);
-void init_TSC_tc(void);
#define HAS_TIMER_SPKR 1
int timer_spkr_acquire(void);
Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
==============================================================================
--- projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Mon May 9 18:46:53 2011 (r221709)
+++ projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Mon May 9 18:53:13 2011 (r221710)
@@ -1296,7 +1296,8 @@ ar5416InitChainMasks(struct ath_hal *ah)
{
int rx_chainmask = AH5416(ah)->ah_rx_chainmask;
- if (rx_chainmask)
+ /* Flip this for this chainmask regardless of chip */
+ if (rx_chainmask == 0x5)
OS_REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, AR_PHY_SWAP_ALT_CHAIN);
/*
Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
==============================================================================
--- projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Mon May 9 18:46:53 2011 (r221709)
+++ projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Mon May 9 18:53:13 2011 (r221710)
@@ -401,8 +401,9 @@ ar9285FillCapabilityInfo(struct ath_hal
if (AR_SREV_KITE_12_OR_LATER(ah))
pCap->halPSPollBroken = AH_FALSE;
+ /* Only RX STBC supported */
pCap->halRxStbcSupport = 1;
- pCap->halTxStbcSupport = 1;
+ pCap->halTxStbcSupport = 0;
return AH_TRUE;
}
Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_phy.c
==============================================================================
--- projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_phy.c Mon May 9 18:46:53 2011 (r221709)
+++ projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_phy.c Mon May 9 18:53:13 2011 (r221710)
@@ -75,24 +75,30 @@ ar9285_antdiv_comb_conf_set(struct ath_h
}
/*
- * Check whether antenna diversity should be enabled
+ * Check whether combined + fast antenna diversity should be enabled.
+ *
+ * This enables software-driven RX antenna diversity based on RX
+ * RSSI + antenna config packet sampling.
*/
-int
+HAL_BOOL
ar9285_check_div_comb(struct ath_hal *ah)
{
uint8_t ant_div_ctl1;
HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom;
const MODAL_EEP4K_HEADER *pModal = &ee->ee_base.modalHeader;
+ /* For now, simply disable this until it's better debugged. -adrian */
+ return AH_FALSE;
+
if (! AR_SREV_KITE(ah))
- return 0;
+ return AH_FALSE;
if (pModal->version < 3)
- return 0;
+ return AH_FALSE;
ant_div_ctl1 = pModal->antdiv_ctl1;
if ((ant_div_ctl1 & 0x1) && ((ant_div_ctl1 >> 3) & 0x1))
- return 1;
+ return AH_TRUE;
- return 0;
+ return AH_FALSE;
}
Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_phy.h
==============================================================================
--- projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_phy.h Mon May 9 18:46:53 2011 (r221709)
+++ projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_phy.h Mon May 9 18:53:13 2011 (r221710)
@@ -41,6 +41,6 @@ extern void ar9285_antdiv_comb_conf_set(
struct ar9285_antcomb_conf *antconf);
extern void ar9285_antdiv_comb_conf_get(struct ath_hal *ah,
struct ar9285_antcomb_conf *antconf);
-extern int ar9285_check_div_comb(struct ath_hal *ah);
+extern HAL_BOOL ar9285_check_div_comb(struct ath_hal *ah);
#endif
Modified: projects/largeSMP/sys/dev/bxe/if_bxe.c
==============================================================================
--- projects/largeSMP/sys/dev/bxe/if_bxe.c Mon May 9 18:46:53 2011 (r221709)
+++ projects/largeSMP/sys/dev/bxe/if_bxe.c Mon May 9 18:53:13 2011 (r221710)
@@ -3323,7 +3323,7 @@ bxe_stop_locked(struct bxe_softc *sc, in
bxe_set_mac_addr_e1(sc, 0);
for (i = 0; i < config->hdr.length; i++)
- CAM_INVALIDATE(config->config_table[i]);
+ CAM_INVALIDATE(&config->config_table[i]);
config->hdr.length = i;
config->hdr.offset = BXE_MAX_MULTICAST * (1 + port);
@@ -14254,6 +14254,8 @@ static void
bxe_set_mac_addr_e1(struct bxe_softc *sc, int set)
{
struct mac_configuration_cmd *config;
+ struct mac_configuration_entry *config_table;
+ uint8_t *eaddr;
int port;
DBENTER(BXE_VERBOSE_MISC);
@@ -14274,43 +14276,40 @@ bxe_set_mac_addr_e1(struct bxe_softc *sc
config->hdr.reserved1 = 0;
/* Program the primary MAC address. */
- config->config_table[0].cam_entry.msb_mac_addr =
- ntohs(*(uint16_t *)&sc->link_params.mac_addr[0]);
- config->config_table[0].cam_entry.middle_mac_addr =
- ntohs(*(uint16_t *)&sc->link_params.mac_addr[2]);
- config->config_table[0].cam_entry.lsb_mac_addr =
- ntohs(*(uint16_t *)&sc->link_params.mac_addr[4]);
- config->config_table[0].cam_entry.flags = htole16(port);
+ config_table = &config->config_table[0];
+ eaddr = sc->link_params.mac_addr;
+ config_table->cam_entry.msb_mac_addr = eaddr[0] << 8 | eaddr[1];
+ config_table->cam_entry.middle_mac_addr = eaddr[2] << 8 | eaddr[3];
+ config_table->cam_entry.lsb_mac_addr = eaddr[4] << 8 | eaddr[5];
+ config_table->cam_entry.flags = htole16(port);
if (set)
- config->config_table[0].target_table_entry.flags = 0;
+ config_table->target_table_entry.flags = 0;
else
- CAM_INVALIDATE(config->config_table[0]);
+ CAM_INVALIDATE(config_table);
- /* t48 config->config_table[0].target_table_entry.client_id = 0; */
- config->config_table[0].target_table_entry.vlan_id = 0;
+ config_table->target_table_entry.vlan_id = 0;
DBPRINT(sc, BXE_VERBOSE, "%s(): %s MAC (%04x:%04x:%04x)\n",
__FUNCTION__, (set ? "Setting" : "Clearing"),
- config->config_table[0].cam_entry.msb_mac_addr,
- config->config_table[0].cam_entry.middle_mac_addr,
- config->config_table[0].cam_entry.lsb_mac_addr);
+ config_table->cam_entry.msb_mac_addr,
+ config_table->cam_entry.middle_mac_addr,
+ config_table->cam_entry.lsb_mac_addr);
/* Program the broadcast MAC address. */
- config->config_table[1].cam_entry.msb_mac_addr = 0xffff;
- config->config_table[1].cam_entry.middle_mac_addr = 0xffff;
- config->config_table[1].cam_entry.lsb_mac_addr = 0xffff;
- config->config_table[1].cam_entry.flags = htole16(port);
+ config_table = &config->config_table[1];
+ config_table->cam_entry.msb_mac_addr = 0xffff;
+ config_table->cam_entry.middle_mac_addr = 0xffff;
+ config_table->cam_entry.lsb_mac_addr = 0xffff;
+ config_table->cam_entry.flags = htole16(port);
if (set)
- config->config_table[1].target_table_entry.flags =
+ config_table->target_table_entry.flags =
TSTORM_CAM_TARGET_TABLE_ENTRY_BROADCAST;
else
- CAM_INVALIDATE(config->config_table[1]);
-
- /*t48 config->config_table[1].target_table_entry.client_id = 0; */
- config->config_table[1].target_table_entry.vlan_id = 0;
+ CAM_INVALIDATE(config_table);
+ config_table->target_table_entry.vlan_id = 0;
/* Post the command to slow path queue. */
bxe_sp_post(sc, RAMROD_CMD_ID_ETH_SET_MAC, 0,
@@ -14330,6 +14329,8 @@ static void
bxe_set_mac_addr_e1h(struct bxe_softc *sc, int set)
{
struct mac_configuration_cmd_e1h *config;
+ struct mac_configuration_entry_e1h *config_table;
+ uint8_t *eaddr;
int func, port;
DBENTER(BXE_VERBOSE_MISC);
@@ -14356,30 +14357,27 @@ bxe_set_mac_addr_e1h(struct bxe_softc *s
config->hdr.reserved1 = 0;
/* Program the primary MAC address. */
- config->config_table[0].msb_mac_addr =
- ntohs(*(uint16_t *)&sc->link_params.mac_addr[0]);
- config->config_table[0].middle_mac_addr =
- ntohs(*(uint16_t *)&sc->link_params.mac_addr[2]);
- config->config_table[0].lsb_mac_addr =
- ntohs(*(uint16_t *)&sc->link_params.mac_addr[4]);
- config->config_table[0].clients_bit_vector =
- htole32(1 << sc->fp->cl_id);
+ config_table = &config->config_table[0];
+ eaddr = sc->link_params.mac_addr;
+ config_table->msb_mac_addr = eaddr[0] << 8 | eaddr[1];
+ config_table->middle_mac_addr = eaddr[2] << 8 | eaddr[3];
+ config_table->lsb_mac_addr = eaddr[4] << 8 | eaddr[5];
+ config_table->clients_bit_vector = htole32(1 << sc->fp->cl_id);
- config->config_table[0].vlan_id = 0;
- config->config_table[0].e1hov_id = htole16(sc->e1hov);
+ config_table->vlan_id = 0;
+ config_table->e1hov_id = htole16(sc->e1hov);
if (set)
- config->config_table[0].flags = port;
+ config_table->flags = port;
else
- config->config_table[0].flags =
+ config_table->flags =
MAC_CONFIGURATION_ENTRY_E1H_ACTION_TYPE;
DBPRINT(sc, BXE_VERBOSE_MISC,
"%s(): %s MAC (%04x:%04x:%04x), E1HOV = %d, CLID = %d\n",
__FUNCTION__, (set ? "Setting" : "Clearing"),
- config->config_table[0].msb_mac_addr,
- config->config_table[0].middle_mac_addr,
- config->config_table[0].lsb_mac_addr, sc->e1hov, BP_L_ID(sc));
+ config_table->msb_mac_addr, config_table->middle_mac_addr,
+ config_table->lsb_mac_addr, sc->e1hov, BP_L_ID(sc));
bxe_sp_post(sc, RAMROD_CMD_ID_ETH_SET_MAC, 0,
U64_HI(BXE_SP_MAPPING(sc, mac_config)),
@@ -14402,7 +14400,9 @@ bxe_set_rx_mode(struct bxe_softc *sc)
struct ifnet *ifp;
struct ifmultiaddr *ifma;
struct mac_configuration_cmd *config;
+ struct mac_configuration_entry *config_table;
uint32_t mc_filter[MC_HASH_SIZE];
+ uint8_t *maddr;
uint32_t crc, bit, regidx, rx_mode;
int i, old, offset, port;
@@ -14431,8 +14431,8 @@ bxe_set_rx_mode(struct bxe_softc *sc)
/* Enable promiscuous mode. */
rx_mode = BXE_RX_MODE_PROMISC;
- } else if ((ifp->if_flags & IFF_ALLMULTI) ||
- (ifp->if_amcount > BXE_MAX_MULTICAST)) {
+ } else if (ifp->if_flags & IFF_ALLMULTI ||
+ ifp->if_amcount > BXE_MAX_MULTICAST) {
DBPRINT(sc, BXE_VERBOSE_MISC,
"%s(): Enabling all multicast mode.\n", __FUNCTION__);
@@ -14453,28 +14453,28 @@ bxe_set_rx_mode(struct bxe_softc *sc)
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
-
- config->config_table[i].cam_entry.msb_mac_addr =
- bswap16(*(uint32_t *)(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)));
- config->config_table[i].cam_entry.middle_mac_addr =
- bswap16(*(uint16_t *)(LLADDR((struct sockaddr_dl *)ifma->ifma_addr) + 2));
- config->config_table[i].cam_entry.lsb_mac_addr =
- bswap16(*(uint16_t *)(LLADDR((struct sockaddr_dl *)ifma->ifma_addr) + 4));
-
- config->config_table[i].cam_entry.flags = htole16(port);
- config->config_table[i].target_table_entry.flags = 0;
- config->config_table[i].target_table_entry.
- clients_bit_vector = htole32(1 << BP_L_ID(sc));
- config->config_table[i].target_table_entry.vlan_id = 0;
-
+ maddr = (uint8_t *)LLADDR(
+ (struct sockaddr_dl *)ifma->ifma_addr);
+ config_table = &config->config_table[i];
+ config_table->cam_entry.msb_mac_addr =
+ maddr[0] << 8 | maddr[1];
+ config_table->cam_entry.middle_mac_addr =
+ maddr[2] << 8 | maddr[3];
+ config_table->cam_entry.lsb_mac_addr =
+ maddr[4] << 8 | maddr[5];
+ config_table->cam_entry.flags = htole16(port);
+ config_table->target_table_entry.flags = 0;
+ config_table->target_table_entry.
+ clients_bit_vector =
+ htole32(1 << BP_L_ID(sc));
+ config_table->target_table_entry.vlan_id = 0;
i++;
-
DBPRINT(sc, BXE_INFO,
"%s(): Setting MCAST[%d] (%04X:%04X:%04X)\n",
__FUNCTION__, i,
- config->config_table[i].cam_entry.msb_mac_addr,
- config->config_table[i].cam_entry.middle_mac_addr,
- config->config_table[i].cam_entry.lsb_mac_addr);
+ config_table->cam_entry.msb_mac_addr,
+ config_table->cam_entry.middle_mac_addr,
+ config_table->cam_entry.lsb_mac_addr);
}
IF_ADDR_UNLOCK(ifp);
@@ -14484,11 +14484,11 @@ bxe_set_rx_mode(struct bxe_softc *sc)
/* Invalidate any extra MC entries in the CAM. */
if (old > i) {
for (; i < old; i++) {
- if (CAM_IS_INVALID(
- config->config_table[i]))
+ config_table = &config->config_table[i];
+ if (CAM_IS_INVALID(config_table))
break;
/* Invalidate */
- CAM_INVALIDATE(config->config_table[i]);
+ CAM_INVALIDATE(config_table);
}
}
@@ -14501,7 +14501,6 @@ bxe_set_rx_mode(struct bxe_softc *sc)
bxe_sp_post(sc, RAMROD_CMD_ID_ETH_SET_MAC, 0,
U64_HI(BXE_SP_MAPPING(sc, mcast_config)),
U64_LO(BXE_SP_MAPPING(sc, mcast_config)), 0);
-
} else { /* E1H */
/* Accept one or more multicasts */
memset(mc_filter, 0, 4 * MC_HASH_SIZE);
Modified: projects/largeSMP/sys/dev/bxe/if_bxe.h
==============================================================================
--- projects/largeSMP/sys/dev/bxe/if_bxe.h Mon May 9 18:46:53 2011 (r221709)
+++ projects/largeSMP/sys/dev/bxe/if_bxe.h Mon May 9 18:53:13 2011 (r221710)
@@ -1773,11 +1773,11 @@ struct bxe_softc {
USTORM_ETH_ST_CONTEXT_CONFIG_BD_SB_INDEX_NUMBER))
#define CAM_IS_INVALID(x) \
- (x.target_table_entry.flags == \
+ ((x)->target_table_entry.flags == \
TSTORM_CAM_TARGET_TABLE_ENTRY_ACTION_TYPE)
#define CAM_INVALIDATE(x) \
- (x.target_table_entry.flags = TSTORM_CAM_TARGET_TABLE_ENTRY_ACTION_TYPE)
+ ((x)->target_table_entry.flags = TSTORM_CAM_TARGET_TABLE_ENTRY_ACTION_TYPE)
/* Number of uint32_t elements in multicast hash array. */
#define MC_HASH_SIZE 8
Modified: projects/largeSMP/sys/dev/syscons/syscons.c
==============================================================================
--- projects/largeSMP/sys/dev/syscons/syscons.c Mon May 9 18:46:53 2011 (r221709)
+++ projects/largeSMP/sys/dev/syscons/syscons.c Mon May 9 18:53:13 2011 (r221710)
@@ -104,7 +104,8 @@ static scr_stat main_console;
static struct tty *main_devs[MAXCONS];
static char init_done = COLD;
-static char shutdown_in_progress = FALSE;
+static int shutdown_in_progress = FALSE;
+static int suspend_in_progress = FALSE;
static char sc_malloc = FALSE;
static int saver_mode = CONS_NO_SAVER; /* LKM/user saver */
@@ -128,6 +129,13 @@ static void none_saver(sc_softc_t *sc,
static void (*current_saver)(sc_softc_t *, int) = none_saver;
#endif
+#ifdef SC_NO_SUSPEND_VTYSWITCH
+static int sc_no_suspend_vtswitch = 1;
+#else
+static int sc_no_suspend_vtswitch = 0;
+#endif
+static int sc_susp_scr;
+
SYSCTL_NODE(_hw, OID_AUTO, syscons, CTLFLAG_RD, 0, "syscons");
SYSCTL_NODE(_hw_syscons, OID_AUTO, saver, CTLFLAG_RD, 0, "saver");
SYSCTL_INT(_hw_syscons_saver, OID_AUTO, keybonly, CTLFLAG_RW,
@@ -142,6 +150,9 @@ SYSCTL_INT(_hw_syscons, OID_AUTO, kbd_re
SYSCTL_INT(_hw_syscons, OID_AUTO, kbd_debug, CTLFLAG_RW|CTLFLAG_SECURE, &enable_kdbkey,
0, "enable keyboard debug");
#endif
+TUNABLE_INT("hw.syscons.sc_no_suspend_vtswitch", &sc_no_suspend_vtswitch);
+SYSCTL_INT(_hw_syscons, OID_AUTO, sc_no_suspend_vtswitch, CTLFLAG_RW,
+ &sc_no_suspend_vtswitch, 0, "Disable VT switch before suspend.");
#if !defined(SC_NO_FONT_LOADING) && defined(SC_DFLT_FONT)
#include "font.h"
#endif
@@ -170,7 +181,9 @@ static kbd_callback_func_t sckbdevent;
static void scinit(int unit, int flags);
static scr_stat *sc_get_stat(struct tty *tp);
static void scterm(int unit, int flags);
-static void scshutdown(void *arg, int howto);
+static void scshutdown(void *, int);
+static void scsuspend(void *);
+static void scresume(void *);
static u_int scgetc(sc_softc_t *sc, u_int flags);
#define SCGETC_CN 1
#define SCGETC_NONBLOCK 2
@@ -518,10 +531,15 @@ sc_attach_unit(int unit, int flags)
printf("\n");
}
- /* register a shutdown callback for the kernel console */
- if (sc_console_unit == unit)
- EVENTHANDLER_REGISTER(shutdown_pre_sync, scshutdown,
- (void *)(uintptr_t)unit, SHUTDOWN_PRI_DEFAULT);
+ /* Register suspend/resume/shutdown callbacks for the kernel console. */
+ if (sc_console_unit == unit) {
+ EVENTHANDLER_REGISTER(power_suspend, scsuspend, NULL,
+ EVENTHANDLER_PRI_ANY);
+ EVENTHANDLER_REGISTER(power_resume, scresume, NULL,
+ EVENTHANDLER_PRI_ANY);
+ EVENTHANDLER_REGISTER(shutdown_pre_sync, scshutdown, NULL,
+ SHUTDOWN_PRI_DEFAULT);
+ }
for (vc = 0; vc < sc->vtys; vc++) {
if (sc->dev[vc] == NULL) {
@@ -1718,7 +1736,7 @@ sccnupdate(scr_stat *scp)
{
/* this is a cut-down version of scrn_timer()... */
- if (scp->sc->suspend_in_progress || scp->sc->font_loading_in_progress)
+ if (suspend_in_progress || scp->sc->font_loading_in_progress)
return;
if (debugger > 0 || panicstr || shutdown_in_progress) {
@@ -1768,7 +1786,7 @@ scrn_timer(void *arg)
return;
/* don't do anything when we are performing some I/O operations */
- if (sc->suspend_in_progress || sc->font_loading_in_progress) {
+ if (suspend_in_progress || sc->font_loading_in_progress) {
if (again)
timeout(scrn_timer, sc, hz / 10);
return;
@@ -3007,16 +3025,64 @@ scterm(int unit, int flags)
}
static void
-scshutdown(void *arg, int howto)
+scshutdown(__unused void *arg, __unused int howto)
{
- /* assert(sc_console != NULL) */
- sc_touch_scrn_saver();
- if (!cold && sc_console
- && sc_console->sc->cur_scp->smode.mode == VT_AUTO
- && sc_console->smode.mode == VT_AUTO)
- sc_switch_scr(sc_console->sc, sc_console->index);
- shutdown_in_progress = TRUE;
+ KASSERT(sc_console != NULL, ("sc_console != NULL"));
+ KASSERT(sc_console->sc != NULL, ("sc_console->sc != NULL"));
+ KASSERT(sc_console->sc->cur_scp != NULL,
+ ("sc_console->sc->cur_scp != NULL"));
+
+ sc_touch_scrn_saver();
+ if (!cold &&
+ sc_console->sc->cur_scp->index != sc_console->index &&
+ sc_console->sc->cur_scp->smode.mode == VT_AUTO &&
+ sc_console->smode.mode == VT_AUTO)
+ sc_switch_scr(sc_console->sc, sc_console->index);
+ shutdown_in_progress = TRUE;
+}
+
+static void
+scsuspend(__unused void *arg)
+{
+ int retry;
+
+ KASSERT(sc_console != NULL, ("sc_console != NULL"));
+ KASSERT(sc_console->sc != NULL, ("sc_console->sc != NULL"));
+ KASSERT(sc_console->sc->cur_scp != NULL,
+ ("sc_console->sc->cur_scp != NULL"));
+
+ sc_susp_scr = sc_console->sc->cur_scp->index;
+ if (sc_no_suspend_vtswitch ||
+ sc_susp_scr == sc_console->index) {
+ sc_touch_scrn_saver();
+ sc_susp_scr = -1;
+ return;
+ }
+ for (retry = 0; retry < 10; retry++) {
+ sc_switch_scr(sc_console->sc, sc_console->index);
+ if (!sc_console->sc->switch_in_progress)
+ break;
+ pause("scsuspend", hz);
+ }
+ suspend_in_progress = TRUE;
+}
+
+static void
+scresume(__unused void *arg)
+{
+
+ KASSERT(sc_console != NULL, ("sc_console != NULL"));
+ KASSERT(sc_console->sc != NULL, ("sc_console->sc != NULL"));
+ KASSERT(sc_console->sc->cur_scp != NULL,
+ ("sc_console->sc->cur_scp != NULL"));
+
+ suspend_in_progress = FALSE;
+ if (sc_susp_scr < 0) {
+ mark_all(sc_console->sc->cur_scp);
+ return;
+ }
+ sc_switch_scr(sc_console->sc, sc_susp_scr);
}
int
Modified: projects/largeSMP/sys/dev/syscons/syscons.h
==============================================================================
--- projects/largeSMP/sys/dev/syscons/syscons.h Mon May 9 18:46:53 2011 (r221709)
+++ projects/largeSMP/sys/dev/syscons/syscons.h Mon May 9 18:53:13 2011 (r221710)
@@ -230,7 +230,6 @@ typedef struct sc_softc {
char switch_in_progress;
char write_in_progress;
char blink_in_progress;
- char suspend_in_progress;
struct mtx video_mtx;
long scrn_time_stamp;
Modified: projects/largeSMP/sys/i386/include/clock.h
==============================================================================
--- projects/largeSMP/sys/i386/include/clock.h Mon May 9 18:46:53 2011 (r221709)
+++ projects/largeSMP/sys/i386/include/clock.h Mon May 9 18:53:13 2011 (r221710)
@@ -30,7 +30,6 @@ void i8254_init(void);
void startrtclock(void);
void timer_restore(void);
void init_TSC(void);
-void init_TSC_tc(void);
#define HAS_TIMER_SPKR 1
int timer_spkr_acquire(void);
Modified: projects/largeSMP/sys/isa/syscons_isa.c
==============================================================================
--- projects/largeSMP/sys/isa/syscons_isa.c Mon May 9 18:46:53 2011 (r221709)
+++ projects/largeSMP/sys/isa/syscons_isa.c Mon May 9 18:53:13 2011 (r221710)
@@ -69,17 +69,6 @@ __FBSDID("$FreeBSD$");
static devclass_t sc_devclass;
static sc_softc_t main_softc;
-#ifdef SC_NO_SUSPEND_VTYSWITCH
-static int sc_no_suspend_vtswitch = 1;
-#else
-static int sc_no_suspend_vtswitch = 0;
-#endif
-static int sc_cur_scr;
-
-TUNABLE_INT("hw.syscons.sc_no_suspend_vtswitch", &sc_no_suspend_vtswitch);
-SYSCTL_DECL(_hw_syscons);
-SYSCTL_INT(_hw_syscons, OID_AUTO, sc_no_suspend_vtswitch, CTLFLAG_RW,
- &sc_no_suspend_vtswitch, 0, "Disable VT switch before suspend.");
static void
scidentify(driver_t *driver, device_t parent)
@@ -108,53 +97,6 @@ scattach(device_t dev)
SC_AUTODETECT_KBD));
}
-static int
-scsuspend(device_t dev)
-{
- int retry = 10;
- sc_softc_t *sc;
-
- sc = &main_softc;
-
- if (sc->cur_scp == NULL)
- return (0);
-
- if (sc->suspend_in_progress == 0) {
- sc_cur_scr = sc->cur_scp->index;
- if (!sc_no_suspend_vtswitch && sc_cur_scr != 0)
- do {
- sc_switch_scr(sc, 0);
- if (!sc->switch_in_progress)
- break;
- pause("scsuspend", hz);
- } while (retry--);
- }
- sc->suspend_in_progress++;
-
- return (0);
-}
-
-static int
-scresume(device_t dev)
-{
- sc_softc_t *sc;
-
- sc = &main_softc;
-
- if (sc->cur_scp == NULL)
- return (0);
-
- sc->suspend_in_progress--;
- if (sc->suspend_in_progress == 0) {
- if (!sc_no_suspend_vtswitch && sc_cur_scr != 0)
- sc_switch_scr(sc, sc_cur_scr);
- else
- mark_all(sc->cur_scp);
- }
-
- return (0);
-}
-
int
sc_max_unit(void)
{
@@ -300,8 +242,6 @@ static device_method_t sc_methods[] = {
DEVMETHOD(device_identify, scidentify),
DEVMETHOD(device_probe, scprobe),
DEVMETHOD(device_attach, scattach),
- DEVMETHOD(device_suspend, scsuspend),
- DEVMETHOD(device_resume, scresume),
{ 0, 0 }
};
@@ -312,70 +252,3 @@ static driver_t sc_driver = {
};
DRIVER_MODULE(sc, isa, sc_driver, sc_devclass, 0, 0);
-
-static devclass_t scpm_devclass;
-
-static void
-scpm_identify(driver_t *driver, device_t parent)
-{
-
- device_add_child(parent, "scpm", 0);
-}
-
-static int
-scpm_probe(device_t dev)
-{
-
- device_set_desc(dev, SC_DRIVER_NAME " suspend/resume");
- device_quiet(dev);
-
- return (BUS_PROBE_DEFAULT);
-}
-
-static int
-scpm_attach(device_t dev)
-{
-
- bus_generic_probe(dev);
- bus_generic_attach(dev);
-
- return (0);
-}
-
-static int
-scpm_suspend(device_t dev)
-{
- int error;
-
- error = bus_generic_suspend(dev);
- if (error != 0)
- return (error);
-
- return (scsuspend(dev));
-}
-
-static int
-scpm_resume(device_t dev)
-{
-
- scresume(dev);
-
- return (bus_generic_resume(dev));
-}
-
-static device_method_t scpm_methods[] = {
- DEVMETHOD(device_identify, scpm_identify),
- DEVMETHOD(device_probe, scpm_probe),
- DEVMETHOD(device_attach, scpm_attach),
- DEVMETHOD(device_suspend, scpm_suspend),
- DEVMETHOD(device_resume, scpm_resume),
- { 0, 0 }
-};
-
-static driver_t scpm_driver = {
- "scpm",
- scpm_methods,
- 0
-};
-
-DRIVER_MODULE(scpm, vgapm, scpm_driver, scpm_devclass, 0, 0);
Modified: projects/largeSMP/sys/pc98/cbus/syscons_cbus.c
==============================================================================
--- projects/largeSMP/sys/pc98/cbus/syscons_cbus.c Mon May 9 18:46:53 2011 (r221709)
+++ projects/largeSMP/sys/pc98/cbus/syscons_cbus.c Mon May 9 18:53:13 2011 (r221710)
@@ -49,17 +49,6 @@ __FBSDID("$FreeBSD$");
static devclass_t sc_devclass;
static sc_softc_t main_softc;
-#ifdef SC_NO_SUSPEND_VTYSWITCH
-static int sc_no_suspend_vtswitch = 1;
-#else
-static int sc_no_suspend_vtswitch = 0;
-#endif
-static int sc_cur_scr;
-
-TUNABLE_INT("hw.syscons.sc_no_suspend_vtswitch", &sc_no_suspend_vtswitch);
-SYSCTL_DECL(_hw_syscons);
-SYSCTL_INT(_hw_syscons, OID_AUTO, sc_no_suspend_vtswitch, CTLFLAG_RW,
- &sc_no_suspend_vtswitch, 0, "Disable VT switch before suspend.");
static void
scidentify(driver_t *driver, device_t parent)
@@ -87,47 +76,6 @@ scattach(device_t dev)
return sc_attach_unit(device_get_unit(dev), device_get_flags(dev));
}
-static int
-scsuspend(device_t dev)
-{
- int retry = 10;
- sc_softc_t *sc;
-
- sc = &main_softc;
-
- if (sc->cur_scp == NULL)
- return (0);
-
- sc_cur_scr = sc->cur_scp->index;
-
- if (sc_no_suspend_vtswitch)
- return (0);
-
- do {
- sc_switch_scr(sc, 0);
- if (!sc->switch_in_progress) {
- break;
- }
- pause("scsuspend", hz);
- } while (retry--);
-
- return (0);
-}
-
-static int
-scresume(device_t dev)
-{
- sc_softc_t *sc;
-
- if (sc_no_suspend_vtswitch)
- return (0);
-
- sc = &main_softc;
- sc_switch_scr(sc, sc_cur_scr);
-
- return (0);
-}
-
int
sc_max_unit(void)
{
@@ -242,8 +190,6 @@ static device_method_t sc_methods[] = {
DEVMETHOD(device_identify, scidentify),
DEVMETHOD(device_probe, scprobe),
DEVMETHOD(device_attach, scattach),
- DEVMETHOD(device_suspend, scsuspend),
- DEVMETHOD(device_resume, scresume),
{ 0, 0 }
};
Modified: projects/largeSMP/sys/x86/isa/clock.c
==============================================================================
--- projects/largeSMP/sys/x86/isa/clock.c Mon May 9 18:46:53 2011 (r221709)
+++ projects/largeSMP/sys/x86/isa/clock.c Mon May 9 18:53:13 2011 (r221710)
@@ -498,7 +498,6 @@ void
cpu_initclocks(void)
{
- init_TSC_tc();
cpu_initclocks_bsp();
}
Modified: projects/largeSMP/sys/x86/x86/tsc.c
==============================================================================
--- projects/largeSMP/sys/x86/x86/tsc.c Mon May 9 18:46:53 2011 (r221709)
+++ projects/largeSMP/sys/x86/x86/tsc.c Mon May 9 18:53:13 2011 (r221710)
@@ -326,7 +326,73 @@ init_TSC(void)
tsc_levels_changed, NULL, EVENTHANDLER_PRI_ANY);
}
-void
+#ifdef SMP
+
+#define TSC_READ(x) \
+static void \
+tsc_read_##x(void *arg) \
+{ \
+ uint32_t *tsc = arg; \
+ u_int cpu = PCPU_GET(cpuid); \
+ \
+ tsc[cpu * 3 + x] = rdtsc32(); \
+}
+TSC_READ(0)
+TSC_READ(1)
+TSC_READ(2)
+#undef TSC_READ
+
+#define N 1000
+
+static void
+comp_smp_tsc(void *arg)
+{
+ uint32_t *tsc;
+ int32_t d1, d2;
+ u_int cpu = PCPU_GET(cpuid);
+ u_int i, j, size;
+
+ size = (mp_maxid + 1) * 3;
+ for (i = 0, tsc = arg; i < N; i++, tsc += size)
+ CPU_FOREACH(j) {
+ if (j == cpu)
+ continue;
+ d1 = tsc[cpu * 3 + 1] - tsc[j * 3];
+ d2 = tsc[cpu * 3 + 2] - tsc[j * 3 + 1];
+ if (d1 <= 0 || d2 <= 0) {
+ smp_tsc = 0;
+ return;
+ }
+ }
+}
+
+static int
+test_smp_tsc(void)
+{
+ uint32_t *data, *tsc;
+ u_int i, size;
+
+ if (!smp_tsc && !tsc_is_invariant)
+ return (-100);
+ size = (mp_maxid + 1) * 3;
+ data = malloc(sizeof(*data) * size * N, M_TEMP, M_WAITOK);
+ for (i = 0, tsc = data; i < N; i++, tsc += size)
+ smp_rendezvous(tsc_read_0, tsc_read_1, tsc_read_2, tsc);
+ smp_tsc = 1; /* XXX */
+ smp_rendezvous(smp_no_rendevous_barrier, comp_smp_tsc,
+ smp_no_rendevous_barrier, data);
+ free(data, M_TEMP);
+ if (bootverbose)
+ printf("SMP: %sed TSC synchronization test\n",
+ smp_tsc ? "pass" : "fail");
+ return (smp_tsc ? 800 : -100);
+}
+
+#undef N
+
+#endif /* SMP */
+
+static void
init_TSC_tc(void)
{
@@ -347,26 +413,25 @@ init_TSC_tc(void)
tsc_timecounter.tc_quality = -1000;
if (bootverbose)
printf("TSC timecounter disabled: APM enabled.\n");
+ goto init;
}
#ifdef SMP
/*
- * We can not use the TSC in SMP mode unless the TSCs on all CPUs
- * are somehow synchronized. Some hardware configurations do
- * this, but we have no way of determining whether this is the
- * case, so we do not use the TSC in multi-processor systems
- * unless the user indicated (by setting kern.timecounter.smp_tsc
- * to 1) that he believes that his TSCs are synchronized.
+ * We can not use the TSC in SMP mode unless the TSCs on all CPUs are
+ * synchronized. If the user is sure that the system has synchronized
+ * TSCs, set kern.timecounter.smp_tsc tunable to a non-zero value.
*/
- if (mp_ncpus > 1 && !smp_tsc)
- tsc_timecounter.tc_quality = -100;
+ if (smp_cpus > 1)
+ tsc_timecounter.tc_quality = test_smp_tsc();
#endif
-
+init:
if (tsc_freq != 0) {
tsc_timecounter.tc_frequency = tsc_freq;
tc_init(&tsc_timecounter);
}
}
+SYSINIT(tsc_tc, SI_SUB_SMP, SI_ORDER_ANY, init_TSC_tc, NULL);
/*
* When cpufreq levels change, find out about the (new) max frequency. We
More information about the svn-src-projects
mailing list