From owner-svn-src-user@FreeBSD.ORG Sun Jun 24 01:28:36 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E21001065676; Sun, 24 Jun 2012 01:28:36 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CCF148FC0A; Sun, 24 Jun 2012 01:28:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5O1SaRK076588; Sun, 24 Jun 2012 01:28:36 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5O1SaQn076586; Sun, 24 Jun 2012 01:28:36 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201206240128.q5O1SaQn076586@svn.freebsd.org> From: Attilio Rao Date: Sun, 24 Jun 2012 01:28:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237515 - user/attilio/vmcontention/sys/vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jun 2012 01:28:37 -0000 Author: attilio Date: Sun Jun 24 01:28:36 2012 New Revision: 237515 URL: http://svn.freebsd.org/changeset/base/237515 Log: Fix an inverted logic or. Reported by: pho Modified: user/attilio/vmcontention/sys/vm/vm_object.c Modified: user/attilio/vmcontention/sys/vm/vm_object.c ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_object.c Sun Jun 24 00:32:15 2012 (r237514) +++ user/attilio/vmcontention/sys/vm/vm_object.c Sun Jun 24 01:28:36 2012 (r237515) @@ -1506,7 +1506,7 @@ restart: if (i == n) { if (n < VM_RADIX_STACK) break; - if (exhausted != 0 && + if (exhausted != 0 || (n = vm_radix_lookupn(&backing_object->rtree, start, 0, color, (void **)pa, VM_RADIX_STACK, &start, &exhausted)) == 0) From owner-svn-src-user@FreeBSD.ORG Sun Jun 24 01:32:43 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA5C61065675; Sun, 24 Jun 2012 01:32:43 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E9118FC08; Sun, 24 Jun 2012 01:32:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5O1WhBu077047; Sun, 24 Jun 2012 01:32:43 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5O1WhiP077039; Sun, 24 Jun 2012 01:32:43 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201206240132.q5O1WhiP077039@svn.freebsd.org> From: Attilio Rao Date: Sun, 24 Jun 2012 01:32:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237516 - in user/attilio/vmcontention: share/man/man4 sys/amd64/amd64 sys/conf sys/dev/acpi_support sys/dev/agp sys/dev/cxgbe X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jun 2012 01:32:43 -0000 Author: attilio Date: Sun Jun 24 01:32:42 2012 New Revision: 237516 URL: http://svn.freebsd.org/changeset/base/237516 Log: MFC Modified: user/attilio/vmcontention/share/man/man4/acpi_ibm.4 user/attilio/vmcontention/sys/amd64/amd64/pmap.c user/attilio/vmcontention/sys/conf/files user/attilio/vmcontention/sys/dev/acpi_support/acpi_ibm.c user/attilio/vmcontention/sys/dev/agp/agp_i810.c user/attilio/vmcontention/sys/dev/cxgbe/t4_sge.c Directory Properties: user/attilio/vmcontention/ (props changed) user/attilio/vmcontention/share/man/man4/ (props changed) user/attilio/vmcontention/sys/ (props changed) user/attilio/vmcontention/sys/conf/ (props changed) Modified: user/attilio/vmcontention/share/man/man4/acpi_ibm.4 ============================================================================== --- user/attilio/vmcontention/share/man/man4/acpi_ibm.4 Sun Jun 24 01:28:36 2012 (r237515) +++ user/attilio/vmcontention/share/man/man4/acpi_ibm.4 Sun Jun 24 01:32:42 2012 (r237516) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 8, 2010 +.Dd June 24, 2012 .Dt ACPI_IBM 4 .Os .Sh NAME @@ -335,6 +335,17 @@ Built-in battery .It UltraBay battery .El +.It Va dev.acpi_ibm.0.handlerevents +.Xr devd 8 +events handled by +.Nm +when +.Va events +is set to 1. +Events are specified as a whitespace-separated list of event code in +hexadecimal or decimal form. +Note that the event maybe handled twice (eg. Brightness up/down) if ACPI BIOS +already handled the event. .El .Pp Defaults for these sysctls can be set in @@ -436,6 +447,19 @@ then fi exit 0 .Ed +.Pp +The following example specify that event code 0x04 (Suspend to RAM), +0x10 (Brightness up) and 0x11 (Brightness down) are handled by +.Nm . +.Bd -literal -offset indent +sysctl dev.acpi_ibm.0.handlerevents='0x04 0x10 0x11' +.Ed +.Pp +in +.Xr sysctl.conf 5 : +.Bd -literal -offset indent +dev.acpi_ibm.0.handlerevents=0x04\\ 0x10\\ 0x11 +.Ed .Sh SEE ALSO .Xr acpi 4 , .Xr led 4 , Modified: user/attilio/vmcontention/sys/amd64/amd64/pmap.c ============================================================================== --- user/attilio/vmcontention/sys/amd64/amd64/pmap.c Sun Jun 24 01:28:36 2012 (r237515) +++ user/attilio/vmcontention/sys/amd64/amd64/pmap.c Sun Jun 24 01:32:42 2012 (r237516) @@ -256,6 +256,8 @@ static caddr_t crashdumpmap; static void free_pv_chunk(struct pv_chunk *pc); static void free_pv_entry(pmap_t pmap, pv_entry_t pv); static pv_entry_t get_pv_entry(pmap_t pmap, boolean_t try); +static int popcnt_pc_map_elem(uint64_t elem); +static void reserve_pv_entry(pmap_t pmap, int needed); static void pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa); static boolean_t pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, struct rwlock **lockp); @@ -2394,6 +2396,85 @@ retry: } /* + * Returns the number of one bits within the given PV chunk map element. + */ +static int +popcnt_pc_map_elem(uint64_t elem) +{ + int count; + + /* + * This simple method of counting the one bits performs well because + * the given element typically contains more zero bits than one bits. + */ + count = 0; + for (; elem != 0; elem &= elem - 1) + count++; + return (count); +} + +/* + * Ensure that the number of spare PV entries in the specified pmap meets or + * exceeds the given count, "needed". + */ +static void +reserve_pv_entry(pmap_t pmap, int needed) +{ + struct pch new_tail; + struct pv_chunk *pc; + int avail, free; + vm_page_t m; + + rw_assert(&pvh_global_lock, RA_LOCKED); + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + + /* + * Newly allocated PV chunks must be stored in a private list until + * the required number of PV chunks have been allocated. Otherwise, + * pmap_pv_reclaim() could recycle one of these chunks. In contrast, + * these chunks must be added to the pmap upon allocation. + */ + TAILQ_INIT(&new_tail); +retry: + avail = 0; + TAILQ_FOREACH(pc, &pmap->pm_pvchunk, pc_list) { + free = popcnt_pc_map_elem(pc->pc_map[0]); + free += popcnt_pc_map_elem(pc->pc_map[1]); + free += popcnt_pc_map_elem(pc->pc_map[2]); + if (free == 0) + break; + avail += free; + if (avail >= needed) + break; + } + for (; avail < needed; avail += _NPCPV) { + m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | + VM_ALLOC_WIRED); + if (m == NULL) { + m = pmap_pv_reclaim(pmap); + if (m == NULL) + goto retry; + } + PV_STAT(atomic_add_int(&pc_chunk_count, 1)); + PV_STAT(atomic_add_int(&pc_chunk_allocs, 1)); + dump_add_page(m->phys_addr); + pc = (void *)PHYS_TO_DMAP(m->phys_addr); + pc->pc_pmap = pmap; + pc->pc_map[0] = PC_FREE0; + pc->pc_map[1] = PC_FREE1; + pc->pc_map[2] = PC_FREE2; + TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); + TAILQ_INSERT_TAIL(&new_tail, pc, pc_lru); + PV_STAT(atomic_add_int(&pv_entry_spare, _NPCPV)); + } + if (!TAILQ_EMPTY(&new_tail)) { + mtx_lock(&pv_chunks_mutex); + TAILQ_CONCAT(&pv_chunks, &new_tail, pc_lru); + mtx_unlock(&pv_chunks_mutex); + } +} + +/* * First find and then remove the pv entry for the specified pmap and virtual * address from the specified pv list. Returns the pv entry if found and NULL * otherwise. This operation can be performed on pv lists for either 4KB or @@ -2430,6 +2511,7 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse rw_assert(&pvh_global_lock, RA_WLOCKED); KASSERT((pa & PDRMASK) == 0, ("pmap_pv_demote_pde: pa is not 2mpage aligned")); + reserve_pv_entry(pmap, NPTEPG - 1); /* * Transfer the 2mpage's pv entry for this mapping to the first @@ -2448,7 +2530,7 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_pv_demote_pde: page %p is not managed", m)); va += PAGE_SIZE; - pv = get_pv_entry(pmap, FALSE); + pv = get_pv_entry(pmap, TRUE); pv->pv_va = va; TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next); } while (va < va_last); Modified: user/attilio/vmcontention/sys/conf/files ============================================================================== --- user/attilio/vmcontention/sys/conf/files Sun Jun 24 01:28:36 2012 (r237515) +++ user/attilio/vmcontention/sys/conf/files Sun Jun 24 01:32:42 2012 (r237516) @@ -161,9 +161,11 @@ cddl/compat/opensolaris/kern/opensolaris cddl/compat/opensolaris/kern/opensolaris_zone.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/acl/acl_common.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/avl/avl.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/common/nvpair/fnvpair.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/nvpair.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/nvpair_alloc_fixed.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/unicode/u8_textprep.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/common/zfs/zfeature_common.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/zfs/zfs_comutil.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/zfs/zfs_deleg.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/zfs/zfs_fletcher.c optional zfs compile-with "${ZFS_C}" @@ -177,6 +179,7 @@ cddl/contrib/opensolaris/uts/common/fs/v cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/bplist.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/ddt_zap.c optional zfs compile-with "${ZFS_C}" @@ -228,6 +231,7 @@ cddl/contrib/opensolaris/uts/common/fs/z cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zap_leaf.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c optional zfs compile-with "${ZFS_C}" Modified: user/attilio/vmcontention/sys/dev/acpi_support/acpi_ibm.c ============================================================================== --- user/attilio/vmcontention/sys/dev/acpi_support/acpi_ibm.c Sun Jun 24 01:28:36 2012 (r237515) +++ user/attilio/vmcontention/sys/dev/acpi_support/acpi_ibm.c Sun Jun 24 01:32:42 2012 (r237516) @@ -50,6 +50,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -70,6 +72,7 @@ ACPI_MODULE_NAME("IBM") #define ACPI_IBM_METHOD_FANLEVEL 11 #define ACPI_IBM_METHOD_FANSTATUS 12 #define ACPI_IBM_METHOD_THERMAL 13 +#define ACPI_IBM_METHOD_HANDLEREVENTS 14 /* Hotkeys/Buttons */ #define IBM_RTC_HOTKEY1 0x64 @@ -126,6 +129,21 @@ ACPI_MODULE_NAME("IBM") #define IBM_NAME_EVENTS_GET "MHKP" #define IBM_NAME_EVENTS_AVAILMASK "MHKA" +/* Event Code */ +#define IBM_EVENT_LCD_BACKLIGHT 0x03 +#define IBM_EVENT_SUSPEND_TO_RAM 0x04 +#define IBM_EVENT_BLUETOOTH 0x05 +#define IBM_EVENT_SCREEN_EXPAND 0x07 +#define IBM_EVENT_SUSPEND_TO_DISK 0x0c +#define IBM_EVENT_BRIGHTNESS_UP 0x10 +#define IBM_EVENT_BRIGHTNESS_DOWN 0x11 +#define IBM_EVENT_THINKLIGHT 0x12 +#define IBM_EVENT_ZOOM 0x14 +#define IBM_EVENT_VOLUME_UP 0x15 +#define IBM_EVENT_VOLUME_DOWN 0x16 +#define IBM_EVENT_MUTE 0x17 +#define IBM_EVENT_ACCESS_IBM_BUTTON 0x18 + #define ABS(x) (((x) < 0)? -(x) : (x)) struct acpi_ibm_softc { @@ -164,6 +182,8 @@ struct acpi_ibm_softc { int events_mask_supported; int events_enable; + unsigned int handler_events; + struct sysctl_ctx_list *sysctl_ctx; struct sysctl_oid *sysctl_tree; }; @@ -267,8 +287,15 @@ static int acpi_ibm_sysctl_set(struct ac static int acpi_ibm_eventmask_set(struct acpi_ibm_softc *sc, int val); static int acpi_ibm_thermal_sysctl(SYSCTL_HANDLER_ARGS); +static int acpi_ibm_handlerevents_sysctl(SYSCTL_HANDLER_ARGS); static void acpi_ibm_notify(ACPI_HANDLE h, UINT32 notify, void *context); +static int acpi_ibm_brightness_set(struct acpi_ibm_softc *sc, int arg); +static int acpi_ibm_bluetooth_set(struct acpi_ibm_softc *sc, int arg); +static int acpi_ibm_thinklight_set(struct acpi_ibm_softc *sc, int arg); +static int acpi_ibm_volume_set(struct acpi_ibm_softc *sc, int arg); +static int acpi_ibm_mute_set(struct acpi_ibm_softc *sc, int arg); + static device_method_t acpi_ibm_methods[] = { /* Device interface */ DEVMETHOD(device_probe, acpi_ibm_probe), @@ -404,6 +431,15 @@ acpi_ibm_attach(device_t dev) "Thermal zones"); } + /* Hook up handlerevents node */ + if (acpi_ibm_sysctl_init(sc, ACPI_IBM_METHOD_HANDLEREVENTS)) { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + "handlerevents", CTLTYPE_STRING | CTLFLAG_RW, + sc, 0, acpi_ibm_handlerevents_sysctl, "I", + "devd(8) events handled by acpi_ibm"); + } + /* Handle notifies */ AcpiInstallNotifyHandler(sc->handle, ACPI_DEVICE_NOTIFY, acpi_ibm_notify, dev); @@ -656,10 +692,8 @@ acpi_ibm_sysctl_get(struct acpi_ibm_soft static int acpi_ibm_sysctl_set(struct acpi_ibm_softc *sc, int method, int arg) { - int val, step; + int val; UINT64 val_ec; - ACPI_OBJECT Arg; - ACPI_OBJECT_LIST Args; ACPI_STATUS status; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -683,101 +717,23 @@ acpi_ibm_sysctl_set(struct acpi_ibm_soft break; case ACPI_IBM_METHOD_BRIGHTNESS: - if (arg < 0 || arg > 7) - return (EINVAL); - - if (sc->cmos_handle) { - /* Read the current brightness */ - status = ACPI_EC_READ(sc->ec_dev, IBM_EC_BRIGHTNESS, &val_ec, 1); - if (ACPI_FAILURE(status)) - return (status); - val = val_ec & IBM_EC_MASK_BRI; - - Args.Count = 1; - Args.Pointer = &Arg; - Arg.Type = ACPI_TYPE_INTEGER; - Arg.Integer.Value = (arg > val) ? IBM_CMOS_BRIGHTNESS_UP : IBM_CMOS_BRIGHTNESS_DOWN; - - step = (arg > val) ? 1 : -1; - for (int i = val; i != arg; i += step) { - status = AcpiEvaluateObject(sc->cmos_handle, NULL, &Args, NULL); - if (ACPI_FAILURE(status)) - break; - } - } - return ACPI_EC_WRITE(sc->ec_dev, IBM_EC_BRIGHTNESS, arg, 1); + return acpi_ibm_brightness_set(sc, arg); break; case ACPI_IBM_METHOD_VOLUME: - if (arg < 0 || arg > 14) - return (EINVAL); - - status = ACPI_EC_READ(sc->ec_dev, IBM_EC_VOLUME, &val_ec, 1); - if (ACPI_FAILURE(status)) - return (status); - - if (sc->cmos_handle) { - val = val_ec & IBM_EC_MASK_VOL; - - Args.Count = 1; - Args.Pointer = &Arg; - Arg.Type = ACPI_TYPE_INTEGER; - Arg.Integer.Value = (arg > val) ? IBM_CMOS_VOLUME_UP : IBM_CMOS_VOLUME_DOWN; - - step = (arg > val) ? 1 : -1; - for (int i = val; i != arg; i += step) { - status = AcpiEvaluateObject(sc->cmos_handle, NULL, &Args, NULL); - if (ACPI_FAILURE(status)) - break; - } - } - return ACPI_EC_WRITE(sc->ec_dev, IBM_EC_VOLUME, arg + (val_ec & (~IBM_EC_MASK_VOL)), 1); + return acpi_ibm_volume_set(sc, arg); break; case ACPI_IBM_METHOD_MUTE: - if (arg < 0 || arg > 1) - return (EINVAL); - - status = ACPI_EC_READ(sc->ec_dev, IBM_EC_VOLUME, &val_ec, 1); - if (ACPI_FAILURE(status)) - return (status); - - if (sc->cmos_handle) { - Args.Count = 1; - Args.Pointer = &Arg; - Arg.Type = ACPI_TYPE_INTEGER; - Arg.Integer.Value = IBM_CMOS_VOLUME_MUTE; - - status = AcpiEvaluateObject(sc->cmos_handle, NULL, &Args, NULL); - if (ACPI_FAILURE(status)) - break; - } - return ACPI_EC_WRITE(sc->ec_dev, IBM_EC_VOLUME, (arg==1) ? val_ec | IBM_EC_MASK_MUTE : val_ec & (~IBM_EC_MASK_MUTE), 1); + return acpi_ibm_mute_set(sc, arg); break; case ACPI_IBM_METHOD_THINKLIGHT: - if (arg < 0 || arg > 1) - return (EINVAL); - - if (sc->light_set_supported) { - Args.Count = 1; - Args.Pointer = &Arg; - Arg.Type = ACPI_TYPE_INTEGER; - Arg.Integer.Value = arg ? sc->light_cmd_on : sc->light_cmd_off; - - status = AcpiEvaluateObject(sc->light_handle, NULL, &Args, NULL); - if (ACPI_SUCCESS(status)) - sc->light_val = arg; - return (status); - } + return acpi_ibm_thinklight_set(sc, arg); break; case ACPI_IBM_METHOD_BLUETOOTH: - if (arg < 0 || arg > 1) - return (EINVAL); - - val = (arg == 1) ? sc->wlan_bt_flags | IBM_NAME_MASK_BT : sc->wlan_bt_flags & (~IBM_NAME_MASK_BT); - return acpi_SetInteger(sc->handle, IBM_NAME_WLAN_BT_SET, val); + return acpi_ibm_bluetooth_set(sc, arg); break; case ACPI_IBM_METHOD_FANLEVEL: @@ -898,6 +854,9 @@ acpi_ibm_sysctl_init(struct acpi_ibm_sof return (TRUE); } return (FALSE); + + case ACPI_IBM_METHOD_HANDLEREVENTS: + return (TRUE); } return (FALSE); } @@ -937,6 +896,328 @@ acpi_ibm_thermal_sysctl(SYSCTL_HANDLER_A return (error); } +static int +acpi_ibm_handlerevents_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct acpi_ibm_softc *sc; + int error = 0; + struct sbuf sb; + char *cp, *ep; + int l, val; + unsigned int handler_events; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + + sc = (struct acpi_ibm_softc *)oidp->oid_arg1; + + if (sbuf_new(&sb, NULL, 128, SBUF_AUTOEXTEND) == NULL) + return (ENOMEM); + + ACPI_SERIAL_BEGIN(ibm); + + /* Get old values if this is a get request. */ + if (req->newptr == NULL) { + for (int i = 0; i < 8 * sizeof(sc->handler_events); i++) + if (sc->handler_events & (1 << i)) + sbuf_printf(&sb, "0x%02x ", i + 1); + if (sbuf_len(&sb) == 0) + sbuf_printf(&sb, "NONE"); + } + + sbuf_trim(&sb); + sbuf_finish(&sb); + + /* Copy out the old values to the user. */ + error = SYSCTL_OUT(req, sbuf_data(&sb), sbuf_len(&sb)); + sbuf_delete(&sb); + + if (error != 0 || req->newptr == NULL) + goto out; + + /* If the user is setting a string, parse it. */ + handler_events = 0; + cp = (char *)req->newptr; + while (*cp) { + if (isspace(*cp)) { + cp++; + continue; + } + + ep = cp; + + while (*ep && !isspace(*ep)) + ep++; + + l = ep - cp; + if (l == 0) + break; + + if (strncmp(cp, "NONE", 4) == 0) { + cp = ep; + continue; + } + + if (l >= 3 && cp[0] == '0' && (cp[1] == 'X' || cp[1] == 'x')) + val = strtoul(cp, &ep, 16); + else + val = strtoul(cp, &ep, 10); + + if (val == 0 || ep == cp || val >= 8 * sizeof(handler_events)) { + cp[l] = '\0'; + device_printf(sc->dev, "invalid event code: %s\n", cp); + error = EINVAL; + goto out; + } + + handler_events |= 1 << (val - 1); + + cp = ep; + } + + sc->handler_events = handler_events; +out: + ACPI_SERIAL_END(ibm); + return (error); +} + +static int +acpi_ibm_brightness_set(struct acpi_ibm_softc *sc, int arg) +{ + int val, step; + UINT64 val_ec; + ACPI_OBJECT Arg; + ACPI_OBJECT_LIST Args; + ACPI_STATUS status; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + ACPI_SERIAL_ASSERT(ibm); + + if (arg < 0 || arg > 7) + return (EINVAL); + + /* Read the current brightness */ + status = ACPI_EC_READ(sc->ec_dev, IBM_EC_BRIGHTNESS, &val_ec, 1); + if (ACPI_FAILURE(status)) + return (status); + + if (sc->cmos_handle) { + val = val_ec & IBM_EC_MASK_BRI; + + Args.Count = 1; + Args.Pointer = &Arg; + Arg.Type = ACPI_TYPE_INTEGER; + Arg.Integer.Value = (arg > val) ? IBM_CMOS_BRIGHTNESS_UP : + IBM_CMOS_BRIGHTNESS_DOWN; + + step = (arg > val) ? 1 : -1; + for (int i = val; i != arg; i += step) { + status = AcpiEvaluateObject(sc->cmos_handle, NULL, + &Args, NULL); + if (ACPI_FAILURE(status)) { + /* Record the last value */ + if (i != val) { + ACPI_EC_WRITE(sc->ec_dev, + IBM_EC_BRIGHTNESS, i - step, 1); + } + return (status); + } + } + } + + return ACPI_EC_WRITE(sc->ec_dev, IBM_EC_BRIGHTNESS, arg, 1); +} + +static int +acpi_ibm_bluetooth_set(struct acpi_ibm_softc *sc, int arg) +{ + int val; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + ACPI_SERIAL_ASSERT(ibm); + + if (arg < 0 || arg > 1) + return (EINVAL); + + val = (arg == 1) ? sc->wlan_bt_flags | IBM_NAME_MASK_BT : + sc->wlan_bt_flags & (~IBM_NAME_MASK_BT); + return acpi_SetInteger(sc->handle, IBM_NAME_WLAN_BT_SET, val); +} + +static int +acpi_ibm_thinklight_set(struct acpi_ibm_softc *sc, int arg) +{ + ACPI_OBJECT Arg; + ACPI_OBJECT_LIST Args; + ACPI_STATUS status; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + ACPI_SERIAL_ASSERT(ibm); + + if (arg < 0 || arg > 1) + return (EINVAL); + + if (sc->light_set_supported) { + Args.Count = 1; + Args.Pointer = &Arg; + Arg.Type = ACPI_TYPE_INTEGER; + Arg.Integer.Value = arg ? sc->light_cmd_on : sc->light_cmd_off; + + status = AcpiEvaluateObject(sc->light_handle, NULL, + &Args, NULL); + if (ACPI_SUCCESS(status)) + sc->light_val = arg; + return (status); + } + + return (0); +} + +static int +acpi_ibm_volume_set(struct acpi_ibm_softc *sc, int arg) +{ + int val, step; + UINT64 val_ec; + ACPI_OBJECT Arg; + ACPI_OBJECT_LIST Args; + ACPI_STATUS status; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + ACPI_SERIAL_ASSERT(ibm); + + if (arg < 0 || arg > 14) + return (EINVAL); + + /* Read the current volume */ + status = ACPI_EC_READ(sc->ec_dev, IBM_EC_VOLUME, &val_ec, 1); + if (ACPI_FAILURE(status)) + return (status); + + if (sc->cmos_handle) { + val = val_ec & IBM_EC_MASK_VOL; + + Args.Count = 1; + Args.Pointer = &Arg; + Arg.Type = ACPI_TYPE_INTEGER; + Arg.Integer.Value = (arg > val) ? IBM_CMOS_VOLUME_UP : + IBM_CMOS_VOLUME_DOWN; + + step = (arg > val) ? 1 : -1; + for (int i = val; i != arg; i += step) { + status = AcpiEvaluateObject(sc->cmos_handle, NULL, + &Args, NULL); + if (ACPI_FAILURE(status)) { + /* Record the last value */ + if (i != val) { + val_ec = i - step + + (val_ec & (~IBM_EC_MASK_VOL)); + ACPI_EC_WRITE(sc->ec_dev, IBM_EC_VOLUME, + val_ec, 1); + } + return (status); + } + } + } + + val_ec = arg + (val_ec & (~IBM_EC_MASK_VOL)); + return ACPI_EC_WRITE(sc->ec_dev, IBM_EC_VOLUME, val_ec, 1); +} + +static int +acpi_ibm_mute_set(struct acpi_ibm_softc *sc, int arg) +{ + UINT64 val_ec; + ACPI_OBJECT Arg; + ACPI_OBJECT_LIST Args; + ACPI_STATUS status; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + ACPI_SERIAL_ASSERT(ibm); + + if (arg < 0 || arg > 1) + return (EINVAL); + + status = ACPI_EC_READ(sc->ec_dev, IBM_EC_VOLUME, &val_ec, 1); + if (ACPI_FAILURE(status)) + return (status); + + if (sc->cmos_handle) { + Args.Count = 1; + Args.Pointer = &Arg; + Arg.Type = ACPI_TYPE_INTEGER; + Arg.Integer.Value = IBM_CMOS_VOLUME_MUTE; + + status = AcpiEvaluateObject(sc->cmos_handle, NULL, &Args, NULL); + if (ACPI_FAILURE(status)) + return (status); + } + + val_ec = (arg == 1) ? val_ec | IBM_EC_MASK_MUTE : + val_ec & (~IBM_EC_MASK_MUTE); + return ACPI_EC_WRITE(sc->ec_dev, IBM_EC_VOLUME, val_ec, 1); +} + +static void +acpi_ibm_eventhandler(struct acpi_ibm_softc *sc, int arg) +{ + int val; + UINT64 val_ec; + ACPI_STATUS status; + + ACPI_SERIAL_BEGIN(ibm); + switch (arg) { + case IBM_EVENT_SUSPEND_TO_RAM: + power_pm_suspend(POWER_SLEEP_STATE_SUSPEND); + break; + + case IBM_EVENT_BLUETOOTH: + acpi_ibm_bluetooth_set(sc, (sc->wlan_bt_flags == 0)); + break; + + case IBM_EVENT_BRIGHTNESS_UP: + case IBM_EVENT_BRIGHTNESS_DOWN: + /* Read the current brightness */ + status = ACPI_EC_READ(sc->ec_dev, IBM_EC_BRIGHTNESS, + &val_ec, 1); + if (ACPI_FAILURE(status)) + return; + + val = val_ec & IBM_EC_MASK_BRI; + val = (arg == IBM_EVENT_BRIGHTNESS_UP) ? val + 1 : val - 1; + acpi_ibm_brightness_set(sc, val); + break; + + case IBM_EVENT_THINKLIGHT: + acpi_ibm_thinklight_set(sc, (sc->light_val == 0)); + break; + + case IBM_EVENT_VOLUME_UP: + case IBM_EVENT_VOLUME_DOWN: + /* Read the current volume */ + status = ACPI_EC_READ(sc->ec_dev, IBM_EC_VOLUME, &val_ec, 1); + if (ACPI_FAILURE(status)) + return; + + val = val_ec & IBM_EC_MASK_VOL; + val = (arg == IBM_EVENT_VOLUME_UP) ? val + 1 : val - 1; + acpi_ibm_volume_set(sc, val); + break; + + case IBM_EVENT_MUTE: + /* Read the current value */ + status = ACPI_EC_READ(sc->ec_dev, IBM_EC_VOLUME, &val_ec, 1); + if (ACPI_FAILURE(status)) + return; + + val = ((val_ec & IBM_EC_MASK_MUTE) == IBM_EC_MASK_MUTE); + acpi_ibm_mute_set(sc, (val == 0)); + break; + + default: + break; + } + ACPI_SERIAL_END(ibm); +} + static void acpi_ibm_notify(ACPI_HANDLE h, UINT32 notify, void *context) { @@ -965,6 +1246,10 @@ acpi_ibm_notify(ACPI_HANDLE h, UINT32 no break; } + /* Execute event handler */ + if (sc->handler_events & (1 << (arg - 1))) + acpi_ibm_eventhandler(sc, (arg & 0xff)); + /* Notify devd(8) */ acpi_UserNotify("IBM", h, (arg & 0xff)); break; Modified: user/attilio/vmcontention/sys/dev/agp/agp_i810.c ============================================================================== --- user/attilio/vmcontention/sys/dev/agp/agp_i810.c Sun Jun 24 01:28:36 2012 (r237515) +++ user/attilio/vmcontention/sys/dev/agp/agp_i810.c Sun Jun 24 01:32:42 2012 (r237516) @@ -700,7 +700,7 @@ static const struct agp_i810_match { .driver = &agp_i810_sb_driver }, { - .devid = 0x01088086, + .devid = 0x010a8086, .name = "SandyBridge server IG", .driver = &agp_i810_sb_driver }, Modified: user/attilio/vmcontention/sys/dev/cxgbe/t4_sge.c ============================================================================== --- user/attilio/vmcontention/sys/dev/cxgbe/t4_sge.c Sun Jun 24 01:28:36 2012 (r237515) +++ user/attilio/vmcontention/sys/dev/cxgbe/t4_sge.c Sun Jun 24 01:32:42 2012 (r237516) @@ -70,12 +70,8 @@ enum { FL_PKTSHIFT = 2 }; -#define FL_ALIGN min(CACHE_LINE_SIZE, 32) -#if CACHE_LINE_SIZE > 64 -#define SPG_LEN 128 -#else -#define SPG_LEN 64 -#endif +static int fl_pad = CACHE_LINE_SIZE; +static int spg_len = 64; /* Used to track coalesced tx work request */ struct txpkts { @@ -167,6 +163,10 @@ static int handle_fw_rpl(struct sge_iq * static int sysctl_uint16(SYSCTL_HANDLER_ARGS); +#if defined(__i386__) || defined(__amd64__) +extern u_int cpu_clflush_line_size; +#endif + /* * Called on MOD_LOAD and fills up fl_buf_info[]. */ @@ -188,6 +188,11 @@ t4_sge_modload(void) FL_BUF_TYPE(i) = m_gettype(bufsize[i]); FL_BUF_ZONE(i) = m_getzone(bufsize[i]); } + +#if defined(__i386__) || defined(__amd64__) + fl_pad = max(cpu_clflush_line_size, 32); + spg_len = cpu_clflush_line_size > 64 ? 128 : 64; +#endif } /** @@ -209,8 +214,8 @@ t4_sge_init(struct adapter *sc) V_INGPADBOUNDARY(M_INGPADBOUNDARY) | F_EGRSTATUSPAGESIZE; ctrl_val = V_PKTSHIFT(FL_PKTSHIFT) | F_RXPKTCPLMODE | - V_INGPADBOUNDARY(ilog2(FL_ALIGN) - 5) | - V_EGRSTATUSPAGESIZE(SPG_LEN == 128); + V_INGPADBOUNDARY(ilog2(fl_pad) - 5) | + V_EGRSTATUSPAGESIZE(spg_len == 128); hpsize = V_HOSTPAGESIZEPF0(PAGE_SHIFT - 10) | V_HOSTPAGESIZEPF1(PAGE_SHIFT - 10) | @@ -1372,8 +1377,8 @@ t4_update_fl_bufsize(struct ifnet *ifp) int i, bufsize; /* large enough for a frame even when VLAN extraction is disabled */ - bufsize = FL_PKTSHIFT + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + - ifp->if_mtu; + bufsize = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ifp->if_mtu; + bufsize = roundup(bufsize + FL_PKTSHIFT, fl_pad); for_each_rxq(pi, i, rxq) { fl = &rxq->fl; @@ -1570,7 +1575,7 @@ alloc_iq_fl(struct port_info *pi, struct return (rc); /* Allocate space for one software descriptor per buffer. */ - fl->cap = (fl->qsize - SPG_LEN / RX_FL_ESIZE) * 8; + fl->cap = (fl->qsize - spg_len / RX_FL_ESIZE) * 8; FL_LOCK(fl); rc = alloc_fl_sdesc(fl); FL_UNLOCK(fl); @@ -2070,7 +2075,7 @@ alloc_eq(struct adapter *sc, struct port if (rc) return (rc); - eq->cap = eq->qsize - SPG_LEN / EQ_ESIZE; + eq->cap = eq->qsize - spg_len / EQ_ESIZE; eq->spg = (void *)&eq->desc[eq->cap]; eq->avail = eq->cap - 1; /* one less to avoid cidx = pidx */ eq->pidx = eq->cidx = 0; From owner-svn-src-user@FreeBSD.ORG Sun Jun 24 06:00:29 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CDE1E106564A; Sun, 24 Jun 2012 06:00:29 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA5128FC08; Sun, 24 Jun 2012 06:00:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5O60T56090786; Sun, 24 Jun 2012 06:00:29 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5O60TmJ090784; Sun, 24 Jun 2012 06:00:29 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206240600.q5O60TmJ090784@svn.freebsd.org> From: Adrian Chadd Date: Sun, 24 Jun 2012 06:00:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237520 - user/adrian/ath_radar_stuff/lib/libradarpkt X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jun 2012 06:00:29 -0000 Author: adrian Date: Sun Jun 24 06:00:29 2012 New Revision: 237520 URL: http://svn.freebsd.org/changeset/base/237520 Log: Use the "right" RSSI for AR9280, so the RSSI value is positive rather than the radiotap generated signal level. Modified: user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c Modified: user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c ============================================================================== --- user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c Sun Jun 24 05:59:32 2012 (r237519) +++ user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c Sun Jun 24 06:00:29 2012 (r237520) @@ -65,7 +65,7 @@ ar9280_radar_decode(struct ieee80211_rad * XXX which rssi should we use? * XXX ext rssi? */ - comb_rssi = rx->wr_antsignal; + comb_rssi = rx->wr_v.vh_rssi; /* Combined RSSI */ pri_rssi = rx->wr_v.rssi_ctl[0]; ext_rssi = rx->wr_v.rssi_ext[0]; nf = rx->wr_antnoise; @@ -76,6 +76,15 @@ ar9280_radar_decode(struct ieee80211_rad return (0); } + /* + * XXX TODO: there's lots of other things that need to be + * done with the RSSI and pulse durations. It's quite likely + * that the pkt format should just have all of those + * (pri/ext/comb RSSI, flags, pri/ext pulse duration) and then + * the "decided" values to match the logic in the current + * HAL/DFS code, so they can all be plotted as appropriate. + */ + #if 0 printf("tsf: %lld", tsf); printf(" len: %d", len); @@ -91,10 +100,10 @@ ar9280_radar_decode(struct ieee80211_rad #endif re->re_timestamp = tsf; - re->re_rssi = comb_rssi; /* XXX extension rssi? */ + re->re_rssi = pri_rssi; /* XXX extension rssi? */ re->re_dur = pkt[len - 3]; /* XXX extension duration? */ + re->re_freq = 0; /* XXX flags? */ - /* XXX freq? */ return(1); } From owner-svn-src-user@FreeBSD.ORG Sun Jun 24 07:10:34 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB1FB10656DC; Sun, 24 Jun 2012 07:10:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C5A1C8FC1F; Sun, 24 Jun 2012 07:10:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5O7AYf6093980; Sun, 24 Jun 2012 07:10:34 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5O7AY4U093973; Sun, 24 Jun 2012 07:10:34 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206240710.q5O7AY4U093973@svn.freebsd.org> From: Adrian Chadd Date: Sun, 24 Jun 2012 07:10:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237524 - in user/adrian/ath_radar_stuff: lib/libradarpkt src/pktlog src/qt-hpktlog src/qt-pktlog X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jun 2012 07:10:35 -0000 Author: adrian Date: Sun Jun 24 07:10:34 2012 New Revision: 237524 URL: http://svn.freebsd.org/changeset/base/237524 Log: Now that the ptach is in -HEAD, we need to define -DATH_ENABLE_RADIOTAP_VENDOR_EXT or the radiotap vendor extensions won't show up. It's dirty, but unfortunately that's how it has to be at the present moment. Modified: user/adrian/ath_radar_stuff/lib/libradarpkt/Makefile user/adrian/ath_radar_stuff/src/pktlog/Makefile user/adrian/ath_radar_stuff/src/qt-hpktlog/Makefile user/adrian/ath_radar_stuff/src/qt-hpktlog/qt-hpktlog.pro user/adrian/ath_radar_stuff/src/qt-pktlog/Makefile user/adrian/ath_radar_stuff/src/qt-pktlog/qt-pktlog.pro Modified: user/adrian/ath_radar_stuff/lib/libradarpkt/Makefile ============================================================================== --- user/adrian/ath_radar_stuff/lib/libradarpkt/Makefile Sun Jun 24 07:03:22 2012 (r237523) +++ user/adrian/ath_radar_stuff/lib/libradarpkt/Makefile Sun Jun 24 07:10:34 2012 (r237524) @@ -1,7 +1,13 @@ LIB= radarpkt SRCS= ar9280_radar.c ar5416_radar.c -CFLAGS+= -I/home/adrian/work/freebsd/ath/head/src/sys -g -ggdb + +# Define 'ATH_ENABLE_RADIOTAP_VENDOR_EXT' as it's not enabled by default +# in the configuration file. Ideally this would just fake an "opt_ath.h" +# and include it, but I digress.. + +CFLAGS+= -I/home/adrian/work/freebsd/ath/head/src/sys -g -ggdb \ + -DATH_ENABLE_RADIOTAP_VENDOR_EXT -g -ggdb NO_MAN= 1 Modified: user/adrian/ath_radar_stuff/src/pktlog/Makefile ============================================================================== --- user/adrian/ath_radar_stuff/src/pktlog/Makefile Sun Jun 24 07:03:22 2012 (r237523) +++ user/adrian/ath_radar_stuff/src/pktlog/Makefile Sun Jun 24 07:10:34 2012 (r237524) @@ -4,7 +4,8 @@ X_INCS= -I../../lib/ X_LIBS= -L../../lib/libradarpkt/ SRCS= main.c -CFLAGS+= -I/home/adrian/work/freebsd/ath/head/src/sys $(X_INCS) -g -ggdb +CFLAGS+= -I/home/adrian/work/freebsd/ath/head/src/sys $(X_INCS) -g -ggdb \ + -DATH_ENABLE_RADIOTAP_VENDOR_EXT LDADD+= $(X_LIBS) -lpcap -lradarpkt NO_MAN= 1 Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/Makefile ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-hpktlog/Makefile Sun Jun 24 07:03:22 2012 (r237523) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/Makefile Sun Jun 24 07:10:34 2012 (r237524) @@ -1,6 +1,6 @@ ############################################################################# # Makefile for building: qt-hpktlog -# Generated by qmake (2.01a) (Qt 4.7.4) on: Fri Jun 22 14:06:40 2012 +# Generated by qmake (2.01a) (Qt 4.7.4) on: Sun Jun 24 00:10:19 2012 # Project: qt-hpktlog.pro # Template: app # Command: /usr/local/bin/qmake-qt4 -o Makefile qt-hpktlog.pro @@ -11,8 +11,8 @@ CC = gcc CXX = g++ DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -CFLAGS = -pipe -O2 -Wall -W $(DEFINES) -CXXFLAGS = -pipe -O2 -Wall -W $(DEFINES) +CFLAGS = -g -ggdb -DATH_ENABLE_RADIOTAP_VENDOR_EXT -O2 -Wall -W $(DEFINES) +CXXFLAGS = -g -ggdb -DATH_ENABLE_RADIOTAP_VENDOR_EXT -O2 -Wall -W $(DEFINES) INCPATH = -I/usr/local/share/qt4/mkspecs/freebsd-g++ -I. -I/usr/local/include/qt4/QtCore -I/usr/local/include/qt4/QtGui -I/usr/local/include/qt4 -I. -I../../lib -I/usr/local/include/qt4 -I/usr/local/include/qwt6 -I. -I/usr/local/include/qt4 -I/usr/local/include LINK = g++ LFLAGS = -Wl,-O1 -pthread -Wl,-rpath,/usr/local/lib/qt4 Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/qt-hpktlog.pro ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-hpktlog/qt-hpktlog.pro Sun Jun 24 07:03:22 2012 (r237523) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/qt-hpktlog.pro Sun Jun 24 07:10:34 2012 (r237524) @@ -8,6 +8,9 @@ DEPENDPATH += . INCLUDEPATH += . ../../lib/ /usr/local/include/qt4 /usr/local/include/qwt6 LIBS+= -L../../lib/libradarpkt -lpcap -lradarpkt -lqwt6 +QMAKE_CFLAGS= -g -ggdb -DATH_ENABLE_RADIOTAP_VENDOR_EXT +QMAKE_CXXFLAGS= -g -ggdb -DATH_ENABLE_RADIOTAP_VENDOR_EXT + # Input HEADERS += MainApp.h PktSource.h # FORMS += PlotWindow.ui MainWindow.ui Modified: user/adrian/ath_radar_stuff/src/qt-pktlog/Makefile ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-pktlog/Makefile Sun Jun 24 07:03:22 2012 (r237523) +++ user/adrian/ath_radar_stuff/src/qt-pktlog/Makefile Sun Jun 24 07:10:34 2012 (r237524) @@ -1,6 +1,6 @@ ############################################################################# # Makefile for building: qt-pktlog -# Generated by qmake (2.01a) (Qt 4.7.4) on: Wed Jun 20 22:53:05 2012 +# Generated by qmake (2.01a) (Qt 4.7.4) on: Sun Jun 24 00:09:46 2012 # Project: qt-pktlog.pro # Template: app # Command: /usr/local/bin/qmake-qt4 -o Makefile qt-pktlog.pro @@ -11,8 +11,8 @@ CC = gcc CXX = g++ DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -CFLAGS = -pipe -O2 -Wall -W $(DEFINES) -CXXFLAGS = -pipe -O2 -Wall -W $(DEFINES) +CFLAGS = -g -ggdb -DATH_ENABLE_RADIOTAP_VENDOR_EXT -O2 -Wall -W $(DEFINES) +CXXFLAGS = -g -ggdb -DATH_ENABLE_RADIOTAP_VENDOR_EXT -O2 -Wall -W $(DEFINES) INCPATH = -I/usr/local/share/qt4/mkspecs/freebsd-g++ -I. -I/usr/local/include/qt4/QtCore -I/usr/local/include/qt4/QtGui -I/usr/local/include/qt4 -I. -I../../lib -I/usr/local/include/qt4 -I/usr/local/include/qwt6 -I. -I/usr/local/include/qt4 -I/usr/local/include LINK = g++ LFLAGS = -Wl,-O1 -pthread -Wl,-rpath,/usr/local/lib/qt4 Modified: user/adrian/ath_radar_stuff/src/qt-pktlog/qt-pktlog.pro ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-pktlog/qt-pktlog.pro Sun Jun 24 07:03:22 2012 (r237523) +++ user/adrian/ath_radar_stuff/src/qt-pktlog/qt-pktlog.pro Sun Jun 24 07:10:34 2012 (r237524) @@ -2,6 +2,9 @@ # Automatically generated by qmake (2.01a) Tue Feb 14 14:16:07 2012 ###################################################################### +QMAKE_CFLAGS= -g -ggdb -DATH_ENABLE_RADIOTAP_VENDOR_EXT +QMAKE_CXXFLAGS= -g -ggdb -DATH_ENABLE_RADIOTAP_VENDOR_EXT + TEMPLATE = app TARGET = DEPENDPATH += . From owner-svn-src-user@FreeBSD.ORG Sun Jun 24 09:12:49 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DF72C1065677; Sun, 24 Jun 2012 09:12:49 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B22B78FC15; Sun, 24 Jun 2012 09:12:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5O9CneD099790; Sun, 24 Jun 2012 09:12:49 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5O9CnP5099786; Sun, 24 Jun 2012 09:12:49 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206240912.q5O9CnP5099786@svn.freebsd.org> From: Adrian Chadd Date: Sun, 24 Jun 2012 09:12:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237530 - user/adrian/ath_radar_stuff/src/qt-hpktlog X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jun 2012 09:12:50 -0000 Author: adrian Date: Sun Jun 24 09:12:49 2012 New Revision: 237530 URL: http://svn.freebsd.org/changeset/base/237530 Log: Change the window title to be something useful, so I can easily determine what's going on with multiple windows. Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.cpp user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.h user/adrian/ath_radar_stuff/src/qt-hpktlog/main.cpp Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.cpp ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.cpp Sun Jun 24 08:47:19 2012 (r237529) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.cpp Sun Jun 24 09:12:49 2012 (r237530) @@ -1,3 +1,5 @@ +#include + #include #include #include @@ -64,6 +66,13 @@ MainApp::~MainApp() delete q_plot; } +void +MainApp::SetTitle(std::string s) +{ + + q_plot->setTitle(QString::fromStdString(s)); +} + // // This causes the radar entry to get received and replotted. // It's quite possible we should just fire off a 1ms timer event Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.h ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.h Sun Jun 24 08:47:19 2012 (r237529) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.h Sun Jun 24 09:12:49 2012 (r237530) @@ -2,6 +2,7 @@ #define __MAINAPP_H__ #include +#include #include #include @@ -64,6 +65,8 @@ class MainApp : public QMainWindow void timerEvent(QTimerEvent *event); + void SetTitle(std::string s); + public slots: void getRadarEntry(struct radar_entry re); Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/main.cpp ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-hpktlog/main.cpp Sun Jun 24 08:47:19 2012 (r237529) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/main.cpp Sun Jun 24 09:12:49 2012 (r237530) @@ -79,6 +79,7 @@ main(int argc, char *argv[]) QApplication a(argc, argv); PktSource ps; MainApp m; + std::string title; int type = 0; @@ -94,6 +95,12 @@ main(int argc, char *argv[]) // Ensure the chip is correct ps.SetChipId(type); + title = "Scatterplot "; + title.append(argv[1]); + title.append(" ("); + title.append(argv[2]); + title.append(")"); + m.SetTitle(title); // Connect the ps source -> mainapp handler QObject::connect(&ps, SIGNAL(emitRadarEntry(struct radar_entry)), From owner-svn-src-user@FreeBSD.ORG Mon Jun 25 08:16:00 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 33C3A10656AB; Mon, 25 Jun 2012 08:16:00 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1EEE78FC17; Mon, 25 Jun 2012 08:16:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5P8Fxms059893; Mon, 25 Jun 2012 08:15:59 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5P8Fxbk059890; Mon, 25 Jun 2012 08:15:59 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206250815.q5P8Fxbk059890@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 25 Jun 2012 08:15:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237557 - user/ae/bootcode/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 08:16:00 -0000 Author: ae Date: Mon Jun 25 08:15:59 2012 New Revision: 237557 URL: http://svn.freebsd.org/changeset/base/237557 Log: Fix a memory leak. Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Mon Jun 25 07:56:23 2012 (r237556) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Mon Jun 25 08:15:59 2012 (r237557) @@ -854,6 +854,8 @@ bd_getdev(struct i386_devdesc *dev) return(-1); if (bd_opendisk(&od, dev) != 0) /* oops, not a viable device */ return(-1); + else + bd_closedisk(od); if (biosdev < 0x80) { /* floppy (or emulated floppy) or ATAPI device */ From owner-svn-src-user@FreeBSD.ORG Mon Jun 25 08:34:15 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1147C1065676; Mon, 25 Jun 2012 08:34:15 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F0B748FC18; Mon, 25 Jun 2012 08:34:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5P8YELL060776; Mon, 25 Jun 2012 08:34:14 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5P8YEcr060773; Mon, 25 Jun 2012 08:34:14 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206250834.q5P8YEcr060773@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 25 Jun 2012 08:34:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237558 - in user/ae/bootcode/sys/boot: common i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 08:34:15 -0000 Author: ae Date: Mon Jun 25 08:34:14 2012 New Revision: 237558 URL: http://svn.freebsd.org/changeset/base/237558 Log: Change the type of d_offset field to off_t. In preparation to moving of the MI code from biosdisk.c to disk.c, add CTASSERT to check that size of struct i386_devdesc is enough to store disk_devdesc. Modified: user/ae/bootcode/sys/boot/common/disk.h user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Modified: user/ae/bootcode/sys/boot/common/disk.h ============================================================================== --- user/ae/bootcode/sys/boot/common/disk.h Mon Jun 25 08:15:59 2012 (r237557) +++ user/ae/bootcode/sys/boot/common/disk.h Mon Jun 25 08:34:14 2012 (r237558) @@ -84,7 +84,7 @@ struct disk_devdesc void *d_opendata; int d_slice; int d_partition; - int d_offset; + off_t d_offset; }; /* Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Mon Jun 25 08:15:59 2012 (r237557) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Mon Jun 25 08:34:14 2012 (r237558) @@ -47,8 +47,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include "disk.h" #include "libi386.h" +CTASSERT(sizeof(struct i386_devdesc) >= sizeof(struct disk_devdesc)); + #define BIOS_NUMDRIVES 0x475 #define BIOSDISK_SECSIZE 512 #define BUFSIZE (1 * BIOSDISK_SECSIZE) From owner-svn-src-user@FreeBSD.ORG Mon Jun 25 17:12:52 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8E06A106566B; Mon, 25 Jun 2012 17:12:52 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 603D78FC0A; Mon, 25 Jun 2012 17:12:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5PHCqVf085332; Mon, 25 Jun 2012 17:12:52 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5PHCq75085329; Mon, 25 Jun 2012 17:12:52 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201206251712.q5PHCq75085329@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 25 Jun 2012 17:12:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237564 - user/des/fbce/lib/FBCE/Controller X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 17:12:52 -0000 Author: des Date: Mon Jun 25 17:12:51 2012 New Revision: 237564 URL: http://svn.freebsd.org/changeset/base/237564 Log: - When generating the list of voters for the admin and result pages, make sure to only include voters. The list is not really needed, just the count, but this is the minimum fix. - Sort tied candidates by login. - While there, use _rs everywhere. Modified: user/des/fbce/lib/FBCE/Controller/Admin.pm user/des/fbce/lib/FBCE/Controller/Result.pm Modified: user/des/fbce/lib/FBCE/Controller/Admin.pm ============================================================================== --- user/des/fbce/lib/FBCE/Controller/Admin.pm Mon Jun 25 16:52:27 2012 (r237563) +++ user/des/fbce/lib/FBCE/Controller/Admin.pm Mon Jun 25 17:12:51 2012 (r237564) @@ -30,14 +30,14 @@ sub index :Path :Args(0) { $c->detach(); } my $voters = $c->model('FBCE::Person')-> - search(undef, { order_by => 'login' }); + search_rs({ active => 1 }, { order_by => 'login' }); my $candidates = $c->model('FBCE::Statement')-> - search_related('person', {}, { order_by => 'login' }); + search_related_rs('person', {}, { order_by => 'login' }); my $voted = $c->model('FBCE::Vote')-> - search_related('voter', {}, { distinct => 1 }); + search_related_rs('voter', {}, { distinct => 1 }); my $votes = $c->model('FBCE::Vote'); my $results = $c->model('FBCE::Result')-> - search(undef, { order_by => { -desc => 'votes' } }); + search_rs(undef, { order_by => [ { -desc => 'votes' }, { -asc => 'login' } ] }); $c->stash(voters => $voters); $c->stash(candidates => $candidates); $c->stash(voted => $voted); Modified: user/des/fbce/lib/FBCE/Controller/Result.pm ============================================================================== --- user/des/fbce/lib/FBCE/Controller/Result.pm Mon Jun 25 16:52:27 2012 (r237563) +++ user/des/fbce/lib/FBCE/Controller/Result.pm Mon Jun 25 17:12:51 2012 (r237564) @@ -25,15 +25,15 @@ sub index :Path :Args(0) { my ($self, $c) = @_; $c->stash(voters => $c->model('FBCE::Person')-> - search_rs(undef, { order_by => 'login' })); + search_rs({ active => 1 }, { order_by => 'login' })); $c->stash(candidates => $c->model('FBCE::Statement')-> - search_related('person', {}, { order_by => 'login' })); + search_related_rs('person', {}, { order_by => 'login' })); if ($c->stash->{'announced'}) { $c->stash(voted => $c->model('FBCE::Vote')-> - search_related('voter', {}, { distinct => 1 })->count); + search_related_rs('voter', {}, { distinct => 1 })->count); $c->stash(votes => $c->model('FBCE::Vote')->count); $c->stash(results => $c->model('FBCE::Result')-> - search_rs(undef, { order_by => { -desc => 'votes' } })); + search_rs(undef, { order_by => [ { -desc => 'votes' }, { -asc => 'login' } ] })); } else { $c->stash(voted => 0, votes => 0, results => undef); } From owner-svn-src-user@FreeBSD.ORG Mon Jun 25 19:59:08 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B1779106567D; Mon, 25 Jun 2012 19:59:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D7C08FC12; Mon, 25 Jun 2012 19:59:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5PJx88k092298; Mon, 25 Jun 2012 19:59:08 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5PJx89r092296; Mon, 25 Jun 2012 19:59:08 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206251959.q5PJx89r092296@svn.freebsd.org> From: Adrian Chadd Date: Mon, 25 Jun 2012 19:59:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237570 - user/adrian/ath_radar_stuff/src/pktlog X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 19:59:08 -0000 Author: adrian Date: Mon Jun 25 19:59:08 2012 New Revision: 237570 URL: http://svn.freebsd.org/changeset/base/237570 Log: Don't print the pulse summary if it didn't parse correctly. Modified: user/adrian/ath_radar_stuff/src/pktlog/main.c Modified: user/adrian/ath_radar_stuff/src/pktlog/main.c ============================================================================== --- user/adrian/ath_radar_stuff/src/pktlog/main.c Mon Jun 25 19:13:43 2012 (r237569) +++ user/adrian/ath_radar_stuff/src/pktlog/main.c Mon Jun 25 19:59:08 2012 (r237570) @@ -46,6 +46,7 @@ pkt_handle(int chip, const char *pkt, in struct ieee80211_radiotap_header *rh; uint8_t rssi, nf; struct radar_entry re; + int r; /* XXX assume it's a radiotap frame */ rh = (struct ieee80211_radiotap_header *) pkt; @@ -85,16 +86,17 @@ pkt_handle(int chip, const char *pkt, in #endif if (chip == CHIP_AR5416) - ar5416_radar_decode(rh, pkt + rh->it_len, len - rh->it_len, + r = ar5416_radar_decode(rh, pkt + rh->it_len, len - rh->it_len, &re); else if (chip == CHIP_AR9280) - ar9280_radar_decode(rh, pkt + rh->it_len, len - rh->it_len, + r = ar9280_radar_decode(rh, pkt + rh->it_len, len - rh->it_len, &re); /* * TODO: Print the summary record */ - pkt_print(&re); + if (r) + pkt_print(&re); } static pcap_t * From owner-svn-src-user@FreeBSD.ORG Mon Jun 25 22:19:21 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E6F41065672; Mon, 25 Jun 2012 22:19:21 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 309008FC12; Mon, 25 Jun 2012 22:19:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5PMJL5p098882; Mon, 25 Jun 2012 22:19:21 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5PMJKcq098879; Mon, 25 Jun 2012 22:19:20 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206252219.q5PMJKcq098879@svn.freebsd.org> From: Adrian Chadd Date: Mon, 25 Jun 2012 22:19:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237577 - user/adrian/ath_radar_stuff/lib/libradarpkt X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 22:19:21 -0000 Author: adrian Date: Mon Jun 25 22:19:20 2012 New Revision: 237577 URL: http://svn.freebsd.org/changeset/base/237577 Log: Add some notes about how to interpret the TSF values. Modified: user/adrian/ath_radar_stuff/lib/libradarpkt/ar5416_radar.c user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c Modified: user/adrian/ath_radar_stuff/lib/libradarpkt/ar5416_radar.c ============================================================================== --- user/adrian/ath_radar_stuff/lib/libradarpkt/ar5416_radar.c Mon Jun 25 22:14:24 2012 (r237576) +++ user/adrian/ath_radar_stuff/lib/libradarpkt/ar5416_radar.c Mon Jun 25 22:19:20 2012 (r237577) @@ -89,6 +89,18 @@ ar5416_radar_decode(struct ieee80211_rad */ re->re_rssi = rssi; + /* + * XXX TODO: + * + * The radar event is timestamped by the MAC the end of the event. + * To work around this particular issue, a "best guess" of the event + * start time involves its duration. + * + * For the AR5416 we can fake this as we know that in 5GHz mode + * the MAC clock is 40MHz, so we can just convert the duration to + * a microsecond value and subtract that from the TSF. + */ + re->re_timestamp = tsf; /* XXX TODO: re->re_freq */ re->re_dur = pkt[len - 1] & 0xff; Modified: user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c ============================================================================== --- user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c Mon Jun 25 22:14:24 2012 (r237576) +++ user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c Mon Jun 25 22:19:20 2012 (r237577) @@ -99,6 +99,27 @@ ar9280_radar_decode(struct ieee80211_rad ); #endif + /* + * XXX TODO: + * + * The radar event is timestamped by the MAC the end of the event. + * To work around this particular issue, a "best guess" of the event + * start time involves its duration. + * + * For the AR5416 we can fake this as we know that in 5GHz mode + * the MAC clock is 40MHz, so we can just convert the duration to + * a microsecond value and subtract that from the TSF. + * This also holds true for the AR9130/AR9160 in 5GHz mode. + * + * However, for the AR9280, 5GHz operation may be in "fast clock" + * mode, where the duration is actually not 0.8uS, but slightly + * smaller. + * + * Since there's currently no way to record this information in + * the vendor radiotap header (but there should be, hint hint) + * should have a flags field somewhere which includes (among other + * things) whether the pulse duration is based on 40MHz or 44MHz. + */ re->re_timestamp = tsf; re->re_rssi = pri_rssi; /* XXX extension rssi? */ re->re_dur = pkt[len - 3]; /* XXX extension duration? */ From owner-svn-src-user@FreeBSD.ORG Tue Jun 26 01:32:59 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A6E4106566B; Tue, 26 Jun 2012 01:32:59 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EA7328FC08; Tue, 26 Jun 2012 01:32:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5Q1Ww6P007462; Tue, 26 Jun 2012 01:32:58 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5Q1Wwp0007460; Tue, 26 Jun 2012 01:32:58 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201206260132.q5Q1Wwp0007460@svn.freebsd.org> From: Doug Barton Date: Tue, 26 Jun 2012 01:32:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237588 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 01:32:59 -0000 Author: dougb Date: Tue Jun 26 01:32:58 2012 New Revision: 237588 URL: http://svn.freebsd.org/changeset/base/237588 Log: Finally remembered why the line from r237475 was too verbose, -Fa. So only print it if we're not -F. Also for -F, print a line saying that we're skipping a file if we've already started a background fetch/checksum process for the same file. Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Tue Jun 26 00:34:34 2012 (r237587) +++ user/dougb/portmaster/portmaster Tue Jun 26 01:32:58 2012 (r237588) @@ -2992,7 +2992,7 @@ all_first_pass () { local iport origin for iport in "$@"; do - pm_v "===>>> $iport" + [ -z "$FETCH_ONLY" ] && pm_v "===>>> $iport" case "$CUR_DEPS" in *:${iport}:*) continue ;; esac @@ -3276,6 +3276,8 @@ if [ -z "$PM_INDEX_ONLY" -a -z "$PM_BUIL if ! ls ${TMPDIR}/f-${PM_PARENT_PID}-${file}-* >/dev/null 2>&1; then pm_mktemp ${file}-${portdir#*/} >/dev/null else + [ -n "$FETCH_ONLY" ] && + echo "===>>> Skipping $file due to previous fetch for it" DONT_FETCH=dont_fetch break fi From owner-svn-src-user@FreeBSD.ORG Tue Jun 26 10:40:48 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6B43106566B; Tue, 26 Jun 2012 10:40:48 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A285C8FC12; Tue, 26 Jun 2012 10:40:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5QAemXj029954; Tue, 26 Jun 2012 10:40:48 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5QAemke029952; Tue, 26 Jun 2012 10:40:48 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206261040.q5QAemke029952@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 26 Jun 2012 10:40:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237595 - user/ae/bootcode/sys/boot/common X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 10:40:48 -0000 Author: ae Date: Tue Jun 26 10:40:48 2012 New Revision: 237595 URL: http://svn.freebsd.org/changeset/base/237595 Log: Build crc32.c only when GPT is enabled. Modified: user/ae/bootcode/sys/boot/common/Makefile.inc Modified: user/ae/bootcode/sys/boot/common/Makefile.inc ============================================================================== --- user/ae/bootcode/sys/boot/common/Makefile.inc Tue Jun 26 10:32:09 2012 (r237594) +++ user/ae/bootcode/sys/boot/common/Makefile.inc Tue Jun 26 10:40:48 2012 (r237595) @@ -1,6 +1,6 @@ # $FreeBSD$ -SRCS+= boot.c commands.c console.c crc32.c devopen.c disk.c interp.c +SRCS+= boot.c commands.c console.c devopen.c disk.c interp.c SRCS+= interp_backslash.c interp_parse.c ls.c misc.c SRCS+= module.c panic.c part.c @@ -24,6 +24,10 @@ SRCS+= load_elf64.c reloc_elf64.c SRCS+= dev_net.c .endif +.if !defined(LOADER_NO_GPT_SUPPORT) +SRCS+= crc32.c +.endif + .if defined(HAVE_BCACHE) SRCS+= bcache.c .endif From owner-svn-src-user@FreeBSD.ORG Tue Jun 26 10:48:48 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE2A91065673; Tue, 26 Jun 2012 10:48:48 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B82DA8FC0A; Tue, 26 Jun 2012 10:48:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5QAmmSZ030368; Tue, 26 Jun 2012 10:48:48 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5QAmmXA030365; Tue, 26 Jun 2012 10:48:48 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206261048.q5QAmmXA030365@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 26 Jun 2012 10:48:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237596 - user/ae/bootcode/sys/boot/common X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 10:48:48 -0000 Author: ae Date: Tue Jun 26 10:48:48 2012 New Revision: 237596 URL: http://svn.freebsd.org/changeset/base/237596 Log: Reimplement code in the disk.c to work with partition tables using new API. Since there is no way to know the disk size and sector size from this layer, change the disk_open() function to take 3 arguments. Also add the disk_close() function to freeing dynamically allocated recources. Modified: user/ae/bootcode/sys/boot/common/disk.c user/ae/bootcode/sys/boot/common/disk.h Modified: user/ae/bootcode/sys/boot/common/disk.c ============================================================================== --- user/ae/bootcode/sys/boot/common/disk.c Tue Jun 26 10:40:48 2012 (r237595) +++ user/ae/bootcode/sys/boot/common/disk.c Tue Jun 26 10:48:48 2012 (r237596) @@ -1,5 +1,6 @@ /*- * Copyright (c) 1998 Michael Smith + * Copyright (c) 2012 Andrey V. Elsukov * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,26 +28,11 @@ #include __FBSDID("$FreeBSD$"); -/* - * MBR/GPT partitioned disk device handling. - * - * Ideas and algorithms from: - * - * - NetBSD libi386/biosdisk.c - * - FreeBSD biosboot/disk.c - * - */ - +#include #include - -#include -#include -#include - #include -#include - #include +#include #include "disk.h" @@ -56,53 +42,26 @@ __FBSDID("$FreeBSD$"); # define DEBUG(fmt, args...) #endif -/* - * Search for a slice with the following preferences: - * - * 1: Active FreeBSD slice - * 2: Non-active FreeBSD slice - * 3: Active Linux slice - * 4: non-active Linux slice - * 5: Active FAT/FAT32 slice - * 6: non-active FAT/FAT32 slice - */ -#define PREF_RAWDISK 0 -#define PREF_FBSD_ACT 1 -#define PREF_FBSD 2 -#define PREF_LINUX_ACT 3 -#define PREF_LINUX 4 -#define PREF_DOS_ACT 5 -#define PREF_DOS 6 -#define PREF_NONE 7 - -#ifdef LOADER_GPT_SUPPORT - -struct gpt_part { - int gp_index; - uuid_t gp_type; - uint64_t gp_start; - uint64_t gp_end; +struct open_disk { + struct ptable *table; + off_t mediasize; + u_int sectorsize; }; -static uuid_t efi = GPT_ENT_TYPE_EFI; -static uuid_t freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT; -static uuid_t freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS; -static uuid_t freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP; -static uuid_t freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS; -static uuid_t ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA; - -#endif - -#if defined(LOADER_GPT_SUPPORT) || defined(LOADER_MBR_SUPPORT) +struct print_args { + struct disk_devdesc *dev; + const char *prefix; + int verbose; +}; -/* Given a size in 512 byte sectors, convert it to a human-readable number. */ +/* Convert size to a human-readable number. */ static char * -display_size(uint64_t size) +display_size(uint64_t size, u_int sectorsize) { static char buf[80]; char unit; - size /= 2; + size = size * sectorsize / 1024; unit = 'K'; if (size >= 10485760000LL) { size /= 1073741824; @@ -118,683 +77,168 @@ display_size(uint64_t size) return (buf); } -#endif - -#ifdef LOADER_MBR_SUPPORT - -static void -disk_checkextended(struct disk_devdesc *dev, - struct dos_partition *slicetab, int slicenum, int *nslicesp) -{ - uint8_t buf[DISK_SECSIZE]; - struct dos_partition *dp; - uint32_t base; - int rc, i, start, end; - - dp = &slicetab[slicenum]; - start = *nslicesp; - - if (dp->dp_size == 0) - goto done; - if (dp->dp_typ != DOSPTYP_EXT) - goto done; - rc = dev->d_dev->dv_strategy(dev, F_READ, dp->dp_start, DISK_SECSIZE, - (char *) buf, NULL); - if (rc) - goto done; - if (buf[0x1fe] != 0x55 || buf[0x1ff] != 0xaa) { - DEBUG("no magic in extended table"); - goto done; - } - base = dp->dp_start; - dp = (struct dos_partition *) &buf[DOSPARTOFF]; - for (i = 0; i < NDOSPART; i++, dp++) { - if (dp->dp_size == 0) - continue; - if (*nslicesp == NEXTDOSPART) - goto done; - dp->dp_start += base; - bcopy(dp, &slicetab[*nslicesp], sizeof(*dp)); - (*nslicesp)++; - } - end = *nslicesp; - - /* - * now, recursively check the slices we just added - */ - for (i = start; i < end; i++) - disk_checkextended(dev, slicetab, i, nslicesp); -done: - return; -} - static int -disk_readslicetab(struct disk_devdesc *dev, - struct dos_partition **slicetabp, int *nslicesp) -{ - struct dos_partition *slicetab = NULL; - int nslices, i; - int rc; - uint8_t buf[DISK_SECSIZE]; - - /* - * Find the slice in the DOS slice table. - */ - rc = dev->d_dev->dv_strategy(dev, F_READ, 0, DISK_SECSIZE, - (char *) buf, NULL); - if (rc) { - DEBUG("error reading MBR"); - return (rc); - } - - /* - * Check the slice table magic. - */ - if (buf[0x1fe] != 0x55 || buf[0x1ff] != 0xaa) { - DEBUG("no slice table/MBR (no magic)"); - return (rc); - } - - /* - * copy the partition table, then pick up any extended partitions. - */ - slicetab = malloc(NEXTDOSPART * sizeof(struct dos_partition)); - bcopy(buf + DOSPARTOFF, slicetab, - sizeof(struct dos_partition) * NDOSPART); - nslices = NDOSPART; /* extended slices start here */ - for (i = 0; i < NDOSPART; i++) - disk_checkextended(dev, slicetab, i, &nslices); - - *slicetabp = slicetab; - *nslicesp = nslices; - return (0); -} - -/* - * Search for the best MBR slice (typically the first FreeBSD slice). - */ -static int -disk_bestslice(struct dos_partition *slicetab, int nslices) -{ - struct dos_partition *dp; - int pref, preflevel; - int i, prefslice; - - prefslice = 0; - preflevel = PREF_NONE; - - dp = &slicetab[0]; - for (i = 0; i < nslices; i++, dp++) { - switch (dp->dp_typ) { - case DOSPTYP_386BSD: /* FreeBSD */ - pref = dp->dp_flag & 0x80 ? PREF_FBSD_ACT : PREF_FBSD; - break; - - case DOSPTYP_LINUX: - pref = dp->dp_flag & 0x80 ? PREF_LINUX_ACT : PREF_LINUX; - break; - - case 0x01: /* DOS/Windows */ - case 0x04: - case 0x06: - case 0x0b: - case 0x0c: - case 0x0e: - pref = dp->dp_flag & 0x80 ? PREF_DOS_ACT : PREF_DOS; - break; - - default: - pref = PREF_NONE; - } - if (pref < preflevel) { - preflevel = pref; - prefslice = i + 1; - } - } - return (prefslice); -} - -static int -disk_openmbr(struct disk_devdesc *dev) -{ - struct dos_partition *slicetab = NULL, *dptr; - int nslices, sector, slice; - int rc; - uint8_t buf[DISK_SECSIZE]; - struct disklabel *lp; - - /* - * Following calculations attempt to determine the correct value - * for dev->d_offset by looking for the slice and partition specified, - * or searching for reasonable defaults. - */ - rc = disk_readslicetab(dev, &slicetab, &nslices); - if (rc) - return (rc); - - /* - * if a slice number was supplied but not found, this is an error. - */ - if (dev->d_slice > 0) { - slice = dev->d_slice - 1; - if (slice >= nslices) { - DEBUG("slice %d not found", slice); - rc = EPART; - goto out; - } - } - - /* - * Check for the historically bogus MBR found on true dedicated disks - */ - if (slicetab[3].dp_typ == DOSPTYP_386BSD && - slicetab[3].dp_start == 0 && slicetab[3].dp_size == 50000) { - sector = 0; - goto unsliced; - } - - /* - * Try to auto-detect the best slice; this should always give - * a slice number - */ - if (dev->d_slice == 0) { - slice = disk_bestslice(slicetab, nslices); - if (slice == -1) { - rc = ENOENT; - goto out; - } - dev->d_slice = slice; - } - - /* - * Accept the supplied slice number unequivocally (we may be looking - * at a DOS partition). - * Note: we number 1-4, offsets are 0-3 - */ - dptr = &slicetab[dev->d_slice - 1]; - sector = dptr->dp_start; - DEBUG("slice entry %d at %d, %d sectors", - dev->d_slice - 1, sector, dptr->dp_size); - -unsliced: - /* - * Now we have the slice offset, look for the partition in the - * disklabel if we have a partition to start with. - * - * XXX we might want to check the label checksum. - */ - if (dev->d_partition < 0) { - /* no partition, must be after the slice */ - DEBUG("opening raw slice"); - dev->d_offset = sector; - rc = 0; - goto out; - } - - rc = dev->d_dev->dv_strategy(dev, F_READ, sector + LABELSECTOR, - DISK_SECSIZE, (char *) buf, NULL); - if (rc) { - DEBUG("error reading disklabel"); - goto out; - } - - lp = (struct disklabel *) buf; - - if (lp->d_magic != DISKMAGIC) { - DEBUG("no disklabel"); - rc = ENOENT; - goto out; - } - if (dev->d_partition >= lp->d_npartitions) { - DEBUG("partition '%c' exceeds partitions in table (a-'%c')", - 'a' + dev->d_partition, - 'a' + lp->d_npartitions); - rc = EPART; - goto out; - } - - dev->d_offset = - lp->d_partitions[dev->d_partition].p_offset - - lp->d_partitions[RAW_PART].p_offset + - sector; - rc = 0; - -out: - if (slicetab) - free(slicetab); - return (rc); -} - -/* - * Print out each valid partition in the disklabel of a FreeBSD slice. - * For size calculations, we assume a 512 byte sector size. - */ -static void -disk_printbsdslice(struct disk_devdesc *dev, daddr_t offset, - char *prefix, int verbose) +ptblread(void *d, void *buf, size_t blocks, off_t offset) { - char line[80]; - char buf[DISK_SECSIZE]; - struct disklabel *lp; - int i, rc, fstype; - - /* read disklabel */ - rc = dev->d_dev->dv_strategy(dev, F_READ, offset + LABELSECTOR, - DISK_SECSIZE, (char *) buf, NULL); - if (rc) - return; - lp =(struct disklabel *)(&buf[0]); - if (lp->d_magic != DISKMAGIC) { - sprintf(line, "%s: FFS bad disklabel\n", prefix); - pager_output(line); - return; - } + struct disk_devdesc *dev; + struct open_disk *od; - /* Print partitions */ - for (i = 0; i < lp->d_npartitions; i++) { - /* - * For each partition, make sure we know what type of fs it - * is. If not, then skip it. - */ - fstype = lp->d_partitions[i].p_fstype; - if (fstype != FS_BSDFFS && - fstype != FS_SWAP && - fstype != FS_VINUM) - continue; - - /* Only print out statistics in verbose mode */ - if (verbose) - sprintf(line, " %s%c: %s %s (%d - %d)\n", - prefix, 'a' + i, - (fstype == FS_SWAP) ? "swap " : - (fstype == FS_VINUM) ? "vinum" : - "FFS ", - display_size(lp->d_partitions[i].p_size), - lp->d_partitions[i].p_offset, - (lp->d_partitions[i].p_offset - + lp->d_partitions[i].p_size)); - else - sprintf(line, " %s%c: %s\n", prefix, 'a' + i, - (fstype == FS_SWAP) ? "swap" : - (fstype == FS_VINUM) ? "vinum" : - "FFS"); - pager_output(line); - } + dev = (struct disk_devdesc *)d; + od = (struct open_disk *)dev->d_opendata; + return (dev->d_dev->dv_strategy(dev, F_READ, offset, + blocks * od->sectorsize, (char *)buf, NULL)); } static void -disk_printslice(struct disk_devdesc *dev, int slice, - struct dos_partition *dp, char *prefix, int verbose) +ptable_print(void *arg, const char *pname, const struct ptable_entry *part) { - char stats[80]; + struct print_args *pa, bsd; + struct open_disk *od; + struct ptable *table; char line[80]; - if (verbose) - sprintf(stats, " %s (%d - %d)", display_size(dp->dp_size), - dp->dp_start, dp->dp_start + dp->dp_size); - else - stats[0] = '\0'; - - switch (dp->dp_typ) { - case DOSPTYP_386BSD: - disk_printbsdslice(dev, (daddr_t)dp->dp_start, - prefix, verbose); - return; - case DOSPTYP_LINSWP: - sprintf(line, "%s: Linux swap%s\n", prefix, stats); - break; - case DOSPTYP_LINUX: - /* - * XXX - * read the superblock to confirm this is an ext2fs partition? - */ - sprintf(line, "%s: ext2fs%s\n", prefix, stats); - break; - case 0x00: /* unused partition */ - case DOSPTYP_EXT: - return; - case 0x01: - sprintf(line, "%s: FAT-12%s\n", prefix, stats); - break; - case 0x04: - case 0x06: - case 0x0e: - sprintf(line, "%s: FAT-16%s\n", prefix, stats); - break; - case 0x07: - sprintf(line, "%s: NTFS/HPFS%s\n", prefix, stats); - break; - case 0x0b: - case 0x0c: - sprintf(line, "%s: FAT-32%s\n", prefix, stats); - break; - default: - sprintf(line, "%s: Unknown fs: 0x%x %s\n", prefix, dp->dp_typ, - stats); - } + pa = (struct print_args *)arg; + od = (struct open_disk *)pa->dev->d_opendata; + sprintf(line, " %s%s: %s %s\n", pa->prefix, pname, + parttype2str(part->type), pa->verbose == 0 ? "": + display_size(part->end - part->start + 1, od->sectorsize)); pager_output(line); -} - -static int -disk_printmbr(struct disk_devdesc *dev, char *prefix, int verbose) -{ - struct dos_partition *slicetab; - int nslices, i; - int rc; - char line[80]; - - rc = disk_readslicetab(dev, &slicetab, &nslices); - if (rc) - return (rc); - for (i = 0; i < nslices; i++) { - sprintf(line, "%ss%d", prefix, i + 1); - disk_printslice(dev, i, &slicetab[i], line, verbose); - } - free(slicetab); - return (0); -} - -#endif - -#ifdef LOADER_GPT_SUPPORT - -static int -disk_readgpt(struct disk_devdesc *dev, struct gpt_part **gptp, int *ngptp) -{ - struct dos_partition *dp; - struct gpt_hdr *hdr; - struct gpt_ent *ent; - struct gpt_part *gptab = NULL; - int entries_per_sec, rc, i, part; - daddr_t lba, elba; - uint8_t gpt[DISK_SECSIZE], tbl[DISK_SECSIZE]; - - /* - * Following calculations attempt to determine the correct value - * for dev->d_offset by looking for the slice and partition specified, - * or searching for reasonable defaults. - */ - rc = 0; - - /* First, read the MBR and see if we have a PMBR. */ - rc = dev->d_dev->dv_strategy(dev, F_READ, 0, DISK_SECSIZE, - (char *) tbl, NULL); - if (rc) { - DEBUG("error reading MBR"); - return (EIO); - } - - /* Check the slice table magic. */ - if (tbl[0x1fe] != 0x55 || tbl[0x1ff] != 0xaa) - return (ENXIO); - - /* Check for GPT slice. */ - part = 0; - dp = (struct dos_partition *)(tbl + DOSPARTOFF); - for (i = 0; i < NDOSPART; i++) { - if (dp[i].dp_typ == 0xee) - part++; - else if ((part != 1) && (dp[i].dp_typ != 0x00)) - return (EINVAL); - } - if (part != 1) - return (EINVAL); - - /* Read primary GPT table header. */ - rc = dev->d_dev->dv_strategy(dev, F_READ, 1, DISK_SECSIZE, - (char *) gpt, NULL); - if (rc) { - DEBUG("error reading GPT header"); - return (EIO); - } - hdr = (struct gpt_hdr *)gpt; - if (bcmp(hdr->hdr_sig, GPT_HDR_SIG, sizeof(hdr->hdr_sig)) != 0 || - hdr->hdr_lba_self != 1 || hdr->hdr_revision < 0x00010000 || - hdr->hdr_entsz < sizeof(*ent) || - DISK_SECSIZE % hdr->hdr_entsz != 0) { - DEBUG("Invalid GPT header\n"); - return (EINVAL); - } - - /* Walk the partition table to count valid partitions. */ - part = 0; - entries_per_sec = DISK_SECSIZE / hdr->hdr_entsz; - elba = hdr->hdr_lba_table + hdr->hdr_entries / entries_per_sec; - for (lba = hdr->hdr_lba_table; lba < elba; lba++) { - rc = dev->d_dev->dv_strategy(dev, F_READ, lba, DISK_SECSIZE, - (char *) tbl, NULL); - if (rc) { - DEBUG("error reading GPT table"); - return (EIO); - } - for (i = 0; i < entries_per_sec; i++) { - ent = (struct gpt_ent *)(tbl + i * hdr->hdr_entsz); - if (uuid_is_nil(&ent->ent_type, NULL) || - ent->ent_lba_start == 0 || - ent->ent_lba_end < ent->ent_lba_start) - continue; - part++; - } - } - - /* Save the important information about all the valid partitions. */ - if (part != 0) { - gptab = malloc(part * sizeof(struct gpt_part)); - part = 0; - for (lba = hdr->hdr_lba_table; lba < elba; lba++) { - rc = dev->d_dev->dv_strategy(dev, F_READ, lba, DISK_SECSIZE, - (char *) tbl, NULL); - if (rc) { - DEBUG("error reading GPT table"); - free(gptab); - return (EIO); - } - for (i = 0; i < entries_per_sec; i++) { - ent = (struct gpt_ent *)(tbl + i * hdr->hdr_entsz); - if (uuid_is_nil(&ent->ent_type, NULL) || - ent->ent_lba_start == 0 || - ent->ent_lba_end < ent->ent_lba_start) - continue; - gptab[part].gp_index = (lba - hdr->hdr_lba_table) * - entries_per_sec + i + 1; - gptab[part].gp_type = ent->ent_type; - gptab[part].gp_start = ent->ent_lba_start; - gptab[part].gp_end = ent->ent_lba_end; - part++; - } - } + if (part->type == PART_FREEBSD) { + /* Open slice with BSD label */ + pa->dev->d_offset = part->start; + table = ptable_open(pa->dev, part->end - part->start + 1, + od->sectorsize, ptblread); + if (table == NULL) + return; + sprintf(line, " %s%s", pa->prefix, pname); + bsd.dev = pa->dev; + bsd.prefix = line; + bsd.verbose = pa->verbose; + ptable_iterate(table, &bsd, ptable_print); + ptable_close(table); } - - *gptp = gptab; - *ngptp = part; - return (0); } -static struct gpt_part * -disk_bestgpt(struct gpt_part *gpt, int ngpt) +void +disk_print(struct disk_devdesc *dev, char *prefix, int verbose) { - struct gpt_part *gp, *prefpart; - int i, pref, preflevel; - - prefpart = NULL; - preflevel = PREF_NONE; + struct open_disk *od; + struct print_args pa; - gp = gpt; - for (i = 0; i < ngpt; i++, gp++) { - /* Windows. XXX: Also Linux. */ - if (uuid_equal(&gp->gp_type, &ms_basic_data, NULL)) - pref = PREF_DOS; - /* FreeBSD */ - else if (uuid_equal(&gp->gp_type, &freebsd_ufs, NULL) || - uuid_equal(&gp->gp_type, &freebsd_zfs, NULL)) - pref = PREF_FBSD; - else - pref = PREF_NONE; - if (pref < preflevel) { - preflevel = pref; - prefpart = gp; - } - } - return (prefpart); + /* Disk should be opened */ + od = (struct open_disk *)dev->d_opendata; + pa.dev = dev; + pa.prefix = prefix; + pa.verbose = verbose; + ptable_iterate(od->table, &pa, ptable_print); } -static int -disk_opengpt(struct disk_devdesc *dev) +int +disk_open(struct disk_devdesc *dev, off_t mediasize, u_int sectorsize) { - struct gpt_part *gpt = NULL, *gp; - int rc, ngpt, i; + struct open_disk *od; + struct ptable *table; + struct ptable_entry part; + int rc; - rc = disk_readgpt(dev, &gpt, &ngpt); - if (rc) - return (rc); - - /* Is this a request for the whole disk? */ - if (dev->d_slice < 0) { - dev->d_offset = 0; - rc = 0; - goto out; + od = (struct open_disk *)malloc(sizeof(struct open_disk)); + if (od == NULL) { + DEBUG("no memory"); + return (ENOMEM); } - /* - * If a partition number was supplied, then the user is trying to use - * an MBR address rather than a GPT address, so fail. + * While we are reading disk metadata, make sure we do it relative + * to the start of the disk */ - if (dev->d_partition != 0xff) { - rc = ENOENT; + rc = 0; + table = NULL; + dev->d_offset = 0; + dev->d_opendata = od; + od->mediasize = mediasize; + od->sectorsize = sectorsize; + DEBUG("open '%s', unit %d slice %d partition %d", + disk_fmtdev(dev), dev->d_unit, dev->d_slice, dev->d_partition); + + /* Determine disk layout. */ + od->table = ptable_open(dev, mediasize / sectorsize, sectorsize, + ptblread); + if (od->table == NULL) { + DEBUG("Can't read partition table"); + rc = ENXIO; goto out; } - - /* If a slice number was supplied but not found, this is an error. */ - gp = NULL; if (dev->d_slice > 0) { - for (i = 0; i < ngpt; i++) { - if (gpt[i].gp_index == dev->d_slice) { - gp = &gpt[i]; - break; - } - } - if (gp == NULL) { - DEBUG("partition %d not found", dev->d_slice); - rc = ENOENT; + /* Try to get information about partition */ + rc = ptable_getpart(od->table, &part, dev->d_slice); + if (rc != 0) /* Partition doesn't exist */ goto out; - } - } - - /* Try to auto-detect the best partition. */ - if (dev->d_slice == 0) { - gp = disk_bestgpt(gpt, ngpt); - if (gp == NULL) { - rc = ENOENT; + dev->d_offset = part.start; + if (dev->d_partition == -1 || + dev->d_partition == 255) + goto out; /* Nothing more to do */ + + /* Try to read BSD label */ + table = ptable_open(dev, part.end - part.start + 1, + od->sectorsize, ptblread); + if (table == NULL) { + DEBUG("Can't read BSD label"); + rc = ENXIO; goto out; } - dev->d_slice = gp->gp_index; + rc = ptable_getpart(table, &part, dev->d_partition); + if (rc != 0) + goto out; + dev->d_offset += part.start; + } else if (dev->d_slice == 0) { + rc = ptable_getbestpart(od->table, &part); + if (rc != 0) + goto out; + /* Save the slice number of best partition to dev */ + dev->d_slice = part.index; + dev->d_offset = part.start; } - - dev->d_offset = gp->gp_start; - rc = 0; - out: - if (gpt) - free(gpt); - return (rc); -} - -static void -disk_printgptpart(struct disk_devdesc *dev, struct gpt_part *gp, - char *prefix, int verbose) -{ - char stats[80]; - char line[96]; - - if (verbose) - sprintf(stats, " %s", - display_size(gp->gp_end + 1 - gp->gp_start)); - else - stats[0] = '\0'; - - if (uuid_equal(&gp->gp_type, &efi, NULL)) - sprintf(line, "%s: EFI %s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &ms_basic_data, NULL)) - sprintf(line, "%s: FAT/NTFS %s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &freebsd_boot, NULL)) - sprintf(line, "%s: FreeBSD boot%s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &freebsd_ufs, NULL)) - sprintf(line, "%s: FreeBSD UFS %s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &freebsd_zfs, NULL)) - sprintf(line, "%s: FreeBSD ZFS %s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &freebsd_swap, NULL)) - sprintf(line, "%s: FreeBSD swap%s\n", prefix, stats); - else - sprintf(line, - "%s: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x%s\n", - prefix, - gp->gp_type.time_low, gp->gp_type.time_mid, - gp->gp_type.time_hi_and_version, - gp->gp_type.clock_seq_hi_and_reserved, - gp->gp_type.clock_seq_low, - gp->gp_type.node[0], - gp->gp_type.node[1], - gp->gp_type.node[2], - gp->gp_type.node[3], - gp->gp_type.node[4], - gp->gp_type.node[5], - stats); - pager_output(line); -} - -static int -disk_printgpt(struct disk_devdesc *dev, char *prefix, int verbose) -{ - struct gpt_part *gpt = NULL; - int rc, ngpt, i; - char line[80]; - - rc = disk_readgpt(dev, &gpt, &ngpt); - if (rc) - return (rc); - for (i = 0; i < ngpt; i++) { - sprintf(line, "%sp%d", prefix, i + 1); - disk_printgptpart(dev, &gpt[i], line, verbose); + if (table != NULL) + ptable_close(table); + if (rc != 0) { + if (od->table != NULL) + ptable_close(od->table); + free(od); } - free(gpt); - return (0); + return (rc); } -#endif - int -disk_open(struct disk_devdesc *dev) +disk_close(struct disk_devdesc *dev) { - int rc; - - rc = 0; - /* - * While we are reading disk metadata, make sure we do it relative - * to the start of the disk - */ - dev->d_offset = 0; + struct open_disk *od; -#ifdef LOADER_GPT_SUPPORT - rc = disk_opengpt(dev); - if (rc == 0) - return (0); -#endif -#ifdef LOADER_MBR_SUPPORT - rc = disk_openmbr(dev); -#endif - - return (rc); + od = (struct open_disk *)dev->d_opendata; + ptable_close(od->table); + free(od); + return (0); } -void -disk_print(struct disk_devdesc *dev, char *prefix, int verbose) +char* +disk_fmtdev(struct disk_devdesc *dev) { + static char buf[128]; + char *cp; + cp = buf + sprintf(buf, "%s%d", dev->d_dev->dv_name, dev->d_unit); + if (dev->d_slice > 0) { #ifdef LOADER_GPT_SUPPORT - if (disk_printgpt(dev, prefix, verbose) == 0) - return; + if (dev->d_partition == 255) { + sprintf(cp, "p%d:", dev->d_slice); + return (buf); + } else #endif #ifdef LOADER_MBR_SUPPORT - disk_printmbr(dev, prefix, verbose); + cp += sprintf(cp, "s%d", dev->d_slice); #endif + if (dev->d_partition >= 0) + cp += sprintf(cp, "%c", dev->d_partition + 'a'); + } + strcat(cp, ":"); + return (buf); } Modified: user/ae/bootcode/sys/boot/common/disk.h ============================================================================== --- user/ae/bootcode/sys/boot/common/disk.h Tue Jun 26 10:40:48 2012 (r237595) +++ user/ae/bootcode/sys/boot/common/disk.h Tue Jun 26 10:48:48 2012 (r237596) @@ -90,10 +90,14 @@ struct disk_devdesc /* * Parse disk metadata and initialise dev->d_offset. */ -extern int disk_open(struct disk_devdesc * dev); +extern int disk_open(struct disk_devdesc *dev, off_t mediasize, + u_int sectorsize); +extern int disk_close(struct disk_devdesc *dev); /* * Print information about slices on a disk. For the size calculations we * assume a 512 byte sector. */ extern void disk_print(struct disk_devdesc *dev, char *prefix, int verbose); +extern char* disk_fmtdev(struct disk_devdesc *dev); + From owner-svn-src-user@FreeBSD.ORG Tue Jun 26 10:55:02 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66435106564A; Tue, 26 Jun 2012 10:55:02 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 49FD58FC1B; Tue, 26 Jun 2012 10:55:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5QAt22k035908; Tue, 26 Jun 2012 10:55:02 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5QAt2CE035906; Tue, 26 Jun 2012 10:55:02 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206261055.q5QAt2CE035906@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 26 Jun 2012 10:55:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237597 - user/ae/bootcode/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 10:55:02 -0000 Author: ae Date: Tue Jun 26 10:55:01 2012 New Revision: 237597 URL: http://svn.freebsd.org/changeset/base/237597 Log: Add offset field to the disk structure in the i386_devdesc. Use MI code from the common/disk.c to get access to partitions. Remove open_disk structure and bd_cleanup function, since they are no longer needed. Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c user/ae/bootcode/sys/boot/i386/libi386/libi386.h Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Tue Jun 26 10:48:48 2012 (r237596) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Tue Jun 26 10:55:01 2012 (r237597) @@ -40,8 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include #include - -#include #include #include @@ -68,15 +66,6 @@ CTASSERT(sizeof(struct i386_devdesc) >= # define DEBUG(fmt, args...) #endif -struct open_disk { - int od_dkunit; /* disk unit number */ - int od_unit; /* BIOS unit number */ - int od_slice; /* slice number of the parent table */ - daddr_t od_boff; /* offset from the beginning */ - daddr_t od_size; /* disk or partition size */ - struct ptable *od_ptable; -}; - /* * List of BIOS devices, translation from disk unit number to * BIOS unit number. @@ -96,22 +85,18 @@ static struct bdinfo int bd_type; /* BIOS 'drive type' (floppy only) */ uint16_t bd_sectorsize; /* Sector size */ uint64_t bd_sectors; /* Disk size */ - struct ptable *bd_ptable; /* Partition table */ } bdinfo [MAXBDDEV]; static int nbdinfo = 0; -#define BD(od) (bdinfo[(od)->od_dkunit]) -#define BDSZ(od) (bdinfo[(od)->od_dkunit].bd_sectors) -#define BDSECSZ(od) (bdinfo[(od)->od_dkunit].bd_sectorsize) +#define BD(dev) (bdinfo[(dev)->d_unit]) -static int bd_read(struct open_disk *od, daddr_t dblk, int blks, +static int bd_read(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest); -static int bd_write(struct open_disk *od, daddr_t dblk, int blks, +static int bd_write(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest); static int bd_int13probe(struct bdinfo *bd); static int bd_init(void); -static void bd_cleanup(void); static int bd_strategy(void *devdata, int flag, daddr_t dblk, size_t size, char *buf, size_t *rsize); static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, @@ -121,12 +106,6 @@ static int bd_close(struct open_file *f) static int bd_ioctl(struct open_file *f, u_long cmd, void *data); static void bd_print(int verbose); -struct bd_print_args { - struct open_disk *od; - const char *prefix; - int verbose; -}; - struct devsw biosdisk = { "disk", DEVT_DISK, @@ -136,12 +115,9 @@ struct devsw biosdisk = { bd_close, bd_ioctl, bd_print, - bd_cleanup + NULL }; -static int bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev); -static void bd_closedisk(struct open_disk *od); - /* * Translate between BIOS device numbers and our private unit numbers. */ @@ -204,19 +180,6 @@ bd_init(void) return(0); } -static void -bd_cleanup(void) -{ - int i; - - for (i = 0; i < nbdinfo; i++) { - if (bdinfo[i].bd_ptable != NULL) { - ptable_close(bdinfo[i].bd_ptable); - bdinfo[i].bd_ptable = NULL; - } - } -} - /* * Try to detect a device supported by the legacy int13 BIOS */ @@ -279,65 +242,14 @@ bd_int13probe(struct bdinfo *bd) return (1); } -/* Convert the size to a human-readable number. */ -static char * -display_size(uint64_t size, uint16_t sectorsize) -{ - static char buf[80]; - char unit; - - size = size * sectorsize / 1024; - unit = 'K'; - if (size >= 10485760000LL) { - size /= 1073741824; - unit = 'T'; - } else if (size >= 10240000) { - size /= 1048576; - unit = 'G'; - } else if (size >= 10000) { - size /= 1024; - unit = 'M'; - } - sprintf(buf, "%.6ld%cB", (long)size, unit); - return (buf); -} - -static void -printpartition(void *arg, const char *pname, const struct ptable_entry *part) -{ - struct bd_print_args *pa, bsd; - struct i386_devdesc dev; - char line[80]; - - pa = (struct bd_print_args *)arg; - sprintf(line, " %s%s: %s %s\n", pa->prefix, pname, - parttype2str(part->type), pa->verbose == 0 ? "": - display_size(part->end - part->start + 1, BDSECSZ(pa->od))); - pager_output(line); - if (part->type == PART_FREEBSD) { - /* Open slice with BSD label */ - dev.d_unit = pa->od->od_dkunit; - dev.d_kind.biosdisk.slice = part->index; - dev.d_kind.biosdisk.partition = -1; - if (!bd_opendisk(&bsd.od, &dev)) { - sprintf(line, " %s%s", pa->prefix, pname); - bsd.prefix = line; - bsd.verbose = pa->verbose; - ptable_iterate(bsd.od->od_ptable, &bsd, - printpartition); - bd_closedisk(bsd.od); - } - } -} /* * Print information about disks */ static void bd_print(int verbose) { - struct bd_print_args pa; static char line[80]; - struct i386_devdesc dev; + struct disk_devdesc dev; int i; for (i = 0; i < nbdinfo; i++) { @@ -345,18 +257,16 @@ bd_print(int verbose) (bdinfo[i].bd_unit < 0x80) ? ('A' + bdinfo[i].bd_unit): ('C' + bdinfo[i].bd_unit - 0x80)); pager_output(line); - - /* try to open the whole disk */ + dev.d_dev = &biosdisk; dev.d_unit = i; - dev.d_kind.biosdisk.slice = -1; - dev.d_kind.biosdisk.partition = -1; - if (!bd_opendisk(&pa.od, &dev)) { + dev.d_slice = -1; + dev.d_partition = -1; + if (disk_open(&dev, + bdinfo[i].bd_sectorsize * bdinfo[i].bd_sectors, + bdinfo[i].bd_sectorsize) == 0) { sprintf(line, " disk%d", i); - pa.prefix = line; - pa.verbose = verbose; - ptable_iterate(pa.od->od_ptable, &pa, - printpartition); - bd_closedisk(pa.od); + disk_print(&dev, line, verbose); + disk_close(&dev); } } } @@ -374,169 +284,41 @@ bd_print(int verbose) static int bd_open(struct open_file *f, ...) { - struct i386_devdesc *dev; - struct open_disk *od; + struct disk_devdesc *dev; va_list ap; - int error; va_start(ap, f); - dev = va_arg(ap, struct i386_devdesc *); + dev = va_arg(ap, struct disk_devdesc *); va_end(ap); - if ((error = bd_opendisk(&od, dev)) != 0) - return (error); - - /* Save our context */ - ((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data = od; - DEBUG("open_disk %p, partition at 0x%x", od, od->od_boff); - return (0); -} - -static int -diskread(void *dev, void *buf, size_t blocks, off_t offset) -{ - struct open_disk *od = dev; - - return (bd_read(dev, offset + od->od_boff, blocks, buf)); -} - -static int -bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev) -{ - struct open_disk *od; - struct ptable_entry part; - int error; - if (dev->d_unit >= nbdinfo) { - DEBUG("attempt to open nonexistent disk"); - return (ENXIO); - } - od = (struct open_disk *)malloc(sizeof(struct open_disk)); - if (!od) { - DEBUG("no memory"); - return (ENOMEM); - } + if (dev->d_unit < 0 || dev->d_unit >= nbdinfo) + return (EIO); - /* Look up BIOS unit number, initalize open_disk structure */ - od->od_dkunit = dev->d_unit; - od->od_unit = bdinfo[od->od_dkunit].bd_unit; - od->od_ptable = bdinfo[od->od_dkunit].bd_ptable; - od->od_slice = 0; - od->od_boff = 0; - error = 0; - DEBUG("open '%s', unit 0x%x slice %d partition %d", - i386_fmtdev(dev), dev->d_unit, dev->d_kind.biosdisk.slice, - dev->d_kind.biosdisk.partition); - - /* Determine disk layout. */ - if (od->od_ptable == NULL) { - od->od_ptable = ptable_open(od, BDSZ(od), BDSECSZ(od), - diskread); - if (od->od_ptable == NULL) { - DEBUG("Can't read partition table"); - error = ENXIO; - goto out; - } - /* Save the result */ - bdinfo[od->od_dkunit].bd_ptable = od->od_ptable; - } - /* - * What we want to open: - * a whole disk: - * slice = -1 - * - * a MBR slice: - * slice = 1 .. 4 - * partition = -1 - * - * an EBR slice: - * slice = 5 .. N - * partition = -1 - * - * a GPT partition: - * slice = 1 .. N - * partition = 255 - * - * BSD partition within an MBR slice: - * slice = 1 .. N - * partition = 0 .. 19 - */ - if (dev->d_kind.biosdisk.slice > 0) { - /* Try to get information about partition */ - error = ptable_getpart(od->od_ptable, &part, - dev->d_kind.biosdisk.slice); - if (error != 0) /* Partition isn't exists */ - goto out; - /* Adjust open_disk's offset within the biosdisk */ - od->od_boff = part.start; - if (dev->d_kind.biosdisk.partition == 255) - goto out; /* Nothing more to do */ - - /* Try to read BSD label */ - od->od_ptable = ptable_open(od, part.end - part.start + 1, - BDSECSZ(od), diskread); - if (od->od_ptable == NULL) { - DEBUG("Can't read BSD label"); - error = ENXIO; - /* Keep parent partition table opened */ - goto out; - } - /* Save the slice number of the parent partition */ - od->od_slice = part.index; - if (dev->d_kind.biosdisk.partition == -1) - goto out; /* Nothing more to do */ - error = ptable_getpart(od->od_ptable, &part, - dev->d_kind.biosdisk.partition); - if (error != 0) { - /* - * Keep parent partition table opened, but - * close this one (BSD label). - */ - ptable_close(od->od_ptable); - goto out; - } - /* Adjust open_disk's offset within the biosdisk */ - od->od_boff += part.start; - } else if (dev->d_kind.biosdisk.slice == 0) { - error = ptable_getbestpart(od->od_ptable, &part); - if (error != 0) - goto out; - /* Save the slice number of best partition to dev */ - dev->d_kind.biosdisk.slice = part.index; - od->od_boff = part.start; - } -out: - if (error != 0) { - free(od); - } else { - *odp = od; /* return the open disk */ - } - return (error); + return (disk_open(dev, BD(dev).bd_sectors * BD(dev).bd_sectorsize, + BD(dev).bd_sectorsize)); } static int bd_close(struct open_file *f) { - struct open_disk *od; + struct disk_devdesc *dev; - od = (struct open_disk *) - (((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data); - bd_closedisk(od); - return (0); + dev = (struct disk_devdesc *)f->f_devdata; + return (disk_close(dev)); } static int bd_ioctl(struct open_file *f, u_long cmd, void *data) { - struct open_disk *od; + struct disk_devdesc *dev; - od = (struct open_disk *) - (((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data); + dev = (struct disk_devdesc *)f->f_devdata; switch (cmd) { case DIOCGSECTORSIZE: - *(u_int *)data = BDSECSZ(od); + *(u_int *)data = BD(dev).bd_sectorsize; break; case DIOCGMEDIASIZE: - *(off_t *)data = BDSZ(od) * BDSECSZ(od); + *(off_t *)data = BD(dev).bd_sectors * BD(dev).bd_sectorsize; break; default: return (ENOTTY); @@ -544,35 +326,25 @@ bd_ioctl(struct open_file *f, u_long cmd return (0); } -static void -bd_closedisk(struct open_disk *od) -{ - - DEBUG("close_disk %p", od); - /* Close only nested ptables */ - if (od->od_slice != 0 && od->od_ptable != NULL) - ptable_close(od->od_ptable); - free(od); -} - static int -bd_strategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) +bd_strategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, + size_t *rsize) { struct bcache_devdata bcd; - struct open_disk *od; + struct disk_devdesc *dev; - od = (struct open_disk *) - (((struct i386_devdesc *)devdata)->d_kind.biosdisk.data); + dev = (struct disk_devdesc *)devdata; bcd.dv_strategy = bd_realstrategy; bcd.dv_devdata = devdata; - return (bcache_strategy(&bcd, od->od_unit, rw, dblk + od->od_boff, + return (bcache_strategy(&bcd, BD(dev).bd_unit, rw, dblk + dev->d_offset, size, buf, rsize)); } -static int -bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) +static int +bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, + size_t *rsize) { - struct open_disk *od = (struct open_disk *)(((struct i386_devdesc *)devdata)->d_kind.biosdisk.data); + struct disk_devdesc *dev = (struct disk_devdesc *)devdata; int blks; #ifdef BD_SUPPORT_FRAGS /* XXX: sector size */ char fragbuf[BIOSDISK_SECSIZE]; @@ -580,12 +352,12 @@ bd_realstrategy(void *devdata, int rw, d fragsize = size % BIOSDISK_SECSIZE; #else - if (size % BDSECSZ(od)) + if (size % BD(dev).bd_sectorsize) panic("bd_strategy: %d bytes I/O not multiple of block size", size); #endif - DEBUG("open_disk %p", od); - blks = size / BDSECSZ(od); + DEBUG("open_disk %p", dev); + blks = size / BD(dev).bd_sectorsize; if (rsize) *rsize = 0; @@ -593,7 +365,7 @@ bd_realstrategy(void *devdata, int rw, d case F_READ: DEBUG("read %d from %lld to %p", blks, dblk, buf); - if (blks && bd_read(od, dblk, blks, buf)) { + if (blks && bd_read(dev, dblk, blks, buf)) { DEBUG("read error"); return (EIO); } @@ -610,7 +382,7 @@ bd_realstrategy(void *devdata, int rw, d case F_WRITE : DEBUG("write %d from %d to %p", blks, dblk, buf); - if (blks && bd_write(od, dblk, blks, buf)) { + if (blks && bd_write(dev, dblk, blks, buf)) { DEBUG("write error"); return (EIO); } @@ -635,7 +407,8 @@ bd_realstrategy(void *devdata, int rw, d #define FLOPPY_BOUNCEBUF 18 static int -bd_edd_io(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest, int write) +bd_edd_io(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest, + int write) { static struct edd_packet packet; @@ -651,7 +424,7 @@ bd_edd_io(struct open_disk *od, daddr_t v86.eax = 0x4300; else v86.eax = 0x4200; - v86.edx = od->od_unit; + v86.edx = BD(dev).bd_unit; v86.ds = VTOPSEG(&packet); v86.esi = VTOPOFF(&packet); v86int(); @@ -659,16 +432,17 @@ bd_edd_io(struct open_disk *od, daddr_t } static int -bd_chs_io(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest, int write) +bd_chs_io(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest, + int write) { u_int x, bpc, cyl, hd, sec; - bpc = BD(od).bd_sec * BD(od).bd_hds; /* blocks per cylinder */ + bpc = BD(dev).bd_sec * BD(dev).bd_hds; /* blocks per cylinder */ x = dblk; cyl = x / bpc; /* block # / blocks per cylinder */ x %= bpc; /* block offset into cylinder */ - hd = x / BD(od).bd_sec; /* offset / blocks per track */ - sec = x % BD(od).bd_sec; /* offset into track */ + hd = x / BD(dev).bd_sec; /* offset / blocks per track */ + sec = x % BD(dev).bd_sec; /* offset into track */ /* correct sector number for 1-based BIOS numbering */ sec++; @@ -684,7 +458,7 @@ bd_chs_io(struct open_disk *od, daddr_t else v86.eax = 0x200 | blks; v86.ecx = ((cyl & 0xff) << 8) | ((cyl & 0x300) >> 2) | sec; - v86.edx = (hd << 8) | od->od_unit; + v86.edx = (hd << 8) | BD(dev).bd_unit; v86.es = VTOPSEG(dest); v86.ebx = VTOPOFF(dest); v86int(); @@ -692,7 +466,7 @@ bd_chs_io(struct open_disk *od, daddr_t } static int -bd_io(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest, int write) +bd_io(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest, int write) { u_int x, sec, result, resid, retry, maxfer; caddr_t p, xp, bbuf, breg; @@ -705,8 +479,9 @@ bd_io(struct open_disk *od, daddr_t dblk p = dest; /* Decide whether we have to bounce */ - if (VTOP(dest) >> 20 != 0 || ((od->od_unit < 0x80) && - ((VTOP(dest) >> 16) != (VTOP(dest + blks * BDSECSZ(od)) >> 16)))) { + if (VTOP(dest) >> 20 != 0 || (BD(dev).bd_unit < 0x80 && + (VTOP(dest) >> 16) != (VTOP(dest + + blks * BD(dev).bd_sectorsize) >> 16))) { /* * There is a 64k physical boundary somewhere in the @@ -717,12 +492,12 @@ bd_io(struct open_disk *od, daddr_t dblk * there, in which case we use the top half. */ x = min(FLOPPY_BOUNCEBUF, (unsigned)blks); - bbuf = alloca(x * 2 * BDSECSZ(od)); + bbuf = alloca(x * 2 * BD(dev).bd_sectorsize); if (((u_int32_t)VTOP(bbuf) & 0xffff0000) == - ((u_int32_t)VTOP(bbuf + x * BDSECSZ(od)) & 0xffff0000)) { + ((u_int32_t)VTOP(bbuf + x * BD(dev).bd_sectorsize) & 0xffff0000)) { breg = bbuf; } else { - breg = bbuf + x * BDSECSZ(od); + breg = bbuf + x * BD(dev).bd_sectorsize; } maxfer = x; /* limit transfers to bounce region size */ } else { @@ -735,8 +510,8 @@ bd_io(struct open_disk *od, daddr_t dblk * Play it safe and don't cross track boundaries. * (XXX this is probably unnecessary) */ - sec = dblk % BD(od).bd_sec; /* offset into track */ - x = min(BD(od).bd_sec - sec, resid); + sec = dblk % BD(dev).bd_sec; /* offset into track */ + x = min(BD(dev).bd_sec - sec, resid); if (maxfer > 0) x = min(x, maxfer); /* fit bounce buffer */ @@ -748,7 +523,7 @@ bd_io(struct open_disk *od, daddr_t dblk * Put your Data In, and shake it all about */ if (write && bbuf != NULL) - bcopy(p, breg, x * BDSECSZ(od)); + bcopy(p, breg, x * BD(dev).bd_sectorsize); /* * Loop retrying the operation a couple of times. The BIOS @@ -760,14 +535,14 @@ bd_io(struct open_disk *od, daddr_t dblk v86.ctl = V86_FLAGS; v86.addr = 0x13; v86.eax = 0; - v86.edx = od->od_unit; + v86.edx = BD(dev).bd_unit; v86int(); } - if (BD(od).bd_flags & BD_MODEEDD1) - result = bd_edd_io(od, dblk, x, xp, write); + if (BD(dev).bd_flags & BD_MODEEDD1) + result = bd_edd_io(dev, dblk, x, xp, write); else - result = bd_chs_io(od, dblk, x, xp, write); + result = bd_chs_io(dev, dblk, x, xp, write); if (result == 0) break; } @@ -782,28 +557,28 @@ bd_io(struct open_disk *od, daddr_t dblk return(-1); } if (!write && bbuf != NULL) - bcopy(breg, p, x * BDSECSZ(od)); - p += (x * BDSECSZ(od)); + bcopy(breg, p, x * BD(dev).bd_sectorsize); + p += (x * BD(dev).bd_sectorsize); dblk += x; resid -= x; } -/* hexdump(dest, (blks * BDSECSZ(od))); */ +/* hexdump(dest, (blks * BD(dev).bd_sectorsize)); */ return(0); } static int -bd_read(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest) +bd_read(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest) { - return (bd_io(od, dblk, blks, dest, 0)); + return (bd_io(dev, dblk, blks, dest, 0)); } static int -bd_write(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest) +bd_write(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest) { - return (bd_io(od, dblk, blks, dest, 1)); + return (bd_io(dev, dblk, blks, dest, 1)); } /* @@ -842,23 +617,25 @@ bd_getbigeom(int bunit) * IDE disks to be specified in $num_ide_disks. There should be a Better Way. */ int -bd_getdev(struct i386_devdesc *dev) +bd_getdev(struct i386_devdesc *d) { - struct open_disk *od; + struct disk_devdesc *dev; int biosdev; int major; int rootdev; char *nip, *cp; int i, unit; + dev = (struct disk_devdesc *)d; biosdev = bd_unit2bios(dev->d_unit); DEBUG("unit %d BIOS device %d", dev->d_unit, biosdev); if (biosdev == -1) /* not a BIOS device */ return(-1); - if (bd_opendisk(&od, dev) != 0) /* oops, not a viable device */ - return(-1); + if (disk_open(dev, BD(dev).bd_sectors * BD(dev).bd_sectorsize, + BD(dev).bd_sectorsize) != 0) /* oops, not a viable device */ + return (-1); else - bd_closedisk(od); + disk_close(dev); if (biosdev < 0x80) { /* floppy (or emulated floppy) or ATAPI device */ @@ -884,8 +661,7 @@ bd_getdev(struct i386_devdesc *dev) unit = i; } - rootdev = MAKEBOOTDEV(major, dev->d_kind.biosdisk.slice + 1, unit, - dev->d_kind.biosdisk.partition); + rootdev = MAKEBOOTDEV(major, dev->d_slice + 1, unit, dev->d_partition); DEBUG("dev is 0x%x\n", rootdev); return(rootdev); } Modified: user/ae/bootcode/sys/boot/i386/libi386/libi386.h ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/libi386.h Tue Jun 26 10:48:48 2012 (r237596) +++ user/ae/bootcode/sys/boot/i386/libi386/libi386.h Tue Jun 26 10:55:01 2012 (r237597) @@ -45,6 +45,7 @@ struct i386_devdesc void *data; int slice; int partition; + off_t offset; } biosdisk; struct { From owner-svn-src-user@FreeBSD.ORG Tue Jun 26 11:00:34 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C5BC8106564A; Tue, 26 Jun 2012 11:00:34 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B07F78FC0C; Tue, 26 Jun 2012 11:00:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5QB0YGL036185; Tue, 26 Jun 2012 11:00:34 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5QB0YVL036182; Tue, 26 Jun 2012 11:00:34 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206261100.q5QB0YVL036182@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 26 Jun 2012 11:00:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237598 - in user/ae/bootcode/sys/boot/userboot: . userboot X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 11:00:34 -0000 Author: ae Date: Tue Jun 26 11:00:34 2012 New Revision: 237598 URL: http://svn.freebsd.org/changeset/base/237598 Log: Add diskioctl method to the loader_callbacks_v1 structure. It is used to know the disk image and sector size. Also implement this functional in the userboot_disk.c and modify disk_open() call. Modified: user/ae/bootcode/sys/boot/userboot/userboot.h user/ae/bootcode/sys/boot/userboot/userboot/userboot_disk.c Modified: user/ae/bootcode/sys/boot/userboot/userboot.h ============================================================================== --- user/ae/bootcode/sys/boot/userboot/userboot.h Tue Jun 26 10:55:01 2012 (r237597) +++ user/ae/bootcode/sys/boot/userboot/userboot.h Tue Jun 26 11:00:34 2012 (r237598) @@ -175,4 +175,9 @@ struct loader_callbacks_v1 { */ void (*getmem)(void *arg, uint64_t *lowmem, uint64_t *highmem); + /* + * ioctl interface to the disk device + */ + int (*diskioctl)(void *arg, int unit, u_long cmd, + void *data); }; Modified: user/ae/bootcode/sys/boot/userboot/userboot/userboot_disk.c ============================================================================== --- user/ae/bootcode/sys/boot/userboot/userboot/userboot_disk.c Tue Jun 26 10:55:01 2012 (r237597) +++ user/ae/bootcode/sys/boot/userboot/userboot/userboot_disk.c Tue Jun 26 11:00:34 2012 (r237598) @@ -31,11 +31,9 @@ __FBSDID("$FreeBSD$"); * Userboot disk image handling. */ +#include #include - #include -#include - #include #include "disk.h" @@ -48,6 +46,7 @@ static int userdisk_strategy(void *devda size_t size, char *buf, size_t *rsize); static int userdisk_open(struct open_file *f, ...); static int userdisk_close(struct open_file *f); +static int userdisk_ioctl(struct open_file *f, u_long cmd, void *data); static void userdisk_print(int verbose); struct devsw userboot_disk = { @@ -57,7 +56,7 @@ struct devsw userboot_disk = { userdisk_strategy, userdisk_open, userdisk_close, - noioctl, + userdisk_ioctl, userdisk_print, NULL }; @@ -78,20 +77,27 @@ userdisk_init(void) static void userdisk_print(int verbose) { - int i; - char line[80]; - struct disk_devdesc dev; + struct disk_devdesc dev; + char line[80]; + off_t mediasize; + u_int sectorsize; + int i; for (i = 0; i < userboot_disk_maxunit; i++) { sprintf(line, " disk%d: Guest drive image\n", i); pager_output(line); + if (CALLBACK(diskioctl, i, DIOCGSECTORSIZE, §orsize) != 0 || + CALLBACK(diskioctl, i, DIOCGMEDIASIZE, &mediasize) != 0) + continue; dev.d_dev = &userboot_disk; dev.d_unit = i; dev.d_slice = -1; dev.d_partition = -1; - dev.d_offset = 0; - sprintf(line, " disk%d", i); - disk_print(&dev, line, verbose); + if (disk_open(&dev, mediasize, sectorsize) == 0) { + sprintf(line, " disk%d", i); + disk_print(&dev, line, verbose); + disk_close(&dev); + } } } @@ -103,6 +109,9 @@ userdisk_open(struct open_file *f, ...) { va_list ap; struct disk_devdesc *dev; + u_int sectorsize; + off_t mediasize; + int rc; va_start(ap, f); dev = va_arg(ap, struct disk_devdesc *); @@ -111,7 +120,13 @@ userdisk_open(struct open_file *f, ...) if (dev->d_unit < 0 || dev->d_unit >= userboot_disk_maxunit) return (EIO); - return (disk_open(dev)); + rc = CALLBACK(diskioctl, dev->d_unit, DIOCGSECTORSIZE, §orsize); + if (rc != 0) + return (rc); + rc = CALLBACK(diskioctl, dev->d_unit, DIOCGMEDIASIZE, &mediasize); + if (rc != 0) + return (rc); + return (disk_open(dev, mediasize, sectorsize)); } static int @@ -144,3 +159,12 @@ userdisk_strategy(void *devdata, int rw, *rsize = size - resid; return (0); } + +static int +userdisk_ioctl(struct open_file *f, u_long cmd, void *data) +{ + struct disk_devdesc *dev; + + dev = (struct disk_devdesc *)f->f_devdata; + return (CALLBACK(diskioctl, dev->d_unit, cmd, data)); +} From owner-svn-src-user@FreeBSD.ORG Tue Jun 26 11:01:13 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2798B106564A; Tue, 26 Jun 2012 11:01:13 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 130F28FC12; Tue, 26 Jun 2012 11:01:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5QB1CM3036248; Tue, 26 Jun 2012 11:01:12 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5QB1CWc036246; Tue, 26 Jun 2012 11:01:12 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206261101.q5QB1CWc036246@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 26 Jun 2012 11:01:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237599 - user/ae/bootcode/sys/boot/userboot/test X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 11:01:13 -0000 Author: ae Date: Tue Jun 26 11:01:12 2012 New Revision: 237599 URL: http://svn.freebsd.org/changeset/base/237599 Log: Implement diskioctl call in the userboot test programm. Modified: user/ae/bootcode/sys/boot/userboot/test/test.c Modified: user/ae/bootcode/sys/boot/userboot/test/test.c ============================================================================== --- user/ae/bootcode/sys/boot/userboot/test/test.c Tue Jun 26 11:00:34 2012 (r237598) +++ user/ae/bootcode/sys/boot/userboot/test/test.c Tue Jun 26 11:01:12 2012 (r237599) @@ -26,6 +26,8 @@ * $FreeBSD$ */ +#include +#include #include #include #include @@ -251,6 +253,29 @@ test_diskread(void *arg, int unit, uint6 return (0); } +int +test_diskioctl(void *arg, int unit, u_long cmd, void *data) +{ + struct stat sb; + + if (unit != 0 || disk_fd == -1) + return (EBADF); + switch (cmd) { + case DIOCGSECTORSIZE: + *(u_int *)data = 512; + break; + case DIOCGMEDIASIZE: + if (fstat(disk_fd, &sb) == 0) + *(off_t *)data = sb.st_size; + else + return (ENOTTY); + break; + default: + return (ENOTTY); + }; + return (0); +} + /* * Guest virtual machine i/o * @@ -353,6 +378,7 @@ struct loader_callbacks_v1 cb = { .stat = test_stat, .diskread = test_diskread, + .diskioctl = test_diskioctl, .copyin = test_copyin, .copyout = test_copyout, From owner-svn-src-user@FreeBSD.ORG Tue Jun 26 11:14:00 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23BEE106564A; Tue, 26 Jun 2012 11:14:00 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0AC988FC0C; Tue, 26 Jun 2012 11:14:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5QBDxkn036885; Tue, 26 Jun 2012 11:13:59 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5QBDxJn036855; Tue, 26 Jun 2012 11:13:59 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206261113.q5QBDxJn036855@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 26 Jun 2012 11:13:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237600 - in user/ae/bootcode: contrib/gcc crypto/openssh include lib/libc/amd64/sys lib/libc/gen lib/libc/i386/sys lib/libc/include lib/libc/net lib/libc/stdlib lib/libc/stdtime lib/li... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 11:14:00 -0000 Author: ae Date: Tue Jun 26 11:13:58 2012 New Revision: 237600 URL: http://svn.freebsd.org/changeset/base/237600 Log: Sync with head/. Added: user/ae/bootcode/lib/libc/amd64/sys/__vdso_gettc.c - copied unchanged from r237599, head/lib/libc/amd64/sys/__vdso_gettc.c user/ae/bootcode/lib/libc/i386/sys/__vdso_gettc.c - copied unchanged from r237599, head/lib/libc/i386/sys/__vdso_gettc.c user/ae/bootcode/lib/libc/sys/__vdso_gettimeofday.c - copied unchanged from r237599, head/lib/libc/sys/__vdso_gettimeofday.c user/ae/bootcode/lib/libc/sys/clock_gettime.c - copied unchanged from r237599, head/lib/libc/sys/clock_gettime.c user/ae/bootcode/lib/libc/sys/gettimeofday.c - copied unchanged from r237599, head/lib/libc/sys/gettimeofday.c user/ae/bootcode/lib/libz/test/ - copied from r237599, head/lib/libz/test/ user/ae/bootcode/sys/amd64/include/vdso.h - copied unchanged from r237599, head/sys/amd64/include/vdso.h user/ae/bootcode/sys/arm/include/vdso.h - copied unchanged from r237599, head/sys/arm/include/vdso.h user/ae/bootcode/sys/contrib/dev/acpica/common/ahpredef.c - copied unchanged from r237599, head/sys/contrib/dev/acpica/common/ahpredef.c user/ae/bootcode/sys/i386/include/vdso.h - copied unchanged from r237599, head/sys/i386/include/vdso.h user/ae/bootcode/sys/ia64/include/vdso.h - copied unchanged from r237599, head/sys/ia64/include/vdso.h user/ae/bootcode/sys/kern/kern_sharedpage.c - copied unchanged from r237599, head/sys/kern/kern_sharedpage.c user/ae/bootcode/sys/kern/subr_dummy_vdso_tc.c - copied unchanged from r237599, head/sys/kern/subr_dummy_vdso_tc.c user/ae/bootcode/sys/mips/include/vdso.h - copied unchanged from r237599, head/sys/mips/include/vdso.h user/ae/bootcode/sys/pc98/include/vdso.h - copied unchanged from r237599, head/sys/pc98/include/vdso.h user/ae/bootcode/sys/powerpc/include/vdso.h - copied unchanged from r237599, head/sys/powerpc/include/vdso.h user/ae/bootcode/sys/sparc64/include/vdso.h - copied unchanged from r237599, head/sys/sparc64/include/vdso.h user/ae/bootcode/sys/sys/vdso.h - copied unchanged from r237599, head/sys/sys/vdso.h user/ae/bootcode/sys/x86/include/vdso.h - copied unchanged from r237599, head/sys/x86/include/vdso.h Deleted: user/ae/bootcode/lib/libz/example.c user/ae/bootcode/lib/libz/minigzip.c Modified: user/ae/bootcode/contrib/gcc/ChangeLog.gcc43 user/ae/bootcode/contrib/gcc/fold-const.c user/ae/bootcode/contrib/gcc/gimplify.c user/ae/bootcode/contrib/gcc/tree-ssa-ccp.c user/ae/bootcode/contrib/gcc/tree-ssa-pre.c user/ae/bootcode/crypto/openssh/ssh-keyscan.1 user/ae/bootcode/crypto/openssh/ssh-keyscan.c user/ae/bootcode/include/wchar.h user/ae/bootcode/lib/libc/amd64/sys/Makefile.inc user/ae/bootcode/lib/libc/gen/aux.c user/ae/bootcode/lib/libc/gen/syslog.c user/ae/bootcode/lib/libc/i386/sys/Makefile.inc user/ae/bootcode/lib/libc/include/libc_private.h user/ae/bootcode/lib/libc/net/Makefile.inc user/ae/bootcode/lib/libc/stdlib/Makefile.inc user/ae/bootcode/lib/libc/stdlib/strfmon.3 user/ae/bootcode/lib/libc/stdtime/Makefile.inc user/ae/bootcode/lib/libc/stdtime/strftime.3 user/ae/bootcode/lib/libc/stdtime/strptime.3 user/ae/bootcode/lib/libc/string/Makefile.inc user/ae/bootcode/lib/libc/sys/Makefile.inc user/ae/bootcode/lib/libedit/common.c user/ae/bootcode/lib/libedit/editline.3 user/ae/bootcode/lib/libedit/editrc.5 user/ae/bootcode/lib/libedit/el.c user/ae/bootcode/lib/libedit/el.h user/ae/bootcode/lib/libedit/histedit.h user/ae/bootcode/lib/libedit/history.c user/ae/bootcode/lib/libedit/key.c user/ae/bootcode/lib/libedit/key.h user/ae/bootcode/lib/libedit/prompt.c user/ae/bootcode/lib/libedit/prompt.h user/ae/bootcode/lib/libedit/read.c user/ae/bootcode/lib/libedit/refresh.c user/ae/bootcode/lib/libedit/search.c user/ae/bootcode/lib/libedit/sig.c user/ae/bootcode/lib/libedit/sig.h user/ae/bootcode/lib/libedit/term.c user/ae/bootcode/lib/libedit/term.h user/ae/bootcode/lib/libedit/tty.c user/ae/bootcode/lib/libedit/vi.c user/ae/bootcode/lib/libelf/Makefile user/ae/bootcode/lib/libstand/Makefile user/ae/bootcode/lib/libz/ChangeLog user/ae/bootcode/lib/libz/FAQ user/ae/bootcode/lib/libz/FREEBSD-upgrade (contents, props changed) user/ae/bootcode/lib/libz/Makefile (contents, props changed) user/ae/bootcode/lib/libz/README user/ae/bootcode/lib/libz/Symbol.map (contents, props changed) user/ae/bootcode/lib/libz/Versions.def (contents, props changed) user/ae/bootcode/lib/libz/adler32.c user/ae/bootcode/lib/libz/contrib/asm686/match.S (contents, props changed) user/ae/bootcode/lib/libz/crc32.c user/ae/bootcode/lib/libz/crc32.h user/ae/bootcode/lib/libz/deflate.c user/ae/bootcode/lib/libz/deflate.h user/ae/bootcode/lib/libz/doc/algorithm.txt (contents, props changed) user/ae/bootcode/lib/libz/gzguts.h (contents, props changed) user/ae/bootcode/lib/libz/gzlib.c user/ae/bootcode/lib/libz/gzread.c user/ae/bootcode/lib/libz/gzwrite.c user/ae/bootcode/lib/libz/infback.c user/ae/bootcode/lib/libz/inffixed.h user/ae/bootcode/lib/libz/inflate.c user/ae/bootcode/lib/libz/inftrees.c user/ae/bootcode/lib/libz/trees.c user/ae/bootcode/lib/libz/zconf.h user/ae/bootcode/lib/libz/zlib.3 user/ae/bootcode/lib/libz/zlib.h user/ae/bootcode/lib/libz/zopen.c (contents, props changed) user/ae/bootcode/lib/libz/zutil.c user/ae/bootcode/lib/libz/zutil.h user/ae/bootcode/sbin/camcontrol/camcontrol.8 user/ae/bootcode/sbin/camcontrol/camcontrol.c user/ae/bootcode/share/man/man4/Makefile user/ae/bootcode/share/man/man4/acpi_ibm.4 user/ae/bootcode/share/man/man5/passwd.5 user/ae/bootcode/share/man/man9/disk.9 user/ae/bootcode/share/mk/bsd.crunchgen.mk user/ae/bootcode/sys/amd64/amd64/pmap.c user/ae/bootcode/sys/amd64/include/elf.h user/ae/bootcode/sys/arm/at91/at91_machdep.c user/ae/bootcode/sys/arm/at91/at91_twi.c user/ae/bootcode/sys/arm/at91/at91reg.h user/ae/bootcode/sys/arm/include/_stdint.h user/ae/bootcode/sys/arm/include/_types.h user/ae/bootcode/sys/arm/include/elf.h user/ae/bootcode/sys/boot/userboot/libstand/Makefile user/ae/bootcode/sys/cam/cam_periph.c user/ae/bootcode/sys/cam/cam_xpt.c user/ae/bootcode/sys/cam/scsi/scsi_all.c user/ae/bootcode/sys/cam/scsi/scsi_all.h user/ae/bootcode/sys/cam/scsi/scsi_cd.c user/ae/bootcode/sys/cam/scsi/scsi_da.c user/ae/bootcode/sys/cam/scsi/scsi_da.h user/ae/bootcode/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c user/ae/bootcode/sys/conf/files user/ae/bootcode/sys/conf/files.arm user/ae/bootcode/sys/conf/files.ia64 user/ae/bootcode/sys/conf/files.mips user/ae/bootcode/sys/conf/files.powerpc user/ae/bootcode/sys/conf/files.sparc64 user/ae/bootcode/sys/conf/options user/ae/bootcode/sys/contrib/dev/acpica/changes.txt (contents, props changed) user/ae/bootcode/sys/contrib/dev/acpica/common/dmextern.c user/ae/bootcode/sys/contrib/dev/acpica/common/dmrestag.c user/ae/bootcode/sys/contrib/dev/acpica/compiler/aslcompile.c user/ae/bootcode/sys/contrib/dev/acpica/compiler/aslerror.c user/ae/bootcode/sys/contrib/dev/acpica/compiler/aslfiles.c user/ae/bootcode/sys/contrib/dev/acpica/compiler/asllookup.c user/ae/bootcode/sys/contrib/dev/acpica/compiler/aslmain.c user/ae/bootcode/sys/contrib/dev/acpica/compiler/aslsupport.l user/ae/bootcode/sys/contrib/dev/acpica/compiler/aslutils.c user/ae/bootcode/sys/contrib/dev/acpica/compiler/dttemplate.c user/ae/bootcode/sys/contrib/dev/acpica/components/debugger/dbdisply.c user/ae/bootcode/sys/contrib/dev/acpica/components/debugger/dbexec.c user/ae/bootcode/sys/contrib/dev/acpica/components/debugger/dbutils.c user/ae/bootcode/sys/contrib/dev/acpica/components/disassembler/dmopcode.c user/ae/bootcode/sys/contrib/dev/acpica/components/disassembler/dmwalk.c user/ae/bootcode/sys/contrib/dev/acpica/components/dispatcher/dsfield.c user/ae/bootcode/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c user/ae/bootcode/sys/contrib/dev/acpica/components/events/evgpe.c user/ae/bootcode/sys/contrib/dev/acpica/components/events/evgpeutil.c user/ae/bootcode/sys/contrib/dev/acpica/components/events/evxfgpe.c user/ae/bootcode/sys/contrib/dev/acpica/components/executer/exconfig.c user/ae/bootcode/sys/contrib/dev/acpica/components/utilities/utmisc.c user/ae/bootcode/sys/contrib/dev/acpica/include/acdebug.h user/ae/bootcode/sys/contrib/dev/acpica/include/acdisasm.h user/ae/bootcode/sys/contrib/dev/acpica/include/acglobal.h user/ae/bootcode/sys/contrib/dev/acpica/include/aclocal.h user/ae/bootcode/sys/contrib/dev/acpica/include/acpixf.h user/ae/bootcode/sys/contrib/dev/acpica/include/acpredef.h user/ae/bootcode/sys/contrib/dev/acpica/include/acutils.h user/ae/bootcode/sys/dev/acpi_support/acpi_ibm.c user/ae/bootcode/sys/dev/adb/adb_kbd.c user/ae/bootcode/sys/dev/agp/agp_i810.c user/ae/bootcode/sys/dev/ath/ath_dfs/null/dfs_null.c user/ae/bootcode/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c user/ae/bootcode/sys/dev/ath/ath_rate/amrr/amrr.c user/ae/bootcode/sys/dev/ath/ath_rate/onoe/onoe.c user/ae/bootcode/sys/dev/ath/ath_rate/sample/sample.c user/ae/bootcode/sys/dev/ath/if_ath.c user/ae/bootcode/sys/dev/ath/if_ath_ahb.c user/ae/bootcode/sys/dev/ath/if_ath_rx.c user/ae/bootcode/sys/dev/ath/if_ath_tx.c user/ae/bootcode/sys/dev/ath/if_athdfs.h user/ae/bootcode/sys/dev/ath/if_athioctl.h user/ae/bootcode/sys/dev/cxgbe/common/common.h user/ae/bootcode/sys/dev/cxgbe/common/t4_hw.c user/ae/bootcode/sys/dev/cxgbe/common/t4_msg.h user/ae/bootcode/sys/dev/cxgbe/firmware/t4fw_cfg.txt user/ae/bootcode/sys/dev/cxgbe/firmware/t4fw_cfg_uwire.txt user/ae/bootcode/sys/dev/cxgbe/firmware/t4fw_interface.h user/ae/bootcode/sys/dev/cxgbe/osdep.h user/ae/bootcode/sys/dev/cxgbe/t4_main.c user/ae/bootcode/sys/dev/cxgbe/t4_sge.c user/ae/bootcode/sys/dev/cxgbe/tom/t4_cpl_io.c user/ae/bootcode/sys/dev/drm2/drm_pciids.h user/ae/bootcode/sys/dev/isp/isp.c user/ae/bootcode/sys/dev/isp/isp_freebsd.c user/ae/bootcode/sys/dev/isp/isp_freebsd.h user/ae/bootcode/sys/dev/isp/isp_pci.c user/ae/bootcode/sys/dev/isp/ispmbox.h user/ae/bootcode/sys/dev/isp/ispvar.h user/ae/bootcode/sys/dev/mfi/mfi_tbolt.c user/ae/bootcode/sys/dev/mps/mps_sas.c user/ae/bootcode/sys/dev/mpt/mpt_cam.c user/ae/bootcode/sys/dev/re/if_re.c user/ae/bootcode/sys/dev/twa/tw_osl_cam.c user/ae/bootcode/sys/dev/xen/blkfront/blkfront.c user/ae/bootcode/sys/geom/geom.h user/ae/bootcode/sys/geom/geom_disk.c user/ae/bootcode/sys/geom/geom_disk.h user/ae/bootcode/sys/geom/geom_subr.c user/ae/bootcode/sys/i386/i386/elf_machdep.c user/ae/bootcode/sys/i386/i386/machdep.c user/ae/bootcode/sys/i386/include/elf.h user/ae/bootcode/sys/i386/include/vmparam.h user/ae/bootcode/sys/ia64/include/_stdint.h user/ae/bootcode/sys/ia64/include/_types.h user/ae/bootcode/sys/ia64/include/elf.h user/ae/bootcode/sys/kern/imgact_elf.c user/ae/bootcode/sys/kern/kern_exec.c user/ae/bootcode/sys/kern/kern_tc.c user/ae/bootcode/sys/kern/subr_firmware.c user/ae/bootcode/sys/mips/include/_stdint.h user/ae/bootcode/sys/mips/include/_types.h user/ae/bootcode/sys/mips/include/elf.h user/ae/bootcode/sys/mips/mips/pmap.c user/ae/bootcode/sys/modules/rdma/krping/Makefile user/ae/bootcode/sys/modules/toecore/Makefile user/ae/bootcode/sys/net80211/ieee80211_output.c user/ae/bootcode/sys/netinet/ipfw/ip_fw_table.c user/ae/bootcode/sys/netinet/sctp_bsd_addr.c user/ae/bootcode/sys/netinet/sctp_bsd_addr.h user/ae/bootcode/sys/netinet/sctp_indata.c user/ae/bootcode/sys/netinet/sctp_input.c user/ae/bootcode/sys/netinet/sctp_os_bsd.h user/ae/bootcode/sys/netinet/sctp_output.c user/ae/bootcode/sys/netinet/sctp_output.h user/ae/bootcode/sys/netinet/sctp_sysctl.c user/ae/bootcode/sys/netinet/sctp_sysctl.h user/ae/bootcode/sys/netinet/sctp_usrreq.c user/ae/bootcode/sys/netinet/sctputil.c user/ae/bootcode/sys/netinet6/in6.c user/ae/bootcode/sys/netinet6/in6_src.c user/ae/bootcode/sys/netinet6/sctp6_usrreq.c user/ae/bootcode/sys/ofed/include/linux/workqueue.h user/ae/bootcode/sys/powerpc/include/_stdint.h user/ae/bootcode/sys/powerpc/include/_types.h user/ae/bootcode/sys/powerpc/include/elf.h user/ae/bootcode/sys/sparc64/include/_stdint.h user/ae/bootcode/sys/sparc64/include/_types.h user/ae/bootcode/sys/sparc64/include/elf.h user/ae/bootcode/sys/sys/_types.h user/ae/bootcode/sys/sys/stdint.h user/ae/bootcode/sys/sys/sysent.h user/ae/bootcode/sys/vm/vm_object.h user/ae/bootcode/sys/x86/include/_stdint.h user/ae/bootcode/sys/x86/include/_types.h user/ae/bootcode/sys/x86/x86/tsc.c user/ae/bootcode/tools/tools/net80211/w00t/redir/buddy.c user/ae/bootcode/tools/tools/net80211/wesside/dics/dics.c user/ae/bootcode/usr.bin/minigzip/Makefile user/ae/bootcode/usr.sbin/acpi/iasl/Makefile user/ae/bootcode/usr.sbin/crunch/crunchgen/crunchgen.c Directory Properties: user/ae/bootcode/ (props changed) user/ae/bootcode/contrib/gcc/ (props changed) user/ae/bootcode/crypto/openssh/ (props changed) user/ae/bootcode/lib/libc/ (props changed) user/ae/bootcode/lib/libc/stdtime/ (props changed) user/ae/bootcode/lib/libz/ (props changed) user/ae/bootcode/lib/libz/contrib/ (props changed) user/ae/bootcode/lib/libz/contrib/README.contrib (props changed) user/ae/bootcode/lib/libz/contrib/asm686/ (props changed) user/ae/bootcode/lib/libz/contrib/asm686/README.686 (props changed) user/ae/bootcode/lib/libz/contrib/gcc_gvmat64/ (props changed) user/ae/bootcode/lib/libz/contrib/gcc_gvmat64/gvmat64.S (props changed) user/ae/bootcode/lib/libz/doc/ (props changed) user/ae/bootcode/lib/libz/doc/rfc1950.txt (props changed) user/ae/bootcode/lib/libz/doc/rfc1951.txt (props changed) user/ae/bootcode/lib/libz/doc/rfc1952.txt (props changed) user/ae/bootcode/lib/libz/doc/txtvsbin.txt (props changed) user/ae/bootcode/lib/libz/gzclose.c (props changed) user/ae/bootcode/sbin/ (props changed) user/ae/bootcode/share/man/man4/ (props changed) user/ae/bootcode/sys/ (props changed) user/ae/bootcode/sys/boot/ (props changed) user/ae/bootcode/sys/cddl/contrib/opensolaris/ (props changed) user/ae/bootcode/sys/conf/ (props changed) user/ae/bootcode/sys/contrib/dev/acpica/ (props changed) user/ae/bootcode/sys/contrib/dev/acpica/common/ (props changed) user/ae/bootcode/sys/contrib/dev/acpica/compiler/ (props changed) user/ae/bootcode/sys/contrib/dev/acpica/components/debugger/ (props changed) user/ae/bootcode/sys/contrib/dev/acpica/components/disassembler/ (props changed) user/ae/bootcode/sys/contrib/dev/acpica/components/dispatcher/ (props changed) user/ae/bootcode/sys/contrib/dev/acpica/components/events/ (props changed) user/ae/bootcode/sys/contrib/dev/acpica/components/executer/ (props changed) user/ae/bootcode/sys/contrib/dev/acpica/components/utilities/ (props changed) user/ae/bootcode/sys/contrib/dev/acpica/include/ (props changed) Modified: user/ae/bootcode/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- user/ae/bootcode/contrib/gcc/ChangeLog.gcc43 Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/contrib/gcc/ChangeLog.gcc43 Tue Jun 26 11:13:58 2012 (r237600) @@ -5,6 +5,18 @@ with SSE3 instruction set support. * doc/invoke.texi: Likewise. +2007-04-12 Richard Guenther (r123736) + + PR tree-optimization/24689 + PR tree-optimization/31307 + * fold-const.c (operand_equal_p): Compare INTEGER_CST array + indices by value. + * gimplify.c (canonicalize_addr_expr): To be consistent with + gimplify_compound_lval only set operands two and three of + ARRAY_REFs if they are not gimple_min_invariant. This makes + it never at this place. + * tree-ssa-ccp.c (maybe_fold_offset_to_array_ref): Likewise. + 2007-04-07 H.J. Lu (r123639) * config/i386/i386.c (ix86_handle_option): Handle SSSE3. @@ -96,7 +108,7 @@ * doc/invoke.texi: Add entry about geode processor. -2006-10-24 Richard Guenther +2006-10-24 Richard Guenther (r118001) PR middle-end/28796 * builtins.c (fold_builtin_classify): Use HONOR_INFINITIES @@ -170,7 +182,13 @@ * doc/invoke.texi: Document -mssse3/-mno-ssse3 switches. -2006-10-21 Richard Guenther +2006-10-21 Richard Guenther (r117932) + + PR tree-optimization/3511 + * tree-ssa-pre.c (phi_translate): Fold CALL_EXPRs that + got new invariant arguments during PHI translation. + +2006-10-21 Richard Guenther (r117929) * builtins.c (fold_builtin_classify): Fix typo. Modified: user/ae/bootcode/contrib/gcc/fold-const.c ============================================================================== --- user/ae/bootcode/contrib/gcc/fold-const.c Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/contrib/gcc/fold-const.c Tue Jun 26 11:13:58 2012 (r237600) @@ -2802,9 +2802,13 @@ operand_equal_p (tree arg0, tree arg1, u case ARRAY_REF: case ARRAY_RANGE_REF: - /* Operands 2 and 3 may be null. */ + /* Operands 2 and 3 may be null. + Compare the array index by value if it is constant first as we + may have different types but same value here. */ return (OP_SAME (0) - && OP_SAME (1) + && (tree_int_cst_equal (TREE_OPERAND (arg0, 1), + TREE_OPERAND (arg1, 1)) + || OP_SAME (1)) && OP_SAME_WITH_NULL (2) && OP_SAME_WITH_NULL (3)); Modified: user/ae/bootcode/contrib/gcc/gimplify.c ============================================================================== --- user/ae/bootcode/contrib/gcc/gimplify.c Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/contrib/gcc/gimplify.c Tue Jun 26 11:13:58 2012 (r237600) @@ -1600,9 +1600,7 @@ canonicalize_addr_expr (tree *expr_p) /* All checks succeeded. Build a new node to merge the cast. */ *expr_p = build4 (ARRAY_REF, dctype, obj_expr, TYPE_MIN_VALUE (TYPE_DOMAIN (datype)), - TYPE_MIN_VALUE (TYPE_DOMAIN (datype)), - size_binop (EXACT_DIV_EXPR, TYPE_SIZE_UNIT (dctype), - size_int (TYPE_ALIGN_UNIT (dctype)))); + NULL_TREE, NULL_TREE); *expr_p = build1 (ADDR_EXPR, ctype, *expr_p); } Modified: user/ae/bootcode/contrib/gcc/tree-ssa-ccp.c ============================================================================== --- user/ae/bootcode/contrib/gcc/tree-ssa-ccp.c Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/contrib/gcc/tree-ssa-ccp.c Tue Jun 26 11:13:58 2012 (r237600) @@ -1621,9 +1621,7 @@ maybe_fold_offset_to_array_ref (tree bas if (!integer_zerop (elt_offset)) idx = int_const_binop (PLUS_EXPR, idx, elt_offset, 0); - return build4 (ARRAY_REF, orig_type, base, idx, min_idx, - size_int (tree_low_cst (elt_size, 1) - / (TYPE_ALIGN_UNIT (elt_type)))); + return build4 (ARRAY_REF, orig_type, base, idx, NULL_TREE, NULL_TREE); } Modified: user/ae/bootcode/contrib/gcc/tree-ssa-pre.c ============================================================================== --- user/ae/bootcode/contrib/gcc/tree-ssa-pre.c Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/contrib/gcc/tree-ssa-pre.c Tue Jun 26 11:13:58 2012 (r237600) @@ -1076,6 +1076,7 @@ phi_translate (tree expr, value_set_t se tree newexpr; tree vh = get_value_handle (expr); bool listchanged = false; + bool invariantarg = false; VEC (tree, gc) *vuses = VALUE_HANDLE_VUSES (vh); VEC (tree, gc) *tvuses; @@ -1134,10 +1135,26 @@ phi_translate (tree expr, value_set_t se if (newval != oldval) { listchanged = true; + invariantarg |= is_gimple_min_invariant (newval); TREE_VALUE (newwalker) = get_value_handle (newval); } } } + + /* In case of new invariant args we might try to fold the call + again. */ + if (invariantarg) + { + tree tmp = fold_ternary (CALL_EXPR, TREE_TYPE (expr), + newop0, newarglist, newop2); + if (tmp) + { + STRIP_TYPE_NOPS (tmp); + if (is_gimple_min_invariant (tmp)) + return tmp; + } + } + if (listchanged) vn_lookup_or_add (newarglist, NULL); Modified: user/ae/bootcode/crypto/openssh/ssh-keyscan.1 ============================================================================== --- user/ae/bootcode/crypto/openssh/ssh-keyscan.1 Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/crypto/openssh/ssh-keyscan.1 Tue Jun 26 11:13:58 2012 (r237600) @@ -1,4 +1,4 @@ -.\" $OpenBSD: ssh-keyscan.1,v 1.29 2010/08/31 11:54:45 djm Exp $ +.\" $OpenBSD: ssh-keyscan.1,v 1.30 2012/04/11 13:34:17 djm Exp $ .\" $FreeBSD$ .\" .\" Copyright 1995, 1996 by David Mazieres . @@ -7,7 +7,7 @@ .\" permitted provided that due credit is given to the author and the .\" OpenBSD project by leaving this copyright notice intact. .\" -.Dd August 31, 2010 +.Dd April 11 2012 .Dt SSH-KEYSCAN 1 .Os .Sh NAME @@ -95,8 +95,11 @@ or .Dq rsa for protocol version 2. Multiple values may be specified by separating them with commas. -The default is -.Dq rsa . +The default is to fetch +.Dq rsa +and +.Dq ecdsa +keys. .It Fl v Verbose mode. Causes Modified: user/ae/bootcode/crypto/openssh/ssh-keyscan.c ============================================================================== --- user/ae/bootcode/crypto/openssh/ssh-keyscan.c Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/crypto/openssh/ssh-keyscan.c Tue Jun 26 11:13:58 2012 (r237600) @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-keyscan.c,v 1.85 2011/03/15 10:36:02 okan Exp $ */ +/* $OpenBSD: ssh-keyscan.c,v 1.86 2012/04/11 13:34:17 djm Exp $ */ /* * Copyright 1995, 1996 by David Mazieres . * @@ -57,7 +57,7 @@ int ssh_port = SSH_DEFAULT_PORT; #define KT_RSA 4 #define KT_ECDSA 8 -int get_keytypes = KT_RSA; /* Get only RSA keys by default */ +int get_keytypes = KT_RSA|KT_ECDSA;/* Get RSA and ECDSA keys by default */ int hash_hosts = 0; /* Hash hostname on output */ Modified: user/ae/bootcode/include/wchar.h ============================================================================== --- user/ae/bootcode/include/wchar.h Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/include/wchar.h Tue Jun 26 11:13:58 2012 (r237600) @@ -88,10 +88,8 @@ typedef __wint_t wint_t; #define _WINT_T_DECLARED #endif -#ifndef WCHAR_MIN -#define WCHAR_MIN __INT_MIN -#define WCHAR_MAX __INT_MAX -#endif +#define WCHAR_MIN __WCHAR_MIN +#define WCHAR_MAX __WCHAR_MAX #ifndef WEOF #define WEOF ((wint_t)-1) Modified: user/ae/bootcode/lib/libc/amd64/sys/Makefile.inc ============================================================================== --- user/ae/bootcode/lib/libc/amd64/sys/Makefile.inc Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/lib/libc/amd64/sys/Makefile.inc Tue Jun 26 11:13:58 2012 (r237600) @@ -1,7 +1,8 @@ # from: Makefile.inc,v 1.1 1993/09/03 19:04:23 jtc Exp # $FreeBSD$ -SRCS+= amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c amd64_set_gsbase.c +SRCS+= amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c \ + amd64_set_gsbase.c __vdso_gettc.c MDASM= vfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ reboot.S sbrk.S setlogin.S sigreturn.S Copied: user/ae/bootcode/lib/libc/amd64/sys/__vdso_gettc.c (from r237599, head/lib/libc/amd64/sys/__vdso_gettc.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ae/bootcode/lib/libc/amd64/sys/__vdso_gettc.c Tue Jun 26 11:13:58 2012 (r237600, copy of r237599, head/lib/libc/amd64/sys/__vdso_gettc.c) @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +static u_int +__vdso_gettc_low(const struct vdso_timehands *th) +{ + uint32_t rv; + + __asm __volatile("rdtsc; shrd %%cl, %%edx, %0" + : "=a" (rv) : "c" (th->th_x86_shift) : "edx"); + return (rv); +} + +u_int +__vdso_gettc(const struct vdso_timehands *th) +{ + + return (th->th_x86_shift > 0 ? __vdso_gettc_low(th) : rdtsc32()); +} Modified: user/ae/bootcode/lib/libc/gen/aux.c ============================================================================== --- user/ae/bootcode/lib/libc/gen/aux.c Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/lib/libc/gen/aux.c Tue Jun 26 11:13:58 2012 (r237600) @@ -66,6 +66,7 @@ __init_elf_aux_vector(void) static pthread_once_t aux_once = PTHREAD_ONCE_INIT; static int pagesize, osreldate, canary_len, ncpus, pagesizes_len; static char *canary, *pagesizes; +static void *timekeep; static void init_aux(void) @@ -101,6 +102,10 @@ init_aux(void) case AT_NCPUS: ncpus = aux->a_un.a_val; break; + + case AT_TIMEKEEP: + timekeep = aux->a_un.a_ptr; + break; } } } @@ -163,6 +168,16 @@ _elf_aux_info(int aux, void *buf, int bu } else res = EINVAL; break; + case AT_TIMEKEEP: + if (buflen == sizeof(void *)) { + if (timekeep != NULL) { + *(void **)buf = timekeep; + res = 0; + } else + res = ENOENT; + } else + res = EINVAL; + break; default: res = ENOENT; break; Modified: user/ae/bootcode/lib/libc/gen/syslog.c ============================================================================== --- user/ae/bootcode/lib/libc/gen/syslog.c Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/lib/libc/gen/syslog.c Tue Jun 26 11:13:58 2012 (r237600) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -414,7 +413,6 @@ void closelog(void) { THREAD_LOCK(); - assert(LogFile >= -1); if (LogFile != -1) { (void)_close(LogFile); LogFile = -1; Modified: user/ae/bootcode/lib/libc/i386/sys/Makefile.inc ============================================================================== --- user/ae/bootcode/lib/libc/i386/sys/Makefile.inc Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/lib/libc/i386/sys/Makefile.inc Tue Jun 26 11:13:58 2012 (r237600) @@ -5,7 +5,8 @@ SRCS+= i386_clr_watch.c i386_set_watch.c i386_vm86.c .endif SRCS+= i386_get_fsbase.c i386_get_gsbase.c i386_get_ioperm.c i386_get_ldt.c \ - i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c + i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c \ + __vdso_gettc.c MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ reboot.S sbrk.S setlogin.S sigreturn.S syscall.S Copied: user/ae/bootcode/lib/libc/i386/sys/__vdso_gettc.c (from r237599, head/lib/libc/i386/sys/__vdso_gettc.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ae/bootcode/lib/libc/i386/sys/__vdso_gettc.c Tue Jun 26 11:13:58 2012 (r237600, copy of r237599, head/lib/libc/i386/sys/__vdso_gettc.c) @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +static u_int +__vdso_gettc_low(const struct vdso_timehands *th) +{ + uint32_t rv; + + __asm __volatile("rdtsc; shrd %%cl, %%edx, %0" + : "=a" (rv) : "c" (th->th_x86_shift) : "edx"); + return (rv); +} + +#pragma weak __vdso_gettc +u_int +__vdso_gettc(const struct vdso_timehands *th) +{ + + return (th->th_x86_shift > 0 ? __vdso_gettc_low(th) : rdtsc32()); +} Modified: user/ae/bootcode/lib/libc/include/libc_private.h ============================================================================== --- user/ae/bootcode/lib/libc/include/libc_private.h Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/lib/libc/include/libc_private.h Tue Jun 26 11:13:58 2012 (r237600) @@ -34,6 +34,7 @@ #ifndef _LIBC_PRIVATE_H_ #define _LIBC_PRIVATE_H_ +#include #include /* @@ -245,6 +246,12 @@ extern void * __sys_freebsd6_mmap(void * /* Without back-compat translation */ extern int __sys_fcntl(int, int, ...); +struct timespec; +struct timeval; +struct timezone; +int __sys_gettimeofday(struct timeval *, struct timezone *); +int __sys_clock_gettime(__clockid_t, struct timespec *ts); + /* execve() with PATH processing to implement posix_spawnp() */ int _execvpe(const char *, char * const *, char * const *); Modified: user/ae/bootcode/lib/libc/net/Makefile.inc ============================================================================== --- user/ae/bootcode/lib/libc/net/Makefile.inc Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/lib/libc/net/Makefile.inc Tue Jun 26 11:13:58 2012 (r237600) @@ -36,7 +36,7 @@ LFLAGS+=-P_nsyy CLEANFILES+=nslexer.c -nslexer.c: nslexer.l +nslexer.c: nslexer.l nsparser.h ${LEX} ${LFLAGS} -o/dev/stdout ${.IMPSRC} | \ sed -e '/YY_BUF_SIZE/s/16384/1024/' >${.TARGET} Modified: user/ae/bootcode/lib/libc/stdlib/Makefile.inc ============================================================================== --- user/ae/bootcode/lib/libc/stdlib/Makefile.inc Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/lib/libc/stdlib/Makefile.inc Tue Jun 26 11:13:58 2012 (r237600) @@ -42,6 +42,7 @@ MLINKS+=rand.3 rand_r.3 rand.3 srand.3 r MLINKS+=random.3 initstate.3 random.3 setstate.3 random.3 srandom.3 \ random.3 srandomdev.3 MLINKS+=radixsort.3 sradixsort.3 +MLINKS+=strfmon.3 strfmon_l.3 MLINKS+=strtod.3 strtof.3 strtod.3 strtold.3 MLINKS+=strtol.3 strtoll.3 strtol.3 strtoq.3 strtol.3 strtoimax.3 MLINKS+=strtoul.3 strtoull.3 strtoul.3 strtouq.3 strtoul.3 strtoumax.3 Modified: user/ae/bootcode/lib/libc/stdlib/strfmon.3 ============================================================================== --- user/ae/bootcode/lib/libc/stdlib/strfmon.3 Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/lib/libc/stdlib/strfmon.3 Tue Jun 26 11:13:58 2012 (r237600) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 12, 2002 +.Dd June 25, 2012 .Dt STRFMON 3 .Os .Sh NAME @@ -36,6 +36,8 @@ .In monetary.h .Ft ssize_t .Fn strfmon "char * restrict s" "size_t maxsize" "const char * restrict format" "..." +.Ft ssize_t +.Fn strfmon_l "char * restrict s" "size_t maxsize" "locale_t loc" "const char * restrict format" "..." .Sh DESCRIPTION The .Fn strfmon @@ -47,6 +49,12 @@ No more than .Fa maxsize bytes are placed into the array. .Pp +The +.Fn strfmon_l +function does the same as +.Fn strfmon +but takes an explicit locale rather than using the current locale. +.Pp The format string is composed of zero or more directives: ordinary characters (not .Cm % ) , @@ -129,6 +137,11 @@ the contents of the array are indetermin and .Va errno is set to indicate the error. +.Pp +The +.Fn strfmon_l +function returns the same values as +.Fn strfmon . .Sh ERRORS The .Fn strfmon @@ -149,6 +162,10 @@ The function conforms to .St -p1003.1-2001 . +The +.Fn strfmon_l +function conforms to +.St -p1003.1-2008 . .Sh AUTHORS .An -nosplit The Modified: user/ae/bootcode/lib/libc/stdtime/Makefile.inc ============================================================================== --- user/ae/bootcode/lib/libc/stdtime/Makefile.inc Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/lib/libc/stdtime/Makefile.inc Tue Jun 26 11:13:58 2012 (r237600) @@ -18,4 +18,6 @@ MLINKS+=ctime.3 asctime.3 ctime.3 diffti ctime.3 localtime.3 ctime.3 mktime.3 ctime.3 timegm.3 \ ctime.3 ctime_r.3 ctime.3 localtime_r.3 ctime.3 gmtime_r.3 \ ctime.3 asctime_r.3 +MLINKS+=strftime.3 strftime_l.3 +MLINKS+=strptime.3 strptime_l.3 MLINKS+=time2posix.3 posix2time.3 Modified: user/ae/bootcode/lib/libc/stdtime/strftime.3 ============================================================================== --- user/ae/bootcode/lib/libc/stdtime/strftime.3 Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/lib/libc/stdtime/strftime.3 Tue Jun 26 11:13:58 2012 (r237600) @@ -32,7 +32,7 @@ .\" @(#)strftime.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd November 4, 2004 +.Dd June 25, 2012 .Dt STRFTIME 3 .Os .Sh NAME @@ -49,6 +49,8 @@ .Fa "const char * restrict format" .Fa "const struct tm * restrict timeptr" .Fc +.Ft size_t +.Fn strftime_l "char *restrict buf" "size_t maxsize" "const char * restrict format" "const struct tm *restrict timeptr" "locale_t loc" .Sh DESCRIPTION The .Fn strftime @@ -58,6 +60,11 @@ into the buffer .Fa buf according to the string pointed to by .Fa format . +The function +.Fn strftime_l +does the same as +.Fn strftime +but takes an explicit locale rather than using the current locale. .Pp The .Fa format @@ -268,6 +275,10 @@ The peculiar week number and year in the and .Ql \&%V are defined in ISO 8601: 1988. +The +.Fn strftime_l +function conforms to +.St -p1003.1-2008 . .Sh BUGS There is no conversion specification for the phase of the moon. .Pp Modified: user/ae/bootcode/lib/libc/stdtime/strptime.3 ============================================================================== --- user/ae/bootcode/lib/libc/stdtime/strptime.3 Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/lib/libc/stdtime/strptime.3 Tue Jun 26 11:13:58 2012 (r237600) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" " -.Dd January 4, 2003 +.Dd June 25, 2012 .Dt STRPTIME 3 .Os .Sh NAME @@ -41,6 +41,10 @@ .Fa "const char * restrict format" .Fa "struct tm * restrict timeptr" .Fc +.In time.h +.In xlocale.h +.Ft char * +.Fn strptime_l "const char * restrict buf" "const char * restrict format" "struct tm * restrict timeptr" "locale_t loc" .Sh DESCRIPTION The .Fn strptime @@ -53,6 +57,11 @@ and fills in the elements of the structu The resulting values will be relative to the local time zone. Thus, it can be considered the reverse operation of .Xr strftime 3 . +The +.Fn strptime_l +function does the same as +.Fn strptime , +but takes an explicit locale rather than using the current locale. .Pp The .Fa format @@ -104,6 +113,9 @@ that has not been required to satisfy th It returns .Dv NULL if one of the conversions failed. +.Fn strptime_l +returns the same values as +.Fn strptime . .Sh SEE ALSO .Xr date 1 , .Xr scanf 3 , Modified: user/ae/bootcode/lib/libc/string/Makefile.inc ============================================================================== --- user/ae/bootcode/lib/libc/string/Makefile.inc Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/lib/libc/string/Makefile.inc Tue Jun 26 11:13:58 2012 (r237600) @@ -42,10 +42,13 @@ MLINKS+=ffs.3 ffsl.3 \ ffs.3 flsll.3 MLINKS+=index.3 rindex.3 MLINKS+=memchr.3 memrchr.3 -MLINKS+=strcasecmp.3 strncasecmp.3 +MLINKS+=strcasecmp.3 strncasecmp.3 \ + strcasecmp.3 strcasecmp_l.3 \ + strcasecmp.3 strncasecmp_l.3 MLINKS+=strcat.3 strncat.3 MLINKS+=strchr.3 strrchr.3 MLINKS+=strcmp.3 strncmp.3 +MLINKS+=strcoll.3 strcoll_l.3 MLINKS+=strcpy.3 stpcpy.3 \ strcpy.3 stpncpy.3 \ strcpy.3 strncpy.3 @@ -57,8 +60,10 @@ MLINKS+=strerror.3 perror.3 \ MLINKS+=strlcpy.3 strlcat.3 MLINKS+=strlen.3 strnlen.3 MLINKS+=strstr.3 strcasestr.3 \ - strstr.3 strnstr.3 + strstr.3 strnstr.3 \ + strstr.3 strcasestr_l.3 MLINKS+=strtok.3 strtok_r.3 +MLINKS+=strxfrm.3 strxfrm_l.3 MLINKS+=wmemchr.3 wcpcpy.3 \ wmemchr.3 wcpncpy.3 \ wmemchr.3 wcscasecmp.3 \ Modified: user/ae/bootcode/lib/libc/sys/Makefile.inc ============================================================================== --- user/ae/bootcode/lib/libc/sys/Makefile.inc Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/lib/libc/sys/Makefile.inc Tue Jun 26 11:13:58 2012 (r237600) @@ -15,6 +15,10 @@ # .sinclude "${.CURDIR}/${LIBC_ARCH}/sys/Makefile.inc" +SRCS+= clock_gettime.c gettimeofday.c __vdso_gettimeofday.c +NOASM+= clock_gettime.o gettimeofday.o +PSEUDO+= _clock_gettime.o _gettimeofday.o + # Sources common to both syscall interfaces: SRCS+= stack_protector.c stack_protector_compat.c __error.c .if !defined(WITHOUT_SYSCALL_COMPAT) Copied: user/ae/bootcode/lib/libc/sys/__vdso_gettimeofday.c (from r237599, head/lib/libc/sys/__vdso_gettimeofday.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ae/bootcode/lib/libc/sys/__vdso_gettimeofday.c Tue Jun 26 11:13:58 2012 (r237600, copy of r237599, head/lib/libc/sys/__vdso_gettimeofday.c) @@ -0,0 +1,142 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include "libc_private.h" + +static u_int +tc_delta(const struct vdso_timehands *th) +{ + + return ((__vdso_gettc(th) - th->th_offset_count) & + th->th_counter_mask); +} + +static int +binuptime(struct bintime *bt, struct vdso_timekeep *tk, int abs) +{ + struct vdso_timehands *th; + uint32_t curr, gen; + + do { + if (!tk->tk_enabled) + return (ENOSYS); + + /* + * XXXKIB. The load of tk->tk_current should use + * atomic_load_acq_32 to provide load barrier. But + * since tk points to r/o mapped page, x86 + * implementation of atomic_load_acq faults. + */ + curr = tk->tk_current; + rmb(); + th = &tk->tk_th[curr]; + if (th->th_algo != VDSO_TH_ALGO_1) + return (ENOSYS); + gen = th->th_gen; + *bt = th->th_offset; + bintime_addx(bt, th->th_scale * tc_delta(th)); + if (abs) + bintime_add(bt, &th->th_boottime); + + /* + * Barrier for load of both tk->tk_current and th->th_gen. + */ + rmb(); + } while (curr != tk->tk_current || gen == 0 || gen != th->th_gen); + return (0); +} + +static struct vdso_timekeep *tk; + +int +__vdso_gettimeofday(struct timeval *tv, struct timezone *tz) +{ + struct bintime bt; + int error; + + if (tz != NULL) + return (ENOSYS); + if (tk == NULL) { + error = _elf_aux_info(AT_TIMEKEEP, &tk, sizeof(tk)); + if (error != 0 || tk == NULL) + return (ENOSYS); + } + if (tk->tk_ver != VDSO_TK_VER_CURR) + return (ENOSYS); + error = binuptime(&bt, tk, 1); + if (error != 0) + return (error); + bintime2timeval(&bt, tv); + return (0); +} + +int +__vdso_clock_gettime(clockid_t clock_id, struct timespec *ts) +{ + struct bintime bt; + int abs, error; + + if (tk == NULL) { + error = _elf_aux_info(AT_TIMEKEEP, &tk, sizeof(tk)); + if (error != 0 || tk == NULL) + return (ENOSYS); + } + if (tk->tk_ver != VDSO_TK_VER_CURR) + return (ENOSYS); + switch (clock_id) { + case CLOCK_REALTIME: + case CLOCK_REALTIME_PRECISE: + case CLOCK_REALTIME_FAST: + case CLOCK_SECOND: + abs = 1; + break; + case CLOCK_MONOTONIC: + case CLOCK_MONOTONIC_PRECISE: + case CLOCK_MONOTONIC_FAST: + case CLOCK_UPTIME: + case CLOCK_UPTIME_PRECISE: + case CLOCK_UPTIME_FAST: + abs = 0; + break; + default: + return (ENOSYS); + } + error = binuptime(&bt, tk, abs); + if (error != 0) + return (error); + bintime2timespec(&bt, ts); + if (clock_id == CLOCK_SECOND) + ts->tv_nsec = 0; + return (0); +} Copied: user/ae/bootcode/lib/libc/sys/clock_gettime.c (from r237599, head/lib/libc/sys/clock_gettime.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ae/bootcode/lib/libc/sys/clock_gettime.c Tue Jun 26 11:13:58 2012 (r237600, copy of r237599, head/lib/libc/sys/clock_gettime.c) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include "libc_private.h" + +int __clock_gettime(clockid_t, struct timespec *ts); + +__weak_reference(__clock_gettime, clock_gettime); + +int +__clock_gettime(clockid_t clock_id, struct timespec *ts) +{ + int error; + + if (__vdso_clock_gettime != NULL && __vdso_gettc != NULL) + error = __vdso_clock_gettime(clock_id, ts); + else + error = ENOSYS; + if (error == ENOSYS) + error = __sys_clock_gettime(clock_id, ts); + return (error); +} Copied: user/ae/bootcode/lib/libc/sys/gettimeofday.c (from r237599, head/lib/libc/sys/gettimeofday.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ae/bootcode/lib/libc/sys/gettimeofday.c Tue Jun 26 11:13:58 2012 (r237600, copy of r237599, head/lib/libc/sys/gettimeofday.c) @@ -0,0 +1,51 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include "libc_private.h" + +int __gettimeofday(struct timeval *tv, struct timezone *tz); + +__weak_reference(__gettimeofday, gettimeofday); + +int +__gettimeofday(struct timeval *tv, struct timezone *tz) +{ + int error; + + if (__vdso_gettimeofday != NULL && __vdso_gettc != NULL) + error = __vdso_gettimeofday(tv, tz); + else + error = ENOSYS; + if (error == ENOSYS) + error = __sys_gettimeofday(tv, tz); + return (error); +} Modified: user/ae/bootcode/lib/libedit/common.c ============================================================================== --- user/ae/bootcode/lib/libedit/common.c Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/lib/libedit/common.c Tue Jun 26 11:13:58 2012 (r237600) @@ -905,7 +905,7 @@ ed_command(EditLine *el, int c __unused) int tmplen; tmplen = c_gets(el, tmpbuf, "\n: "); - term__putc('\n'); + term__putc(el, '\n'); if (tmplen < 0 || (tmpbuf[tmplen] = 0, parse_line(el, tmpbuf)) == -1) term_beep(el); Modified: user/ae/bootcode/lib/libedit/editline.3 ============================================================================== --- user/ae/bootcode/lib/libedit/editline.3 Tue Jun 26 11:01:12 2012 (r237599) +++ user/ae/bootcode/lib/libedit/editline.3 Tue Jun 26 11:13:58 2012 (r237600) @@ -1,4 +1,4 @@ -.\" $NetBSD: editline.3,v 1.55 2007/01/12 16:31:13 christos Exp $ +.\" $NetBSD: editline.3,v 1.70 2009/07/05 21:55:24 perry Exp $ .\" .\" Copyright (c) 1997-2003 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 12, 2007 +.Dd July 5, 2009 .Dt EDITLINE 3 .Os .Sh NAME @@ -162,6 +162,14 @@ is modified to contain the number of cha Returns the line read if successful, or .Dv NULL if no characters were read or if an error occurred. +If an error occurred, +.Fa count +is set to \-1 and +.Dv errno +contains the error code that caused it. +The return value may not remain valid across calls to +.Fn el_gets +and must be copied if the data is to be retained. .It Fn el_getc Read a character from the tty. .Fa ch @@ -222,10 +230,30 @@ are supported, along with the required a Define prompt printing function as .Fa f , which is to return a string that contains the prompt. +.It Dv EL_PROMPT_ESC , Fa "char *(*f)(EditLine *)" , Fa "char c" +Same as +.Dv EL_PROMPT , +but the +.Fa c +argument indicates the start/stop literal prompt character. +.Pp +If a start/stop literal character is found in the prompt, the +character itself +is not printed, but characters after it are printed directly to the +terminal without affecting the state of the current line. +A subsequent second start/stop literal character ends this behavior. +This is typically used to embed literal escape sequences that change the +color/style of the terminal in the prompt. +.Dv 0 +unsets it. +.It Dv EL_REFRESH +Re-display the current line on the next terminal line. .It Dv EL_RPROMPT , Fa "char *(*f)(EditLine *)" Define right side prompt printing function as .Fa f , which is to return a string that contains the prompt. +.It Dv EL_RPROMPT_ESC , Fa "char *(*f)(EditLine *)" , Fa "char c" +Define the right prompt printing function but with a literal escape character. .It Dv EL_TERMINAL , Fa "const char *type" Define terminal type of the tty to be .Fa type , @@ -259,66 +287,43 @@ reading command input: and .Dv SIGWINCH . Otherwise, the current signal handlers will be used. -.It Dv EL_BIND , Xo -.Fa "const char *" , -.Fa "..." , -.Dv NULL -.Xc +.It Dv EL_BIND , Fa "const char *" , Fa "..." , Dv NULL Perform the .Ic bind builtin command. Refer to .Xr editrc 5 for more information. -.It Dv EL_ECHOTC , Xo -.Fa "const char *" , -.Fa "..." , -.Dv NULL -.Xc +.It Dv EL_ECHOTC , Fa "const char *" , Fa "..." , Dv NULL Perform the .Ic echotc builtin command. Refer to .Xr editrc 5 for more information. -.It Dv EL_SETTC , Xo -.Fa "const char *" , -.Fa "..." , -.Dv NULL -.Xc +.It Dv EL_SETTC , Fa "const char *" , Fa "..." , Dv NULL Perform the .Ic settc builtin command. Refer to .Xr editrc 5 for more information. -.It Dv EL_SETTY , Xo -.Fa "const char *" , -.Fa "..." , -.Dv NULL -.Xc +.It Dv EL_SETTY , Fa "const char *" , Fa "..." , Dv NULL Perform the .Ic setty builtin command. Refer to .Xr editrc 5 for more information. -.It Dv EL_TELLTC , Xo -.Fa "const char *" , -.Fa "..." , -.Dv NULL -.Xc +.It Dv EL_TELLTC , Fa "const char *" , Fa "..." , Dv NULL Perform the .Ic telltc *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Tue Jun 26 21:20:54 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E41071065675; Tue, 26 Jun 2012 21:20:54 +0000 (UTC) (envelope-from jceel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CECDA8FC1E; Tue, 26 Jun 2012 21:20:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5QLKshH062932; Tue, 26 Jun 2012 21:20:54 GMT (envelope-from jceel@svn.freebsd.org) Received: (from jceel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5QLKsVC062930; Tue, 26 Jun 2012 21:20:54 GMT (envelope-from jceel@svn.freebsd.org) Message-Id: <201206262120.q5QLKsVC062930@svn.freebsd.org> From: Jakub Wojciech Klama Date: Tue, 26 Jun 2012 21:20:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237609 - user/jceel/soc2012_armv6/sys/dev/fdt X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 21:20:55 -0000 Author: jceel Date: Tue Jun 26 21:20:54 2012 New Revision: 237609 URL: http://svn.freebsd.org/changeset/base/237609 Log: Fix unmasking IRQ in legacy interrupt routing code. Modified: user/jceel/soc2012_armv6/sys/dev/fdt/fdtbus.c Modified: user/jceel/soc2012_armv6/sys/dev/fdt/fdtbus.c ============================================================================== --- user/jceel/soc2012_armv6/sys/dev/fdt/fdtbus.c Tue Jun 26 20:39:29 2012 (r237608) +++ user/jceel/soc2012_armv6/sys/dev/fdt/fdtbus.c Tue Jun 26 21:20:54 2012 (r237609) @@ -605,6 +605,7 @@ fdtbus_setup_intr(device_t bus, device_t #else arm_setup_irqhandler(device_get_nameunit(child), filter, ihand, arg, rman_get_start(res), flags, cookiep); + arm_unmask_irq(rman_get_start(res)); #endif /* ARM_INTRNG */ err = 0; #endif From owner-svn-src-user@FreeBSD.ORG Wed Jun 27 11:34:57 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3B6EF106566C; Wed, 27 Jun 2012 11:34:57 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C5C98FC16; Wed, 27 Jun 2012 11:34:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5RBYutw007905; Wed, 27 Jun 2012 11:34:56 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5RBYuIx007902; Wed, 27 Jun 2012 11:34:56 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206271134.q5RBYuIx007902@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 27 Jun 2012 11:34:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237641 - user/ae/bootcode/sys/boot/common X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 11:34:57 -0000 Author: ae Date: Wed Jun 27 11:34:56 2012 New Revision: 237641 URL: http://svn.freebsd.org/changeset/base/237641 Log: Add disk_parsedev() function. Modified: user/ae/bootcode/sys/boot/common/disk.c user/ae/bootcode/sys/boot/common/disk.h Modified: user/ae/bootcode/sys/boot/common/disk.c ============================================================================== --- user/ae/bootcode/sys/boot/common/disk.c Wed Jun 27 11:08:03 2012 (r237640) +++ user/ae/bootcode/sys/boot/common/disk.c Wed Jun 27 11:34:56 2012 (r237641) @@ -242,3 +242,55 @@ disk_fmtdev(struct disk_devdesc *dev) strcat(cp, ":"); return (buf); } + +int +disk_parsedev(struct disk_devdesc *dev, const char *devspec, const char **path) +{ + int unit, slice, partition; + const char *np; + char *cp; + + np = devspec; + unit = slice = partition = -1; + if (*np != '\0' && *np != ':') { + unit = strtol(np, &cp, 10); + if (cp == np) + return (EUNIT); +#ifdef LOADER_GPT_SUPPORT + if (*cp == 'p') { + np = cp + 1; + slice = strtol(np, &cp, 10); + if (np == cp) + return (ESLICE); + /* we don't support nested partitions on GPT */ + if (*cp != '\0' && *cp != ':') + return (EINVAL); + partition = 255; + } else +#endif +#ifdef LOADER_MBR_SUPPORT + if (*cp == 's') { + np = cp + 1; + slice = strtol(np, &cp, 10); + if (np == cp) + return (ESLICE); + } +#endif + if (*cp != '\0' && *cp != ':') { + partition = *cp - 'a'; + if (partition < 0) + return (EPART); + cp++; + } + } else + return (EINVAL); + + if (*cp != '\0' && *cp != ':') + return (EINVAL); + dev->d_unit = unit; + dev->d_slice = slice; + dev->d_partition = partition; + if (path != NULL) + *path = (*cp == '\0') ? cp: cp + 1; + return (0); +} Modified: user/ae/bootcode/sys/boot/common/disk.h ============================================================================== --- user/ae/bootcode/sys/boot/common/disk.h Wed Jun 27 11:08:03 2012 (r237640) +++ user/ae/bootcode/sys/boot/common/disk.h Wed Jun 27 11:34:56 2012 (r237641) @@ -100,4 +100,6 @@ extern int disk_close(struct disk_devdes */ extern void disk_print(struct disk_devdesc *dev, char *prefix, int verbose); extern char* disk_fmtdev(struct disk_devdesc *dev); +extern int disk_parsedev(struct disk_devdesc *dev, const char *devspec, + const char **path); From owner-svn-src-user@FreeBSD.ORG Wed Jun 27 11:36:33 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CC067106564A; Wed, 27 Jun 2012 11:36:33 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B651D8FC15; Wed, 27 Jun 2012 11:36:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5RBaXsd008042; Wed, 27 Jun 2012 11:36:33 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5RBaX70008039; Wed, 27 Jun 2012 11:36:33 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206271136.q5RBaX70008039@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 27 Jun 2012 11:36:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237642 - in user/ae/bootcode/sys/boot: i386/libi386 userboot/userboot X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 11:36:33 -0000 Author: ae Date: Wed Jun 27 11:36:33 2012 New Revision: 237642 URL: http://svn.freebsd.org/changeset/base/237642 Log: Use disk_parsedev() and disk_fmtdev() functions. Modified: user/ae/bootcode/sys/boot/i386/libi386/devicename.c user/ae/bootcode/sys/boot/userboot/userboot/devicename.c Modified: user/ae/bootcode/sys/boot/i386/libi386/devicename.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/devicename.c Wed Jun 27 11:34:56 2012 (r237641) +++ user/ae/bootcode/sys/boot/i386/libi386/devicename.c Wed Jun 27 11:36:33 2012 (r237642) @@ -29,8 +29,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include "bootstrap.h" +#include "disk.h" #include "libi386.h" #include "../zfs/libzfs.h" @@ -86,7 +86,7 @@ i386_parsedev(struct i386_devdesc **dev, { struct i386_devdesc *idev; struct devsw *dv; - int i, unit, slice, partition, err; + int i, unit, err; char *cp; const char *np; @@ -112,62 +112,9 @@ i386_parsedev(struct i386_devdesc **dev, break; case DEVT_DISK: - unit = -1; - slice = -1; - partition = -1; - if (*np && (*np != ':')) { - unit = strtol(np, &cp, 10); /* next comes the unit number */ - if (cp == np) { - err = EUNIT; - goto fail; - } -#ifdef LOADER_GPT_SUPPORT - if (*cp == 'p') { /* got a GPT partition */ - np = cp + 1; - slice = strtol(np, &cp, 10); - if (cp == np) { - err = ESLICE; - goto fail; - } - if (*cp && (*cp != ':')) { - err = EINVAL; - goto fail; - } - partition = 0xff; - } else { -#endif - if (*cp == 's') { /* got a slice number */ - np = cp + 1; - slice = strtol(np, &cp, 10); - if (cp == np) { - err = ESLICE; - goto fail; - } - } - if (*cp && (*cp != ':')) { - partition = *cp - 'a'; /* got a partition number */ - if ((partition < 0) || (partition >= MAXPARTITIONS)) { - err = EPART; - goto fail; - } - cp++; - } -#ifdef LOADER_GPT_SUPPORT - } -#endif - } else { - cp = np; - } - if (*cp && (*cp != ':')) { - err = EINVAL; + err = disk_parsedev((struct disk_devdesc *)idev, np, path); + if (err != 0) goto fail; - } - - idev->d_unit = unit; - idev->d_kind.biosdisk.slice = slice; - idev->d_kind.biosdisk.partition = partition; - if (path != NULL) - *path = (*cp == 0) ? cp : cp + 1; break; case DEVT_CD: @@ -221,38 +168,20 @@ i386_fmtdev(void *vdev) { struct i386_devdesc *dev = (struct i386_devdesc *)vdev; static char buf[128]; /* XXX device length constant? */ - char *cp; - + switch(dev->d_type) { case DEVT_NONE: strcpy(buf, "(no device)"); break; case DEVT_CD: + case DEVT_NET: sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); break; case DEVT_DISK: - cp = buf; - cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_unit); -#ifdef LOADER_GPT_SUPPORT - if (dev->d_kind.biosdisk.partition == 0xff) { - cp += sprintf(cp, "p%d", dev->d_kind.biosdisk.slice); - } else { -#endif - if (dev->d_kind.biosdisk.slice > 0) - cp += sprintf(cp, "s%d", dev->d_kind.biosdisk.slice); - if (dev->d_kind.biosdisk.partition >= 0) - cp += sprintf(cp, "%c", dev->d_kind.biosdisk.partition + 'a'); -#ifdef LOADER_GPT_SUPPORT - } -#endif - strcat(cp, ":"); - break; + return (disk_fmtdev(vdev)); - case DEVT_NET: - sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); - break; case DEVT_ZFS: return(zfs_fmtdev(vdev)); } Modified: user/ae/bootcode/sys/boot/userboot/userboot/devicename.c ============================================================================== --- user/ae/bootcode/sys/boot/userboot/userboot/devicename.c Wed Jun 27 11:34:56 2012 (r237641) +++ user/ae/bootcode/sys/boot/userboot/userboot/devicename.c Wed Jun 27 11:36:33 2012 (r237642) @@ -29,7 +29,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include "bootstrap.h" #include "disk.h" @@ -87,7 +86,7 @@ userboot_parsedev(struct disk_devdesc ** { struct disk_devdesc *idev; struct devsw *dv; - int i, unit, slice, partition, err; + int i, unit, err; char *cp; const char *np; @@ -113,62 +112,9 @@ userboot_parsedev(struct disk_devdesc ** break; case DEVT_DISK: - unit = -1; - slice = -1; - partition = -1; - if (*np && (*np != ':')) { - unit = strtol(np, &cp, 10); /* next comes the unit number */ - if (cp == np) { - err = EUNIT; - goto fail; - } -#ifdef LOADER_GPT_SUPPORT - if (*cp == 'p') { /* got a GPT partition */ - np = cp + 1; - slice = strtol(np, &cp, 10); - if (cp == np) { - err = ESLICE; - goto fail; - } - if (*cp && (*cp != ':')) { - err = EINVAL; - goto fail; - } - partition = 0xff; - } else { -#endif - if (*cp == 's') { /* got a slice number */ - np = cp + 1; - slice = strtol(np, &cp, 10); - if (cp == np) { - err = ESLICE; - goto fail; - } - } - if (*cp && (*cp != ':')) { - partition = *cp - 'a'; /* got a partition number */ - if ((partition < 0) || (partition >= MAXPARTITIONS)) { - err = EPART; - goto fail; - } - cp++; - } -#ifdef LOADER_GPT_SUPPORT - } -#endif - } else { - cp = np; - } - if (*cp && (*cp != ':')) { - err = EINVAL; + err = disk_parsedev(idev, np, path); + if (err != 0) goto fail; - } - - idev->d_unit = unit; - idev->d_slice = slice; - idev->d_partition = partition; - if (path != NULL) - *path = (*cp == 0) ? cp : cp + 1; break; case DEVT_CD: @@ -219,8 +165,7 @@ userboot_fmtdev(void *vdev) { struct disk_devdesc *dev = (struct disk_devdesc *)vdev; static char buf[128]; /* XXX device length constant? */ - char *cp; - + switch(dev->d_type) { case DEVT_NONE: strcpy(buf, "(no device)"); @@ -231,22 +176,7 @@ userboot_fmtdev(void *vdev) break; case DEVT_DISK: - cp = buf; - cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_unit); -#ifdef LOADER_GPT_SUPPORT - if (dev->d_partition == 0xff) { - cp += sprintf(cp, "p%d", dev->d_slice); - } else { -#endif - if (dev->d_slice > 0) - cp += sprintf(cp, "s%d", dev->d_slice); - if (dev->d_partition >= 0) - cp += sprintf(cp, "%c", dev->d_partition + 'a'); -#ifdef LOADER_GPT_SUPPORT - } -#endif - strcat(cp, ":"); - break; + return (disk_fmtdev(vdev)); case DEVT_NET: case DEVT_ZFS: From owner-svn-src-user@FreeBSD.ORG Wed Jun 27 21:47:28 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21829106566C; Wed, 27 Jun 2012 21:47:28 +0000 (UTC) (envelope-from jceel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08FD78FC1B; Wed, 27 Jun 2012 21:47:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5RLlR6X034587; Wed, 27 Jun 2012 21:47:27 GMT (envelope-from jceel@svn.freebsd.org) Received: (from jceel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5RLlRSk034577; Wed, 27 Jun 2012 21:47:27 GMT (envelope-from jceel@svn.freebsd.org) Message-Id: <201206272147.q5RLlRSk034577@svn.freebsd.org> From: Jakub Wojciech Klama Date: Wed, 27 Jun 2012 21:47:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237667 - in user/jceel/soc2012_armv6/sys: arm/arm arm/conf arm/include arm/mv arm/mv/discovery boot/fdt/dts dev/mge X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 21:47:28 -0000 Author: jceel Date: Wed Jun 27 21:47:27 2012 New Revision: 237667 URL: http://svn.freebsd.org/changeset/base/237667 Log: Replace arm/mv port with one got from HEAD, as on armv6 branch Marvell targets other than armadaxp (for example DB-88F5XXX, 6XXX, Sheevaplug, etc) are defunct. Modified: user/jceel/soc2012_armv6/sys/arm/arm/cpufunc.c user/jceel/soc2012_armv6/sys/arm/conf/DB-88F6XXX user/jceel/soc2012_armv6/sys/arm/include/fdt.h user/jceel/soc2012_armv6/sys/arm/mv/common.c user/jceel/soc2012_armv6/sys/arm/mv/discovery/discovery.c user/jceel/soc2012_armv6/sys/arm/mv/files.mv user/jceel/soc2012_armv6/sys/arm/mv/mv_machdep.c user/jceel/soc2012_armv6/sys/arm/mv/mvreg.h user/jceel/soc2012_armv6/sys/arm/mv/mvvar.h user/jceel/soc2012_armv6/sys/arm/mv/mvwin.h user/jceel/soc2012_armv6/sys/arm/mv/std.mv user/jceel/soc2012_armv6/sys/arm/mv/timer.c user/jceel/soc2012_armv6/sys/boot/fdt/dts/db88f6281.dts user/jceel/soc2012_armv6/sys/dev/mge/if_mge.c user/jceel/soc2012_armv6/sys/dev/mge/if_mgevar.h Modified: user/jceel/soc2012_armv6/sys/arm/arm/cpufunc.c ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/arm/cpufunc.c Wed Jun 27 21:35:45 2012 (r237666) +++ user/jceel/soc2012_armv6/sys/arm/arm/cpufunc.c Wed Jun 27 21:47:27 2012 (r237667) @@ -1297,7 +1297,7 @@ set_cpufuncs() get_cachetype_cp15(); pmap_pte_init_generic(); goto out; - } else if (cputype == CPU_ID_ARM926EJS || cputype == CPU_ID_ARM926ES || + } else if (cputype == CPU_ID_ARM926EJS || /*cputype == CPU_ID_ARM926ES ||*/ cputype == CPU_ID_ARM1026EJS) { cpufuncs = armv5_ec_cpufuncs; get_cachetype_cp15(); Modified: user/jceel/soc2012_armv6/sys/arm/conf/DB-88F6XXX ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/conf/DB-88F6XXX Wed Jun 27 21:35:45 2012 (r237666) +++ user/jceel/soc2012_armv6/sys/arm/conf/DB-88F6XXX Wed Jun 27 21:47:27 2012 (r237667) @@ -44,8 +44,8 @@ options DIAGNOSTIC #options INVARIANTS #Enable calls of extra sanity checking #options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS options KDB -options WITNESS #Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed +#options WITNESS #Enable checks to detect deadlocks and cycles +#options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed #options WITNESS_KDB device pci @@ -65,26 +65,31 @@ device mii device e1000phy device bpf -device cesa # Marvell security engine -device crypto -device cryptodev +#device cesa # Marvell security engine +#device crypto +#device cryptodev # USB -options USB_DEBUG # enable debug msgs -device usb -device ehci -device umass -device scbus -device pass -device da +#options USB_DEBUG # enable debug msgs +#device usb +#device ehci +#device umass +#device scbus +#device pass +#device da # I2C (TWSI) -device iic -device iicbus +#device iic +#device iicbus # SATA -device mvs +#device mvs + +# Flash +device cfi +device cfid # Flattened Device Tree options FDT +options FDT_DTB_STATIC makeoptions FDT_DTS_FILE=db88f6281.dts Modified: user/jceel/soc2012_armv6/sys/arm/include/fdt.h ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/include/fdt.h Wed Jun 27 21:35:45 2012 (r237666) +++ user/jceel/soc2012_armv6/sys/arm/include/fdt.h Wed Jun 27 21:47:27 2012 (r237667) @@ -71,7 +71,9 @@ struct mem_region { vm_size_t mr_size; }; +int fdt_localbus_devmap(phandle_t, struct pmap_devmap *, int, int *); int fdt_pci_devmap(phandle_t, struct pmap_devmap *devmap, vm_offset_t, vm_offset_t); #endif /* _MACHINE_FDT_H_ */ + Modified: user/jceel/soc2012_armv6/sys/arm/mv/common.c ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/mv/common.c Wed Jun 27 21:35:45 2012 (r237666) +++ user/jceel/soc2012_armv6/sys/arm/mv/common.c Wed Jun 27 21:47:27 2012 (r237667) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 2008-2011 MARVELL INTERNATIONAL LTD. + * Copyright (C) 2008 MARVELL INTERNATIONAL LTD. * All rights reserved. * * Developed by Semihalf. @@ -29,8 +29,6 @@ * SUCH DAMAGE. */ -#include "opt_global.h" - #include __FBSDID("$FreeBSD$"); @@ -38,27 +36,17 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include -#include #include #include #include #include -#include #include #include #include - -MALLOC_DEFINE(M_IDMA, "idma", "idma dma test memory"); - -#define IDMA_DEBUG -#undef IDMA_DEBUG - #define MAX_CPU_WIN 5 #ifdef DEBUG @@ -76,9 +64,7 @@ MALLOC_DEFINE(M_IDMA, "idma", "idma dma static int win_eth_can_remap(int i); -#ifndef SOC_MV_FREY static int decode_win_cpu_valid(void); -#endif static int decode_win_usb_valid(void); static int decode_win_eth_valid(void); static int decode_win_pcie_valid(void); @@ -87,11 +73,10 @@ static int decode_win_cesa_valid(void); static int decode_win_idma_valid(void); static int decode_win_xor_valid(void); -#ifndef SOC_MV_FREY static void decode_win_cpu_setup(void); -#endif static void decode_win_usb_setup(u_long); static void decode_win_eth_setup(u_long); +static void decode_win_pcie_setup(u_long); static void decode_win_sata_setup(u_long); static void decode_win_cesa_setup(u_long); static void decode_win_idma_setup(u_long); @@ -108,6 +93,7 @@ static int fdt_get_ranges(const char *, static int win_cpu_from_dt(void); static int fdt_win_setup(void); +static uint32_t used_cpu_wins; static uint32_t dev_mask = 0; static int cpu_wins_no = 0; static int eth_port = 0; @@ -115,7 +101,7 @@ static int usb_port = 0; static struct decode_win cpu_win_tbl[MAX_CPU_WIN]; -const struct decode_win *cpu_wins = cpu_win_tbl; +static const struct decode_win *cpu_wins = cpu_win_tbl; typedef void (*decode_win_setup_t)(u_long); typedef void (*dump_win_t)(u_long); @@ -265,22 +251,13 @@ cpu_extra_feat(void) uint32_t ef = 0; soc_id(&dev, &rev); - - switch (dev) { - case MV_DEV_88F6281: - case MV_DEV_88RC8180: - case MV_DEV_MV78100_Z0: - case MV_DEV_MV78100: + if (dev == MV_DEV_88F6281 || dev == MV_DEV_MV78100_Z0 || + dev == MV_DEV_MV78100) __asm __volatile("mrc p15, 1, %0, c15, c1, 0" : "=r" (ef)); - break; - case MV_DEV_88F5182: - case MV_DEV_88F5281: + else if (dev == MV_DEV_88F5182 || dev == MV_DEV_88F5281) __asm __volatile("mrc p15, 0, %0, c14, c0, 0" : "=r" (ef)); - break; - default: - if (bootverbose) - printf("This ARM Core does not support any extra features\n"); - } + else if (bootverbose) + printf("This ARM Core does not support any extra features\n"); return (ef); } @@ -293,7 +270,7 @@ uint32_t soc_power_ctrl_get(uint32_t mask) { -#if !defined(SOC_MV_ORION) && !defined(SOC_MV_LOKIPLUS) && !defined(SOC_MV_FREY) +#ifndef SOC_MV_ORION if (mask != CPU_PM_CTRL_NONE) mask &= read_cpu_ctrl(CPU_PM_CTRL); @@ -311,7 +288,7 @@ void soc_power_ctrl_set(uint32_t mask) { -#if !defined(SOC_MV_ORION) && !defined(SOC_MV_LOKIPLUS) +#ifndef SOC_MV_ORION if (mask != CPU_PM_CTRL_NONE) write_cpu_ctrl(CPU_PM_CTRL, mask); #endif @@ -334,7 +311,7 @@ soc_id(uint32_t *dev, uint32_t *rev) static void soc_identify(void) { - uint32_t d, r, size, mode; + uint32_t d, r; const char *dev; const char *rev; @@ -374,35 +351,12 @@ soc_identify(void) else if (r == 3) rev = "A1"; break; - case MV_DEV_88RC8180: - dev = "Marvell 88RC8180"; - break; - case MV_DEV_88RC9480: - dev = "Marvell 88RC9480"; - break; - case MV_DEV_88RC9580: - dev = "Marvell 88RC9580"; - break; - case MV_DEV_88F6781: - dev = "Marvell 88F6781"; - if (r == 2) - rev = "Y0"; - break; case MV_DEV_MV78100_Z0: dev = "Marvell MV78100 Z0"; break; case MV_DEV_MV78100: dev = "Marvell MV78100"; break; - case MV_DEV_MV78160: - dev = "Marvell MV78160"; - break; - case MV_DEV_MV78260: - dev = "Marvell MV78260"; - break; - case MV_DEV_MV78460: - dev = "Marvell MV78460"; - break; default: dev = "UNKNOWN"; break; @@ -413,28 +367,7 @@ soc_identify(void) printf(" rev %s", rev); printf(", TClock %dMHz\n", get_tclk() / 1000 / 1000); - mode = read_cpu_ctrl(CPU_CONFIG); - printf(" Instruction cache prefetch %s, data cache prefetch %s\n", - (mode & CPU_CONFIG_IC_PREF) ? "enabled" : "disabled", - (mode & CPU_CONFIG_DC_PREF) ? "enabled" : "disabled"); - - switch (d) { - case MV_DEV_88F6281: - mode = read_cpu_ctrl(CPU_L2_CONFIG) & CPU_L2_CONFIG_MODE; - printf(" 256KB 4-way set-associative %s unified L2 cache\n", - mode ? "write-through" : "write-back"); - break; - case MV_DEV_MV78100: - mode = read_cpu_ctrl(CPU_CONTROL); - size = mode & CPU_CONTROL_L2_SIZE; - mode = mode & CPU_CONTROL_L2_MODE; - printf(" %s set-associative %s unified L2 cache\n", - size ? "256KB 4-way" : "512KB 8-way", - mode ? "write-through" : "write-back"); - break; - default: - break; - } + /* TODO add info on currently set endianess */ } static void @@ -451,17 +384,6 @@ platform_identify(void *dummy) SYSINIT(platform_identify, SI_SUB_CPU, SI_ORDER_SECOND, platform_identify, NULL); -#ifdef KDB -static void -mv_enter_debugger(void *dummy) -{ - - if (boothowto & RB_KDB) - kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger"); -} -SYSINIT(mv_enter_debugger, SI_SUB_CPU, SI_ORDER_ANY, mv_enter_debugger, NULL); -#endif - int soc_decode_win(void) { @@ -481,7 +403,6 @@ soc_decode_win(void) /* Retrieve our ID: some windows facilities vary between SoC models */ soc_id(&dev, &rev); -#ifndef SOC_MV_FREY if (!decode_win_cpu_valid() || !decode_win_usb_valid() || !decode_win_eth_valid() || !decode_win_idma_valid() || !decode_win_pcie_valid() || !decode_win_sata_valid() || @@ -489,13 +410,6 @@ soc_decode_win(void) return (EINVAL); decode_win_cpu_setup(); -#else - if (!decode_win_usb_valid() || - !decode_win_eth_valid() || !decode_win_idma_valid() || - !decode_win_pcie_valid() || !decode_win_sata_valid() || - !decode_win_cesa_valid() || !decode_win_xor_valid()) - return (EINVAL); -#endif if (MV_DUMP_WIN) soc_dump_decode_win(); @@ -510,7 +424,6 @@ soc_decode_win(void) /************************************************************************** * Decode windows registers accessors **************************************************************************/ -#if !defined(SOC_MV_FREY) WIN_REG_IDX_RD(win_cpu, cr, MV_WIN_CPU_CTRL, MV_MBUS_BRIDGE_BASE) WIN_REG_IDX_RD(win_cpu, br, MV_WIN_CPU_BASE, MV_MBUS_BRIDGE_BASE) WIN_REG_IDX_RD(win_cpu, remap_l, MV_WIN_CPU_REMAP_LO, MV_MBUS_BRIDGE_BASE) @@ -519,7 +432,9 @@ WIN_REG_IDX_WR(win_cpu, cr, MV_WIN_CPU_C WIN_REG_IDX_WR(win_cpu, br, MV_WIN_CPU_BASE, MV_MBUS_BRIDGE_BASE) WIN_REG_IDX_WR(win_cpu, remap_l, MV_WIN_CPU_REMAP_LO, MV_MBUS_BRIDGE_BASE) WIN_REG_IDX_WR(win_cpu, remap_h, MV_WIN_CPU_REMAP_HI, MV_MBUS_BRIDGE_BASE) -#endif + +WIN_REG_IDX_RD(ddr, br, MV_WIN_DDR_BASE, MV_DDR_CADR_BASE) +WIN_REG_IDX_RD(ddr, sz, MV_WIN_DDR_SIZE, MV_DDR_CADR_BASE) WIN_REG_BASE_IDX_RD(win_usb, cr, MV_WIN_USB_CTRL) WIN_REG_BASE_IDX_RD(win_usb, br, MV_WIN_USB_BASE) @@ -558,10 +473,7 @@ WIN_REG_BASE_IDX_RD(win_pcie, remap, MV_ WIN_REG_BASE_IDX_WR(win_pcie, cr, MV_WIN_PCIE_CTRL); WIN_REG_BASE_IDX_WR(win_pcie, br, MV_WIN_PCIE_BASE); WIN_REG_BASE_IDX_WR(win_pcie, remap, MV_WIN_PCIE_REMAP); -WIN_REG_BASE_IDX_RD(pcie_bar, br, MV_PCIE_BAR_BASE); -WIN_REG_BASE_IDX_WR(pcie_bar, br, MV_PCIE_BAR_BASE); -WIN_REG_BASE_IDX_WR(pcie_bar, brh, MV_PCIE_BAR_BASE_H); -WIN_REG_BASE_IDX_WR(pcie_bar, cr, MV_PCIE_BAR_CTRL); +WIN_REG_BASE_IDX_WR(pcie, bar, MV_PCIE_BAR); WIN_REG_BASE_IDX_RD(win_idma, br, MV_WIN_IDMA_BASE) WIN_REG_BASE_IDX_RD(win_idma, sz, MV_WIN_IDMA_SIZE) @@ -578,44 +490,7 @@ WIN_REG_BASE_IDX_RD(win_sata, cr, MV_WIN WIN_REG_BASE_IDX_RD(win_sata, br, MV_WIN_SATA_BASE); WIN_REG_BASE_IDX_WR(win_sata, cr, MV_WIN_SATA_CTRL); WIN_REG_BASE_IDX_WR(win_sata, br, MV_WIN_SATA_BASE); -#ifndef SOC_MV_DOVE -WIN_REG_IDX_RD(ddr, br, MV_WIN_DDR_BASE, MV_DDR_CADR_BASE) -WIN_REG_IDX_RD(ddr, sz, MV_WIN_DDR_SIZE, MV_DDR_CADR_BASE) -#else -/* - * On 88F6781 (Dove) SoC DDR Controller is accessed through - * single MBUS <-> AXI bridge. In this case we provide emulated - * ddr_br_read() and ddr_sz_read() functions to keep compatibility - * with common decoding windows setup code. - */ - -static inline uint32_t ddr_br_read(int i) -{ - uint32_t mmap; - - /* Read Memory Address Map Register for CS i */ - mmap = bus_space_read_4(fdtbus_bs_tag, MV_DDR_CADR_BASE + (i * 0x10), 0); - - /* Return CS i base address */ - return (mmap & 0xFF000000); -} - -static inline uint32_t ddr_sz_read(int i) -{ - uint32_t mmap, size; - - /* Read Memory Address Map Register for CS i */ - mmap = bus_space_read_4(fdtbus_bs_tag, MV_DDR_CADR_BASE + (i * 0x10), 0); - /* Extract size of CS space in 64kB units */ - size = (1 << ((mmap >> 16) & 0x0F)); - - /* Return CS size and enable/disable status */ - return (((size - 1) << 16) | (mmap & 0x01)); -} -#endif - -#if !defined(SOC_MV_FREY) /************************************************************************** * Decode windows helper routines **************************************************************************/ @@ -661,10 +536,8 @@ win_cpu_can_remap(int i) if ((dev == MV_DEV_88F5182 && i < 2) || (dev == MV_DEV_88F5281 && i < 4) || (dev == MV_DEV_88F6281 && i < 4) || - (dev == MV_DEV_88RC8180 && i < 2) || - (dev == MV_DEV_88F6781 && i < 4) || - (dev == MV_DEV_MV78100_Z0 && i < 8) || - ((dev & MV_DEV_FAMILY_MASK) == MV_DEV_DISCOVERY && i < 8)) + (dev == MV_DEV_MV78100 && i < 8) || + (dev == MV_DEV_MV78100_Z0 && i < 8)) return (1); return (0); @@ -717,7 +590,7 @@ decode_win_cpu_valid(void) rv = 0; } - if (cpu_wins[i].remap != ~0 && win_cpu_can_remap(i) != 1) { + if (cpu_wins[i].remap >= 0 && win_cpu_can_remap(i) != 1) { printf("CPU window#%d: not capable of remapping, but " "val 0x%08x defined\n", i, cpu_wins[i].remap); rv = 0; @@ -737,13 +610,6 @@ decode_win_cpu_valid(void) continue; } - if (b != (b & ~(s - 1))) { - printf("CPU window#%d: address 0x%08x is not aligned " - "to 0x%08x\n", i, b, s); - rv = 0; - continue; - } - j = decode_win_overlap(i, cpu_wins_no, &cpu_wins[0]); if (j >= 0) { printf("CPU window#%d: (0x%08x - 0x%08x) overlaps " @@ -759,39 +625,21 @@ decode_win_cpu_valid(void) int decode_win_cpu_set(int target, int attr, vm_paddr_t base, uint32_t size, - vm_paddr_t remap) + int remap) { uint32_t br, cr; - int win, i; + int win; - if (remap == ~0) { - win = MV_WIN_CPU_MAX - 1; - i = -1; - } else { - win = 0; - i = 1; - } + if (used_cpu_wins >= MV_WIN_CPU_MAX) + return (0); - while ((win >= 0) && (win < MV_WIN_CPU_MAX)) { - cr = win_cpu_cr_read(win); - if ((cr & MV_WIN_CPU_ENABLE_BIT) == 0) - break; - if ((cr & ((0xff << MV_WIN_CPU_ATTR_SHIFT) | - (0x1f << MV_WIN_CPU_TARGET_SHIFT))) == - ((attr << MV_WIN_CPU_ATTR_SHIFT) | - (target << MV_WIN_CPU_TARGET_SHIFT))) - break; - win += i; - } - if ((win < 0) || (win >= MV_WIN_CPU_MAX) || - ((remap != ~0) && (win_cpu_can_remap(win) == 0))) - return (-1); + win = used_cpu_wins++; br = base & 0xffff0000; win_cpu_br_write(win, br); if (win_cpu_can_remap(win)) { - if (remap != ~0) { + if (remap >= 0) { win_cpu_remap_l_write(win, remap & 0xffff0000); win_cpu_remap_h_write(win, 0); } else { @@ -805,8 +653,7 @@ decode_win_cpu_set(int target, int attr, } } - cr = ((size - 1) & 0xffff0000) | (attr << MV_WIN_CPU_ATTR_SHIFT) | - (target << MV_WIN_CPU_TARGET_SHIFT) | MV_WIN_CPU_ENABLE_BIT; + cr = ((size - 1) & 0xffff0000) | (attr << 8) | (target << 4) | 1; win_cpu_cr_write(win, cr); return (0); @@ -817,6 +664,8 @@ decode_win_cpu_setup(void) { int i; + used_cpu_wins = 0; + /* Disable all CPU windows */ for (i = 0; i < MV_WIN_CPU_MAX; i++) { win_cpu_cr_write(i, 0); @@ -834,7 +683,7 @@ decode_win_cpu_setup(void) cpu_wins[i].size, cpu_wins[i].remap); } -#endif + /* * Check if we're able to cover all active DDR banks. */ @@ -887,13 +736,6 @@ ddr_size(int i) uint32_t ddr_attr(int i) { - uint32_t dev, rev; - - soc_id(&dev, &rev); - if (dev == MV_DEV_88RC8180) - return ((ddr_sz_read(i) & 0xf0) >> 4); - if (dev == MV_DEV_88F6781) - return (0); return (i == 0 ? 0xe : (i == 1 ? 0xd : @@ -904,21 +746,8 @@ ddr_attr(int i) uint32_t ddr_target(int i) { - uint32_t dev, rev; - soc_id(&dev, &rev); - if (dev == MV_DEV_88RC8180) { - i = (ddr_sz_read(i) & 0xf0) >> 4; - return (i == 0xe ? 0xc : - (i == 0xd ? 0xd : - (i == 0xb ? 0xe : - (i == 0x7 ? 0xf : 0xc)))); - } - - /* - * On SOCs other than 88RC8180 Mbus unit ID for - * DDR SDRAM controller is always 0x0. - */ + /* Mbus unit ID is 0x0 for DDR SDRAM controller */ return (0); } @@ -1001,7 +830,7 @@ win_eth_can_remap(int i) /* ETH encode windows 0-3 have remap capability */ if (i < 4) return (1); - + return (0); } @@ -1062,12 +891,6 @@ decode_win_eth_dump(u_long base) win_eth_epap_read(base)); } -#if defined(SOC_MV_LOKIPLUS) -#define MV_WIN_ETH_DDR_TRGT(n) 0 -#else -#define MV_WIN_ETH_DDR_TRGT(n) ddr_target(n) -#endif - static void decode_win_eth_setup(u_long base) { @@ -1094,7 +917,7 @@ decode_win_eth_setup(u_long base) for (i = 0; i < MV_WIN_DDR_MAX; i++) if (ddr_is_active(i)) { - br = ddr_base(i) | (ddr_attr(i) << 8) | MV_WIN_ETH_DDR_TRGT(i); + br = ddr_base(i) | (ddr_attr(i) << 8) | ddr_target(i); sz = ((ddr_size(i) - 1) & 0xffff0000); /* Set the first free ETH window */ @@ -1128,21 +951,15 @@ decode_win_eth_valid(void) * PCIE windows routines **************************************************************************/ -void +static void decode_win_pcie_setup(u_long base) { - uint32_t size = 0, ddrbase = ~0; + uint32_t size = 0; uint32_t cr, br; int i, j; - for (i = 0; i < MV_PCIE_BAR_MAX; i++) { - pcie_bar_br_write(base, i, - MV_PCIE_BAR_64BIT | MV_PCIE_BAR_PREFETCH_EN); - if (i < 3) - pcie_bar_brh_write(base, i, 0); - if (i > 0) - pcie_bar_cr_write(base, i, 0); - } + for (i = 0; i < MV_PCIE_BAR_MAX; i++) + pcie_bar_write(base, i, 0); for (i = 0; i < MV_WIN_PCIE_MAX; i++) { win_pcie_cr_write(base, i, 0); @@ -1150,13 +967,6 @@ decode_win_pcie_setup(u_long base) win_pcie_remap_write(base, i, 0); } - /* On End-Point only set BAR size to 1MB regardless of DDR size */ - if ((bus_space_read_4(fdtbus_bs_tag, base, MV_PCIE_CONTROL) - & MV_PCIE_ROOT_CMPLX) == 0) { - pcie_bar_cr_write(base, 1, 0xf0000 | 1); - return; - } - for (i = 0; i < MV_WIN_DDR_MAX; i++) { if (ddr_is_active(i)) { /* Map DDR to BAR 1 */ @@ -1164,8 +974,6 @@ decode_win_pcie_setup(u_long base) size += ddr_size(i) & 0xffff0000; cr |= (ddr_attr(i) << 8) | (ddr_target(i) << 4) | 1; br = ddr_base(i); - if (br < ddrbase) - ddrbase = br; /* Use the first available PCIE window */ for (j = 0; j < MV_WIN_PCIE_MAX; j++) { @@ -1185,11 +993,7 @@ decode_win_pcie_setup(u_long base) * form value passed to register to get correct value. */ size -= 0x10000; - pcie_bar_cr_write(base, 1, size | 1); - pcie_bar_br_write(base, 1, ddrbase | - MV_PCIE_BAR_64BIT | MV_PCIE_BAR_PREFETCH_EN); - pcie_bar_br_write(base, 0, fdt_immr_pa | - MV_PCIE_BAR_64BIT | MV_PCIE_BAR_PREFETCH_EN); + pcie_bar_write(base, 0, size | 1); } static int @@ -1475,6 +1279,7 @@ xor_ctrl_write(u_long base, int i, int c /* * Set channel protection 'val' for window 'w' on channel 'c' */ + static void xor_chan_write(u_long base, int c, int e, int w, int val) { @@ -1932,7 +1737,7 @@ win_cpu_from_dt(void) /* Retrieve 'ranges' property of '/localbus' node. */ if ((err = fdt_get_ranges("/localbus", ranges, sizeof(ranges), &tuples, &tuple_size)) != 0) - return (0); + return (err); /* * Fill CPU decode windows table. @@ -1947,9 +1752,9 @@ win_cpu_from_dt(void) cpu_win_tbl[t].attr = fdt32_to_cpu(ranges[i + 1]); cpu_win_tbl[t].base = fdt32_to_cpu(ranges[i + 2]); cpu_win_tbl[t].size = fdt32_to_cpu(ranges[i + 3]); - cpu_win_tbl[t].remap = ~0; + cpu_win_tbl[t].remap = -1; debugf("target = 0x%0x attr = 0x%0x base = 0x%0x " - "size = 0x%0x remap = 0x%0x\n", cpu_win_tbl[t].target, + "size = 0x%0x remap = %d\n", cpu_win_tbl[t].target, cpu_win_tbl[t].attr, cpu_win_tbl[t].base, cpu_win_tbl[t].size, cpu_win_tbl[t].remap); } @@ -1976,7 +1781,7 @@ moveon: cpu_win_tbl[t].attr = MV_WIN_CESA_ATTR; cpu_win_tbl[t].base = sram_base; cpu_win_tbl[t].size = sram_size; - cpu_win_tbl[t].remap = ~0; + cpu_win_tbl[t].remap = -1; debugf("sram: base = 0x%0lx size = 0x%0lx\n", sram_base, sram_size); return (0); @@ -1994,12 +1799,15 @@ fdt_win_setup(void) if (node == -1) panic("fdt_win_setup: no root node"); + node = fdt_find_compatible(node, "simple-bus", 1); + if (node == 0) + return (ENXIO); + /* - * Traverse through all children of root and simple-bus nodes. - * For each found device retrieve decode windows data (if applicable). + * Traverse through all children of simple-bus node, and retrieve + * decode windows data for devices (if applicable). */ - child = OF_child(node); - while (child != 0) { + for (child = OF_child(node); child != 0; child = OF_peer(child)) for (i = 0; soc_nodes[i].compat != NULL; i++) { soc_node = &soc_nodes[i]; @@ -2011,7 +1819,7 @@ fdt_win_setup(void) if (err != 0) return (err); - base = (base & 0x000fffff) | fdt_immr_va; + base += fdt_immr_va; if (soc_node->decode_handler != NULL) soc_node->decode_handler(base); else @@ -2021,19 +1829,6 @@ fdt_win_setup(void) soc_node->dump_handler(base); } - /* - * Once done with root-level children let's move down to - * simple-bus and its children. - */ - child = OF_peer(child); - if ((child == 0) && (node == OF_finddevice("/"))) { - node = fdt_find_compatible(node, "simple-bus", 1); - if (node == 0) - return (ENXIO); - child = OF_child(node); - } - } - return (0); } @@ -2064,8 +1859,7 @@ fdt_pic_decode_ic(phandle_t node, pcell_ int *pol) { - if (!fdt_is_compatible(node, "mrvl,pic") && - !fdt_is_compatible(node, "mrvl,mpic")) + if (!fdt_is_compatible(node, "mrvl,pic")) return (ENXIO); *interrupt = fdt32_to_cpu(intr[0]); Modified: user/jceel/soc2012_armv6/sys/arm/mv/discovery/discovery.c ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/mv/discovery/discovery.c Wed Jun 27 21:35:45 2012 (r237666) +++ user/jceel/soc2012_armv6/sys/arm/mv/discovery/discovery.c Wed Jun 27 21:47:27 2012 (r237667) @@ -43,6 +43,30 @@ __FBSDID("$FreeBSD$"); #include #include +/* + * Virtual address space layout: + * ----------------------------- + * 0x0000_0000 - 0xBFFF_FFFF : User Process (3 GB) + * 0xC000_0000 - virtual_avail : Kernel Reserved (text, data, page tables, + * : stack etc.) + * virtual-avail - 0xEFFF_FFFF : KVA (virtual_avail is typically < 0xc0a0_0000) + * 0xF000_0000 - 0xF0FF_FFFF : No-Cache allocation area (16 MB) + * 0xF100_0000 - 0xF10F_FFFF : SoC Integrated devices registers range (1 MB) + * 0xF110_0000 - 0xF11F_FFFF : PCI-Express I/O space (1MB) + * 0xF120_0000 - 0xF12F_FFFF : PCI I/O space (1MB) + * 0xF130_0000 - 0xF52F_FFFF : PCI-Express memory space (64MB) + * 0xF530_0000 - 0xF92F_FFFF : PCI memory space (64MB) + * 0xF930_0000 - 0xF93F_FFFF : Device Bus: BOOT (1 MB) + * 0xF940_0000 - 0xF94F_FFFF : Device Bus: CS0 (1 MB) + * 0xF950_0000 - 0xFB4F_FFFF : Device Bus: CS1 (32 MB) + * 0xFB50_0000 - 0xFB5F_FFFF : Device Bus: CS2 (1 MB) + * 0xFB60_0000 - 0xFFFE_FFFF : Unused (~74MB) + * 0xFFFF_0000 - 0xFFFF_0FFF : 'High' vectors page (4 kB) + * 0xFFFF_1000 - 0xFFFF_1FFF : ARM_TP_ADDRESS/RAS page (4 kB) + * 0xFFFF_2000 - 0xFFFF_FFFF : Unused (56 kB) + */ + + struct resource_spec mv_gpio_res[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, { SYS_RES_IRQ, 0, RF_ACTIVE }, Modified: user/jceel/soc2012_armv6/sys/arm/mv/files.mv ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/mv/files.mv Wed Jun 27 21:35:45 2012 (r237666) +++ user/jceel/soc2012_armv6/sys/arm/mv/files.mv Wed Jun 27 21:47:27 2012 (r237667) @@ -14,18 +14,16 @@ # arm/arm/bus_space_generic.c standard arm/arm/cpufunc_asm_arm10.S standard -arm/arm/cpufunc_asm_arm11.S standard -arm/arm/cpufunc_asm_armv5.S standard arm/arm/cpufunc_asm_armv5_ec.S standard -arm/arm/cpufunc_asm_armv7.S standard arm/arm/cpufunc_asm_sheeva.S standard -arm/arm/cpufunc_asm_pj4b.S standard arm/arm/irq_dispatch.S standard arm/arm/intr.c standard arm/mv/bus_space.c standard arm/mv/common.c standard arm/mv/gpio.c standard +arm/mv/ic.c standard +arm/mv/mv_localbus.c standard arm/mv/mv_machdep.c standard arm/mv/mv_pci.c optional pci arm/mv/mv_sata.c optional ata | atamvsata @@ -34,6 +32,7 @@ arm/mv/twsi.c optional iicbus dev/cesa/cesa.c optional cesa dev/mge/if_mge.c optional mge +dev/nand/nfc_mv.c optional nand dev/mvs/mvs_soc.c optional mvs dev/uart/uart_dev_ns8250.c optional uart dev/usb/controller/ehci_mv.c optional ehci Modified: user/jceel/soc2012_armv6/sys/arm/mv/mv_machdep.c ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/mv/mv_machdep.c Wed Jun 27 21:35:45 2012 (r237666) +++ user/jceel/soc2012_armv6/sys/arm/mv/mv_machdep.c Wed Jun 27 21:47:27 2012 (r237667) @@ -755,6 +755,7 @@ static struct pmap_devmap fdt_devmap[FDT { 0, 0, 0, 0, 0, } }; +#if 0 static int platform_sram_devmap(struct pmap_devmap *map) { @@ -792,6 +793,7 @@ out: return (ENOENT); } +#endif /* * Construct pmap_devmap[] with DT-derived config data. @@ -800,12 +802,16 @@ static int platform_devmap_init(void) { phandle_t root, child; - int i; + pcell_t bank_count; + u_long base, size; + int i, num_mapped; + + i = 0; + pmap_devmap_bootstrap_table = &fdt_devmap[0]; /* * IMMR range. */ - i = 0; fdt_devmap[i].pd_va = fdt_immr_va; fdt_devmap[i].pd_pa = fdt_immr_pa; fdt_devmap[i].pd_size = fdt_immr_size; @@ -814,36 +820,54 @@ platform_devmap_init(void) i++; /* - * SRAM range. - */ - if (i < FDT_DEVMAP_MAX) - if (platform_sram_devmap(&fdt_devmap[i]) == 0) - i++; - - /* - * PCI range(s). + * PCI range(s) and localbus. */ if ((root = OF_finddevice("/")) == -1) return (ENXIO); - for (child = OF_child(root); child != 0; child = OF_peer(child)) - if (fdt_is_type(child, "pci") || fdt_is_type(child, "pciep")) { + + for (child = OF_child(root); child != 0; child = OF_peer(child)) { + if (fdt_is_type(child, "pci")) { /* * Check space: each PCI node will consume 2 devmap * entries. */ - if (i + 1 >= FDT_DEVMAP_MAX) + if (i + 1 >= FDT_DEVMAP_MAX) { return (ENOMEM); + } /* * XXX this should account for PCI and multiple ranges * of a given kind. */ - if (fdt_pci_devmap(child, &fdt_devmap[i], MV_PCI_VA_IO_BASE, - MV_PCI_VA_MEM_BASE) != 0) + if (fdt_pci_devmap(child, &fdt_devmap[i], + MV_PCIE_IO_BASE, MV_PCIE_MEM_BASE) != 0) return (ENXIO); i += 2; } + if (fdt_is_compatible(child, "mrvl,lbc")) { + /* Check available space */ + if (OF_getprop(child, "bank-count", (void *)&bank_count, + sizeof(bank_count)) <= 0) + /* If no property, use default value */ + bank_count = 1; + else + bank_count = fdt32_to_cpu(bank_count); + + if ((i + bank_count) >= FDT_DEVMAP_MAX) + return (ENOMEM); + + /* Add all localbus ranges to device map */ + num_mapped = 0; + + if (fdt_localbus_devmap(child, &fdt_devmap[i], + (int)bank_count, &num_mapped) != 0) + return (ENXIO); + + i += num_mapped; + } + } + /* * CESA SRAM range. */ @@ -851,10 +875,26 @@ platform_devmap_init(void) if (fdt_is_compatible(child, "mrvl,cesa-sram")) goto moveon; - pmap_devmap_bootstrap_table = &fdt_devmap[0]; + if ((child = fdt_find_compatible(root, "mrvl,cesa-sram", 0)) == 0) + /* No CESA SRAM node. */ + return (0); +moveon: + if (i >= FDT_DEVMAP_MAX) + return (ENOMEM); + + if (fdt_regsize(child, &base, &size) != 0) + return (EINVAL); + + fdt_devmap[i].pd_va = MV_CESA_SRAM_BASE; /* XXX */ + fdt_devmap[i].pd_pa = base; + fdt_devmap[i].pd_size = size; + fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE; + fdt_devmap[i].pd_cache = PTE_NOCACHE; + return (0); } + struct arm32_dma_range * bus_dma_get_range(void) { Modified: user/jceel/soc2012_armv6/sys/arm/mv/mvreg.h ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/mv/mvreg.h Wed Jun 27 21:35:45 2012 (r237666) +++ user/jceel/soc2012_armv6/sys/arm/mv/mvreg.h Wed Jun 27 21:47:27 2012 (r237667) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 2007-2011 MARVELL INTERNATIONAL LTD. + * Copyright (C) 2007-2008 MARVELL INTERNATIONAL LTD. * All rights reserved. * * Developed by Semihalf. @@ -49,55 +49,23 @@ #define FIQ_MASK 0x20 #define FIQ_MASK_HI 0x24 #define FIQ_CAUSE_SELECT 0x28 -#define ENDPOINT_IRQ_MASK_ERROR(n) 0x2C -#define ENDPOINT_IRQ_MASK(n) 0x30 -#define ENDPOINT_IRQ_MASK_HI(n) 0x34 +#define ENDPOINT_IRQ_MASK_ERROR 0x2C +#define ENDPOINT_IRQ_MASK 0x30 +#define ENDPOINT_IRQ_MASK_HI 0x34 #define ENDPOINT_IRQ_CAUSE_SELECT 0x38 -#elif defined (SOC_MV_LOKIPLUS) || defined (SOC_MV_FREY) +#else /* !SOC_MV_DISCOVERY */ #define IRQ_CAUSE 0x0 #define IRQ_MASK 0x4 #define FIQ_MASK 0x8 -#define ENDPOINT_IRQ_MASK(n) (0xC + (n) * 4) -#define IRQ_CAUSE_HI (-1) /* Fake defines for unified */ -#define IRQ_MASK_HI (-1) /* interrupt controller code */ -#define FIQ_MASK_HI (-1) -#define ENDPOINT_IRQ_MASK_HI(n) (-1) -#define ENDPOINT_IRQ_MASK_ERROR(n) (-1) -#define IRQ_CAUSE_ERROR (-1) -#define IRQ_MASK_ERROR (-1) -#elif defined (SOC_MV_ARMADAXP) -#define IRQ_CAUSE 0x18 -#define IRQ_MASK 0x30 -#else /* !SOC_MV_DISCOVERY && !SOC_MV_LOKIPLUS */ -#define IRQ_CAUSE 0x0 -#define IRQ_MASK 0x4 -#define FIQ_MASK 0x8 -#define ENDPOINT_IRQ_MASK(n) 0xC +#define ENDPOINT_IRQ_MASK 0xC #define IRQ_CAUSE_HI 0x10 #define IRQ_MASK_HI 0x14 #define FIQ_MASK_HI 0x18 -#define ENDPOINT_IRQ_MASK_HI(n) 0x1C -#define ENDPOINT_IRQ_MASK_ERROR(n) (-1) +#define ENDPOINT_IRQ_MASK_HI 0x1C #define IRQ_CAUSE_ERROR (-1) /* Fake defines for unified */ #define IRQ_MASK_ERROR (-1) /* interrupt controller code */ #endif -#if defined(SOC_MV_FREY) -#define BRIDGE_IRQ_CAUSE 0x118 -#define IRQ_TIMER0 0x00000002 -#define IRQ_TIMER1 0x00000004 -#define IRQ_TIMER_WD 0x00000008 - -#define BRIDGE_IRQ_MASK 0x11c -#define IRQ_TIMER0_MASK 0x00000002 -#define IRQ_TIMER1_MASK 0x00000004 -#define IRQ_TIMER_WD_MASK 0x00000008 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Wed Jun 27 21:48:57 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 302401065673; Wed, 27 Jun 2012 21:48:57 +0000 (UTC) (envelope-from jceel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1AA468FC1F; Wed, 27 Jun 2012 21:48:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5RLmvn0034676; Wed, 27 Jun 2012 21:48:57 GMT (envelope-from jceel@svn.freebsd.org) Received: (from jceel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5RLmvl7034675; Wed, 27 Jun 2012 21:48:57 GMT (envelope-from jceel@svn.freebsd.org) Message-Id: <201206272148.q5RLmvl7034675@svn.freebsd.org> From: Jakub Wojciech Klama Date: Wed, 27 Jun 2012 21:48:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237668 - user/jceel/soc2012_armv6/sys/arm/mv X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 21:48:57 -0000 Author: jceel Date: Wed Jun 27 21:48:56 2012 New Revision: 237668 URL: http://svn.freebsd.org/changeset/base/237668 Log: mv localbus driver, missing on previous commit. Added: user/jceel/soc2012_armv6/sys/arm/mv/mv_localbus.c Added: user/jceel/soc2012_armv6/sys/arm/mv/mv_localbus.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/jceel/soc2012_armv6/sys/arm/mv/mv_localbus.c Wed Jun 27 21:48:56 2012 (r237668) @@ -0,0 +1,492 @@ +/*- + * Copyright (c) 2012 Semihalf. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD: head/sys/arm/mv/mv_localbus.c 235656 2012-05-19 18:16:49Z marcel $"); + +#include "opt_platform.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include "dev/fdt/fdt_common.h" +#include "ofw_bus_if.h" + +#include + +#define DEBUG + +#ifdef DEBUG +#define debugf(fmt, args...) do { printf("%s(): ", __func__); \ + printf(fmt,##args); } while (0) +#else +#define debugf(fmt, args...) +#endif + +#define MV_LOCALBUS_MAX_BANKS 8 +#define MV_LOCALBUS_MAX_BANK_CELLS 4 + +static MALLOC_DEFINE(M_LOCALBUS, "localbus", "localbus devices information"); + +struct localbus_bank { + vm_offset_t va; /* VA of the bank */ + vm_paddr_t pa; /* physical address of the bank */ + vm_size_t size; /* bank size */ + uint8_t mapped; /* device memory has mapping */ +}; + +struct localbus_softc { + device_t sc_dev; + bus_space_handle_t sc_bsh; + bus_space_tag_t sc_bst; + int sc_rid; + + struct localbus_bank *sc_banks; +}; + +struct localbus_devinfo { + struct ofw_bus_devinfo di_ofw; + struct resource_list di_res; + int di_bank; +}; + +struct localbus_va_entry { + int8_t bank; + vm_offset_t va; + vm_size_t size; +}; + +/* + * Prototypes. + */ +static int localbus_probe(device_t); +static int localbus_attach(device_t); +static int localbus_print_child(device_t, device_t); + +static struct resource *localbus_alloc_resource(device_t, device_t, int, + int *, u_long, u_long, u_long, u_int); +static struct resource_list *localbus_get_resource_list(device_t, device_t); + +static ofw_bus_get_devinfo_t localbus_get_devinfo; + +/* + * Bus interface definition. + */ +static device_method_t localbus_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, localbus_probe), + DEVMETHOD(device_attach, localbus_attach), + DEVMETHOD(device_detach, bus_generic_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + + /* Bus interface */ + DEVMETHOD(bus_print_child, localbus_print_child), + DEVMETHOD(bus_alloc_resource, localbus_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + DEVMETHOD(bus_get_resource_list, localbus_get_resource_list), + + /* OFW bus interface */ + DEVMETHOD(ofw_bus_get_devinfo, localbus_get_devinfo), + DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), + DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), + DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), + DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), + DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), + + { 0, 0 } +}; + +static driver_t localbus_driver = { + "localbus", + localbus_methods, + sizeof(struct localbus_softc) +}; + +const struct localbus_va_entry localbus_virtmap[] = { + { 0, MV_DEV_BOOT_BASE, MV_DEV_BOOT_SIZE }, + { 1, MV_DEV_CS0_BASE, MV_DEV_CS0_SIZE }, + { 2, MV_DEV_CS1_BASE, MV_DEV_CS1_SIZE }, + { 3, MV_DEV_CS2_BASE, MV_DEV_CS2_SIZE }, + + { -1, 0, 0 } +}; + +static struct localbus_bank localbus_banks[MV_LOCALBUS_MAX_BANKS]; + +devclass_t localbus_devclass; + +DRIVER_MODULE(localbus, fdtbus, localbus_driver, localbus_devclass, 0, 0); + +static int +fdt_localbus_reg_decode(phandle_t node, struct localbus_softc *sc, + struct localbus_devinfo *di) +{ + u_long start, end, count; + pcell_t *reg, *regptr; + pcell_t addr_cells, size_cells; + int tuple_size, tuples; + int i, rv, bank; + + if (fdt_addrsize_cells(OF_parent(node), &addr_cells, &size_cells) != 0) + return (ENXIO); + + tuple_size = sizeof(pcell_t) * (addr_cells + size_cells); + tuples = OF_getprop_alloc(node, "reg", tuple_size, (void **)®); + debugf("addr_cells = %d, size_cells = %d\n", addr_cells, size_cells); + debugf("tuples = %d, tuple size = %d\n", tuples, tuple_size); + if (tuples <= 0) + /* No 'reg' property in this node. */ + return (0); + + regptr = reg; + for (i = 0; i < tuples; i++) { + + bank = fdt_data_get((void *)regptr, 1); + + if (bank >= MV_LOCALBUS_MAX_BANKS) { + device_printf(sc->sc_dev, "bank number [%d] out of " + "range\n", bank); + continue; + } + + /* + * If device doesn't have virtual to physical mapping don't add + * resources + */ + if (!(sc->sc_banks[bank].mapped)) { + device_printf(sc->sc_dev, "device [%d]: missing memory " + "mapping\n", bank); + continue; + } + + di->di_bank = bank; + regptr += 1; + + /* Get address/size. */ + rv = fdt_data_to_res(regptr, addr_cells - 1, size_cells, &start, + &count); + if (rv != 0) { + resource_list_free(&di->di_res); + goto out; + } + + /* Check if enough amount of memory is mapped */ + if (sc->sc_banks[bank].size < count) { + device_printf(sc->sc_dev, "device [%d]: not enough " + "memory reserved\n", bank); + continue; + } + + regptr += addr_cells - 1 + size_cells; + + /* Calculate address range relative to VA base. */ + start = sc->sc_banks[bank].va + start; + end = start + count - 1; + + debugf("reg addr bank = %d, start = %lx, end = %lx, " + "count = %lx\n", bank, start, end, count); + + /* Use bank (CS) cell as rid. */ + resource_list_add(&di->di_res, SYS_RES_MEMORY, di->di_bank, + start, end, count); + } + rv = 0; +out: + free(reg, M_OFWPROP); + return (rv); +} + +static int +localbus_probe(device_t dev) +{ + + if (!ofw_bus_is_compatible_strict(dev, "mrvl,lbc")) + return (ENXIO); + + device_set_desc(dev, "Marvell device bus"); + + return (BUS_PROBE_DEFAULT); +} + +static int +localbus_attach(device_t dev) +{ + device_t dev_child; + struct localbus_softc *sc; + struct localbus_devinfo *di; + phandle_t dt_node, dt_child; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_banks = localbus_banks; + + /* + * Walk localbus and add direct subordinates as our children. + */ + dt_node = ofw_bus_get_node(dev); + for (dt_child = OF_child(dt_node); dt_child != 0; + dt_child = OF_peer(dt_child)) { + + /* Check and process 'status' property. */ + if (!(fdt_is_enabled(dt_child))) + continue; + + if (!(fdt_pm_is_enabled(dt_child))) + continue; + + di = malloc(sizeof(*di), M_LOCALBUS, M_WAITOK | M_ZERO); + if (ofw_bus_gen_setup_devinfo(&di->di_ofw, dt_child) != 0) { + free(di, M_LOCALBUS); + device_printf(dev, "could not set up devinfo\n"); + continue; + } + + resource_list_init(&di->di_res); + if (fdt_localbus_reg_decode(dt_child, sc, di)) { + device_printf(dev, "could not process 'reg' " + "property\n"); + ofw_bus_gen_destroy_devinfo(&di->di_ofw); + free(di, M_LOCALBUS); + continue; + } + + /* Add newbus device for this FDT node */ + dev_child = device_add_child(dev, NULL, -1); + if (dev_child == NULL) { + device_printf(dev, "could not add child: %s\n", + di->di_ofw.obd_name); + resource_list_free(&di->di_res); + ofw_bus_gen_destroy_devinfo(&di->di_ofw); + free(di, M_LOCALBUS); + continue; + } +#ifdef DEBUG + device_printf(dev, "added child: %s\n\n", di->di_ofw.obd_name); +#endif + device_set_ivars(dev_child, di); + } + + return (bus_generic_attach(dev)); +} + +static int +localbus_print_child(device_t dev, device_t child) +{ + struct localbus_devinfo *di; + struct resource_list *rl; + int rv; + + di = device_get_ivars(child); + rl = &di->di_res; + + rv = 0; + rv += bus_print_child_header(dev, child); + rv += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#lx"); + rv += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%ld"); + rv += bus_print_child_footer(dev, child); + + return (rv); +} + +static struct resource * +localbus_alloc_resource(device_t bus, device_t child, int type, int *rid, + u_long start, u_long end, u_long count, u_int flags) +{ + struct localbus_devinfo *di; + struct resource_list_entry *rle; + + /* + * Request for the default allocation with a given rid: use resource + * list stored in the local device info. + */ + if ((start == 0UL) && (end == ~0UL)) { + if ((di = device_get_ivars(child)) == NULL) + return (NULL); + + if (type == SYS_RES_IOPORT) + type = SYS_RES_MEMORY; + + rid = &di->di_bank; + rle = resource_list_find(&di->di_res, type, *rid); + if (rle == NULL) { + device_printf(bus, "no default resources for " + "rid = %d, type = %d\n", *rid, type); + return (NULL); + } + start = rle->start; + end = rle->end; + count = rle->count; + } + + return (bus_generic_alloc_resource(bus, child, type, rid, start, end, + count, flags)); +} + + +static struct resource_list * +localbus_get_resource_list(device_t bus, device_t child) +{ + struct localbus_devinfo *di; + + di = device_get_ivars(child); + return (&di->di_res); +} + +static const struct ofw_bus_devinfo * +localbus_get_devinfo(device_t bus, device_t child) +{ + struct localbus_devinfo *di; + + di = device_get_ivars(child); + return (&di->di_ofw); +} + +int +fdt_localbus_devmap(phandle_t dt_node, struct pmap_devmap *fdt_devmap, + int banks_max_num, int *banks_added) +{ + pcell_t ranges[MV_LOCALBUS_MAX_BANKS * MV_LOCALBUS_MAX_BANK_CELLS]; + pcell_t *rangesptr; + uint32_t tuple_size, bank; + vm_paddr_t offset; + vm_size_t size; + int dev_num, addr_cells, size_cells, par_addr_cells, va_index, i, j, k; + + if ((fdt_addrsize_cells(dt_node, &addr_cells, &size_cells)) != 0) + return (EINVAL); + + par_addr_cells = fdt_parent_addr_cells(dt_node); + if (par_addr_cells > 2) { + /* + * Localbus devmap initialization error: unsupported parent + * #addr-cells + */ + return (ERANGE); + } + + tuple_size = (addr_cells + par_addr_cells + size_cells); + if (tuple_size > MV_LOCALBUS_MAX_BANK_CELLS) + return (ERANGE); + + tuple_size *= sizeof(pcell_t); + + dev_num = OF_getprop(dt_node, "ranges", ranges, sizeof(ranges)); + if (dev_num <= 0) + return (EINVAL); + + /* Calculate number of devices attached to bus */ + dev_num = dev_num / tuple_size; + + /* + * If number of ranges > max number of localbus devices, + * additional entries will not be processed + */ + dev_num = MIN(dev_num, banks_max_num); + + rangesptr = &ranges[0]; + j = 0; + + /* Process data from FDT */ + for (i = 0; i < dev_num; i++) { + + /* First field is bank number */ + bank = fdt_data_get((void *)rangesptr, 1); + rangesptr += 1; + + if (bank < 0 || bank > MV_LOCALBUS_MAX_BANKS) { + /* Bank out of range */ + rangesptr += ((addr_cells - 1) + par_addr_cells + + size_cells); + continue; + } + + /* Find virtmap entry for this bank */ + va_index = -1; + for (k = 0; localbus_virtmap[k].bank >= 0; k++) { + if (localbus_virtmap[k].bank == bank) { + va_index = k; + break; + } + } + + /* Check if virtmap entry was found */ + if (va_index == -1) { + rangesptr += ((addr_cells - 1) + par_addr_cells + + size_cells); + continue; + } + + /* Remaining child's address fields are unused */ + rangesptr += (addr_cells - 1); + + /* Parent address offset */ + offset = fdt_data_get((void *)rangesptr, par_addr_cells); + rangesptr += par_addr_cells; + + /* Last field is size */ + size = fdt_data_get((void *)rangesptr, size_cells); + rangesptr += size_cells; + + if (size > localbus_virtmap[va_index].size) { + /* Not enough space reserved in virtual memory map */ + continue; + } + + fdt_devmap[j].pd_va = localbus_virtmap[va_index].va; + fdt_devmap[j].pd_pa = offset; + fdt_devmap[j].pd_size = size; + fdt_devmap[j].pd_prot = VM_PROT_READ | VM_PROT_WRITE; + fdt_devmap[j].pd_cache = PTE_NOCACHE; + + /* Copy data to structure used by localbus driver */ + localbus_banks[bank].va = fdt_devmap[j].pd_va; + localbus_banks[bank].pa = fdt_devmap[j].pd_pa; + localbus_banks[bank].size = fdt_devmap[j].pd_size; + localbus_banks[bank].mapped = 1; + + j++; + } + + *banks_added = j; + return (0); +} From owner-svn-src-user@FreeBSD.ORG Thu Jun 28 05:48:58 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7FFC106564A; Thu, 28 Jun 2012 05:48:58 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C330D8FC12; Thu, 28 Jun 2012 05:48:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5S5mwp2055324; Thu, 28 Jun 2012 05:48:58 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5S5mwxZ055322; Thu, 28 Jun 2012 05:48:58 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206280548.q5S5mwxZ055322@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 28 Jun 2012 05:48:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237685 - user/ae/bootcode/sys/boot/i386/pmbr X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 05:48:58 -0000 Author: ae Date: Thu Jun 28 05:48:58 2012 New Revision: 237685 URL: http://svn.freebsd.org/changeset/base/237685 Log: Revert r237294. Requested by: jhb Modified: user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s Modified: user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s ============================================================================== --- user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s Thu Jun 28 05:42:04 2012 (r237684) +++ user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s Thu Jun 28 05:48:58 2012 (r237685) @@ -255,16 +255,6 @@ boot_uuid: .long 0x83bd6b9d .org DISKSIG,0x90 sig: .long 0 # OS Disk Signature .word 0 # "Unknown" in PMBR - # Partition table -partbl: .byte 0x80 # bootable flag - .byte 0x00 # CHS address - .byte 0x02 # of first - .byte 0x00 # sector - .byte 0xee # Partition type PMBR - .byte 0xff # CHS address - .byte 0xff # of last - .byte 0xff # sector - .long 1 # LBA of first sector - .long 0xffffffff # LBA of last sector - .fill 0x10,0x3,0x0 # Remaining partition records + +partbl: .fill 0x10,0x4,0x0 # Partition table .word MAGIC # Magic number From owner-svn-src-user@FreeBSD.ORG Thu Jun 28 06:13:52 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C836F106564A; Thu, 28 Jun 2012 06:13:52 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B2988FC0C; Thu, 28 Jun 2012 06:13:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5S6DqTZ056356; Thu, 28 Jun 2012 06:13:52 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5S6DqQu056355; Thu, 28 Jun 2012 06:13:52 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201206280613.q5S6DqQu056355@svn.freebsd.org> From: Alan Cox Date: Thu, 28 Jun 2012 06:13:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237686 - user/alc/pvh_global_lock X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 06:13:52 -0000 Author: alc Date: Thu Jun 28 06:13:52 2012 New Revision: 237686 URL: http://svn.freebsd.org/changeset/base/237686 Log: Retire this branch. Similar changes have been committed to HEAD. Deleted: user/alc/pvh_global_lock/ From owner-svn-src-user@FreeBSD.ORG Thu Jun 28 06:58:12 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D89231065677; Thu, 28 Jun 2012 06:58:12 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A9C318FC14; Thu, 28 Jun 2012 06:58:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5S6wCUk058238; Thu, 28 Jun 2012 06:58:12 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5S6wCu0058234; Thu, 28 Jun 2012 06:58:12 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206280658.q5S6wCu0058234@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 28 Jun 2012 06:58:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237688 - in user/ae/bootcode/sys/boot: common i386/pmbr X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 06:58:13 -0000 Author: ae Date: Thu Jun 28 06:58:12 2012 New Revision: 237688 URL: http://svn.freebsd.org/changeset/base/237688 Log: Don't try to detect GEOM's signature in the last sector. This is the path to the Dark Side. Discussed with: marcel Modified: user/ae/bootcode/sys/boot/common/part.c user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s Modified: user/ae/bootcode/sys/boot/common/part.c ============================================================================== --- user/ae/bootcode/sys/boot/common/part.c Thu Jun 28 06:49:04 2012 (r237687) +++ user/ae/bootcode/sys/boot/common/part.c Thu Jun 28 06:58:12 2012 (r237688) @@ -256,24 +256,12 @@ ptable_gptread(struct ptable *table, voi } } offset = pri ? hdr.hdr_lba_alt: table->sectors - 1; - while (offset > 0) { - /* Read the backup GPT header. */ - if (dread(dev, buf, 1, offset) != 0) { - phdr = NULL; - break; - } + /* Read the backup GPT header. */ + if (dread(dev, buf, 1, offset) != 0) + phdr = NULL; + else phdr = gpt_checkhdr((struct gpt_hdr *)buf, offset, table->sectors, table->sectorsize); - if (phdr != NULL) - break; - /* - * Skip GEOM metadata and try to read backup - * GPT header again. - */ - if (memcmp(buf, GEOM_MAGIC, sizeof(GEOM_MAGIC) - 1) != 0) - break; - offset--; - } if (phdr != NULL) { /* * Compare primary and backup headers. Modified: user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s ============================================================================== --- user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s Thu Jun 28 06:49:04 2012 (r237687) +++ user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s Thu Jun 28 06:58:12 2012 (r237688) @@ -44,7 +44,6 @@ .set GPT_SIG,0 .set GPT_SIG_0,0x20494645 # "EFI " .set GPT_SIG_1,0x54524150 # "PART" - .set GEOM_MAGIC,0x4d4f4547 # "GEOM" .set GPT_MYLBA,24 .set GPT_PART_LBA,72 .set GPT_NPART,80 @@ -109,19 +108,13 @@ main.2a: movw $GPT_ADDR,%bx jnz main.2b jmp load_part main.2b: cmpb $1,%dh # Reading primary? - je main.3 # Try backup if yes - cmpl $GEOM_MAGIC,GPT_ADDR # GEOM sig at backup location? - jz main.3 # Skip GEOM metadata - jmp err_pt # Invalid table found + jne err_pt # If no - invalid table found # # Try alternative LBAs from the last sector for the GPT header. # main.3: movb $0,%dh # %dh := 0 (reading backup) movw $DPBUF+DPBUF_SEC,%si # %si = last sector + 1 movw $lba,%di # %di = $lba - cmpl $0,(%si) # - jnz main.3a # - decl 0x4(%si) # 0x4(%si) = last sec (32-64) main.3a: decl (%si) # 0x0(%si) = last sec (0-31) movw $2,%cx rep From owner-svn-src-user@FreeBSD.ORG Thu Jun 28 10:40:58 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 422EC106564A; Thu, 28 Jun 2012 10:40:58 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E79B8FC1D; Thu, 28 Jun 2012 10:40:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5SAewSx071271; Thu, 28 Jun 2012 10:40:58 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5SAev56071269; Thu, 28 Jun 2012 10:40:57 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206281040.q5SAev56071269@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 28 Jun 2012 10:40:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237702 - user/ae/bootcode/sys/boot/userboot/userboot X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 10:40:58 -0000 Author: ae Date: Thu Jun 28 10:40:57 2012 New Revision: 237702 URL: http://svn.freebsd.org/changeset/base/237702 Log: Don't forget call disk_close() on disk closing. Modified: user/ae/bootcode/sys/boot/userboot/userboot/userboot_disk.c Modified: user/ae/bootcode/sys/boot/userboot/userboot/userboot_disk.c ============================================================================== --- user/ae/bootcode/sys/boot/userboot/userboot/userboot_disk.c Thu Jun 28 10:21:25 2012 (r237701) +++ user/ae/bootcode/sys/boot/userboot/userboot/userboot_disk.c Thu Jun 28 10:40:57 2012 (r237702) @@ -132,8 +132,10 @@ userdisk_open(struct open_file *f, ...) static int userdisk_close(struct open_file *f) { + struct disk_devdesc *dev; - return(0); + dev = (struct disk_devdesc *)f->f_devdata; + return (disk_close(dev)); } static int From owner-svn-src-user@FreeBSD.ORG Thu Jun 28 11:46:15 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 103C0106566B; Thu, 28 Jun 2012 11:46:15 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED8E78FC15; Thu, 28 Jun 2012 11:46:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5SBkEHX073962; Thu, 28 Jun 2012 11:46:14 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5SBkEpU073955; Thu, 28 Jun 2012 11:46:14 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206281146.q5SBkEpU073955@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 28 Jun 2012 11:46:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237704 - in user/ae/bootcode/sys/boot: powerpc/uboot uboot/common uboot/lib X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 11:46:15 -0000 Author: ae Date: Thu Jun 28 11:46:14 2012 New Revision: 237704 URL: http://svn.freebsd.org/changeset/base/237704 Log: Rename uboot's disk.c into storage.c. Use new API in the uboot's disk driver to get access to partition tables. Added: user/ae/bootcode/sys/boot/uboot/lib/storage.c - copied, changed from r237683, user/ae/bootcode/sys/boot/uboot/lib/disk.c Deleted: user/ae/bootcode/sys/boot/uboot/lib/disk.c Modified: user/ae/bootcode/sys/boot/powerpc/uboot/Makefile user/ae/bootcode/sys/boot/uboot/common/main.c user/ae/bootcode/sys/boot/uboot/lib/Makefile user/ae/bootcode/sys/boot/uboot/lib/devicename.c user/ae/bootcode/sys/boot/uboot/lib/libuboot.h Modified: user/ae/bootcode/sys/boot/powerpc/uboot/Makefile ============================================================================== --- user/ae/bootcode/sys/boot/powerpc/uboot/Makefile Thu Jun 28 11:15:48 2012 (r237703) +++ user/ae/bootcode/sys/boot/powerpc/uboot/Makefile Thu Jun 28 11:46:14 2012 (r237704) @@ -29,6 +29,12 @@ LOADER_FDT_SUPPORT= no .if ${LOADER_DISK_SUPPORT} == "yes" CFLAGS+= -DLOADER_DISK_SUPPORT +.if !defined(LOADER_NO_MBR_SUPPORT) +CFLAGS+= -DLOADER_MBR_SUPPORT +.endif +.if !defined(LOADER_NO_GPT_SUPPORT) +CFLAGS+= -DLOADER_GPT_SUPPORT +.endif .endif .if ${LOADER_UFS_SUPPORT} == "yes" CFLAGS+= -DLOADER_UFS_SUPPORT Modified: user/ae/bootcode/sys/boot/uboot/common/main.c ============================================================================== --- user/ae/bootcode/sys/boot/uboot/common/main.c Thu Jun 28 11:15:48 2012 (r237703) +++ user/ae/bootcode/sys/boot/uboot/common/main.c Thu Jun 28 11:46:14 2012 (r237704) @@ -185,7 +185,7 @@ main(void) if (strncmp(devsw[i]->dv_name, "disk", strlen(devsw[i]->dv_name)) == 0) { f.f_devdata = &currdev; - currdev.d_disk.pnum = 0; + currdev.d_kind.disk.slice = 0; if (devsw[i]->dv_open(&f,&currdev) == 0) break; } Modified: user/ae/bootcode/sys/boot/uboot/lib/Makefile ============================================================================== --- user/ae/bootcode/sys/boot/uboot/lib/Makefile Thu Jun 28 11:15:48 2012 (r237703) +++ user/ae/bootcode/sys/boot/uboot/lib/Makefile Thu Jun 28 11:46:14 2012 (r237704) @@ -6,8 +6,8 @@ LIB= uboot INTERNALLIB= WARNS?= 2 -SRCS= crc32.c console.c copy.c devicename.c disk.c elf_freebsd.c glue.c -SRCS+= module.c net.c reboot.c time.c +SRCS= crc32.c console.c copy.c devicename.c elf_freebsd.c glue.c +SRCS+= module.c net.c reboot.c storage.c time.c CFLAGS+= -ffreestanding -msoft-float Modified: user/ae/bootcode/sys/boot/uboot/lib/devicename.c ============================================================================== --- user/ae/bootcode/sys/boot/uboot/lib/devicename.c Thu Jun 28 11:15:48 2012 (r237703) +++ user/ae/bootcode/sys/boot/uboot/lib/devicename.c Thu Jun 28 11:46:14 2012 (r237704) @@ -27,12 +27,11 @@ #include __FBSDID("$FreeBSD$"); -#include - #include #include #include "bootstrap.h" +#include "disk.h" #include "libuboot.h" static int uboot_parsedev(struct uboot_devdesc **dev, const char *devspec, @@ -90,7 +89,7 @@ uboot_parsedev(struct uboot_devdesc **de struct devsw *dv; char *cp; const char *np; - int i, unit, pnum, ptype, err; + int i, unit, err; /* minimum length check */ if (strlen(devspec) < 2) @@ -115,49 +114,9 @@ uboot_parsedev(struct uboot_devdesc **de break; case DEVT_DISK: - unit = -1; - pnum = -1; - ptype = -1; - if (*np && (*np != ':')) { - /* next comes the unit number */ - unit = strtol(np, &cp, 10); - if (cp == np) { - err = EUNIT; - goto fail; - } - if (*cp && (*cp != ':')) { - /* get partition */ - if (*cp == 'p' && *(cp + 1) && - *(cp + 1) != ':') { - pnum = strtol(cp + 1, &cp, 10); - ptype = PTYPE_GPT; - } else if (*cp == 's' && *(cp + 1) && - *(cp + 1) != ':') { - pnum = strtol(cp + 1, &cp, 10); - ptype = PTYPE_MBR; - } else { - pnum = *cp - 'a'; - ptype = PTYPE_BSDLABEL; - if ((pnum < 0) || - (pnum >= MAXPARTITIONS)) { - err = EPART; - goto fail; - } - cp++; - } - } - } - if (*cp && (*cp != ':')) { - err = EINVAL; + err = disk_parsedev((struct disk_devdesc *)idev, np, path); + if (err != 0) goto fail; - } - - idev->d_unit = unit; - idev->d_disk.pnum = pnum; - idev->d_disk.ptype = ptype; - idev->d_disk.data = NULL; - if (path != NULL) - *path = (*cp == 0) ? cp : cp + 1; break; case DEVT_NET: @@ -204,7 +163,6 @@ char * uboot_fmtdev(void *vdev) { struct uboot_devdesc *dev = (struct uboot_devdesc *)vdev; - char *cp; static char buf[128]; switch(dev->d_type) { @@ -213,22 +171,7 @@ uboot_fmtdev(void *vdev) break; case DEVT_DISK: - cp = buf; - cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_unit); - if (dev->d_kind.disk.pnum >= 0) { - if (dev->d_kind.disk.ptype == PTYPE_BSDLABEL) - cp += sprintf(cp, "%c", - dev->d_kind.disk.pnum + 'a'); - else if (dev->d_kind.disk.ptype == PTYPE_GPT) - cp += sprintf(cp, "p%i", - dev->d_kind.disk.pnum); - else if (dev->d_kind.disk.ptype == PTYPE_MBR) - cp += sprintf(cp, "s%i", - dev->d_kind.disk.pnum); - } - - strcat(cp, ":"); - break; + return (disk_fmtdev(vdev)); case DEVT_NET: sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); Modified: user/ae/bootcode/sys/boot/uboot/lib/libuboot.h ============================================================================== --- user/ae/bootcode/sys/boot/uboot/lib/libuboot.h Thu Jun 28 11:15:48 2012 (r237703) +++ user/ae/bootcode/sys/boot/uboot/lib/libuboot.h Thu Jun 28 11:46:14 2012 (r237704) @@ -35,18 +35,13 @@ struct uboot_devdesc union { struct { void *data; - int pnum; - int ptype; + int slice; + int partition; + off_t offset; } disk; } d_kind; }; -#define d_disk d_kind.disk - -#define PTYPE_BSDLABEL 1 -#define PTYPE_GPT 2 -#define PTYPE_MBR 3 - /* * Default network packet alignment in memory */ Copied and modified: user/ae/bootcode/sys/boot/uboot/lib/storage.c (from r237683, user/ae/bootcode/sys/boot/uboot/lib/disk.c) ============================================================================== --- user/ae/bootcode/sys/boot/uboot/lib/disk.c Thu Jun 28 03:48:54 2012 (r237683, copy source) +++ user/ae/bootcode/sys/boot/uboot/lib/storage.c Thu Jun 28 11:46:14 2012 (r237704) @@ -34,20 +34,14 @@ __FBSDID("$FreeBSD$"); #include -#include -#include +#include #include #include #include -#include - -#define FSTYPENAMES -#include -#include -#include #include "api_public.h" #include "bootstrap.h" +#include "disk.h" #include "glue.h" #include "libuboot.h" @@ -66,51 +60,28 @@ __FBSDID("$FreeBSD$"); #define debugf(fmt, args...) #endif -struct gpt_part { - int gp_index; - uuid_t gp_type; - uint64_t gp_start; - uint64_t gp_end; -}; +static struct { + int opened; /* device open count */ + int handle; /* storage device handle */ + int type; /* storage type */ + off_t blocks; /* block count */ + u_int bsize; /* block size */ +} stor_info[UB_MAX_DEV]; -struct open_dev { - int od_bsize; /* block size */ - int od_bstart; /* start block offset from beginning of disk */ - union { - struct { - struct disklabel bsdlabel; - } _bsd; - struct { - struct gpt_part *gpt_partitions; - int gpt_nparts; - } _gpt; - } _data; -}; +#define SI(dev) (stor_info[(dev)->d_unit]) -#define od_bsdlabel _data._bsd.bsdlabel -#define od_nparts _data._gpt.gpt_nparts -#define od_partitions _data._gpt.gpt_partitions - -static uuid_t efi = GPT_ENT_TYPE_EFI; -static uuid_t freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT; -static uuid_t freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS; -static uuid_t freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP; -static uuid_t freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS; -static uuid_t ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA; - -static int stor_info[UB_MAX_DEV]; static int stor_info_no = 0; -static int stor_opendev(struct open_dev **, struct uboot_devdesc *); -static int stor_closedev(struct uboot_devdesc *); -static int stor_readdev(struct uboot_devdesc *, daddr_t, size_t, char *); -static int stor_open_count = 0; +static int stor_opendev(struct disk_devdesc *); +static int stor_readdev(struct disk_devdesc *, daddr_t, size_t, char *); /* devsw I/F */ static int stor_init(void); static int stor_strategy(void *, int, daddr_t, size_t, char *, size_t *); static int stor_open(struct open_file *, ...); static int stor_close(struct open_file *); +static int stor_ioctl(struct open_file *f, u_long cmd, void *data); static void stor_print(int); +static void stor_cleanup(void); struct devsw uboot_storage = { "disk", @@ -119,24 +90,16 @@ struct devsw uboot_storage = { stor_strategy, stor_open, stor_close, - noioctl, - stor_print + stor_ioctl, + stor_print, + stor_cleanup }; -static void -uuid_letoh(uuid_t *uuid) -{ - - uuid->time_low = le32toh(uuid->time_low); - uuid->time_mid = le16toh(uuid->time_mid); - uuid->time_hi_and_version = le16toh(uuid->time_hi_and_version); -} - static int stor_init(void) { struct device_info *di; - int i, found = 0; + int i; if (devs_no == 0) { printf("No U-Boot devices! Really enumerated?\n"); @@ -151,12 +114,17 @@ stor_init(void) stor_info_no); return (-1); } - stor_info[stor_info_no++] = i; - found = 1; + stor_info[stor_info_no++].handle = i; + stor_info[stor_info_no++].opened = 0; + stor_info[stor_info_no++].type = di->type; + stor_info[stor_info_no++].blocks = + di->di_stor.block_count; + stor_info[stor_info_no++].bsize = + di->di_stor.block_size; } } - if (!found) { + if (!stor_info_no) { debugf("No storage devices\n"); return (-1); } @@ -165,32 +133,39 @@ stor_init(void) return (0); } +static void +stor_cleanup(void) +{ + int i; + + for (i = 0; i < stor_info_no; i++) + if (stor_info[i].opened > 0) + ub_dev_close(stor_info[i].handle); +} + static int stor_strategy(void *devdata, int rw, daddr_t blk, size_t size, char *buf, size_t *rsize) { - struct uboot_devdesc *dev = (struct uboot_devdesc *)devdata; - struct open_dev *od = (struct open_dev *)dev->d_disk.data; - int bcount, err; - - debugf("od=%p, size=%d, bsize=%d\n", od, size, od->od_bsize); + struct disk_devdesc *dev = (struct disk_devdesc *)devdata; + daddr_t bcount; + int err; if (rw != F_READ) { stor_printf("write attempt, operation not supported!\n"); return (EROFS); } - if (size % od->od_bsize) { + if (size % SI(dev).bsize) { stor_printf("size=%d not multiple of device block size=%d\n", - size, od->od_bsize); + size, SI(dev).bsize); return (EIO); } - bcount = size / od->od_bsize; - + bcount = size / SI(dev).bsize; if (rsize) *rsize = 0; - err = stor_readdev(dev, blk + od->od_bstart, bcount, buf); + err = stor_readdev(dev, blk + dev->d_offset, bcount, buf); if (!err && rsize) *rsize = size; @@ -201,340 +176,54 @@ static int stor_open(struct open_file *f, ...) { va_list ap; - struct open_dev *od; - struct uboot_devdesc *dev; - int err; + struct disk_devdesc *dev; va_start(ap, f); - dev = va_arg(ap, struct uboot_devdesc *); + dev = va_arg(ap, struct disk_devdesc *); va_end(ap); - if ((err = stor_opendev(&od, dev)) != 0) - return (err); - - ((struct uboot_devdesc *)(f->f_devdata))->d_disk.data = od; - - return (0); -} - -static int -stor_close(struct open_file *f) -{ - struct uboot_devdesc *dev; - - dev = (struct uboot_devdesc *)(f->f_devdata); - - return (stor_closedev(dev)); + return (stor_opendev(dev)); } static int -stor_open_gpt(struct open_dev *od, struct uboot_devdesc *dev) +stor_opendev(struct disk_devdesc *dev) { - char *buf; - struct dos_partition *dp; - struct gpt_hdr *hdr; - struct gpt_ent *ent; - daddr_t slba, lba, elba; - int eps, part, i; - int err = 0; - - od->od_nparts = 0; - od->od_partitions = NULL; - - /* Devices with block size smaller than 512 bytes cannot use GPT */ - if (od->od_bsize < 512) - return (ENXIO); - - /* Allocate 1 block */ - buf = malloc(od->od_bsize); - if (!buf) { - stor_printf("could not allocate memory for GPT\n"); - return (ENOMEM); - } - - /* Read MBR */ - err = stor_readdev(dev, 0, 1, buf); - if (err) { - stor_printf("GPT read error=%d\n", err); - err = EIO; - goto out; - } - - /* Check the slice table magic. */ - if (le16toh(*((uint16_t *)(buf + DOSMAGICOFFSET))) != DOSMAGIC) { - err = ENXIO; - goto out; - } - - /* Check GPT slice */ - dp = (struct dos_partition *)(buf + DOSPARTOFF); - part = 0; - - for (i = 0; i < NDOSPART; i++) { - if (dp[i].dp_typ == 0xee) - part += 1; - else if (dp[i].dp_typ != 0x00) { - err = EINVAL; - goto out; - } - } - - if (part != 1) { - err = EINVAL; - goto out; - } - - /* Read primary GPT header */ - err = stor_readdev(dev, 1, 1, buf); - if (err) { - stor_printf("GPT read error=%d\n", err); - err = EIO; - goto out; - } - - hdr = (struct gpt_hdr *)buf; - - /* Check GPT header */ - if (bcmp(hdr->hdr_sig, GPT_HDR_SIG, sizeof(hdr->hdr_sig)) != 0 || - le64toh(hdr->hdr_lba_self) != 1 || - le32toh(hdr->hdr_revision) < 0x00010000 || - le32toh(hdr->hdr_entsz) < sizeof(*ent) || - od->od_bsize % le32toh(hdr->hdr_entsz) != 0) { - debugf("Invalid GPT header!\n"); - err = EINVAL; - goto out; - } - - /* Count number of valid partitions */ - part = 0; - eps = od->od_bsize / le32toh(hdr->hdr_entsz); - slba = le64toh(hdr->hdr_lba_table); - elba = slba + le32toh(hdr->hdr_entries) / eps; - - for (lba = slba; lba < elba; lba++) { - err = stor_readdev(dev, lba, 1, buf); - if (err) { - stor_printf("GPT read error=%d\n", err); - err = EIO; - goto out; - } - - ent = (struct gpt_ent *)buf; - - for (i = 0; i < eps; i++) { - if (uuid_is_nil(&ent[i].ent_type, NULL) || - le64toh(ent[i].ent_lba_start) == 0 || - le64toh(ent[i].ent_lba_end) < - le64toh(ent[i].ent_lba_start)) - continue; - - part += 1; - } - } - - /* Save information about partitions */ - if (part != 0) { - od->od_nparts = part; - od->od_partitions = malloc(part * sizeof(struct gpt_part)); - if (!od->od_partitions) { - stor_printf("could not allocate memory for GPT\n"); - err = ENOMEM; - goto out; - } - - part = 0; - for (lba = slba; lba < elba; lba++) { - err = stor_readdev(dev, lba, 1, buf); - if (err) { - stor_printf("GPT read error=%d\n", err); - err = EIO; - goto out; - } - - ent = (struct gpt_ent *)buf; - - for (i = 0; i < eps; i++) { - if (uuid_is_nil(&ent[i].ent_type, NULL) || - le64toh(ent[i].ent_lba_start) == 0 || - le64toh(ent[i].ent_lba_end) < - le64toh(ent[i].ent_lba_start)) - continue; - - od->od_partitions[part].gp_index = (lba - slba) - * eps + i + 1; - od->od_partitions[part].gp_type = - ent[i].ent_type; - od->od_partitions[part].gp_start = - le64toh(ent[i].ent_lba_start); - od->od_partitions[part].gp_end = - le64toh(ent[i].ent_lba_end); - - uuid_letoh(&od->od_partitions[part].gp_type); - part += 1; - } - } - } - - dev->d_disk.ptype = PTYPE_GPT; - /* - * If index of partition to open (dev->d_disk.pnum) is not defined - * we set it to the index of the first existing partition. This - * handles cases when only a disk device is specified (without full - * partition information) by the caller. - */ - if ((od->od_nparts > 0) && (dev->d_disk.pnum == 0)) - dev->d_disk.pnum = od->od_partitions[0].gp_index; - - for (i = 0; i < od->od_nparts; i++) - if (od->od_partitions[i].gp_index == dev->d_disk.pnum) - od->od_bstart = od->od_partitions[i].gp_start; - -out: - if (err && od->od_partitions) - free(od->od_partitions); - - free(buf); - return (err); -} - -static int -stor_open_mbr(struct open_dev *od, struct uboot_devdesc *dev) -{ - char *buf = NULL; - struct dos_partition *dp; - int err, i, part; - - od->od_nparts = 0; - od->od_partitions = NULL; - - /* Block size must be at least 512 bytes. */ - if (od->od_bsize < 512) - return (ENXIO); - - /* Read MBR */ - buf = malloc(od->od_bsize); - if (!buf) { - stor_printf("could not allocate memory for MBR\n"); - return (ENOMEM); - } - err = stor_readdev(dev, 0, 1, buf); - if (err) { - stor_printf("MBR read error=%d\n", err); - err = EIO; - goto out; - } - - /* Check the slice table magic. */ - if (le16toh(*((uint16_t *)(buf + DOSMAGICOFFSET))) != DOSMAGIC) { - err = ENXIO; - goto out; - } - - /* Save information about partitions. */ - dp = (struct dos_partition *)(buf + DOSPARTOFF); - od->od_partitions = calloc(NDOSPART, sizeof(struct gpt_part)); - if (!od->od_partitions) { - stor_printf("could not allocate memory for MBR partitions\n"); - err = ENOMEM; - goto out; - } + int err; - part = 0; - for (i = 0; i < NDOSPART; i++) { - u_int32_t start = le32dec(&dp[i].dp_start); - u_int32_t size = le32dec(&dp[i].dp_size); - uuid_t *u = NULL; - - /* Map MBR partition types to GPT partition types. */ - switch (dp[i].dp_typ) { - case DOSPTYP_386BSD: - u = &freebsd_ufs; - break; - /* XXX Other types XXX */ - } + if (dev->d_unit < 0 || dev->d_unit >= stor_info_no) + return (EIO); - if (u) { - od->od_partitions[part].gp_type = *u; - od->od_partitions[part].gp_index = i + 1; - od->od_partitions[part].gp_start = start; - od->od_partitions[part].gp_end = start + size; - part += 1; + if (SI(dev).opened == 0) { + err = ub_dev_open(SI(dev).handle); + if (err != 0) { + stor_printf("device open failed with error=%d, " + "handle=%d\n", err, SI(dev).handle); + return (ENXIO); } + SI(dev).opened++; } - od->od_nparts = part; - - if (od->od_nparts == 0) { - err = EINVAL; - goto out; - } - - dev->d_disk.ptype = PTYPE_MBR; - - /* XXX Be smarter here? XXX */ - if (dev->d_disk.pnum == 0) - dev->d_disk.pnum = od->od_partitions[0].gp_index; - - for (i = 0; i < od->od_nparts; i++) - if (od->od_partitions[i].gp_index == dev->d_disk.pnum) - od->od_bstart = od->od_partitions[i].gp_start; - -out: - if (err && od->od_partitions) - free(od->od_partitions); - free(buf); - return (err); + return (disk_open(dev, SI(dev).blocks * SI(dev).bsize, + SI(dev).bsize)); } static int -stor_open_bsdlabel(struct open_dev *od, struct uboot_devdesc *dev) +stor_close(struct open_file *f) { - char *buf; - struct disklabel *dl; - int err = 0; - - /* Allocate 1 block */ - buf = malloc(od->od_bsize); - if (!buf) { - stor_printf("could not allocate memory for disklabel\n"); - return (ENOMEM); - } + struct disk_devdesc *dev; - /* Read disklabel */ - err = stor_readdev(dev, LABELSECTOR, 1, buf); - if (err) { - stor_printf("disklabel read error=%d\n", err); - err = ERDLAB; - goto out; - } - bcopy(buf + LABELOFFSET, &od->od_bsdlabel, sizeof(struct disklabel)); - dl = &od->od_bsdlabel; - - if (dl->d_magic != DISKMAGIC) { - stor_printf("no disklabel magic!\n"); - err = EUNLAB; - goto out; - } - - od->od_bstart = dl->d_partitions[dev->d_disk.pnum].p_offset; - dev->d_disk.ptype = PTYPE_BSDLABEL; - - debugf("bstart=%d\n", od->od_bstart); - -out: - free(buf); - return (err); + dev = (struct disk_devdesc *)(f->f_devdata); + return (disk_close(dev)); } static int -stor_readdev(struct uboot_devdesc *dev, daddr_t blk, size_t size, char *buf) +stor_readdev(struct disk_devdesc *dev, daddr_t blk, size_t size, char *buf) { lbasize_t real_size; - int err, handle; + int err; debugf("reading blk=%d size=%d @ 0x%08x\n", (int)blk, size, (uint32_t)buf); - handle = stor_info[dev->d_unit]; - err = ub_dev_read(handle, buf, size, blk, &real_size); + err = ub_dev_read(SI(dev).handle, buf, size, blk, &real_size); if (err != 0) { stor_printf("read failed, error=%d\n", err); return (EIO); @@ -549,228 +238,46 @@ stor_readdev(struct uboot_devdesc *dev, } -static int -stor_opendev(struct open_dev **odp, struct uboot_devdesc *dev) -{ - struct device_info *di; - struct open_dev *od; - int err, h; - - h = stor_info[dev->d_unit]; - - debugf("refcount=%d\n", stor_open_count); - - /* - * There can be recursive open calls from the infrastructure, but at - * U-Boot level open the device only the first time. - */ - if (stor_open_count > 0) - stor_open_count++; - else if ((err = ub_dev_open(h)) != 0) { - stor_printf("device open failed with error=%d, handle=%d\n", - err, h); - *odp = NULL; - return (ENXIO); - } - - if ((di = ub_dev_get(h)) == NULL) - panic("could not retrieve U-Boot device_info, handle=%d", h); - - if ((od = malloc(sizeof(struct open_dev))) == NULL) { - stor_printf("could not allocate memory for open_dev\n"); - return (ENOMEM); - } - od->od_bsize = di->di_stor.block_size; - od->od_bstart = 0; - - err = stor_open_gpt(od, dev); - if (err != 0) - err = stor_open_mbr(od, dev); - if (err != 0) - err = stor_open_bsdlabel(od, dev); - - if (err != 0) - free(od); - else { - stor_open_count = 1; - *odp = od; - } - - return (err); -} - -static int -stor_closedev(struct uboot_devdesc *dev) -{ - struct open_dev *od; - int err, h; - - od = (struct open_dev *)dev->d_disk.data; - if (dev->d_disk.ptype == PTYPE_GPT && od->od_nparts != 0) - free(od->od_partitions); - if (dev->d_disk.ptype == PTYPE_MBR && od->od_nparts != 0) - free(od->od_partitions); - - free(od); - dev->d_disk.data = NULL; - - if (--stor_open_count == 0) { - h = stor_info[dev->d_unit]; - if ((err = ub_dev_close(h)) != 0) { - stor_printf("device close failed with error=%d, " - "handle=%d\n", err, h); - return (ENXIO); - } - } - - return (0); -} - -/* Given a size in 512 byte sectors, convert it to a human-readable number. */ -/* XXX stolen from sys/boot/i386/libi386/biosdisk.c, should really be shared */ -static char * -display_size(uint64_t size) -{ - static char buf[80]; - char unit; - - size /= 2; - unit = 'K'; - if (size >= 10485760000LL) { - size /= 1073741824; - unit = 'T'; - } else if (size >= 10240000) { - size /= 1048576; - unit = 'G'; - } else if (size >= 10000) { - size /= 1024; - unit = 'M'; - } - sprintf(buf, "%.6ld%cB", (long)size, unit); - return (buf); -} - static void -stor_print_bsdlabel(struct uboot_devdesc *dev, char *prefix, int verbose) -{ - char buf[512], line[80]; - struct disklabel *dl; - uint32_t off, size; - int err, i, t; - - /* Read disklabel */ - err = stor_readdev(dev, LABELSECTOR, 1, buf); - if (err) { - sprintf(line, "%s%d: disklabel read error=%d\n", - dev->d_dev->dv_name, dev->d_unit, err); - pager_output(line); - return; - } - dl = (struct disklabel *)buf; - - if (dl->d_magic != DISKMAGIC) { - sprintf(line, "%s%d: no disklabel magic!\n", - dev->d_dev->dv_name, dev->d_unit); - pager_output(line); - return; - } - - /* Print partitions info */ - for (i = 0; i < dl->d_npartitions; i++) { - if ((t = dl->d_partitions[i].p_fstype) < FSMAXTYPES) { - - off = dl->d_partitions[i].p_offset; - size = dl->d_partitions[i].p_size; - if (fstypenames[t] == NULL || size == 0) - continue; - - if ((('a' + i) == 'c') && (!verbose)) - continue; - - sprintf(line, " %s%c: %s %s (%d - %d)\n", prefix, - 'a' + i, fstypenames[t], display_size(size), - off, off + size); - - pager_output(line); - } - } -} - -static void -stor_print_gpt(struct uboot_devdesc *dev, char *prefix, int verbose) +stor_print(int verbose) { - struct open_dev *od = (struct open_dev *)dev->d_disk.data; - struct gpt_part *gp; - char line[80]; - char *fs; + struct disk_devdesc dev; + static char line[80]; int i; - for (i = 0; i < od->od_nparts; i++) { - gp = &od->od_partitions[i]; - - if (uuid_equal(&gp->gp_type, &efi, NULL)) - fs = "EFI"; - else if (uuid_equal(&gp->gp_type, &ms_basic_data, NULL)) - fs = "FAT/NTFS"; - else if (uuid_equal(&gp->gp_type, &freebsd_boot, NULL)) - fs = "FreeBSD Boot"; - else if (uuid_equal(&gp->gp_type, &freebsd_ufs, NULL)) - fs = "FreeBSD UFS"; - else if (uuid_equal(&gp->gp_type, &freebsd_swap, NULL)) - fs = "FreeBSD Swap"; - else if (uuid_equal(&gp->gp_type, &freebsd_zfs, NULL)) - fs = "FreeBSD ZFS"; - else - fs = "unknown"; - - sprintf(line, " %sp%u: %s %s (%lld - %lld)\n", prefix, - gp->gp_index, fs, - display_size(gp->gp_end + 1 - gp->gp_start), gp->gp_start, - gp->gp_end); - + for (i = 0; i < stor_info_no; i++) { + dev.d_dev = &uboot_storage; + dev.d_unit = i; + dev.d_slice = -1; + dev.d_partition = -1; + sprintf(line, "\tdisk%d (%s)\n", i, + ub_stor_type(SI(&dev).type)); pager_output(line); + if (stor_opendev(&dev) == 0) { + sprintf(line, "\tdisk%d", i); + disk_print(&dev, line, verbose); + disk_close(&dev); + } } } -static void -stor_print_one(int i, struct device_info *di, int verbose) +static int +stor_ioctl(struct open_file *f, u_long cmd, void *data) { - struct uboot_devdesc dev; - struct open_dev *od; - char line[80]; - - sprintf(line, "\tdisk%d (%s)\n", i, ub_stor_type(di->type)); - pager_output(line); - - dev.d_dev = &uboot_storage; - dev.d_unit = i; - dev.d_disk.pnum = -1; - dev.d_disk.data = NULL; - - if (stor_opendev(&od, &dev) == 0) { - dev.d_disk.data = od; - - if (dev.d_disk.ptype == PTYPE_GPT) { - sprintf(line, "\t\tdisk%d", i); - stor_print_gpt(&dev, line, verbose); - } else if (dev.d_disk.ptype == PTYPE_BSDLABEL) { - sprintf(line, "\t\tdisk%d", i); - stor_print_bsdlabel(&dev, line, verbose); - } + struct disk_devdesc *dev; - stor_closedev(&dev); + dev = (struct disk_devdesc *)f->f_devdata; + switch (cmd) { + case DIOCGSECTORSIZE: + *(u_int *)data = SI(dev).bsize; + break; + case DIOCGMEDIASIZE: + *(off_t *)data = SI(dev).bsize * SI(dev).blocks; + break; + default: + return (ENOTTY); } + return (0); } -static void -stor_print(int verbose) -{ - struct device_info *di; - int i; - for (i = 0; i < stor_info_no; i++) { - di = ub_dev_get(stor_info[i]); - if (di != NULL) - stor_print_one(i, di, verbose); - } -} From owner-svn-src-user@FreeBSD.ORG Thu Jun 28 11:58:11 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 108E9106567E; Thu, 28 Jun 2012 11:58:11 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4E2B8FC14; Thu, 28 Jun 2012 11:58:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5SBwA5r074506; Thu, 28 Jun 2012 11:58:10 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5SBwACb074504; Thu, 28 Jun 2012 11:58:10 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206281158.q5SBwACb074504@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 28 Jun 2012 11:58:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237705 - user/ae/bootcode/sys/boot/uboot/lib X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 11:58:11 -0000 Author: ae Date: Thu Jun 28 11:58:10 2012 New Revision: 237705 URL: http://svn.freebsd.org/changeset/base/237705 Log: Fix copy/paste bug. Modified: user/ae/bootcode/sys/boot/uboot/lib/storage.c Modified: user/ae/bootcode/sys/boot/uboot/lib/storage.c ============================================================================== --- user/ae/bootcode/sys/boot/uboot/lib/storage.c Thu Jun 28 11:46:14 2012 (r237704) +++ user/ae/bootcode/sys/boot/uboot/lib/storage.c Thu Jun 28 11:58:10 2012 (r237705) @@ -114,13 +114,14 @@ stor_init(void) stor_info_no); return (-1); } - stor_info[stor_info_no++].handle = i; - stor_info[stor_info_no++].opened = 0; - stor_info[stor_info_no++].type = di->type; - stor_info[stor_info_no++].blocks = + stor_info[stor_info_no].handle = i; + stor_info[stor_info_no].opened = 0; + stor_info[stor_info_no].type = di->type; + stor_info[stor_info_no].blocks = di->di_stor.block_count; - stor_info[stor_info_no++].bsize = + stor_info[stor_info_no].bsize = di->di_stor.block_size; + stor_info_no++; } } From owner-svn-src-user@FreeBSD.ORG Fri Jun 29 08:39:30 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D9FC9106566B; Fri, 29 Jun 2012 08:39:30 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C5BD08FC0C; Fri, 29 Jun 2012 08:39:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5T8dUAD028950; Fri, 29 Jun 2012 08:39:30 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5T8dUx0028948; Fri, 29 Jun 2012 08:39:30 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206290839.q5T8dUx0028948@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 29 Jun 2012 08:39:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237749 - user/ae/bootcode/sys/boot/uboot/lib X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 08:39:31 -0000 Author: ae Date: Fri Jun 29 08:39:30 2012 New Revision: 237749 URL: http://svn.freebsd.org/changeset/base/237749 Log: is no longer needed. Modified: user/ae/bootcode/sys/boot/uboot/lib/storage.c Modified: user/ae/bootcode/sys/boot/uboot/lib/storage.c ============================================================================== --- user/ae/bootcode/sys/boot/uboot/lib/storage.c Fri Jun 29 07:35:37 2012 (r237748) +++ user/ae/bootcode/sys/boot/uboot/lib/storage.c Fri Jun 29 08:39:30 2012 (r237749) @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include From owner-svn-src-user@FreeBSD.ORG Fri Jun 29 08:41:14 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7CA99106564A; Fri, 29 Jun 2012 08:41:14 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 682058FC14; Fri, 29 Jun 2012 08:41:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5T8fEFB029061; Fri, 29 Jun 2012 08:41:14 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5T8fEnv029059; Fri, 29 Jun 2012 08:41:14 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206290841.q5T8fEnv029059@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 29 Jun 2012 08:41:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237750 - user/ae/bootcode/sys/boot/arm/uboot X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 08:41:14 -0000 Author: ae Date: Fri Jun 29 08:41:13 2012 New Revision: 237750 URL: http://svn.freebsd.org/changeset/base/237750 Log: Turn on the build of MBR and GPT support in the arm/uboot. Modified: user/ae/bootcode/sys/boot/arm/uboot/Makefile Modified: user/ae/bootcode/sys/boot/arm/uboot/Makefile ============================================================================== --- user/ae/bootcode/sys/boot/arm/uboot/Makefile Fri Jun 29 08:39:30 2012 (r237749) +++ user/ae/bootcode/sys/boot/arm/uboot/Makefile Fri Jun 29 08:41:13 2012 (r237750) @@ -36,6 +36,12 @@ LOADER_FDT_SUPPORT= no .if ${LOADER_DISK_SUPPORT} == "yes" CFLAGS+= -DLOADER_DISK_SUPPORT +.if !defined(LOADER_NO_MBR_SUPPORT) +CFLAGS+= -DLOADER_MBR_SUPPORT +.endif +.if !defined(LOADER_NO_GPT_SUPPORT) +CFLAGS+= -DLOADER_GPT_SUPPORT +.endif .endif .if ${LOADER_UFS_SUPPORT} == "yes" CFLAGS+= -DLOADER_UFS_SUPPORT