PERFORCE change 150023 for review
Marko Zec
zec at FreeBSD.org
Thu Sep 18 16:06:49 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=150023
Change 150023 by zec at zec_tca51 on 2008/09/18 16:06:06
IFC @ 150022
Affected files ...
.. //depot/projects/vimage/src/sys/boot/Makefile#4 integrate
.. //depot/projects/vimage/src/sys/cam/cam.h#2 integrate
.. //depot/projects/vimage/src/sys/dev/ata/ata-chipset.c#17 integrate
.. //depot/projects/vimage/src/sys/dev/ata/ata-pci.c#6 integrate
.. //depot/projects/vimage/src/sys/dev/ata/ata-pci.h#12 integrate
.. //depot/projects/vimage/src/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#11 integrate
.. //depot/projects/vimage/src/sys/dev/sbni/if_sbni.c#6 integrate
.. //depot/projects/vimage/src/sys/dev/sbni/if_sbni_isa.c#6 integrate
.. //depot/projects/vimage/src/sys/dev/sbni/if_sbni_pci.c#6 integrate
.. //depot/projects/vimage/src/sys/dev/sbni/if_sbnireg.h#5 integrate
.. //depot/projects/vimage/src/sys/dev/sbni/if_sbnivar.h#5 integrate
.. //depot/projects/vimage/src/sys/geom/geom_io.c#6 integrate
.. //depot/projects/vimage/src/sys/i386/i386/identcpu.c#9 integrate
.. //depot/projects/vimage/src/sys/i386/i386/intr_machdep.c#8 integrate
.. //depot/projects/vimage/src/sys/i386/include/specialreg.h#9 integrate
.. //depot/projects/vimage/src/sys/i386/xen/mp_machdep.c#2 integrate
.. //depot/projects/vimage/src/sys/i386/xen/xen_machdep.c#6 integrate
.. //depot/projects/vimage/src/sys/kern/kern_priv.c#5 integrate
.. //depot/projects/vimage/src/sys/mips/malta/gt_pci.c#3 integrate
.. //depot/projects/vimage/src/sys/mips/mips/intr_machdep.c#3 integrate
.. //depot/projects/vimage/src/sys/modules/sbni/Makefile#5 integrate
.. //depot/projects/vimage/src/sys/net/if_lagg.c#16 integrate
.. //depot/projects/vimage/src/sys/netipx/ipx.c#5 integrate
.. //depot/projects/vimage/src/sys/nfsserver/nfs.h#4 integrate
.. //depot/projects/vimage/src/sys/nfsserver/nfs_serv.c#9 integrate
.. //depot/projects/vimage/src/sys/nfsserver/nfs_srvsock.c#7 integrate
.. //depot/projects/vimage/src/sys/nfsserver/nfs_srvsubs.c#10 integrate
.. //depot/projects/vimage/src/sys/nfsserver/nfs_syscalls.c#10 integrate
.. //depot/projects/vimage/src/sys/security/mac_bsdextended/mac_bsdextended.c#13 integrate
.. //depot/projects/vimage/src/sys/sparc64/include/smp.h#6 integrate
.. //depot/projects/vimage/src/sys/sparc64/sparc64/genassym.c#7 integrate
.. //depot/projects/vimage/src/sys/sparc64/sparc64/intr_machdep.c#7 integrate
.. //depot/projects/vimage/src/sys/sparc64/sparc64/mp_machdep.c#8 integrate
.. //depot/projects/vimage/src/sys/sys/param.h#27 integrate
.. //depot/projects/vimage/src/sys/sys/priv.h#11 integrate
.. //depot/projects/vimage/src/sys/sys/ttydisc.h#3 integrate
Differences ...
==== //depot/projects/vimage/src/sys/boot/Makefile#4 (text+ko) ====
@@ -1,7 +1,11 @@
-# $FreeBSD: src/sys/boot/Makefile,v 1.34 2008/07/23 07:23:33 imp Exp $
+# $FreeBSD: src/sys/boot/Makefile,v 1.35 2008/09/18 15:25:35 obrien Exp $
.include <bsd.own.mk>
+.if ${MACHINE_ARCH} == "mips"
+MK_FORTH=no # not yet
+.endif
+
.if ${MK_FORTH} != "no"
# Build the add-in FORTH interpreter.
SUBDIR+= ficl
==== //depot/projects/vimage/src/sys/cam/cam.h#2 (text+ko) ====
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/cam/cam.h,v 1.11 2005/01/05 22:34:34 imp Exp $
+ * $FreeBSD: src/sys/cam/cam.h,v 1.12 2008/09/18 14:48:46 sbruno Exp $
*/
#ifndef _CAM_CAM_H
@@ -129,6 +129,7 @@
* requests for the target at the sim level
* back into the XPT queue.
*/
+ CAM_SCSI_IT_NEXUS_LOST, /* Initiator/Target Nexus lost. */
CAM_IDE = 0x33, /* Initiator Detected Error */
CAM_RESRC_UNAVAIL, /* Resource Unavailable */
CAM_UNACKED_EVENT, /* Unacknowledged Event by Host */
==== //depot/projects/vimage/src/sys/dev/ata/ata-chipset.c#17 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.226 2008/09/04 10:27:58 mav Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.227 2008/09/18 12:12:34 sos Exp $");
#include "opt_ata.h"
#include <sys/param.h>
@@ -62,6 +62,8 @@
static void ata_sata_setmode(device_t dev, int mode);
static int ata_request2fis_h2d(struct ata_request *request, u_int8_t *fis);
static int ata_ahci_chipinit(device_t dev);
+static int ata_ahci_ctlr_reset(device_t dev);
+static int ata_ahci_suspend(device_t dev);
static int ata_ahci_allocate(device_t dev);
static int ata_ahci_status(device_t dev);
static int ata_ahci_begin_transaction(struct ata_request *request);
@@ -602,6 +604,42 @@
else
device_printf(dev, "AHCI called from vendor specific driver\n");
+ /* reset controller */
+ ata_ahci_ctlr_reset(dev);
+
+ /* get the number of HW channels */
+ ctlr->channels =
+ MAX(flsl(ATA_INL(ctlr->r_res2, ATA_AHCI_PI)),
+ (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_NPMASK) + 1);
+
+ ctlr->reset = ata_ahci_reset;
+ ctlr->dmainit = ata_ahci_dmainit;
+ ctlr->allocate = ata_ahci_allocate;
+ ctlr->setmode = ata_sata_setmode;
+ ctlr->suspend = ata_ahci_suspend;
+ ctlr->resume = ata_ahci_ctlr_reset;
+
+ /* enable PCI interrupt */
+ pci_write_config(dev, PCIR_COMMAND,
+ pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400, 2);
+
+ /* announce we support the HW */
+ version = ATA_INL(ctlr->r_res2, ATA_AHCI_VS);
+ device_printf(dev,
+ "AHCI Version %x%x.%x%x controller with %d ports PM %s\n",
+ (version >> 24) & 0xff, (version >> 16) & 0xff,
+ (version >> 8) & 0xff, version & 0xff,
+ (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_NPMASK) + 1,
+ (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_CAP_SPM) ?
+ "supported" : "not supported");
+ return 0;
+}
+
+static int
+ata_ahci_ctlr_reset(device_t dev)
+{
+ struct ata_pci_controller *ctlr = device_get_softc(dev);
+
/* enable AHCI mode */
ATA_OUTL(ctlr->r_res2, ATA_AHCI_GHC, ATA_AHCI_GHC_AE);
@@ -617,11 +655,6 @@
/* reenable AHCI mode */
ATA_OUTL(ctlr->r_res2, ATA_AHCI_GHC, ATA_AHCI_GHC_AE);
- /* get the number of HW channels */
- ctlr->channels =
- MAX(flsl(ATA_INL(ctlr->r_res2, ATA_AHCI_PI)),
- (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_NPMASK) + 1);
-
/* clear interrupts */
ATA_OUTL(ctlr->r_res2, ATA_AHCI_IS, ATA_INL(ctlr->r_res2, ATA_AHCI_IS));
@@ -629,33 +662,26 @@
ATA_OUTL(ctlr->r_res2, ATA_AHCI_GHC,
ATA_INL(ctlr->r_res2, ATA_AHCI_GHC) | ATA_AHCI_GHC_IE);
- ctlr->reset = ata_ahci_reset;
- ctlr->dmainit = ata_ahci_dmainit;
- ctlr->allocate = ata_ahci_allocate;
- ctlr->setmode = ata_sata_setmode;
+ return 0;
+}
- /* enable PCI interrupt */
- pci_write_config(dev, PCIR_COMMAND,
- pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400, 2);
+static int
+ata_ahci_suspend(device_t dev)
+{
+ struct ata_pci_controller *ctlr = device_get_softc(dev);
- /* announce we support the HW */
- version = ATA_INL(ctlr->r_res2, ATA_AHCI_VS);
- device_printf(dev,
- "AHCI Version %x%x.%x%x controller with %d ports PM %s\n",
- (version >> 24) & 0xff, (version >> 16) & 0xff,
- (version >> 8) & 0xff, version & 0xff,
- (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_NPMASK) + 1,
- (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_CAP_SPM) ?
- "supported" : "not supported");
+ /* disable interupts so the state change(s) doesn't trigger */
+ ATA_OUTL(ctlr->r_res2, ATA_AHCI_GHC,
+ ATA_INL(ctlr->r_res2, ATA_AHCI_GHC) & (~ATA_AHCI_GHC_IE));
return 0;
}
+
static int
ata_ahci_allocate(device_t dev)
{
struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
struct ata_channel *ch = device_get_softc(dev);
- u_int64_t work;
int offset = ch->unit << 7;
/* set the SATA resources */
@@ -676,30 +702,6 @@
ch->hw.pm_read = ata_ahci_pm_read;
ch->hw.pm_write = ata_ahci_pm_write;
- /* setup work areas */
- work = ch->dma.work_bus + ATA_AHCI_CL_OFFSET;
- ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CLB + offset, work & 0xffffffff);
- ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CLBU + offset, work >> 32);
-
- work = ch->dma.work_bus + ATA_AHCI_FB_OFFSET;
- ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FB + offset, work & 0xffffffff);
- ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FBU + offset, work >> 32);
-
- /* enable wanted port interrupts */
- ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_IE + offset,
- (ATA_AHCI_P_IX_CPD | ATA_AHCI_P_IX_TFE | ATA_AHCI_P_IX_HBF |
- ATA_AHCI_P_IX_HBD | ATA_AHCI_P_IX_IF | ATA_AHCI_P_IX_OF |
- ATA_AHCI_P_IX_PRC | ATA_AHCI_P_IX_PC | ATA_AHCI_P_IX_DP |
- ATA_AHCI_P_IX_UF | ATA_AHCI_P_IX_SDB | ATA_AHCI_P_IX_DS |
- ATA_AHCI_P_IX_PS | ATA_AHCI_P_IX_DHR));
-
- /* enable FIS based switching */
- //ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FBS + offset, 0x00000003);
-
- /* start operations on this channel */
- ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CMD + offset,
- (ATA_AHCI_P_CMD_ACTIVE | ATA_AHCI_P_CMD_FRE |
- ATA_AHCI_P_CMD_POD | ATA_AHCI_P_CMD_SUD | ATA_AHCI_P_CMD_ST));
return 0;
}
@@ -711,21 +713,24 @@
u_int32_t action = ATA_INL(ctlr->r_res2, ATA_AHCI_IS);
int offset = ch->unit << 7;
+#define ATA_AHCI_STATBITS \
+ (ATA_AHCI_P_IX_IF|ATA_AHCI_P_IX_HBD|ATA_AHCI_P_IX_HBF|ATA_AHCI_P_IX_TFE)
+
if (action & (1 << ch->unit)) {
u_int32_t istatus = ATA_INL(ctlr->r_res2, ATA_AHCI_P_IS + offset);
u_int32_t cstatus = ATA_INL(ctlr->r_res2, ATA_AHCI_P_CI + offset);
/* clear interrupt(s) */
+ ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_IS + offset, istatus);
ATA_OUTL(ctlr->r_res2, ATA_AHCI_IS, action & (1 << ch->unit));
- ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_IS + offset, istatus);
/* do we have any PHY events ? */
- /* XXX SOS check istatus phy bits */
- ata_sata_phy_check_events(dev);
+ if (istatus & (ATA_AHCI_P_IX_PRC | ATA_AHCI_P_IX_PC))
+ ata_sata_phy_check_events(dev);
/* do we have a potentially hanging engine to take care of? */
/* XXX SOS what todo on NCQ */
- if ((istatus & 0x78400050) && (cstatus & 1)) {
+ if ((istatus & ATA_AHCI_STATBITS) && (cstatus & 1)) {
u_int32_t cmd = ATA_INL(ctlr->r_res2, ATA_AHCI_P_CMD + offset);
int timeout = 0;
@@ -1047,10 +1052,10 @@
ATA_INL(ctlr->r_res2, ATA_AHCI_P_IS + offset));
/* start operations on this channel */
+ cmd = ATA_INL(ctlr->r_res2, ATA_AHCI_P_CMD + offset);
ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CMD + offset,
- (ATA_AHCI_P_CMD_ACTIVE | ATA_AHCI_P_CMD_FRE |
- ATA_AHCI_P_CMD_POD | ATA_AHCI_P_CMD_SUD | ATA_AHCI_P_CMD_ST)
- | (ch->devices & ATA_PORTMULTIPLIER ? ATA_AHCI_P_CMD_PMA : 0));
+ cmd | (ATA_AHCI_P_CMD_FRE | ATA_AHCI_P_CMD_ST) |
+ (ch->devices & ATA_PORTMULTIPLIER ? ATA_AHCI_P_CMD_PMA : 0));
}
static u_int32_t
@@ -1110,19 +1115,50 @@
{
struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
struct ata_channel *ch = device_get_softc(dev);
- u_int32_t signature;
+ u_int64_t work;
+ u_int32_t cmd, signature;
+ int offset = ch->unit << 7;
if (!(ATA_INL(ctlr->r_res2, ATA_AHCI_PI) & (1 << ch->unit))) {
device_printf(dev, "port not implemented\n");
return;
}
+ /* setup work areas */
+ work = ch->dma.work_bus + ATA_AHCI_CL_OFFSET;
+ ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CLB + offset, work & 0xffffffff);
+ ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CLBU + offset, work >> 32);
+
+ work = ch->dma.work_bus + ATA_AHCI_FB_OFFSET;
+ ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FB + offset, work & 0xffffffff);
+ ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FBU + offset, work >> 32);
+
+ /* enable wanted port interrupts */
+ ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_IE + offset,
+ (ATA_AHCI_P_IX_CPD | ATA_AHCI_P_IX_TFE | ATA_AHCI_P_IX_HBF |
+ ATA_AHCI_P_IX_HBD | ATA_AHCI_P_IX_IF | ATA_AHCI_P_IX_OF |
+ ATA_AHCI_P_IX_PRC | ATA_AHCI_P_IX_PC | ATA_AHCI_P_IX_DP |
+ ATA_AHCI_P_IX_UF | ATA_AHCI_P_IX_SDB | ATA_AHCI_P_IX_DS |
+ ATA_AHCI_P_IX_PS | ATA_AHCI_P_IX_DHR));
+
+ /* activate the channel and power/spin up device */
+ ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CMD + offset,
+ (ATA_AHCI_P_CMD_ACTIVE | ATA_AHCI_P_CMD_POD | ATA_AHCI_P_CMD_SUD));
+
ata_ahci_restart(dev);
+ /* enable FIS based switching */
+ //ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FBS + offset, 0x00000003);
+
if (!ata_sata_phy_reset(dev)) {
if (bootverbose)
device_printf(dev, "phy reset found no device\n");
ch->devices = 0;
+
+ /* kill off all activity on this channel */
+ cmd = ATA_INL(ctlr->r_res2, ATA_AHCI_P_CMD + offset);
+ ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CMD + offset,
+ cmd & ~(ATA_AHCI_P_CMD_FRE | ATA_AHCI_P_CMD_ST));
return;
}
==== //depot/projects/vimage/src/sys/dev/ata/ata-pci.c#6 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-pci.c,v 1.128 2008/06/11 06:44:58 sos Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-pci.c,v 1.129 2008/09/18 12:12:34 sos Exp $");
#include "opt_ata.h"
#include <sys/param.h>
@@ -262,6 +262,31 @@
return 0;
}
+int
+ata_pci_suspend(device_t dev)
+{
+ struct ata_pci_controller *ctlr = device_get_softc(dev);
+ int error = 0;
+
+ bus_generic_suspend(dev);
+ if (ctlr->suspend)
+ error = ctlr->suspend(dev);
+ return error;
+}
+
+int
+ata_pci_resume(device_t dev)
+{
+ struct ata_pci_controller *ctlr = device_get_softc(dev);
+ int error = 0;
+
+ if (ctlr->resume)
+ error = ctlr->resume(dev);
+ bus_generic_resume(dev);
+ return error;
+}
+
+
struct resource *
ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid,
u_long start, u_long end, u_long count, u_int flags)
@@ -555,9 +580,9 @@
DEVMETHOD(device_probe, ata_pci_probe),
DEVMETHOD(device_attach, ata_pci_attach),
DEVMETHOD(device_detach, ata_pci_detach),
+ DEVMETHOD(device_suspend, ata_pci_suspend),
+ DEVMETHOD(device_resume, ata_pci_resume),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
- DEVMETHOD(device_suspend, bus_generic_suspend),
- DEVMETHOD(device_resume, bus_generic_resume),
/* bus methods */
DEVMETHOD(bus_alloc_resource, ata_pci_alloc_resource),
==== //depot/projects/vimage/src/sys/dev/ata/ata-pci.h#12 (text+ko) ====
@@ -23,7 +23,7 @@
* (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: src/sys/dev/ata/ata-pci.h,v 1.90 2008/09/04 10:27:58 mav Exp $
+ * $FreeBSD: src/sys/dev/ata/ata-pci.h,v 1.91 2008/09/18 12:12:34 sos Exp $
*/
/* structure holding chipset config info */
@@ -50,6 +50,8 @@
struct ata_chip_id *chip;
int channels;
int (*chipinit)(device_t);
+ int (*suspend)(device_t);
+ int (*resume)(device_t);
int (*allocate)(device_t);
int (*locking)(device_t, int);
void (*reset)(device_t);
@@ -461,6 +463,8 @@
int ata_pci_probe(device_t dev);
int ata_pci_attach(device_t dev);
int ata_pci_detach(device_t dev);
+int ata_pci_suspend(device_t dev);
+int ata_pci_resume(device_t dev);
struct resource * ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags);
int ata_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r);
int ata_pci_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *function, void *argument, void **cookiep);
==== //depot/projects/vimage/src/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#11 (text+ko) ====
@@ -28,7 +28,7 @@
***************************************************************************/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c,v 1.19 2008/09/16 01:02:17 kmacy Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c,v 1.20 2008/09/17 15:49:44 attilio Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1663,8 +1663,8 @@
if (error)
return (error);
- if (optval > IPTOS_PREC_CRITIC_ECP && !suser(curthread))
- return (EPERM);
+ if (optval > IPTOS_PREC_CRITIC_ECP)
+ return (EINVAL);
inp = so_sotoinpcb(so);
inp_wlock(inp);
==== //depot/projects/vimage/src/sys/dev/sbni/if_sbni.c#6 (text+ko) ====
==== //depot/projects/vimage/src/sys/dev/sbni/if_sbni_isa.c#6 (text+ko) ====
==== //depot/projects/vimage/src/sys/dev/sbni/if_sbni_pci.c#6 (text+ko) ====
==== //depot/projects/vimage/src/sys/dev/sbni/if_sbnireg.h#5 (text+ko) ====
==== //depot/projects/vimage/src/sys/dev/sbni/if_sbnivar.h#5 (text+ko) ====
==== //depot/projects/vimage/src/sys/geom/geom_io.c#6 (text+ko) ====
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/geom/geom_io.c,v 1.77 2007/12/16 18:03:31 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/geom/geom_io.c,v 1.78 2008/09/18 15:02:19 sbruno Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -582,7 +582,7 @@
g_bioq_unlock(&g_bio_run_up);
THREAD_NO_SLEEPING();
CTR4(KTR_GEOM, "g_up biodone bp %p provider %s off "
- "%ld len %ld", bp, bp->bio_to->name,
+ "%jd len %ld", bp, bp->bio_to->name,
bp->bio_offset, bp->bio_length);
biodone(bp);
THREAD_SLEEPING_OK();
==== //depot/projects/vimage/src/sys/i386/i386/identcpu.c#9 (text+ko) ====
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/i386/identcpu.c,v 1.185 2008/05/23 04:03:53 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/i386/identcpu.c,v 1.186 2008/09/17 20:45:18 jhb Exp $");
#include "opt_cpu.h"
@@ -719,7 +719,7 @@
"\020"
"\001SSE3" /* SSE3 */
"\002<b1>"
- "\003RSVD2" /* "Reserved" bit 2 */
+ "\003DTES64" /* 64-bit Debug Trace */
"\004MON" /* MONITOR/MWAIT Instructions */
"\005DS_CPL" /* CPL Qualified Debug Store */
"\006VMX" /* Virtual Machine Extensions */
@@ -736,11 +736,11 @@
"\021<b16>"
"\022<b17>"
"\023DCA" /* Direct Cache Access */
- "\024<b19>"
- "\025<b20>"
- "\026<b21>"
+ "\024SSE4.1"
+ "\025SSE4.2"
+ "\026x2APIC" /* xAPIC Extensions */
"\027<b22>"
- "\030<b23>"
+ "\030POPCNT"
"\031<b24>"
"\032<b25>"
"\033<b26>"
@@ -790,7 +790,7 @@
"\030<s23>" /* Same */
"\031<s24>" /* Same */
"\032FFXSR" /* Fast FXSAVE/FXRSTOR */
- "\033<b26>" /* Undefined */
+ "\033Page1GB" /* 1-GB large page support */
"\034RDTSCP" /* RDTSCP */
"\035<b28>" /* Undefined */
"\036LM" /* 64 bit long mode */
==== //depot/projects/vimage/src/sys/i386/i386/intr_machdep.c#8 (text+ko) ====
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/i386/i386/intr_machdep.c,v 1.36 2008/04/11 03:26:40 jeff Exp $
+ * $FreeBSD: src/sys/i386/i386/intr_machdep.c,v 1.37 2008/09/18 03:19:46 kmacy Exp $
*/
/*
@@ -458,6 +458,13 @@
struct intsrc *isrc;
int i;
+#ifdef XEN
+ /*
+ * Doesn't work yet
+ */
+ return;
+#endif
+
/* Don't bother on UP. */
if (mp_ncpus == 1)
return;
==== //depot/projects/vimage/src/sys/i386/include/specialreg.h#9 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* from: @(#)specialreg.h 7.1 (Berkeley) 5/9/91
- * $FreeBSD: src/sys/i386/include/specialreg.h,v 1.45 2008/08/08 16:26:53 stas Exp $
+ * $FreeBSD: src/sys/i386/include/specialreg.h,v 1.46 2008/09/17 20:45:18 jhb Exp $
*/
#ifndef _MACHINE_SPECIALREG_H_
@@ -110,6 +110,7 @@
#define CPUID_PBE 0x80000000
#define CPUID2_SSE3 0x00000001
+#define CPUID2_DTES64 0x00000004
#define CPUID2_MON 0x00000008
#define CPUID2_DS_CPL 0x00000010
#define CPUID2_VMX 0x00000020
@@ -122,6 +123,10 @@
#define CPUID2_XTPR 0x00004000
#define CPUID2_PDCM 0x00008000
#define CPUID2_DCA 0x00040000
+#define CPUID2_SSE41 0x00080000
+#define CPUID2_SSE42 0x00100000
+#define CPUID2_X2APIC 0x00200000
+#define CPUID2_POPCNT 0x00800000
/*
* Important bits in the AMD extended cpuid flags
@@ -131,6 +136,7 @@
#define AMDID_NX 0x00100000
#define AMDID_EXT_MMX 0x00400000
#define AMDID_FFXSR 0x01000000
+#define AMDID_PAGE1GB 0x04000000
#define AMDID_RDTSCP 0x08000000
#define AMDID_LM 0x20000000
#define AMDID_EXT_3DNOW 0x40000000
==== //depot/projects/vimage/src/sys/i386/xen/mp_machdep.c#2 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/xen/mp_machdep.c,v 1.1 2008/09/10 07:11:08 kmacy Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/xen/mp_machdep.c,v 1.3 2008/09/18 02:59:19 kmacy Exp $");
#include "opt_apic.h"
#include "opt_cpu.h"
@@ -439,6 +439,8 @@
while (smp_started == 0)
ia32_pause();
+
+ PCPU_SET(curthread, PCPU_GET(idlethread));
/* enter the scheduler */
sched_throw(NULL);
@@ -556,11 +558,11 @@
/* Get per-cpu data */
pc = &__pcpu[bootAP];
+ pcpu_init(pc, bootAP, sizeof(struct pcpu));
pc->pc_apic_id = cpu_apic_ids[bootAP];
pc->pc_prvspace = pc;
pc->pc_curthread = 0;
- pcpu_init(pc, bootAP, sizeof(struct pcpu));
gdt_segs[GPRIV_SEL].ssd_base = (int) pc;
gdt_segs[GPROC0_SEL].ssd_base = (int) &pc->pc_common_tss;
@@ -622,18 +624,19 @@
vm_page_t m[4];
static vcpu_guest_context_t ctxt;
vm_offset_t boot_stack;
- vm_paddr_t *va = (vm_paddr_t *)PTOV(IdlePDPT);
- vm_paddr_t ma[4];
+ vm_offset_t newPTD;
+ vm_paddr_t ma[NPGPTD];
static int color;
int i;
/*
- * Page 0: boot stack
- * Page 1: PDPT
- * Page 2-3: PTD{2-3]
+ * Page 0,[0-3] PTD
+ * Page 1, [4] boot stack
+ * Page [5] PDPT
+
*
*/
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < NPGPTD + 2; i++) {
m[i] = vm_page_alloc(NULL, color++,
VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED |
VM_ALLOC_ZERO);
@@ -641,45 +644,45 @@
pmap_zero_page(m[i]);
}
- boot_stack = kmem_alloc_nofault(kernel_map, 1);
+ boot_stack = kmem_alloc_nofault(kernel_map, 1);
+ newPTD = kmem_alloc_nofault(kernel_map, NPGPTD);
+ ma[0] = xpmap_ptom(VM_PAGE_TO_PHYS(m[0]))|PG_V;
- /*
- * Initialize new IdlePDPT with dedicated page
- * for upper 1GB
- */
- pmap_kenter(boot_stack, VM_PAGE_TO_PHYS(m[1]));
- for (i = 0; i < 4; i++) {
- ((vm_paddr_t *)boot_stack)[i] = va[i];
- ma[i] = va[i];
+#ifdef PAE
+ pmap_kenter(boot_stack, VM_PAGE_TO_PHYS(m[NPGPTD + 1]));
+ for (i = 0; i < NPGPTD; i++) {
+ ((vm_paddr_t *)boot_stack)[i] =
+ ma[i] =
+ xpmap_ptom(VM_PAGE_TO_PHYS(m[i]))|PG_V;
}
-
- ma[2] = ((vm_paddr_t *)boot_stack)[2] =
- xpmap_ptom(VM_PAGE_TO_PHYS(m[2]))|PG_V;
- ma[3] = ((vm_paddr_t *)boot_stack)[3] =
- xpmap_ptom(VM_PAGE_TO_PHYS(m[3]))|PG_V;
+#endif
/*
* Copy cpu0 IdlePTD to new IdlePTD - copying only
* kernel mappings
*/
- pmap_kenter(boot_stack, VM_PAGE_TO_PHYS(m[3]));
- memcpy((uint8_t *)boot_stack, (uint8_t *)PTOV(IdlePTD) + 3*PAGE_SIZE,
+ pmap_qenter(newPTD, m, 4);
+
+ memcpy((uint8_t *)newPTD + KPTDI*sizeof(vm_paddr_t),
+ (uint8_t *)PTOV(IdlePTD) + KPTDI*sizeof(vm_paddr_t),
nkpt*sizeof(vm_paddr_t));
-
+
+ pmap_qremove(newPTD, 4);
+ kmem_free(kernel_map, newPTD, 4);
/*
* map actual idle stack to boot_stack
*/
- pmap_kenter(boot_stack, VM_PAGE_TO_PHYS(m[0]));
+ pmap_kenter(boot_stack, VM_PAGE_TO_PHYS(m[NPGPTD]));
- printf("pinning pgdpt=%llx\n",
- xpmap_ptom(VM_PAGE_TO_PHYS(m[1])));
- xen_pgdpt_pin(xpmap_ptom(VM_PAGE_TO_PHYS(m[1])));
+ xen_pgdpt_pin(xpmap_ptom(VM_PAGE_TO_PHYS(m[NPGPTD + 1])));
vm_page_lock_queues();
for (i = 0; i < 4; i++) {
+ int pdir = (PTDPTDI + i) / NPDEPG;
+ int curoffset = (PTDPTDI + i) % NPDEPG;
+
xen_queue_pt_update((vm_paddr_t)
- ((ma[2] & ~PG_V) +
- (PTDPTDI - 1024 + i)*sizeof(vm_paddr_t)),
+ ((ma[pdir] & ~PG_V) + (curoffset*sizeof(vm_paddr_t))),
ma[i]);
}
PT_UPDATES_FLUSH();
@@ -715,12 +718,7 @@
ctxt.failsafe_callback_cs = GSEL(GCODE_SEL, SEL_KPL);
ctxt.failsafe_callback_eip = (unsigned long)failsafe_callback;
- ctxt.ctrlreg[3] =
-#if 1
- xpmap_ptom(VM_PAGE_TO_PHYS(m[1]));
-#else
- xpmap_ptom((unsigned long)IdlePDPT);
-#endif
+ ctxt.ctrlreg[3] = xpmap_ptom(VM_PAGE_TO_PHYS(m[NPGPTD + 1]));
#else /* __x86_64__ */
ctxt.user_regs.esp = idle->thread.rsp0 - sizeof(struct pt_regs);
ctxt.kernel_ss = GSEL(GDATA_SEL, SEL_KPL);
@@ -751,11 +749,12 @@
* of the different hardware we might encounter. It isn't pretty,
* but it seems to work.
*/
+
+int cpus;
static int
start_ap(int apic_id)
{
int ms;
- int cpus;
/* used as a watchpoint to signal AP startup */
cpus = mp_naps;
==== //depot/projects/vimage/src/sys/i386/xen/xen_machdep.c#6 (text+ko) ====
@@ -1,7 +1,7 @@
/*
*
* Copyright (c) 2004 Christian Limpach.
- * Copyright (c) 2004-2006 Kip Macy
+ * Copyright (c) 2004-2006,2008 Kip Macy
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/xen/xen_machdep.c,v 1.9 2008/09/10 07:11:08 kmacy Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/xen/xen_machdep.c,v 1.10 2008/09/17 19:11:37 kmacy Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -258,19 +258,26 @@
if (__predict_true(gdtset))
for (i = _xpq_idx; i > 0;) {
if (i >= 3) {
- CTR6(KTR_PMAP, "mmu:val: %lx ptr: %lx val: %lx ptr: %lx val: %lx ptr: %lx",
- (XPQ_QUEUE[i-1].val & 0xffffffff), (XPQ_QUEUE[i-1].ptr & 0xffffffff),
- (XPQ_QUEUE[i-2].val & 0xffffffff), (XPQ_QUEUE[i-2].ptr & 0xffffffff),
- (XPQ_QUEUE[i-3].val & 0xffffffff), (XPQ_QUEUE[i-3].ptr & 0xffffffff));
+ CTR6(KTR_PMAP, "mmu:val: %lx ptr: %lx val: %lx "
+ "ptr: %lx val: %lx ptr: %lx",
+ (XPQ_QUEUE[i-1].val & 0xffffffff),
+ (XPQ_QUEUE[i-1].ptr & 0xffffffff),
+ (XPQ_QUEUE[i-2].val & 0xffffffff),
+ (XPQ_QUEUE[i-2].ptr & 0xffffffff),
+ (XPQ_QUEUE[i-3].val & 0xffffffff),
+ (XPQ_QUEUE[i-3].ptr & 0xffffffff));
i -= 3;
} else if (i == 2) {
CTR4(KTR_PMAP, "mmu: val: %lx ptr: %lx val: %lx ptr: %lx",
- (XPQ_QUEUE[i-1].val & 0xffffffff), (XPQ_QUEUE[i-1].ptr & 0xffffffff),
- (XPQ_QUEUE[i-2].val & 0xffffffff), (XPQ_QUEUE[i-2].ptr & 0xffffffff));
+ (XPQ_QUEUE[i-1].val & 0xffffffff),
+ (XPQ_QUEUE[i-1].ptr & 0xffffffff),
+ (XPQ_QUEUE[i-2].val & 0xffffffff),
+ (XPQ_QUEUE[i-2].ptr & 0xffffffff));
i = 0;
} else {
CTR2(KTR_PMAP, "mmu: val: %lx ptr: %lx",
- (XPQ_QUEUE[i-1].val & 0xffffffff), (XPQ_QUEUE[i-1].ptr & 0xffffffff));
+ (XPQ_QUEUE[i-1].val & 0xffffffff),
+ (XPQ_QUEUE[i-1].ptr & 0xffffffff));
i = 0;
}
}
@@ -279,7 +286,8 @@
critical_exit();
if (__predict_false(error < 0)) {
for (i = 0; i < _xpq_idx; i++)
- printf("val: %llx ptr: %llx\n", XPQ_QUEUE[i].val, XPQ_QUEUE[i].ptr);
+ printf("val: %llx ptr: %llx\n",
+ XPQ_QUEUE[i].val, XPQ_QUEUE[i].ptr);
panic("Failed to execute MMU updates: %d", error);
}
@@ -389,8 +397,11 @@
if (__predict_true(gdtset))
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+ KASSERT((ptr & 7) == 0, ("misaligned update"));
+
if (__predict_true(gdtset))
critical_enter();
+
XPQ_QUEUE[XPQ_IDX].ptr = ((uint64_t)ptr) | MMU_NORMAL_PT_UPDATE;
XPQ_QUEUE[XPQ_IDX].val = (uint64_t)val;
#ifdef INVARIANTS
@@ -792,6 +803,10 @@
#endif /* ADD_ISA_HOLE */
extern unsigned long physfree;
+
+int pdir, curoffset;
+
+
void
initvalues(start_info_t *startinfo)
{
@@ -837,7 +852,9 @@
((xen_start_info->nr_pt_frames) + 3 )*PAGE_SIZE;
printk("initvalues(): wooh - availmem=%x,%x\n", avail_space, cur_space);
- printk("KERNBASE=%x,pt_base=%x, VTOPFN(base)=%x, nr_pt_frames=%x\n", KERNBASE,xen_start_info->pt_base, VTOPFN(xen_start_info->pt_base), xen_start_info->nr_pt_frames);
+ printk("KERNBASE=%x,pt_base=%x, VTOPFN(base)=%x, nr_pt_frames=%x\n",
+ KERNBASE,xen_start_info->pt_base, VTOPFN(xen_start_info->pt_base),
+ xen_start_info->nr_pt_frames);
xendebug_flags = 0; /* 0xffffffff; */
/* allocate 4 pages for bootmem allocator */
@@ -851,13 +868,13 @@
/*
* pre-zero unused mapped pages - mapped on 4MB boundary
*/
-/*
- bzero((char *)cur_space, (cur_space + 0x3fffff) % 0x400000);
- */
-
#ifdef PAE
IdlePDPT = (pd_entry_t *)startinfo->pt_base;
IdlePDPTma = xpmap_ptom(VTOP(startinfo->pt_base));
+ /*
+ * Note that only one page directory has been allocated at this point.
+ * Thus, if KERNBASE
+ */
IdlePTD = (pd_entry_t *)((uint8_t *)startinfo->pt_base + PAGE_SIZE);
IdlePTDma = xpmap_ptom(VTOP(IdlePTD));
l3_pages = 1;
@@ -931,14 +948,25 @@
PT_SET_MA(tmpva, (vm_paddr_t)0);
}
-#ifdef PAE
- offset = 0;
-#else
- offset = KPTDI;
-#endif
+ PT_UPDATES_FLUSH();
+
+ memcpy(((uint8_t *)IdlePTDnew) + ((unsigned int)(KERNBASE >> 18)),
+ ((uint8_t *)IdlePTD) + ((KERNBASE >> 18) & PAGE_MASK),
+ l1_pages*sizeof(pt_entry_t));
+
+ for (i = 0; i < 4; i++) {
+ PT_SET_MA((uint8_t *)IdlePTDnew + i*PAGE_SIZE,
+ IdlePTDnewma[i] | PG_V);
+ }
+ xen_load_cr3(VTOP(IdlePDPTnew));
+ xen_pgdpt_pin(xpmap_ptom(VTOP(IdlePDPTnew)));
/* allocate remainder of NKPT pages */
- for (i = l1_pages; i < NKPT; i++, cur_space += PAGE_SIZE) {
+ for (offset = (KERNBASE >> PDRSHIFT), i = l1_pages - 1; i < NKPT;
+ i++, cur_space += PAGE_SIZE) {
+ pdir = (offset + i) / NPDEPG;
+ curoffset = ((offset + i) % NPDEPG);
+
/*
* make sure that all the initial page table pages
* have been zeroed
@@ -947,31 +975,21 @@
bzero((char *)cur_space, PAGE_SIZE);
PT_SET_MA(cur_space, (vm_paddr_t)0);
xen_pt_pin(xpmap_ptom(VTOP(cur_space)));
- xen_queue_pt_update((vm_paddr_t)(IdlePTDma + (offset + i)*sizeof(vm_paddr_t)),
+ xen_queue_pt_update((vm_paddr_t)(IdlePTDnewma[pdir] +
+ curoffset*sizeof(vm_paddr_t)),
xpmap_ptom(VTOP(cur_space)) | PG_KERNEL);
+ PT_UPDATES_FLUSH();
}
- PT_UPDATES_FLUSH();
- memcpy((uint8_t *)IdlePTDnew + 3*PAGE_SIZE, IdlePTD, PAGE_SIZE/2);
- printk("do remapping\n");
for (i = 0; i < 4; i++) {
- PT_SET_MA((uint8_t *)IdlePTDnew + i*PAGE_SIZE,
- IdlePTDnewma[i] | PG_V);
- }
- xen_load_cr3(VTOP(IdlePDPTnew));
- xen_pgdpt_pin(xpmap_ptom(VTOP(IdlePDPTnew)));
+ pdir = (PTDPTDI + i) / NPDEPG;
+ curoffset = (PTDPTDI + i) % NPDEPG;
- for (i = 0; i < 4; i++) {
- xen_queue_pt_update((vm_paddr_t)(IdlePTDnewma[2] + (PTDPTDI - 1024 + i)*sizeof(vm_paddr_t)),
+ xen_queue_pt_update((vm_paddr_t)(IdlePTDnewma[pdir] +
+ curoffset*sizeof(vm_paddr_t)),
IdlePTDnewma[i] | PG_V);
}
- /* copy NKPT pages */
- for (i = 0; i < NKPT; i++) {
- xen_queue_pt_update(
- (vm_paddr_t)(IdlePTDnewma[3] + (i)*sizeof(vm_paddr_t)),
- IdlePTD[i]);
- }
PT_UPDATES_FLUSH();
IdlePTD = IdlePTDnew;
==== //depot/projects/vimage/src/sys/kern/kern_priv.c#5 (text+ko) ====
@@ -30,7 +30,7 @@
#include "opt_mac.h"
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_priv.c,v 1.5 2008/03/07 15:27:08 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_priv.c,v 1.6 2008/09/17 15:49:44 attilio Exp $");
#include <sys/param.h>
#include <sys/jail.h>
@@ -133,24 +133,3 @@
return (priv_check_cred(td->td_ucred, priv, 0));
}
-
-/*
- * Historical suser() wrapper functions, which now simply request PRIV_ROOT.
- * These will be removed in the near future, and exist solely because
- * the kernel and modules are not yet fully adapted to the new model.
- */
-int
-suser_cred(struct ucred *cred, int flags)
-{
-
- return (priv_check_cred(cred, PRIV_ROOT, flags));
-}
-
-int
-suser(struct thread *td)
-{
-
- KASSERT(td == curthread, ("suser: td != curthread"));
-
- return (suser_cred(td->td_ucred, 0));
-}
==== //depot/projects/vimage/src/sys/mips/malta/gt_pci.c#3 (text+ko) ====
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/mips/malta/gt_pci.c,v 1.2 2008/09/10 03:49:08 gonzo Exp $");
+__FBSDID("$FreeBSD: src/sys/mips/malta/gt_pci.c,v 1.3 2008/09/18 15:15:42 obrien Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -657,7 +657,7 @@
event = sc->sc_eventstab[irq];
if (event == NULL) {
- error = intr_event_create(&event, (void *)irq, 0,
+ error = intr_event_create(&event, (void *)irq, 0, 0,
(mask_fn)mips_mask_irq, (mask_fn)mips_unmask_irq,
(mask_fn)mips_unmask_irq, NULL, "gt_pci intr%d:", irq);
if (error)
==== //depot/projects/vimage/src/sys/mips/mips/intr_machdep.c#3 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/mips/mips/intr_machdep.c,v 1.2 2008/09/04 17:10:52 obrien Exp $");
+__FBSDID("$FreeBSD: src/sys/mips/mips/intr_machdep.c,v 1.3 2008/09/18 15:24:49 obrien Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -84,7 +84,7 @@
event = hardintr_events[irq];
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list