svn commit: r188930 - in user/alc/pagelock/sys: . amd64/amd64 conf
dev/ata dev/ata/chipsets dev/md dev/usb2/controller fs/tmpfs
i386/i386 net80211
Alan Cox
alc at FreeBSD.org
Sun Feb 22 11:59:42 PST 2009
Author: alc
Date: Sun Feb 22 19:59:41 2009
New Revision: 188930
URL: http://svn.freebsd.org/changeset/base/188930
Log:
Merge r188902 through r188929.
Modified:
user/alc/pagelock/sys/ (props changed)
user/alc/pagelock/sys/amd64/amd64/local_apic.c
user/alc/pagelock/sys/conf/kern.mk
user/alc/pagelock/sys/dev/ata/ata-all.c
user/alc/pagelock/sys/dev/ata/ata-all.h
user/alc/pagelock/sys/dev/ata/ata-pci.h
user/alc/pagelock/sys/dev/ata/ata-sata.c
user/alc/pagelock/sys/dev/ata/chipsets/ata-ahci.c
user/alc/pagelock/sys/dev/ata/chipsets/ata-promise.c
user/alc/pagelock/sys/dev/ata/chipsets/ata-siliconimage.c
user/alc/pagelock/sys/dev/md/md.c
user/alc/pagelock/sys/dev/usb2/controller/usb2_bus.h
user/alc/pagelock/sys/dev/usb2/controller/usb2_controller.c
user/alc/pagelock/sys/fs/tmpfs/tmpfs_vnops.c
user/alc/pagelock/sys/i386/i386/local_apic.c
user/alc/pagelock/sys/net80211/ieee80211_scan.c
user/alc/pagelock/sys/net80211/ieee80211_tdma.c
Modified: user/alc/pagelock/sys/amd64/amd64/local_apic.c
==============================================================================
--- user/alc/pagelock/sys/amd64/amd64/local_apic.c Sun Feb 22 19:50:09 2009 (r188929)
+++ user/alc/pagelock/sys/amd64/amd64/local_apic.c Sun Feb 22 19:59:41 2009 (r188930)
@@ -900,7 +900,13 @@ apic_disable_vector(u_int apic_id, u_int
KASSERT(vector != IDT_SYSCALL, ("Attempt to overwrite syscall entry"));
KASSERT(ioint_handlers[vector / 32] != NULL,
("No ISR handler for vector %u", vector));
+#ifdef notyet
+ /*
+ * We can not currently clear the idt entry because other cpus
+ * may have a valid vector at this offset.
+ */
setidt(vector, &IDTVEC(rsvd), SDT_SYSIGT, SEL_KPL, 0);
+#endif
}
/* Release an APIC vector when it's no longer in use. */
@@ -924,9 +930,11 @@ apic_free_vector(u_int apic_id, u_int ve
if (sched_is_bound(td))
panic("apic_free_vector: Thread already bound.\n");
sched_bind(td, apic_cpuid(apic_id));
+ thread_unlock(td);
mtx_lock_spin(&icu_lock);
lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] = 0;
mtx_unlock_spin(&icu_lock);
+ thread_lock(td);
sched_unbind(td);
thread_unlock(td);
Modified: user/alc/pagelock/sys/conf/kern.mk
==============================================================================
--- user/alc/pagelock/sys/conf/kern.mk Sun Feb 22 19:50:09 2009 (r188929)
+++ user/alc/pagelock/sys/conf/kern.mk Sun Feb 22 19:59:41 2009 (r188930)
@@ -78,9 +78,10 @@ INLINE_LIMIT?= 8000
#
# For PowerPC we tell gcc to use floating point emulation. This avoids using
# floating point registers for integer operations which it has a tendency to do.
+# Also explicitly disable Altivec instructions inside the kernel.
#
.if ${MACHINE_ARCH} == "powerpc"
-CFLAGS+= -msoft-float
+CFLAGS+= -msoft-float -mno-altivec
INLINE_LIMIT?= 15000
.endif
Modified: user/alc/pagelock/sys/dev/ata/ata-all.c
==============================================================================
--- user/alc/pagelock/sys/dev/ata/ata-all.c Sun Feb 22 19:50:09 2009 (r188929)
+++ user/alc/pagelock/sys/dev/ata/ata-all.c Sun Feb 22 19:59:41 2009 (r188930)
@@ -62,6 +62,7 @@ static struct cdevsw ata_cdevsw = {
/* prototypes */
static void ata_boot_attach(void);
static device_t ata_add_child(device_t, struct ata_device *, int);
+static void ata_conn_event(void *, int);
static void bswap(int8_t *, int);
static void btrim(int8_t *, int);
static void bpack(int8_t *, int8_t *, int);
@@ -127,6 +128,7 @@ ata_attach(device_t dev)
bzero(&ch->queue_mtx, sizeof(struct mtx));
mtx_init(&ch->queue_mtx, "ATA queue lock", NULL, MTX_DEF);
TAILQ_INIT(&ch->ata_queue);
+ TASK_INIT(&ch->conntask, 0, ata_conn_event, dev);
/* reset the controller HW, the channel and device(s) */
while (ATA_LOCKING(dev, ATA_LF_LOCK) != ch->unit)
@@ -181,6 +183,7 @@ ata_detach(device_t dev)
device_delete_child(dev, children[i]);
free(children, M_TEMP);
}
+ taskqueue_drain(taskqueue_thread, &ch->conntask);
/* release resources */
bus_teardown_intr(dev, ch->r_irq, ch->ih);
@@ -196,6 +199,14 @@ ata_detach(device_t dev)
return 0;
}
+static void
+ata_conn_event(void *context, int dummy)
+{
+ device_t dev = (device_t)context;
+
+ ata_reinit(dev);
+}
+
int
ata_reinit(device_t dev)
{
@@ -217,6 +228,11 @@ ata_reinit(device_t dev)
/* catch eventual request in ch->running */
mtx_lock(&ch->state_mtx);
+ if (ch->state & ATA_STALL_QUEUE) {
+ /* Recursive reinits and reinits during detach prohobited. */
+ mtx_unlock(&ch->state_mtx);
+ return (ENXIO);
+ }
if ((request = ch->running))
callout_stop(&request->callout);
ch->running = NULL;
@@ -274,6 +290,9 @@ ata_reinit(device_t dev)
mtx_unlock(&ch->state_mtx);
ATA_LOCKING(dev, ATA_LF_UNLOCK);
+ /* Add new children. */
+ ata_identify(dev);
+
if (bootverbose)
device_printf(dev, "reinit done ..\n");
@@ -684,14 +703,27 @@ ata_identify(device_t dev)
{
struct ata_channel *ch = device_get_softc(dev);
struct ata_device *atadev;
+ device_t *children;
device_t child;
- int i;
+ int nchildren, i, n = ch->devices;
if (bootverbose)
- device_printf(dev, "identify ch->devices=%08x\n", ch->devices);
+ device_printf(dev, "Identifying devices: %08x\n", ch->devices);
+ mtx_lock(&Giant);
+ /* Skip existing devices. */
+ if (!device_get_children(dev, &children, &nchildren)) {
+ for (i = 0; i < nchildren; i++) {
+ if (children[i] && (atadev = device_get_softc(children[i])))
+ n &= ~((ATA_ATA_MASTER | ATA_ATAPI_MASTER) << atadev->unit);
+ }
+ free(children, M_TEMP);
+ }
+ /* Create new devices. */
+ if (bootverbose)
+ device_printf(dev, "New devices: %08x\n", n);
for (i = 0; i < ATA_PM; ++i) {
- if (ch->devices & (((ATA_ATA_MASTER | ATA_ATAPI_MASTER) << i))) {
+ if (n & (((ATA_ATA_MASTER | ATA_ATAPI_MASTER) << i))) {
int unit = -1;
if (!(atadev = malloc(sizeof(struct ata_device),
@@ -701,7 +733,7 @@ ata_identify(device_t dev)
}
atadev->unit = i;
#ifdef ATA_STATIC_ID
- if (ch->devices & ((ATA_ATA_MASTER << i)))
+ if (n & (ATA_ATA_MASTER << i))
unit = (device_get_unit(dev) << 1) + i;
#endif
if ((child = ata_add_child(dev, atadev, unit))) {
@@ -716,6 +748,7 @@ ata_identify(device_t dev)
}
bus_generic_probe(dev);
bus_generic_attach(dev);
+ mtx_unlock(&Giant);
return 0;
}
@@ -899,8 +932,7 @@ ata_atapi(device_t dev)
struct ata_channel *ch = device_get_softc(device_get_parent(dev));
struct ata_device *atadev = device_get_softc(dev);
- return ((atadev->unit == ATA_MASTER && ch->devices & ATA_ATAPI_MASTER) ||
- (atadev->unit == ATA_SLAVE && ch->devices & ATA_ATAPI_SLAVE));
+ return (ch->devices & (ATA_ATAPI_MASTER << atadev->unit));
}
int
Modified: user/alc/pagelock/sys/dev/ata/ata-all.h
==============================================================================
--- user/alc/pagelock/sys/dev/ata/ata-all.h Sun Feb 22 19:50:09 2009 (r188929)
+++ user/alc/pagelock/sys/dev/ata/ata-all.h Sun Feb 22 19:59:41 2009 (r188930)
@@ -530,6 +530,7 @@ struct ata_channel {
TAILQ_HEAD(, ata_request) ata_queue; /* head of ATA queue */
struct ata_request *freezepoint; /* composite freezepoint */
struct ata_request *running; /* currently running request */
+ struct task conntask; /* PHY events handling task */
};
/* disk bay/enclosure related */
Modified: user/alc/pagelock/sys/dev/ata/ata-pci.h
==============================================================================
--- user/alc/pagelock/sys/dev/ata/ata-pci.h Sun Feb 22 19:50:09 2009 (r188929)
+++ user/alc/pagelock/sys/dev/ata/ata-pci.h Sun Feb 22 19:59:41 2009 (r188930)
@@ -66,15 +66,6 @@ struct ata_pci_controller {
} interrupt[8]; /* XXX SOS max ch# for now */
};
-/* structure for SATA connection update hotplug/hotswap support */
-struct ata_connect_task {
- struct task task;
- device_t dev;
- int action;
-#define ATA_C_ATTACH 1
-#define ATA_C_DETACH 2
-};
-
/* defines for known chipset PCI id's */
#define ATA_ACARD_ID 0x1191
#define ATA_ATP850 0x00021191
@@ -451,7 +442,6 @@ int ata_check_80pin(device_t dev, int mo
int ata_mode2idx(int mode);
/* global prototypes ata-sata.c */
-void ata_sata_phy_event(void *context, int dummy);
void ata_sata_phy_check_events(device_t dev);
int ata_sata_phy_reset(device_t dev);
void ata_sata_setmode(device_t dev, int mode);
Modified: user/alc/pagelock/sys/dev/ata/ata-sata.c
==============================================================================
--- user/alc/pagelock/sys/dev/ata/ata-sata.c Sun Feb 22 19:50:09 2009 (r188929)
+++ user/alc/pagelock/sys/dev/ata/ata-sata.c Sun Feb 22 19:59:41 2009 (r188930)
@@ -50,41 +50,6 @@ __FBSDID("$FreeBSD$");
#include <dev/ata/ata-pci.h>
#include <ata_if.h>
-/*
- * SATA support functions
- */
-void
-ata_sata_phy_event(void *context, int dummy)
-{
- struct ata_connect_task *tp = (struct ata_connect_task *)context;
- struct ata_channel *ch = device_get_softc(tp->dev);
- device_t *children;
- int nchildren, i;
-
- mtx_lock(&Giant); /* newbus suckage it needs Giant */
- if (tp->action == ATA_C_ATTACH) {
- if (bootverbose)
- device_printf(tp->dev, "CONNECTED\n");
- ATA_RESET(tp->dev);
- ata_identify(tp->dev);
- }
- if (tp->action == ATA_C_DETACH) {
- if (!device_get_children(tp->dev, &children, &nchildren)) {
- for (i = 0; i < nchildren; i++)
- if (children[i])
- device_delete_child(tp->dev, children[i]);
- free(children, M_TEMP);
- }
- mtx_lock(&ch->state_mtx);
- ch->state = ATA_IDLE;
- mtx_unlock(&ch->state_mtx);
- if (bootverbose)
- device_printf(tp->dev, "DISCONNECTED\n");
- }
- mtx_unlock(&Giant); /* suckage code dealt with, release Giant */
- free(tp, M_ATA);
-}
-
void
ata_sata_phy_check_events(device_t dev)
{
@@ -94,32 +59,17 @@ ata_sata_phy_check_events(device_t dev)
/* clear error bits/interrupt */
ATA_IDX_OUTL(ch, ATA_SERROR, error);
- /* do we have any events flagged ? */
- if (error) {
- struct ata_connect_task *tp;
- u_int32_t status = ATA_IDX_INL(ch, ATA_SSTATUS);
-
- /* if we have a connection event deal with it */
- if ((error & ATA_SE_PHY_CHANGED) &&
- (tp = (struct ata_connect_task *)
- malloc(sizeof(struct ata_connect_task),
- M_ATA, M_NOWAIT | M_ZERO))) {
-
+ /* if we have a connection event deal with it */
+ if (error & ATA_SE_PHY_CHANGED) {
+ if (bootverbose) {
+ u_int32_t status = ATA_IDX_INL(ch, ATA_SSTATUS);
if (((status & ATA_SS_CONWELL_MASK) == ATA_SS_CONWELL_GEN1) ||
((status & ATA_SS_CONWELL_MASK) == ATA_SS_CONWELL_GEN2)) {
- if (bootverbose)
device_printf(dev, "CONNECT requested\n");
- tp->action = ATA_C_ATTACH;
- }
- else {
- if (bootverbose)
+ } else
device_printf(dev, "DISCONNECT requested\n");
- tp->action = ATA_C_DETACH;
- }
- tp->dev = dev;
- TASK_INIT(&tp->task, 0, ata_sata_phy_event, tp);
- taskqueue_enqueue(taskqueue_thread, &tp->task);
}
+ taskqueue_enqueue(taskqueue_thread, &ch->conntask);
}
}
@@ -345,11 +295,11 @@ ata_pm_identify(device_t dev)
device_printf(dev, "p%d: SIGNATURE=%08x\n", port, signature);
/* figure out whats there */
- switch (signature) {
- case 0x00000101:
+ switch (signature >> 16) {
+ case 0x0000:
ch->devices |= (ATA_ATA_MASTER << port);
continue;
- case 0xeb140101:
+ case 0xeb14:
ch->devices |= (ATA_ATAPI_MASTER << port);
continue;
}
Modified: user/alc/pagelock/sys/dev/ata/chipsets/ata-ahci.c
==============================================================================
--- user/alc/pagelock/sys/dev/ata/chipsets/ata-ahci.c Sun Feb 22 19:50:09 2009 (r188929)
+++ user/alc/pagelock/sys/dev/ata/chipsets/ata-ahci.c Sun Feb 22 19:59:41 2009 (r188930)
@@ -486,11 +486,13 @@ ata_ahci_issue_cmd(device_t dev, u_int16
ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_IS + offset,
ATA_INL(ctlr->r_res2, ATA_AHCI_P_IS + offset));
- if (bootverbose)
- device_printf(dev, "ahci_issue_cmd time=%dms cnt=%dms status=%08x\n",
- timeout, count, status);
- if (timeout && (count >= timeout))
+ if (timeout && (count >= timeout)) {
+ if (bootverbose) {
+ device_printf(dev, "ahci_issue_cmd timeout: %d of %dms, status=%08x\n",
+ count, timeout, status);
+ }
return EIO;
+ }
return 0;
}
@@ -624,7 +626,7 @@ ata_ahci_start(device_t dev)
}
static int
-ata_ahci_wait_ready(device_t dev)
+ata_ahci_wait_ready(device_t dev, int t)
{
struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
struct ata_channel *ch = device_get_softc(dev);
@@ -634,8 +636,8 @@ ata_ahci_wait_ready(device_t dev)
while (ATA_INL(ctlr->r_res2, ATA_AHCI_P_TFD + offset) &
(ATA_S_BUSY | ATA_S_DRQ)) {
DELAY(1000);
- if (timeout++ > 1000) {
- device_printf(dev, "port is not ready\n");
+ if (timeout++ > t) {
+ device_printf(dev, "port is not ready (timeout %dms)\n", t);
return (-1);
}
}
@@ -653,6 +655,9 @@ ata_ahci_softreset(device_t dev, int por
struct ata_ahci_cmd_tab *ctp =
(struct ata_ahci_cmd_tab *)(ch->dma.work + ATA_AHCI_CT_OFFSET);
+ if (bootverbose)
+ device_printf(dev, "software reset port %d...\n", port);
+
/* kick controller into sane state */
ata_ahci_stop(dev);
ata_ahci_clo(dev);
@@ -665,9 +670,10 @@ ata_ahci_softreset(device_t dev, int por
//ctp->cfis[7] = ATA_D_LBA | ATA_D_IBM;
ctp->cfis[15] = (ATA_A_4BIT | ATA_A_RESET);
- if (ata_ahci_issue_cmd(dev, ATA_AHCI_CMD_RESET | ATA_AHCI_CMD_CLR_BUSY,100))
- device_printf(dev, "setting SRST failed ??\n");
- //return -1;
+ if (ata_ahci_issue_cmd(dev, ATA_AHCI_CMD_RESET | ATA_AHCI_CMD_CLR_BUSY,100)) {
+ device_printf(dev, "software reset set timeout\n");
+ return (-1);
+ }
ata_udelay(50);
@@ -680,8 +686,10 @@ ata_ahci_softreset(device_t dev, int por
if (ata_ahci_issue_cmd(dev, 0, 0))
return -1;
- if (ata_ahci_wait_ready(dev))
+ if (ata_ahci_wait_ready(dev, 1000)) {
+ device_printf(dev, "software reset clear timeout\n");
return (-1);
+ }
return ATA_INL(ctlr->r_res2, ATA_AHCI_P_SIG + offset);
}
@@ -695,6 +703,9 @@ ata_ahci_reset(device_t dev)
u_int32_t signature;
int offset = ch->unit << 7;
+ if (bootverbose)
+ device_printf(dev, "AHCI reset...\n");
+
/* Disable port interrupts */
ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_IE + offset, 0);
@@ -718,7 +729,7 @@ ata_ahci_reset(device_t dev)
if (!ata_sata_phy_reset(dev)) {
if (bootverbose)
- device_printf(dev, "phy reset found no device\n");
+ device_printf(dev, "AHCI reset done: phy reset found no device\n");
ch->devices = 0;
/* enable wanted port interrupts */
@@ -738,7 +749,7 @@ ata_ahci_reset(device_t dev)
ATA_AHCI_P_IX_PS | ATA_AHCI_P_IX_DHR));
/* Wait for initial TFD from device. */
- ata_ahci_wait_ready(dev);
+ ata_ahci_wait_ready(dev, 10000);
/* only probe for PortMultiplier if HW has support */
if (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_CAP_SPM) {
@@ -754,24 +765,24 @@ ata_ahci_reset(device_t dev)
if (bootverbose)
device_printf(dev, "SIGNATURE: %08x\n", signature);
- switch (signature) {
- case 0x00000101:
+ switch (signature >> 16) {
+ case 0x0000:
ch->devices = ATA_ATA_MASTER;
break;
- case 0x96690101:
+ case 0x9669:
ch->devices = ATA_PORTMULTIPLIER;
ata_pm_identify(dev);
break;
- case 0xeb140101:
+ case 0xeb14:
ch->devices = ATA_ATAPI_MASTER;
break;
default: /* SOS XXX */
if (bootverbose)
- device_printf(dev, "No signature, asuming disk device\n");
+ device_printf(dev, "Unknown signature, asuming disk device\n");
ch->devices = ATA_ATA_MASTER;
}
if (bootverbose)
- device_printf(dev, "ahci_reset devices=%08x\n", ch->devices);
+ device_printf(dev, "AHCI reset done: devices=%08x\n", ch->devices);
}
static void
Modified: user/alc/pagelock/sys/dev/ata/chipsets/ata-promise.c
==============================================================================
--- user/alc/pagelock/sys/dev/ata/chipsets/ata-promise.c Sun Feb 22 19:50:09 2009 (r188929)
+++ user/alc/pagelock/sys/dev/ata/chipsets/ata-promise.c Sun Feb 22 19:59:41 2009 (r188930)
@@ -637,7 +637,6 @@ ata_promise_mio_status(device_t dev)
{
struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
struct ata_channel *ch = device_get_softc(dev);
- struct ata_connect_task *tp;
u_int32_t fake_reg, stat_reg, vector, status;
switch (ctlr->chip->cfg2) {
@@ -663,31 +662,17 @@ ata_promise_mio_status(device_t dev)
ATA_OUTL(ctlr->r_res2, stat_reg, status & (0x00000011 << ch->unit));
/* check for and handle disconnect events */
- if ((status & (0x00000001 << ch->unit)) &&
- (tp = (struct ata_connect_task *)
- malloc(sizeof(struct ata_connect_task),
- M_ATA, M_NOWAIT | M_ZERO))) {
-
+ if (status & (0x00000001 << ch->unit)) {
if (bootverbose)
device_printf(dev, "DISCONNECT requested\n");
- tp->action = ATA_C_DETACH;
- tp->dev = dev;
- TASK_INIT(&tp->task, 0, ata_sata_phy_event, tp);
- taskqueue_enqueue(taskqueue_thread, &tp->task);
+ taskqueue_enqueue(taskqueue_thread, &ch->conntask);
}
/* check for and handle connect events */
- if ((status & (0x00000010 << ch->unit)) &&
- (tp = (struct ata_connect_task *)
- malloc(sizeof(struct ata_connect_task),
- M_ATA, M_NOWAIT | M_ZERO))) {
-
+ if (status & (0x00000010 << ch->unit)) {
if (bootverbose)
device_printf(dev, "CONNECT requested\n");
- tp->action = ATA_C_ATTACH;
- tp->dev = dev;
- TASK_INIT(&tp->task, 0, ata_sata_phy_event, tp);
- taskqueue_enqueue(taskqueue_thread, &tp->task);
+ taskqueue_enqueue(taskqueue_thread, &ch->conntask);
}
/* do we have any device action ? */
@@ -823,15 +808,15 @@ ata_promise_mio_reset(device_t dev)
if (1 | bootverbose)
device_printf(dev, "SIGNATURE: %08x\n", signature);
- switch (signature) {
- case 0x00000101:
+ switch (signature >> 16) {
+ case 0x0000:
ch->devices = ATA_ATA_MASTER;
break;
- case 0x96690101:
+ case 0x9669:
ch->devices = ATA_PORTMULTIPLIER;
ata_pm_identify(dev);
break;
- case 0xeb140101:
+ case 0xeb14:
ch->devices = ATA_ATAPI_MASTER;
break;
default: /* SOS XXX */
Modified: user/alc/pagelock/sys/dev/ata/chipsets/ata-siliconimage.c
==============================================================================
--- user/alc/pagelock/sys/dev/ata/chipsets/ata-siliconimage.c Sun Feb 22 19:50:09 2009 (r188929)
+++ user/alc/pagelock/sys/dev/ata/chipsets/ata-siliconimage.c Sun Feb 22 19:59:41 2009 (r188930)
@@ -849,17 +849,17 @@ ata_siiprb_reset(device_t dev)
device_printf(dev, "SIGNATURE=%08x\n", signature);
/* figure out whats there */
- switch (signature) {
- case 0x00000101:
+ switch (signature >> 16) {
+ case 0x0000:
ch->devices = ATA_ATA_MASTER;
break;
- case 0x96690101:
+ case 0x9669:
ch->devices = ATA_PORTMULTIPLIER;
ATA_OUTL(ctlr->r_res2, 0x1000 + offset, 0x2000); /* enable PM support */
//SOS XXX need to clear all PM status and interrupts!!!!
ata_pm_identify(dev);
break;
- case 0xeb140101:
+ case 0xeb14:
ch->devices = ATA_ATAPI_MASTER;
break;
default:
Modified: user/alc/pagelock/sys/dev/md/md.c
==============================================================================
--- user/alc/pagelock/sys/dev/md/md.c Sun Feb 22 19:50:09 2009 (r188929)
+++ user/alc/pagelock/sys/dev/md/md.c Sun Feb 22 19:59:41 2009 (r188930)
@@ -629,9 +629,7 @@ mdstart_swap(struct md_s *sc, struct bio
if (rv == VM_PAGER_ERROR) {
sf_buf_free(sf);
sched_unpin();
- vm_page_lock_queues();
vm_page_wakeup(m);
- vm_page_unlock_queues();
break;
}
bcopy((void *)(sf_buf_kva(sf) + offs), p, len);
@@ -641,9 +639,7 @@ mdstart_swap(struct md_s *sc, struct bio
if (rv == VM_PAGER_ERROR) {
sf_buf_free(sf);
sched_unpin();
- vm_page_lock_queues();
vm_page_wakeup(m);
- vm_page_unlock_queues();
break;
}
bcopy(p, (void *)(sf_buf_kva(sf) + offs), len);
@@ -655,9 +651,7 @@ mdstart_swap(struct md_s *sc, struct bio
if (rv == VM_PAGER_ERROR) {
sf_buf_free(sf);
sched_unpin();
- vm_page_lock_queues();
vm_page_wakeup(m);
- vm_page_unlock_queues();
break;
}
bzero((void *)(sf_buf_kva(sf) + offs), len);
@@ -667,8 +661,8 @@ mdstart_swap(struct md_s *sc, struct bio
}
sf_buf_free(sf);
sched_unpin();
- vm_page_lock_queues();
vm_page_wakeup(m);
+ vm_page_lock_queues();
vm_page_activate(m);
if (bp->bio_cmd == BIO_WRITE)
vm_page_dirty(m);
Modified: user/alc/pagelock/sys/dev/usb2/controller/usb2_bus.h
==============================================================================
--- user/alc/pagelock/sys/dev/usb2/controller/usb2_bus.h Sun Feb 22 19:50:09 2009 (r188929)
+++ user/alc/pagelock/sys/dev/usb2/controller/usb2_bus.h Sun Feb 22 19:59:41 2009 (r188930)
@@ -53,6 +53,7 @@ struct usb2_bus {
struct usb2_bus_stat stats_ok;
struct usb2_process explore_proc;
struct usb2_process roothub_proc;
+ struct root_hold_token *bus_roothold;
/*
* There are two callback processes. One for Giant locked
* callbacks. One for non-Giant locked callbacks. This should
Modified: user/alc/pagelock/sys/dev/usb2/controller/usb2_controller.c
==============================================================================
--- user/alc/pagelock/sys/dev/usb2/controller/usb2_controller.c Sun Feb 22 19:50:09 2009 (r188929)
+++ user/alc/pagelock/sys/dev/usb2/controller/usb2_controller.c Sun Feb 22 19:59:41 2009 (r188930)
@@ -126,6 +126,10 @@ usb2_attach(device_t dev)
DPRINTFN(0, "USB device has no ivars\n");
return (ENXIO);
}
+
+ /* delay vfs_mountroot until the bus is explored */
+ bus->bus_roothold = root_mount_hold(device_get_nameunit(dev));
+
if (usb2_post_init_called) {
mtx_lock(&Giant);
usb2_attach_sub(dev, bus);
@@ -153,6 +157,10 @@ usb2_detach(device_t dev)
usb2_callout_drain(&bus->power_wdog);
/* Let the USB explore process detach all devices. */
+ if (bus->bus_roothold != NULL) {
+ root_mount_rel(bus->bus_roothold);
+ bus->bus_roothold = NULL;
+ }
USB_BUS_LOCK(bus);
if (usb2_proc_msignal(&bus->explore_proc,
@@ -225,6 +233,10 @@ usb2_bus_explore(struct usb2_proc_msg *p
USB_BUS_LOCK(bus);
}
+ if (bus->bus_roothold != NULL) {
+ root_mount_rel(bus->bus_roothold);
+ bus->bus_roothold = NULL;
+ }
}
/*------------------------------------------------------------------------*
Modified: user/alc/pagelock/sys/fs/tmpfs/tmpfs_vnops.c
==============================================================================
--- user/alc/pagelock/sys/fs/tmpfs/tmpfs_vnops.c Sun Feb 22 19:50:09 2009 (r188929)
+++ user/alc/pagelock/sys/fs/tmpfs/tmpfs_vnops.c Sun Feb 22 19:59:41 2009 (r188930)
@@ -52,8 +52,7 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_object.h>
#include <vm/vm_page.h>
#include <vm/vm_pager.h>
-#include <sys/sched.h>
-#include <sys/sf_buf.h>
+
#include <machine/_inttypes.h>
#include <fs/fifofs/fifo.h>
@@ -436,10 +435,9 @@ tmpfs_mappedread(vm_object_t vobj, vm_ob
{
vm_pindex_t idx;
vm_page_t m;
- struct sf_buf *sf;
- off_t offset, addr;
+ vm_offset_t offset;
+ off_t addr;
size_t tlen;
- caddr_t va;
int error;
addr = uio->uio_offset;
@@ -458,12 +456,7 @@ lookupvpg:
goto lookupvpg;
vm_page_busy(m);
VM_OBJECT_UNLOCK(vobj);
- sched_pin();
- sf = sf_buf_alloc(m, SFB_CPUPRIVATE);
- va = (caddr_t)sf_buf_kva(sf);
- error = uiomove(va + offset, tlen, uio);
- sf_buf_free(sf);
- sched_unpin();
+ error = uiomove_fromphys(&m, offset, tlen, uio);
VM_OBJECT_LOCK(vobj);
vm_page_wakeup(m);
VM_OBJECT_UNLOCK(vobj);
@@ -487,17 +480,11 @@ nocache:
vm_page_zero_invalid(m, TRUE);
}
VM_OBJECT_UNLOCK(tobj);
- sched_pin();
- sf = sf_buf_alloc(m, SFB_CPUPRIVATE);
- va = (caddr_t)sf_buf_kva(sf);
- error = uiomove(va + offset, tlen, uio);
- sf_buf_free(sf);
- sched_unpin();
+ error = uiomove_fromphys(&m, offset, tlen, uio);
VM_OBJECT_LOCK(tobj);
out:
vm_page_lock_queues();
- vm_page_unwire(m, 0);
- vm_page_activate(m);
+ vm_page_unwire(m, TRUE);
vm_page_unlock_queues();
vm_page_wakeup(m);
vm_object_pip_subtract(tobj, 1);
@@ -558,10 +545,9 @@ tmpfs_mappedwrite(vm_object_t vobj, vm_o
{
vm_pindex_t idx;
vm_page_t vpg, tpg;
- struct sf_buf *sf;
- off_t offset, addr;
+ vm_offset_t offset;
+ off_t addr;
size_t tlen;
- caddr_t va;
int error;
error = 0;
@@ -587,12 +573,7 @@ lookupvpg:
vm_page_undirty(vpg);
vm_page_unlock_queues();
VM_OBJECT_UNLOCK(vobj);
- sched_pin();
- sf = sf_buf_alloc(vpg, SFB_CPUPRIVATE);
- va = (caddr_t)sf_buf_kva(sf);
- error = uiomove(va + offset, tlen, uio);
- sf_buf_free(sf);
- sched_unpin();
+ error = uiomove_fromphys(&vpg, offset, tlen, uio);
} else {
VM_OBJECT_UNLOCK(vobj);
vpg = NULL;
@@ -614,14 +595,9 @@ nocache:
vm_page_zero_invalid(tpg, TRUE);
}
VM_OBJECT_UNLOCK(tobj);
- if (vpg == NULL) {
- sched_pin();
- sf = sf_buf_alloc(tpg, SFB_CPUPRIVATE);
- va = (caddr_t)sf_buf_kva(sf);
- error = uiomove(va + offset, tlen, uio);
- sf_buf_free(sf);
- sched_unpin();
- } else {
+ if (vpg == NULL)
+ error = uiomove_fromphys(&tpg, offset, tlen, uio);
+ else {
KASSERT(vpg->valid == VM_PAGE_BITS_ALL, ("parts of vpg invalid"));
pmap_copy_page(vpg, tpg);
}
@@ -635,8 +611,7 @@ out:
vm_page_zero_invalid(tpg, TRUE);
vm_page_dirty(tpg);
}
- vm_page_unwire(tpg, 0);
- vm_page_activate(tpg);
+ vm_page_unwire(tpg, TRUE);
vm_page_unlock_queues();
vm_page_wakeup(tpg);
if (vpg != NULL)
Modified: user/alc/pagelock/sys/i386/i386/local_apic.c
==============================================================================
--- user/alc/pagelock/sys/i386/i386/local_apic.c Sun Feb 22 19:50:09 2009 (r188929)
+++ user/alc/pagelock/sys/i386/i386/local_apic.c Sun Feb 22 19:59:41 2009 (r188930)
@@ -903,8 +903,14 @@ apic_disable_vector(u_int apic_id, u_int
KASSERT(vector != IDT_SYSCALL, ("Attempt to overwrite syscall entry"));
KASSERT(ioint_handlers[vector / 32] != NULL,
("No ISR handler for vector %u", vector));
+#ifdef notyet
+ /*
+ * We can not currently clear the idt entry because other cpus
+ * may have a valid vector at this offset.
+ */
setidt(vector, &IDTVEC(rsvd), SDT_SYS386TGT, SEL_KPL,
GSEL(GCODE_SEL, SEL_KPL));
+#endif
}
/* Release an APIC vector when it's no longer in use. */
@@ -928,9 +934,11 @@ apic_free_vector(u_int apic_id, u_int ve
if (sched_is_bound(td))
panic("apic_free_vector: Thread already bound.\n");
sched_bind(td, apic_cpuid(apic_id));
+ thread_unlock(td);
mtx_lock_spin(&icu_lock);
lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] = 0;
mtx_unlock_spin(&icu_lock);
+ thread_lock(td);
sched_unbind(td);
thread_unlock(td);
Modified: user/alc/pagelock/sys/net80211/ieee80211_scan.c
==============================================================================
--- user/alc/pagelock/sys/net80211/ieee80211_scan.c Sun Feb 22 19:50:09 2009 (r188929)
+++ user/alc/pagelock/sys/net80211/ieee80211_scan.c Sun Feb 22 19:59:41 2009 (r188930)
@@ -346,7 +346,8 @@ scan_dump(struct ieee80211_scan_state *s
if_printf(vap->iv_ifp, "scan set ");
ieee80211_scan_dump_channels(ss);
- printf(" dwell min %lu max %lu\n", ss->ss_mindwell, ss->ss_maxdwell);
+ printf(" dwell min %lums max %lums\n",
+ ticks_to_msecs(ss->ss_mindwell), ticks_to_msecs(ss->ss_maxdwell));
}
#endif /* IEEE80211_DEBUG */
@@ -919,7 +920,7 @@ again:
maxdwell = ss->ss_maxdwell;
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
- "%s: chan %3d%c -> %3d%c [%s, dwell min %lu max %lu]\n",
+ "%s: chan %3d%c -> %3d%c [%s, dwell min %lums max %lums]\n",
__func__,
ieee80211_chan2ieee(ic, ic->ic_curchan),
channel_type(ic->ic_curchan),
@@ -927,7 +928,7 @@ again:
(ss->ss_flags & IEEE80211_SCAN_ACTIVE) &&
(chan->ic_flags & IEEE80211_CHAN_PASSIVE) == 0 ?
"active" : "passive",
- ss->ss_mindwell, maxdwell);
+ ticks_to_msecs(ss->ss_mindwell), ticks_to_msecs(maxdwell));
/*
* Potentially change channel and phy mode.
Modified: user/alc/pagelock/sys/net80211/ieee80211_tdma.c
==============================================================================
--- user/alc/pagelock/sys/net80211/ieee80211_tdma.c Sun Feb 22 19:50:09 2009 (r188929)
+++ user/alc/pagelock/sys/net80211/ieee80211_tdma.c Sun Feb 22 19:59:41 2009 (r188930)
@@ -240,11 +240,14 @@ tdma_newstate(struct ieee80211vap *vap,
if (status == 0 &&
nstate == IEEE80211_S_RUN && ostate != IEEE80211_S_RUN &&
(vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS) &&
- ts->tdma_slot != 0) {
+ ts->tdma_slot != 0 &&
+ vap->iv_des_chan == IEEE80211_CHAN_ANYC) {
/*
* Start s/w beacon miss timer for slave devices w/o
- * hardware support. The 2x is a fudge for our doing
- * this in software.
+ * hardware support. Note we do this only if we're
+ * not locked to a channel (i.e. roam to follow the
+ * master). The 2x is a fudge for our doing this in
+ * software.
*/
vap->iv_swbmiss_period = IEEE80211_TU_TO_TICKS(
2 * vap->iv_bmissthreshold * ts->tdma_bintval *
More information about the svn-src-user
mailing list